@kbss-cvut/s-forms 0.8.0 → 0.8.1-alpha-7ec5901.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 w,ButtonToolbar as y,Nav as L,NavItem as R,NavLink as D,Modal as V,Alert as H}from"react-bootstrap";import{jsx as M,jsxs as U}from"react/jsx-runtime";import{IntlProvider as j,useIntl as P}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 x from"react-datepicker";import{parse as q,format as k}from"date-fns";import z 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 F from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import"core-js/modules/web.timers.js";import Q from"inputmask-core";import{IntelligentTreeSelect as B}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 W from"javascript-time-ago";import X from"javascript-time-ago/locale/en";import G from"javascript-time-ago/locale/cs";import{motion as Y}from"framer-motion";import{Rings as K}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 J(){return J=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},J.apply(this,arguments)}function Z(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$(e,t)}function ee(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 te(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 ne(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 te(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)?te(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 oe,re=/*#__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}(),ie=["children"],ae=/*#__PURE__*/e.createContext({}),se=function(n){var o=n.children,r=ee(n,ie),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}):(re.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(ae.Provider,J({value:l},r),o)};se.propTypes={children:l.element.isRequired,fetchTypeAheadValues:l.func};var le=function(){};oe=le,le.COLUMN_COUNT=12,le.INPUT_LENGTH_THRESHOLD=50,le.DATETIME_NUMBER_FORMAT="x",le.EPOCH_MILLISECONDS="epoch-milliseconds",le.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",le.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",le.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",le.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",le.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",le.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",le.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",le.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",le.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",le.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"]},le.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",le.VALUE_TYPE_CODE="code",le.VALUE_TYPE_TEXT="text",le.GENERATED_ROW_SIZE=1,le.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",le.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",le.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",le.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",le.HELP_DESCRIPTION="http://purl.org/dc/elements/1.1/description",le.SOURCE="http://purl.org/dc/elements/1.1/source",le.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"},le.STEP="http://onto.fel.cvut.cz/ontologies/form/step",le.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",le.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",le.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",le.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",le.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",le.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",le.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",le.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",le.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",le.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",le.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",le.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",le.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",le.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",le.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",le.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",le.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",le.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",le.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",le.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",le.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",le.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",le.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",le.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",le.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",le.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",le.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",le.PREFIX="http://www.w3.org/ns/shacl#prefix",le.NAMESPACE="http://www.w3.org/ns/shacl#namespace",le.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",le.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",le.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",le.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",le.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",le.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",le.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",le.TIMESTAMP_FORMAT="http://onto.fel.cvut.cz/ontologies/form/timestamp-format",le.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",le.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",le.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",le.RDFS_LABEL=c.RDFS_LABEL,le.RDFS_COMMENT=c.RDFS_COMMENT,le.DEFAULT_HAS_CHILD=c.DEFAULT_HAS_CHILD,le.BROADER="http://www.w3.org/2004/02/skos/core#broader",le.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",le.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",le.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink"},le.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},le.DEFAULT_OPTIONS={icons:[{id:oe.ICONS.QUESTION_HELP,behavior:oe.ICON_BEHAVIOR.ENABLE},{id:oe.ICONS.QUESTION_COMMENTS,behavior:oe.ICON_BEHAVIOR.ON_HOVER},{id:oe.ICONS.QUESTION_LINK,behavior:oe.ICON_BEHAVIOR.ON_HOVER}]},le.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},le.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 ue=/*#__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[le.HAS_SUBQUESTION]);if(r)for(var s,l=ne(a);!(s=l()).done;){var u=e.findQuestionById(t,s.value,!0,!1,!1);if(u)return u}if(i)for(var c,p=ne(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}(),ce=/*#__PURE__*/function(){function e(){}return e.putObject=function(t,n){e.objectMap[t]=n},e.getObject=function(t){return e.objectMap[t]},e}();ce.objectMap={};var pe=/*#__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],ue.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}(),me=/*#__PURE__*/function(){function e(){}return e.isForm=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.FORM)},e.isWizardStep=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.WIZARD_STEP)},e.isSection=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.QUESTION_SECTION)},e.isAnswerable=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.ANSWERABLE)},e.isTypeahead=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.QUESTION_TYPEAHEAD)},e.getPossibleValuesQuery=function(e){return c.getJsonAttValue(e,le.HAS_OPTIONS_QUERY)},e.isDisabled=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.DISABLED)},e.isHidden=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.HIDDEN)},e.isTextarea=function(t,n){return n&&n.length>le.INPUT_LENGTH_THRESHOLD&&!e.isTypeahead(t)||c.hasValue(t,le.LAYOUT_CLASS,le.LAYOUT.TEXTAREA)},e.isText=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.TEXT)},e.isCalendar=function(t){return e.isDate(t)||e.isTime(t)||e.isDateTime(t)},e.isDate=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.DATE)},e.isTime=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.TIME)},e.isDateTime=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.DATETIME)},e.isTimestamp=function(e){return c.hasValue(e,le.TIMESTAMP_FORMAT,le.EPOCH_MILLISECONDS)},e.isCheckbox=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.CHECKBOX)},e.isMaskedInput=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.MASKED_INPUT)},e.isSparqlInput=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.SPARQL)},e.isTurtleInput=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.TURTLE)},e.isCollapsed=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.COLLAPSED)},e.isEmphasised=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.EMPHASISED)},e.getCategory=function(e){return le.LAYOUT.CATEGORY.find(function(t){return c.hasValue(e,le.LAYOUT_CLASS,t)})},e.resolveValue=function(e){return e?e[le.HAS_OBJECT_VALUE]?e[le.HAS_OBJECT_VALUE]["@id"]:c.getJsonAttValue(e,le.HAS_DATA_VALUE):null},e.resolveValueObject=function(e){return e?e[le.HAS_OBJECT_VALUE]?ue.asArray(e[le.HAS_OBJECT_VALUE])[0]:e[le.HAS_DATA_VALUE]?ue.asArray(e[le.HAS_DATA_VALUE])[0]:null:null},e.isRelevant=function(t){if(!t[le.IS_RELEVANT_IF])return!0;for(var n,o=ne(ue.asArray(t[le.IS_RELEVANT_IF]));!(n=o()).done;)if(!e.testCondition(n.value))return!1;return!0},e.hasValidationLogic=function(e){return!!(e[le.REQUIRES_ANSWER]||e[le.REQUIRES_ANSWER_IF]||e[le.PATTERN]||this.containsXSDProperty(e))},e.isValid=function(e){if(!1===e[le.HAS_VALID_ANSWER])return!1;for(var t,n=ne(ue.asArray(e[le.HAS_SUBQUESTION]));!(t=n()).done;)if(!1===this.isValid(t.value))return!1;return!0},e.testOrCondition=function(e){var t=e[le.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(var n,o=ne(this._getMappedObjectsArray(t));!(n=o()).done;)if(this.testCondition(n.value))return!0;return!1},e.testCondition=function(t){var n,o=t[le.ACCEPTS_VALIDATION_VALUE],r=t[le.ACCEPTS_ANSWER_VALUE],i=t[le.ACCEPTS],a=t[le.HAS_TESTED_QUESTION];if(t[le.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=ue.asArray(i);if(1!==s.length&&console.warn("Support for multiple accepts values is not implemented !"),s[0]["@id"]===le.ANSWERED_QUESTION){(r||o)&&console.warn("Support for accepted answer/validations values is not implemented !");for(var l,c=ne(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=ue.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=ne(ue.asArray(a));!(m=d()).done;){if(void 0===(n=ce.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=ce.getObject(a["@id"]);for(var f,h=ne(ue.asArray(r));!(f=h()).done;){var E=f.value;if(!n)return console.warn("Question is not defined."),!0;if(!n.hasOwnProperty(le.HAS_ANSWER))return!1;var v=u.getValues(n,le.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(pe.compareValues(S,E))return!0}}return!1},e._getMappedObjectsArray=function(e,t){return ue.asArray(e).map(function(e){var n=ce.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(le.HAS_ANSWER)){var n=u.getValues(t,le.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return!0}}for(var r,i=ne(ue.asArray(t[le.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(le.HAS_ANSWER)){var n=u.getValues(t,le.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=ne(ue.asArray(t[le.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=e.isDate(t),i=e.isTime(t),a=e.isDateTime(t);switch(!0){case r:return t[le.DATE_FORMAT]||o.dateFormat;case i:return t[le.TIME_FORMAT]||o.timeFormat;case a:return t[le.DATETIME_FORMAT]||o.dateTimeFormat;default:return null}},e.dfsTraverseQuestionTree=function(e,t,n){function o(e){t(e),ue.asArray(e[le.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[le.REQUIRES_ANSWER]&&!e[le.USED_ONLY_FOR_COMPLETENESS]?i=t+o+"required: "+e[le.REQUIRES_ANSWER]+"\n":e[le.USED_ONLY_FOR_COMPLETENESS]&&(i=t+o+"required only for completeness: "+e[le.USED_ONLY_FOR_COMPLETENESS]+"\n"),r+=t+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",r+=e[le.HELP_DESCRIPTION]?t+o+"description: "+e[le.HELP_DESCRIPTION]+"\n":"",r+=i,r+=e[le.PATTERN]?t+o+"pattern: "+e[le.PATTERN]+"\n":"",r+=e[le.INPUT_MASK]?t+o+"mask: "+e[le.INPUT_MASK]+"\n":"",r+=e[le.XSD.MAX_INCLUSIVE]?t+o+"This field should be a number equal or lower to "+e[le.XSD.MAX_INCLUSIVE]+"\n":"",r+=e[le.XSD.MIN_INCLUSIVE]?t+o+"This field must be greater or equal to "+e[le.XSD.MIN_INCLUSIVE]+"\n":"",r+=e[le.HAS_VALIDATION_MESSAGE]?t+o+"validation-message: "+e[le.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(le.XSD);n<o.length;n++)if(t.includes(o[n]))return!0;return!1},e.getInputMask=function(e){if(e[le.INPUT_MASK])return e[le.INPUT_MASK]},e}(),de={},fe=[],he=/*#__PURE__*/e.createContext({}),Ee=function(r){var i=n(r.data||de),a=i[0],s=i[1],l=n(r.formQuestions||fe),u=l[0],c=l[1];o(function(){if(r.isFormValid){var e=me.isValid(a);r.isFormValid(e)}},[]),o(function(){s(r.data||de)},[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=me.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(he.Provider,J({value:h},r),r.children)};Ee.propTypes={children:l.element.isRequired,data:l.object.isRequired,formQuestions:l.array.isRequired,isFormValid:l.func};var ve=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={cursorPosition:0},n}Z(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),className:"mb-3"},/*#__PURE__*/e.createElement(d.Check,J({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",className:"mb-3"},/*#__PURE__*/e.createElement(d.Check,J({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",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(h,J({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",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(h,J({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",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(h,J({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);ve.propTypes={type:l.string,label:l.object,value:l.any,onChange:l.func,help:l.string,validation:l.object,placeholder:l.string},ve.defaultProps={type:"text"};var Se=["children"],Ae=/*#__PURE__*/e.createContext({}),ge={components:{inputComponent:ve},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}},_e=function(n){var o=n.children,r=ee(n,Se),i=t(function(){return{inputComponent:r.components&&r.components.inputComponent||ge.components.inputComponent,componentsOptions:Object.assign({},ge.componentsOptions,r.componentsOptions),options:Object.assign({},ge.options,r.options),mapComponent:r.mapComponent}},[r]);/*#__PURE__*/return e.createElement(Ae.Provider,{value:i},o)};_e.propTypes={children:l.element.isRequired,components:l.object,mapComponent:l.func,options:l.object};var Te,Ne,Ie={"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 ","error.default_message":"Něco se pokazilo.","error.view_details":"Zobrazit podrobnosti o chybě"},Oe={"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 ","error.default_message":"Something went wrong.","error.view_details":"View Error Details"},Ce=/*#__PURE__*/e.createContext({}),be=function(e){var t=e.locale,n=void 0===t?navigator.language:t,o=Oe;return n===le.LANG.cs.locale&&(o=Ie),M(Ce.Provider,{value:{locale:n,lang:o},children:M(j,{locale:n,messages:o,children:e.children})})},we={"@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":""}}]}]}]},ye=/*#__PURE__*/function(){function e(){}return e.generateForm=function(){return JSON.parse(JSON.stringify(we))},e}(),Le={root:(Te={},Te[le.HAS_LAYOUT_CLASS]=le.FORM,Te),expandProperties:[le.HAS_SUBQUESTION,le.IS_RELEVANT_IF,le.HAS_ANSWER,le.HAS_DECLARED_PREFIX,le.HAS_OPTION,le.HAS_COMMENT]},Re=/*#__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=Le),u.flatten(e,null,null,function(e,t){})},e.expandStructure=function(e){var t,n={};e["@graph"].forEach(function(e){n[e["@id"]]=e,me.isForm(e)&&(t=e)});try{this._expandGraph(t,Le,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]=ue.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}();Ne=Re,Re.compressStructure=function(e){var t=[],n=new Set;return(t=Ne._compressGraph(e,t,n)).sort(function(e,t){return e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0})},Re._compressGraph=function(e,t,n){return n.has(e["@id"])||(t.push(e),n.add(e["@id"])),Le.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=Ne._compressGraph(a,t,n),e[o][i]={"@id":a["@id"]})}}),t};var De=/*#__PURE__*/function(){function e(){}return e.constructDefaultForm=function(t){var n=ye.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=Re.expandStructure(e),Object.keys(r).map(function(e){ce.putObject(e,r[e])})):console.warn("default form is constructed."),!(o=(n=e["@graph"].find(function(e){return me.isForm(e)}))[le.HAS_SUBQUESTION]))throw re.error("Could not find any questions in the received data."),"No questions in the form";return(i=o.filter(function(e){return!(!me.isWizardStep(e)||me.isHidden(e))||(re.warn("Item is not a wizard step: "+e),!1)})).length||(re.log("Could not find any wizard steps in the received data. Building form without steps"),n[le.HAS_SUBQUESTION].forEach(function(e){return i.push(e)})),i.sort(pe.getCompareLocalizedLabelFunction(t)),pe.orderPreservingToplogicalSort(i,le.HAS_PRECEDING_QUESTION),[i,{root:n}]},e}(),Ve=/*#__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,le.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,le.HAS_QUESTION_ORIGIN,"@id"),t[le.HAS_SUBQUESTION]){n.subQuestions=[];for(var o=0;o<t[le.HAS_SUBQUESTION].length;o++)n.subQuestions.push(e._processQuestion(t[le.HAS_SUBQUESTION][o]))}if(t[le.HAS_ANSWER]){n.answers=[],Array.isArray(t[le.HAS_ANSWER])||(t[le.HAS_ANSWER]=[t[le.HAS_ANSWER]]);for(var r=0;r<t[le.HAS_ANSWER].length;r++)n.answers.push(e.processAnswer(t[le.HAS_ANSWER][r]))}if(t[le.HAS_COMMENT]){n.comments=[],Array.isArray(t[le.HAS_COMMENT])||(t[le.HAS_COMMENT]=[t[le.HAS_COMMENT]]);for(var i=0;i<t[le.HAS_COMMENT].length;i++)n.comments.push(e.processComment(t[le.HAS_COMMENT][i]))}return n},e.processComment=function(e){var t={};return t.author=c.getJsonAttValue(e,le.HAS_AUTHOR,"@id"),t.value=c.getJsonAttValue(e,le.HAS_COMMENT_VALUE),t.timestamp=c.getJsonAttValue(e,le.HAS_TIMESTAMP,"@id"),t},e.processAnswer=function(e){var t={};return t.uri=e["@id"],t.origin=c.getJsonAttValue(e,le.HAS_ANSWER_ORIGIN,"@id"),e[le.HAS_OBJECT_VALUE]?t.codeValue=c.getJsonAttValue(e,le.HAS_OBJECT_VALUE,"@id"):t.textValue=c.getJsonAttValue(e,le.HAS_DATA_VALUE),t},e.generateAnswer=function(e){var t={};return t[le.HAS_DATA_VALUE]="",t},e}(),He=function(t){var n=r(Ae);/*#__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||me.isDisabled(t.question)})};He.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(Ae).componentsOptions,a=n(null),s=a[0],l=a[1],u=n(""),c=u[0],p=u[1],m=me.resolveDateTimeFormat(t.question,t.value,i.dateTimeAnswer),h=me.isDate(t.question),E=me.isTime(t.question),v=me.isTimestamp(t.question);o(function(){var e=S(t.value);e?l(e):(l(null),p("Invalid date value "+t.value+" of question "+t.question["@id"]+"."),console.error(c))},[t.value,m]);var S=function(e){if(!e)return null;var t=v?new Date(e):q(e,m,new Date);return isNaN(t.getTime())?null:t};/*#__PURE__*/return e.createElement(f,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(d.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(x,{selected:s,placeholderText:m,onChange:function(e){l(e);var n=e?v?e.getTime():k(e,m):"";t.onChange(n)},showTimeSelect:!h,showTimeSelectOnly:E,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:m,className:z("form-control",t.validation.classname),disabled:i.readOnly||me.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 Ue=[le.XSD.INT,le.XSD.INTEGER,le.XSD.NON_NEGATIVE_INTEGER,le.XSD.NON_POSITIVE_INTEGER,le.XSD.NEGATIVE_INTEGER,le.XSD.POSITIVE_INTEGER,le.XSD.FLOAT,le.XSD.POSITIVE_FLOAT,le.XSD.NEGATIVE_FLOAT],je={};je[le.XSD.NON_NEGATIVE_INTEGER]={min:0},je[le.XSD.NON_POSITIVE_INTEGER]={max:0},je[le.XSD.NEGATIVE_INTEGER]={max:-1},je[le.XSD.POSITIVE_INTEGER]={min:1};var Pe={"string-2":"prefixed",atom:"var"},xe=/*#__PURE__*/function(){function e(){}return e._resolveInputType=function(t,n){return me.isSparqlInput(t)||me.isTurtleInput(t)||me.isTextarea(t,n)?"textarea":e._isNumeric(t)?"number":"text"},e._isNumeric=function(e){for(var t=0,n=Ue.length;t<n;t++)if(c.hasValue(e,le.HAS_DATATYPE,Ue[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||me.isDisabled(t),r},e._resolveStepRestriction=function(e){var t={};return void 0!==e[le.STEP]&&(t.step=c.getJsonAttValue(e,le.STEP)),t},e._resolveNumberRestrictions=function(e){var t={};return Object.getOwnPropertyNames(je).forEach(function(n){c.hasValue(e,le.HAS_DATATYPE,n)&&(t=Object.assign({},t,je[n]))}),void 0!==e[le.XSD.MIN_INCLUSIVE]&&(t.min=e[le.XSD.MIN_INCLUSIVE]),void 0!==e[le.XSD.MIN_EXCLUSIVE]&&(t.min=e[le.XSD.MIN_EXCLUSIVE]+1),void 0!==e[le.XSD.MAX_EXCLUSIVE]&&(t.max=e[le.XSD.MAX_EXCLUSIVE]-1),void 0!==e[le.XSD.MAX_INCLUSIVE]&&(t.max=e[le.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}(),qe=function(t){var n=r(Ae),o=n.inputComponent,i=n.componentsOptions,a=t.question,s=t.answer,l=t.value;return s[le.HAS_OBJECT_VALUE]&&s[le.HAS_OBJECT_VALUE][c.RDFS_LABEL]&&(l=c.getJsonAttValue(s[le.HAS_OBJECT_VALUE],c.RDFS_LABEL)),/*#__PURE__*/e.createElement(o,Object.assign({},xe.resolveInputProperties(a,l,i),{validation:t.validation,label:t.label,title:t.title,value:null==l?"":l,placeholder:me.getInputMask(a),onKeyPress:function(e){return xe._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=F.fromTextArea(e.target);n.setValue(l),n.on("change",function(){t.onChange(n.getValue())}),F.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"===Pe[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[le.HAS_DECLARED_PREFIX]&&t.question[le.HAS_DECLARED_PREFIX].filter(function(e){return e[le.PREFIX]===l.slice(0,-1)}).length){var u=t.question[le.HAS_DECLARED_PREFIX].filter(function(e){return e[le.PREFIX]===l.slice(0,-1)}),c={};c[u[0][le.PREFIX]]=u[0][le.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=F.fromTextArea(e.target);o.setValue(l),o.on("change",function(){t.onChange(o.getValue())})}}}))};qe.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 ke={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"},ze=/*#__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+=ke[t]?ke[t]:t;return n},e}(),Fe=["size","placeholder"];function Qe(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 Be=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this)._updatePattern=function(e){n.mask.setPattern(ze.mapMask(e.mask),{value:n.mask.getRawValue(),selection:Qe(n.input)})},n._updateMaskSelection=function(){n.mask.selection=Qe(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 Q({pattern:ze.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"}),n}Z(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(ze.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(ze.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(ze.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=ee(n,Fe),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);Be.contextType=Ae,Be.propTypes={mask:l.string.isRequired},Be.defaultProps={value:""};var We=function(t){var n=r(Ae).componentsOptions,o=t.question,i=t.value,a=c.getJsonAttValue(o,le.INPUT_MASK);return a?/*#__PURE__*/e.createElement(Be,{mask:a,value:i,label:t.label,title:t.title,placeholder:a,onChange:function(e){return t.onChange(e.target.value)},disabled:n.readOnly||me.isDisabled(o),validation:t.validation}):(re.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(qe,t))};We.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 Xe=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}Z(n,t);var o=n.prototype;return o._generateSelectOptions=function(t){var n=[];t.sort(function(e,t){var n=c.getJsonAttValue(e,le.RDFS_LABEL),o=c.getJsonAttValue(t,le.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],le.RDFS_LABEL),key:"opt-"+o},c.getJsonAttValue(t[o],le.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||me.isDisabled(n)},this._generateSelectOptions(n[le.HAS_OPTION]))},n}(e.Component);Xe.contextType=Ae,Xe.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.string,onChange:l.func.isRequired,validation:l.object};var Ge=function(e,t){return void 0!==e&&e.length?(e.sort(pe.getCompareLocalizedLabelFunction(t)),pe.orderPreservingToplogicalSort(e,le.HAS_PRECEDING_VALUE),e):[]},Ye=function(t){var i=ue.getStringHash(me.getPossibleValuesQuery(t.question)),a=r(ae),s=r(Ae),l=s.options.intl,u=n(!0),p=u[0],m=u[1],h=n(Ge(t.options,l)),E=h[0],v=h[1];o(function(){var e=!1,n=t.question;return!n[le.HAS_OPTION]&&me.getPossibleValuesQuery(n)?function(){try{var t=function(t,o){try{var r=Promise.resolve(a.loadFormOptions(i,me.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(){re.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[le.HAS_OPTION])),function(){e=!0}},[i,a,t.question,l]);var S,A,g=function(e){if(!e)return[];for(var t,n={},o=[],r=ne(e=Ge(e,l));!(t=r()).done;){var i=t.value,a=c.getLocalized(i[le.RDFS_LABEL],l),s=c.getLocalized(i[le.RDFS_COMMENT],l);n[i["@id"]]={id:i["@id"],value:i["@id"],label:a,description:s,children:[]};for(var u,p=ne(ue.asArray(i[le.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)},_=ue.findKeyInObjects(E,["name","value"]),T=ue.findKeyInObjects(E,["name","label"]);/*#__PURE__*/return e.createElement(f,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(d.Label,null,t.label),/*#__PURE__*/e.createElement(B,{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[le.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES]?function(t){/*#__PURE__*/return e.createElement(e.Fragment,null,t)}:null,value:E.find(function(e){return e.id===t.value})||null,multi:!1,options:E,isSearchable:!0,isLoading:p,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,isDisabled:p||s.componentsOptions.readOnly||me.isDisabled(t.question),onChange:function(e){t.onChange(e?e.id:null)},titleKey:"description"}),t.validation.message)};Ye.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 Ke=function(t){/*#__PURE__*/return e.createElement("svg",{className:"caret-square-up",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t.title||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 17.453c-0.172 0.344-0.516 0.547-0.891 0.547h-10c-0.375 0-0.719-0.203-0.891-0.547-0.172-0.328-0.141-0.734 0.078-1.031l5-7c0.187-0.266 0.484-0.422 0.812-0.422s0.625 0.156 0.812 0.422l5 7c0.219 0.297 0.25 0.703 0.078 1.031zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"}))},Je=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"}))},Ze=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"}))},$e=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"}))},et=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)))};et.propTypes={tooltipContent:l.oneOfType([l.object.isRequired,l.string.isRequired]),id:l.string.isRequired,overlayPlacement:l.string,absolutePosition:l.bool,show:l.bool},et.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};var tt=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(et,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o[0],absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement($e,{className:t.iconClass})))};tt.propTypes={text:l.string.isRequired,iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},tt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var nt=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"}))},ot=function(t){/*#__PURE__*/return e.createElement(et,{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(nt,{className:t.iconClass})))};ot.propTypes={url:l.oneOfType([l.string.isRequired,l.object.isRequired]),iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},ot.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var rt=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"}))},it=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"}))))},at="Unknown author",st=function(t){var o=r(Ae).options,i=n(!1),a=i[0],s=i[1],l=n(!1),u=l[0],c=l[1];W.addLocale(G),W.addLocale(X),W.setDefaultLocale(le.LANG.en.locale);var p,m=new W(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 at},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(ot,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():at})):d())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},/*#__PURE__*/e.createElement(et,{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(Y.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(it,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};st.propTypes={author:l.object,timestamp:l.string.isRequired,commentValue:l.string.isRequired,onDeleteQuestionComment:l.func.isRequired,onDeleteViewComment:l.func,index:l.number.isRequired};var lt=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?U("div",{className:"comment-delete",children:[M(K,{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(st,{commentValue:e[le.HAS_COMMENT_VALUE],author:e[le.HAS_AUTHOR]?e[le.HAS_AUTHOR]:null,timestamp:e[le.HAS_TIMESTAMP],onDeleteQuestionComment:r,onDeleteViewComment:c,index:t})},t)})})})},ut=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"}))},ct="300px",pt=function(t){var r=n(""),a=r[0],s=r[1],l=i(null),u=P();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(ct)&&(e.style.height=ct)};/*#__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 position-relative",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(ut,null)))))))};pt.propTypes={onChange:l.func.isRequired};var mt,dt=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"}))},ft=function(t){var a=r(Ae),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[le.HAS_COMMENT]||(e[le.HAS_COMMENT]=[]),Array.isArray(e[le.HAS_COMMENT])||(e[le.HAS_COMMENT]=[e[le.HAS_COMMENT]]),e[le.HAS_COMMENT]},A=function(e){var n={};g(n,e),t.onChange(O(),n)},g=function(e,t){a.options.currentUser&&(e[le.HAS_AUTHOR]={"@id":a.options.currentUser}),e[le.HAS_COMMENT_VALUE]=t,e[le.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(rt,null),O()>0?/*#__PURE__*/e.createElement(_,{className:"comment-badge",pill:!0,variant:"primary"},O()):null),/*#__PURE__*/e.createElement(Y.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,J({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:function(e){!function(e){"Escape"===e.key&&E()}(e)}},/*#__PURE__*/e.createElement(Y.div,{className:"close-comment-icon",onClick:E,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(dt,null)),/*#__PURE__*/e.createElement(lt,{comments:S(),onDeleteCommentClick:N}),/*#__PURE__*/e.createElement(pt,{onChange:A})))})))};ft.propTypes={question:l.object.isRequired,onChange:l.func.isRequired};var ht=/*#__PURE__*/function(){function t(){}return t.renderIcons=function(t,n,o,r){var i;i=n.icons?n.icons:le.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===le.ICONS.QUESTION_COMMENTS&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},l)),i[c].id===le.ICONS.QUESTION_HELP&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},s)),i[c].id===le.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(le.ICONS.QUESTION_HELP,e,t,n,o)},t.renderQuestionLink=function(e,t,n,o){return this.getIconComponentFromName(le.ICONS.QUESTION_LINK,e,t,n,o)},t.getIconComponentFromName=function(e,t,n,o,r){var i=this.getIconFromIconList(n.icons?n.icons:le.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===le.ICON_BEHAVIOR.ON_HOVER||t.behavior===le.ICON_BEHAVIOR.ENABLE))return t.behavior===le.ICON_BEHAVIOR.ENABLE?(i=!0,a=""):a="emphasise-on-relevant-icon",t.id===le.ICONS.QUESTION_HELP&&n[le.HELP_DESCRIPTION]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(tt,{text:c.getLocalized(n[le.HELP_DESCRIPTION],o.intl),absolutePosition:!1})):null:t.id===le.ICONS.QUESTION_LINK&&n[le.SOURCE]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(ot,{url:n[le.SOURCE]})):null:t.id===le.ICONS.QUESTION_COMMENTS&&i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(ft,{question:n,onChange:r})):null},t}();mt=ht,ht.renderQuestionComments=function(e,t,n,o){return mt.getIconComponentFromName(le.ICONS.QUESTION_COMMENTS,e,t,n,o)},ht.getIconFromIconList=function(e,t){return e?e.find(function(e){return e.id===t}):null};var Et=function(t){var r=e.useContext(ae),i=e.useContext(Ae).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[le.HAS_OBJECT_VALUE]=null,e[le.HAS_DATA_VALUE]=null):t.answer[le.HAS_OBJECT_VALUE]||me.isTypeahead(t.question)?e[le.HAS_OBJECT_VALUE]={"@id":n}:e[le.HAS_DATA_VALUE]={"@value":n}},f=function(){l({severity:"",classname:"",message:null}),!1===h[le.HAS_VALID_ANSWER]&&l(h[le.HAS_VALIDATION_SEVERITY]===le.VALIDATION.SEVERITY.WARNING?{severity:le.VALIDATION.SEVERITY.WARNING,classname:le.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(N,{className:le.VALIDATION.CLASSNAME.WARNING},h[le.HAS_VALIDATION_MESSAGE])}:{severity:le.VALIDATION.SEVERITY.ERROR,classname:le.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(N,{className:le.VALIDATION.CLASSNAME.ERROR},h[le.HAS_VALIDATION_MESSAGE])})},h=t.question,E=me.resolveValue(t.answer),v=function(n){var o=c.getLocalized(n[le.RDFS_LABEL],i.intl);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,ht.renderIcons(t.question,i,t.onCommentChange,t.showIcon))}(h),S=c.getLocalized(h[le.RDFS_COMMENT],i.intl);return u=me.isTypeahead(h)?function(n,o,i){var a=ue.getStringHash(me.getPossibleValuesQuery(t.question)),l=r.getOptions(a)||[];/*#__PURE__*/return e.createElement(Ye,{question:t.question,answer:t.answer,label:o,title:i,value:n,onChange:m,options:l,validation:s})}(E,v,S):(p=h)[le.HAS_OPTION]&&0!==p[le.HAS_OPTION].length?function(n,o,r){/*#__PURE__*/return e.createElement(Xe,{question:t.question,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S):me.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):me.isCheckbox(h)?function(n,o,r){/*#__PURE__*/return e.createElement(He,{label:o,title:r,value:n,onChange:m,question:t.question,validation:s})}(E,v,S):me.isMaskedInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(We,{label:o,title:r,value:n,onChange:m,question:t.question,answer:t.answer,validation:s})}(E,v,S):me.isSparqlInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(qe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,sparql:!0,validation:s})}(E,v,S):me.isTurtleInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(qe,{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(qe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S),u};Et.propTypes={answer:l.object.isRequired,question:l.object.isRequired,onChange:l.func.isRequired,onCommentChange:l.func.isRequired,index:l.number,icons:l.object};var vt=function(e,t){var n=[It,Nt,At,_t,gt,Tt];return function(){if(me.hasValidationLogic(e,t)){var o=me.getAnswerValue(e);return St(e,t,o,n)}}},St=function(e,t,n,o){for(var r,i={},a=ne(o);!(r=a()).done;){var s=(0,r.value)(e,t);if(!s.isValid)return i[le.HAS_VALID_ANSWER]=!1,i[le.HAS_VALIDATION_MESSAGE]=s.message,i[le.HAS_VALIDATION_SEVERITY]=s.validationSeverity,i;if(!1===i[le.HAS_VALID_ANSWER])break}return i[le.HAS_VALID_ANSWER]=!0,i[le.HAS_VALIDATION_MESSAGE]="",i[le.HAS_VALIDATION_SEVERITY]="",i},At=function(e,t){var n=me.getAnswerValue(e);return n&&n.length>0&&e[le.PATTERN]&&!new RegExp(e[le.PATTERN]).test(n)&&me.hasAnswer(e)?{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},gt=function(e,t){return!e[le.REQUIRES_ANSWER]||e[le.USED_ONLY_FOR_COMPLETENESS]||me.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})}},_t=function(e,t){return me.isCheckbox(e)&&e[le.REQUIRES_ANSWER]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0}},Tt=function(e,t){return e[le.REQUIRES_ANSWER]&&e[le.USED_ONLY_FOR_COMPLETENESS]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.WARNING,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0}},Nt=function(e,t){if(e[le.XSD.MIN_INCLUSIVE]){var n=me.getAnswerValue(e);if(n&&n.length>0){var o=e[le.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},It=function(e,t){var n=me.getAnswerValue(e);if(e[le.XSD.MAX_INCLUSIVE]&&n&&n.length>0){var o=e[le.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}},Ot=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={prefixes:e.prefixes},n}return Z(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[le.PREFIX]<t[le.PREFIX]?-1:1}).map(function(t){/*#__PURE__*/return e.createElement(C,{key:t[le.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[le.PREFIX]),": ",t[le.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);Ot.propTypes={prefixes:l.array.isRequired,children:l.element.isRequired,iconClass:l.string},Ot.defaultProps={iconClass:""};var Ct=function(e){var t;return(t=e.question[le.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},bt=/*#__PURE__*/function(t){function n(e){var o;return(o=t.call(this,e)||this).handleAnswerChange=function(e,t){if(me.isSection(o.props.question)){var n=!!me.resolveValue(t);o.setState({expanded:n})}o._handleChange(le.HAS_ANSWER,e,t)},o.handleSubQuestionChange=function(e,t){o._handleChange(le.HAS_SUBQUESTION,e,t)},o.handleCommentChange=function(e,t){o._handleChange(le.HAS_COMMENT,e,t)},o._toggleCollapse=function(){o.props.collapsible&&o.setState({expanded:!o.state.expanded})},o._onEnterHandler=function(){o.setState({showIcon:!0})},o._onLeaveHandler=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"),me.isWizardStep(e)&&r.push("wizard-step bg-primary text-white"),me.isEmphasised(e)&&r.push(n.getEmphasizedClass(e)),me.isSection(e)&&r.push("section-background"),t&&r.push("cursor-pointer"),o.isDebugged(e)&&r.push("show-irrelevant"),r},ce.putObject(e.question["@id"],e.question),o.state={validator:{},expanded:!me.isCollapsed(e.question),showIcon:!1},o}Z(n,t);var o=n.prototype;return o.componentDidMount=function(){this.setState({validator:vt(this.props.question,this.props.intl)})},o.componentDidUpdate=function(){var e=this.props.question,t=this.context.options.startingQuestionId,n=e[le.HAS_SUBQUESTION].find(function(e){return e["@id"]===t});if(me.isSection(e)&&me.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===le.HAS_ANSWER){var r=this.state.validator(n);o=Object.assign({},o,r)}ce.putObject(o["@id"],o),this.props.onChange(this.props.index,o)},o.isDebugged=function(e){var t=this.context.options.startingQuestionId;return!me.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!ue.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):me.isHidden(t)?null:me.isRelevant(t)?n:null},o.renderQuestion=function(t){if(me.isAnswerable(t)&&!me.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(me.isAnswerable(t))return this.renderAnswerableSection();if(me.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:z("p-3",a)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(w,{activeKey:this.state.expanded?s:void 0,className:"mb-3"},/*#__PURE__*/e.createElement(w.Item,{eventKey:s},/*#__PURE__*/e.createElement(b,{className:""},/*#__PURE__*/e.createElement(w.Button,{as:b.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"d-inline",id:t["@id"]},r&&!me.isWizardStep(t)&&this._renderCollapseToggle(),s),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(w.Body,{className:"p-0"},r?l:/*#__PURE__*/e.createElement(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(Ct,{key:this.props.question["@id"]+"-media",question:this.props.question})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t},o.renderQuestionIcons=function(){return ht.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:z("p-3",r)},this.renderSubQuestions(i)),s=this._getHeaderClassName();return this.state.expanded&&s.push("text-primary"),/*#__PURE__*/e.createElement(w,{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:s},this.renderAnswers()),o?/*#__PURE__*/e.createElement(w.Collapse,{className:i,eventKey:t["@id"]},a):{cardBody:a}))},o.getShowIrrelevantClassname=function(e){return!this.context.options.debugMode&&!pe.checkId(e[le.HAS_SUBQUESTION],this.context.options.startingQuestionId)||me.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++)me.isTextarea(o,me.resolveValue(i[a]))||me.isSparqlInput(o)||me.isTurtleInput(o),t=z("answer",n._getQuestionCategoryClass(o),n.getEmphasizedOnRelevantClass(o)),r.push(/*#__PURE__*/e.createElement("div",{key:"row-item-"+a,className:t,id:o["@id"],onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"answer-content",style:this._getAnswerWidthStyle()},/*#__PURE__*/e.createElement(Et,{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[le.HAS_ANSWER]||(e[le.HAS_ANSWER]=[]),Array.isArray(e[le.HAS_ANSWER])||(e[le.HAS_ANSWER]=[e[le.HAS_ANSWER]]),0===e[le.HAS_ANSWER].length&&(e[le.HAS_ANSWER]=me.isSection(e)&&!me.isAnswerable(e)?[]:[Ve.generateAnswer(e)]),e[le.HAS_ANSWER]},o._getAnswerWidthStyle=function(){var e=Number(this.props.question[le.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===le.GENERATED_ROW_SIZE?"col-6":"col-"+le.COLUMN_COUNT/le.GENERATED_ROW_SIZE},n._getQuestionCategoryClass=function(e){var t=me.getCategory(e);return t?"question-"+t:""},n.getEmphasizedClass=function(e){return me.isEmphasised(e)?"bg-warning":""},n.getEmphasizedOnRelevantClass=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.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?Ke:Je,{title:t}))},o._renderPrefixes=function(){var t=this.props.question;return t[le.HAS_DECLARED_PREFIX]&&t[le.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(Ot,{prefixes:t[le.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(Ze,null)):null},o._renderUnits=function(){var t=this.props.question;return t[le.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[le.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||ue.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[le.HAS_SUBQUESTION]||(e[le.HAS_SUBQUESTION]=[]),Array.isArray(e[le.HAS_SUBQUESTION])||(e[le.HAS_SUBQUESTION]=[e[le.HAS_SUBQUESTION]]),pe.orderByLocalizedLabels(e[le.HAS_SUBQUESTION],this.context.options.intl),pe.orderPreservingToplogicalSort(e[le.HAS_SUBQUESTION],le.HAS_PRECEDING_QUESTION),e[le.HAS_SUBQUESTION]},o._getFirstAnswerValue=function(){return me.resolveValue(this._getAnswers()[0])},n}(e.Component);bt.contextType=Ae,bt.propTypes={question:l.object.isRequired,onChange:l.func.isRequired,index:l.number,withoutCard:l.bool,collapsible:l.bool},bt.defaultProps={withoutCard:!1,collapsible:!0};var wt=function(t){var n=r(he),o=n.updateFormQuestionsData,i=n.getFormQuestionsData,a=P(),s=i([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(bt,{question:s,onChange:function(e,n){o(t.index||e,Object.assign({},t.question,n))},collapsible:me.isAnswerable(s),intl:a}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(y,{className:"m-3 float-end"},!t.isFirstStep&&/*#__PURE__*/e.createElement(g,{className:"me-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"}))))};wt.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 yt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Ae).options,s=P();/*#__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(et,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(R,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(D,{eventKey:n,active:n===i?"active":"",hidden:!a.debugMode&&!me.isRelevant(t),disabled:!a.enableWizardStepSkip,className:z([a.debugMode&&!me.isRelevant(t)?"show-irrelevant":bt.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=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Ae).options,s=P();/*#__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(et,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(C,{hidden:!a.debugMode&&!me.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:z([a.debugMode&&!me.isRelevant(t)?"show-irrelevant":bt.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],a.intl)))})))};Lt.propTypes={currentStep:l.number.isRequired,steps:l.array.isRequired,onNavigate:l.func.isRequired};var Rt,Dt=function(e,t){var n=function e(n,o){return n?n["@id"]===t?o:ue.asArray(n[le.HAS_SUBQUESTION]).findIndex(function(t,n){return-1!==e(t,n)}):-1};return e.findIndex(function(e,t){return-1!==n(e,t)})},Vt=function(){var t=e.useContext(he),n=e.useContext(Ae),r=n.options,i=n.mapComponent,a=0;r.startingQuestionId?-1===(a=Dt(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?yt:Lt,{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],wt),/*#__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}))))},Ht=/*#__PURE__*/e.forwardRef(function(t,n){var o=e.useContext(Ae).options;/*#__PURE__*/return e.createElement(V,J({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))});Ht.propTypes={children:l.element.isRequired};var Mt=function(){};Rt=Mt,Mt.updateQuestionValidation=function(e,t,n,o){if(t[le.HAS_ANSWER]){var r=vt(t,o)();r&&(e[n]=Object.assign({},t,r))}for(var i,a=ne(e);!(i=a()).done;)Rt.updateSubQuestionsValidation(i.value,o)},Mt.updateSubQuestionsValidation=function(e,t){for(var n=ue.asArray(e[le.HAS_SUBQUESTION]),o=0;o<n.length;o++)Rt.updateQuestionValidation(n,n[o],o,t)};var Ut=/*#__PURE__*/a(function(t,n){var o=r(he),i=o.getFormQuestionsData,a=o.updateFormQuestionsData,l=o.getData,u=P();s(n,function(){return{validateForm:p,getFormSpecification:m,getFormQuestionsData:i,getFormData:c}},[]);var c=function(){var e=l(),t=i();return Ve.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 me.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,bt);/*#__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!me.isWizardStep(e)});return h?/*#__PURE__*/e.createElement(Ht,null,v?d():/*#__PURE__*/e.createElement(Vt,null)):v?d():/*#__PURE__*/e.createElement(Vt,null)}),jt=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={hasError:!1,errorLabel:null,errorDetails:null},n}Z(n,t),n.getDerivedStateFromError=function(e){return{hasError:!0,error:e}};var o=n.prototype;return o.componentDidCatch=function(e,t){this.setState({errorLabel:e,errorDetails:t})},o.render=function(){if(this.state.hasError){var t=this.context.lang;/*#__PURE__*/return e.createElement("div",{style:{padding:"20px"}},/*#__PURE__*/e.createElement(H,{variant:"danger"},/*#__PURE__*/e.createElement(H.Heading,null,t["error.default_message"]||"Something went wrong."),/*#__PURE__*/e.createElement("p",null,this.state.errorLabel&&this.state.errorLabel.toString())),/*#__PURE__*/e.createElement(w,null,/*#__PURE__*/e.createElement(b,null,/*#__PURE__*/e.createElement(b.Header,null,/*#__PURE__*/e.createElement(w.Toggle,{as:g,variant:"link",eventKey:"0"},t["error.view_details"]||"View Error Details")),/*#__PURE__*/e.createElement(w.Collapse,{eventKey:"0"},/*#__PURE__*/e.createElement(b.Body,null,/*#__PURE__*/e.createElement("pre",{style:{whiteSpace:"pre-wrap"}},this.state.errorDetails&&this.state.errorDetails.componentStack))))))}return this.props.children},n}(e.Component);jt.contextType=Ce;var Pt=/*#__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(De.constructForm(t.form,t.options.intl)).then(function(e){var t=e[0],n=e[1];t.formQuestions.some(function(e){return me.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=ne(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(_e,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:f,options:t.options},/*#__PURE__*/e.createElement(be,{locale:t.options.intl.locale},/*#__PURE__*/e.createElement(jt,null,/*#__PURE__*/e.createElement(se,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(Ee,{data:m,formQuestions:u.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(Ut,{ref:r,modalView:t.options&&t.options.modalView,mapComponent:f}))))))});Pt.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{Et as Answer,Ae as ConfigurationContext,le as Constants,he as FormQuestionsContext,me as FormUtils,tt as HelpIcon,be as IntlContextProvider,Re as JsonLdFramingUtils,ce as JsonLdObjectMap,pe as JsonLdObjectUtils,bt as Question,ht as QuestionStatic,wt as WizardStep,Pt 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 w,ButtonToolbar as y,Nav as L,NavItem as R,NavLink as D,Modal as V,Alert as H}from"react-bootstrap";import{jsx as M,jsxs as U}from"react/jsx-runtime";import{IntlProvider as j,useIntl as P}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 x from"react-datepicker";import{parse as q,format as k}from"date-fns";import z 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 F from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import"core-js/modules/web.timers.js";import Q from"inputmask-core";import{IntelligentTreeSelect as B}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 W from"javascript-time-ago";import X from"javascript-time-ago/locale/en";import G from"javascript-time-ago/locale/cs";import{motion as Y}from"framer-motion";import{Rings as K}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 J(){return J=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},J.apply(this,arguments)}function Z(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$(e,t)}function ee(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 te(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 ne(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 te(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)?te(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 oe,re=/*#__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}(),ie=["children"],ae=/*#__PURE__*/e.createContext({}),se=function(n){var o=n.children,r=ee(n,ie),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}):(re.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(ae.Provider,J({value:l},r),o)};se.propTypes={children:l.element.isRequired,fetchTypeAheadValues:l.func};var le=function(){};oe=le,le.COLUMN_COUNT=12,le.INPUT_LENGTH_THRESHOLD=50,le.DATETIME_NUMBER_FORMAT="x",le.EPOCH_MILLISECONDS="epoch-milliseconds",le.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",le.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",le.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",le.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",le.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",le.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",le.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",le.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",le.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",le.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"]},le.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",le.VALUE_TYPE_CODE="code",le.VALUE_TYPE_TEXT="text",le.GENERATED_ROW_SIZE=1,le.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",le.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",le.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",le.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",le.HELP_DESCRIPTION="http://purl.org/dc/elements/1.1/description",le.SOURCE="http://purl.org/dc/elements/1.1/source",le.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"},le.STEP="http://onto.fel.cvut.cz/ontologies/form/step",le.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",le.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",le.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",le.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",le.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",le.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",le.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",le.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",le.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",le.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",le.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",le.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",le.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",le.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",le.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",le.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",le.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",le.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",le.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",le.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",le.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",le.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",le.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",le.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",le.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",le.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",le.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",le.PREFIX="http://www.w3.org/ns/shacl#prefix",le.NAMESPACE="http://www.w3.org/ns/shacl#namespace",le.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",le.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",le.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",le.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",le.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",le.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",le.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",le.TIMESTAMP_FORMAT="http://onto.fel.cvut.cz/ontologies/form/timestamp-format",le.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",le.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",le.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",le.RDFS_LABEL=c.RDFS_LABEL,le.RDFS_COMMENT=c.RDFS_COMMENT,le.DEFAULT_HAS_CHILD=c.DEFAULT_HAS_CHILD,le.BROADER="http://www.w3.org/2004/02/skos/core#broader",le.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",le.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",le.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink"},le.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},le.DEFAULT_OPTIONS={icons:[{id:oe.ICONS.QUESTION_HELP,behavior:oe.ICON_BEHAVIOR.ENABLE},{id:oe.ICONS.QUESTION_COMMENTS,behavior:oe.ICON_BEHAVIOR.ON_HOVER},{id:oe.ICONS.QUESTION_LINK,behavior:oe.ICON_BEHAVIOR.ON_HOVER}]},le.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},le.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 ue=/*#__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[le.HAS_SUBQUESTION]);if(r)for(var s,l=ne(a);!(s=l()).done;){var u=e.findQuestionById(t,s.value,!0,!1,!1);if(u)return u}if(i)for(var c,p=ne(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}(),ce=/*#__PURE__*/function(){function e(){}return e.putObject=function(t,n){e.objectMap[t]=n},e.getObject=function(t){return e.objectMap[t]},e}();ce.objectMap={};var pe=/*#__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],ue.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}(),me=/*#__PURE__*/function(){function e(){}return e.isForm=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.FORM)},e.isWizardStep=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.WIZARD_STEP)},e.isSection=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.QUESTION_SECTION)},e.isAnswerable=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.ANSWERABLE)},e.isTypeahead=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.QUESTION_TYPEAHEAD)},e.getPossibleValuesQuery=function(e){return c.getJsonAttValue(e,le.HAS_OPTIONS_QUERY)},e.isDisabled=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.DISABLED)},e.isHidden=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.HIDDEN)},e.isTextarea=function(t,n){return n&&n.length>le.INPUT_LENGTH_THRESHOLD&&!e.isTypeahead(t)||c.hasValue(t,le.LAYOUT_CLASS,le.LAYOUT.TEXTAREA)},e.isText=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.TEXT)},e.isCalendar=function(t){return e.isDate(t)||e.isTime(t)||e.isDateTime(t)},e.isDate=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.DATE)},e.isTime=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.TIME)},e.isDateTime=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.DATETIME)},e.isTimestamp=function(e){return c.hasValue(e,le.TIMESTAMP_FORMAT,le.EPOCH_MILLISECONDS)},e.isCheckbox=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.CHECKBOX)},e.isMaskedInput=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.MASKED_INPUT)},e.isSparqlInput=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.SPARQL)},e.isTurtleInput=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.TURTLE)},e.isCollapsed=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.COLLAPSED)},e.isEmphasised=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.LAYOUT.EMPHASISED)},e.getCategory=function(e){return le.LAYOUT.CATEGORY.find(function(t){return c.hasValue(e,le.LAYOUT_CLASS,t)})},e.resolveValue=function(e){return e?e[le.HAS_OBJECT_VALUE]?e[le.HAS_OBJECT_VALUE]["@id"]:c.getJsonAttValue(e,le.HAS_DATA_VALUE):null},e.resolveValueObject=function(e){return e?e[le.HAS_OBJECT_VALUE]?ue.asArray(e[le.HAS_OBJECT_VALUE])[0]:e[le.HAS_DATA_VALUE]?ue.asArray(e[le.HAS_DATA_VALUE])[0]:null:null},e.isRelevant=function(t){if(!t[le.IS_RELEVANT_IF])return!0;for(var n,o=ne(ue.asArray(t[le.IS_RELEVANT_IF]));!(n=o()).done;)if(!e.testCondition(n.value))return!1;return!0},e.hasValidationLogic=function(e){return!!(e[le.REQUIRES_ANSWER]||e[le.REQUIRES_ANSWER_IF]||e[le.PATTERN]||this.containsXSDProperty(e))},e.isValid=function(e){if(!1===e[le.HAS_VALID_ANSWER])return!1;for(var t,n=ne(ue.asArray(e[le.HAS_SUBQUESTION]));!(t=n()).done;)if(!1===this.isValid(t.value))return!1;return!0},e.testOrCondition=function(e){var t=e[le.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(var n,o=ne(this._getMappedObjectsArray(t));!(n=o()).done;)if(this.testCondition(n.value))return!0;return!1},e.testCondition=function(t){var n,o=t[le.ACCEPTS_VALIDATION_VALUE],r=t[le.ACCEPTS_ANSWER_VALUE],i=t[le.ACCEPTS],a=t[le.HAS_TESTED_QUESTION];if(t[le.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=ue.asArray(i);if(1!==s.length&&console.warn("Support for multiple accepts values is not implemented !"),s[0]["@id"]===le.ANSWERED_QUESTION){(r||o)&&console.warn("Support for accepted answer/validations values is not implemented !");for(var l,c=ne(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=ue.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=ne(ue.asArray(a));!(m=d()).done;){if(void 0===(n=ce.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=ce.getObject(a["@id"]);for(var f,h=ne(ue.asArray(r));!(f=h()).done;){var E=f.value;if(!n)return console.warn("Question is not defined."),!0;if(!n.hasOwnProperty(le.HAS_ANSWER))return!1;var v=u.getValues(n,le.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(pe.compareValues(S,E))return!0}}return!1},e._getMappedObjectsArray=function(e,t){return ue.asArray(e).map(function(e){var n=ce.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(le.HAS_ANSWER)){var n=u.getValues(t,le.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return!0}}for(var r,i=ne(ue.asArray(t[le.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(le.HAS_ANSWER)){var n=u.getValues(t,le.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=ne(ue.asArray(t[le.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=e.isDate(t),i=e.isTime(t),a=e.isDateTime(t);switch(!0){case r:return t[le.DATE_FORMAT]||o.dateFormat;case i:return t[le.TIME_FORMAT]||o.timeFormat;case a:return t[le.DATETIME_FORMAT]||o.dateTimeFormat;default:return null}},e.dfsTraverseQuestionTree=function(e,t,n){function o(e){t(e),ue.asArray(e[le.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[le.REQUIRES_ANSWER]&&!e[le.USED_ONLY_FOR_COMPLETENESS]?i=t+o+"required: "+e[le.REQUIRES_ANSWER]+"\n":e[le.USED_ONLY_FOR_COMPLETENESS]&&(i=t+o+"required only for completeness: "+e[le.USED_ONLY_FOR_COMPLETENESS]+"\n"),r+=t+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",r+=e[le.HELP_DESCRIPTION]?t+o+"description: "+e[le.HELP_DESCRIPTION]+"\n":"",r+=i,r+=e[le.PATTERN]?t+o+"pattern: "+e[le.PATTERN]+"\n":"",r+=e[le.INPUT_MASK]?t+o+"mask: "+e[le.INPUT_MASK]+"\n":"",r+=e[le.XSD.MAX_INCLUSIVE]?t+o+"This field should be a number equal or lower to "+e[le.XSD.MAX_INCLUSIVE]+"\n":"",r+=e[le.XSD.MIN_INCLUSIVE]?t+o+"This field must be greater or equal to "+e[le.XSD.MIN_INCLUSIVE]+"\n":"",r+=e[le.HAS_VALIDATION_MESSAGE]?t+o+"validation-message: "+e[le.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(le.XSD);n<o.length;n++)if(t.includes(o[n]))return!0;return!1},e.getInputMask=function(e){if(e[le.INPUT_MASK])return e[le.INPUT_MASK]},e}(),de={},fe=[],he=/*#__PURE__*/e.createContext({}),Ee=function(r){var i=n(r.data||de),a=i[0],s=i[1],l=n(r.formQuestions||fe),u=l[0],c=l[1];o(function(){if(r.isFormValid){var e=me.isValid(a);r.isFormValid(e)}},[]),o(function(){s(r.data||de)},[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=me.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(he.Provider,J({value:h},r),r.children)};Ee.propTypes={children:l.element.isRequired,data:l.object.isRequired,formQuestions:l.array.isRequired,isFormValid:l.func};var ve=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={cursorPosition:0},n}Z(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),className:"mb-3"},/*#__PURE__*/e.createElement(d.Check,J({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",className:"mb-3"},/*#__PURE__*/e.createElement(d.Check,J({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",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(h,J({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",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(h,J({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",className:"mb-3"},this._renderLabel(),/*#__PURE__*/e.createElement(h,J({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);ve.propTypes={type:l.string,label:l.object,value:l.any,onChange:l.func,help:l.string,validation:l.object,placeholder:l.string},ve.defaultProps={type:"text"};var Se=["children"],Ae=/*#__PURE__*/e.createContext({}),ge={components:{inputComponent:ve},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}},_e=function(n){var o=n.children,r=ee(n,Se),i=t(function(){return{inputComponent:r.components&&r.components.inputComponent||ge.components.inputComponent,componentsOptions:Object.assign({},ge.componentsOptions,r.componentsOptions),options:Object.assign({},ge.options,r.options),mapComponent:r.mapComponent}},[r]);/*#__PURE__*/return e.createElement(Ae.Provider,{value:i},o)};_e.propTypes={children:l.element.isRequired,components:l.object,mapComponent:l.func,options:l.object};var Te,Ne,Ie={"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 ","error.default_message":"Něco se pokazilo.","error.view_details":"Zobrazit podrobnosti o chybě"},Oe={"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 ","error.default_message":"Something went wrong.","error.view_details":"View Error Details"},Ce=/*#__PURE__*/e.createContext({}),be=function(e){var t=e.locale,n=void 0===t?navigator.language:t,o=Oe;return n===le.LANG.cs.locale&&(o=Ie),M(Ce.Provider,{value:{locale:n,lang:o},children:M(j,{locale:n,messages:o,children:e.children})})},we={"@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":""}}]}]}]},ye=/*#__PURE__*/function(){function e(){}return e.generateForm=function(){return JSON.parse(JSON.stringify(we))},e}(),Le={root:(Te={},Te[le.HAS_LAYOUT_CLASS]=le.FORM,Te),expandProperties:[le.HAS_SUBQUESTION,le.IS_RELEVANT_IF,le.HAS_ANSWER,le.HAS_DECLARED_PREFIX,le.HAS_OPTION,le.HAS_COMMENT]},Re=/*#__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=Le),u.flatten(e,null,null,function(e,t){})},e.expandStructure=function(e){var t,n={};e["@graph"].forEach(function(e){n[e["@id"]]=e,me.isForm(e)&&(t=e)});try{this._expandGraph(t,Le,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]=ue.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}();Ne=Re,Re.compressStructure=function(e){var t=[],n=new Set;return(t=Ne._compressGraph(e,t,n)).sort(function(e,t){return e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0})},Re._compressGraph=function(e,t,n){return n.has(e["@id"])||(t.push(e),n.add(e["@id"])),Le.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=Ne._compressGraph(a,t,n),e[o][i]={"@id":a["@id"]})}}),t};var De=/*#__PURE__*/function(){function e(){}return e.constructDefaultForm=function(t){var n=ye.generateForm();return e._constructFormQuestions(n,t)},e.constructForm=function(t,n){try{var o,r;return Promise.resolve(u.compact(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=Re.expandStructure(e),Object.keys(r).map(function(e){ce.putObject(e,r[e])})):console.warn("default form is constructed."),!(o=(n=e["@graph"].find(function(e){return me.isForm(e)}))[le.HAS_SUBQUESTION]))throw re.error("Could not find any questions in the received data."),"No questions in the form";return(i=o.filter(function(e){return!(!me.isWizardStep(e)||me.isHidden(e))||(re.warn("Item is not a wizard step: "+e),!1)})).length||(re.log("Could not find any wizard steps in the received data. Building form without steps"),n[le.HAS_SUBQUESTION].forEach(function(e){return i.push(e)})),i.sort(pe.getCompareLocalizedLabelFunction(t)),pe.orderPreservingToplogicalSort(i,le.HAS_PRECEDING_QUESTION),[i,{root:n}]},e}(),Ve=/*#__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,le.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,le.HAS_QUESTION_ORIGIN,"@id"),t[le.HAS_SUBQUESTION]){n.subQuestions=[];for(var o=0;o<t[le.HAS_SUBQUESTION].length;o++)n.subQuestions.push(e._processQuestion(t[le.HAS_SUBQUESTION][o]))}if(t[le.HAS_ANSWER]){n.answers=[],Array.isArray(t[le.HAS_ANSWER])||(t[le.HAS_ANSWER]=[t[le.HAS_ANSWER]]);for(var r=0;r<t[le.HAS_ANSWER].length;r++)n.answers.push(e.processAnswer(t[le.HAS_ANSWER][r]))}if(t[le.HAS_COMMENT]){n.comments=[],Array.isArray(t[le.HAS_COMMENT])||(t[le.HAS_COMMENT]=[t[le.HAS_COMMENT]]);for(var i=0;i<t[le.HAS_COMMENT].length;i++)n.comments.push(e.processComment(t[le.HAS_COMMENT][i]))}return n},e.processComment=function(e){var t={};return t.author=c.getJsonAttValue(e,le.HAS_AUTHOR,"@id"),t.value=c.getJsonAttValue(e,le.HAS_COMMENT_VALUE),t.timestamp=c.getJsonAttValue(e,le.HAS_TIMESTAMP,"@id"),t},e.processAnswer=function(e){var t={};return t.uri=e["@id"],t.origin=c.getJsonAttValue(e,le.HAS_ANSWER_ORIGIN,"@id"),e[le.HAS_OBJECT_VALUE]?t.codeValue=c.getJsonAttValue(e,le.HAS_OBJECT_VALUE,"@id"):t.textValue=c.getJsonAttValue(e,le.HAS_DATA_VALUE),t},e.generateAnswer=function(e){var t={};return t[le.HAS_DATA_VALUE]="",t},e}(),He=function(t){var n=r(Ae);/*#__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||me.isDisabled(t.question)})};He.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(Ae).componentsOptions,a=n(null),s=a[0],l=a[1],u=n(""),c=u[0],p=u[1],m=me.resolveDateTimeFormat(t.question,t.value,i.dateTimeAnswer),h=me.isDate(t.question),E=me.isTime(t.question),v=me.isTimestamp(t.question);o(function(){var e=S(t.value);e?l(e):(l(null),p("Invalid date value "+t.value+" of question "+t.question["@id"]+"."),console.error(c))},[t.value,m]);var S=function(e){if(!e)return null;var t=v?new Date(e):q(e,m,new Date);return isNaN(t.getTime())?null:t};/*#__PURE__*/return e.createElement(f,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(d.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(x,{selected:s,placeholderText:m,onChange:function(e){l(e);var n=e?v?e.getTime():k(e,m):"";t.onChange(n)},showTimeSelect:!h,showTimeSelectOnly:E,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:m,className:z("form-control",t.validation.classname),disabled:i.readOnly||me.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 Ue=[le.XSD.INT,le.XSD.INTEGER,le.XSD.NON_NEGATIVE_INTEGER,le.XSD.NON_POSITIVE_INTEGER,le.XSD.NEGATIVE_INTEGER,le.XSD.POSITIVE_INTEGER,le.XSD.FLOAT,le.XSD.POSITIVE_FLOAT,le.XSD.NEGATIVE_FLOAT],je={};je[le.XSD.NON_NEGATIVE_INTEGER]={min:0},je[le.XSD.NON_POSITIVE_INTEGER]={max:0},je[le.XSD.NEGATIVE_INTEGER]={max:-1},je[le.XSD.POSITIVE_INTEGER]={min:1};var Pe={"string-2":"prefixed",atom:"var"},xe=/*#__PURE__*/function(){function e(){}return e._resolveInputType=function(t,n){return me.isSparqlInput(t)||me.isTurtleInput(t)||me.isTextarea(t,n)?"textarea":e._isNumeric(t)?"number":"text"},e._isNumeric=function(e){for(var t=0,n=Ue.length;t<n;t++)if(c.hasValue(e,le.HAS_DATATYPE,Ue[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||me.isDisabled(t),r},e._resolveStepRestriction=function(e){var t={};return void 0!==e[le.STEP]&&(t.step=c.getJsonAttValue(e,le.STEP)),t},e._resolveNumberRestrictions=function(e){var t={};return Object.getOwnPropertyNames(je).forEach(function(n){c.hasValue(e,le.HAS_DATATYPE,n)&&(t=Object.assign({},t,je[n]))}),void 0!==e[le.XSD.MIN_INCLUSIVE]&&(t.min=e[le.XSD.MIN_INCLUSIVE]),void 0!==e[le.XSD.MIN_EXCLUSIVE]&&(t.min=e[le.XSD.MIN_EXCLUSIVE]+1),void 0!==e[le.XSD.MAX_EXCLUSIVE]&&(t.max=e[le.XSD.MAX_EXCLUSIVE]-1),void 0!==e[le.XSD.MAX_INCLUSIVE]&&(t.max=e[le.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}(),qe=function(t){var n=r(Ae),o=n.inputComponent,i=n.componentsOptions,a=t.question,s=t.answer,l=t.value;return s[le.HAS_OBJECT_VALUE]&&s[le.HAS_OBJECT_VALUE][c.RDFS_LABEL]&&(l=c.getJsonAttValue(s[le.HAS_OBJECT_VALUE],c.RDFS_LABEL)),/*#__PURE__*/e.createElement(o,Object.assign({},xe.resolveInputProperties(a,l,i),{validation:t.validation,label:t.label,title:t.title,value:null==l?"":l,placeholder:me.getInputMask(a),onKeyPress:function(e){return xe._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=F.fromTextArea(e.target);n.setValue(l),n.on("change",function(){t.onChange(n.getValue())}),F.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"===Pe[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[le.HAS_DECLARED_PREFIX]&&t.question[le.HAS_DECLARED_PREFIX].filter(function(e){return e[le.PREFIX]===l.slice(0,-1)}).length){var u=t.question[le.HAS_DECLARED_PREFIX].filter(function(e){return e[le.PREFIX]===l.slice(0,-1)}),c={};c[u[0][le.PREFIX]]=u[0][le.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=F.fromTextArea(e.target);o.setValue(l),o.on("change",function(){t.onChange(o.getValue())})}}}))};qe.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 ke={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"},ze=/*#__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+=ke[t]?ke[t]:t;return n},e}(),Fe=["size","placeholder"];function Qe(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 Be=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this)._updatePattern=function(e){n.mask.setPattern(ze.mapMask(e.mask),{value:n.mask.getRawValue(),selection:Qe(n.input)})},n._updateMaskSelection=function(){n.mask.selection=Qe(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 Q({pattern:ze.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"}),n}Z(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(ze.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(ze.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(ze.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=ee(n,Fe),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);Be.contextType=Ae,Be.propTypes={mask:l.string.isRequired},Be.defaultProps={value:""};var We=function(t){var n=r(Ae).componentsOptions,o=t.question,i=t.value,a=c.getJsonAttValue(o,le.INPUT_MASK);return a?/*#__PURE__*/e.createElement(Be,{mask:a,value:i,label:t.label,title:t.title,placeholder:a,onChange:function(e){return t.onChange(e.target.value)},disabled:n.readOnly||me.isDisabled(o),validation:t.validation}):(re.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(qe,t))};We.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 Xe=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}Z(n,t);var o=n.prototype;return o._generateSelectOptions=function(t){var n=[];t.sort(function(e,t){var n=c.getJsonAttValue(e,le.RDFS_LABEL),o=c.getJsonAttValue(t,le.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],le.RDFS_LABEL),key:"opt-"+o},c.getJsonAttValue(t[o],le.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||me.isDisabled(n)},this._generateSelectOptions(n[le.HAS_OPTION]))},n}(e.Component);Xe.contextType=Ae,Xe.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.string,onChange:l.func.isRequired,validation:l.object};var Ge=function(e,t){return void 0!==e&&e.length?(e.sort(pe.getCompareLocalizedLabelFunction(t)),pe.orderPreservingToplogicalSort(e,le.HAS_PRECEDING_VALUE),e):[]},Ye=function(t){var i=ue.getStringHash(me.getPossibleValuesQuery(t.question)),a=r(ae),s=r(Ae),l=s.options.intl,u=n(!0),p=u[0],m=u[1],h=n(Ge(t.options,l)),E=h[0],v=h[1];o(function(){var e=!1,n=t.question;return!n[le.HAS_OPTION]&&me.getPossibleValuesQuery(n)?function(){try{var t=function(t,o){try{var r=Promise.resolve(a.loadFormOptions(i,me.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(){re.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[le.HAS_OPTION])),function(){e=!0}},[i,a,t.question,l]);var S,A,g=function(e){if(!e)return[];for(var t,n={},o=[],r=ne(e=Ge(e,l));!(t=r()).done;){var i=t.value,a=c.getLocalized(i[le.RDFS_LABEL],l),s=c.getLocalized(i[le.RDFS_COMMENT],l);n[i["@id"]]={id:i["@id"],value:i["@id"],label:a,description:s,children:[]};for(var u,p=ne(ue.asArray(i[le.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)},_=ue.findKeyInObjects(E,["name","value"]),T=ue.findKeyInObjects(E,["name","label"]);/*#__PURE__*/return e.createElement(f,{size:"small",className:"mb-3"},/*#__PURE__*/e.createElement(d.Label,null,t.label),/*#__PURE__*/e.createElement(B,{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[le.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES]?function(t){/*#__PURE__*/return e.createElement(e.Fragment,null,t)}:null,value:E.find(function(e){return e.id===t.value})||null,multi:!1,options:E,isSearchable:!0,isLoading:p,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,isDisabled:p||s.componentsOptions.readOnly||me.isDisabled(t.question),onChange:function(e){t.onChange(e?e.id:null)},titleKey:"description"}),t.validation.message)};Ye.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 Ke=function(t){/*#__PURE__*/return e.createElement("svg",{className:"caret-square-up",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t.title||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 17.453c-0.172 0.344-0.516 0.547-0.891 0.547h-10c-0.375 0-0.719-0.203-0.891-0.547-0.172-0.328-0.141-0.734 0.078-1.031l5-7c0.187-0.266 0.484-0.422 0.812-0.422s0.625 0.156 0.812 0.422l5 7c0.219 0.297 0.25 0.703 0.078 1.031zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"}))},Je=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"}))},Ze=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"}))},$e=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"}))},et=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)))};et.propTypes={tooltipContent:l.oneOfType([l.object.isRequired,l.string.isRequired]),id:l.string.isRequired,overlayPlacement:l.string,absolutePosition:l.bool,show:l.bool},et.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};var tt=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(et,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o[0],absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement($e,{className:t.iconClass})))};tt.propTypes={text:l.string.isRequired,iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},tt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var nt=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"}))},ot=function(t){/*#__PURE__*/return e.createElement(et,{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(nt,{className:t.iconClass})))};ot.propTypes={url:l.oneOfType([l.string.isRequired,l.object.isRequired]),iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},ot.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var rt=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"}))},it=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"}))))},at="Unknown author",st=function(t){var o=r(Ae).options,i=n(!1),a=i[0],s=i[1],l=n(!1),u=l[0],c=l[1];W.addLocale(G),W.addLocale(X),W.setDefaultLocale(le.LANG.en.locale);var p,m=new W(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 at},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(ot,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():at})):d())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},/*#__PURE__*/e.createElement(et,{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(Y.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(it,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};st.propTypes={author:l.object,timestamp:l.string.isRequired,commentValue:l.string.isRequired,onDeleteQuestionComment:l.func.isRequired,onDeleteViewComment:l.func,index:l.number.isRequired};var lt=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?U("div",{className:"comment-delete",children:[M(K,{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(st,{commentValue:e[le.HAS_COMMENT_VALUE],author:e[le.HAS_AUTHOR]?e[le.HAS_AUTHOR]:null,timestamp:e[le.HAS_TIMESTAMP],onDeleteQuestionComment:r,onDeleteViewComment:c,index:t})},t)})})})},ut=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"}))},ct="300px",pt=function(t){var r=n(""),a=r[0],s=r[1],l=i(null),u=P();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(ct)&&(e.style.height=ct)};/*#__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 position-relative",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(ut,null)))))))};pt.propTypes={onChange:l.func.isRequired};var mt,dt=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"}))},ft=function(t){var a=r(Ae),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[le.HAS_COMMENT]||(e[le.HAS_COMMENT]=[]),Array.isArray(e[le.HAS_COMMENT])||(e[le.HAS_COMMENT]=[e[le.HAS_COMMENT]]),e[le.HAS_COMMENT]},A=function(e){var n={};g(n,e),t.onChange(O(),n)},g=function(e,t){a.options.currentUser&&(e[le.HAS_AUTHOR]={"@id":a.options.currentUser}),e[le.HAS_COMMENT_VALUE]=t,e[le.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(rt,null),O()>0?/*#__PURE__*/e.createElement(_,{className:"comment-badge",pill:!0,variant:"primary"},O()):null),/*#__PURE__*/e.createElement(Y.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,J({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:function(e){!function(e){"Escape"===e.key&&E()}(e)}},/*#__PURE__*/e.createElement(Y.div,{className:"close-comment-icon",onClick:E,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(dt,null)),/*#__PURE__*/e.createElement(lt,{comments:S(),onDeleteCommentClick:N}),/*#__PURE__*/e.createElement(pt,{onChange:A})))})))};ft.propTypes={question:l.object.isRequired,onChange:l.func.isRequired};var ht=/*#__PURE__*/function(){function t(){}return t.renderIcons=function(t,n,o,r){var i;i=n.icons?n.icons:le.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===le.ICONS.QUESTION_COMMENTS&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},l)),i[c].id===le.ICONS.QUESTION_HELP&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},s)),i[c].id===le.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(le.ICONS.QUESTION_HELP,e,t,n,o)},t.renderQuestionLink=function(e,t,n,o){return this.getIconComponentFromName(le.ICONS.QUESTION_LINK,e,t,n,o)},t.getIconComponentFromName=function(e,t,n,o,r){var i=this.getIconFromIconList(n.icons?n.icons:le.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===le.ICON_BEHAVIOR.ON_HOVER||t.behavior===le.ICON_BEHAVIOR.ENABLE))return t.behavior===le.ICON_BEHAVIOR.ENABLE?(i=!0,a=""):a="emphasise-on-relevant-icon",t.id===le.ICONS.QUESTION_HELP&&n[le.HELP_DESCRIPTION]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(tt,{text:c.getLocalized(n[le.HELP_DESCRIPTION],o.intl),absolutePosition:!1})):null:t.id===le.ICONS.QUESTION_LINK&&n[le.SOURCE]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(ot,{url:n[le.SOURCE]})):null:t.id===le.ICONS.QUESTION_COMMENTS&&i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(ft,{question:n,onChange:r})):null},t}();mt=ht,ht.renderQuestionComments=function(e,t,n,o){return mt.getIconComponentFromName(le.ICONS.QUESTION_COMMENTS,e,t,n,o)},ht.getIconFromIconList=function(e,t){return e?e.find(function(e){return e.id===t}):null};var Et=function(t){var r=e.useContext(ae),i=e.useContext(Ae).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[le.HAS_OBJECT_VALUE]=null,e[le.HAS_DATA_VALUE]=null):t.answer[le.HAS_OBJECT_VALUE]||me.isTypeahead(t.question)?e[le.HAS_OBJECT_VALUE]={"@id":n}:e[le.HAS_DATA_VALUE]={"@value":n}},f=function(){l({severity:"",classname:"",message:null}),!1===h[le.HAS_VALID_ANSWER]&&l(h[le.HAS_VALIDATION_SEVERITY]===le.VALIDATION.SEVERITY.WARNING?{severity:le.VALIDATION.SEVERITY.WARNING,classname:le.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(N,{className:le.VALIDATION.CLASSNAME.WARNING},h[le.HAS_VALIDATION_MESSAGE])}:{severity:le.VALIDATION.SEVERITY.ERROR,classname:le.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(N,{className:le.VALIDATION.CLASSNAME.ERROR},h[le.HAS_VALIDATION_MESSAGE])})},h=t.question,E=me.resolveValue(t.answer),v=function(n){var o=c.getLocalized(n[le.RDFS_LABEL],i.intl);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,ht.renderIcons(t.question,i,t.onCommentChange,t.showIcon))}(h),S=c.getLocalized(h[le.RDFS_COMMENT],i.intl);return u=me.isTypeahead(h)?function(n,o,i){var a=ue.getStringHash(me.getPossibleValuesQuery(t.question)),l=r.getOptions(a)||[];/*#__PURE__*/return e.createElement(Ye,{question:t.question,answer:t.answer,label:o,title:i,value:n,onChange:m,options:l,validation:s})}(E,v,S):(p=h)[le.HAS_OPTION]&&0!==p[le.HAS_OPTION].length?function(n,o,r){/*#__PURE__*/return e.createElement(Xe,{question:t.question,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S):me.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):me.isCheckbox(h)?function(n,o,r){/*#__PURE__*/return e.createElement(He,{label:o,title:r,value:n,onChange:m,question:t.question,validation:s})}(E,v,S):me.isMaskedInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(We,{label:o,title:r,value:n,onChange:m,question:t.question,answer:t.answer,validation:s})}(E,v,S):me.isSparqlInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(qe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,sparql:!0,validation:s})}(E,v,S):me.isTurtleInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(qe,{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(qe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S),u};Et.propTypes={answer:l.object.isRequired,question:l.object.isRequired,onChange:l.func.isRequired,onCommentChange:l.func.isRequired,index:l.number,icons:l.object};var vt=function(e,t){var n=[It,Nt,At,_t,gt,Tt];return function(){if(me.hasValidationLogic(e,t)){var o=me.getAnswerValue(e);return St(e,t,o,n)}}},St=function(e,t,n,o){for(var r,i={},a=ne(o);!(r=a()).done;){var s=(0,r.value)(e,t);if(!s.isValid)return i[le.HAS_VALID_ANSWER]=!1,i[le.HAS_VALIDATION_MESSAGE]=s.message,i[le.HAS_VALIDATION_SEVERITY]=s.validationSeverity,i;if(!1===i[le.HAS_VALID_ANSWER])break}return i[le.HAS_VALID_ANSWER]=!0,i[le.HAS_VALIDATION_MESSAGE]="",i[le.HAS_VALIDATION_SEVERITY]="",i},At=function(e,t){var n=me.getAnswerValue(e);return n&&n.length>0&&e[le.PATTERN]&&!new RegExp(e[le.PATTERN]).test(n)&&me.hasAnswer(e)?{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},gt=function(e,t){return!e[le.REQUIRES_ANSWER]||e[le.USED_ONLY_FOR_COMPLETENESS]||me.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})}},_t=function(e,t){return me.isCheckbox(e)&&e[le.REQUIRES_ANSWER]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0}},Tt=function(e,t){return e[le.REQUIRES_ANSWER]&&e[le.USED_ONLY_FOR_COMPLETENESS]&&!me.hasAnswer(e)?{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.WARNING,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0}},Nt=function(e,t){if(e[le.XSD.MIN_INCLUSIVE]){var n=me.getAnswerValue(e);if(n&&n.length>0){var o=e[le.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},It=function(e,t){var n=me.getAnswerValue(e);if(e[le.XSD.MAX_INCLUSIVE]&&n&&n.length>0){var o=e[le.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:le.VALIDATION.SEVERITY.ERROR,message:e[le.HAS_VALIDATION_MESSAGE]?e[le.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}},Ot=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={prefixes:e.prefixes},n}return Z(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[le.PREFIX]<t[le.PREFIX]?-1:1}).map(function(t){/*#__PURE__*/return e.createElement(C,{key:t[le.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[le.PREFIX]),": ",t[le.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);Ot.propTypes={prefixes:l.array.isRequired,children:l.element.isRequired,iconClass:l.string},Ot.defaultProps={iconClass:""};var Ct=function(e){var t;return(t=e.question[le.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},bt=/*#__PURE__*/function(t){function n(e){var o;return(o=t.call(this,e)||this).handleAnswerChange=function(e,t){if(me.isSection(o.props.question)){var n=!!me.resolveValue(t);o.setState({expanded:n})}o._handleChange(le.HAS_ANSWER,e,t)},o.handleSubQuestionChange=function(e,t){o._handleChange(le.HAS_SUBQUESTION,e,t)},o.handleCommentChange=function(e,t){o._handleChange(le.HAS_COMMENT,e,t)},o._toggleCollapse=function(){o.props.collapsible&&o.setState({expanded:!o.state.expanded})},o._onEnterHandler=function(){o.setState({showIcon:!0})},o._onLeaveHandler=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"),me.isWizardStep(e)&&r.push("wizard-step bg-primary text-white"),me.isEmphasised(e)&&r.push(n.getEmphasizedClass(e)),me.isSection(e)&&r.push("section-background"),t&&r.push("cursor-pointer"),o.isDebugged(e)&&r.push("show-irrelevant"),r},ce.putObject(e.question["@id"],e.question),o.state={validator:{},expanded:!me.isCollapsed(e.question),showIcon:!1},o}Z(n,t);var o=n.prototype;return o.componentDidMount=function(){this.setState({validator:vt(this.props.question,this.props.intl)})},o.componentDidUpdate=function(){var e=this.props.question,t=this.context.options.startingQuestionId,n=e[le.HAS_SUBQUESTION].find(function(e){return e["@id"]===t});if(me.isSection(e)&&me.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===le.HAS_ANSWER){var r=this.state.validator(n);o=Object.assign({},o,r)}ce.putObject(o["@id"],o),this.props.onChange(this.props.index,o)},o.isDebugged=function(e){var t=this.context.options.startingQuestionId;return!me.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!ue.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):me.isHidden(t)?null:me.isRelevant(t)?n:null},o.renderQuestion=function(t){if(me.isAnswerable(t)&&!me.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(me.isAnswerable(t))return this.renderAnswerableSection();if(me.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:z("p-3",a)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(w,{activeKey:this.state.expanded?s:void 0,className:"mb-3"},/*#__PURE__*/e.createElement(w.Item,{eventKey:s},/*#__PURE__*/e.createElement(b,{className:""},/*#__PURE__*/e.createElement(w.Button,{as:b.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"d-inline",id:t["@id"]},r&&!me.isWizardStep(t)&&this._renderCollapseToggle(),s),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(w.Body,{className:"p-0"},r?l:/*#__PURE__*/e.createElement(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(Ct,{key:this.props.question["@id"]+"-media",question:this.props.question})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t},o.renderQuestionIcons=function(){return ht.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:z("p-3",r)},this.renderSubQuestions(i)),s=this._getHeaderClassName();return this.state.expanded&&s.push("text-primary"),/*#__PURE__*/e.createElement(w,{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:s},this.renderAnswers()),o?/*#__PURE__*/e.createElement(w.Collapse,{className:i,eventKey:t["@id"]},a):{cardBody:a}))},o.getShowIrrelevantClassname=function(e){return!this.context.options.debugMode&&!pe.checkId(e[le.HAS_SUBQUESTION],this.context.options.startingQuestionId)||me.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++)me.isTextarea(o,me.resolveValue(i[a]))||me.isSparqlInput(o)||me.isTurtleInput(o),t=z("answer",n._getQuestionCategoryClass(o),n.getEmphasizedOnRelevantClass(o)),r.push(/*#__PURE__*/e.createElement("div",{key:"row-item-"+a,className:t,id:o["@id"],onMouseEnter:this._onEnterHandler,onMouseLeave:this._onLeaveHandler,onFocus:this._onEnterHandler,onBlur:this._onLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"answer-content",style:this._getAnswerWidthStyle()},/*#__PURE__*/e.createElement(Et,{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[le.HAS_ANSWER]||(e[le.HAS_ANSWER]=[]),Array.isArray(e[le.HAS_ANSWER])||(e[le.HAS_ANSWER]=[e[le.HAS_ANSWER]]),0===e[le.HAS_ANSWER].length&&(e[le.HAS_ANSWER]=me.isSection(e)&&!me.isAnswerable(e)?[]:[Ve.generateAnswer(e)]),e[le.HAS_ANSWER]},o._getAnswerWidthStyle=function(){var e=Number(this.props.question[le.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===le.GENERATED_ROW_SIZE?"col-6":"col-"+le.COLUMN_COUNT/le.GENERATED_ROW_SIZE},n._getQuestionCategoryClass=function(e){var t=me.getCategory(e);return t?"question-"+t:""},n.getEmphasizedClass=function(e){return me.isEmphasised(e)?"bg-warning":""},n.getEmphasizedOnRelevantClass=function(e){return c.hasValue(e,le.LAYOUT_CLASS,le.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?Ke:Je,{title:t}))},o._renderPrefixes=function(){var t=this.props.question;return t[le.HAS_DECLARED_PREFIX]&&t[le.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(Ot,{prefixes:t[le.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(Ze,null)):null},o._renderUnits=function(){var t=this.props.question;return t[le.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[le.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||ue.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[le.HAS_SUBQUESTION]||(e[le.HAS_SUBQUESTION]=[]),Array.isArray(e[le.HAS_SUBQUESTION])||(e[le.HAS_SUBQUESTION]=[e[le.HAS_SUBQUESTION]]),pe.orderByLocalizedLabels(e[le.HAS_SUBQUESTION],this.context.options.intl),pe.orderPreservingToplogicalSort(e[le.HAS_SUBQUESTION],le.HAS_PRECEDING_QUESTION),e[le.HAS_SUBQUESTION]},o._getFirstAnswerValue=function(){return me.resolveValue(this._getAnswers()[0])},n}(e.Component);bt.contextType=Ae,bt.propTypes={question:l.object.isRequired,onChange:l.func.isRequired,index:l.number,withoutCard:l.bool,collapsible:l.bool},bt.defaultProps={withoutCard:!1,collapsible:!0};var wt=function(t){var n=r(he),o=n.updateFormQuestionsData,i=n.getFormQuestionsData,a=P(),s=i([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(bt,{question:s,onChange:function(e,n){o(t.index||e,Object.assign({},t.question,n))},collapsible:me.isAnswerable(s),intl:a}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(y,{className:"m-3 float-end"},!t.isFirstStep&&/*#__PURE__*/e.createElement(g,{className:"me-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"}))))};wt.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 yt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Ae).options,s=P();/*#__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(et,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(R,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(D,{eventKey:n,active:n===i?"active":"",hidden:!a.debugMode&&!me.isRelevant(t),disabled:!a.enableWizardStepSkip,className:z([a.debugMode&&!me.isRelevant(t)?"show-irrelevant":bt.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=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Ae).options,s=P();/*#__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(et,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(C,{hidden:!a.debugMode&&!me.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:z([a.debugMode&&!me.isRelevant(t)?"show-irrelevant":bt.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],a.intl)))})))};Lt.propTypes={currentStep:l.number.isRequired,steps:l.array.isRequired,onNavigate:l.func.isRequired};var Rt,Dt=function(e,t){var n=function e(n,o){return n?n["@id"]===t?o:ue.asArray(n[le.HAS_SUBQUESTION]).findIndex(function(t,n){return-1!==e(t,n)}):-1};return e.findIndex(function(e,t){return-1!==n(e,t)})},Vt=function(){var t=e.useContext(he),n=e.useContext(Ae),r=n.options,i=n.mapComponent,a=0;r.startingQuestionId?-1===(a=Dt(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?yt:Lt,{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],wt),/*#__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}))))},Ht=/*#__PURE__*/e.forwardRef(function(t,n){var o=e.useContext(Ae).options;/*#__PURE__*/return e.createElement(V,J({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))});Ht.propTypes={children:l.element.isRequired};var Mt=function(){};Rt=Mt,Mt.updateQuestionValidation=function(e,t,n,o){var r=vt(t,o)();r&&(e[n]=Object.assign({},t,r));for(var i,a=ne(e);!(i=a()).done;)Rt.updateSubQuestionsValidation(i.value,o)},Mt.updateSubQuestionsValidation=function(e,t){for(var n=ue.asArray(e[le.HAS_SUBQUESTION]),o=0;o<n.length;o++)Rt.updateQuestionValidation(n,n[o],o,t)};var Ut=/*#__PURE__*/a(function(t,n){var o=r(he),i=o.getFormQuestionsData,a=o.updateFormQuestionsData,l=o.getData,u=P();s(n,function(){return{validateForm:p,getFormSpecification:m,getFormQuestionsData:i,getFormData:c}},[]);var c=function(){var e=l(),t=i();return Ve.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 me.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,bt);/*#__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!me.isWizardStep(e)});return h?/*#__PURE__*/e.createElement(Ht,null,v?d():/*#__PURE__*/e.createElement(Vt,null)):v?d():/*#__PURE__*/e.createElement(Vt,null)}),jt=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={hasError:!1,errorLabel:null,errorDetails:null},n}Z(n,t),n.getDerivedStateFromError=function(e){return{hasError:!0,error:e}};var o=n.prototype;return o.componentDidCatch=function(e,t){this.setState({errorLabel:e,errorDetails:t})},o.render=function(){if(this.state.hasError){var t=this.context.lang;/*#__PURE__*/return e.createElement("div",{style:{padding:"20px"}},/*#__PURE__*/e.createElement(H,{variant:"danger"},/*#__PURE__*/e.createElement(H.Heading,null,t["error.default_message"]||"Something went wrong."),/*#__PURE__*/e.createElement("p",null,this.state.errorLabel&&this.state.errorLabel.toString())),/*#__PURE__*/e.createElement(w,null,/*#__PURE__*/e.createElement(b,null,/*#__PURE__*/e.createElement(b.Header,null,/*#__PURE__*/e.createElement(w.Toggle,{as:g,variant:"link",eventKey:"0"},t["error.view_details"]||"View Error Details")),/*#__PURE__*/e.createElement(w.Collapse,{eventKey:"0"},/*#__PURE__*/e.createElement(b.Body,null,/*#__PURE__*/e.createElement("pre",{style:{whiteSpace:"pre-wrap"}},this.state.errorDetails&&this.state.errorDetails.componentStack))))))}return this.props.children},n}(e.Component);jt.contextType=Ce;var Pt=/*#__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(De.constructForm(t.form,t.options.intl)).then(function(e){var t=e[0],n=e[1];t.formQuestions.some(function(e){return me.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=ne(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(_e,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:f,options:t.options},/*#__PURE__*/e.createElement(be,{locale:t.options.intl.locale},/*#__PURE__*/e.createElement(jt,null,/*#__PURE__*/e.createElement(se,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(Ee,{data:m,formQuestions:u.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(Ut,{ref:r,modalView:t.options&&t.options.modalView,mapComponent:f}))))))});Pt.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{Et as Answer,Ae as ConfigurationContext,le as Constants,he as FormQuestionsContext,me as FormUtils,tt as HelpIcon,be as IntlContextProvider,Re as JsonLdFramingUtils,ce as JsonLdObjectMap,pe as JsonLdObjectUtils,bt as Question,ht as QuestionStatic,wt as WizardStep,Pt as default};
2
2
  //# sourceMappingURL=s-forms.js.map