UNPKG

@sheperd/sheperdsurvey

Version:

Create conversational dnpconditional-logic forms with Vue.js. sssgit

12 lines 205 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueFlowForm={},e.Vue)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),r=function(e){this.enterKey="Enter",this.shiftKey="Shift",this.ok="OK",this.continue="Continue",this.skip="Skip",this.pressEnter="Press :enterKey",this.multipleChoiceHelpText="Please choose all that apply",this.multipleChoiceHelpTextSingle="Please choose only one answer",this.otherPrompt="Other",this.placeholder="Type your answer here...",this.submitText="Submit",this.longTextHelpText=":shiftKey + :enterKey to make a line break.",this.prev="Prev",this.next="Next",this.percentCompleted=":percent% completed",this.invalidPrompt="Please fill out the field correctly",this.thankYouText="Thank you!",this.successText="Your submission has been sent.",this.ariaOk="Press to continue",this.ariaRequired="This step is required",this.ariaPrev="Previous step",this.ariaNext="Next step",this.ariaSubmitText="Press to submit",this.ariaMultipleChoice="Press :letter to select",this.ariaTypeAnswer="Type your answer here",this.errorAllowedFileTypes="Invalid file type. Allowed file types: :fileTypes.",this.errorMaxFileSize="File(s) too large. Maximum allowed file size: :size.",this.errorMinFiles="Too few files added. Minimum allowed files: :min.",this.errorMaxFiles="Too many files added. Maximum allowed files: :max.",Object.assign(this,e||{})}; /*! Copyright (c) 2020 - present, DITDOT Ltd. - MIT Licence https://github.com/ditdot-dev/vue-flow-form https://www.ditdot.hr/en */r.prototype.formatString=function(e,t){var n=this;return e.replace(/:(\w+)/g,(function(e,o){return n[o]?'<span class="f-string-em">'+n[o]+"</span>":t&&t[o]?t[o]:e}))},r.prototype.formatFileSize=function(e){var t=e>0?Math.floor(Math.log(e)/Math.log(1024)):0;return 1*(e/Math.pow(1024,t)).toFixed(2)+" "+["B","kB","MB","GB","TB"][t]};var i=Object.freeze({Date:"FlowFormDateType",Dropdown:"FlowFormDropdownType",Email:"FlowFormEmailType",File:"FlowFormFileType",LongText:"FlowFormLongTextType",MultipleChoice:"FlowFormMultipleChoiceType",Ranking:"FlowFormRankingType",MultiplePictureChoice:"FlowFormMultiplePictureChoiceType",Number:"FlowFormNumberType",Password:"FlowFormPasswordType",Phone:"FlowFormPhoneType",SectionBreak:"FlowFormSectionBreakType",Text:"FlowFormTextType",Url:"FlowFormUrlType",Matrix:"FlowFormMatrixType",AutoComplete:"FlowFormAutoCompleteType"});Object.freeze({label:"",value:"",disabled:!0});var a=Object.freeze({Date:"##/##/####",DateIso:"####-##-##",PhoneUs:"(###) ###-####"}),l=function(e){this.label="",this.value=null,this.selected=!1,this.imageSrc=null,this.imageAlt=null,Object.assign(this,e)};l.prototype.choiceLabel=function(){return this.label||this.value},l.prototype.choiceValue=function(){return null!==this.value?this.value:this.label||this.imageAlt||this.imageSrc},l.prototype.toggle=function(){this.selected=!this.selected};var u=function(e){this.url="",this.text="",this.target="_blank",Object.assign(this,e)},s=function(e){e=e||{},this.id=null,this.answer=null,this.answerOptionId=null,this.answered=!1,this.index=0,this.options=[],this.description="",this.className="",this.type=null,this.html=null,this.required=!1,this.jump=null,this.placeholder=null,this.mask="",this.multiple=!1,this.allowOther=!1,this.other=null,this.language=null,this.tagline=null,this.title=null,this.subtitle=null,this.content=null,this.inline=!1,this.helpText=null,this.helpTextShow=!0,this.descriptionLink=[],this.min=null,this.max=null,this.maxLength=null,this.nextStepOnAnswer=!1,this.accept=null,this.maxSize=null,this.rows=[],this.columns=[],Object.assign(this,e),this.type===i.Phone&&(this.mask||(this.mask=a.Phone),this.placeholder||(this.placeholder=this.mask)),this.type===i.Url&&(this.mask=null),this.type!==i.Date||this.placeholder||(this.placeholder="yyyy-mm-dd"),this.type!==i.Matrix&&this.multiple&&!Array.isArray(this.answer)&&(this.answer=this.answer?[this.answer]:[]),(this.required||void 0===e.answer)&&(!this.answer||this.multiple&&!this.answer.length)||(this.answered=!0),this.resetOptions()};s.prototype.getJumpId=function(){var e=null;return"function"==typeof this.jump?e=this.jump.call(this):this.jump[this.answer]?e=this.jump[this.answer]:this.jump._other&&(e=this.jump._other),e},s.prototype.setAnswer=function(e){this.type!==i.Number||""===e||isNaN(+e)||(e=+e),this.answer=e},s.prototype.setAnswerOptionId=function(e){this.type!==i.Number||""===e||isNaN(+e)||(e=+e),this.answerOptionId=e},s.prototype.setIndex=function(e){this.id||(this.id="q_"+e),this.index=e},s.prototype.resetOptions=function(){var e=this;if(this.options){var t=Array.isArray(this.answer),n=0;if(this.options.forEach((function(o){var r=o.choiceValue();e.answer===r||t&&-1!==e.answer.indexOf(r)?(o.selected=!0,++n):o.selected=!1})),this.allowOther){var o=null;t?this.answer.length&&this.answer.length!==n&&(o=this.answer[this.answer.length-1]):-1===this.options.map((function(e){return e.choiceValue()})).indexOf(this.answer)&&(o=this.answer),null!==o&&(this.other=o)}}},s.prototype.resetAnswer=function(){this.answered=!1,this.answer=this.multiple?[]:null,this.answerOptionId=this.multiple?[]:null,this.other=null,this.resetOptions()},s.prototype.isMultipleChoiceType=function(){return[i.MultipleChoice,i.MultiplePictureChoice].includes(this.type)};var c=!1,d=!1;"undefined"!=typeof navigator&&"undefined"!=typeof document&&(c=navigator.userAgent.match(/iphone|ipad|ipod/i)||-1!==navigator.userAgent.indexOf("Mac")&&"ontouchend"in document,d=c||navigator.userAgent.match(/android/i));var f={data:function(){return{isIos:c,isMobile:d}}},p={name:"FlowFormBaseType",props:{language:r,question:s,active:Boolean,disabled:Boolean,modelValue:[String,Array,Boolean,Number,Object]},mixins:[f],data:function(){return{dirty:!1,dataValue:null,dataId:null,answer:null,enterPressed:!1,allowedChars:null,alwaysAllowedKeys:["ArrowLeft","ArrowRight","Delete","Backspace"],focused:!1,canReceiveFocus:!1,errorMessage:null}},mounted:function(){this.question.answer?(this.dataValue=this.answer=this.question.answer,this.dataId=this.answerOptionId=this.question.answerOptionId):(this.question.multiple||"FlowFormRankingType"==this.question.type)&&(this.dataValue=[],this.dataId=[])},methods:{fixAnswer:function(e){return e},fixAnswerOptionId:function(e){return e},getElement:function(){for(var e=this.$refs.input;e&&e.$el;)e=e.$el;return e},setFocus:function(){this.focused=!0},unsetFocus:function(e){this.focused=!1},focus:function(){if(!this.focused){var e=this.getElement();e&&e.focus()}},blur:function(){var e=this.getElement();e&&e.blur()},onKeyDown:function(e){this.enterPressed=!1,clearTimeout(this.timeoutId),e&&("Enter"!==e.key||e.shiftKey||this.unsetFocus(),null!==this.allowedChars&&-1===this.alwaysAllowedKeys.indexOf(e.key)&&-1===this.allowedChars.indexOf(e.key)&&e.preventDefault())},onChange:function(e){this.dirty=!0,this.dataValue=e.target.value,this.dataId=e.target.id,this.onKeyDown(),this.setAnswer(this.dataValue),this.setAnswerOptionId(this.dataId)},onEnter:function(){this._onEnter()},_onEnter:function(){this.enterPressed=!0,this.dataValue=this.fixAnswer(this.dataValue),this.dataId=this.fixAnswerOptionId(this.dataId),this.setAnswer(this.dataValue),this.setAnswerOptionId(this.dataId),this.isValid()?this.blur():this.focus()},setAnswer:function(e){this.question.setAnswer(e),this.answer=this.question.answer,this.question.answered=this.isValid(),this.$emit("update:modelValue",this.answer)},setAnswerOptionId:function(e){this.question.setAnswerOptionId(e),this.answerOptionId=this.question.answerOptionId},showInvalid:function(){return this.dirty&&this.enterPressed&&!this.isValid()},isValid:function(){return!(this.question.required||this.hasValue||!this.dirty)||!!this.validate()},validate:function(){return!this.question.required||this.hasValue}},computed:{placeholder:function(){return this.question.placeholder||this.language.placeholder},hasValue:function(){if(null!==this.dataValue){var e=this.dataValue;return e.trim?e.trim().length>0:!Array.isArray(e)||e.length>0}return!1}},__file:"src/components/QuestionTypes/BaseType.vue"},h={extends:p,name:i.Dropdown,computed:{answerLabel:function(){for(var e=0;e<this.question.options.length;e++){var t=this.question.options[e];if(t.choiceValue()===this.dataValue)return t.choiceLabel()}return this.question.placeholder}},methods:{onKeyDownListener:function(e){"ArrowDown"===e.key||"ArrowUp"===e.key?this.setAnswer(this.dataValue):"Enter"===e.key&&this.hasValue&&(this.focused=!1,this.blur())},onKeyUpListener:function(e){"Enter"===e.key&&this.isValid()&&!this.disabled&&(e.stopPropagation(),this._onEnter(),this.$emit("next"))}}},v={class:"faux-form"},m=["value","required"],g={key:0,label:" ",value:"",disabled:"",selected:"",hidden:""},y=["disabled","value"],b=t.createElementVNode("span",{class:"f-arrow-down"},[t.createElementVNode("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"-163 254.1 284.9 284.9",style:"","xml:space":"preserve"},[t.createElementVNode("g",null,[t.createElementVNode("path",{d:"M119.1,330.6l-14.3-14.3c-1.9-1.9-4.1-2.9-6.6-2.9c-2.5,0-4.7,1-6.6,2.9L-20.5,428.5l-112.2-112.2c-1.9-1.9-4.1-2.9-6.6-2.9c-2.5,0-4.7,0.9-6.6,2.9l-14.3,14.3c-1.9,1.9-2.9,4.1-2.9,6.6c0,2.5,1,4.7,2.9,6.6l133,133c1.9,1.9,4.1,2.9,6.6,2.9s4.7-1,6.6-2.9l133.1-133c1.9-1.9,2.8-4.1,2.8-6.6C121.9,334.7,121,332.5,119.1,330.6z"})])])],-1);function w(e,t,n,o){void 0===n&&(n=!0),e=e||"",t=t||"";for(var r=0,i=0,a="";r<t.length&&i<e.length;){var l=o[c=t[r]],u=e[i];l&&!l.escape?(l.pattern.test(u)&&(a+=l.transform?l.transform(u):u,r++),i++):(l&&l.escape&&(c=t[++r]),n&&(a+=c),u===c&&i++,r++)}for(var s="";r<t.length&&n;){var c;if(o[c=t[r]]){s="";break}s+=c,r++}return a+s}function x(e,t,n,o){return void 0===n&&(n=!0),Array.isArray(t)?function(e,t,n){return t=t.sort((function(e,t){return e.length-t.length})),function(o,r,i){void 0===i&&(i=!0);for(var a=0;a<t.length;){var l=t[a];a++;var u=t[a];if(!(u&&e(o,u,!0,n).length>l.length))return e(o,l,i,n)}return""}}(w,t,o)(e,t,n,o):w(e,t,n,o)}h.render=function(e,n,o,r,i,a){return t.openBlock(),t.createElementBlock("span",v,[t.createElementVNode("select",{ref:"input",class:"",value:e.dataValue,onChange:n[0]||(n[0]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)}),onKeydown:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.onKeyDownListener&&a.onKeyDownListener.apply(a,e)}),onKeyup:n[2]||(n[2]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.onKeyUpListener&&a.onKeyUpListener.apply(a,e)}),required:e.question.required},[e.question.required?(t.openBlock(),t.createElementBlock("option",g," ")):t.createCommentVNode("v-if",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.options,(function(e,n){return t.openBlock(),t.createElementBlock("option",{disabled:e.disabled,value:e.choiceValue(),key:"o"+n},t.toDisplayString(e.choiceLabel()),9,y)})),128))],40,m),t.createElementVNode("span",null,[t.createElementVNode("span",{class:t.normalizeClass(["f-empty",{"f-answered":this.question.answer&&this.question.answered}])},t.toDisplayString(a.answerLabel),3),b])])},h.__file="src/components/QuestionTypes/DropdownType.vue";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function E(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})})),t}var k={"#":{pattern:/\d/},X:{pattern:/[0-9a-zA-Z]/},S:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleUpperCase()}},a:{pattern:/[a-zA-Z]/,transform:function(e){return e.toLocaleLowerCase()}},"!":{escape:!0}};function S(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}var C={name:"TheMask",props:{value:[String,Number],mask:{type:[String,Array],required:!0},masked:{type:Boolean,default:!1},tokens:{type:Object,default:function(){return k}}},directives:{mask:function(e,t){var n=t.value;if((Array.isArray(n)||"string"==typeof n)&&(n={mask:n,tokens:k}),"INPUT"!==e.tagName.toLocaleUpperCase()){var o=e.getElementsByTagName("input");if(1!==o.length)throw new Error("v-mask directive requires 1 input, found "+o.length);e=o[0]}e.oninput=function(t){if(t.isTrusted){var o=e.selectionEnd,r=e.value[o-1];for(e.value=x(e.value,n.mask,!0,n.tokens);o<e.value.length&&e.value.charAt(o-1)!==r;)o++;e===document.activeElement&&(e.setSelectionRange(o,o),setTimeout((function(){e.setSelectionRange(o,o)}),0)),e.dispatchEvent(S("input"))}};var r=x(e.value,n.mask,!0,n.tokens);r!==e.value&&(e.value=r,e.dispatchEvent(S("input")))}},data:function(){return{lastValue:null,display:this.value}},watch:{value:function(e){e!==this.lastValue&&(this.display=e)},masked:function(){this.refresh(this.display)}},computed:{config:function(){return{mask:this.mask,tokens:this.tokens,masked:this.masked}}},methods:{onInput:function(e){e.isTrusted||this.refresh(e.target.value)},refresh:function(e){this.display=e,(e=x(e,this.mask,this.masked,this.tokens))!==this.lastValue&&(this.lastValue=e,this.$emit("input",e))}}},D=["value"];C.render=function(e,n,o,r,i,a){var l=t.resolveDirective("mask");return t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"text",value:i.display,onInput:n[0]||(n[0]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.onInput&&a.onInput.apply(a,e)})},null,40,D)),[[l,a.config]])},C.__file="node_modules/vue-the-mask/src/component.vue";var O={extends:p,name:i.Text,components:{TheMask:C},data:function(){return{inputType:"text",canReceiveFocus:!0}},methods:{validate:function(){return this.question.mask&&this.hasValue?this.validateMask():!this.question.required||this.hasValue},validateMask:function(){var e=this;return Array.isArray(this.question.mask)?this.question.mask.some((function(t){return t.length===e.dataValue.length})):this.dataValue.length===this.question.mask.length}}},T=["data-placeholder"],A=["type","value","required","min","max","placeholder","maxlength"];O.render=function(e,n,o,r,i,a){var l=t.resolveComponent("the-mask");return t.openBlock(),t.createElementBlock("span",{"data-placeholder":"date"===i.inputType?e.placeholder:null},[e.question.mask?(t.openBlock(),t.createBlock(l,{key:0,ref:"input",mask:e.question.mask,masked:!1,type:i.inputType,value:e.modelValue,required:e.question.required,onKeydown:e.onKeyDown,onKeyup:[e.onChange,t.withKeys(t.withModifiers(e.onEnter,["prevent"]),["enter"]),t.withKeys(t.withModifiers(e.onEnter,["prevent"]),["tab"])],onFocus:e.setFocus,onBlur:e.unsetFocus,placeholder:e.placeholder,min:e.question.min,max:e.question.max,onChange:e.onChange},null,8,["mask","type","value","required","onKeydown","onKeyup","onFocus","onBlur","placeholder","min","max","onChange"])):(t.openBlock(),t.createElementBlock("input",{key:1,ref:"input",type:i.inputType,value:e.modelValue,required:e.question.required,onKeydown:n[0]||(n[0]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onKeyDown&&e.onKeyDown.apply(e,t)}),onKeyup:[n[1]||(n[1]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)}),n[2]||(n[2]=t.withKeys(t.withModifiers((function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onEnter&&e.onEnter.apply(e,t)}),["prevent"]),["enter"])),n[3]||(n[3]=t.withKeys(t.withModifiers((function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onEnter&&e.onEnter.apply(e,t)}),["prevent"]),["tab"]))],onFocus:n[4]||(n[4]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.setFocus&&e.setFocus.apply(e,t)}),onBlur:n[5]||(n[5]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.unsetFocus&&e.unsetFocus.apply(e,t)}),min:e.question.min,max:e.question.max,onChange:n[6]||(n[6]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.onChange&&e.onChange.apply(e,t)}),placeholder:e.placeholder,maxlength:e.question.maxLength},null,40,A))],8,T)},O.__file="src/components/QuestionTypes/TextType.vue";var q={extends:O,name:i.Email,data:function(){return{inputType:"email"}},methods:{validate:function(){return this.hasValue?/^[^@]+@.+[^.]$/.test(this.dataValue):!this.question.required}},__file:"src/components/QuestionTypes/EmailType.vue"},B={name:"TextareaAutosize",props:{value:{type:[String,Number],default:""},autosize:{type:Boolean,default:!0},minHeight:{type:[Number],default:null},maxHeight:{type:[Number],default:null},important:{type:[Boolean,Array],default:!1}},data:function(){return{val:null,maxHeightScroll:!1,height:"auto"}},computed:{computedStyles:function(){return this.autosize?{resize:this.isResizeImportant?"none !important":"none",height:this.height,overflow:this.maxHeightScroll?"auto":this.isOverflowImportant?"hidden !important":"hidden"}:{}},isResizeImportant:function(){var e=this.important;return!0===e||Array.isArray(e)&&e.includes("resize")},isOverflowImportant:function(){var e=this.important;return!0===e||Array.isArray(e)&&e.includes("overflow")},isHeightImportant:function(){var e=this.important;return!0===e||Array.isArray(e)&&e.includes("height")}},watch:{value:function(e){this.val=e},val:function(e){this.$nextTick(this.resize),this.$emit("input",e)},minHeight:function(){this.$nextTick(this.resize)},maxHeight:function(){this.$nextTick(this.resize)},autosize:function(e){e&&this.resize()}},methods:{resize:function(){var e=this,t=this.isHeightImportant?"important":"";return this.height="auto"+(t?" !important":""),this.$nextTick((function(){var n=e.$el.scrollHeight+1;e.minHeight&&(n=n<e.minHeight?e.minHeight:n),e.maxHeight&&(n>e.maxHeight?(n=e.maxHeight,e.maxHeightScroll=!0):e.maxHeightScroll=!1);var o=n+"px";e.height=o+(t?" !important":"")})),this}},created:function(){this.val=this.value},mounted:function(){this.resize()}};B.render=function(e,n,o,r,i,a){return t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{style:t.normalizeStyle(a.computedStyles),"onUpdate:modelValue":n[0]||(n[0]=function(e){return i.val=e}),onFocus:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.resize&&a.resize.apply(a,e)})},null,36)),[[t.vModelText,i.val]])},B.__file="node_modules/vue-textarea-autosize/src/components/TextareaAutosize.vue";var F={extends:p,name:i.LongText,components:{TextareaAutosize:B},data:function(){return{canReceiveFocus:!0}},mounted:function(){window.addEventListener("resize",this.onResizeListener)},beforeUnmount:function(){window.removeEventListener("resize",this.onResizeListener)},methods:{onResizeListener:function(){this.$refs.input.resize()},unsetFocus:function(e){!e&&this.isMobile||(this.focused=!1)},onEnterDown:function(e){this.isMobile||e.preventDefault()},onEnter:function(){this._onEnter(),this.isMobile&&this.focus()}}};F.render=function(e,n,o,r,i,a){var l=t.resolveComponent("textarea-autosize");return t.openBlock(),t.createElementBlock("span",null,[t.createVNode(l,{ref:"input",rows:"1",value:e.modelValue,required:e.question.required,onKeydown:[e.onKeyDown,t.withKeys(t.withModifiers(a.onEnterDown,["exact"]),["enter"])],onKeyup:[e.onChange,t.withKeys(t.withModifiers(a.onEnter,["exact","prevent"]),["enter"]),t.withKeys(t.withModifiers(a.onEnter,["prevent"]),["tab"])],onFocus:e.setFocus,onBlur:a.unsetFocus,placeholder:e.placeholder,maxlength:e.question.maxLength},null,8,["value","required","onKeydown","onKeyup","onFocus","onBlur","placeholder","maxlength"])])},F.__file="src/components/QuestionTypes/LongTextType.vue";var V={extends:p,name:i.MultipleChoice,data:function(){return{editingOther:!1,hasImages:!1}},mounted:function(){this.addKeyListener()},beforeUnmount:function(){this.removeKeyListener()},watch:{active:function(e){e?(this.addKeyListener(),this.question.multiple&&this.question.answered&&(this.enterPressed=!1)):this.removeKeyListener()}},methods:{addKeyListener:function(){this.removeKeyListener(),document.addEventListener("keyup",this.onKeyListener)},removeKeyListener:function(){document.removeEventListener("keyup",this.onKeyListener)},onKeyListener:function(e){if(this.active&&!this.editingOther&&e.key&&1===e.key.length){var t=e.key.toUpperCase().charCodeAt(0);if(t>=65&&t<=90){var n=t-65;if(n>-1){var o=this.question.options[n];o?this.toggleAnswer(o):this.question.allowOther&&n===this.question.options.length&&this.startEditOther()}}}},getLabel:function(e){return this.language.ariaMultipleChoice.replace(":letter",this.getToggleKey(e))},getToggleKey:function(e){var t=65+e;return t<=90?String.fromCharCode(t):""},toggleAnswer:function(e){if(!this.question.multiple){this.question.allowOther&&(this.question.other=this.dataValue=null,this.setAnswer(this.dataValue),this.setAnswerOptionId(this.dataId));for(var t=0;t<this.question.options.length;t++){var n=this.question.options[t];n.selected&&this._toggleAnswer(n)}}this._toggleAnswer(e)},_toggleAnswer:function(e){var t=e.choiceValue(),n=e.id;e.toggle(),this.question.multiple?(this.enterPressed=!1,e.selected?-1===this.dataValue.indexOf(t)&&(this.dataValue.push(t),this.dataId.push(n)):(this._removeAnswer(t),this._removeAnswerId(n))):(this.dataValue=e.selected?t:null,this.dataId=e.selected?n:null),this.isValid()&&this.question.nextStepOnAnswer&&!this.question.multiple&&!this.disabled&&this.$emit("next"),this.setAnswer(this.dataValue),this.setAnswerOptionId(this.dataId)},_removeAnswer:function(e){var t=this.dataValue.indexOf(e);-1!==t&&this.dataValue.splice(t,1)},_removeAnswerId:function(e){var t=this.dataId.indexOf(e);-1!==t&&this.dataId.splice(t,1)},startEditOther:function(){var e=this;this.editingOther=!0,this.enterPressed=!1,this.$nextTick((function(){e.$refs.otherInput.focus()}))},onChangeOther:function(){if(this.editingOther){var e=[],t=[],n=this;this.question.options.forEach((function(o){o.selected&&(n.question.multiple?(e.push(o.choiceValue()),t.push(o.id)):o.toggle())})),this.question.other&&this.question.multiple?e.push(this.question.other):this.question.multiple||(e=this.question.other),this.dataValue=e,this.dataId=t,this.setAnswer(this.dataValue),this.setAnswerOptionId(this.dataId)}},stopEditOther:function(){this.editingOther=!1}},computed:{hasValue:function(){return!!this.question.options.filter((function(e){return e.selected})).length||!!this.question.allowOther&&(this.question.other&&this.question.other.trim().length>0)}}},N={class:"f-radios-wrap"},_=["id","onClick","aria-label"],L={key:0,class:"f-image"},P=["src","alt"],I={class:"f-label-wrap"},M={class:"f-key"},j={key:0,class:"f-label"},R=["aria-label"],Q={class:"f-label-wrap"},K={key:0,class:"f-key"},$={key:2,class:"f-selected"},z={class:"f-label"},U={key:3,class:"f-label"};V.render=function(e,n,o,r,i,a){return t.openBlock(),t.createElementBlock("div",N,[t.createElementVNode("ul",{class:t.normalizeClass(["f-radios",{"f-multiple":e.question.multiple}]),role:"listbox"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.question.options,(function(e,n){return t.openBlock(),t.createElementBlock("li",{id:e.id,onClick:t.withModifiers((function(t){return a.toggleAnswer(e)}),["prevent"]),class:t.normalizeClass({"f-selected":e.selected}),key:"m"+n,"aria-label":a.getLabel(n),role:"option"},[i.hasImages&&e.imageSrc?(t.openBlock(),t.createElementBlock("span",L,[t.createElementVNode("img",{src:e.imageSrc,alt:e.imageAlt},null,8,P)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",I,[t.createElementVNode("span",M,t.toDisplayString(a.getToggleKey(n)),1),e.choiceLabel()?(t.openBlock(),t.createElementBlock("span",j,t.toDisplayString(e.choiceLabel()),1)):t.createCommentVNode("v-if",!0)])],10,_)})),128)),!i.hasImages&&e.question.allowOther?(t.openBlock(),t.createElementBlock("li",{key:0,class:t.normalizeClass(["f-other",{"f-selected":e.question.other,"f-focus":i.editingOther}]),onClick:n[5]||(n[5]=t.withModifiers((function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.startEditOther&&a.startEditOther.apply(a,e)}),["prevent"])),"aria-label":e.language.ariaTypeAnswer,role:"option"},[t.createElementVNode("div",Q,[i.editingOther?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("span",K,t.toDisplayString(a.getToggleKey(e.question.options.length)),1)),i.editingOther?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,"onUpdate:modelValue":n[0]||(n[0]=function(t){return e.question.other=t}),type:"text",ref:"otherInput",onBlur:n[1]||(n[1]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.stopEditOther&&a.stopEditOther.apply(a,e)}),onKeyup:[n[2]||(n[2]=t.withKeys(t.withModifiers((function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.stopEditOther&&a.stopEditOther.apply(a,e)}),["prevent"]),["enter"])),n[3]||(n[3]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.onChangeOther&&a.onChangeOther.apply(a,e)})],onChange:n[4]||(n[4]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return a.onChangeOther&&a.onChangeOther.apply(a,e)}),maxlength:"256"},null,544)),[[t.vModelText,e.question.other]]):e.question.other?(t.openBlock(),t.createElementBlock("span",$,[t.createElementVNode("span",z,t.toDisplayString(e.question.other),1)])):(t.openBlock(),t.createElementBlock("span",U,t.toDisplayString(e.language.otherPrompt),1))])],10,R)):t.createCommentVNode("v-if",!0)],2)])},V.__file="src/components/QuestionTypes/MultipleChoiceType.vue";var H={exports:{}}; /**! * Sortable 1.14.0 * @author RubaXa <trash@rubaxa.org> * @author owenm <owen23355@gmail.com> * @license MIT */function Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function X(e){for(var t=arguments,n=1;n<arguments.length;n++){var o=null!=t[n]?t[n]:{};n%2?Y(Object(o),!0).forEach((function(t){W(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Y(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(){return Z=Object.assign||function(e){for(var t=arguments,n=1;n<arguments.length;n++){var o=t[n];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},Z.apply(this,arguments)}function J(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ne(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var oe=ne(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),re=ne(/Edge/i),ie=ne(/firefox/i),ae=ne(/safari/i)&&!ne(/chrome/i)&&!ne(/android/i),le=ne(/iP(ad|od|hone)/i),ue=ne(/chrome/i)&&ne(/android/i),se={capture:!1,passive:!1};function ce(e,t,n){e.addEventListener(t,n,!oe&&se)}function de(e,t,n){e.removeEventListener(t,n,!oe&&se)}function fe(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function pe(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function he(e,t,n,o){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&fe(e,t):fe(e,t))||o&&e===n)return e;if(e===n)break}while(e=pe(e))}return null}var ve,me=/\s+/g;function ge(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var o=(" "+e.className+" ").replace(me," ").replace(" "+t+" "," ");e.className=(o+(n?" "+t:"")).replace(me," ")}}function ye(e,t,n){var o=e&&e.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in o||-1!==t.indexOf("webkit")||(t="-webkit-"+t),o[t]=n+("string"==typeof n?"":"px")}}function be(e,t){var n="";if("string"==typeof e)n=e;else do{var o=ye(e,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function we(e,t,n){if(e){var o=e.getElementsByTagName(t),r=0,i=o.length;if(n)for(;r<i;r++)n(o[r],r);return o}return[]}function xe(){var e=document.scrollingElement;return e||document.documentElement}function Ee(e,t,n,o,r){if(e.getBoundingClientRect||e===window){var i,a,l,u,s,c,d;if(e!==window&&e.parentNode&&e!==xe()?(a=(i=e.getBoundingClientRect()).top,l=i.left,u=i.bottom,s=i.right,c=i.height,d=i.width):(a=0,l=0,u=window.innerHeight,s=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(r=r||e.parentNode,!oe))do{if(r&&r.getBoundingClientRect&&("none"!==ye(r,"transform")||n&&"static"!==ye(r,"position"))){var f=r.getBoundingClientRect();a-=f.top+parseInt(ye(r,"border-top-width")),l-=f.left+parseInt(ye(r,"border-left-width")),u=a+i.height,s=l+i.width;break}}while(r=r.parentNode);if(o&&e!==window){var p=be(r||e),h=p&&p.a,v=p&&p.d;p&&(u=(a/=v)+(c/=v),s=(l/=h)+(d/=h))}return{top:a,left:l,bottom:u,right:s,width:d,height:c}}}function ke(e,t,n){for(var o=Te(e,!0),r=Ee(e)[t];o;){var i=Ee(o)[n];if(!("top"===n||"left"===n?r>=i:r<=i))return o;if(o===xe())break;o=Te(o,!1)}return!1}function Se(e,t,n,o){for(var r=0,i=0,a=e.children;i<a.length;){if("none"!==a[i].style.display&&a[i]!==Nt.ghost&&(o||a[i]!==Nt.dragged)&&he(a[i],n.draggable,e,!1)){if(r===t)return a[i];r++}i++}return null}function Ce(e,t){for(var n=e.lastElementChild;n&&(n===Nt.ghost||"none"===ye(n,"display")||t&&!fe(n,t));)n=n.previousElementSibling;return n||null}function De(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Nt.clone||t&&!fe(e,t)||n++;return n}function Oe(e){var t=0,n=0,o=xe();if(e)do{var r=be(e),i=r.a,a=r.d;t+=e.scrollLeft*i,n+=e.scrollTop*a}while(e!==o&&(e=e.parentNode));return[t,n]}function Te(e,t){if(!e||!e.getBoundingClientRect)return xe();var n=e,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=ye(n);if(n.clientWidth<n.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!n.getBoundingClientRect||n===document.body)return xe();if(o||t)return n;o=!0}}}while(n=n.parentNode);return xe()}function Ae(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function qe(e,t){return function(){if(!ve){var n=arguments,o=this;1===n.length?e.call(o,n[0]):e.apply(o,n),ve=setTimeout((function(){ve=void 0}),t)}}}function Be(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function Fe(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function Ve(e,t){ye(e,"position","absolute"),ye(e,"top",t.top),ye(e,"left",t.left),ye(e,"width",t.width),ye(e,"height",t.height)}function Ne(e){ye(e,"position",""),ye(e,"top",""),ye(e,"left",""),ye(e,"width",""),ye(e,"height","")}var _e="Sortable"+(new Date).getTime();function Le(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==ye(e,"display")&&e!==Nt.ghost){t.push({target:e,rect:Ee(e)});var n=X({},t[t.length-1].rect);if(e.thisAnimationDuration){var o=be(e,!0);o&&(n.top-=o.f,n.left-=o.e)}e.fromRect=n}}))},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var o in t)if(t.hasOwnProperty(o)&&t[o]===e[n][o])return Number(n);return-1}(t,{target:e}),1)},animateAll:function(n){var o=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof n&&n());var r=!1,i=0;t.forEach((function(e){var t=0,n=e.target,a=n.fromRect,l=Ee(n),u=n.prevFromRect,s=n.prevToRect,c=e.rect,d=be(n,!0);d&&(l.top-=d.f,l.left-=d.e),n.toRect=l,n.thisAnimationDuration&&Ae(u,l)&&!Ae(a,l)&&(c.top-l.top)/(c.left-l.left)==(a.top-l.top)/(a.left-l.left)&&(t=function(e,t,n,o){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*o.animation}(c,u,s,o.options)),Ae(l,a)||(n.prevFromRect=a,n.prevToRect=l,t||(t=o.options.animation),o.animate(n,c,l,t)),t&&(r=!0,i=Math.max(i,t),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),t),n.thisAnimationDuration=t)})),clearTimeout(e),r?e=setTimeout((function(){"function"==typeof n&&n()}),i):"function"==typeof n&&n(),t=[]},animate:function(e,t,n,o){if(o){ye(e,"transition",""),ye(e,"transform","");var r=be(this.el),i=r&&r.a,a=r&&r.d,l=(t.left-n.left)/(i||1),u=(t.top-n.top)/(a||1);e.animatingX=!!l,e.animatingY=!!u,ye(e,"transform","translate3d("+l+"px,"+u+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),ye(e,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),ye(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){ye(e,"transition",""),ye(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),o)}}}}var Pe=[],Ie={initializeByDefault:!0},Me={mount:function(e){for(var t in Ie)Ie.hasOwnProperty(t)&&!(t in e)&&(e[t]=Ie[t]);Pe.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),Pe.push(e)},pluginEvent:function(e,t,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var r=e+"Global";Pe.forEach((function(o){t[o.pluginName]&&(t[o.pluginName][r]&&t[o.pluginName][r](X({sortable:t},n)),t.options[o.pluginName]&&t[o.pluginName][e]&&t[o.pluginName][e](X({sortable:t},n)))}))},initializePlugins:function(e,t,n,o){for(var r in Pe.forEach((function(o){var r=o.pluginName;if(e.options[r]||o.initializeByDefault){var i=new o(e,t,e.options);i.sortable=e,i.options=e.options,e[r]=i,Z(n,i.defaults)}})),e.options)if(e.options.hasOwnProperty(r)){var i=this.modifyOption(e,r,e.options[r]);void 0!==i&&(e.options[r]=i)}},getEventProperties:function(e,t){var n={};return Pe.forEach((function(o){"function"==typeof o.eventProperties&&Z(n,o.eventProperties.call(t[o.pluginName],e))})),n},modifyOption:function(e,t,n){var o;return Pe.forEach((function(r){e[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[t]&&(o=r.optionListeners[t].call(e[r.pluginName],n))})),o}};function je(e){var t=e.sortable,n=e.rootEl,o=e.name,r=e.targetEl,i=e.cloneEl,a=e.toEl,l=e.fromEl,u=e.oldIndex,s=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[_e]){var v,m=t.options,g="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||oe||re?(v=document.createEvent("Event")).initEvent(o,!0,!0):v=new CustomEvent(o,{bubbles:!0,cancelable:!0}),v.to=a||n,v.from=l||n,v.item=r||n,v.clone=i,v.oldIndex=u,v.newIndex=s,v.oldDraggableIndex=c,v.newDraggableIndex=d,v.originalEvent=f,v.pullMode=p?p.lastPutMode:void 0;var y=X(X({},h),Me.getEventProperties(o,t));for(var b in y)v[b]=y[b];n&&n.dispatchEvent(v),m[g]&&m[g].call(t,v)}}var Re=["evt"],Qe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,r=J(n,Re);Me.pluginEvent.bind(Nt)(e,t,X({dragEl:$e,parentEl:ze,ghostEl:Ue,rootEl:He,nextEl:Ye,lastDownEl:Xe,cloneEl:Ge,cloneHidden:We,dragStarted:ct,putSortable:ot,activeSortable:Nt.active,originalEvent:o,oldIndex:Ze,oldDraggableIndex:et,newIndex:Je,newDraggableIndex:tt,hideGhostForTarget:qt,unhideGhostForTarget:Bt,cloneNowHidden:function(){We=!0},cloneNowShown:function(){We=!1},dispatchSortableEvent:function(e){Ke({sortable:t,name:e,originalEvent:o})}},r))};function Ke(e){je(X({putSortable:ot,cloneEl:Ge,targetEl:$e,rootEl:He,oldIndex:Ze,oldDraggableIndex:et,newIndex:Je,newDraggableIndex:tt},e))}var $e,ze,Ue,He,Ye,Xe,Ge,We,Ze,Je,et,tt,nt,ot,rt,it,at,lt,ut,st,ct,dt,ft,pt,ht,vt=!1,mt=!1,gt=[],yt=!1,bt=!1,wt=[],xt=!1,Et=[],kt="undefined"!=typeof document,St=le,Ct=re||oe?"cssFloat":"float",Dt=kt&&!ue&&!le&&"draggable"in document.createElement("div"),Ot=function(){if(kt){if(oe)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Tt=function(e,t){var n=ye(e),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=Se(e,0,t),i=Se(e,1,t),a=r&&ye(r),l=i&&ye(i),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ee(r).width,s=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Ee(i).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==l.clear&&l.clear!==c?"horizontal":"vertical"}return r&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||u>=o&&"none"===n[Ct]||i&&"none"===n[Ct]&&u+s>o)?"vertical":"horizontal"},At=function(e){function t(e,n){return function(o,r,i,a){var l=o.options.group.name&&r.options.group.name&&o.options.group.name===r.options.group.name;if(null==e&&(n||l))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(o,r,i,a),n)(o,r,i,a);var u=(n?o:r).options.group.name;return!0===e||"string"==typeof e&&e===u||e.join&&e.indexOf(u)>-1}}var n={},o=e.group;o&&"object"==G(o)||(o={name:o}),n.name=o.name,n.checkPull=t(o.pull,!0),n.checkPut=t(o.put),n.revertClone=o.revertClone,e.group=n},qt=function(){!Ot&&Ue&&ye(Ue,"display","none")},Bt=function(){!Ot&&Ue&&ye(Ue,"display","")};kt&&document.addEventListener("click",(function(e){if(mt)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),mt=!1,!1}),!0);var Ft=function(e){if($e){var t=function(e,t){var n;return gt.some((function(o){var r=o[_e].options.emptyInsertThreshold;if(r&&!Ce(o)){var i=Ee(o),a=e>=i.left-r&&e<=i.right+r,l=t>=i.top-r&&t<=i.bottom+r;return a&&l?n=o:void 0}})),n}((e=e.touches?e.touches[0]:e).clientX,e.clientY);if(t){var n={};for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[_e]._onDragOver(n)}}},Vt=function(e){$e&&$e.parentNode[_e]._isOutsideThisEl(e.target)};function Nt(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=Z({},t),e[_e]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Tt(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Nt.supportPointer&&"PointerEvent"in window&&!ae,emptyInsertThreshold:5};for(var o in Me.initializePlugins(this,e,n),n)!(o in t)&&(t[o]=n[o]);for(var r in At(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Dt,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?ce(e,"pointerdown",this._onTapStart):(ce(e,"mousedown",this._onTapStart),ce(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(ce(e,"dragover",this),ce(e,"dragenter",this)),gt.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Z(this,Le())}function _t(e,t,n,o,r,i,a,l){var u,s,c=e[_e],d=c.options.onMove;return!window.CustomEvent||oe||re?(u=document.createEvent("Event")).initEvent("move",!0,!0):u=new CustomEvent("move",{bubbles:!0,cancelable:!0}),u.to=t,u.from=e,u.dragged=n,u.draggedRect=o,u.related=r||t,u.relatedRect=i||Ee(t),u.willInsertAfter=l,u.originalEvent=a,e.dispatchEvent(u),d&&(s=d.call(c,u,a)),s}function Lt(e){e.draggable=!1}function Pt(){xt=!1}function It(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,o=0;n--;)o+=t.charCodeAt(n);return o.toString(36)}function Mt(e){return setTimeout(e,0)}function jt(e){return clearTimeout(e)}Nt.prototype={constructor:Nt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(dt=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,$e):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,o=this.options,r=o.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(a||e).target,u=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,s=o.filter;if(function(e){Et.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var o=t[n];o.checked&&Et.push(o)}}(n),!$e&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||o.disabled)&&!u.isContentEditable&&(this.nativeDraggable||!ae||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=he(l,o.draggable,n,!1))&&l.animated||Xe===l)){if(Ze=De(l),et=De(l,o.draggable),"function"==typeof s){if(s.call(this,e,l,this))return Ke({sortable:t,rootEl:u,name:"filter",targetEl:l,toEl:n,fromEl:n}),Qe("filter",t,{evt:e}),void(r&&e.cancelable&&e.preventDefault())}else if(s&&(s=s.split(",").some((function(o){if(o=he(u,o.trim(),n,!1))return Ke({sortable:t,rootEl:o,name:"filter",targetEl:l,fromEl:n,toEl:n}),Qe("filter",t,{evt:e}),!0}))))return void(r&&e.cancelable&&e.preventDefault());o.handle&&!he(u,o.handle,n,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(e,t,n){var o,r=this,i=r.el,a=r.options,l=i.ownerDocument;if(n&&!$e&&n.parentNode===i){var u=Ee(n);if(He=i,ze=($e=n).parentNode,Ye=$e.nextSibling,Xe=n,nt=a.group,Nt.dragged=$e,rt={target:$e,clientX:(t||e).clientX,clientY:(t||e).clientY},ut=rt.clientX-u.left,st=rt.clientY-u.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,$e.style["will-change"]="all",o=function(){Qe("delayEnded",r,{evt:e}),Nt.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!ie&&r.nativeDraggable&&($e.draggable=!0),r._triggerDragStart(e,t),Ke({sortable:r,name:"choose",originalEvent:e}),ge($e,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){we($e,e.trim(),Lt)})),ce(l,"dragover",Ft),ce(l,"mousemove",Ft),ce(l,"touchmove",Ft),ce(l,"mouseup",r._onDrop),ce(l,"touchend",r._onDrop),ce(l,"touchcancel",r._onDrop),ie&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$e.draggable=!0),Qe("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(re||oe))o();else{if(Nt.eventCanceled)return void this._onDrop();ce(l,"mouseup",r._disableDelayedDrag),ce(l,"touchend",r._disableDelayedDrag),ce(l,"touchcancel",r._disableDelayedDrag),ce(l,"mousemove",r._delayedDragTouchMoveHandler),ce(l,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&ce(l,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(o,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$e&&Lt($e),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;de(e,"mouseup",this._disableDelayedDrag),de(e,"touchend",this._disableDelayedDrag),de(e,"touchcancel",this._disableDelayedDrag),de(e,"mousemove",this._delayedDragTouchMoveHandler),de(e,"touchmove",this._delayedDragTouchMoveHandler),de(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?ce(document,"pointermove",this._onTouchMove):ce(document,t?"touchmove":"mousemove",this._onTouchMove):(ce($e,"dragend",this),ce(He,"dragstart",this._onDragStart));try{document.selection?Mt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(vt=!1,He&&$e){Qe("dragStarted",this,{evt:t}),this.nativeDraggable&&ce(document,"dragover",Vt);var n=this.options;!e&&ge($e,n.dragClass,!1),ge($e,n.ghostClass,!0),Nt.active=this,e&&this._appendGhost(),Ke({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(it){this._lastX=it.clientX,this._lastY=it.clientY,qt();for(var e=document.elementFromPoint(it.clientX,it.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(it.clientX,it.clientY))!==t;)t=e;if($e.parentNode[_e]._isOutsideThisEl(e),t)do{if(t[_e]){if(t[_e]._onDragOver({clientX:it.clientX,clientY:it.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Bt()}},_onTouchMove:function(e){if(rt){var t=this.options,n=t.fallbackTolerance,o=t.fallbackOffset,r=e.touches?e.touches[0]:e,i=Ue&&be(Ue,!0),a=Ue&&i&&i.a,l=Ue&&i&&i.d,u=St&&ht&&Oe(ht),s=(r.clientX-rt.clientX+o.x)/(a||1)+(u?u[0]-wt[0]:0)/(a||1),c=(r.clientY-rt.clientY+o.y)/(l||1)+(u?u[1]-wt[1]:0)/(l||1);if(!Nt.active&&!vt){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(Ue){i?(i.e+=s-(at||0),i.f+=c-(lt||0)):i={a:1,b:0,c:0,d:1,e:s,f:c};var d="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");ye(Ue,"webkitTransform",d),ye(Ue,"mozTransform",d),ye(Ue,"msTransform",d),ye(Ue,"transform",d),at=s,lt=c,it=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Ue){var e=this.options.fallbackOnBody?document.body:He,t=Ee($e,!0,St,!0,e),n=this.options;if(St){for(ht=e;"static"===ye(ht,"position")&&"none"===ye(ht,"transform")&&ht!==document;)ht=ht.parentNode;ht!==document.body&&ht!==document.documentElement?(ht===document&&(ht=xe()),t.top+=ht.scrollTop,t.left+=ht.scrollLeft):ht=xe(),wt=Oe(ht)}ge(Ue=$e.cloneNode(!0),n.ghostClass,!1),ge(Ue,n.fallbackClass,!0),ge(Ue,n.dragClass,!0),ye(Ue,"transition",""),ye(Ue,"transform",""),ye(Ue,"box-sizing","border-box"),ye(Ue,"margin",0),ye(Ue,"top",t.top),ye(Ue,"left",t.left),ye(Ue,"width",t.width),ye(Ue,"height",t.height),ye(Ue,"opacity","0.8"),ye(Ue,"position",St?"absolute":"fixed"),ye(Ue,"zIndex","100000"),ye(Ue,"pointerEvents","none"),Nt.ghost=Ue,e.appendChild(Ue),ye(Ue,"transform-origin",ut/parseInt(Ue.style.width)*100+"% "+st/parseInt(Ue.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,o=e.dataTransfer,r=n.options;Qe("dragStart",this,{evt:e}),Nt.eventCanceled?this._onDrop():(Qe("setupClone",this),Nt.eventCanceled||((Ge=Fe($e)).draggable=!1,Ge.style["will-change"]="",this._hideClone(),ge(Ge,this.options.chosenClass,!1),Nt.clone=Ge),n.cloneId=Mt((function(){Qe("clone",n),Nt.eventCanceled||(n.options.removeCloneOnHide||He.insertBefore(Ge,$e),n._hideClone(),Ke({sortable:n,name:"clone"}))})),!t&&ge($e,r.dragClass,!0),t?(mt=!0,n._loopId=setInterval(n._emulateDragOver,50)):(de(document,"mouseup",n._onDrop),de(document,"touchend",n._onDrop),de(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",r.setData&&r.setData.call(n,o,$e)),ce(document,"drop",n),ye($e,"transform","translateZ(0)")),vt=!0,n._dragStartId=Mt(n._dragStarted.bind(n,t,e)),ce(document,"selectstart",n),ct=!0,ae&&ye(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,o,r,i=this.el,a=e.target,l=this.options,u=l.group,s=Nt.active,c=nt===u,d=l.sort,f=ot||s,p=this,h=!1;if(!xt){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),a=he(a,l.draggable,i,!0),A("dragOver")