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