{"version":3,"file":"nodes_controller-C5Ide4Dh.js","sources":["../../../app/javascript/entrypoints/controllers/nodes_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\";\nimport Sortable from \"sortablejs\";\nimport { patch } from \"@rails/request.js\";\n\nexport default class extends Controller {\n draggingData = {};\n\n static targets = [];\n\n createSortable(element) {\n const sortable = new Sortable(element, {\n draggable: \".draggable-node\",\n onChange: (event) => {\n this.updateRowOrder(event);\n },\n filter: \".draggable\",\n });\n }\n\n connect() {\n this.createSortable(this.element);\n }\n\n async updateRowOrder(event) {\n const sortable = Sortable.get(event.target);\n const items = sortable.toArray();\n\n patch(\"/nodes/update_position\", {\n responseKind: \"turbo-stream\",\n body: { positions: items },\n });\n }\n}\n"],"names":["nodes_controller","Controller","__publicField","element","Sortable","event","items","patch"],"mappings":"yUAIe,MAAKA,UAASC,CAAW,CAAzB,kCACbC,EAAA,oBAAe,CAAA,GAIf,eAAeC,EAAS,CACL,IAAIC,EAASD,EAAS,CACrC,UAAW,kBACX,SAAWE,GAAU,CACnB,KAAK,eAAeA,CAAK,CAC1B,EACD,OAAQ,YACd,CAAK,CACF,CAED,SAAU,CACR,KAAK,eAAe,KAAK,OAAO,CACjC,CAED,MAAM,eAAeA,EAAO,CAE1B,MAAMC,EADWF,EAAS,IAAIC,EAAM,MAAM,EACnB,UAEvBE,EAAM,yBAA0B,CAC9B,aAAc,eACd,KAAM,CAAE,UAAWD,CAAO,CAChC,CAAK,CACF,CACH,CAzBEJ,EAHkBF,EAGX,UAAU,CAAA"}