text: function debounce(e,t,n){var i;return function(){var s=this,a=arguments,u=function(){i=null,n||e.apply(s,a)},r=n&&!i;clearTimeout(i),i=setTimeout(u,t),r&&e.apply(s,a)}}function initVueMultiselect(e){if(e){var t=e.id,n=e.dataset.editorType,s=JSON.parse(e.dataset.selectedItems||"[]"),a=e.dataset.tenantPath,u=e.dataset.searchUrl,r=JSON.parse(e.dataset.multiple),o=debounce(function(e,t){e.isLoading=!0;var n=a+"/"+u;t&&(n+="&query="+t),fetch(n).then(function(t){t.json().then(function(t){e.options=t,e.isLoading=!1})})},250),c=Vue.component("vue-multiselect",window.VueMultiselect.default),d=new Vue({el:"#"+t,components:{"vue-multiselect":c},data:{value:null,arrayOfItems:s,options:[]},computed:{selectedIds:function(){return this.arrayOfItems.map(function(e){return e.id}).join(",")},isDisabled:function(){return this.arrayOfItems.length>0&&!r}},watch:{selectedIds:function(){setTimeout(function(){$(document).trigger("contentpreview:render")},100)}},created:function(){this.asyncFind()},methods:{asyncFind:function(e){o(this,e)},onSelect:function(e,t){for(i=0;i<this.arrayOfItems.length;i++)if(this.arrayOfItems[i].id===e.id)return;this.arrayOfItems.push(e)},remove:function(e){this.arrayOfItems.splice(this.arrayOfItems.indexOf(e),1)}}}),l=new CustomEvent("vue-multiselect-created",{detail:{vm:d,editorType:n}});document.querySelector("body").dispatchEvent(l)}}
  