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