{"version":3,"file":"command_operation_templates.ts-B7kCiq3-.js","sources":["../../../../../app/javascript/entries/controllers/command_operation_templates.ts"],"sourcesContent":["import { t } from \"i18next\";\n// @ts-nocheck\nimport jquery from \"jquery\";\nwindow.$ = jquery;\n\n$(() => {\n check_readonly();\n $(\"#command_operation_template_switch_command_logic_templates_attributes_1_switch_logic\").on(\"ready change\", () => {\n check_readonly();\n });\n});\n\nconst check_readonly = () => {\n const val = $(\"#command_operation_template_switch_command_logic_templates_attributes_1_switch_logic\").val();\n const target = [t(\"CommandOperationTemplates.値ãŒç©ºã§ã¯ãªã„\"), t(\"CommandOperationTemplates.値ãŒç©ºã«ãªã£ã¦ã„ã‚‹\")];\n if (target.includes(val)) {\n // éžæ´»æ€§\n $(\"#command_operation_template_switch_command_logic_templates_attributes_1_switch_case\").attr(\"readonly\", true);\n $(\"#command_operation_template_switch_command_logic_templates_attributes_1_switch_case\").val(\"\");\n } else {\n $(\"#command_operation_template_switch_command_logic_templates_attributes_1_switch_case\").attr(\"readonly\", false);\n }\n};\n\nwindow.addEventListener(\"load\", () => {\n setTimeout(() => {\n const output = document.querySelector(\".js-command-operation-output\");\n const action = document.querySelector(\".js-command-operation-action\");\n\n if (output !== null) {\n output.addEventListener(\"change\", (event) => {\n changeOutputTermValue(event.target.value);\n });\n action.addEventListener(\"change\", () => {\n changeOutputTermValue(null);\n });\n document.addEventListener(\"click\", (event) => {\n if (event.target.closest(\".js-command-operation-output-add\")) {\n const selectedName = document.querySelector(\".js-command-operation-output\")\n ? document.querySelector(\".js-command-operation-output\").value\n : null;\n changeOutputTermValue(selectedName);\n }\n });\n }\n }, 1000);\n\n function changeOutputTermValue(value) {\n const outputNames = document.querySelectorAll(\".js-command-operation-output-name\");\n if (outputNames.length) {\n for (let index = 0; index < outputNames.length; index++) {\n outputNames[index].textContent = value;\n }\n }\n }\n});\n"],"names":["jquery","check_readonly","val","t","output","action","event","changeOutputTermValue","selectedName","value","outputNames","index"],"mappings":"oKAGA,OAAO,EAAIA,EAEX,EAAE,IAAM,CACSC,EAAA,EACf,EAAE,sFAAsF,EAAE,GAAG,eAAgB,IAAM,CAClGA,EAAA,CAAA,CAChB,CACH,CAAC,EAED,MAAMA,EAAiB,IAAM,CAC3B,MAAMC,EAAM,EAAE,sFAAsF,EAAE,IAAI,EAC3F,CAACC,EAAE,mCAAmC,EAAGA,EAAE,qCAAqC,CAAC,EACrF,SAASD,CAAG,GAErB,EAAE,qFAAqF,EAAE,KAAK,WAAY,EAAI,EAC5G,EAAA,qFAAqF,EAAE,IAAI,EAAE,GAE/F,EAAE,qFAAqF,EAAE,KAAK,WAAY,EAAK,CAEnH,EAEA,OAAO,iBAAiB,OAAQ,IAAM,CACpC,WAAW,IAAM,CACT,MAAAE,EAAS,SAAS,cAAc,8BAA8B,EAC9DC,EAAS,SAAS,cAAc,8BAA8B,EAEhED,IAAW,OACNA,EAAA,iBAAiB,SAAWE,GAAU,CACrBC,EAAAD,EAAM,OAAO,KAAK,CAAA,CACzC,EACMD,EAAA,iBAAiB,SAAU,IAAM,CACtCE,EAAsB,IAAI,CAAA,CAC3B,EACQ,SAAA,iBAAiB,QAAUD,GAAU,CAC5C,GAAIA,EAAM,OAAO,QAAQ,kCAAkC,EAAG,CACtD,MAAAE,EAAe,SAAS,cAAc,8BAA8B,EACtE,SAAS,cAAc,8BAA8B,EAAE,MACvD,KACJD,EAAsBC,CAAY,CAAA,CACpC,CACD,IAEF,GAAI,EAEP,SAASD,EAAsBE,EAAO,CAC9B,MAAAC,EAAc,SAAS,iBAAiB,mCAAmC,EACjF,GAAIA,EAAY,OACd,QAASC,EAAQ,EAAGA,EAAQD,EAAY,OAAQC,IAClCD,EAAAC,CAAK,EAAE,YAAcF,CAErC,CAEJ,CAAC"}