{"code":"(window.webpackJsonpGUI=window.webpackJsonpGUI||[]).push([[26],{1571:function(e,n,t){\"use strict\";t.r(n),t.d(n,\"resources\",(function(){return s}));const s={\"userscript.js\":async function(e){let{addon:n,msg:t}=e;const s=await n.tab.traps.getBlockly();let o=null;function i(e,s){return o||(o=[...e]),n.self.disabled||(e.push([\"-\",\"-\"],[\",\",\",\"],[\".\",\".\"]),e.splice(5,0,[t(\"enter-key\"),\"enter\"]),n.settings.get(\"experimentalKeys\")&&e.push([\"`\",\"`\"],[\"=\",\"=\"],[\"[\",\"[\"],[\"]\",\"]\"],[\"\\\\\",\"\\\\\"],[\";\",\";\"],[\"'\",\"'\"],[\"/\",\"/\"]),s&&n.settings.get(\"shiftKeys\")&&e.push([\"!\",\"!\"],[\"@\",\"@\"],[\"#\",\"#\"],[\"$\",\"$\"],[\"%\",\"%\"],[\"^\",\"^\"],[\"&\",\"&\"],[\"*\",\"*\"],[\"(\",\"(\"],[\")\",\")\"],[\"_\",\"_\"],[\"+\",\"+\"],[\"{\",\"{\"],[\"}\",\"}\"],[\"|\",\"|\"],[\":\",\":\"],['\"','\"'],[\"?\",\"?\"],[\"<\",\"<\"],[\">\",\">\"],[\"~\",\"~\"]),n.settings.get(\"twKeys\")&&e.push([\"backspace\",\"backspace\"],[\"delete\",\"delete\"],[\"shift\",\"shift\"],[\"caps lock\",\"caps lock\"],[\"scroll lock\",\"scroll lock\"],[\"control\",\"control\"],[\"escape\",\"escape\"],[\"insert\",\"insert\"],[\"home\",\"home\"],[\"end\",\"end\"],[\"page up\",\"page up\"],[\"page down\",\"page down\"])),e}for(const e of[\"sensing_keyoptions\",\"event_whenkeypressed\"]){const n=s.Blocks[e],t=n.init;n.init=function(){const n=this.jsonInit;this.jsonInit=function(t){return i(t.args0[0].options,\"event_whenkeypressed\"===e),n.call(this,t)};for(var s=arguments.length,o=new Array(s),c=0;c{const e=Blockly.getMainWorkspace(),n=e&&e.getFlyout();if(e&&n){const t=[...e.getAllBlocks(),...n.getWorkspace().getAllBlocks()];for(const e of t){if(\"event_whenkeypressed\"!==e.type&&\"sensing_keyoptions\"!==e.type)continue;const n=e.inputList[0];if(!n)continue;const t=n.fieldRow.find((e=>e&&Array.isArray(e.menuGenerator_)));t&&(t.menuGenerator_=i(o?[...o]:t.menuGenerator_,\"event_whenkeypressed\"===e.type))}}};c(),n.settings.addEventListener(\"change\",c),n.self.addEventListener(\"disabled\",c),n.self.addEventListener(\"reenabled\",c)}}}}]);","name":"js/pentapod/addon-entry-editor-extra-keys.6ed00a194ea668dd1be6.js","input":"(window[\"webpackJsonpGUI\"] = window[\"webpackJsonpGUI\"] || []).push([[26],{\n\n/***/ 1571:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, \"resources\", function() { return /* binding */ resources; });\n\n// CONCATENATED MODULE: ./src/addons/addons/editor-extra-keys/userscript.js\n/* harmony default export */ var userscript = (async function (_ref) {\n let {\n addon,\n msg\n } = _ref;\n const ScratchBlocks = await addon.tab.traps.getBlockly();\n let defaultKeys = null;\n function appendKeys(keys, enableShiftKeys) {\n if (!defaultKeys) {\n defaultKeys = [...keys];\n }\n if (!addon.self.disabled) {\n keys.push(...[[\"-\", \"-\"], [\",\", \",\"], [\".\", \".\"]]);\n keys.splice(5, 0, [msg(\"enter-key\"), \"enter\"]);\n if (addon.settings.get(\"experimentalKeys\")) {\n keys.push(...[[\"`\", \"`\"], [\"=\", \"=\"], [\"[\", \"[\"], [\"]\", \"]\"], [\"\\\\\", \"\\\\\"], [\";\", \";\"], [\"'\", \"'\"], [\"/\", \"/\"]]);\n }\n if (enableShiftKeys && addon.settings.get(\"shiftKeys\")) {\n keys.push(...[[\"!\", \"!\"], [\"@\", \"@\"], [\"#\", \"#\"], [\"$\", \"$\"], [\"%\", \"%\"], [\"^\", \"^\"], [\"&\", \"&\"], [\"*\", \"*\"], [\"(\", \"(\"], [\")\", \")\"], [\"_\", \"_\"], [\"+\", \"+\"], [\"{\", \"{\"], [\"}\", \"}\"], [\"|\", \"|\"], [\":\", \":\"], ['\"', '\"'], [\"?\", \"?\"], [\"<\", \"<\"], [\">\", \">\"], [\"~\", \"~\"]]);\n }\n if (addon.settings.get(\"twKeys\")) {\n keys.push(...[[\"backspace\", \"backspace\"], [\"delete\", \"delete\"], [\"shift\", \"shift\"], [\"caps lock\", \"caps lock\"], [\"scroll lock\", \"scroll lock\"], [\"control\", \"control\"], [\"escape\", \"escape\"], [\"insert\", \"insert\"], [\"home\", \"home\"], [\"end\", \"end\"], [\"page up\", \"page up\"], [\"page down\", \"page down\"]]);\n }\n }\n return keys;\n }\n for (const opcode of [\"sensing_keyoptions\", \"event_whenkeypressed\"]) {\n const block = ScratchBlocks.Blocks[opcode];\n const originalInit = block.init;\n block.init = function () {\n const originalJsonInit = this.jsonInit;\n this.jsonInit = function (obj) {\n appendKeys(obj.args0[0].options, opcode === \"event_whenkeypressed\");\n return originalJsonInit.call(this, obj);\n };\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return originalInit.call(this, ...args);\n };\n }\n const updateExistingBlocks = () => {\n const workspace = Blockly.getMainWorkspace();\n const flyout = workspace && workspace.getFlyout();\n if (workspace && flyout) {\n const allBlocks = [...workspace.getAllBlocks(), ...flyout.getWorkspace().getAllBlocks()];\n for (const block of allBlocks) {\n if (block.type !== \"event_whenkeypressed\" && block.type !== \"sensing_keyoptions\") {\n continue;\n }\n const input = block.inputList[0];\n if (!input) {\n continue;\n }\n const field = input.fieldRow.find(i => i && Array.isArray(i.menuGenerator_));\n if (!field) {\n continue;\n }\n field.menuGenerator_ = appendKeys(defaultKeys ? [...defaultKeys] : field.menuGenerator_, block.type === \"event_whenkeypressed\");\n }\n }\n };\n updateExistingBlocks();\n addon.settings.addEventListener(\"change\", updateExistingBlocks);\n addon.self.addEventListener(\"disabled\", updateExistingBlocks);\n addon.self.addEventListener(\"reenabled\", updateExistingBlocks);\n});\n// CONCATENATED MODULE: ./src/addons/addons/editor-extra-keys/_runtime_entry.js\n/* generated by pull.js */\n\nconst resources = {\n \"userscript.js\": userscript\n};\n\n/***/ })\n\n}]);","inputSourceMap":null}