parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QdEO":[function(require,module,exports) {
module.exports={props:{name:{type:String,required:!0},value:{type:null,default:null},type:{type:String,required:!0},length:{type:[String,Number],default:null},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},newItem:{type:Boolean,default:!1},relation:{type:Object,default:null},fields:{type:Object,default:null},values:{type:Object,default:null}}};
},{}],"jLuR":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("../../../mixins/interface")),t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return o(e)||l(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function l(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function o(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}var s={mixins:[e.default],data:function(){return{activeLanguage:null,languages:null}},computed:{error:function(){return!this.options.languagesCollection||!this.options.translationLanguageField},primaryKeyField:function(){return this.$lodash.find(this.fields,{primary_key:!0}).field},primaryKey:function(){return this.values[this.primaryKeyField]},relatedFields:function(){return this.relation?this.relation.collection_many.fields:null},languageFields:function(){return this.options.languagesCollection?this.$store.state.collections[this.options.languagesCollection].fields:null},langValue:function(){return this.languages&&this.activeLanguage&&this.value&&this.valuesByLang[this.activeLanguage]||{}},valuesByLang:function(){return this.value?this.$lodash.keyBy(this.value,this.options.translationLanguageField):{}},fieldManyName:function(){return this.relation.field_many.field}},created:function(){this.fetchLanguages()},methods:{fetchLanguages:function(){var e=this;if(!this.options.languagesCollection||!this.options.translationLanguageField)return null;this.$api.getItems(this.options.languagesCollection,{limit:-1}).then(function(e){return e.data}).then(function(t){if(0!==t.length){var n=e.options.languagesPrimaryKeyField,i=e.options.languagesNameField;e.languages=t.map(function(e){return{code:e[n],name:e[i]}}),e.activeLanguage=e.options.defaultLanguage||t[0][e.$lodash.find(e.languageFields,{primary_key:!0}).field]}})},stageValue:function(e){var n,r,l,o=this,s=e.field,u=e.value;this.valuesByLang[this.activeLanguage]?n=this.value.map(function(e){return e[o.options.translationLanguageField]===o.activeLanguage?t({},e,i({},s,u)):e}):n=this.newItem?[].concat(a(this.value||[]),[(r={},i(r,this.options.translationLanguageField,this.activeLanguage),i(r,s,u),r)]):[].concat(a(this.value||[]),[(l={},i(l,this.relation.field_many.field,this.primaryKey),i(l,this.options.translationLanguageField,this.activeLanguage),i(l,s,u),l)]);return n=n.map(function(e){var t=Object.assign({},e);return delete t[o.fieldManyName],t}),this.$emit("input",n)}}};exports.default=s;
(function(){var a=exports.default||module.exports;"function"==typeof a&&(a=a.options),Object.assign(a,{render:function(){var a=this,e=a.$createElement,t=a._self._c||e;return a.error||!a.relation?t("div",{staticClass:"translation error"},[t("p",[t("i",{staticClass:"material-icons"},[a._v("warning")]),a._v(" "+a._s(a.$t("interfaces-translation-translation_not_setup"))+" ")])]):a.languages&&0===a.languages.length?t("div",{staticClass:"translation error"},[t("p",[t("i",{staticClass:"material-icons"},[a._v("warning")]),a._v(" "+a._s(a.$t("interfaces-translation-translation_no_languages"))+" ")])]):a.activeLanguage?t("div",{staticClass:"translation"},[t("v-simple-select",{staticClass:"language-select",attrs:{placeholder:a.$t("interfaces-translation-choose_language")},model:{value:a.activeLanguage,callback:function(e){a.activeLanguage=e},expression:"activeLanguage"}},a._l(a.languages,function(e){return t("option",{key:e.code,domProps:{value:e.code}},[a._v(" "+a._s(e.name)+" ")])}),0),a._v(" "),t("hr"),a._v(" "),t("v-form",{key:a.activeLanguage,ref:"form",staticClass:"form",attrs:{fields:a.relatedFields,values:a.langValue,collection:a.relation.collection_many},on:{"stage-value":a.stageValue}})],1):a._e()},staticRenderFns:[],_compiled:!0,_scopeId:"data-v-7d4c14",functional:void 0});})();
},{"../../../mixins/interface":"QdEO"}]},{},["jLuR"], "__DirectusExtension__")