diff --git a/appinventor/appengine/war/index.jsp b/appinventor/appengine/war/index.jsp
index 5e65b7fa579..fd54c8548b2 100644
--- a/appinventor/appengine/war/index.jsp
+++ b/appinventor/appengine/war/index.jsp
@@ -124,7 +124,7 @@
-
+
diff --git a/appinventor/appengine/war/static/js/workspace-multiselect-pr134-c630b72.min.js b/appinventor/appengine/war/static/js/workspace-multiselect-pr135-edf5dd2.min.js
similarity index 59%
rename from appinventor/appengine/war/static/js/workspace-multiselect-pr134-c630b72.min.js
rename to appinventor/appengine/war/static/js/workspace-multiselect-pr135-edf5dd2.min.js
index 87273904e78..015a80047a4 100644
--- a/appinventor/appengine/war/static/js/workspace-multiselect-pr134-c630b72.min.js
+++ b/appinventor/appengine/war/static/js/workspace-multiselect-pr135-edf5dd2.min.js
@@ -1,3 +1,2 @@
-/*! For license information please see index.js.LICENSE.txt */
-!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],t);else{var s="object"==typeof exports?t(require("blockly/core")):t(e.Blockly);for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(this,e=>(()=>{var t={28:function(e){e.exports=function(){"use strict";function e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)}return s}function t(t){for(var s=1;se.length)&&(t=e.length);for(var s=0,n=new Array(t);s1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},k=function(e,t){var s=t;window.addEventListener("resize",s),window.addEventListener("scroll",s);var n=new MutationObserver(s);return e.forEach(function(e,t){n.observe(e,{childList:0!==t,attributes:!0})}),{observer:n,callback:s,cleanup:function(){return N(n,s)}}},C=function(e,t){var s;return function(){for(var n=arguments.length,i=new Array(n),o=0;o1&&void 0!==arguments[1]?arguments[1]:0,i=null===(s=t[n])||void 0===s?void 0:s.parentNode;return i?(t.push(i),e(t,++n)):t}([e])},I=function(e,t){var s={top:Number.POSITIVE_INFINITY,left:Number.POSITIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,right:Number.NEGATIVE_INFINITY,width:Number.NEGATIVE_INFINITY,height:Number.NEGATIVE_INFINITY};return z(e).forEach(function(e){var n=t.getRect(e);s.top=Math.min(s.top,n.top),s.left=Math.min(s.left,n.left),s.bottom=Math.max(s.bottom,n.bottom),s.right=Math.max(s.right,n.right)}),s.height=s.bottom-s.top,s.width=s.right-s.left,s},w=function(e){return!e||e instanceof Document?E():{x:e.scrollLeft>=0?e.scrollLeft:E().x,y:e.scrollTop>=0?e.scrollTop:E().y}},T=function(e){var t=e.elementRect,s=e.containerRect,n=e.tolerance,i=void 0===n?{x:0,y:0}:n,o=[];return t.top-i.ys.bottom&&o.push("bottom"),t.right+i.y>s.right&&o.push("right"),o},L=function(e){var t={x:0,y:0},s=window.getComputedStyle(e);if(!s.transform||"none"===s.transform)return t;if(s.transform.indexOf("3d")>=0){var n=s.transform.trim().match(/matrix3d\((.*?)\)/);if(n&&n.length){var i,o=null===(i=n[1])||void 0===i?void 0:i.split(",");t.x=parseInt(o[12])||0,t.y=parseInt(o[13])||0}return t}var r=s.transform.trim().match(/matrix\((.*?)\)/);if(r&&r.length){var c,l=null===(c=r[1])||void 0===c?void 0:c.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},P=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return L(e);var s={x:0,y:0},n=t.trim().match(/translate[3dD]*?\(.*?\)/);if(n){var i,o=null===(i=n[0])||void 0===i?void 0:i.split("(");if(o){var r,c=null===(r=o[1])||void 0===r?void 0:r.split(",");s.x=parseInt(c[0])||0,s.y=parseInt(c[1])||0}}return s.x||s.x?s:L(e)}(e):function(e){var t=e.style,s={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!s.x&&!s.x){var n=window.getComputedStyle(e);return{x:parseInt(n.left)||0,y:parseInt(n.top)||0}}return s}(e)},x=function(e){var t=e.computedStyle,s=e.node,n=t.position;s instanceof Document||"absolute"===n||"relative"===n||"fixed"===n||(s.style.position="relative")},A=function(e,t,s){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},B=function(e,t,s,n){if(void 0===t)return s?o({},e,n):{};if(null===t)return o({},e,null);var i=!0,r=!1,c="string"==typeof n;c&&(i="string"==typeof t||t instanceof String),c&&!i&&(r=!0,A(e,"string"));var l=!Number.isNaN(n)&&"number"==typeof n;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(r=!0,A(e,"number"));var a="[object Object]"===Object.prototype.toString.call(n);a&&(i="[object Object]"===Object.prototype.toString.call(t)),a&&!i&&(r=!0,A(e,"object"));var u="boolean"==typeof n;u&&(i="boolean"==typeof t),u&&!i&&(r=!0,A(e,"boolean"));var d=Array.isArray(n);d&&(i=Array.isArray(t)),d&&!i&&(r=!0,A(e,"array"));var h=r||s;return"dragKeys"===e&&i?o({},e,Object.assign(n,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map(function(e){return e.id})).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?o({},e,t):h?o({},e,n):{}):h?o({},e,n):{}},R=function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e;if(s>0){var i=(e.right-e.left)*s,o=(e.bottom-e.top)*s;n={left:e.left+i,right:e.right-i,top:e.top+o,bottom:e.bottom-o}}return n.leftt.left&&n.topt.top},O=function(e){var t=e.element,s=e.posDirection,n=e.containerRect,i=e.useTransform,o=P(t,i),r=v(o,"+",s);K(t,r,i);var c=t.getBoundingClientRect();!function(e){var t=e.element,s=e.edges,n=e.elementRect,i=e.containerRect,o=e.elementPos,r=e.useTransform;s.includes("top")&&K(t,{y:o.y+i.top-n.top,x:o.x},r),s.includes("left")&&K(t,{y:o.y,x:o.x+i.left-n.left},r),s.includes("bottom")&&K(t,{y:o.y+i.bottom-n.bottom,x:o.x},r),s.includes("right")&&K(t,{y:o.y,x:o.x+i.right-n.right},r)}({element:t,edges:T({elementRect:c,containerRect:n}),elementRect:c,containerRect:n,elementPos:r,useTransform:i})},N=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},K=function(e,t,s){if(s){var n=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(n.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:f(new Set(f(e))):[]},W=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},V=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"DS",void 0),o(this,"_observers",void 0),o(this,"_node",void 0),o(this,"_parentNodes",void 0),o(this,"_computedStyle",void 0),o(this,"_computedBorder",void 0),o(this,"_rect",void 0),o(this,"setArea",function(e){n.reset(),n._node=e,x({computedStyle:n.computedStyle,node:n._node}),setTimeout(function(){n.DS.PubSub.publish("Area:modified:pre",{item:n}),n.reset(),n.DS.PubSub.publish("Area:modified",{item:n})})}),o(this,"start",function(){n._observers=k(n.parentNodes,C(function(e){n.DS.PubSub.publish("Area:modified:pre",{event:e,item:n}),n.reset(),n.DS.PubSub.publish("Area:modified",{event:e,item:n})},60))}),o(this,"reset",function(){n._computedStyle=void 0,n._rect=void 0,n._computedBorder=void 0,n._parentNodes=void 0}),o(this,"stop",function(){n._observers.cleanup(),n.reset()}),o(this,"scroll",function(e,t){var s={scroll_directions:e,scroll_multiplier:t};n.DS.PubSub.publish("Area:scroll:pre",s),function(e,t,s){if(t.length){var n=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,i=e instanceof Document?n||document.body:e,o=t.includes("top")&&i.scrollTop>0,r=t.includes("bottom")&&i.scrollTop0,l=t.includes("right")&&i.scrollLeft0&&(e.y=Math.min(e.y,i.bottom)),e.x>0&&(e.x=Math.min(e.x,i.right)),n._selectionRect.top+=e.y,n._selectionRect.bottom+=e.y,n._selectionRect.left+=e.x,n._selectionRect.right+=e.x),e}),o(this,"handleZIndex",function(e){n._elements.forEach(function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)})}),this.DS=i,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return i(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?v(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?v(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var n=this,i=t.DS,r=t.id,c=t.element,l=t.droppables;s(this,e),o(this,"id",void 0),o(this,"element",void 0),o(this,"_droppables",void 0),o(this,"_rect",void 0),o(this,"_observers",void 0),o(this,"_timeout",void 0),o(this,"_itemsDropped",[]),o(this,"_itemsInside",void 0),o(this,"setReadyClasses",function(e){if(!n.isDestroyed){var t=n.droppables.filter(function(e){return n.DS.SelectedSet.has(e)});t.length&&(t.forEach(function(t){t.classList[e]("".concat(n.Settings.droppableClass)),t.classList[e]("".concat(n.Settings.droppableClass,"-").concat(n.id))}),n.element.classList[e]("".concat(n.Settings.dropZoneReadyClass)))}}),o(this,"handleNoDrop",function(){var e;n.isDestroyed||(n.DS.SelectedSet.forEach(function(e){e.classList.remove(n.Settings.droppedTargetClass),e.classList.remove("".concat(n.Settings.droppedTargetClass,"-").concat(n.id))}),n._itemsDropped=n._itemsDropped.filter(function(e){return!n.DS.SelectedSet.has(e)}),null!==(e=n._itemsDropped)&&void 0!==e&&e.length||n.element.classList.remove("".concat(n.Settings.dropZoneTargetClass)))}),o(this,"handleDrop",function(){var e,t,s;n.isDestroyed||(n._itemsDropped=f(new Set([].concat(f(n._itemsDropped),f(null===(e=n.droppables)||void 0===e?void 0:e.filter(function(e){return n.DS.SelectedSet.has(e)}))))),null===(t=n._itemsDropped)||void 0===t||t.forEach(function(e){e.classList.add("".concat(n.Settings.droppedTargetClass)),e.classList.add("".concat(n.Settings.droppedTargetClass,"-").concat(n.id))}),null!==(s=n._itemsDropped)&&void 0!==s&&s.length&&n.element.classList.add("".concat(n.Settings.dropZoneTargetClass)))}),o(this,"handleItemsInsideClasses",function(){var e=!1;n.droppables.forEach(function(t){n.itemsInside.includes(t)?(t.classList.add("".concat(n.Settings.droppedInsideClass)),t.classList.add("".concat(n.Settings.droppedInsideClass,"-").concat(n.id)),e=!0):(t.classList.remove("".concat(n.Settings.droppedInsideClass,"-").concat(n.id)),t.className.includes("".concat(n.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(n.Settings.droppedInsideClass)))}),e?n.element.classList.add("".concat(n.Settings.dropZoneInsideClass)):n.element.classList.remove("".concat(n.Settings.dropZoneInsideClass))}),o(this,"start",function(e){e.isDragging&&!n.isDestroyed&&n.setReadyClasses("add")}),o(this,"stop",function(e){e.isDragging&&!n.isDestroyed&&(n.setReadyClasses("remove"),n.handleItemsInsideClasses())}),o(this,"toObject",function(){return{id:n.id,element:n.element,droppables:n.droppables,itemsDropped:n.itemsDropped,itemsInside:n.itemsInside}}),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.id=r,this.element=c,l&&(this.droppables=z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",function(e){var t=e.settings;n.element&&(n.element.classList.remove(t["dropZoneClass:pre"]),n.element.classList.add(t.dropZoneClass))}),this._observers=k(this.parentNodes,C(function(){return n._rect=null},this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return i(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach(function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))}),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap(function(t){return R(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]}),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){return e._itemsInside=null},this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=M(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),U=i(function e(n){var i=this,r=n.DS;s(this,e),o(this,"_zoneByElement",new Map),o(this,"_zoneById",new Map),o(this,"_zonesByDroppable",new Map),o(this,"_zones",void 0),o(this,"setDropZones",function(e){var s=e.dropZones;s&&(i._zones&&i._zones.forEach(function(e){return e.destroy()}),i._zones=s.map(function(e){return new F(t({DS:i.DS},e))}),i._zones.forEach(function(e){i._zoneByElement.set(e.element,e),i._zoneById.set(e.id,e),e.droppables.forEach(function(t){var s=i._zonesByDroppable.get(t);if(null==s||!s.length)return i._zonesByDroppable.set(t,[e]);i._zonesByDroppable.set(t,f(new Set([].concat(f(s),[e]))))})}))}),o(this,"_handleDrop",function(e){i._zones.forEach(function(t){t!==e&&t.handleNoDrop()}),e&&e.handleDrop()}),o(this,"_getZoneByElementsFromPoint",function(e,t){for(var s=t.x,n=t.y,o=0,r=e.length;o0)){var s=n.DS,i=s.stores,o=i.PointerStore,r=i.KeyStore,c=s.SelectableSet,l=s.SelectedSet;o.start(t);var a=t.target;c.has(a)&&(r.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(a),n.reset())}}),o(this,"stop",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DS.Area.HTMLNode;n.isInteracting=!1,n.isDragging=!1,n.Settings.usePointerEvents?(e.removeEventListener("pointerdown",n.start,{passive:!1}),document.removeEventListener("pointerup",n.reset),document.removeEventListener("pointercancel",n.reset)):(e.removeEventListener("mousedown",n.start),document.removeEventListener("mouseup",n.reset)),e.removeEventListener("touchstart",n.start,{passive:!1}),document.removeEventListener("touchend",n.reset)}),o(this,"update",function(e){var t=e.event,s=e.scroll_directions,i=e.scroll_multiplier;n.isInteracting&&n.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:s,scroll_multiplier:i,isDragging:n.isDragging})}),o(this,"reset",function(e){return n.DS.publish("Interaction:end:pre",{event:e,isDragging:n.isDragging})}),o(this,"_reset",function(e){var t=n.isDragging;n.stop(),n.init(),n.DS.publish("Interaction:end",{event:e,isDragging:t})}),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",function(e){var t=e.settings;n.stop(t["area:pre"]),n.init()}),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",function(e){var t=e.event;return n.start(t)}),this.DS.subscribe("Interaction:start:pre",function(e){var t=e.event;return n._start(t)}),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",function(e){var t=e.event;return n._reset(t)}),this.DS.subscribe("Area:scroll",this.update)}return i(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),H=i(function e(t){var n=this,i=t.DS;s(this,e),o(this,"subscribers",{}),o(this,"subscribe",function(e,t){return Array.isArray(n.subscribers[e])||(n.subscribers[e]=[]),n.subscribers[e].push(t),n.subscribers[e].length-1}),o(this,"unsubscribe",function(e,t,s){s>=0?n.subscribers[e].splice(s,1):t&&(n.subscribers[e]=n.subscribers[e].filter(function(e){return e!==t}))}),o(this,"publish",function(e,t){Array.isArray(e)?e.forEach(function(e){return n._publish(e,t)}):n._publish(e,t)}),o(this,"_publish",function(e,t){var s=n.subscribers[e];Array.isArray(s)&&(e.includes(":pre")?n._handlePrePublish(s,t):n._handlePublish(s,t))}),o(this,"_handlePublish",function(e,t){for(var s=0,i=e.length;s=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,r=!0,c=!1;return{s:function(){s=s.call(e)},n:function(){var e=s.next();return r=e.done,e},e:function(e){c=!0,o=e},f:function(){try{r||null==s.return||s.return()}finally{if(c)throw o}}}}(u);try{for(p.s();!(s=p.n()).done;){var f=S(s.value,2),y=f[0],m=f[1];r.isInside(y,m)&&(R(m,d,a)?h.set(y,m):g.set(y,m))}}catch(e){p.e(e)}finally{p.f()}if(!n.DS.continue){var v=n.filterSelected({select:h,unselect:g,selectorRect:d}),_=v.select,D=v.unselect;_.forEach(function(t,s){return function(e){var t=e.element,s=e.force,n=e.multiSelectionToggle,i=e.SelectedSet,o=e.hoverClassName;t.classList.contains(o)&&!s||(i.has(t)?n&&i.delete(t):i.add(t),t.classList.add(o))}({element:s,force:e,multiSelectionToggle:l,SelectedSet:n.DS.SelectedSet,hoverClassName:n.Settings.hoverClass})}),D.forEach(function(t,s){return function(e){var t=e.element,s=e.force,n=e.SelectedSet,i=e.PrevSelectedSet,o=e.hoverClassName;if(!t.classList.contains(o)&&!s)return!1;var r=n.has(t),c=i.has(t);r&&!c?n.delete(t):!r&&c&&n.add(t),t.classList.remove(o)}({element:s,force:e,SelectedSet:n.DS.SelectedSet,hoverClassName:n.Settings.hoverClass,PrevSelectedSet:n._prevSelectedSet})})}}),o(this,"filterSelected",function(e){var t=e.select,s=e.unselect;return e.selectorRect,{select:t,unselect:s}}),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return i(e,[{key:"_storePrevious",value:function(e){var t=this.DS,s=t.stores.KeyStore,n=t.SelectedSet;s.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(n):this._prevSelectedSet=new Set}}]),e}(),J=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_rect",void 0),o(this,"attachSelector",function(){var e,t,s,i;n.HTMLNode&&null!==(e=n.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&n.DS.SelectorArea.HTMLNode.removeChild(n.HTMLNode),n.HTMLNode=n.DS.stores.SettingsStore.s.selector||(s=n.DS.stores.SettingsStore.s.customStyles,(i=document.createElement("div")).style.position="absolute",s||(i.style.background="rgba(0, 175, 255, 0.2)",i.style.border="1px solid rgba(0, 175, 255, 0.8)",i.style.display="none",i.style.pointerEvents="none"),i),n.HTMLNode.classList.add(n.DS.stores.SettingsStore.s.selectorClass),n.HTMLNode&&null!==(t=n.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&n.DS.SelectorArea.HTMLNode.appendChild(n.HTMLNode)}),o(this,"start",function(e){if(!e.isDragging){var t=n.DS.stores.PointerStore.initialValArea;W(n.HTMLNode,D(t,1)),n.HTMLNode.style.display="block",n._rect=null}}),o(this,"stop",function(){n.HTMLNode.style.width="0",n.HTMLNode.style.height="0",n.HTMLNode.style.display="none"}),o(this,"update",function(e){if(!e.isDragging&&!n.DS.continue){var t=n.DS.stores,s=t.ScrollStore,i=t.PointerStore,o=function(e){var t=e.scrollAmount,s=e.initialPointerPos,n=e.pointerPos,i={};return n.x>s.x-t.x?(i.left=s.x-t.x,i.width=n.x-s.x+t.x):(i.left=n.x,i.width=s.x-n.x-t.x),n.y>s.y-t.y?(i.top=s.y-t.y,i.height=n.y-s.y+t.y):(i.top=n.y,i.height=s.y-n.y-t.y),i}({scrollAmount:s.scrollAmount,initialPointerPos:i.initialValArea,pointerPos:i.currentValArea});W(n.HTMLNode,o),n._rect=null}}),this.DS=i,this.DS.subscribe("Settings:updated:selectorClass",function(e){var t=e.settings;n.HTMLNode.classList.remove(t["selectorClass:pre"]),n.HTMLNode.classList.add(t.selectorClass)}),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return i(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),q=function(){function e(t){var n,i=this,r=t.DS;s(this,e),o(this,"_scrollInterval",void 0),o(this,"_rect",void 0),o(this,"currentEdges",[]),o(this,"start",function(){i.applyElements("append"),i.updatePos()}),o(this,"applyElements",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",s="".concat(e,"Child");i.HTMLNode[s](i.DS.Selector.HTMLNode),document[t][s](i.HTMLNode)}),o(this,"updatePos",function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,s=i.HTMLNode.style,n="".concat(e.top+t.top,"px"),o="".concat(e.left+t.left,"px"),r="".concat(e.width,"px"),c="".concat(e.height,"px");s.top!==n&&(s.top=n),s.left!==o&&(s.left=o),s.width!==r&&(s.width=r),s.height!==c&&(s.height=c)}),o(this,"stop",function(e){i.stopAutoScroll(),e&&i.applyElements("remove")}),o(this,"startAutoScroll",function(){i.currentEdges=[],i._scrollInterval=setInterval(function(){return i.handleAutoScroll()},16)}),o(this,"handleAutoScroll",function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,s=e.Area;i.currentEdges=T({elementRect:D(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&s.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}}),o(this,"stopAutoScroll",function(){i.currentEdges=[],clearInterval(i._scrollInterval)}),o(this,"isInside",function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||R(i.rect,t||e.getBoundingClientRect())}),this.DS=r,this.HTMLNode=((n=document.createElement("div")).style.position="fixed",n.style.overflow="hidden",n.style.pointerEvents="none",n.style.zIndex="999999999999999999",n),this.DS.subscribe("Settings:updated:selectorAreaClass",function(e){var t=e.settings;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.HTMLNode.classList.add(t.selectorAreaClass)}),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",function(){i.updatePos(),i.stopAutoScroll()})}return i(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,s=e?t.getPointerPosition(e):t.initialVal;return R({left:s.x,top:s.y,right:s.x,bottom:s.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),$=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_currentValues",new Set),o(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),o(this,"init",function(){document.addEventListener("keydown",n.keydown),document.addEventListener("keyup",n.keyup),window.addEventListener("blur",n.reset)}),o(this,"keydown",function(e){var t=e.key.toLowerCase();n.DS.publish("KeyStore:down:pre",{event:e,key:t}),n._currentValues.add(t),n.DS.publish("KeyStore:down",{event:e,key:t})}),o(this,"keyup",function(e){var t=e.key.toLowerCase();n.DS.publish("KeyStore:up:pre",{event:e,key:t}),n._currentValues.delete(t),n.DS.publish("KeyStore:up",{event:e,key:t})}),o(this,"stop",function(){document.removeEventListener("keydown",n.keydown),document.removeEventListener("keyup",n.reset),window.removeEventListener("blur",n.reset),n.reset()}),o(this,"reset",function(){return n._currentValues.clear()}),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return i(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var s=this.DS.stores.SettingsStore.s.multiSelectKeys.map(function(e){return e.toLocaleLowerCase()});return!!this.currentValues.some(function(e){return s.includes(e.toLocaleLowerCase())})||!(!e||!s.some(function(s){return e[t._keyMapping[s]]}))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),Q=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_isMouseInteraction",!1),o(this,"_initialValArea",void 0),o(this,"_currentValArea",void 0),o(this,"_lastValArea",void 0),o(this,"_initialVal",void 0),o(this,"_currentVal",void 0),o(this,"_lastVal",void 0),o(this,"_lastTouch",void 0),o(this,"init",function(){n.Settings.usePointerEvents?document.addEventListener("pointermove",n.update,{passive:!1}):document.addEventListener("mousemove",n.update),document.addEventListener("touchmove",n.update,{passive:!1})}),o(this,"getPointerPosition",function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:n._normalizedEvent(e)})}),o(this,"update",function(e){e&&(n.DS.publish("PointerStore:updated:pre",{event:e}),n.currentVal=n.getPointerPosition(e),n._isMouseInteraction&&n.DS.publish("PointerStore:updated",{event:e}))}),o(this,"stop",function(){n.Settings.usePointerEvents?document.removeEventListener("pointermove",n.update,{passive:!1}):document.removeEventListener("mousemove",n.update),document.removeEventListener("touchmove",n.update,{passive:!1}),setTimeout(function(){return n._isMouseInteraction=!1},100)}),o(this,"reset",function(e){e&&(n.currentVal=n.lastVal=n.getPointerPosition(e),n.stop(),n.init())}),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",function(e){var t=e.event;return n.start(t)}),this.DS.subscribe("Interaction:end",function(e){var t=e.event;return n.reset(t)})}return i(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&v(e,"-",v(_(this.DS.Area.rect),"+",_(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&v(e,"-",v(_(this.DS.Area.rect),"+",_(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&v(e,"-",v(_(this.DS.Area.rect),"+",_(this.DS.Area.computedBorder)))}}]),e}(),ee=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_initialVal",void 0),o(this,"_currentVal",void 0),o(this,"_canScroll",void 0),o(this,"init",function(){return n.DS.stores.SettingsStore.s.area.addEventListener("scroll",n.update)}),o(this,"start",function(){n._currentVal=n._initialVal=w(n.DS.stores.SettingsStore.s.area),n.DS.stores.SettingsStore.s.area.addEventListener("scroll",n.update)}),o(this,"update",function(){return n._currentVal=w(n.DS.stores.SettingsStore.s.area)}),o(this,"stop",function(){n.DS.stores.SettingsStore.s.area.removeEventListener("scroll",n.update),n._initialVal={x:0,y:0},n._canScroll=null}),o(this,"reset",function(){n.stop(),n.start()}),this.DS=i,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",function(){return n.start()}),this.DS.subscribe("Interaction:end",function(){return n.reset()})}return i(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=w(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=v(this.currentVal,"-",this.initialVal),s={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},n=v(v(t,"*",s),"-",t);return{x:t.x+n.x,y:t.y+n.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=w(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),te=i(function e(n){var i=this,r=n.DS,c=n.settings;s(this,e),o(this,"_settings",{}),o(this,"s",{}),o(this,"update",function(e){var s=e.settings,n=e.init;return i.DS.publish("Settings:updated:pre",t({settings:s},n?{init:n}:{}))}),o(this,"_update",function(e){for(var s=function(e,s){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},B("area",e.area,s,document)),B("selectables",e.selectables,s,null)),B("autoScrollSpeed",e.autoScrollSpeed,s,5)),B("overflowTolerance",e.overflowTolerance,s,{x:25,y:25})),B("zoom",e.zoom,s,1)),B("customStyles",e.customStyles,s,!1)),B("multiSelectMode",e.multiSelectMode,s,!1)),B("multiSelectToggling",e.multiSelectToggling,s,!0)),B("multiSelectKeys",e.multiSelectKeys,s,["Control","Shift","Meta"])),B("selector",e.selector,s,null)),B("selectionThreshold",e.selectionThreshold,s,0)),B("draggability",e.draggability,s,!0)),B("immediateDrag",e.immediateDrag,s,!0)),B("keyboardDrag",e.keyboardDrag,s,!0)),B("dragKeys",e.dragKeys,s,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),B("keyboardDragSpeed",e.keyboardDragSpeed,s,10)),B("useTransform",e.useTransform,s,!0)),B("refreshMemoryRate",e.refreshMemoryRate,s,80)),B("dropZones",e.dropZones,s,[])),B("dropInsideThreshold",e.dropInsideThreshold,s,1)),B("dropTargetThreshold",e.dropTargetThreshold,s,0)),B("usePointerEvents",e.usePointerEvents,s,!1)),B("hoverClass",e.hoverClass,s,"ds-hover")),B("selectableClass",e.selectableClass,s,"ds-selectable")),B("selectedClass",e.selectedClass,s,"ds-selected")),B("selectorClass",e.selectorClass,s,"ds-selector")),B("selectorAreaClass",e.selectorAreaClass,s,"ds-selector-area")),B("droppedTargetClass",e.droppedTargetClass,s,"ds-dropped-target")),B("droppedInsideClass",e.droppedInsideClass,s,"ds-dropped-inside")),B("droppableClass",e.droppableClass,s,"ds-droppable")),B("dropZoneClass",e.dropZoneClass,s,"ds-dropzone")),B("dropZoneReadyClass",e.dropZoneReadyClass,s,"ds-dropzone-ready")),B("dropZoneTargetClass",e.dropZoneTargetClass,s,"ds-dropzone-target")),B("dropZoneInsideClass",e.dropZoneInsideClass,s,"ds-dropzone-inside")),B("dragAsBlock",e.dragAsBlock,s,!1))}(e.settings,e.init),n=function(){var e,t=S(c[r],2),s=t[0],n=t[1];s in i._settings||Object.defineProperty(i.s,s,{get:function(){return i._settings[s]},set:function(e){return i.update({settings:o({},s,e)})}}),i._settings["".concat(s,":pre")]=i._settings[s],i._settings[s]=n;var l={settings:(e={},o(e,s,i._settings[s]),o(e,"".concat(s,":pre"),i._settings["".concat(s,":pre")]),e)};i.DS.publish("Settings:updated",l),i.DS.publish("Settings:updated:".concat(s),l)},r=0,c=Object.entries(s);r0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(z(e)),s||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(z(e)),s&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return z(e).forEach(function(i){return t.SelectedSet.has(i)?t.removeSelection(e,s,n):t.addSelection(e,s,n)}),s&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,s),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,s){var n=z(e);return this.SelectableSet.addAll(n),t&&this.SelectedSet.addAll(n),s&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,s)}},{key:"removeSelectables",value:function(e,t,s){return this.SelectableSet.deleteAll(z(e)),t&&this.removeSelection(e),s&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();return se.isCollision=R,se}()},370:t=>{"use strict";t.exports=e}},s={};function n(e){var i=s[e];if(void 0!==i)return i.exports;var o=s[e]={exports:{}};return t[e].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{Multiselect:()=>z,dragSelectionWeakMap:()=>s,inMultipleSelectionModeWeakMap:()=>o});var e=n(370);const t=new WeakMap,s=new WeakMap,o=new WeakMap,r=new Set,c=new Set,l=new WeakMap,a=[],u=[],d=[];let h=0;const g=Object.freeze({MULTIDELETE:"multiselectDelete",MULTICOPY:"multiselectCopy",MULTICUT:"multiselectCut",MULTIPASTE:"multiselectPaste"}),p=function(e,t=!1){for(;e;)if((e=t?e.getParent():e.getSurroundParent())&&s.get(e.workspace).has(e.id))return!0;return!1},S=function(e,t){return e.getBlockById(t)?e.getBlockById(t):e.getCommentById(t)?e.getCommentById(t):null},f=function(){const e=[];c.forEach(t=>{delete t.source,e.push(t)}),h=Date.now(),localStorage.setItem("blocklyStashMulti",JSON.stringify(e)),localStorage.setItem("blocklyStashConnection",JSON.stringify(a)),localStorage.setItem("blocklyStashTime",h)},b=function(){const e=JSON.parse(localStorage.getItem("blocklyStashMulti")),t=JSON.parse(localStorage.getItem("blocklyStashConnection")),s=localStorage.getItem("blocklyStashTime");e&&parseInt(s)>h&&(h=s,c.clear(),e.forEach(e=>{c.add(e)}),a.length=0,t.forEach(e=>{a.push(e)}))},y=function(e){if(!e)return c.size;const t=JSON.parse(localStorage.getItem("blocklyStashMulti")),s=localStorage.getItem("blocklyStashTime");return t&&parseInt(s)>h?t.length:c.size};class m{constructor(t){this.workspace=t,this.id=e.utils.idGenerator.genUid(),this.subDraggables=new Map,this.topSubDraggables=[],this.loc=new e.utils.Coordinate(0,0),this.connectionDBList=[],this.dragSelection=s.get(t)}clearAll_(){for(const[e]of this.subDraggables)e.unselect(),this.removeSubDraggable_(e)}addSubDraggable_(e){e instanceof m||this.addPointerDownEventListener_(e),this.subDraggables.set(e,e.getRelativeToSurfaceXY())}removeSubDraggable_(e){e instanceof m||this.removePointerDownEventListener_(e),this.subDraggables.delete(e)}addPointerDownEventListener_(t){const s=t instanceof e.BlockSvg?this.pointerDownEventHandlerCapture_.bind(this):null,n=this.pointerDownEventHandler_.bind(this);t.pointerDownHandlerCapture=s,t.pointerDownHandler=n,s&&t.getSvgRoot().addEventListener("pointerdown",s,!0),t.getSvgRoot().addEventListener("pointerdown",n)}removePointerDownEventListener_(e){if(e){const t=e.pointerDownHandlerCapture,s=e.pointerDownHandler;t&&(e.getSvgRoot().removeEventListener("pointerdown",t,!0),delete e.pointerDownHandlerCapture),s&&(e.getSvgRoot().removeEventListener("pointerdown",s),delete e.pointerDownHandler)}}pointerDownEventHandlerCapture_(e){if(!o.get(this.workspace)){const t=this.workspace.getBlockById(e.target.closest("[data-id]").getAttribute("data-id"));this.subDraggables.has(t)||(this.clearAll_(),this.dragSelection.clear())}}pointerDownEventHandler_(t){o.get(this.workspace)||e.common.setSelected(this)}isMovable(){return!o.get(this.workspace)}getRelativeToSurfaceXY(){return this.loc}startDrag(t){this.inGroup=!!e.Events.getGroup(),this.inGroup||e.Events.setGroup(!0);for(const t of this.subDraggables){if(t[0]instanceof e.BlockSvg){if(p(t[0],!0)||this.topSubDraggables.push(t[0]),!t[0].isShadow()){const e=t[0].getParent();e&&this.subDraggables.has(e)&&e.getNextBlock()===t[0]&&this.connectionDBList.push([e.nextConnection,t[0].previousConnection])}}else this.topSubDraggables.push(t[0]);this.subDraggables.set(t[0],t[0].getRelativeToSurfaceXY())}for(const e of this.topSubDraggables)e.startDrag()}drag(t,s){for(const n of this.topSubDraggables)this.subDraggables.get(n)&&this.subDraggables.get(n)instanceof e.utils.Coordinate&&n.drag(e.utils.Coordinate.sum(t,this.subDraggables.get(n)),s)}endDrag(t){const s=this.workspace.getDragTarget(t);s&&this.topSubDraggables.some(e=>s.shouldPreventMove(e))&&this.revertDrag();for(const e of this.topSubDraggables)e.endDrag(t);for(const e of this.subDraggables)e[1]=e[0].getRelativeToSurfaceXY();this.connectionDBList.forEach(function(e){e[0].connect(e[1])}),this.topSubDraggables.length=0,this.connectionDBList.length=0,this.inGroup||e.Events.setGroup(!1)}revertDrag(){for(const e of this.subDraggables)e[0].revertDrag()}select(){for(const t of this.subDraggables)t[0]instanceof e.BlockSvg&&t[0].isShadow(),t[0].select()}unselect(){}isDeletable(){return!0}dispose(){for(const t of this.subDraggables)t[0].isDeletable()&&(this.removeSubDraggable_(t[0]),this.dragSelection.delete(t[0].id),t[0]instanceof e.BlockSvg?t[0].dispose(!0,!0):t[0].dispose())}setDeleteStyle(e){for(const t of this.subDraggables)t[0].isDeletable()&&t[0].setDeleteStyle(e)}getBoundingRectangle(){if(0===this.subDraggables.size)return new e.utils.Rect(0,0,0,0);let t=1/0,s=-1/0,n=1/0,i=-1/0;return this.subDraggables.forEach((e,o)=>{const r=o.getBoundingRectangle();t=Math.min(t,r.top),s=Math.max(s,r.bottom),n=Math.min(n,r.left),i=Math.max(i,r.right)}),new e.utils.Rect(t,s,n,i)}toFlyoutInfo(){const e=[];for(const t of this.subDraggables)if(void 0!==t[0].toFlyoutInfo){const s=t[0].toFlyoutInfo();e.push(...s)}return e}}const v=function(){const n="blockDuplicate",i={displayText:function(t){let n=0;const o=t.block.workspace;return s.get(o).forEach(function(e){const t=o.getBlockById(e);i.check(t)&&n++}),n<=1?e.Msg.DUPLICATE_BLOCK:e.Msg.DUPLICATE_X_BLOCKS?e.Msg.DUPLICATE_X_BLOCKS.replace("%1",n):e.Msg.DUPLICATE_BLOCK+" ("+n+")"},preconditionFn:function(e){const t=e.block;return!t.isInFlyout&&t.isDeletable()&&t.isMovable()?t.isDuplicatable()?"enabled":"disabled":"hidden"},check:function(e){return e&&"enabled"===i.preconditionFn({block:e})&&!p(e)},callback:function(n){const o={},r=[],c=n.block.workspace,l=t.get(c),a=function(t){if(i.check(t)){const s=e.utils.idGenerator.genUid(),n=t.toCopyData();n.blockState.id=s,o[t.id]=e.clipboard.paste(n,c)}},u=s.get(c);e.Events.setGroup(!0),u.size?(u.forEach(function(e){const t=c.getBlockById(e);t&&(t.unselect(),p(t)||a(t))}),u.clear(),l.clearAll_(),e.common.setSelected(null)):a(n.block);for(const[e,t]of Object.entries(o)){const s=c.getBlockById(e),n=s.getParent();t.id&&(n&&n.id in o&&n.getNextBlock()===s&&r.push([o[n.id].nextConnection,t.previousConnection]),"drag_to_dupe"!==t.type&&(u.add(t.id),l.addSubDraggable_(t)))}r.forEach(function(e){e[0].connect(e[1])}),1===u.size?e.common.setSelected(S(c,u.values().next().value)):e.common.setSelected(l),e.Events.setGroup(!1)},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:n,weight:1};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)},_=function(){const t="blockComment",n={displayText:function(t){let i=0;const o=t.block.hasIcon(e.icons.CommentIcon.TYPE),r=t.block.workspace;return s.get(r).forEach(function(t){const s=r.getBlockById(t);n.check(s)&&o===s.hasIcon(e.icons.CommentIcon.TYPE)&&i++}),o?i<=1?e.Msg.REMOVE_COMMENT:e.Msg.REMOVE_X_COMMENTS?e.Msg.REMOVE_X_COMMENTS.replace("%1",i):e.Msg.REMOVE_COMMENT+" ("+i+")":i<=1?e.Msg.ADD_COMMENT:e.Msg.ADD_X_COMMENTS?e.Msg.ADD_X_COMMENTS.replace("%1",i):e.Msg.ADD_COMMENT+" ("+i+")"},preconditionFn:function(t){const s=t.block;return e.utils.userAgent.IE||s.isInFlyout||!s.workspace.options.comments||s.isCollapsed()||!s.isEditable()?"hidden":"enabled"},check:function(e){return e&&"enabled"===n.preconditionFn({block:e})},callback:function(t){const i=t.block.hasIcon(e.icons.CommentIcon.TYPE),o=function(e){n.check(e)&&(i?e.setCommentText(null):e.setCommentText(""))},r=t.block.workspace,c=s.get(r);e.Events.setGroup(!0),c.size||o(t.block),c.forEach(function(e){const t=r.getBlockById(e);t&&o(t)}),e.Events.setGroup(!1)},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:t,weight:2};null!==e.ContextMenuRegistry.registry.getItem(t)&&e.ContextMenuRegistry.registry.unregister(t),e.ContextMenuRegistry.registry.register(n)},D=function(){const t="blockInline",n={displayText:function(t){let i=0;const o=t.block.getInputsInline(),r=t.block.workspace;return s.get(r).forEach(function(e){const t=r.getBlockById(e);n.check(t)&&t.getInputsInline()===o&&i++}),o?i<=1?e.Msg.EXTERNAL_INPUTS:e.Msg.EXTERNAL_X_INPUTS?e.Msg.EXTERNAL_X_INPUTS.replace("%1",i):e.Msg.EXTERNAL_INPUTS+" ("+i+")":i<=1?e.Msg.INLINE_INPUTS:e.Msg.INLINE_X_INPUTS?e.Msg.INLINE_X_INPUTS.replace("%1",i):e.Msg.INLINE_INPUTS+" ("+i+")"},preconditionFn:function(t){const s=t.block;if(!s.isInFlyout&&s.isMovable()&&!s.isCollapsed())for(let t=1;tt.name).includes(t)&&(e.ShortcutRegistry.registry.unregister(t),d.push(t))},B=function(){d.length=0;for(const t of[g.MULTIDELETE,g.MULTICOPY,g.MULTICUT,g.MULTIPASTE])Object.entries(e.ShortcutRegistry.registry.getRegistry()).map(([e,t])=>t.name).includes(t)&&e.ShortcutRegistry.registry.unregister(t);for(const t of[e.ShortcutItems.names.DELETE,e.ShortcutItems.names.COPY,e.ShortcutItems.names.CUT,e.ShortcutItems.names.PASTE])d.push(t)},R=function(n){const i=[e.ShortcutItems.names.DELETE],o={[e.ShortcutItems.names.DELETE]:T,[e.ShortcutItems.names.COPY]:L,[e.ShortcutItems.names.CUT]:P,[e.ShortcutItems.names.PASTE]:x};for(const e of d)i.includes(e)?o[e]():o[e](n);!function(){const n="selectall",i={name:n,preconditionFn:function(e){return!!e.getTopBlocks().some(e=>i.check(e))},check:function(e){return e&&(e.isDeletable()||e.isMovable())&&!e.isInsertionMarker()},callback:function(n,o){o.preventDefault();const r=s.get(n),c=t.get(n);if(e.getSelected()){if(e.getSelected()instanceof m)for(const[t]of e.getSelected().subDraggables)t.unselect();else e.getSelected().unselect();e.common.setSelected(null),c.clearAll_(),s.get(n).clear()}const l=[];return n.getTopBlocks().forEach(function(e){if(i.check(e)){l.push(e);let t=e.getNextBlock();for(;t;)l.push(t),t=t.getNextBlock()}}),l.forEach(function(e){"drag_to_dupe"!==e.type&&(c.addSubDraggable_(e),r.add(e.id))}),e.common.setSelected(c),!0}};n in e.ShortcutRegistry.registry.getRegistry()&&e.ShortcutRegistry.registry.unregister(n),e.ShortcutRegistry.registry.register(i);const o=e.ShortcutRegistry.registry.createSerializedKey(e.utils.KeyCodes.A,[e.utils.KeyCodes.CTRL]);e.ShortcutRegistry.registry.addKeyMapping(o,i.name);const r=e.ShortcutRegistry.registry.createSerializedKey(e.utils.KeyCodes.A,[e.utils.KeyCodes.ALT]);e.ShortcutRegistry.registry.addKeyMapping(r,i.name);const c=e.ShortcutRegistry.registry.createSerializedKey(e.utils.KeyCodes.A,[e.utils.KeyCodes.META]);e.ShortcutRegistry.registry.addKeyMapping(c,i.name)}()};var O=n(28),N=n.n(O);class K{constructor(n,i,o){this.enabled_img="https://github.com/mit-cml/workspace-multiselect/raw/main/test/media/select.svg",this.disabled_img="https://github.com/mit-cml/workspace-multiselect/raw/main/test/media/unselect.svg",this.workspace_=n,this.enabled=!1,this.id="multiselectControls",this.multiSelectKeys_=o,this.onMultiselectWrapper_=null,this.multiselectGroup_=null,this.initialized_=!1,this.hasDisableWorkspaceDrag_=!1,this.justUnselectedBlock_=null,this.lastSelectedElement_=null,i&&i.enabledIcon&&(this.enabled_img=i.enabledIcon),i&&i.disabledIcon&&(this.disabled_img=i.disabledIcon),this.dragSelection=s.get(n),this.multiDraggable=t.get(n),this.origHandleBlockStart=e.Gesture.prototype.handleBlockStart}createDom(){return this.svgGroup_=e.utils.dom.createSvgElement(e.utils.Svg.G,{},null),this.createMultiselectSvg_(),this.svgGroup_}init(t,s){if(!t){let t=3;"number"==typeof s&&(t=s),this.workspace_.getComponentManager().addComponent({component:this,weight:t,capabilities:[e.ComponentManager.Capability.POSITIONABLE]})}this.initialized_=!0,this.workspace_.resize(),this.multiDraggable.clearAll_()}dispose(){this.disableMultiselect(),this.workspace_.getComponentManager().removeComponent(this.id),this.svgGroup_&&e.utils.dom.removeNode(this.svgGroup_),this.onMultiselectWrapper_&&e.browserEvents.unbind(this.onMultiselectWrapper_)}getBoundingRectangle(){const t=this.top_+32,s=this.left_+32;return new e.utils.Rect(this.top_,t,this.left_,s)}position(t,s){if(!this.initialized_)return;const n=e.uiPosition.getCornerOppositeToolbox(this.workspace_,t),i=e.uiPosition.getStartPositionRect(n,new e.utils.Size(32,32),20,20,t,this.workspace_),o=n.vertical===e.uiPosition.verticalPosition.TOP?e.uiPosition.bumpDirection.DOWN:e.uiPosition.bumpDirection.UP,r=e.uiPosition.bumpPositionRect(i,20,o,s);this.top_=r.top,this.left_=r.left,this.svgGroup_&&this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}revertLastUnselectedBlock(){this.updateDraggables_(this.justUnselectedBlock_)}createMultiselectSvg_(){this.multiselectGroup_=e.utils.dom.createSvgElement(e.utils.Svg.G,{class:"blocklyMultiselect"},this.svgGroup_),e.utils.dom.createSvgElement(e.utils.Svg.IMAGE,{width:32,height:32},this.multiselectGroup_).setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",this.disabled_img),this.onMultiselectWrapper_=e.browserEvents.conditionalBind(this.multiselectGroup_,"mousedown",null,this.switchMultiselect_.bind(this))}switchMultiselect_(t){this.workspace_.markFocused(),this.enabled=!this.enabled,this.enabled?this.enableMultiselect(!0):this.disableMultiselect(!0),e.Touch.clearTouchIdentifier(),t.stopPropagation(),t.preventDefault()}updateDraggables_(t){if(t)if(t instanceof e.BlockSvg){if(!t.isDeletable()&&!t.isMovable()||t.isShadow()||"drag_to_dupe"===t.type)return;this.dragSelection.has(t.id)?(this.dragSelection.delete(t.id),this.justUnselectedBlock_=t,this.multiDraggable.removeSubDraggable_(t),t.pathObject.updateSelected(!1)):(this.dragSelection.add(t.id),this.justUnselectedBlock_=null,this.multiDraggable.addSubDraggable_(t),t.pathObject.updateSelected(!0),t.bringToFront())}else{if(!t.isMovable()&&!t.isDeletable())return;this.dragSelection.has(t.id)?(this.dragSelection.delete(t.id),this.multiDraggable.removeSubDraggable_(t),t.unselect()):(this.dragSelection.add(t.id),this.multiDraggable.addSubDraggable_(t),t.select())}}updateMultiselect(){if(o.get(this.workspace_))this.dragSelection.size>1&&e.getSelected()!==this.multiDraggable?e.common.setSelected(this.multiDraggable):1===this.dragSelection.size&&e.getSelected()!==S(this.workspace_,this.dragSelection.values().next().value)?e.common.setSelected(S(this.workspace_,this.dragSelection.values().next().value)):0===this.dragSelection.size&&null!==e.getSelected()?e.common.setSelected(null):this.lastSelectedElement_&&!l.get(this.workspace_)?(this.updateDraggables_(this.lastSelectedElement_),this.lastSelectedElement_=null,l.set(this.workspace_,!1),this.dragSelection.size>1&&e.getSelected()!==this.multiDraggable?e.common.setSelected(this.multiDraggable):1===this.dragSelection.size&&e.getSelected()!==S(this.workspace_,this.dragSelection.values().next().value)?e.common.setSelected(S(this.workspace_,this.dragSelection.values().next().value)):0===this.dragSelection.size&&null!==e.getSelected()&&e.common.setSelected(null)):this.dragSelection.size||e.getSelected()instanceof m||(e.getSelected()instanceof e.BlockSvg&&!e.getSelected().isShadow()&&e.common.setSelected(null),e.getSelected()instanceof e.BlockSvg&&(this.justUnselectedBlock_=e.getSelected()));else if(this.workspace_.id!==e.getMainWorkspace().id&&(this.multiDraggable.clearAll_(),this.dragSelection.clear()),e.getSelected()){if(e.getSelected()&&!(e.getSelected()instanceof m)&&!this.dragSelection.has(e.getSelected().id)){for(const e of this.multiDraggable.subDraggables)e[0].unselect();this.multiDraggable.clearAll_(),this.dragSelection.clear(),this.lastSelectedElement_=e.getSelected(),l.set(this.workspace_,!1)}}else{this.lastSelectedElement_=null;for(const e of this.multiDraggable.subDraggables)e[0].unselect();this.multiDraggable.clearAll_(),this.dragSelection.clear(),e.common.setSelected(null)}}enableMultiselect(e=!1){!this.hasDisableWorkspaceDrag_&&this.workspace_.options.moveOptions&&this.workspace_.options.moveOptions.drag&&(this.workspace_.options.moveOptions.drag=!1,this.hasDisableWorkspaceDrag_=!0),this.dragSelect_=new(N())({selectables:this.workspace_.getInjectionDiv().querySelectorAll("g.blocklyDraggable:not(.blocklyInsertionMarker)> path.blocklyPath, g.blocklyDraggable > rect.blocklyCommentHighlight"),area:this.workspace_.getSvgGroup(),multiselectMode:!0,draggability:!1,usePointerEvents:!0,multiSelectKeys:this.multiSelectKeys_}),this.dragSelect_.Selection.filterSelected=({selectorRect:e,select:t,unselect:s})=>{const n=t,i=s;return((e,t)=>{const s=[];for(const[n,i]of e.entries())for(const[o,r]of e.entries())if(n!==o&&N().isCollision(r,i,0)&&null!==n.parentNode&&null!==o.parentNode&&n.parentNode!==o.parentNode&&n.parentNode.contains(o.parentNode)&&N().isCollision(t,r,1)){s.push(n);break}return s})(n,e).forEach(e=>{const t=n.get(e);n.delete(e),i.set(e,t)}),{select:n,unselect:i}},this.dragSelect_.subscribe("elementselect",e=>{const t=e.item.parentElement;o.get(this.workspace_)&&t&&t.dataset&&t.dataset.id&&this.updateDraggables_(S(this.workspace_,t.dataset.id))}),this.dragSelect_.subscribe("elementunselect",e=>{const t=e.item.parentElement;o.get(this.workspace_)&&t&&t.dataset&&t.dataset.id&&this.updateDraggables_(S(this.workspace_,t.dataset.id))}),e&&document.dispatchEvent(new KeyboardEvent("keydown",{key:this.multiSelectKeys_[0]})),this.updateMultiselectIcon(!0),o.set(this.workspace_,!0)}disableMultiselect(t=!1){o.set(this.workspace_,!1),this.dragSelect_&&(t&&document.dispatchEvent(new KeyboardEvent("keyup",{key:this.multiSelectKeys_[0]})),this.dragSelect_.stop(),this.dragSelect_=null),this.dragSelection.size>1&&e.getSelected()!==this.multiDraggable?e.common.setSelected(this.multiDraggable):1===this.dragSelection.size&&e.getSelected()!==S(this.workspace_,this.dragSelection.values().next().value)?e.common.setSelected(S(this.workspace_,this.dragSelection.values().next().value)):0===this.dragSelection.size&&null!==e.getSelected()&&e.common.setSelected(null),this.hasDisableWorkspaceDrag_&&(this.workspace_.options.moveOptions.drag=!0,this.hasDisableWorkspaceDrag_=!1),this.updateMultiselectIcon(!1)}updateMultiselectIcon(t){this.multiselectGroup_&&(this.enabled=t,t?this.multiselectGroup_.firstElementChild.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",this.enabled_img):this.multiselectGroup_.firstElementChild.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",this.disabled_img))}}e.Css.register("\n.blocklyMultiselect>image, .blocklyMultiselect>svg>image {\n opacity: .4;\n}\n\n.blocklyMultiselect>image:hover, .blocklyMultiselect>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyMultiselect>image:active, .blocklyMultiselect>svg>image:active {\n opacity: .8;\n}\n");class z{constructor(n){this.workspace_=n,this.origHandleWsStart_=e.Gesture.prototype.handleWsStart,s.set(this.workspace_,new Set),t.set(this.workspace_,new m(this.workspace_)),this.dragSelection_=s.get(this.workspace_),o.set(this.workspace_,!1),this.useCopyPasteCrossTab_=!0,this.useCopyPasteMenu_=!0,this.multiFieldUpdate_=!0,this.multiSelectKeys_=["shift"],this.registeredShortcut_=!0}init(n){n.multiSelectKeys&&n.multiSelectKeys.length>0&&(this.multiSelectKeys_=n.multiSelectKeys.map(e=>e.toLocaleLowerCase()));const i=this.workspace_.getInjectionDiv(),o=e.DropDownDiv.getContentDiv(),l=e.WidgetDiv.getDiv();if(this.onKeyDownWrapper_=e.browserEvents.conditionalBind(i,"keydown",this,this.onKeyDown_),this.onKeyDownDropdownDivWrapper_=e.browserEvents.conditionalBind(o,"keydown",this,this.onKeyDown_),l&&(this.onKeyDownWidgetDivWrapper_=e.browserEvents.conditionalBind(l,"keydown",this,this.onKeyDown_)),this.onKeyUpWrapper_=e.browserEvents.conditionalBind(i,"keyup",this,this.onKeyUp_),this.onKeyUpDropdownDivWrapper_=e.browserEvents.conditionalBind(o,"keyup",this,this.onKeyUp_),l&&(this.onKeyUpWidgetDivWrapper_=e.browserEvents.conditionalBind(l,"keyup",this,this.onKeyUp_)),this.onFocusOutWrapper_=e.browserEvents.conditionalBind(i,"focusout",this,this.onBlur_),this.onFocusOutDropdownDivWrapper_=e.browserEvents.conditionalBind(o,"focusout",this,this.onBlur_),l&&(this.onFocusOutWidgetDivWrapper_=e.browserEvents.conditionalBind(l,"focusout",this,this.onBlur_)),i.addEventListener("mouseenter",()=>{!1!==n.workspaceAutoFocus&&document.activeElement!==this.workspace_.getSvgGroup().parentElement&&"input"!==document.activeElement.nodeName.toLowerCase()&&"textarea"!==document.activeElement.nodeName.toLowerCase()&&this.workspace_.getSvgGroup().parentElement.focus()}),this.eventListenerWrapper_=this.eventListener_.bind(this),this.workspace_.addChangeListener(this.eventListenerWrapper_),this.eventListenerAllWrapper_=this.eventListenerAll_.bind(this),e.Workspace.getAll().forEach(e=>{e.addChangeListener(this.eventListenerAllWrapper_)}),n.multiselectCopyPaste&&!1===n.multiselectCopyPaste.crossTab&&(this.useCopyPasteCrossTab_=!1),n.multiselectCopyPaste&&!1===n.multiselectCopyPaste.menu&&(this.useCopyPasteMenu_=!1),e.ContextMenuRegistry.registry.getItem("workspaceSelectAll")||(w(),function(n,i){n&&(function(t){const n="blockCopyToStorage",i={displayText:function(t){let n=0;const o=t.block.workspace;return s.get(o).forEach(function(e){const t=o.getBlockById(e);t&&i.check(t)&&n++}),n<=1?e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy":e.Msg.CROSS_TAB_COPY_X_BLOCKS?e.Msg.CROSS_TAB_COPY_X_BLOCKS.replace("%1",n):(e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy")+" ("+n+")"},preconditionFn:function(n){const o=n.block.workspace;if(o.options.readOnly&&!t)return"hidden";const r=e.common.getSelected(),c=s.get(o);if(void 0===c)return"hidden";if(!c.size)return i.check(r)?"enabled":"disabled";for(const e of c){const t=o.getBlockById(e);if(t&&i.check(t))return"enabled"}return"disabled"},check:function(e){return e&&e.isDeletable()&&e.isMovable()&&!p(e)},callback:function(n){const o=n.block.workspace;c.clear(),o.hideChaff();const r=[],l=function(e){i.check(e)&&(c.add(JSON.stringify(e.toCopyData())),r.push(e.id))},u=e.common.getSelected(),d=s.get(o);if(e.Events.setGroup(!0),u&&u instanceof m)for(const t of u.subDraggables)t[0]instanceof e.BlockSvg&&l(t[0]);else d.size||l(u);return a.length=0,r.forEach(function(e){const t=o.getBlockById(e),s=t.getParent();s&&-1!==r.indexOf(s.id)&&s.getNextBlock()===t&&a.push([r.indexOf(s.id),r.indexOf(t.id)])}),t&&f(),e.Events.setGroup(!1),!0},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:n,weight:0};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}(i),function(n){const i="blockPasteFromStorage",o={displayText:function(){const t=y(n);return t<=1?e.Msg.CROSS_TAB_PASTE?e.Msg.CROSS_TAB_PASTE:"Paste":e.Msg.CROSS_TAB_PASTE_X_ELEMENTS?e.Msg.CROSS_TAB_PASTE_X_ELEMENTS.replace("%1",t):(e.Msg.CROSS_TAB_PASTE?e.Msg.CROSS_TAB_PASTE:"Paste")+" ("+t+")"},preconditionFn:function(e){return e.workspace.options.readOnly?"hidden":y(n)<1?"disabled":"enabled"},callback:function(i){let o=i.workspace;const r=s.get(o);e.Events.setGroup(!0);const l=t.get(o);r.size&&(r.forEach(function(e){S(o,e).unselect()}),r.clear(),l.clearAll_());const u=[];return n&&b(),c.forEach(function(n){const i=JSON.parse(n);if(o.id!==e.getMainWorkspace().id&&(i.blockState?i.blockState.id=e.utils.idGenerator.genUid():i.commentState&&(i.commentState.id=e.utils.idGenerator.genUid())),i.source&&(o=i.source),o.isFlyout&&(o=o.targetWorkspace),i.typeCounts&&o.isCapacityAvailable(i.typeCounts)){const n=e.clipboard.paste(i,o);n&&u.push(n),"drag_to_dupe"!==n.type&&(s.get(o).add(n.id),t.get(o).addSubDraggable_(n))}else if(i.commentState){const n=e.clipboard.paste(i,o);n&&n.select(),s.get(o).add(n.id),t.get(o).addSubDraggable_(n)}}),a.forEach(function(e){u[e[0]].nextConnection.connect(u[e[1]].previousConnection)}),e.Events.setGroup(!1),1===r.size?e.common.setSelected(S(o,r.values().next().value)):e.common.setSelected(l),!0},scopeType:e.ContextMenuRegistry.ScopeType.WORKSPACE,id:i,weight:0};null!==e.ContextMenuRegistry.registry.getItem(i)&&e.ContextMenuRegistry.registry.unregister(i),e.ContextMenuRegistry.registry.register(o)}(i),function(t){const n="commentCopyToStorage",i={displayText:function(t){let n=0;const o=t.comment.workspace;return s.get(o).forEach(function(e){const t=o.getCommentById(e);t&&i.check(t)&&n++}),n<=1?e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy":e.Msg.CROSS_TAB_COPY_X_COMMENTS?e.Msg.CROSS_TAB_COMMENTS.replace("%1",n):(e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy")+" ("+n+")"},preconditionFn:function(e){const n=e.comment.workspace;if(n.options.readOnly&&!t)return"hidden";const o=s.get(n);if(void 0===o)return"hidden";if(!o.size)return i.check(e.comment)?"enabled":"disabled";for(const e of o){const t=n.getCommentById(e);if(t&&i.check(t))return"enabled"}return"disabled"},check:function(e){return e&&e.isDeletable()&&e.isMovable()},callback:function(n){const o=n.comment.workspace;c.clear(),o.hideChaff();const r=function(e){i.check(e)&&c.add(JSON.stringify(e.toCopyData()))},l=e.common.getSelected(),a=s.get(o);if(e.Events.setGroup(!0),l&&l instanceof m)for(const t of l.subDraggables)t[0]instanceof e.comments.RenderedWorkspaceComment&&r(t[0]);else a.size||r(n.comment);return t&&f(),e.Events.setGroup(!1),!0},scopeType:e.ContextMenuRegistry.ScopeType.COMMENT,id:n,weight:0};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}(i));const o={blockDuplicate:v,blockComment:_,blockInline:D,blockCollapseExpand:k,blockDisable:C,blockDelete:E,commentDelete:M,commentDuplicate:I};for(const e of u)o[e]();!function(){const n="workspaceSelectAll",i={displayText:function(){return"Select all Blocks"},preconditionFn:function(e){return e.workspace.getTopBlocks().some(e=>i.check(e))?"enabled":"disabled"},check:function(e){return e&&(e.isDeletable()||e.isMovable())&&!e.isInsertionMarker()},callback:function(n){const o=t.get(n.workspace);if(e.getSelected()){if(e.getSelected()instanceof m)for(const[t]of e.getSelected().subDraggables)t.unselect();else e.getSelected().unselect();e.common.setSelected(null),o.clearAll_(),s.get(n.workspace).clear()}const r=[];n.workspace.getTopBlocks().forEach(function(e){if(i.check(e)){r.push(e);let t=e.getNextBlock();for(;t;)r.push(t),t=t.getNextBlock()}}),r.forEach(function(e){"drag_to_dupe"!==e.type&&(s.get(e.workspace).add(e.id),o.addSubDraggable_(e))}),e.common.setSelected(o)},scopeType:e.ContextMenuRegistry.ScopeType.WORKSPACE,id:n,weight:5};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}(),function(t=!1){const n="copy_to_backpack",i={getBackPack:function(e){return e.getComponentManager().getComponent("backpack")},check:function(e){if(!e)return!1;const t=e.workspace,s=i.getBackPack(t);return s&&!s.containsBlock(e)&&!p(e)},displayText:function(t){if(!t.block)return"";const n=t.block.workspace;if(!i.getBackPack(n))return"";let o=0;const r=s.get(n);r.size||i.check(t.block)&&o++;for(const e of r)i.check(n.getBlockById(e))&&o++;return o>1?e.Msg.COPY_X_TO_BACKPACK?e.Msg.COPY_X_TO_BACKPACK.replace("%1",o.toString()):e.Msg.COPY_TO_BACKPACK+` (${o})`:e.Msg.COPY_TO_BACKPACK},preconditionFn:function(e){if(!e.block)return"hidden";const n=e.block.workspace;if(!n.isFlyout){if(!i.getBackPack(n))return"hidden";if(t)return"enabled";const o=s.get(n);if(!o.size&&i.check(e.block))return"enabled";for(const e of o)if(i.check(n.getBlockById(e)))return"enabled";return"disabled"}return"hidden"},callback:function(e){if(!e.block)return;const t=e.block.workspace,n=i.getBackPack(t),o=s.get(t);o.size||i.check(e.block)&&n.addBlock(e.block),o.forEach(function(e){const s=t.getBlockById(e);i.check(s)&&n.addBlock(s)})},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:n,weight:200};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}()}(this.useCopyPasteMenu_,this.useCopyPasteCrossTab_),A(),R(this.useCopyPasteCrossTab_)),this.controls_=new K(this.workspace_,n.multiselectIcon,this.multiSelectKeys_),r.add(this.controls_),!n.multiselectIcon||!n.multiselectIcon.hideIcon){const e=this.controls_.createDom();this.workspace_.getParentSvg().appendChild(e)}this.controls_.init(n.multiselectIcon.hideIcon,n.multiselectIcon.weight),n.useDoubleClick&&this.useDoubleClick_(!0),!1===n.multiFieldUpdate&&(this.multiFieldUpdate_=!1),n.bumpNeighbours||(this.origBumpNeighbours=e.BlockSvg.prototype.bumpNeighbours,e.BlockSvg.prototype.bumpNeighbours=function(){}),e.browserEvents.conditionalBind(i,"keydown",this,this.unbindMultiselectCopyPaste_),this.workspace_.keyboardAccessibilityMode&&(B(),this.registeredShortcut_=!1)}static withoutMultiFieldUpdates(t){const s=e.Events.getRecordUndo();e.Events.setRecordUndo(!1);try{t()}finally{e.Events.setRecordUndo(s)}}setMultiselectIcon(e,t){this.controls_&&(this.controls_.enabled_img=e,this.controls_.disabled_img=t,this.controls_.updateMultiselectIcon(this.controls_.enabled))}dispose(t=!1){this.onKeyDownWrapper_&&(e.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyDownDropdownDivWrapper_&&(e.browserEvents.unbind(this.onKeyDownDropdownDivWrapper_),this.onKeyDownDropdownDivWrapper_=null),this.onKeyDownWidgetDivWrapper_&&(e.browserEvents.unbind(this.onKeyDownWidgetDivWrapper_),this.onKeyDownWidgetDivWrapper_=null),this.onKeyUpWrapper_&&(e.browserEvents.unbind(this.onKeyUpWrapper_),this.onKeyUpWrapper_=null),this.onKeyUpDropdownDivWrapper_&&(e.browserEvents.unbind(this.onKeyUpDropdownDivWrapper_),this.onKeyUpDropdownDivWrapper_=null),this.onKeyUpWidgetDivWrapper_&&(e.browserEvents.unbind(this.onKeyUpWidgetDivWrapper_),this.onKeyUpWidgetDivWrapper_=null),this.onFocusOutWrapper_&&(e.browserEvents.unbind(this.onFocusOutWrapper_),this.onFocusOutWrapper_=null),this.onFocusOutDropdownDivWrapper_&&(e.browserEvents.unbind(this.onFocusOutDropdownDivWrapper_),this.onFocusOutDropdownDivWrapper_=null),this.onFocusOutWidgetDivWrapper_&&(e.browserEvents.unbind(this.onFocusOutWidgetDivWrapper_),this.onFocusOutWidgetDivWrapper_=null),this.eventListenerWrapper_&&(this.workspace_.removeChangeListener(this.eventListenerWrapper_),this.eventListenerWrapper_=null),this.eventListenerAllWrapper_&&(e.Workspace.getAll().forEach(e=>{e.removeChangeListener(this.eventListenerAllWrapper_)}),this.eventListenerAllWrapper_=null),t||(w(),this.useCopyPasteMenu_&&(e.ContextMenuRegistry.registry.unregister("blockCopyToStorage"),e.ContextMenuRegistry.registry.unregister("blockPasteFromStorage")),e.ContextMenuRegistry.registry.unregister("workspaceSelectAll"),e.ContextMenuRegistry.registry.unregister("copy_to_backpack"),function(){const t={blockDuplicate:e.ContextMenuItems.registerDuplicate,blockComment:e.ContextMenuItems.registerComment,blockInline:e.ContextMenuItems.registerInline,blockCollapseExpand:e.ContextMenuItems.registerCollapseExpandBlock,blockDisable:e.ContextMenuItems.registerDisable,blockDelete:e.ContextMenuItems.registerDelete,commentDelete:e.ContextMenuItems.registerCommentDelete,commentDuplicate:e.ContextMenuItems.registerCommentDuplicate};for(const e of u)t[e]()}(),A(),e.ShortcutRegistry.registry.unregister("selectall"),function(){const t={[e.ShortcutItems.names.DELETE]:e.ShortcutItems.registerDelete,[e.ShortcutItems.names.COPY]:e.ShortcutItems.registerCopy,[e.ShortcutItems.names.CUT]:e.ShortcutItems.registerCut,[e.ShortcutItems.names.PASTE]:e.ShortcutItems.registerPaste};for(const e of d)t[e]()}()),this.controls_&&(r.delete(this.controls_),this.controls_.dispose(),this.controls_=null),this.useDoubleClick_(!1),this.origBumpNeighbours&&(e.BlockSvg.prototype.bumpNeighbours=this.origBumpNeighbours)}useDoubleClick_(t){e.Gesture.prototype.handleWsStart=t?function(t){if(t.isWrapped)return t;const n=function(n,i){if(t.call(this,n,i),this.targetBlock&&1===n.buttons&&!o.get(i)){const t=function(e){return!e.isInFlyout&&e.isMovable()&&e.workspace.options.collapse},o=e.getSelected(),r=function(e,s){e&&t(e)&&!p(e)&&e.setCollapsed(s)};if(i.doubleClickPid_&&!n.target.closest(".blocklyIconGroup"))if(clearTimeout(i.doubleClickPid_),i.doubleClickPid_=void 0,o&&o instanceof e.BlockSvg&&t(o)){if(o.id===i.doubleClickBlock_){const t=!o.isCollapsed();return e.Events.setGroup(!0),o&&r(o,t),void e.Events.setGroup(!1)}}else if(o&&o instanceof m){const t=s.get(i);if(t.size){let s=0;t.forEach(e=>{i.getBlockById(e)&&(i.getBlockById(e).isCollapsed()||p(i.getBlockById(e))||(s+=1))});let n=!1;return s>0&&(n=!0),e.Events.setGroup(!0),t.forEach(function(e){const t=i.getBlockById(e);t&&r(t,n)}),void e.Events.setGroup(!1)}}i.doubleClickPid_||(i.doubleClickBlock_=o.id,i.doubleClickPid_=setTimeout(function(){i.doubleClickPid_=void 0},500))}};return n.isWrapped=!0,n}(e.Gesture.prototype.handleWsStart):this.origHandleWsStart_}eventListener_(t){if(this.multiFieldUpdate_&&this.dragSelection_.has(t.blockId)&&(t.type===e.Events.CHANGE&&"field"===t.element&&t.recordUndo||t.type===e.Events.BLOCK_FIELD_INTERMEDIATE_CHANGE)){if(this.multiFieldUpdateGroup_!==t.group&&(this.multiFieldUpdateGroup_=t.group,this.multiFieldUpdateSourceBlockId_=t.blockId),t.blockId!==this.multiFieldUpdateSourceBlockId_)return;const s=e.Events.getGroup();s||(e.Events.setGroup(t.group),t.group=e.Events.getGroup());try{const e=this.workspace_.getBlockById(t.blockId).type;this.dragSelection_.forEach(s=>{if(s===t.blockId)return;const n=this.workspace_.getBlockById(s);n&&n.type===e&&n.setFieldValue(t.newValue,t.name)})}catch(e){console.warn(e)}finally{e.Events.setGroup(s)}}}eventListenerAll_(t){t.type===e.Events.SELECTED&&r.forEach(e=>{e.updateMultiselect()})}onKeyDown_(e){this.multiSelectKeys_.indexOf(e.key.toLocaleLowerCase())>-1&&!o.get(this.workspace_)&&this.controls_.enableMultiselect()}unbindMultiselectCopyPaste_(e){this.workspace_.keyboardAccessibilityMode&&this.registeredShortcut_?(B(),this.registeredShortcut_=!1):this.workspace_.keyboardAccessibilityMode||this.registeredShortcut_||(R(),this.registeredShortcut_=!0)}onKeyUp_(e){this.multiSelectKeys_.indexOf(e.key.toLocaleLowerCase())>-1&&this.controls_.disableMultiselect()}onBlur_(t){if(o.get(this.workspace_)){t.relatedTarget&&("INPUT"===t.relatedTarget.tagName||"TEXTAREA"===t.relatedTarget.tagName||"DIV"===t.relatedTarget.tagName&&t.relatedTarget.classList.value.indexOf("blocklyDropdownMenu")>-1)&&this.controls_.revertLastUnselectedBlock();const s=this.workspace_.getInjectionDiv(),n=e.DropDownDiv.getContentDiv(),i=e.WidgetDiv.getDiv();if(t.relatedTarget&&(s.contains(t.relatedTarget)||n.contains(t.relatedTarget)||i?.contains(t.relatedTarget)))return;this.controls_.disableMultiselect()}}}})(),i})());
-//# sourceMappingURL=workspace-multiselect-pr134-c630b72.min.js.map
\ No newline at end of file
+!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],t);else{var s="object"==typeof exports?t(require("blockly/core")):t(e.Blockly);for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(this,e=>(()=>{var t={28:function(e){e.exports=function(){"use strict";function e(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)}return s}function t(t){for(var s=1;se.length)&&(t=e.length);for(var s=0,n=new Array(t);s1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},k=function(e,t){var s=t;window.addEventListener("resize",s),window.addEventListener("scroll",s);var n=new MutationObserver(s);return e.forEach(function(e,t){n.observe(e,{childList:0!==t,attributes:!0})}),{observer:n,callback:s,cleanup:function(){return N(n,s)}}},C=function(e,t){var s;return function(){for(var n=arguments.length,i=new Array(n),o=0;o1&&void 0!==arguments[1]?arguments[1]:0,i=null===(s=t[n])||void 0===s?void 0:s.parentNode;return i?(t.push(i),e(t,++n)):t}([e])},I=function(e,t){var s={top:Number.POSITIVE_INFINITY,left:Number.POSITIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,right:Number.NEGATIVE_INFINITY,width:Number.NEGATIVE_INFINITY,height:Number.NEGATIVE_INFINITY};return z(e).forEach(function(e){var n=t.getRect(e);s.top=Math.min(s.top,n.top),s.left=Math.min(s.left,n.left),s.bottom=Math.max(s.bottom,n.bottom),s.right=Math.max(s.right,n.right)}),s.height=s.bottom-s.top,s.width=s.right-s.left,s},w=function(e){return!e||e instanceof Document?E():{x:e.scrollLeft>=0?e.scrollLeft:E().x,y:e.scrollTop>=0?e.scrollTop:E().y}},T=function(e){var t=e.elementRect,s=e.containerRect,n=e.tolerance,i=void 0===n?{x:0,y:0}:n,o=[];return t.top-i.ys.bottom&&o.push("bottom"),t.right+i.y>s.right&&o.push("right"),o},L=function(e){var t={x:0,y:0},s=window.getComputedStyle(e);if(!s.transform||"none"===s.transform)return t;if(s.transform.indexOf("3d")>=0){var n=s.transform.trim().match(/matrix3d\((.*?)\)/);if(n&&n.length){var i,o=null===(i=n[1])||void 0===i?void 0:i.split(",");t.x=parseInt(o[12])||0,t.y=parseInt(o[13])||0}return t}var r=s.transform.trim().match(/matrix\((.*?)\)/);if(r&&r.length){var c,l=null===(c=r[1])||void 0===c?void 0:c.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},P=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return L(e);var s={x:0,y:0},n=t.trim().match(/translate[3dD]*?\(.*?\)/);if(n){var i,o=null===(i=n[0])||void 0===i?void 0:i.split("(");if(o){var r,c=null===(r=o[1])||void 0===r?void 0:r.split(",");s.x=parseInt(c[0])||0,s.y=parseInt(c[1])||0}}return s.x||s.x?s:L(e)}(e):function(e){var t=e.style,s={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!s.x&&!s.x){var n=window.getComputedStyle(e);return{x:parseInt(n.left)||0,y:parseInt(n.top)||0}}return s}(e)},x=function(e){var t=e.computedStyle,s=e.node,n=t.position;s instanceof Document||"absolute"===n||"relative"===n||"fixed"===n||(s.style.position="relative")},A=function(e,t,s){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},B=function(e,t,s,n){if(void 0===t)return s?o({},e,n):{};if(null===t)return o({},e,null);var i=!0,r=!1,c="string"==typeof n;c&&(i="string"==typeof t||t instanceof String),c&&!i&&(r=!0,A(e,"string"));var l=!Number.isNaN(n)&&"number"==typeof n;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(r=!0,A(e,"number"));var a="[object Object]"===Object.prototype.toString.call(n);a&&(i="[object Object]"===Object.prototype.toString.call(t)),a&&!i&&(r=!0,A(e,"object"));var u="boolean"==typeof n;u&&(i="boolean"==typeof t),u&&!i&&(r=!0,A(e,"boolean"));var d=Array.isArray(n);d&&(i=Array.isArray(t)),d&&!i&&(r=!0,A(e,"array"));var h=r||s;return"dragKeys"===e&&i?o({},e,Object.assign(n,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map(function(e){return e.id})).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?o({},e,t):h?o({},e,n):{}):h?o({},e,n):{}},R=function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e;if(s>0){var i=(e.right-e.left)*s,o=(e.bottom-e.top)*s;n={left:e.left+i,right:e.right-i,top:e.top+o,bottom:e.bottom-o}}return n.leftt.left&&n.topt.top},O=function(e){var t=e.element,s=e.posDirection,n=e.containerRect,i=e.useTransform,o=P(t,i),r=v(o,"+",s);K(t,r,i);var c=t.getBoundingClientRect();!function(e){var t=e.element,s=e.edges,n=e.elementRect,i=e.containerRect,o=e.elementPos,r=e.useTransform;s.includes("top")&&K(t,{y:o.y+i.top-n.top,x:o.x},r),s.includes("left")&&K(t,{y:o.y,x:o.x+i.left-n.left},r),s.includes("bottom")&&K(t,{y:o.y+i.bottom-n.bottom,x:o.x},r),s.includes("right")&&K(t,{y:o.y,x:o.x+i.right-n.right},r)}({element:t,edges:T({elementRect:c,containerRect:n}),elementRect:c,containerRect:n,elementPos:r,useTransform:i})},N=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},K=function(e,t,s){if(s){var n=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(n.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:f(new Set(f(e))):[]},W=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},V=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"DS",void 0),o(this,"_observers",void 0),o(this,"_node",void 0),o(this,"_parentNodes",void 0),o(this,"_computedStyle",void 0),o(this,"_computedBorder",void 0),o(this,"_rect",void 0),o(this,"setArea",function(e){n.reset(),n._node=e,x({computedStyle:n.computedStyle,node:n._node}),setTimeout(function(){n.DS.PubSub.publish("Area:modified:pre",{item:n}),n.reset(),n.DS.PubSub.publish("Area:modified",{item:n})})}),o(this,"start",function(){n._observers=k(n.parentNodes,C(function(e){n.DS.PubSub.publish("Area:modified:pre",{event:e,item:n}),n.reset(),n.DS.PubSub.publish("Area:modified",{event:e,item:n})},60))}),o(this,"reset",function(){n._computedStyle=void 0,n._rect=void 0,n._computedBorder=void 0,n._parentNodes=void 0}),o(this,"stop",function(){n._observers.cleanup(),n.reset()}),o(this,"scroll",function(e,t){var s={scroll_directions:e,scroll_multiplier:t};n.DS.PubSub.publish("Area:scroll:pre",s),function(e,t,s){if(t.length){var n=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,i=e instanceof Document?n||document.body:e,o=t.includes("top")&&i.scrollTop>0,r=t.includes("bottom")&&i.scrollTop0,l=t.includes("right")&&i.scrollLeft0&&(e.y=Math.min(e.y,i.bottom)),e.x>0&&(e.x=Math.min(e.x,i.right)),n._selectionRect.top+=e.y,n._selectionRect.bottom+=e.y,n._selectionRect.left+=e.x,n._selectionRect.right+=e.x),e}),o(this,"handleZIndex",function(e){n._elements.forEach(function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)})}),this.DS=i,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return i(e,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?v(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?v(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),e}(),F=function(){function e(t){var n=this,i=t.DS,r=t.id,c=t.element,l=t.droppables;s(this,e),o(this,"id",void 0),o(this,"element",void 0),o(this,"_droppables",void 0),o(this,"_rect",void 0),o(this,"_observers",void 0),o(this,"_timeout",void 0),o(this,"_itemsDropped",[]),o(this,"_itemsInside",void 0),o(this,"setReadyClasses",function(e){if(!n.isDestroyed){var t=n.droppables.filter(function(e){return n.DS.SelectedSet.has(e)});t.length&&(t.forEach(function(t){t.classList[e]("".concat(n.Settings.droppableClass)),t.classList[e]("".concat(n.Settings.droppableClass,"-").concat(n.id))}),n.element.classList[e]("".concat(n.Settings.dropZoneReadyClass)))}}),o(this,"handleNoDrop",function(){var e;n.isDestroyed||(n.DS.SelectedSet.forEach(function(e){e.classList.remove(n.Settings.droppedTargetClass),e.classList.remove("".concat(n.Settings.droppedTargetClass,"-").concat(n.id))}),n._itemsDropped=n._itemsDropped.filter(function(e){return!n.DS.SelectedSet.has(e)}),null!==(e=n._itemsDropped)&&void 0!==e&&e.length||n.element.classList.remove("".concat(n.Settings.dropZoneTargetClass)))}),o(this,"handleDrop",function(){var e,t,s;n.isDestroyed||(n._itemsDropped=f(new Set([].concat(f(n._itemsDropped),f(null===(e=n.droppables)||void 0===e?void 0:e.filter(function(e){return n.DS.SelectedSet.has(e)}))))),null===(t=n._itemsDropped)||void 0===t||t.forEach(function(e){e.classList.add("".concat(n.Settings.droppedTargetClass)),e.classList.add("".concat(n.Settings.droppedTargetClass,"-").concat(n.id))}),null!==(s=n._itemsDropped)&&void 0!==s&&s.length&&n.element.classList.add("".concat(n.Settings.dropZoneTargetClass)))}),o(this,"handleItemsInsideClasses",function(){var e=!1;n.droppables.forEach(function(t){n.itemsInside.includes(t)?(t.classList.add("".concat(n.Settings.droppedInsideClass)),t.classList.add("".concat(n.Settings.droppedInsideClass,"-").concat(n.id)),e=!0):(t.classList.remove("".concat(n.Settings.droppedInsideClass,"-").concat(n.id)),t.className.includes("".concat(n.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(n.Settings.droppedInsideClass)))}),e?n.element.classList.add("".concat(n.Settings.dropZoneInsideClass)):n.element.classList.remove("".concat(n.Settings.dropZoneInsideClass))}),o(this,"start",function(e){e.isDragging&&!n.isDestroyed&&n.setReadyClasses("add")}),o(this,"stop",function(e){e.isDragging&&!n.isDestroyed&&(n.setReadyClasses("remove"),n.handleItemsInsideClasses())}),o(this,"toObject",function(){return{id:n.id,element:n.element,droppables:n.droppables,itemsDropped:n.itemsDropped,itemsInside:n.itemsInside}}),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.id=r,this.element=c,l&&(this.droppables=z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",function(e){var t=e.settings;n.element&&(n.element.classList.remove(t["dropZoneClass:pre"]),n.element.classList.add(t.dropZoneClass))}),this._observers=k(this.parentNodes,C(function(){return n._rect=null},this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return i(e,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach(function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))}),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap(function(t){return R(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]}),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){return e._itemsInside=null},this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=M(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),e}(),U=i(function e(n){var i=this,r=n.DS;s(this,e),o(this,"_zoneByElement",new Map),o(this,"_zoneById",new Map),o(this,"_zonesByDroppable",new Map),o(this,"_zones",void 0),o(this,"setDropZones",function(e){var s=e.dropZones;s&&(i._zones&&i._zones.forEach(function(e){return e.destroy()}),i._zones=s.map(function(e){return new F(t({DS:i.DS},e))}),i._zones.forEach(function(e){i._zoneByElement.set(e.element,e),i._zoneById.set(e.id,e),e.droppables.forEach(function(t){var s=i._zonesByDroppable.get(t);if(null==s||!s.length)return i._zonesByDroppable.set(t,[e]);i._zonesByDroppable.set(t,f(new Set([].concat(f(s),[e]))))})}))}),o(this,"_handleDrop",function(e){i._zones.forEach(function(t){t!==e&&t.handleNoDrop()}),e&&e.handleDrop()}),o(this,"_getZoneByElementsFromPoint",function(e,t){for(var s=t.x,n=t.y,o=0,r=e.length;o0)){var s=n.DS,i=s.stores,o=i.PointerStore,r=i.KeyStore,c=s.SelectableSet,l=s.SelectedSet;o.start(t);var a=t.target;c.has(a)&&(r.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(a),n.reset())}}),o(this,"stop",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DS.Area.HTMLNode;n.isInteracting=!1,n.isDragging=!1,n.Settings.usePointerEvents?(e.removeEventListener("pointerdown",n.start,{passive:!1}),document.removeEventListener("pointerup",n.reset),document.removeEventListener("pointercancel",n.reset)):(e.removeEventListener("mousedown",n.start),document.removeEventListener("mouseup",n.reset)),e.removeEventListener("touchstart",n.start,{passive:!1}),document.removeEventListener("touchend",n.reset)}),o(this,"update",function(e){var t=e.event,s=e.scroll_directions,i=e.scroll_multiplier;n.isInteracting&&n.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:s,scroll_multiplier:i,isDragging:n.isDragging})}),o(this,"reset",function(e){return n.DS.publish("Interaction:end:pre",{event:e,isDragging:n.isDragging})}),o(this,"_reset",function(e){var t=n.isDragging;n.stop(),n.init(),n.DS.publish("Interaction:end",{event:e,isDragging:t})}),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",function(e){var t=e.settings;n.stop(t["area:pre"]),n.init()}),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",function(e){var t=e.event;return n.start(t)}),this.DS.subscribe("Interaction:start:pre",function(e){var t=e.event;return n._start(t)}),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",function(e){var t=e.event;return n._reset(t)}),this.DS.subscribe("Area:scroll",this.update)}return i(e,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),e}(),H=i(function e(t){var n=this,i=t.DS;s(this,e),o(this,"subscribers",{}),o(this,"subscribe",function(e,t){return Array.isArray(n.subscribers[e])||(n.subscribers[e]=[]),n.subscribers[e].push(t),n.subscribers[e].length-1}),o(this,"unsubscribe",function(e,t,s){s>=0?n.subscribers[e].splice(s,1):t&&(n.subscribers[e]=n.subscribers[e].filter(function(e){return e!==t}))}),o(this,"publish",function(e,t){Array.isArray(e)?e.forEach(function(e){return n._publish(e,t)}):n._publish(e,t)}),o(this,"_publish",function(e,t){var s=n.subscribers[e];Array.isArray(s)&&(e.includes(":pre")?n._handlePrePublish(s,t):n._handlePublish(s,t))}),o(this,"_handlePublish",function(e,t){for(var s=0,i=e.length;s=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,r=!0,c=!1;return{s:function(){s=s.call(e)},n:function(){var e=s.next();return r=e.done,e},e:function(e){c=!0,o=e},f:function(){try{r||null==s.return||s.return()}finally{if(c)throw o}}}}(u);try{for(p.s();!(s=p.n()).done;){var f=S(s.value,2),y=f[0],m=f[1];r.isInside(y,m)&&(R(m,d,a)?h.set(y,m):g.set(y,m))}}catch(e){p.e(e)}finally{p.f()}if(!n.DS.continue){var v=n.filterSelected({select:h,unselect:g,selectorRect:d}),_=v.select,D=v.unselect;_.forEach(function(t,s){return function(e){var t=e.element,s=e.force,n=e.multiSelectionToggle,i=e.SelectedSet,o=e.hoverClassName;t.classList.contains(o)&&!s||(i.has(t)?n&&i.delete(t):i.add(t),t.classList.add(o))}({element:s,force:e,multiSelectionToggle:l,SelectedSet:n.DS.SelectedSet,hoverClassName:n.Settings.hoverClass})}),D.forEach(function(t,s){return function(e){var t=e.element,s=e.force,n=e.SelectedSet,i=e.PrevSelectedSet,o=e.hoverClassName;if(!t.classList.contains(o)&&!s)return!1;var r=n.has(t),c=i.has(t);r&&!c?n.delete(t):!r&&c&&n.add(t),t.classList.remove(o)}({element:s,force:e,SelectedSet:n.DS.SelectedSet,hoverClassName:n.Settings.hoverClass,PrevSelectedSet:n._prevSelectedSet})})}}),o(this,"filterSelected",function(e){var t=e.select,s=e.unselect;return e.selectorRect,{select:t,unselect:s}}),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return i(e,[{key:"_storePrevious",value:function(e){var t=this.DS,s=t.stores.KeyStore,n=t.SelectedSet;s.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(n):this._prevSelectedSet=new Set}}]),e}(),J=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_rect",void 0),o(this,"attachSelector",function(){var e,t,s,i;n.HTMLNode&&null!==(e=n.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&n.DS.SelectorArea.HTMLNode.removeChild(n.HTMLNode),n.HTMLNode=n.DS.stores.SettingsStore.s.selector||(s=n.DS.stores.SettingsStore.s.customStyles,(i=document.createElement("div")).style.position="absolute",s||(i.style.background="rgba(0, 175, 255, 0.2)",i.style.border="1px solid rgba(0, 175, 255, 0.8)",i.style.display="none",i.style.pointerEvents="none"),i),n.HTMLNode.classList.add(n.DS.stores.SettingsStore.s.selectorClass),n.HTMLNode&&null!==(t=n.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&n.DS.SelectorArea.HTMLNode.appendChild(n.HTMLNode)}),o(this,"start",function(e){if(!e.isDragging){var t=n.DS.stores.PointerStore.initialValArea;W(n.HTMLNode,D(t,1)),n.HTMLNode.style.display="block",n._rect=null}}),o(this,"stop",function(){n.HTMLNode.style.width="0",n.HTMLNode.style.height="0",n.HTMLNode.style.display="none"}),o(this,"update",function(e){if(!e.isDragging&&!n.DS.continue){var t=n.DS.stores,s=t.ScrollStore,i=t.PointerStore,o=function(e){var t=e.scrollAmount,s=e.initialPointerPos,n=e.pointerPos,i={};return n.x>s.x-t.x?(i.left=s.x-t.x,i.width=n.x-s.x+t.x):(i.left=n.x,i.width=s.x-n.x-t.x),n.y>s.y-t.y?(i.top=s.y-t.y,i.height=n.y-s.y+t.y):(i.top=n.y,i.height=s.y-n.y-t.y),i}({scrollAmount:s.scrollAmount,initialPointerPos:i.initialValArea,pointerPos:i.currentValArea});W(n.HTMLNode,o),n._rect=null}}),this.DS=i,this.DS.subscribe("Settings:updated:selectorClass",function(e){var t=e.settings;n.HTMLNode.classList.remove(t["selectorClass:pre"]),n.HTMLNode.classList.add(t.selectorClass)}),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.DS.subscribe("Settings:updated:customStyles",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return i(e,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),q=function(){function e(t){var n,i=this,r=t.DS;s(this,e),o(this,"_scrollInterval",void 0),o(this,"_rect",void 0),o(this,"currentEdges",[]),o(this,"start",function(){i.applyElements("append"),i.updatePos()}),o(this,"applyElements",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",s="".concat(e,"Child");i.HTMLNode[s](i.DS.Selector.HTMLNode),document[t][s](i.HTMLNode)}),o(this,"updatePos",function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,s=i.HTMLNode.style,n="".concat(e.top+t.top,"px"),o="".concat(e.left+t.left,"px"),r="".concat(e.width,"px"),c="".concat(e.height,"px");s.top!==n&&(s.top=n),s.left!==o&&(s.left=o),s.width!==r&&(s.width=r),s.height!==c&&(s.height=c)}),o(this,"stop",function(e){i.stopAutoScroll(),e&&i.applyElements("remove")}),o(this,"startAutoScroll",function(){i.currentEdges=[],i._scrollInterval=setInterval(function(){return i.handleAutoScroll()},16)}),o(this,"handleAutoScroll",function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,s=e.Area;i.currentEdges=T({elementRect:D(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&s.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}}),o(this,"stopAutoScroll",function(){i.currentEdges=[],clearInterval(i._scrollInterval)}),o(this,"isInside",function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||R(i.rect,t||e.getBoundingClientRect())}),this.DS=r,this.HTMLNode=((n=document.createElement("div")).style.position="fixed",n.style.overflow="hidden",n.style.pointerEvents="none",n.style.zIndex="999999999999999999",n),this.DS.subscribe("Settings:updated:selectorAreaClass",function(e){var t=e.settings;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.HTMLNode.classList.add(t.selectorAreaClass)}),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",function(){i.updatePos(),i.stopAutoScroll()})}return i(e,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,s=e?t.getPointerPosition(e):t.initialVal;return R({left:s.x,top:s.y,right:s.x,bottom:s.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),e}(),$=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_currentValues",new Set),o(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),o(this,"init",function(){document.addEventListener("keydown",n.keydown),document.addEventListener("keyup",n.keyup),window.addEventListener("blur",n.reset)}),o(this,"keydown",function(e){var t=e.key.toLowerCase();n.DS.publish("KeyStore:down:pre",{event:e,key:t}),n._currentValues.add(t),n.DS.publish("KeyStore:down",{event:e,key:t})}),o(this,"keyup",function(e){var t=e.key.toLowerCase();n.DS.publish("KeyStore:up:pre",{event:e,key:t}),n._currentValues.delete(t),n.DS.publish("KeyStore:up",{event:e,key:t})}),o(this,"stop",function(){document.removeEventListener("keydown",n.keydown),document.removeEventListener("keyup",n.reset),window.removeEventListener("blur",n.reset),n.reset()}),o(this,"reset",function(){return n._currentValues.clear()}),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return i(e,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var s=this.DS.stores.SettingsStore.s.multiSelectKeys.map(function(e){return e.toLocaleLowerCase()});return!!this.currentValues.some(function(e){return s.includes(e.toLocaleLowerCase())})||!(!e||!s.some(function(s){return e[t._keyMapping[s]]}))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),e}(),Q=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_isMouseInteraction",!1),o(this,"_initialValArea",void 0),o(this,"_currentValArea",void 0),o(this,"_lastValArea",void 0),o(this,"_initialVal",void 0),o(this,"_currentVal",void 0),o(this,"_lastVal",void 0),o(this,"_lastTouch",void 0),o(this,"init",function(){n.Settings.usePointerEvents?document.addEventListener("pointermove",n.update,{passive:!1}):document.addEventListener("mousemove",n.update),document.addEventListener("touchmove",n.update,{passive:!1})}),o(this,"getPointerPosition",function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:n._normalizedEvent(e)})}),o(this,"update",function(e){e&&(n.DS.publish("PointerStore:updated:pre",{event:e}),n.currentVal=n.getPointerPosition(e),n._isMouseInteraction&&n.DS.publish("PointerStore:updated",{event:e}))}),o(this,"stop",function(){n.Settings.usePointerEvents?document.removeEventListener("pointermove",n.update,{passive:!1}):document.removeEventListener("mousemove",n.update),document.removeEventListener("touchmove",n.update,{passive:!1}),setTimeout(function(){return n._isMouseInteraction=!1},100)}),o(this,"reset",function(e){e&&(n.currentVal=n.lastVal=n.getPointerPosition(e),n.stop(),n.init())}),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",function(e){var t=e.event;return n.start(t)}),this.DS.subscribe("Interaction:end",function(e){var t=e.event;return n.reset(t)})}return i(e,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&v(e,"-",v(_(this.DS.Area.rect),"+",_(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&v(e,"-",v(_(this.DS.Area.rect),"+",_(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&v(e,"-",v(_(this.DS.Area.rect),"+",_(this.DS.Area.computedBorder)))}}]),e}(),ee=function(){function e(t){var n=this,i=t.DS;s(this,e),o(this,"_initialVal",void 0),o(this,"_currentVal",void 0),o(this,"_canScroll",void 0),o(this,"init",function(){return n.DS.stores.SettingsStore.s.area.addEventListener("scroll",n.update)}),o(this,"start",function(){n._currentVal=n._initialVal=w(n.DS.stores.SettingsStore.s.area),n.DS.stores.SettingsStore.s.area.addEventListener("scroll",n.update)}),o(this,"update",function(){return n._currentVal=w(n.DS.stores.SettingsStore.s.area)}),o(this,"stop",function(){n.DS.stores.SettingsStore.s.area.removeEventListener("scroll",n.update),n._initialVal={x:0,y:0},n._canScroll=null}),o(this,"reset",function(){n.stop(),n.start()}),this.DS=i,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",function(){return n.start()}),this.DS.subscribe("Interaction:end",function(){return n.reset()})}return i(e,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=w(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=v(this.currentVal,"-",this.initialVal),s={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},n=v(v(t,"*",s),"-",t);return{x:t.x+n.x,y:t.y+n.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=w(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),e}(),te=i(function e(n){var i=this,r=n.DS,c=n.settings;s(this,e),o(this,"_settings",{}),o(this,"s",{}),o(this,"update",function(e){var s=e.settings,n=e.init;return i.DS.publish("Settings:updated:pre",t({settings:s},n?{init:n}:{}))}),o(this,"_update",function(e){for(var s=function(e,s){return t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t({},B("area",e.area,s,document)),B("selectables",e.selectables,s,null)),B("autoScrollSpeed",e.autoScrollSpeed,s,5)),B("overflowTolerance",e.overflowTolerance,s,{x:25,y:25})),B("zoom",e.zoom,s,1)),B("customStyles",e.customStyles,s,!1)),B("multiSelectMode",e.multiSelectMode,s,!1)),B("multiSelectToggling",e.multiSelectToggling,s,!0)),B("multiSelectKeys",e.multiSelectKeys,s,["Control","Shift","Meta"])),B("selector",e.selector,s,null)),B("selectionThreshold",e.selectionThreshold,s,0)),B("draggability",e.draggability,s,!0)),B("immediateDrag",e.immediateDrag,s,!0)),B("keyboardDrag",e.keyboardDrag,s,!0)),B("dragKeys",e.dragKeys,s,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),B("keyboardDragSpeed",e.keyboardDragSpeed,s,10)),B("useTransform",e.useTransform,s,!0)),B("refreshMemoryRate",e.refreshMemoryRate,s,80)),B("dropZones",e.dropZones,s,[])),B("dropInsideThreshold",e.dropInsideThreshold,s,1)),B("dropTargetThreshold",e.dropTargetThreshold,s,0)),B("usePointerEvents",e.usePointerEvents,s,!1)),B("hoverClass",e.hoverClass,s,"ds-hover")),B("selectableClass",e.selectableClass,s,"ds-selectable")),B("selectedClass",e.selectedClass,s,"ds-selected")),B("selectorClass",e.selectorClass,s,"ds-selector")),B("selectorAreaClass",e.selectorAreaClass,s,"ds-selector-area")),B("droppedTargetClass",e.droppedTargetClass,s,"ds-dropped-target")),B("droppedInsideClass",e.droppedInsideClass,s,"ds-dropped-inside")),B("droppableClass",e.droppableClass,s,"ds-droppable")),B("dropZoneClass",e.dropZoneClass,s,"ds-dropzone")),B("dropZoneReadyClass",e.dropZoneReadyClass,s,"ds-dropzone-ready")),B("dropZoneTargetClass",e.dropZoneTargetClass,s,"ds-dropzone-target")),B("dropZoneInsideClass",e.dropZoneInsideClass,s,"ds-dropzone-inside")),B("dragAsBlock",e.dragAsBlock,s,!1))}(e.settings,e.init),n=function(){var e,t=S(c[r],2),s=t[0],n=t[1];s in i._settings||Object.defineProperty(i.s,s,{get:function(){return i._settings[s]},set:function(e){return i.update({settings:o({},s,e)})}}),i._settings["".concat(s,":pre")]=i._settings[s],i._settings[s]=n;var l={settings:(e={},o(e,s,i._settings[s]),o(e,"".concat(s,":pre"),i._settings["".concat(s,":pre")]),e)};i.DS.publish("Settings:updated",l),i.DS.publish("Settings:updated:".concat(s),l)},r=0,c=Object.entries(s);r0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(z(e)),s||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(z(e)),s&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return z(e).forEach(function(i){return t.SelectedSet.has(i)?t.removeSelection(e,s,n):t.addSelection(e,s,n)}),s&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,s),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,s){var n=z(e);return this.SelectableSet.addAll(n),t&&this.SelectedSet.addAll(n),s&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,s)}},{key:"removeSelectables",value:function(e,t,s){return this.SelectableSet.deleteAll(z(e)),t&&this.removeSelection(e),s&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),e}();return se.isCollision=R,se}()},370:t=>{"use strict";t.exports=e}},s={};function n(e){var i=s[e];if(void 0!==i)return i.exports;var o=s[e]={exports:{}};return t[e].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{Multiselect:()=>z,dragSelectionWeakMap:()=>s,inMultipleSelectionModeWeakMap:()=>o});var e=n(370);const t=new WeakMap,s=new WeakMap,o=new WeakMap,r=new Set,c=new Set,l=new WeakMap,a=[],u=[],d=[];let h=0;const g=Object.freeze({MULTIDELETE:"multiselectDelete",MULTICOPY:"multiselectCopy",MULTICUT:"multiselectCut",MULTIPASTE:"multiselectPaste"}),p=function(e,t=!1){for(;e;)if((e=t?e.getParent():e.getSurroundParent())&&s.get(e.workspace).has(e.id))return!0;return!1},S=function(e,t){return e.getBlockById(t)?e.getBlockById(t):e.getCommentById(t)?e.getCommentById(t):null},f=function(){const e=[];c.forEach(t=>{delete t.source,e.push(t)}),h=Date.now(),localStorage.setItem("blocklyStashMulti",JSON.stringify(e)),localStorage.setItem("blocklyStashConnection",JSON.stringify(a)),localStorage.setItem("blocklyStashTime",h)},b=function(){const e=JSON.parse(localStorage.getItem("blocklyStashMulti")),t=JSON.parse(localStorage.getItem("blocklyStashConnection")),s=localStorage.getItem("blocklyStashTime");e&&parseInt(s)>h&&(h=s,c.clear(),e.forEach(e=>{c.add(e)}),a.length=0,t.forEach(e=>{a.push(e)}))},y=function(e){if(!e)return c.size;const t=JSON.parse(localStorage.getItem("blocklyStashMulti")),s=localStorage.getItem("blocklyStashTime");return t&&parseInt(s)>h?t.length:c.size};class m{constructor(t){this.workspace=t,this.id=e.utils.idGenerator.genUid(),this.subDraggables=new Map,this.topSubDraggables=[],this.loc=new e.utils.Coordinate(0,0),this.connectionDBList=[],this.dragSelection=s.get(t)}clearAll_(){for(const[e]of this.subDraggables)e.unselect(),this.removeSubDraggable_(e)}addSubDraggable_(e){e instanceof m||this.addPointerDownEventListener_(e),this.subDraggables.set(e,e.getRelativeToSurfaceXY())}removeSubDraggable_(e){e instanceof m||this.removePointerDownEventListener_(e),this.subDraggables.delete(e)}addPointerDownEventListener_(t){const s=t instanceof e.BlockSvg?this.pointerDownEventHandlerCapture_.bind(this):null,n=this.pointerDownEventHandler_.bind(this);t.pointerDownHandlerCapture=s,t.pointerDownHandler=n,s&&t.getSvgRoot().addEventListener("pointerdown",s,!0),t.getSvgRoot().addEventListener("pointerdown",n)}removePointerDownEventListener_(e){if(e){const t=e.pointerDownHandlerCapture,s=e.pointerDownHandler;t&&(e.getSvgRoot().removeEventListener("pointerdown",t,!0),delete e.pointerDownHandlerCapture),s&&(e.getSvgRoot().removeEventListener("pointerdown",s),delete e.pointerDownHandler)}}pointerDownEventHandlerCapture_(e){if(!o.get(this.workspace)){const t=this.workspace.getBlockById(e.target.closest("[data-id]").getAttribute("data-id"));this.subDraggables.has(t)||(this.clearAll_(),this.dragSelection.clear())}}pointerDownEventHandler_(t){o.get(this.workspace)||e.common.setSelected(this)}isMovable(){return!o.get(this.workspace)}getRelativeToSurfaceXY(){return this.loc}startDrag(t){this.inGroup=!!e.Events.getGroup(),this.inGroup||e.Events.setGroup(!0);for(const t of this.subDraggables){if(t[0]instanceof e.BlockSvg){if(p(t[0],!0)||this.topSubDraggables.push(t[0]),!t[0].isShadow()){const e=t[0].getParent();e&&this.subDraggables.has(e)&&e.getNextBlock()===t[0]&&this.connectionDBList.push([e.nextConnection,t[0].previousConnection])}}else this.topSubDraggables.push(t[0]);this.subDraggables.set(t[0],t[0].getRelativeToSurfaceXY())}for(const e of this.topSubDraggables)e.startDrag()}drag(t,s){for(const n of this.topSubDraggables)this.subDraggables.get(n)&&this.subDraggables.get(n)instanceof e.utils.Coordinate&&n.drag(e.utils.Coordinate.sum(t,this.subDraggables.get(n)),s)}endDrag(t){const s=this.workspace.getDragTarget(t);s&&this.topSubDraggables.some(e=>s.shouldPreventMove(e))&&this.revertDrag();for(const e of this.topSubDraggables)e.endDrag(t);for(const e of this.subDraggables)e[1]=e[0].getRelativeToSurfaceXY();this.connectionDBList.forEach(function(e){e[0].connect(e[1])}),this.topSubDraggables.length=0,this.connectionDBList.length=0,this.inGroup||e.Events.setGroup(!1)}revertDrag(){for(const e of this.topSubDraggables)e.revertDrag()}select(){for(const t of this.subDraggables)t[0]instanceof e.BlockSvg&&t[0].isShadow(),t[0].select()}unselect(){}isDeletable(){return!0}dispose(){for(const t of this.subDraggables)t[0].isDeletable()&&(this.removeSubDraggable_(t[0]),this.dragSelection.delete(t[0].id),t[0]instanceof e.BlockSvg?t[0].dispose(!0,!0):t[0].dispose())}setDeleteStyle(e){for(const t of this.subDraggables)t[0].isDeletable()&&t[0].setDeleteStyle(e)}getBoundingRectangle(){if(0===this.subDraggables.size)return new e.utils.Rect(0,0,0,0);let t=1/0,s=-1/0,n=1/0,i=-1/0;return this.subDraggables.forEach((e,o)=>{const r=o.getBoundingRectangle();t=Math.min(t,r.top),s=Math.max(s,r.bottom),n=Math.min(n,r.left),i=Math.max(i,r.right)}),new e.utils.Rect(t,s,n,i)}toFlyoutInfo(){const e=[];for(const t of this.topSubDraggables)if(void 0!==t.toFlyoutInfo){const s=t.toFlyoutInfo();e.push(...s)}return e}}const v=function(){const n="blockDuplicate",i={displayText:function(t){let n=0;const o=t.block.workspace;return s.get(o).forEach(function(e){const t=o.getBlockById(e);i.check(t)&&n++}),n<=1?e.Msg.DUPLICATE_BLOCK:e.Msg.DUPLICATE_X_BLOCKS?e.Msg.DUPLICATE_X_BLOCKS.replace("%1",n):e.Msg.DUPLICATE_BLOCK+" ("+n+")"},preconditionFn:function(e){const t=e.block;return!t.isInFlyout&&t.isDeletable()&&t.isMovable()?t.isDuplicatable()?"enabled":"disabled":"hidden"},check:function(e){return e&&"enabled"===i.preconditionFn({block:e})&&!p(e)},callback:function(n){const o={},r=[],c=n.block.workspace,l=t.get(c),a=function(t){if(i.check(t)){const s=e.utils.idGenerator.genUid(),n=t.toCopyData();n.blockState.id=s,o[t.id]=e.clipboard.paste(n,c)}},u=s.get(c);e.Events.setGroup(!0),u.size?(u.forEach(function(e){const t=c.getBlockById(e);t&&(t.unselect(),p(t)||a(t))}),u.clear(),l.clearAll_(),e.common.setSelected(null)):a(n.block);for(const[e,t]of Object.entries(o)){const s=c.getBlockById(e),n=s.getParent();t.id&&(n&&n.id in o&&n.getNextBlock()===s&&r.push([o[n.id].nextConnection,t.previousConnection]),"drag_to_dupe"!==t.type&&(u.add(t.id),l.addSubDraggable_(t)))}r.forEach(function(e){e[0].connect(e[1])}),1===u.size?e.common.setSelected(S(c,u.values().next().value)):e.common.setSelected(l),e.Events.setGroup(!1)},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:n,weight:1};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)},_=function(){const t="blockComment",n={displayText:function(t){let i=0;const o=t.block.hasIcon(e.icons.CommentIcon.TYPE),r=t.block.workspace;return s.get(r).forEach(function(t){const s=r.getBlockById(t);n.check(s)&&o===s.hasIcon(e.icons.CommentIcon.TYPE)&&i++}),o?i<=1?e.Msg.REMOVE_COMMENT:e.Msg.REMOVE_X_COMMENTS?e.Msg.REMOVE_X_COMMENTS.replace("%1",i):e.Msg.REMOVE_COMMENT+" ("+i+")":i<=1?e.Msg.ADD_COMMENT:e.Msg.ADD_X_COMMENTS?e.Msg.ADD_X_COMMENTS.replace("%1",i):e.Msg.ADD_COMMENT+" ("+i+")"},preconditionFn:function(t){const s=t.block;return e.utils.userAgent.IE||s.isInFlyout||!s.workspace.options.comments||s.isCollapsed()||!s.isEditable()?"hidden":"enabled"},check:function(e){return e&&"enabled"===n.preconditionFn({block:e})},callback:function(t){const i=t.block.hasIcon(e.icons.CommentIcon.TYPE),o=function(e){n.check(e)&&(i?e.setCommentText(null):e.setCommentText(""))},r=t.block.workspace,c=s.get(r);e.Events.setGroup(!0),c.size||o(t.block),c.forEach(function(e){const t=r.getBlockById(e);t&&o(t)}),e.Events.setGroup(!1)},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:t,weight:2};null!==e.ContextMenuRegistry.registry.getItem(t)&&e.ContextMenuRegistry.registry.unregister(t),e.ContextMenuRegistry.registry.register(n)},D=function(){const t="blockInline",n={displayText:function(t){let i=0;const o=t.block.getInputsInline(),r=t.block.workspace;return s.get(r).forEach(function(e){const t=r.getBlockById(e);n.check(t)&&t.getInputsInline()===o&&i++}),o?i<=1?e.Msg.EXTERNAL_INPUTS:e.Msg.EXTERNAL_X_INPUTS?e.Msg.EXTERNAL_X_INPUTS.replace("%1",i):e.Msg.EXTERNAL_INPUTS+" ("+i+")":i<=1?e.Msg.INLINE_INPUTS:e.Msg.INLINE_X_INPUTS?e.Msg.INLINE_X_INPUTS.replace("%1",i):e.Msg.INLINE_INPUTS+" ("+i+")"},preconditionFn:function(t){const s=t.block;if(!s.isInFlyout&&s.isMovable()&&!s.isCollapsed())for(let t=1;tt.name).includes(t)&&(e.ShortcutRegistry.registry.unregister(t),d.push(t))},B=function(){d.length=0;for(const t of[g.MULTIDELETE,g.MULTICOPY,g.MULTICUT,g.MULTIPASTE])Object.entries(e.ShortcutRegistry.registry.getRegistry()).map(([e,t])=>t.name).includes(t)&&e.ShortcutRegistry.registry.unregister(t);for(const t of[e.ShortcutItems.names.DELETE,e.ShortcutItems.names.COPY,e.ShortcutItems.names.CUT,e.ShortcutItems.names.PASTE])d.push(t)},R=function(n){const i=[e.ShortcutItems.names.DELETE],o={[e.ShortcutItems.names.DELETE]:T,[e.ShortcutItems.names.COPY]:L,[e.ShortcutItems.names.CUT]:P,[e.ShortcutItems.names.PASTE]:x};for(const e of d)i.includes(e)?o[e]():o[e](n);!function(){const n="selectall",i={name:n,preconditionFn:function(e){return!!e.getTopBlocks().some(e=>i.check(e))},check:function(e){return e&&(e.isDeletable()||e.isMovable())&&!e.isInsertionMarker()},callback:function(n,o){o.preventDefault();const r=s.get(n),c=t.get(n);if(e.getSelected()){if(e.getSelected()instanceof m)for(const[t]of e.getSelected().subDraggables)t.unselect();else e.getSelected().unselect();e.common.setSelected(null),c.clearAll_(),s.get(n).clear()}const l=[];return n.getTopBlocks().forEach(function(e){if(i.check(e)){l.push(e);let t=e.getNextBlock();for(;t;)l.push(t),t=t.getNextBlock()}}),l.forEach(function(e){"drag_to_dupe"!==e.type&&(c.addSubDraggable_(e),r.add(e.id))}),e.common.setSelected(c),!0}};n in e.ShortcutRegistry.registry.getRegistry()&&e.ShortcutRegistry.registry.unregister(n),e.ShortcutRegistry.registry.register(i);const o=e.ShortcutRegistry.registry.createSerializedKey(e.utils.KeyCodes.A,[e.utils.KeyCodes.CTRL]);e.ShortcutRegistry.registry.addKeyMapping(o,i.name);const r=e.ShortcutRegistry.registry.createSerializedKey(e.utils.KeyCodes.A,[e.utils.KeyCodes.ALT]);e.ShortcutRegistry.registry.addKeyMapping(r,i.name);const c=e.ShortcutRegistry.registry.createSerializedKey(e.utils.KeyCodes.A,[e.utils.KeyCodes.META]);e.ShortcutRegistry.registry.addKeyMapping(c,i.name)}()};var O=n(28),N=n.n(O);class K{constructor(n,i,o){this.enabled_img="https://github.com/mit-cml/workspace-multiselect/raw/main/test/media/select.svg",this.disabled_img="https://github.com/mit-cml/workspace-multiselect/raw/main/test/media/unselect.svg",this.workspace_=n,this.enabled=!1,this.id="multiselectControls",this.multiSelectKeys_=o,this.onMultiselectWrapper_=null,this.multiselectGroup_=null,this.initialized_=!1,this.hasDisableWorkspaceDrag_=!1,this.justUnselectedBlock_=null,this.lastSelectedElement_=null,i&&i.enabledIcon&&(this.enabled_img=i.enabledIcon),i&&i.disabledIcon&&(this.disabled_img=i.disabledIcon),this.dragSelection=s.get(n),this.multiDraggable=t.get(n),this.origHandleBlockStart=e.Gesture.prototype.handleBlockStart}createDom(){return this.svgGroup_=e.utils.dom.createSvgElement(e.utils.Svg.G,{},null),this.createMultiselectSvg_(),this.svgGroup_}init(t,s){if(!t){let t=3;"number"==typeof s&&(t=s),this.workspace_.getComponentManager().addComponent({component:this,weight:t,capabilities:[e.ComponentManager.Capability.POSITIONABLE]})}this.initialized_=!0,this.workspace_.resize(),this.multiDraggable.clearAll_()}dispose(){this.disableMultiselect(),this.workspace_.getComponentManager().removeComponent(this.id),this.svgGroup_&&e.utils.dom.removeNode(this.svgGroup_),this.onMultiselectWrapper_&&e.browserEvents.unbind(this.onMultiselectWrapper_)}getBoundingRectangle(){const t=this.top_+32,s=this.left_+32;return new e.utils.Rect(this.top_,t,this.left_,s)}position(t,s){if(!this.initialized_)return;const n=e.uiPosition.getCornerOppositeToolbox(this.workspace_,t),i=e.uiPosition.getStartPositionRect(n,new e.utils.Size(32,32),20,20,t,this.workspace_),o=n.vertical===e.uiPosition.verticalPosition.TOP?e.uiPosition.bumpDirection.DOWN:e.uiPosition.bumpDirection.UP,r=e.uiPosition.bumpPositionRect(i,20,o,s);this.top_=r.top,this.left_=r.left,this.svgGroup_&&this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}revertLastUnselectedBlock(){this.updateDraggables_(this.justUnselectedBlock_)}createMultiselectSvg_(){this.multiselectGroup_=e.utils.dom.createSvgElement(e.utils.Svg.G,{class:"blocklyMultiselect"},this.svgGroup_),e.utils.dom.createSvgElement(e.utils.Svg.IMAGE,{width:32,height:32},this.multiselectGroup_).setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",this.disabled_img),this.onMultiselectWrapper_=e.browserEvents.conditionalBind(this.multiselectGroup_,"mousedown",null,this.switchMultiselect_.bind(this))}switchMultiselect_(t){this.workspace_.markFocused(),this.enabled=!this.enabled,this.enabled?this.enableMultiselect(!0):this.disableMultiselect(!0),e.Touch.clearTouchIdentifier(),t.stopPropagation(),t.preventDefault()}updateDraggables_(t){if(t)if(t instanceof e.BlockSvg){if(!t.isDeletable()&&!t.isMovable()||t.isShadow()||"drag_to_dupe"===t.type)return;this.dragSelection.has(t.id)?(this.dragSelection.delete(t.id),this.justUnselectedBlock_=t,this.multiDraggable.removeSubDraggable_(t),t.pathObject.updateSelected(!1)):(this.dragSelection.add(t.id),this.justUnselectedBlock_=null,this.multiDraggable.addSubDraggable_(t),t.pathObject.updateSelected(!0),t.bringToFront())}else{if(!t.isMovable()&&!t.isDeletable())return;this.dragSelection.has(t.id)?(this.dragSelection.delete(t.id),this.multiDraggable.removeSubDraggable_(t),t.unselect()):(this.dragSelection.add(t.id),this.multiDraggable.addSubDraggable_(t),t.select())}}updateMultiselect(){if(o.get(this.workspace_))this.dragSelection.size>1&&e.getSelected()!==this.multiDraggable?e.common.setSelected(this.multiDraggable):1===this.dragSelection.size&&e.getSelected()!==S(this.workspace_,this.dragSelection.values().next().value)?e.common.setSelected(S(this.workspace_,this.dragSelection.values().next().value)):0===this.dragSelection.size&&null!==e.getSelected()?e.common.setSelected(null):this.lastSelectedElement_&&!l.get(this.workspace_)?(this.updateDraggables_(this.lastSelectedElement_),this.lastSelectedElement_=null,l.set(this.workspace_,!1),this.dragSelection.size>1&&e.getSelected()!==this.multiDraggable?e.common.setSelected(this.multiDraggable):1===this.dragSelection.size&&e.getSelected()!==S(this.workspace_,this.dragSelection.values().next().value)?e.common.setSelected(S(this.workspace_,this.dragSelection.values().next().value)):0===this.dragSelection.size&&null!==e.getSelected()&&e.common.setSelected(null)):this.dragSelection.size||e.getSelected()instanceof m||(e.getSelected()instanceof e.BlockSvg&&!e.getSelected().isShadow()&&e.common.setSelected(null),e.getSelected()instanceof e.BlockSvg&&(this.justUnselectedBlock_=e.getSelected()));else if(this.workspace_.id!==e.getMainWorkspace().id&&(this.multiDraggable.clearAll_(),this.dragSelection.clear()),e.getSelected()){if(e.getSelected()&&!(e.getSelected()instanceof m)&&!this.dragSelection.has(e.getSelected().id)){for(const e of this.multiDraggable.subDraggables)e[0].unselect();this.multiDraggable.clearAll_(),this.dragSelection.clear(),this.lastSelectedElement_=e.getSelected(),l.set(this.workspace_,!1)}}else{this.lastSelectedElement_=null;for(const e of this.multiDraggable.subDraggables)e[0].unselect();this.multiDraggable.clearAll_(),this.dragSelection.clear(),e.common.setSelected(null)}}enableMultiselect(e=!1){!this.hasDisableWorkspaceDrag_&&this.workspace_.options.moveOptions&&this.workspace_.options.moveOptions.drag&&(this.workspace_.options.moveOptions.drag=!1,this.hasDisableWorkspaceDrag_=!0),this.dragSelect_=new(N())({selectables:this.workspace_.getInjectionDiv().querySelectorAll("g.blocklyDraggable:not(.blocklyInsertionMarker)> path.blocklyPath, g.blocklyDraggable > rect.blocklyCommentHighlight"),area:this.workspace_.getSvgGroup(),multiselectMode:!0,draggability:!1,usePointerEvents:!0,multiSelectKeys:this.multiSelectKeys_}),this.dragSelect_.Selection.filterSelected=({selectorRect:e,select:t,unselect:s})=>{const n=t,i=s;return((e,t)=>{const s=[];for(const[n,i]of e.entries())for(const[o,r]of e.entries())if(n!==o&&N().isCollision(r,i,0)&&null!==n.parentNode&&null!==o.parentNode&&n.parentNode!==o.parentNode&&n.parentNode.contains(o.parentNode)&&N().isCollision(t,r,1)){s.push(n);break}return s})(n,e).forEach(e=>{const t=n.get(e);n.delete(e),i.set(e,t)}),{select:n,unselect:i}},this.dragSelect_.subscribe("elementselect",e=>{const t=e.item.parentElement;o.get(this.workspace_)&&t&&t.dataset&&t.dataset.id&&this.updateDraggables_(S(this.workspace_,t.dataset.id))}),this.dragSelect_.subscribe("elementunselect",e=>{const t=e.item.parentElement;o.get(this.workspace_)&&t&&t.dataset&&t.dataset.id&&this.updateDraggables_(S(this.workspace_,t.dataset.id))}),e&&document.dispatchEvent(new KeyboardEvent("keydown",{key:this.multiSelectKeys_[0]})),this.updateMultiselectIcon(!0),o.set(this.workspace_,!0)}disableMultiselect(t=!1){o.set(this.workspace_,!1),this.dragSelect_&&(t&&document.dispatchEvent(new KeyboardEvent("keyup",{key:this.multiSelectKeys_[0]})),this.dragSelect_.stop(),this.dragSelect_=null),this.dragSelection.size>1&&e.getSelected()!==this.multiDraggable?e.common.setSelected(this.multiDraggable):1===this.dragSelection.size&&e.getSelected()!==S(this.workspace_,this.dragSelection.values().next().value)?e.common.setSelected(S(this.workspace_,this.dragSelection.values().next().value)):0===this.dragSelection.size&&null!==e.getSelected()&&e.common.setSelected(null),this.hasDisableWorkspaceDrag_&&(this.workspace_.options.moveOptions.drag=!0,this.hasDisableWorkspaceDrag_=!1),this.updateMultiselectIcon(!1)}updateMultiselectIcon(t){this.multiselectGroup_&&(this.enabled=t,t?this.multiselectGroup_.firstElementChild.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",this.enabled_img):this.multiselectGroup_.firstElementChild.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",this.disabled_img))}}e.Css.register("\n.blocklyMultiselect>image, .blocklyMultiselect>svg>image {\n opacity: .4;\n}\n\n.blocklyMultiselect>image:hover, .blocklyMultiselect>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyMultiselect>image:active, .blocklyMultiselect>svg>image:active {\n opacity: .8;\n}\n");class z{constructor(n){this.workspace_=n,this.origHandleWsStart_=e.Gesture.prototype.handleWsStart,s.set(this.workspace_,new Set),t.set(this.workspace_,new m(this.workspace_)),this.dragSelection_=s.get(this.workspace_),o.set(this.workspace_,!1),this.useCopyPasteCrossTab_=!0,this.useCopyPasteMenu_=!0,this.multiFieldUpdate_=!0,this.multiSelectKeys_=["shift"],this.registeredShortcut_=!0}init(n){n.multiSelectKeys&&n.multiSelectKeys.length>0&&(this.multiSelectKeys_=n.multiSelectKeys.map(e=>e.toLocaleLowerCase()));const i=this.workspace_.getInjectionDiv(),o=e.DropDownDiv.getContentDiv(),l=e.WidgetDiv.getDiv();if(this.onKeyDownWrapper_=e.browserEvents.conditionalBind(i,"keydown",this,this.onKeyDown_),this.onKeyDownDropdownDivWrapper_=e.browserEvents.conditionalBind(o,"keydown",this,this.onKeyDown_),l&&(this.onKeyDownWidgetDivWrapper_=e.browserEvents.conditionalBind(l,"keydown",this,this.onKeyDown_)),this.onKeyUpWrapper_=e.browserEvents.conditionalBind(i,"keyup",this,this.onKeyUp_),this.onKeyUpDropdownDivWrapper_=e.browserEvents.conditionalBind(o,"keyup",this,this.onKeyUp_),l&&(this.onKeyUpWidgetDivWrapper_=e.browserEvents.conditionalBind(l,"keyup",this,this.onKeyUp_)),this.onFocusOutWrapper_=e.browserEvents.conditionalBind(i,"focusout",this,this.onBlur_),this.onFocusOutDropdownDivWrapper_=e.browserEvents.conditionalBind(o,"focusout",this,this.onBlur_),l&&(this.onFocusOutWidgetDivWrapper_=e.browserEvents.conditionalBind(l,"focusout",this,this.onBlur_)),i.addEventListener("mouseenter",()=>{!1!==n.workspaceAutoFocus&&document.activeElement!==this.workspace_.getSvgGroup().parentElement&&"input"!==document.activeElement.nodeName.toLowerCase()&&"textarea"!==document.activeElement.nodeName.toLowerCase()&&this.workspace_.getSvgGroup().parentElement.focus()}),this.eventListenerWrapper_=this.eventListener_.bind(this),this.workspace_.addChangeListener(this.eventListenerWrapper_),this.eventListenerAllWrapper_=this.eventListenerAll_.bind(this),e.Workspace.getAll().forEach(e=>{e.addChangeListener(this.eventListenerAllWrapper_)}),n.multiselectCopyPaste&&!1===n.multiselectCopyPaste.crossTab&&(this.useCopyPasteCrossTab_=!1),n.multiselectCopyPaste&&!1===n.multiselectCopyPaste.menu&&(this.useCopyPasteMenu_=!1),e.ContextMenuRegistry.registry.getItem("workspaceSelectAll")||(w(),function(n,i){n&&(function(t){const n="blockCopyToStorage",i={displayText:function(t){let n=0;const o=t.block.workspace;return s.get(o).forEach(function(e){const t=o.getBlockById(e);t&&i.check(t)&&n++}),n<=1?e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy":e.Msg.CROSS_TAB_COPY_X_BLOCKS?e.Msg.CROSS_TAB_COPY_X_BLOCKS.replace("%1",n):(e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy")+" ("+n+")"},preconditionFn:function(n){const o=n.block.workspace;if(o.options.readOnly&&!t)return"hidden";const r=e.common.getSelected(),c=s.get(o);if(void 0===c)return"hidden";if(!c.size)return i.check(r)?"enabled":"disabled";for(const e of c){const t=o.getBlockById(e);if(t&&i.check(t))return"enabled"}return"disabled"},check:function(e){return e&&e.isDeletable()&&e.isMovable()&&!p(e)},callback:function(n){const o=n.block.workspace;c.clear(),o.hideChaff();const r=[],l=function(e){i.check(e)&&(c.add(JSON.stringify(e.toCopyData())),r.push(e.id))},u=e.common.getSelected(),d=s.get(o);if(e.Events.setGroup(!0),u&&u instanceof m)for(const t of u.subDraggables)t[0]instanceof e.BlockSvg&&l(t[0]);else d.size||l(u);return a.length=0,r.forEach(function(e){const t=o.getBlockById(e),s=t.getParent();s&&-1!==r.indexOf(s.id)&&s.getNextBlock()===t&&a.push([r.indexOf(s.id),r.indexOf(t.id)])}),t&&f(),e.Events.setGroup(!1),!0},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:n,weight:0};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}(i),function(n){const i="blockPasteFromStorage",o={displayText:function(){const t=y(n);return t<=1?e.Msg.CROSS_TAB_PASTE?e.Msg.CROSS_TAB_PASTE:"Paste":e.Msg.CROSS_TAB_PASTE_X_ELEMENTS?e.Msg.CROSS_TAB_PASTE_X_ELEMENTS.replace("%1",t):(e.Msg.CROSS_TAB_PASTE?e.Msg.CROSS_TAB_PASTE:"Paste")+" ("+t+")"},preconditionFn:function(e){return e.workspace.options.readOnly?"hidden":y(n)<1?"disabled":"enabled"},callback:function(i){let o=i.workspace;const r=s.get(o);e.Events.setGroup(!0);const l=t.get(o);r.size&&(r.forEach(function(e){S(o,e).unselect()}),r.clear(),l.clearAll_());const u=[];return n&&b(),c.forEach(function(n){const i=JSON.parse(n);if(o.id!==e.getMainWorkspace().id&&(i.blockState?i.blockState.id=e.utils.idGenerator.genUid():i.commentState&&(i.commentState.id=e.utils.idGenerator.genUid())),i.source&&(o=i.source),o.isFlyout&&(o=o.targetWorkspace),i.typeCounts&&o.isCapacityAvailable(i.typeCounts)){const n=e.clipboard.paste(i,o);n&&u.push(n),"drag_to_dupe"!==n.type&&(s.get(o).add(n.id),t.get(o).addSubDraggable_(n))}else if(i.commentState){const n=e.clipboard.paste(i,o);n&&n.select(),s.get(o).add(n.id),t.get(o).addSubDraggable_(n)}}),a.forEach(function(e){u[e[0]].nextConnection.connect(u[e[1]].previousConnection)}),e.Events.setGroup(!1),1===r.size?e.common.setSelected(S(o,r.values().next().value)):e.common.setSelected(l),!0},scopeType:e.ContextMenuRegistry.ScopeType.WORKSPACE,id:i,weight:0};null!==e.ContextMenuRegistry.registry.getItem(i)&&e.ContextMenuRegistry.registry.unregister(i),e.ContextMenuRegistry.registry.register(o)}(i),function(t){const n="commentCopyToStorage",i={displayText:function(t){let n=0;const o=t.comment.workspace;return s.get(o).forEach(function(e){const t=o.getCommentById(e);t&&i.check(t)&&n++}),n<=1?e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy":e.Msg.CROSS_TAB_COPY_X_COMMENTS?e.Msg.CROSS_TAB_COMMENTS.replace("%1",n):(e.Msg.CROSS_TAB_COPY?e.Msg.CROSS_TAB_COPY:"Copy")+" ("+n+")"},preconditionFn:function(e){const n=e.comment.workspace;if(n.options.readOnly&&!t)return"hidden";const o=s.get(n);if(void 0===o)return"hidden";if(!o.size)return i.check(e.comment)?"enabled":"disabled";for(const e of o){const t=n.getCommentById(e);if(t&&i.check(t))return"enabled"}return"disabled"},check:function(e){return e&&e.isDeletable()&&e.isMovable()},callback:function(n){const o=n.comment.workspace;c.clear(),o.hideChaff();const r=function(e){i.check(e)&&c.add(JSON.stringify(e.toCopyData()))},l=e.common.getSelected(),a=s.get(o);if(e.Events.setGroup(!0),l&&l instanceof m)for(const t of l.subDraggables)t[0]instanceof e.comments.RenderedWorkspaceComment&&r(t[0]);else a.size||r(n.comment);return t&&f(),e.Events.setGroup(!1),!0},scopeType:e.ContextMenuRegistry.ScopeType.COMMENT,id:n,weight:0};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}(i));const o={blockDuplicate:v,blockComment:_,blockInline:D,blockCollapseExpand:k,blockDisable:C,blockDelete:E,commentDelete:M,commentDuplicate:I};for(const e of u)o[e]();!function(){const n="workspaceSelectAll",i={displayText:function(){return"Select all Blocks"},preconditionFn:function(e){return e.workspace.getTopBlocks().some(e=>i.check(e))?"enabled":"disabled"},check:function(e){return e&&(e.isDeletable()||e.isMovable())&&!e.isInsertionMarker()},callback:function(n){const o=t.get(n.workspace);if(e.getSelected()){if(e.getSelected()instanceof m)for(const[t]of e.getSelected().subDraggables)t.unselect();else e.getSelected().unselect();e.common.setSelected(null),o.clearAll_(),s.get(n.workspace).clear()}const r=[];n.workspace.getTopBlocks().forEach(function(e){if(i.check(e)){r.push(e);let t=e.getNextBlock();for(;t;)r.push(t),t=t.getNextBlock()}}),r.forEach(function(e){"drag_to_dupe"!==e.type&&(s.get(e.workspace).add(e.id),o.addSubDraggable_(e))}),e.common.setSelected(o)},scopeType:e.ContextMenuRegistry.ScopeType.WORKSPACE,id:n,weight:5};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}(),function(t=!1){const n="copy_to_backpack",i={getBackPack:function(e){return e.getComponentManager().getComponent("backpack")},check:function(e){if(!e)return!1;const t=e.workspace,s=i.getBackPack(t);return s&&!s.containsBlock(e)&&!p(e)},displayText:function(t){if(!t.block)return"";const n=t.block.workspace;if(!i.getBackPack(n))return"";let o=0;const r=s.get(n);r.size||i.check(t.block)&&o++;for(const e of r)i.check(n.getBlockById(e))&&o++;return o>1?e.Msg.COPY_X_TO_BACKPACK?e.Msg.COPY_X_TO_BACKPACK.replace("%1",o.toString()):e.Msg.COPY_TO_BACKPACK+` (${o})`:e.Msg.COPY_TO_BACKPACK},preconditionFn:function(e){if(!e.block)return"hidden";const n=e.block.workspace;if(!n.isFlyout){if(!i.getBackPack(n))return"hidden";if(t)return"enabled";const o=s.get(n);if(!o.size&&i.check(e.block))return"enabled";for(const e of o)if(i.check(n.getBlockById(e)))return"enabled";return"disabled"}return"hidden"},callback:function(e){if(!e.block)return;const t=e.block.workspace,n=i.getBackPack(t),o=s.get(t);o.size||i.check(e.block)&&n.addBlock(e.block),o.forEach(function(e){const s=t.getBlockById(e);i.check(s)&&n.addBlock(s)})},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:n,weight:200};null!==e.ContextMenuRegistry.registry.getItem(n)&&e.ContextMenuRegistry.registry.unregister(n),e.ContextMenuRegistry.registry.register(i)}()}(this.useCopyPasteMenu_,this.useCopyPasteCrossTab_),A(),R(this.useCopyPasteCrossTab_)),this.controls_=new K(this.workspace_,n.multiselectIcon,this.multiSelectKeys_),r.add(this.controls_),!n.multiselectIcon||!n.multiselectIcon.hideIcon){const e=this.controls_.createDom();this.workspace_.getParentSvg().appendChild(e)}this.controls_.init(n.multiselectIcon.hideIcon,n.multiselectIcon.weight),n.useDoubleClick&&this.useDoubleClick_(!0),!1===n.multiFieldUpdate&&(this.multiFieldUpdate_=!1),n.bumpNeighbours||(this.origBumpNeighbours=e.BlockSvg.prototype.bumpNeighbours,e.BlockSvg.prototype.bumpNeighbours=function(){}),e.browserEvents.conditionalBind(i,"keydown",this,this.unbindMultiselectCopyPaste_),this.workspace_.keyboardAccessibilityMode&&(B(),this.registeredShortcut_=!1)}static withoutMultiFieldUpdates(t){const s=e.Events.getRecordUndo();e.Events.setRecordUndo(!1);try{t()}finally{e.Events.setRecordUndo(s)}}setMultiselectIcon(e,t){this.controls_&&(this.controls_.enabled_img=e,this.controls_.disabled_img=t,this.controls_.updateMultiselectIcon(this.controls_.enabled))}dispose(t=!1){this.onKeyDownWrapper_&&(e.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyDownDropdownDivWrapper_&&(e.browserEvents.unbind(this.onKeyDownDropdownDivWrapper_),this.onKeyDownDropdownDivWrapper_=null),this.onKeyDownWidgetDivWrapper_&&(e.browserEvents.unbind(this.onKeyDownWidgetDivWrapper_),this.onKeyDownWidgetDivWrapper_=null),this.onKeyUpWrapper_&&(e.browserEvents.unbind(this.onKeyUpWrapper_),this.onKeyUpWrapper_=null),this.onKeyUpDropdownDivWrapper_&&(e.browserEvents.unbind(this.onKeyUpDropdownDivWrapper_),this.onKeyUpDropdownDivWrapper_=null),this.onKeyUpWidgetDivWrapper_&&(e.browserEvents.unbind(this.onKeyUpWidgetDivWrapper_),this.onKeyUpWidgetDivWrapper_=null),this.onFocusOutWrapper_&&(e.browserEvents.unbind(this.onFocusOutWrapper_),this.onFocusOutWrapper_=null),this.onFocusOutDropdownDivWrapper_&&(e.browserEvents.unbind(this.onFocusOutDropdownDivWrapper_),this.onFocusOutDropdownDivWrapper_=null),this.onFocusOutWidgetDivWrapper_&&(e.browserEvents.unbind(this.onFocusOutWidgetDivWrapper_),this.onFocusOutWidgetDivWrapper_=null),this.eventListenerWrapper_&&(this.workspace_.removeChangeListener(this.eventListenerWrapper_),this.eventListenerWrapper_=null),this.eventListenerAllWrapper_&&(e.Workspace.getAll().forEach(e=>{e.removeChangeListener(this.eventListenerAllWrapper_)}),this.eventListenerAllWrapper_=null),t||(w(),this.useCopyPasteMenu_&&(e.ContextMenuRegistry.registry.unregister("blockCopyToStorage"),e.ContextMenuRegistry.registry.unregister("blockPasteFromStorage")),e.ContextMenuRegistry.registry.unregister("workspaceSelectAll"),e.ContextMenuRegistry.registry.unregister("copy_to_backpack"),function(){const t={blockDuplicate:e.ContextMenuItems.registerDuplicate,blockComment:e.ContextMenuItems.registerComment,blockInline:e.ContextMenuItems.registerInline,blockCollapseExpand:e.ContextMenuItems.registerCollapseExpandBlock,blockDisable:e.ContextMenuItems.registerDisable,blockDelete:e.ContextMenuItems.registerDelete,commentDelete:e.ContextMenuItems.registerCommentDelete,commentDuplicate:e.ContextMenuItems.registerCommentDuplicate};for(const e of u)t[e]()}(),A(),e.ShortcutRegistry.registry.unregister("selectall"),function(){const t={[e.ShortcutItems.names.DELETE]:e.ShortcutItems.registerDelete,[e.ShortcutItems.names.COPY]:e.ShortcutItems.registerCopy,[e.ShortcutItems.names.CUT]:e.ShortcutItems.registerCut,[e.ShortcutItems.names.PASTE]:e.ShortcutItems.registerPaste};for(const e of d)t[e]()}()),this.controls_&&(r.delete(this.controls_),this.controls_.dispose(),this.controls_=null),this.useDoubleClick_(!1),this.origBumpNeighbours&&(e.BlockSvg.prototype.bumpNeighbours=this.origBumpNeighbours)}useDoubleClick_(t){e.Gesture.prototype.handleWsStart=t?function(t){if(t.isWrapped)return t;const n=function(n,i){if(t.call(this,n,i),this.targetBlock&&1===n.buttons&&!o.get(i)){const t=function(e){return!e.isInFlyout&&e.isMovable()&&e.workspace.options.collapse},o=e.getSelected(),r=function(e,s){e&&t(e)&&!p(e)&&e.setCollapsed(s)};if(i.doubleClickPid_&&!n.target.closest(".blocklyIconGroup"))if(clearTimeout(i.doubleClickPid_),i.doubleClickPid_=void 0,o&&o instanceof e.BlockSvg&&t(o)){if(o.id===i.doubleClickBlock_){const t=!o.isCollapsed();return e.Events.setGroup(!0),o&&r(o,t),void e.Events.setGroup(!1)}}else if(o&&o instanceof m){const t=s.get(i);if(t.size){let s=0;t.forEach(e=>{i.getBlockById(e)&&(i.getBlockById(e).isCollapsed()||p(i.getBlockById(e))||(s+=1))});let n=!1;return s>0&&(n=!0),e.Events.setGroup(!0),t.forEach(function(e){const t=i.getBlockById(e);t&&r(t,n)}),void e.Events.setGroup(!1)}}i.doubleClickPid_||(i.doubleClickBlock_=o.id,i.doubleClickPid_=setTimeout(function(){i.doubleClickPid_=void 0},500))}};return n.isWrapped=!0,n}(e.Gesture.prototype.handleWsStart):this.origHandleWsStart_}eventListener_(t){if(this.multiFieldUpdate_&&this.dragSelection_.has(t.blockId)&&(t.type===e.Events.CHANGE&&"field"===t.element&&t.recordUndo||t.type===e.Events.BLOCK_FIELD_INTERMEDIATE_CHANGE)){if(this.multiFieldUpdateGroup_!==t.group&&(this.multiFieldUpdateGroup_=t.group,this.multiFieldUpdateSourceBlockId_=t.blockId),t.blockId!==this.multiFieldUpdateSourceBlockId_)return;const s=e.Events.getGroup();s||(e.Events.setGroup(t.group),t.group=e.Events.getGroup());try{const e=this.workspace_.getBlockById(t.blockId).type;this.dragSelection_.forEach(s=>{if(s===t.blockId)return;const n=this.workspace_.getBlockById(s);n&&n.type===e&&n.setFieldValue(t.newValue,t.name)})}catch(e){console.warn(e)}finally{e.Events.setGroup(s)}}}eventListenerAll_(t){t.type===e.Events.SELECTED&&r.forEach(e=>{e.updateMultiselect()})}onKeyDown_(e){this.multiSelectKeys_.indexOf(e.key.toLocaleLowerCase())>-1&&!o.get(this.workspace_)&&this.controls_.enableMultiselect()}unbindMultiselectCopyPaste_(e){this.workspace_.keyboardAccessibilityMode&&this.registeredShortcut_?(B(),this.registeredShortcut_=!1):this.workspace_.keyboardAccessibilityMode||this.registeredShortcut_||(R(),this.registeredShortcut_=!0)}onKeyUp_(e){this.multiSelectKeys_.indexOf(e.key.toLocaleLowerCase())>-1&&this.controls_.disableMultiselect()}onBlur_(t){if(o.get(this.workspace_)){t.relatedTarget&&("INPUT"===t.relatedTarget.tagName||"TEXTAREA"===t.relatedTarget.tagName||"DIV"===t.relatedTarget.tagName&&t.relatedTarget.classList.value.indexOf("blocklyDropdownMenu")>-1)&&this.controls_.revertLastUnselectedBlock();const s=this.workspace_.getInjectionDiv(),n=e.DropDownDiv.getContentDiv(),i=e.WidgetDiv.getDiv();if(t.relatedTarget&&(s.contains(t.relatedTarget)||n.contains(t.relatedTarget)||i?.contains(t.relatedTarget)))return;this.controls_.disableMultiselect()}}}})(),i})());
+//# sourceMappingURL=workspace-multiselect-pr135-edf5dd2.min.js.map
\ No newline at end of file
diff --git a/appinventor/blocklyeditor/tests/com/google/appinventor/mocha/index.html b/appinventor/blocklyeditor/tests/com/google/appinventor/mocha/index.html
index 95739a87f04..d759029a76f 100644
--- a/appinventor/blocklyeditor/tests/com/google/appinventor/mocha/index.html
+++ b/appinventor/blocklyeditor/tests/com/google/appinventor/mocha/index.html
@@ -14,7 +14,7 @@
-
+
diff --git a/appinventor/karma.conf.js b/appinventor/karma.conf.js
index 204b03b6206..ad81367b900 100644
--- a/appinventor/karma.conf.js
+++ b/appinventor/karma.conf.js
@@ -24,7 +24,7 @@ module.exports = function(config) {
'appengine/war/static/js/workspace-search-9.1.10.min.js',
'appengine/war/static/js/block-dynamic-connection-0.7.16.min.js',
'appengine/war/static/js/blockly-field-colour-5.0.19.min.js',
- 'appengine/war/static/js/workspace-multiselect-pr134-c630b72.min.js',
+ 'appengine/war/static/js/workspace-multiselect-pr135-edf5dd2.min.js',
'blocklyeditor/tests/testCommon.js',
'blocklyeditor/tests/com/google/appinventor/mocha/*.js',
'blocklyeditor/build/javascript/*.js',