PageSourceSearch

https://cdn.electionbuddy.com/packs/js/application-b73082404d9f6af6e35a.js

js electionbuddy.com collected 2026-09-25 02:43:18 UTC 1,629,094 bytes, 3 lines download raw bytes

1/*! For license information please see application-b73082404d9f6af6e35a.js.LICENSE.txt */
2(self.webpackChunk=self.webpackChunk||[]).push([[543],{132:function(e,t,n){"use strict";var r=n(7241),o=n.n(r);o().translations={af:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Voeg meer inskrywings by"}}},nomination:{profile:{edit_image:"Wysig prent",edit_pdf:"Wysig PDF"}}}}}}},am:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u1270\u1328\u121b\u122a \u1218\u133b\u134a\u12eb\u12ce\u127d\u1295 \u12eb\u12ad\u1209"}}},nomination:{profile:{edit_image:"\u121d\u1235\u120d \u12a0\u122d\u1275\u12d5",edit_pdf:"\u1352\u12f2\u12a4\u134d \u12a0\u122d\u1275\u12d5"}}}}}}},ar:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0623\u0636\u0641 \u0627\u0644\u0645\u0632\u064a\u062f \u0645\u0646 \u0627\u0644\u0648\u0638\u0627\u0626\u0641 \u0627\u0644\u0645\u0643\u062a\u0648\u0628\u0629"}}},nomination:{profile:{edit_image:"\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0635\u0648\u0631\u0629",edit_pdf:"\u062a\u0639\u062f\u064a\u0644 \u0645\u0644\u0641 PDF"}}}}}}},bg:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0414\u043e\u0431\u0430\u0432\u0435\u0442\u0435 \u043e\u0449\u0435 \u0434\u043e\u043f\u044a\u043b\u043d\u0438\u0442\u0435\u043b\u043d\u043e \u0432\u043f\u0438\u0441\u0430\u043d\u0438 \u043e\u0442\u0433\u043e\u0432\u043e\u0440\u0438"}}},nomination:{profile:{edit_image:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",edit_pdf:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 PDF"}}}}}}},bn:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0986\u09b0\u09cb \u09b2\u09bf\u0996\u09c1\u09a8-\u0987\u09a8 \u09af\u09cb\u0997 \u0995\u09b0\u09c1\u09a8"}}},nomination:{profile:{edit_image:"\u099b\u09ac\u09bf \u09b8\u09ae\u09cd\u09aa\u09be\u09a6\u09a8\u09be \u0995\u09b0\u09c1\u09a8",edit_pdf:"PDF \u098f\u09a1\u09bf\u099f \u0995\u09b0\u09c1\u09a8"}}}}}}},bs:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Dodaj jo\u0161 upisanih radova"}}},nomination:{profile:{edit_image:"Uredi sliku",edit_pdf:"Uredi PDF"}}}}}}},ca:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Afegiu m\xe9s espais per escriure les vostres propostes de vot. "}}},nomination:{profile:{edit_image:"Edita la imatge",edit_pdf:"Edita PDF"}}}}}}},cs:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"P\u0159idejte dal\u0161\xed ru\u010dn\u011b dopsan\xe9 mo\u017enosti"}}},nomination:{profile:{edit_image:"Upravit obr\xe1zek",edit_pdf:"Upravit PDF"}}}}}}},cy:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Ychwanegwch fwy o ysgrifennu i mewn"}}},nomination:{profile:{edit_image:"Golygu Delwedd",edit_pdf:"Golygu PDF"}}}}}}},da:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Tilf\xf8j flere indskrivninger"}}},nomination:{profile:{edit_image:"Rediger billede",edit_pdf:"Rediger PDF"}}}}}}},de:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Weitere Write-Ins hinzuf\xfcgen"}}},nomination:{profile:{edit_image:"Bild bearbeiten",edit_pdf:"PDF bearbeiten"}}}}}}},el:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u03a0\u03c1\u03bf\u03c3\u03b8\u03ad\u03c3\u03c4\u03b5 \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b5\u03c2 \u03b5\u03b3\u03b3\u03c1\u03b1\u03c6\u03ad\u03c2"}}},nomination:{profile:{edit_image:"\u0395\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03c3\u03af\u03b1 \u03b5\u03b9\u03ba\u03cc\u03bd\u03b1\u03c2",edit_pdf:"\u0395\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03c3\u03af\u03b1 PDF"}}}}}}},"en-US":{js:{results:{frame_error:{message:"These results could not be loaded. Check your connection and try again.",retry:"Try again"}}},pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Add more Write-ins"}}},nomination:{profile:{edit_image:"Edit Image",edit_pdf:"Edit PDF"}}}}}}},es:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"A\xf1ada m\xe1s espacios para escribir sus propuestas de voto"}}},nomination:{profile:{edit_image:"Editar imagen",edit_pdf:"Editar PDF"}}}}}}},et:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Lisage veel kirjutisi"}}},nomination:{profile:{edit_image:"Redigeeri pilti",edit_pdf:"Redigeeri PDF-i"}}}}}}},eu:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Hutsune gehiago gehitu zure proposamenak idazteko"}}},nomination:{profile:{edit_image:"Editatu irudia",edit_pdf:"Editatu PDFa"}}}}}}},fa:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0646\u0648\u0634\u062a\u0646 \u0647\u0627\u06cc \u0628\u06cc\u0634\u062a\u0631 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0646\u06cc\u062f"}}},nomination:{profile:{edit_image:"\u0648\u06cc\u0631\u0627\u06cc\u0634 \u062a\u0635\u0648\u06cc\u0631",edit_pdf:"PDF \u0631\u0627 \u0648\u06cc\u0631\u0627\u06cc\u0634 \u06a9\u0646\u06cc\u062f"}}}}}}},"fa-AF":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u0646 Write-in \u0647\u0627\u06cc \u0628\u06cc\u0634\u062a\u0631"}}},nomination:{profile:{edit_image:"\u0648\u06cc\u0631\u0627\u06cc\u0634 \u062a\u0635\u0648\u06cc\u0631",edit_pdf:"\u0648\u06cc\u0631\u0627\u06cc\u0634 \u067e\u06cc \u062f\u06cc \u0627\u0641"}}}}}}},fi:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Lis\xe4\xe4 Write-ins"}}},nomination:{profile:{edit_image:"Muokkaa kuvaa",edit_pdf:"Muokkaa PDF"}}}}}}},fil:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Magdagdag pa ng mga Write-in"}}},nomination:{profile:{edit_image:"I-edit ang Larawan",edit_pdf:"I-edit ang PDF"}}}}}}},fr:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Ajouter plus d'\xe9critures"}}},nomination:{profile:{edit_image:"\xc9diter l'image",edit_pdf:"Modifier le PDF"}}}}}}},"fr-CA":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Ajouter plus de Write-ins"}}},nomination:{profile:{edit_image:"Modifier l'image",edit_pdf:"Modifier PDF"}}}}}}},he:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u05d4\u05d5\u05e1\u05d9\u05e4\u05d5 \u05e2\u05e8\u
205db\u05d9\u05dd \u05d9\u05d3\u05e0\u05d9\u05d9\u05dd \u05e0\u05d5\u05e1\u05e4\u05d9\u05dd"}}},nomination:{profile:{edit_image:"\u05e2\u05e8\u05d5\u05da \u05ea\u05de\u05d5\u05e0\u05d4",edit_pdf:"\u05e2\u05e8\u05d5\u05da PDF"}}}}}}},hi:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0914\u0930 \u0905\u0927\u093f\u0915 \u0932\u093f\u0916\u093f\u0924 \u092e\u0947\u0902 \u0926\u0947\u0902"}}},nomination:{profile:{edit_image:"\u0938\u0902\u092a\u093e\u0926\u093f\u0924 \u091b\u0935\u093f",edit_pdf:"\u092a\u0940\u0921\u0940\u090f\u092b \u0938\u0902\u092a\u093e\u0926\u093f\u0924 \u0915\u0930\u0947\u0902"}}}}}}},hr:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Dodajte jo\u0161 upisivanja"}}},nomination:{profile:{edit_image:"Uredi sliku",edit_pdf:"Uredi PDF"}}}}}}},"ht-HT":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Ajoute plis Ekriti"}}},nomination:{profile:{edit_image:"Modifye Imaj",edit_pdf:"Modifye PDF"}}}}}}},hu:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Adjon hozz\xe1 \xfaj lehet\u0151s\xe9geket"}}},nomination:{profile:{edit_image:"K\xe9p szerkeszt\xe9se",edit_pdf:"PDF szerkeszt\xe9se"}}}}}}},id:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Tambahkan Pilihan Tulis Lainnya"}}},nomination:{profile:{edit_image:"Sunting Gambar",edit_pdf:"Sunting PDF"}}}}}}},is:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"B\xe6ttu vi\xf0 fleiri innsendum valkostum"}}},nomination:{profile:{edit_image:"Breyta mynd",edit_pdf:"Breyta PDF"}}}}}}},it:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Aggiungi altri candidati"}}},nomination:{profile:{edit_image:"Modifica immagine",edit_pdf:"Modifica PDF"}}}}}}},ja:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u66f8\u304d\u8fbc\u307f\u3092\u8ffd\u52a0\u3059\u308b"}}},nomination:{profile:{edit_image:"\u753b\u50cf\u3092\u7de8\u96c6",edit_pdf:"PDF\u3092\u7de8\u96c6"}}}}}}},ka:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u10d3\u10d0\u10d0\u10db\u10d0\u10e2\u10d4\u10d7 \u10db\u10d4\u10e2\u10d8 \u10e9\u10d0\u10ec\u10d4\u10e0\u10d0"}}},nomination:{profile:{edit_image:"\u10e1\u10e3\u10e0\u10d0\u10d7\u10d8\u10e1 \u10e0\u10d4\u10d3\u10d0\u10e5\u10e2\u10d8\u10e0\u10d4\u10d1\u10d0",edit_pdf:"PDF-\u10d8\u10e1 \u10e0\u10d4\u10d3\u10d0\u10e5\u10e2\u10d8\u10e0\u10d4\u10d1\u10d0"}}}}}}},"km-KH":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u1794\u1793\u17d2\u1790\u17c2\u1798\u1780\u17b6\u179a\u179f\u179a\u179f\u17c1\u179a\u1794\u1793\u17d2\u1790\u17c2\u1798"}}},nomination:{profile:{edit_image:"\u1780\u17c2\u179f\u1798\u17d2\u179a\u17bd\u179b\u179a\u17bc\u1794\u1797\u17b6\u1796",edit_pdf:"\u1780\u17c2\u179f\u1798\u17d2\u179a\u17bd\u179b PDF"}}}}}}},ko:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\ub354 \ub9ce\uc740 \uae30\uc785 \ucd94\uac00"}}},nomination:{profile:{edit_image:"\uc774\ubbf8\uc9c0 \ud3b8\uc9d1",edit_pdf:"PDF \ud3b8\uc9d1"}}}}}}},lt:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Prid\u0117ti daugiau \u012fra\u0161\u0173"}}},nomination:{profile:{edit_image:"Redaguoti vaizd\u0105",edit_pdf:"Redaguoti PDF"}}}}}}},lv:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Pievienot v\u0113l citus variantus"}}},nomination:{profile:{edit_image:"Redi\u0123\u0113t att\u0113lu",edit_pdf:"Redi\u0123\u0113t PDF"}}}}}}},"mr-IN":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0905\u0927\u093f\u0915 \u0932\u0947\u0916\u0928-\u0907\u0928 \u091c\u094b\u0921\u093e"}}},nomination:{profile:{edit_image:"\u092a\u094d\u0930\u0924\u093f\u092e\u093e \u0938\u0902\u092a\u093e\u0926\u093f\u0924 \u0915\u0930\u093e",edit_pdf:"PDF \u0938\u0902\u092a\u093e\u0926\u093f\u0924 \u0915\u0930\u093e"}}}}}}},my:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u1014\u1031\u102c\u1000\u103a\u1011\u1015\u103a \u101b\u1031\u1038\u101e\u103d\u1004\u103a\u1038\u1001\u103b\u1000\u103a\u1019\u103b\u102c\u1038 \u1011\u100a\u1037\u103a\u1015\u102b\u104b"}}},nomination:{profile:{edit_image:"\u1015\u102f\u1036 \u1010\u100a\u103a\u1038\u1016\u103c\u1010\u103a\u1015\u102b\u104b",edit_pdf:"PDF \u1000\u102d\u102f\u1010\u100a\u103a\u1038\u1016\u103c\u1010\u103a\u1015\u102b\u104b"}}}}}}},ne:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0925\u092a \u0932\u0947\u0916\u094d\u0928\u0941\u0939\u094b\u0938\u094d"}}},nomination:{profile:{edit_image:"\u091b\u0935\u093f \u0938\u092e\u094d\u092a\u093e\u0926\u0928 \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d",edit_pdf:"PDF \u0938\u092e\u094d\u092a\u093e\u0926\u0928 \u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d"}}}}}}},nl:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Voeg meer inschrijvingen toe"}}},nomination:{profile:{edit_image:"Bewerk afbeelding",edit_pdf:"PDF bewerken"}}}}}}},"no-NO":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Legg til flere utfyllinger"}}},nomination:{profile:{edit_image:"Rediger bilde",edit_pdf:"Rediger PDF"}}}}}}},pa:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0a39\u0a4b\u0a30 \u0a32\u0a3f\u0a16\u0a4b-\u0a07\u0a28 \u0a38\u0a3c\u0a3e\u0a2e\u0a32 \u0a15\u0a30\u0a4b"}}}
2,nomination:{profile:{edit_image:"\u0a1a\u0a3f\u0a71\u0a24\u0a30 \u0a26\u0a3e \u0a38\u0a70\u0a2a\u0a3e\u0a26\u0a28 \u0a15\u0a30\u0a4b",edit_pdf:"PDF \u0a26\u0a3e \u0a38\u0a70\u0a2a\u0a3e\u0a26\u0a28 \u0a15\u0a30\u0a4b"}}}}}}},pl:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Dodaj wi\u0119cej wpisanych warto\u015bci."}}},nomination:{profile:{edit_image:"Edytuj obraz",edit_pdf:"Edytuj PDF"}}}}}}},ps:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0646\u0648\u0631 \u0644\u06cc\u06a9\u0646\u06d0 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0693\u0626"}}},nomination:{profile:{edit_image:"\u0627\u0646\u0681\u0648\u0631 \u0633\u0645\u0648\u0644",edit_pdf:"\u062f PDF \u0633\u0645\u0648\u0644"}}}}}}},"pt-BR":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Adicione mais op\xe7\xf5es por escrito."}}},nomination:{profile:{edit_image:"Editar imagem",edit_pdf:"Editar PDF"}}}}}}},ro:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Adaug\u0103 mai multe op\u021biuni introduse manual"}}},nomination:{profile:{edit_image:"Editeaz\u0103 imagine",edit_pdf:"Edita\u021bi PDF"}}}}}}},ru:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432"}}},nomination:{profile:{edit_image:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",edit_pdf:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c PDF-\u0444\u0430\u0439\u043b"}}}}}}},sk:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Pridajte viac z\xe1pisov"}}},nomination:{profile:{edit_image:"Upravi\u0165 obr\xe1zok",edit_pdf:"Upravi\u0165 PDF"}}}}}}},so:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Ku dar Qoritaanno dheeraad ah"}}},nomination:{profile:{edit_image:"Wax ka beddel sawirka",edit_pdf:"Wax ka beddel PDF"}}}}}}},sq:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Shto m\xeb shum\xeb shkrime"}}},nomination:{profile:{edit_image:"Modifiko imazhin",edit_pdf:"Modifiko PDF-n\xeb"}}}}}}},sv:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"L\xe4gg till fler Write-ins"}}},nomination:{profile:{edit_image:"Redigera bild",edit_pdf:"Redigera PDF"}}}}}}},sw:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Ongeza maandishi zaidi"}}},nomination:{profile:{edit_image:"Hariri Picha",edit_pdf:"Hariri PDF"}}}}}}},ta:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0bae\u0bc7\u0bb2\u0bc1\u0bae\u0bcd \u0b8e\u0bb4\u0bc1\u0ba4\u0bc1\u0baa\u0bca\u0bb0\u0bc1\u0b9f\u0bcd\u0b95\u0bb3\u0bc8\u0b9a\u0bcd \u0b9a\u0bc7\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bb5\u0bc1\u0bae\u0bcd"}}},nomination:{profile:{edit_image:"\u0baa\u0b9f\u0ba4\u0bcd\u0ba4\u0bc8\u0ba4\u0bcd \u0ba4\u0bbf\u0bb0\u0bc1\u0ba4\u0bcd\u0ba4\u0bc1",edit_pdf:"PDF \u0b90\u0ba4\u0bcd \u0ba4\u0bbf\u0bb0\u0bc1\u0ba4\u0bcd\u0ba4\u0bc1"}}}}}}},th:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21"}}},nomination:{profile:{edit_image:"\u0e41\u0e01\u0e49\u0e44\u0e02\u0e23\u0e39\u0e1b\u0e20\u0e32\u0e1e",edit_pdf:"\u0e41\u0e01\u0e49\u0e44\u0e02\u0e44\u0e1f\u0e25\u0e4c PDF"}}}}}}},ti:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u1270\u12c8\u1233\u12ba Write-ins \u12c8\u1235\u12b9"}}},nomination:{profile:{edit_image:"\u121d\u1235\u120a \u12a3\u122d\u1275\u12d5",edit_pdf:"\u1352\u12f2\u12a4\u134d \u12a3\u122d\u1275\u12d5"}}}}}}},tr:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Daha fazla Liste d\u0131\u015f\u0131 aday ekle"}}},nomination:{profile:{edit_image:"Resmi D\xfczenle",edit_pdf:"PDF'yi d\xfczenle"}}}}}}},uk:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0414\u043e\u0434\u0430\u0442\u0438 \u0431\u0456\u043b\u044c\u0448\u0435 \u0432\u043b\u0430\u0441\u043d\u0438\u0445 \u0432\u0430\u0440\u0456\u0430\u043d\u0442\u0456\u0432"}}},nomination:{profile:{edit_image:"\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f",edit_pdf:"\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 PDF"}}}}}}},ur:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u0645\u0632\u06cc\u062f \u062a\u062d\u0631\u06cc\u0631\u06cc\u06ba \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4"}}},nomination:{profile:{edit_image:"\u062a\u0635\u0648\u06cc\u0631 \u0645\u06cc\u06ba \u062a\u0631\u0645\u06cc\u0645 \u06a9\u0631\u06cc\u06ba\u06d4",edit_pdf:"\u067e\u06cc \u0688\u06cc \u0627\u06cc\u064
21 \u0645\u06cc\u06ba \u062a\u0631\u0645\u06cc\u0645 \u06a9\u0631\u06cc\u06ba\u06d4"}}}}}}},vi:{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"Th\xeam nhi\u1ec1u m\u1ee5c ghi v\xe0o"}}},nomination:{profile:{edit_image:"Ch\u1ec9nh s\u1eeda h\xecnh \u1ea3nh",edit_pdf:"Ch\u1ec9nh s\u1eeda PDF"}}}}}}},"zh-Hans":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u6dfb\u52a0\u66f4\u591a\u6295\u7ed9\u975e\u5019\u9009\u4eba\u7684\u7968"}}},nomination:{profile:{edit_image:"\u7de8\u8f2f\u5716\u7247",edit_pdf:"\u7f16\u8f91 PDF"}}}}}}},"zh-Hant":{pages:{vote:{ballot:{question:{general:{choices:{writein:{add:"\u65b0\u589e\u66f4\u591a\u81ea\u586b\u9078\u9805"}}},nomination:{profile:{edit_image:"\u7de8\u8f2f\u5f71\u50cf",edit_pdf:"\u7de8\u8f2fPDF"}}}}}}}},o().locale="en-US",t.A=o()},7571:function(){function e(e){return i(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||n()}function t(e,t){return i(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||r(e,t)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){if(Array.isArray(e))return e}var a;a=function(){var n=new ResizeObserver(function(e){return e.forEach(function(e){return e.target.querySelectorAll(".pagy-rjs").forEach(function(e){return e.pagyRender()})})}),i=function(e,r){var o,i=t(r,4),a=i[0],u=i[1],c=i[2],l=i[3],f=null!==(o=e.parentElement)&&void 0!==o?o:e,d=Object.keys(u).map(function(e){return parseInt(e)}).sort(function(e,t){return t-e}),p=-1,h=function(e,t,n){return e.replace(/__pagy_page__/g,t).replace(/__pagy_label__/g,
2n)};(e.pagyRender=function(){var t,n=d.find(function(e){return e<f.clientWidth})||0;if(n!==p){var r=a.before,o=u[n.toString()],i=null!==(t=null===c||void 0===c?void 0:c[n.toString()])&&void 0!==t?t:o.map(function(e){return e.toString()});for(var v in o){var y=o[v],m=i[v];r+="string"==typeof l&&1===y?s(h(a.link,y.toString(),m),l):"number"==typeof y?h(a.link,y.toString(),m):"gap"===y?a.gap:h(a.active,y,m)}r+=a.after,e.innerHTML="",e.insertAdjacentHTML("afterbegin",r),p=n}})(),e.classList.contains("pagy-rjs")&&n.observe(f)},a=function(e,n){var r=t(n,2),o=r[0],i=r[1];return c(e,function(e){return[e,o.replace(/__pagy_page__/,e)]},i)},u=function(e,n){var r=t(n,3),o=r[0],i=r[1],a=r[2];c(e,function(e){var t=Math.max(Math.ceil(o/parseInt(e)),1).toString();return[t,i.replace(/__pagy_page__/,t).replace(/__pagy_items__/,e)]},a)},c=function(e,n,r){var o=e.querySelector("input"),i=o.value,a=function(){if(o.value!==i){var a=[o.min,o.value,o.max].map(function(e){return parseInt(e)||0}),u=t(a,3),c=u[0],l=u[1],f=u[2];if(l<c||l>f)return o.value=i,void o.select();var d=t(n(o.value),2),p=d[0],h=d[1];"string"==typeof r&&"1"===p&&(h=s(h,r)),e.insertAdjacentHTML("afterbegin",h),e.querySelector("a").click()}};["change","focus"].forEach(function(e){return o.addEventListener(e,o.select)}),o.addEventListener("focusout",a),o.addEventListener("keypress",function(e){"Enter"===e.key&&a()})},s=function(e,t){return e.replace(RegExp("(\\?|&amp;)".concat(t,"=1\\b(?!&amp;)|\\b").concat(t,"=1&amp;")),"")};return{version:"6.5.0",init:function(t){var n,c=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},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 a,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}((t instanceof Element?t:document).querySelectorAll("[data-pagy]"));try{for(c.s();!(n=c.n()).done;){var s=n.value;try{var l=Uint8Array.from(atob(s.getAttribute("data-pagy")),function(e){return e.charCodeAt(0)}),f=e(JSON.parse((new TextDecoder).decode(l))),d=f[0],p=o(f).slice(1);"nav"===d?i(s,p):"combo"===d?a(s,p):"selector"===d?u(s,p):console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",s,d)}catch(t){console.warn("Skipped Pagy.init() for: %o\n%s",s,t)}}}catch(h){c.e(h)}finally{c.f()}}}}(),window.Pagy=a},1121:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.inject()}},{key:"inject",value:function(){if(this.hasSubscriptionMetaTarget){var e=this.element.querySelector(".ag-grid-component-title-group");if(e){var t=this.subscriptionMetaTarget,n=e.querySelector(".billing-history-title");n?n.after(t):e.prepend(t),t.hidden=!1}}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["subscriptionMeta"]},2612:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=".electionbuddy.com",f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),a(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"clear",value:function(){try{document.cookie="".concat("ajs_user_id","=; domain=").concat(l,"; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"),window.localStorage.removeItem("ajs_user_id"),document.cookie="".concat("ajs_anonymous_id","=").concat(crypto.randomUUID(),"; domain=").concat(l,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax; secure"),window.localStorage.removeItem("ajs_anonymous_id")}catch(e){}}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI)},7956:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return b}});var r=n(5396);function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var c=function(){return e=function e(t,n,r,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.selectedItems=[],this.itemCount=0,this.listTarget=t,this.itemsSelectedTextTarget=n,this.selectAllButtonTarget=r,this.moveButtonTarget=o,this.itemCount=this.listTarget.querySelectorAll("li").length},(t=[{key:"selectItem",value:function(e){this.selectedItems.push(e),this.updateState()}},{key:"unselectItem",value:function(e){this.selectedItems=this.selectedItems.filter(function(t){return t!==e}),this.updateState()}},{key:"selectAllItems",value:function(){var e=this;this.listTarget.querySelectorAll("li").forEach(function(t){var n=t.dataset.value;n&&!e.isItemSelected(n)&&(t.classList.add("selected"),e.selectItem(n))})}},{key:"unselectAllItems",value:function(){var e=this;this.listTarget.querySelectorAll("li").forEach(function(t){var n=t.dataset.value;n&&(t.classList.remove("selected"),e.unselectItem(n))})}},{key:"clearSelection",value:function(){this.selectedItems=[],this.updateState()}},{key:"isItemSelected",value:function(e){return this.selectedItems.includes(e)}},{key:"areAllItemsSelected",value:function(){return this.selectedItems.length===this.itemCount}},{key:"getSelectedItems",value:function(){return o(this.selectedItems)}},{key:"updateState",value:function(){this.updateItemsSelectedText(),this.updateMoveButtonState(),this.updateSelectAllButtonText()}},{key:"updateItemsSelectedText",value:function(){this.itemsSelectedTextTarget.innerText="".concat(this.selectedItems.length)}},{key:"updateMoveButtonState",value:function(){0===this.selectedItems.length?this.moveButtonTarget.setAttribute("disabled","disabled"):this.moveButtonTarget.removeAttribute("disabled")}},{key:"updateSelectAllButtonText",value:function(){this.areAllItemsSelected()&&this.itemCount>0?this.selectAllButtonTarget.innerText="Deselect All":this.selectAllButtonTarget.innerText="Select All"}}])&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var f=function(){return e=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.observer=void 0,this.searchBar=t,this.clearButton=n,this.initializeListeners()},(t=[{key:"initializeListeners",value:function(){this.searchBar.addEventListener("keydown",this.handleKeyDown.bind(this)),this.searchBar.addEventListener("focus",this.handleFocus.bind(this)),this.searchBar.addEventListener("input",this.handleInput.bind(this)),this.clearButton.addEventListener("click",this.handleClear.bind(this)),this.checkClearButtonVisibility()}},{key:"handleKeyDown",value:function(e){var t;"Enter"===e.key&&(e.preventDefault(),null===(t=this.searchBar.form)||void 0===t||t.dis
2patchEvent(new CustomEvent("submit",{bubbles:!0,cancelable:!0})))}},{key:"handleFocus",value:function(){this.setupMutationObserver()}},{key:"handleInput",value:function(){this.updateClearButtonVisibility(),this.searchBar.dispatchEvent(new CustomEvent("search",{detail:this.searchBar.value}))}},{key:"handleClear",value:function(){this.searchBar.value="",this.updateClearButtonVisibility(),this.searchBar.dispatchEvent(new CustomEvent("search",{detail:""}))}},{key:"updateClearButtonVisibility",value:function(){this.clearButton.style.display=this.searchBar.value.length>0?"block":"none"}},{key:"checkClearButtonVisibility",value:function(){this.clearButton.style.display=this.searchBar.value.length>0?"block":"none"}},{key:"setupMutationObserver",value:function(){var e=this;this.observer&&this.observer.disconnect(),this.observer=new MutationObserver(function(){var t=e.searchBar.value.length;e.searchBar.focus(),e.searchBar.setSelectionRange(t,t)}),this.observer.observe(document.getElementById("assign-to-organization-modal"),{childList:!0})}}])&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n){return t=y(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var b=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=h(this,t,[].concat(r))).availableListState=void 0,e.assignedListState=void 0,e.availableSearchManager=void 0,e.assignedSearchManager=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.initializeStates(),this.initializeSearchManagers()}},{key:"initializeStates",value:function(){this.availableListState=new c(this.availableListTarget,this.itemsSelectedTextAvailableTarget,this.selectAllButtonAvailableTarget,this.moveButtonAvailableTarget),this.assignedListState=new c(this.assignedListTarget,this.itemsSelectedTextAssignedTarget,this.selectAllButtonAssignedTarget,this.moveButtonAssignedTarget)}},{key:"initializeSearchManagers",value:function(){this.availableSearchManager=new f(this.availableSearchBarTarget,this.availableClearButtonTarget),this.assignedSearchManager=new f(this.assignedSearchBarTarget,this.assignedClearButtonTarget)}},{key:"onMoveButtonClick",value:function(e){"available"===e.currentTarget.dataset.movedirection?this.availableListState.clearSelection():this.assignedListState.clearSelection(),this.updateHiddenFields()}},{key:"onItemClick",value:function(e){var t=e.currentTarget,n=t.dataset,r=n.value,o="available"===n.list?this.availableListState:this.assignedListState;o.isItemSelected(r)?(t.classList.remove("selected"),o.unselectItem(r)):(t.classList.add("selected"),o.selectItem(r)),this.updateHiddenFields()}},{key:"onSelectAllButtonClick",value:function(e){var t=e.currentTarget.dataset,n=(t.value,"available"===t.list?this.availableListState:this.assignedListState);n.areAllItemsSelected()?n.unselectAllItems():n.selectAllItems(),this.updateHiddenFields()}},{key:"updateHiddenFields",value:function(){this.availableListSelectedItemsInputTarget.value=this.availableListState.getSelectedItems().join(","),this.assignedListSelectedItemsInputTarget.value=this.assignedListState.getSelectedItems().join(",")}}])&&d(n.prototype,r),o&&d(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);b.targets=["availableListSelectedItemsInput","assignedListSelectedItemsInput","selectAllButton","availableList","assignedList","selectAllButtonAvailable","selectAllButtonAssigned","moveButtonAvailable","moveButtonAssigned","itemsSelectedTextAvailable","itemsSelectedTextAssigned","availableSearchBar","assignedSearchBar","availableClearButton","assignedClearButton"]},9995:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.disable(),this.validate()}},{key:"changeModel",value:function(){this.hasConfirmInputTarget&&(this.confirmInputTarget.value=""),this.disable()}},{key:"validate",value:function(){if(this.hasSelectTarget&&this.hasConfirmInputTarget&&this.hasSubmitButtonTarget){var e=this.selectTarget.selectedOptions[0],t=e?e.dataset.model:null,n=!!t&&this.confirmInputTarget.value===t;this.submitButtonTarget.disabled=!n}}},{key:"disable",value:function(){this.hasSubmitButtonTarget&&(this.submitButtonTarget.disabled=!0)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["select","confirmInput","submitButton"]},8995:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}n.r(t),n.d(t,{default:function(){return d}});var d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=c(this,t,[].concat(r))).timerId=null,e.boundHandleVisibilityChange=e.handleVisibilityChange.bind(e),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){document.addEventListener("visibilitychange",this.boundHandleVisibilityChange),document.hidden||this.start()}},{key:"disconnect",value:function(){document.removeEventListener("visibilitychange",this.boundHandleVisibilityChange),this.stop()}},{key:"handleVisibilityChange",value:function(){document.hidden?this.stop():(this.refresh(),this.start())}},{key:"start",value:function(){var e=this;null===this.timerId&&(this.timerId=window.setInterval(function(){return e.refresh()},this.intervalValue))}},{key:"stop",value:function(){null!==this.timerId&&(window.clearInterval(this.timerId),this.timerId=null)}},{key:"targetUrl",value:function(){return this.hasUrlValue&&this.urlValue.length>0?this.urlValue:window.location.href}},{key:"refresh",value:(s=r().m(function e(){var t,n,o;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch(this.targetUrl(),{headers:{Accept:"text/html","X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"});case 1:if((t=e.v).ok){e.n=2;break}return e.a(2);case 2:return e.n=3,t.text();case 3:n=e.v,null!==(o=this.parseReplacementContent(n))&&(this.element.innerHTML=o,this.refreshGrids()),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,this,[[0,4]])}),l=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function a(e){i(o,n,r,a,u,"next",e)}function u(e){i(o,n,r,a,u,"throw",e)}a(void 0)})},function(){return l.apply(this,arguments)})},{key:"refreshGrids",value:function(){var e;(null!==(e=this.element.parentElement)&&void 0!==e?e:document).querySelectorAll('[data-controller*="ag-grid"]').forEach(function(e){e.dispatchEvent(new CustomEvent("grid:refresh"))})}},{key:"parseReplacementContent",value:function(e){if(!this.element.i
2d)return null;var t=(new DOMParser).parseFromString(e,"text/html").getElementById(this.element.id);return t?t.innerHTML:null}}],o&&a(n.prototype,o),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,u,s,l}(n(5396).xI);d.values={url:String,interval:{type:Number,default:6e4}}},4183:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return A}});var r=n(8179),o=n(4546),i=n(737),a=n(6935),u=n(2790),c=n(5404);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var f=0,d=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.container=void 0,this.input=void 0,this.list=void 0,this.suggestions=[],this.matches=[],this.highlightedIndex=-1,this.listOpen=!1,this.engaged=!1,this.instanceId=++f,this.inputHandler=function(){t.engaged=!0,t.applyFilter()},this.keydownHandler=function(e){return t.handleKeyDown(e)},this.outsideClickHandler=function(e){t.container.contains(e.target)||t.closeList()}},(t=[{key:"init",value:function(e){var t;this.suggestions=e.getSuggestions?e.getSuggestions():[],this.container=document.createElement("div"),this.container.className="suggestion-cell-editor";var n=e.eGridCell.getBoundingClientRect(),r=window.getComputedStyle(e.eGridCell);this.container.style.width="".concat(n.width,"px"),this.container.style.fontFamily=r.fontFamily,this.container.style.fontSize=r.fontSize,this.container.style.setProperty("--suggestion-cell-editor-row-height","".concat(n.height,"px")),this.container.style.setProperty("--suggestion-cell-editor-padding",r.paddingLeft),this.input=document.createElement("input"),this.input.type="text",this.input.className="suggestion-cell-editor__input",this.input.value=null!==(t=e.value)&&void 0!==t?t:"",this.input.autocomplete="off",this.list=document.createElement("ul"),this.list.className="suggestion-cell-editor__list",this.list.id="suggestion-cell-editor-list-".concat(this.instanceId),this.list.setAttribute("role","listbox"),this.container.appendChild(this.input),this.suggestions.length>0&&(this.input.setAttribute("role","combobox"),this.input.setAttribute("aria-expanded","false"),this.input.setAttribute("aria-controls",this.list.id),this.input.setAttribute("aria-autocomplete","list"),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keydownHandler),document.addEventListener("mousedown",this.outsideClickHandler),this.container.appendChild(this.list))}},{key:"getGui",value:function(){return this.container}},{key:"getValue",value:function(){return this.input.value}},{key:"afterGuiAttached",value:function(){this.input.focus(),this.input.select(),this.suggestions.length>0&&this.applyFilter()}},{key:"isPopup",value:function(){return!0}},{key:"destroy",value:function(){this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keydownHandler),document.removeEventListener("mousedown",this.outsideClickHandler)}},{key:"applyFilter",value:function(){var e=this.input.value.trim().toLowerCase();this.matches=this.rankMatches(e),this.renderList(),this.openList()}},{key:"rankMatches",value:function(e){return""===e?this.suggestions.map(function(e){return{name:e,rank:0}}):this.suggestions.map(function(t){var n=t.toLowerCase().indexOf(e);return-1===n?null:{name:t,rank:0===n?0:1}}).filter(function(e){return null!==e}).sort(function(e,t){return e.rank-t.rank})}},{key:"renderList",value:function(){var e=this;if(this.list.innerHTML="",this.highlightedIndex=this.engaged&&this.matches.length>0?0:-1,0===this.matches.length){var t=document.createElement("li");return t.className="suggestion-cell-editor__empty",t.textContent="no matches",this.list.appendChild(t),void this.updateActiveDescendant()}
2this.matches.forEach(function(t,n){var r=document.createElement("li");r.id=e.rowId(n),r.className="suggestion-cell-editor__option",r.setAttribute("role","option"),r.textContent=t.name,r.addEventListener("mousedown",function(t){t.preventDefault(),e.acceptRow(n)}),e.list.appendChild(r)}),this.updateHighlight()}},{key:"rowId",value:function(e){return"suggestion-cell-editor-option-".concat(this.instanceId,"-").concat(e)}},{key:"updateHighlight",value:function(){var e=this,t=Array.from(this.list.children);t.forEach(function(t,n){var r=n===e.highlightedIndex;t.classList.toggle("suggestion-cell-editor__option--active",r),t.setAttribute("aria-selected",r?"true":"false")});var n=t[this.highlightedIndex];n&&n.scrollIntoView({block:"nearest"}),this.updateActiveDescendant()}},{key:"updateActiveDescendant",value:function(){this.highlightedIndex>=0&&this.highlightedIndex<this.matches.length?this.input.setAttribute("aria-activedescendant",this.rowId(this.highlightedIndex)):this.input.removeAttribute("aria-activedescendant")}},{key:"openList",value:function(){this.listOpen=!0,this.list.classList.add("suggestion-cell-editor__list--open"),this.input.setAttribute("aria-expanded","true")}},{key:"closeList",value:function(){this.listOpen=!1,this.list.classList.remove("suggestion-cell-editor__list--open"),this.input.setAttribute("aria-expanded","false"),this.input.removeAttribute("aria-activedescendant")}},{key:"handleKeyDown",value:function(e){var t=this.matches.length;if("ArrowDown"===e.key||"ArrowUp"===e.key){if(this.engaged=!0,e.preventDefault(),!this.listOpen)return this.applyFilter();if(0===t)return;var n="ArrowDown"===e.key?1:-1,r=this.highlightedIndex<0?1===n?-1:0:this.highlightedIndex;return this.highlightedIndex=(r+n+t)%t,void this.updateHighlight()}"Enter"!==e.key&&"Tab"!==e.key?"Escape"===e.key&&this.listOpen&&(e.stopPropagation(),this.closeList()):this.listOpen&&this.highlightedIndex>=0&&(e.preventDefault(),this.acceptRow(this.highlightedIndex))}},{key:"acceptRow",value:function(e){var t=this.matches[e];t&&(this.input.value=t.name,this.closeList(),this.input.focus())}}])&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function p(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return y(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(y(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,y(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,y(f,"constructor",s),y(s,"constructor",c),c.displayName="GeneratorFunction",y(s,o,"GeneratorFunction"),y(f),y(f,o,"Generator"),y(f,r,function(){return this}),y(f,"toString",function(){return"[object Generator]"}),(v=function(){return{w:i,m:d}})()}function y(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}y=function(e,t,n,r){function i(t,n){y(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},y(e,t,n,r)}function m(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){m(i,r,o,a,u,"next",e)}function u(e){m(i,r,o,a,u,"throw",e)}a(void 0)})}}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?g(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,T(r.key),r)}}function T(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function k(e,t,n){return t=E(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,j()?Reflect.construct(t,n||[],E(e).constructor):t.apply(e,n))}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function S(e,t,n,r){var o=P(E(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function P(){return P="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=E(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},P.apply(null,arguments)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function C(e,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},C(e,t)}var x="api-dashboard:staged-files-changed",A=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=k(this,t,[].concat(r))).errorMap=new Map,e.activeColumnDefs=[],e.lastPasteGrowthNodeIds=null,e.stagedFiles=[],e.pasteNoticeTimer=null,e.gatherListener=null,e.errorsListener=null,e.stagedFilesChangedListener=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&C(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;if(S(t,"connect",this,3)([]),this.hasGridTarget){this.activeColumnDefs=this.columnDefsValue;var n=w(w({theme:i.zA,localeText:a.V,columnDefs:this.buildProvisionColumnDefs(this.activeColumnDefs),rowData:this.buildBlankRows(this.initialBlankRowsValue),domLayout:"autoHeight",suppressColumnVirtualisation:!0,suppressMovableColumns:!0,suppressDragLeaveHidesColumns:!0,suppressRowDrag:!0,rowGroupPanelShow:"never",cellSelection:!0,rowNumbers:{width:50,minWidth:50},stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,processDataFromClipboard:function(t){return e.growGridForPaste(t)},onCellValueChanged:function(t){return e.handleCellValueChanged(t)},onFirstDataRendered:function(){return e.autoSizeNonFlexColumns()},onUndoEnded:function(t){return e.handleUndoEnded(t)},popupParent:document.body,getMainMenuItems:function(t){return e.resetColumnsOnlyMainMenuItems(t)},defaultColDef:{editable:!0,sortable:!1,resizable:!0,suppressMovable:!0,suppressHeaderMenuButton:!0,filterParams:a.m}},this.gridOptionsValue),u.T);this.gridApi=(0,r.Dvw)(this.gridTarget,n),this.gridBlurHandler=function(t){var n,r=t.target;e.gridTarget.contains(r)||null===(n=e.gridApi)||void 0===n||n.clearCellSelection()},document.addEventListener("mousedown",this.gridBlurHandler),this.gatherListener=function(){return e.gatherAndDispatch()},document.addEventListener("gatherHandsontableData",this.gatherListener),this.errorsListener=function(t){var n,r;return e.applyErrors(null!==(n=null===(r=t.detail)||void 0===r?void 0:r.errors)&&void 0!==n?n:[])},this.element.addEventListener("handsontable:errors",this.errorsListener),this.stagedFilesChangedListener=function(t){var n,r;e.stagedFiles=null!==(n=null===(r=t.detail)||void 0===r?void 0:r.files)&&void 0!==n?n:[]},document.addEventListener(x,this.stagedFilesChangedListener)}}},{key:"disconnect",value:function(){this.gatherListener&&(document.removeEventListener("gatherHandsontableData",this.gatherListener),this.gatherListener=null),this.errorsListener&&(this.element.removeEventListener("handsontable:errors",this.errorsListener),this.errorsListener=null),this.stagedFilesChangedListener&&(document.removeEventListener(x,this.stagedFilesChangedListener),this.stagedFilesChangedListener=null),null!==this.pasteNoticeTimer&&(window.clearTimeout(this.pasteNoticeTimer),this.pasteNoticeTimer=null),S(t,"disconnect",this,3)([])}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"gatherRows",value:function(){var e,t=[];return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){e.data&&t.push(e.data)}),t}},{key:"gatherAndDispatch",value:function(){var e=this.gatherNonBlankRows();this.element.dispatchEvent(new CustomEvent("handsontable:data",{detail:{rows:e},bubbles:!0}))}},{key:"gatherNonBlankRows",value:function(){var e,t=this,n=[];return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){if(e.data){var r=e.data;t.rowHasContent(r)&&n.push(r)}}),n}},{key:"buildProvisionColumnDefs",value:function(e){var t=this;
2return e.map(function(e){var n,r=t.resolveColId(e),o=r?null===(n=t.attachmentColumnsValue)||void 0===n?void 0:n[r]:void 0;return w(w(w({},e),t.suggestionEditorFor(e,o)),{},{cellClassRules:_({},"ag-grid-provision-cell--error",function(e){return t.isCellInError(e.node.rowIndex,r)})})})}},{key:"suggestionEditorFor",value:function(e,t){var n,r,o=this;if(Array.isArray(t))return{cellEditor:d,cellEditorParams:{getSuggestions:function(){return o.stagedNamesFor(t)}}};if("suggestionCellEditor"!==e.cellEditor)return{};var i=null!==(n=null===(r=e.cellEditorParams)||void 0===r?void 0:r.values)&&void 0!==n?n:[];return{cellEditor:d,cellEditorParams:{getSuggestions:function(){return i}}}}},{key:"stagedNamesFor",value:function(e){var t=new Set(e);return this.stagedFiles.filter(function(e){return t.has(e.extension)}).map(function(e){return e.name})}},{key:"isCellInError",value:function(e,t){if(null===e||!t)return!1;var n=this.errorMap.get(e);return!!n&&n.has(t)}},{key:"resolveColId",value:function(e){var t;return null!==(t=e.colId)&&void 0!==t?t:"string"===typeof e.field?e.field:void 0}},{key:"getColKeys",value:function(e){var t=this;return e.map(function(e){return t.resolveColId(e)}).filter(function(e){return Boolean(e)})}},{key:"buildBlankRows",value:function(e){var t=this.getColKeys(this.activeColumnDefs);return Array.from({length:Math.max(e,0)},function(){var e={};return t.forEach(function(t){e[t]=""}),e})}},{key:"growGridForPaste",value:function(e){var t;if(!this.gridApi)return e.data;var n=this.gridApi.getFocusedCell();if(!n)return e.data;this.lastPasteGrowthNodeIds=null,this.reportReadOnlyPasteTargets(n.column,e.data);var r=this.gridApi.getDisplayedRowCount(),o=n.rowIndex+e.data.length-r;if(o<=0)return e.data;var i=this.gridApi.applyTransaction({add:this.buildBlankRows(o)});return this.lastPasteGrowthNodeIds=(null!==(t=null===i||void 0===i?void 0:i.add)&&void 0!==t?t:[]).map(function(e){return e.id}).filter(function(e){return void 0!==e}),e.data}},{key:"reportReadOnlyPasteTargets",value:function(e,t){var n,r,o=t.reduce(function(e,t){return Math.max(e,t.length)},0);if(0!==o){var i=new Set(this.getColKeys(this.activeColumnDefs)),a=(null!==(n=null===(r=this.gridApi)||void 0===r?void 0:r.getAllDisplayedColumns())&&void 0!==n?n:[]).filter(function(e){return i.has(e.getColId())}),u=a.findIndex(function(t){return t.getColId()===e.getColId()});if(-1!==u){var c=a.slice(u,u+o).filter(function(e,n){return!1===e.getColDef().editable&&t.some(function(e){var t;return""!==(null!==(t=e[n])&&void 0!==t?t:"").trim()})}).map(function(e){var t;return null!==(t=e.getColDef().headerName)&&void 0!==t?t:e.getColId()});this.showPasteNotice(c)}}}},{key:"showPasteNotice",value:function(e){var t=this;if(this.hasPasteNoticeTarget)if(null!==this.pasteNoticeTimer&&window.clearTimeout(this.pasteNoticeTimer),0!==e.length){var n=e.slice(0,3).join(", "),r=e.length-3,o=r>0?"".concat(n," and ").concat(r," more"):n,i=1===e.length,a="The pasted ".concat(i?"value":"values"," for ").concat(o," ").concat(i?"was":"were"," ignored");this.pasteNoticeTarget.textContent="".concat(a," \u2014 greyed columns cannot be changed."),this.pasteNoticeTarget.hidden=!1,this.pasteNoticeTimer=window.setTimeout(function(){t.pasteNoticeTarget.hidden=!0,t.pasteNoticeTimer=null},1e4)}else this.pasteNoticeTarget.hidden=!0}},{key:"handleUndoEnded",value:function(e){var t=this;if(e.operationPerformed){var n=this.lastPasteGrowthNodeIds;if(this.lastPasteGrowthNodeIds=null,n&&this.gridApi){var r=n.map(function(e){return t.gridApi.getRowNode(e)}).filter(function(e){return!!e});r.length===n.length&&(r.some(function(e){return!e.data||t.rowHasContent(e.data)})||this.gridApi.applyTransaction({remove:r.map(function(e){return e.data})}))}}}},{key:"handleCellValueChanged",value:function(e){this.appendBlankRowIfLastRowFilled(e),this.autoSizeNonFlexColumns()}},{key:"appendBlankRowIfLastRowFilled",value:function(e){if(this.gridApi){var t=this.gridApi.getDisplayedRowCount();null!==e.rowIndex&&e.rowIndex===t-1&&this.rowHasContent(e.data)&&this.gridApi.applyTransaction({add:this.buildBlankRows(1)})}}},{key:"rowHasContent",value:function(e){return Object.values(e).some(function(e){return""!==(null!==e&&void 0!==e?e:"").toString().trim()})}},{key:"clearRows",value:(f=b(v().m(function e(){return v().w(function(e){for(;;)switch(e.n){case 0:if(this.gridApi){e.n=1;break}return e.a(2);case 1:if(!(this.gatherNonBlankRows().length>0)){e.n=3;break}return e.n=2,(0,c.j)({message:"Are you sure you want to clear all rows?"});case 2:if(e.v){e.n=3;break}return e.a(2);case 3:this.gridApi.setGridOption("rowData",this.buildBlankRows(this.initialBlankRowsValue)),this.errorMap=new Map,this.lastPasteGrowthNodeIds=null,this.gridApi.refreshCells({force:!0});case 4:return e.a(2)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"clearValues",value:(l=b(v().m(function e(){var t,n,r,o;return v().w(function(e){for(;;)switch(e.n){case 0:if(this.gridApi){e.n=1;break}return e.a(2);case 1:if(t=new Set(this.valueClearColumnsValue),0!==(n=this.getColKeys(this.activeColumnDefs).filter(function(e){return!t.has(e)})).length){e.n=2;break}return e.a(2);case 2:if(r=[],this.gridApi.forEachNode(function(e){e.data&&r.push(e.data)}),!r.some(function(e){return n.some(function(t){var n;return""!==(null!==(n=e[t])&&void 0!==n?n:"").toString().trim()})})){e.n=4;break}return e.n=3,(0,c.j)({message:"Are you sure you want to clear all values? The ID columns are kept."});case 3:if(e.v){e.n=4;break}return e.a(2);case 4:o=r.map(function(e){var t=w({},e);
2return n.forEach(function(e){t[e]=""}),t}),this.gridApi.setGridOption("rowData",o),this.errorMap=new Map,this.lastPasteGrowthNodeIds=null,this.gridApi.refreshCells({force:!0});case 5:return e.a(2)}},e,this)})),function(){return l.apply(this,arguments)})},{key:"isReady",value:function(){return!!this.gridApi}},{key:"rebuildColumns",value:function(e){if(this.gridApi){this.activeColumnDefs=e.map(function(e){return{colId:e.key,field:e.key,headerName:e.header}});for(var t=this.getColKeys(this.activeColumnDefs),n=this.gatherRows().map(function(e){var n={};return t.forEach(function(t){var r;n[t]=null!==(r=e[t])&&void 0!==r?r:""}),n});n.length<Math.max(this.initialBlankRowsValue,0);)n.push.apply(n,p(this.buildBlankRows(1)));this.errorMap=new Map,this.lastPasteGrowthNodeIds=null,this.gridApi.setGridOption("columnDefs",this.buildProvisionColumnDefs(this.activeColumnDefs)),this.gridApi.setGridOption("rowData",n),this.autoSizeNonFlexColumns()}}},{key:"loadRows",value:function(e){if(this.gridApi){for(var t=this.getColKeys(this.activeColumnDefs),n=(null!==e&&void 0!==e?e:[]).map(function(e){var n={};return t.forEach(function(t){var r;n[t]=(null!==(r=e[t])&&void 0!==r?r:"").toString()}),n});n.length<Math.max(this.initialBlankRowsValue,0);)n.push.apply(n,p(this.buildBlankRows(1)));this.errorMap=new Map,this.gridApi.setGridOption("rowData",n),this.autoSizeNonFlexColumns()}}},{key:"refresh",value:function(){this.autoSizeNonFlexColumns()}},{key:"applyErrors",value:function(e){var t,n=this,r=this.getColKeys(this.activeColumnDefs);
2this.errorMap=new Map,(null!==e&&void 0!==e?e:[]).forEach(function(e){e&&"string"===typeof e.field&&Array.isArray(e.rows)&&(r.includes(e.field)?e.rows.forEach(function(t){var r;if("number"===typeof t){var o=t-1;if(!(o<0)){var i=null!==(r=n.errorMap.get(o))&&void 0!==r?r:new Set;i.add(e.field),n.errorMap.set(o,i)}}}):console.warn('AgGridProvisionComponent: unresolvable field "'.concat(e.field,'" in error contract')))}),null===(t=this.gridApi)||void 0===t||t.refreshCells({force:!0})}}],o&&O(n.prototype,o),s&&O(n,s),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,s,l,f}(o.AgGridBaseController);A.targets=[].concat(p(o.AgGridBaseController.targets),["pasteNotice"]),A.values=w(w({},o.AgGridBaseController.values),{},{initialBlankRows:Number,attachmentColumns:Object,valueClearColumns:Array})},9785:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return L}});var r=n(5396),o=n(7832);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function u(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var s=/^[ \t\r\n]+|[ \t\r\n]+$/g;function l(e){return e.replace(s,"").normalize("NFC")}var f=function(){return u(function e(t,n){i(this,e),this.id=void 0,this.files=void 0,this.status="queued",this.progressPercent=0,this.message=null,this.failureReason=null,this.offerRemove=!1,this.autoRetriesUsed=0,this.xhr=null,this.id=t,this.files=n},[{key:"names",get:function(){return this.files.map(function(e){return l(e.name)})}},{key:"snapshot",value:function(){return{id:this.id,names:this.names,status:this.status,progressPercent:this.progressPercent,message:this.message,failureReason:this.failureReason,offerRemove:this.offerRemove,canRetry:"failed"===this.status}}}])}(),d=function(){return u(function e(t){i(this,e),this.config=void 0,this.batches=[],this.queue=[],this.stagingToken=null,this.nextBatchId=0,this.inFlight=0,this.cancelled=!1,this.config=t},[{key:"currentToken",value:function(){return this.stagingToken}},{key:"allStaged",value:function(){return this.batches.length>0&&this.batches.every(function(e){return"staged"===e.status})}},{key:"pendingNames",value:function(){return this.batches.reduce(function(e,t){return"staged"===t.status?e:e.concat(t.names)},[])}},{key:"start",value:function(e){var t=this;if(0!==e.length){this.cancelled=!1;var n=function(e,t,n){var r=[];return e.forEach(function(e){var o=r.find(function(r){return r.files.length<t&&r.bytes+e.size<=n});o?(o.files.push(e),o.bytes+=e.size):r.push({files:[e],bytes:e.size})}),r.map(function(e){return e.files})}(e,this.config.batchMaxFiles,this.config.batchMaxBytes),r=n.map(function(e){return new f(String(t.nextBatchId++),e)});this.batches=this.batches.concat(r),this.emit(),this.stagingToken?this.enqueue(r):this.openSession(r)}}},{key:"retryBatch",value:function(e){var t=this.batches.find(function(t){return t.id===e});t&&"failed"===t.status&&(t.autoRetriesUsed=0,t.message=null,t.offerRemove=!1,t.failureReason=null,this.enqueue([t]))}},{key:"removeFiles",value:function(e){var t=this,n=new Set(e.map(l)),r=[];this.batches=this.batches.filter(function(e){if("uploading"===e.status)return!0;var o=e.files.length;return e.files=e.files.filter(function(t){return!n.has(l(t.name))||("staged"===e.status&&r.push(l(t.name)),!1)}),e.files.length===o||0!==e.files.length&&("failed"===e.status&&(e.status="queued",e.message=null,e.offerRemove=!1,e.failureReason=null,t.queue.push(e)),!0)}),this.pump(),this.emit(),r.length>0&&this.stagingToken&&this.deleteFiles(r)}},{key:"cancel",value:function(){var e,t;this.cancelled=!0;var n=this.stagingToken;
2this.batches.forEach(function(e){var t;return null===(t=e.xhr)||void 0===t?void 0:t.abort()}),this.batches=[],this.queue=[],this.inFlight=0,this.stagingToken=null,this.emit(),null===(e=(t=this.config).onTotalsChanged)||void 0===e||e.call(t,{count:0,bytes:0}),n&&this.sendXhr("DELETE",this.config.sessionPath,JSON.stringify({staging_token:n}),!0,null,function(){})}},{key:"openSession",value:function(e){var t=this;this.sendXhr("POST",this.config.openPath,"{}",!0,null,function(n){var r;if(201===n.status&&"string"===typeof(null===(r=n.json)||void 0===r?void 0:r.staging_token))return t.stagingToken=n.json.staging_token,void t.enqueue(e);t.batches=t.batches.filter(function(t){return-1===e.indexOf(t)}),t.emit();var o,i=t.classify(n);if("session_invalid"===i)t.config.onSessionInvalid(null!==(o=t.firstErrorMessage(n))&&void 0!==o?o:"upload session is invalid or has expired");else if("server"===i){var a,u;null===(a=(u=t.config).onOpenFailed)||void 0===a||a.call(u,"The server could not open an upload session. Try again in a moment.")}else{var c,s;null===(c=(s=t.config).onOpenFailed)||void 0===c||c.call(s,"Could not open an upload session. Check your connection and try again.")}})}},{key:"enqueue",value:function(e){var t=this;e.forEach(function(e){e.status="queued",t.queue.push(e)}),this.pump()}},{key:"pump",value:function(){for(;this.inFlight<this.config.batchConcurrency&&this.queue.length>0;){var e=this.queue.shift();e&&this.uploadBatch(e)}}},{key:"uploadBatch",value:function(e){var t=this;if(!this.cancelled&&this.stagingToken){this.inFlight+=1,e.status="uploading",e.progressPercent=0,e.message=null,e.offerRemove=!1,this.emit();var n=new FormData;n.append("staging_token",this.stagingToken),e.files.forEach(function(e){return n.append("staged_files[]",e,e.name)}),e.xhr=this.sendXhr("POST",this.config.batchesPath,n,!1,function(n){e.progressPercent=n,t.emit()},function(n){t.inFlight-=1,e.xhr=null,t.handleBatchOutcome(e,n),t.pump()})}}},{key:"handleBatchOutcome",value:function(e,t){if(!this.cancelled){var n,r,o,i,a,u=this.classify(t);if("success"===u)return e.status="staged",e.progressPercent=100,e.message=null,null!==(n=t.json)&&void 0!==n&&n.totals&&(null===(r=(o=this.config).onTotalsChanged)||void 0===r||r.call(o,t.json.totals)),void this.emit();if("session_invalid"===u)return this.stagingToken=null,this.batches.forEach(function(e){var t;return null===(t=e.xhr)||void 0===t?void 0:t.abort()}),this.queue=[],void this.config.onSessionInvalid(null!==(i=this.firstErrorMessage(t))&&void 0!==i?i:"upload session is invalid or has expired");if("validation"===u)return e.status="failed",e.failureReason="validation",e.offerRemove=!0,e.message="".concat(null!==(a=this.firstErrorMessage(t))&&void 0!==a?a:"These files were not accepted."," Retrying the same bytes will fail again -- remove or replace them first."),void this.emit();if(e.failureReason="server"===u?"server":"transport",e.autoRetriesUsed<2)return e.autoRetriesUsed+=1,void this.queue.push(e);e.status="failed",e.offerRemove=!1,e.message="server"===u?"The server could not accept this batch. Nothing from it was saved -- retry this batch.":"Upload failed. Check your connection and retry this batch.",this.emit()}}},{key:"deleteFiles",value:function(e){var t=this,n=JSON.stringify({staging_token:this.stagingToken,names:e});this.sendXhr("DELETE",this.config.filesPath,n,!0,null,function(e){var n,r,o,i;if("session_invalid"===t.classify(e))return t.stagingToken=null,void t.config.onSessionInvalid(null!==(i=t.firstErrorMessage(e))&&void 0!==i?i:"upload session is invalid or has expired");null!==(n=e.json)&&void 0!==n&&n.totals&&(null===(r=(o=t.config).onTotalsChanged)||void 0===r||r.call(o,e.json.totals))})}},{key:"classify",value:function(e){if(e.networkError)return"transport";if(e.status>=500)return"server";if(null===e.json)return"transport";if(200===e.status||201===e.status)return"success";if(422===e.status){var t,n=null===(t=e.json.errors)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.code;return"staging_session_invalid"===n||"already_submitted"===n?"session_invalid":"validation"}return"transport"}},{key:"firstErrorMessage",value:function(e){var t,n;return null!==(t=null===(n=e.json)||void 0===n||null===(n=n.errors)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.message)&&void 0!==t?t:null}},{key:"emit",value:function(){this.config.onBatchesChanged(this.batches.map(function(e){return e.snapshot()}))}},{key:"csrfToken",value:function(){var e,t;return null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:""}},{key:"sendXhr",value:function(e,t,n,r,o,i){var a=new XMLHttpRequest;return a.open(e,t,!0),a.setRequestHeader("X-CSRF-Token",this.csrfToken()),a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.setRequestHeader("Accept","application/json"),r&&a.setRequestHeader("Content-Type","application/json"),o&&a.upload.addEventListener("progress",function(e){e.lengthComputable&&o(Math.round(e.loaded/e.total*100))}),a.onload=function(){var e=null;if(-1!==(a.getResponseHeader("Content-Type")||"").indexOf("application/json"))try{e=JSON.parse(a.responseText)}catch(t){e=null}i({status:a.status,json:e,networkError:!1})},a.onerror=function(){return i({status:0,json:null,networkError:!0})},a.onabort=function(){return i({status:0,json:null,networkError:!0})},a.send(n),a}}])}(),p=["code"];function h(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;
vendor: 4,142 bytes, line 2
2!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return g(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(g(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,g(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,g(f,"constructor",s),g(s,"constructor",c),c.displayName="GeneratorFunction",g(s,o,"GeneratorFunction"),g(f),g(f,o,"Generator"),g(f,r,function(){return this}),g(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:d}})()}function g(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}g=function(e,t,n,r){function i(t,n){g(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},g(e,t,n,r)}function w(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function _(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){w(i,r,o,a,u,"next",e)}function u(e){w(i,r,o,a,u,"throw",e)}a(void 0)})}}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,T(r.key),r)}}function T(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function k(e,t,n){return t=S(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,j()?Reflect.construct(t,n||[],S(e).constructor):t.apply(e,n))}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}
2function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}var E=["information_file","choice_image","choice_pdf"],C=/^[ \t\r\n]+|[ \t\r\n]+$/g,x=200,A=new Set(["desktop.ini","thumbs.db",".ds_store","icon\r"]),R=new Set(["jpg","jpeg","png","pdf"]),L=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=k(this,t,[].concat(r))).subscription=null,e.loading_subscription=null,e.uploadId=null,e.currentUploadMethod="handsontable",e.baseHandsontableColumns=[],e.currentLanguageColumns=[],e.tableRevealed=!1,e.stagedFileSets=new Map,e.stagedFolderNames=new Map,e.stagedNames=new Set,e.lastGatheredRows=[],e.stagedFilesChangeListener=function(t){return e.handleStagedFilesChanged(t)},e.batchTransports=new Map,e.batchChipRefs=new Map,e.degradedInputs=new Set,e.batchCancelListener=function(t){return e.handleBatchCancelClick(t)},e.turboFrameLoadListener=function(){},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this,t=this;this.handleHandsontableData=this.handleHandsontableData.bind(this),this.element.addEventListener("handsontable:data",this.handleHandsontableData),this.turboFrameLoadListener=function(t){var n=t.target;n&&"hot-frame"===n.id&&(e.tableRevealed=!1,e.injectDropdownWhenReady())},document.addEventListener("turbo:frame-load",this.turboFrameLoadListener),this.injectDropdownWhenReady(),this.subscription=o.A.subscriptions.create({channel:"UploadChannel"},{connected:function(){},disconnected:function(){},received:function(e){if("error"===e.status){if(!t.errorMessagesTarget||!e.errors)return;var n="csv"===t.currentUploadMethod?"Please fix the errors in the csv, download the error report for details.":"Please fix the errors in the table, download the error report for details.";t.showErrorMessages(n),t.uploadId=e.upload_id,t.showDownloadErrorOptions(),"handsontable"===t.currentUploadMethod&&t.dispatchHandsontableErrors(e.errors)}else"success"===e.status&&(t.showSuccessMessage(t.uploadSuccessHeading()),t.dispatchHandsontableErrors([]))}}),this.loading_subscription=o.A.subscriptions.create({channel:"UploadLoadingIndicatorChannel"},{connected:function(){},disconnected:function(){},received:function(e){"start"===e.status?NProgress.start():NProgress.done()}})}},{key:"disconnect",value:function(){this.element.removeEventListener("handsontable:data",this.handleHandsontableData),document.removeEventListener("turbo:frame-load",this.turboFrameLoadListener),this.subscription&&(console.log("Unsubscribing from CsvUploadChannel"),this.subscription.unsubscribe(),this.subscription=null),this.loading_subscription&&(console.log("Unsubscribing from ApiDashboardLoadingIndicatorChannel"),this.loading_subscription.unsubscribe(),this.loading_subscription=null)}},{key:"triggerGather",value:function(){document.dispatchEvent(new Event("gatherHandsontableData"))}},{key:"handleHandsontableData",value:function(e){var t,n,r=this.element.querySelector("#handsontable-payload");r&&(r.value=JSON.stringify(e.detail)),this.lastGatheredRows=null!==(t=null===(n=e.detail)||void 0===n?void 0:n.rows)&&void 0!==t?t:[]}},{key:"submitForm",value:function(e){if(this.clearErrorMessages(),this.hideDryRunPanel(),"csv"===this.currentUploadMethod){var t=this.element.querySelector('input[type="file"][name="csv_file"]');
2if(!t||!t.files||0===t.files.length)return e.preventDefault(),e.stopImmediatePropagation(),void this.showErrorMessages("No file uploaded. Please upload your file before validation.")}return this.stagingEnabledValue&&this.blockSubmitForPendingBatches()?(e.preventDefault(),void e.stopImmediatePropagation()):(document.dispatchEvent(new Event("gatherHandsontableData")),"handsontable"===this.currentUploadMethod&&this.runGridAttachmentPreCheck()?(e.preventDefault(),void e.stopImmediatePropagation()):void e.target)}},{key:"submitSingleForm",value:function(e){var t=this;e.preventDefault(),this.hasErrorMessagesSingleTarget&&this.clearSingleErrorMessages();var n=e.currentTarget.closest("form");if(n){var r=new URL(n.action);new FormData(n).forEach(function(e,t){r.searchParams.set(t,e)}),fetch(r.toString()).then(function(){var e=_(b().m(function e(n){var r,o,i,a,u;return b().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n.ok){e.n=5;break}return r="An error occurred",e.p=1,e.n=2,n.json();case 2:o=e.v,r=o.error||r,e.n=4;break;case 3:e.p=3,e.v;case 4:return t.showSingleErrorMessage(r),e.a(2);case 5:if(202!==n.status){e.n=7;break}return e.n=6,n.json();case 6:return i=e.v,t.showSingleQueuedMessage(i.message||"Export queued.",i.report_center_url),e.a(2);case 7:return e.n=8,n.blob();case 8:a=e.v,u=t.filenameFromContentDisposition(n.headers.get("Content-Disposition"))||"download.csv",t.triggerBlobDownload(a,u),t.showSingleSuccessMessage("Download successful!");case 9:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}()).catch(function(){t.showSingleErrorMessage("An unexpected error occurred")})}}},{key:"showSingleQueuedMessage",value:function(e,t){if(this.showSingleSuccessMessage(e),t&&this.hasErrorMessagesSingleTarget){var n=document.createElement("a");n.href=t,n.textContent="Open Report Center",this.errorMessagesSingleTarget.append(" ",n)}}},{key:"filenameFromContentDisposition",value:function(e){if(!e)return null;var t=e.match(/filename\*?=(?:UTF-8'')?"?([^";]+)"?/i);if(!t)return null;try{return decodeURIComponent(t[1])}catch(n){return t[1]}}},{key:"triggerBlobDownload",value:function(e,t){var n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(function(){return URL.revokeObjectURL(n)},0)}},{key:"clearSingleErrorMessages",value:function(){this.hasErrorMessagesSingleTarget&&(this.errorMessagesSingleTarget.innerHTML="")}},{key:"showSingleErrorMessage",value:function(e){this.hasErrorMessagesSingleTarget&&(this.errorMessagesSingleTarget.classList.remove("success-messages"),this.errorMessagesSingleTarget.classList.add("error-messages"),this.errorMessagesSingleTarget.innerHTML=e)}},{key:"showSingleSuccessMessage",value:function(e){this.hasErrorMessagesSingleTarget&&(this.errorMessagesSingleTarget.classList.remove("error-messages"),this.errorMessagesSingleTarget.classList.add("success-messages"),this.errorMessagesSingleTarget.innerHTML=e)}},{key:"handleSuccess",value:function(e){var t=e.target,n=t.classList.contains("handsontable-form"),r=t.classList.contains("csv-upload-form");(n||r)&&(this.errorMessagesTarget.innerText="",n&&this.dispatchHandsontableErrors([]))}},{key:"handleError",value:function(e){var t=e.target,n=v(e.detail,1)[0];this.renderSubmitErrors(t,n)}},{key:"renderSubmitErrors",value:function(e,t){var n,r=e.classList.contains("handsontable-form"),o=e.classList.contains("csv-upload-form");if(r||o){var i=null!==(n=null===t||void 0===t?void 0:t.errors)&&void 0!==n?n:[];if(r&&this.dispatchHandsontableErrors(i),null!==t&&void 0!==t&&t.upload_id){var a="csv"===this.currentUploadMethod?"Please fix the errors in the csv, download the error report for details.":"Please fix the errors in the table, download the error report for details.";this.showErrorMessages(a),this.uploadId=t.upload_id,this.showDownloadErrorOptions()}else this.renderInlineSubmitErrors(i)}}},{key:"renderInlineSubmitErrors",value:function(e){var t=this;if(this.errorMessagesTarget){var n=Array.isArray(e)?e:[e].filter(function(e){return null!==e&&void 0!==e&&""!==e});if(0!==n.length){this.showErrorMessages("".concat(n.length," Error").concat(1===n.length?"":"s"));var r=document.createElement("ul");
2r.className="validation-errors",n.slice(0,x).forEach(function(e){var n=document.createElement("li");n.className="validation-errors__item",n.textContent=t.describeSubmitError(e),r.appendChild(n)}),this.errorMessagesTarget.appendChild(r);var o=n.length-x;if(o>0){var i=document.createElement("div");i.className="validation-errors__remainder",i.textContent="\u2026and ".concat(o," more error").concat(1===o?"":"s"),this.errorMessagesTarget.appendChild(i)}}else this.showErrorMessages("Validation failed, but the response carried no details.")}}},{key:"describeSubmitError",value:function(e){var t,n;if("object"!==typeof e||null===e)return String(e);var r=Array.isArray(e.rows)?e.rows:[],o=r.slice(0,10).join(", "),i=r.length-10,a=r.length>0?"Row".concat(1===r.length?"":"s"," ").concat(o).concat(i>0?" +".concat(i," more"):""," \u2014 "):"",u=e.field?"".concat(e.field,": "):"";return"".concat(a).concat(u).concat(null!==(t=null!==(n=e.message)&&void 0!==n?n:e.code)&&void 0!==t?t:"Invalid value")}},{key:"csrfToken",value:function(){var e,t;return null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:""}},{key:"validateOnly",value:function(e){var t=this;if(e.preventDefault(),this.clearErrorMessages(),this.hideDryRunPanel(),this.hideErrorDownloadLinks(),"csv"===this.currentUploadMethod){var n=this.element.querySelector('input[type="file"][name="csv_file"]');
2if(!n||!n.files||0===n.files.length)return void this.showErrorMessages("No file uploaded. Please upload your file before validation.")}var r=e.currentTarget.closest("form");if(r){"handsontable"===this.currentUploadMethod&&document.dispatchEvent(new Event("gatherHandsontableData"));var o=new FormData(r);fetch(this.tabConfig().urlValidate,{method:"POST",body:o,headers:{Accept:"application/json","X-CSRF-Token":this.csrfToken(),"X-Requested-With":"XMLHttpRequest"}}).then(function(){var e=_(b().m(function e(n){var o;return b().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n.json().catch(function(){return{}});case 1:if(o=e.v,n.ok){e.n=2;break}return t.renderSubmitErrors(r,o),e.a(2);case 2:t.renderDryRunPanel(o);case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(){t.showErrorMessages("An unexpected error occurred while validating.")})}}},{key:"uploadSuccessHeading",value:function(){return this.tabConfig().dryRunUi?"Update - SUCCESS!":"Upload Successful!"}},{key:"renderDryRunPanel",value:function(e){var t,n,r,o=this;if(this.hasDryRunPanelTarget){var i=this.dryRunPanelTarget;i.innerHTML="";var a=document.createElement("div");a.className="dry-run-panel__heading",a.textContent="Validate - SUCCESS!",i.appendChild(a);var u=null!==(t=e.rows)&&void 0!==t?t:[],c=u.filter(function(e){return"noop"!==e.action}),s=u.length-c.length,l=document.createElement("div");if(l.className="dry-run-panel__summary",Object.entries(null!==(n=e.summary)&&void 0!==n?n:{}).forEach(function(e){var t=v(e,2),n=t[0],r=t[1];l.appendChild(o.dryRunSummaryLine(o.humanize(n),r))}),s>0){var f=this.dryRunSummaryLine("Rows not changed",s);f.classList.add("dry-run-panel__summary-line--full"),l.appendChild(f)}if(l.childElementCount>0&&i.appendChild(l),c.length>0){var d=document.createElement("div");d.className="dry-run-panel__details-heading",d.textContent="Details",i.appendChild(d);var p=document.createElement("div");p.className="dry-run-panel__rows",c.slice(0,x).forEach(function(e){var t,n=document.createElement("div");n.className="dry-run-panel__row";var r=(null!==(t=e.changes)&&void 0!==t?t:[]).join(", "),o=null!=e.question_id?"question ".concat(e.question_id).concat(e.answer_id?", answer ".concat(e.answer_id):""):null!=e.vote_id?"vote ".concat(e.vote_id):"\u2014";n.textContent="Row ".concat(e.row,": ").concat(o," \u2014 ").concat(e.action)+(r?" (".concat(r,")"):""),p.appendChild(n)}),i.appendChild(p);var h=c.length-x;if(h>0){var y=document.createElement("div");y.className="dry-run-panel__row-remainder",y.textContent="\u2026and ".concat(h," more row").concat(1===h?"":"s"),i.appendChild(y)}}else if(u.length>0){var m=document.createElement("div");m.className="dry-run-panel__rows-empty",m.textContent="No changes detected \u2014 all ".concat(u.length," row").concat(1===u.length?"":"s"," already match"),i.appendChild(m)}(null!==(r=e.consequences)&&void 0!==r?r:[]).forEach(function(e){var t=document.createElement("div");t.className="dry-run-panel__consequence",t.textContent=o.describeConsequence(e),i.appendChild(t)}),i.classList.remove("hidden")}}},{key:"hideDryRunPanel",value:function(){this.hasDryRunPanelTarget&&(this.dryRunPanelTarget.classList.add("hidden"),this.dryRunPanelTarget.innerHTML="")}},{key:"dryRunSummaryLine",value:function(e,t){var n=document.createElement("div");n.className="dry-run-panel__summary-line";var r=document.createElement("span");r.textContent="".concat(e,": ");var o=document.createElement("span");return o.className="dry-run-panel__summary-value",o.textContent=String(t),n.append(r,o),n}},{key:"humanize",value:function(e){return e.replace(/_/g," ").replace(/^./,function(e){return e.toUpperCase()})}},{key:"describeConsequence",value:function(e){var t=e.code,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,p),r=Object.entries(n).map(function(e){var t=v(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r)}).join(", ");return r?"".concat(t," (").concat(r,")"):String(t)}},{key:"clearErrorMessages",value:function(){this.errorMessagesTarget&&(this.errorMessagesTarget.innerHTML="")}},{key:"dispatchHandsontableErrors",value:function(e){var t=document.querySelector(".handsontable-wrapper");if(t){var n=new CustomEvent("handsontable:errors",{detail:{errors:e},bubbles:!0});t.dispatchEvent(n)}}},{key:"showErrorMessages",value:function(e){this.errorMessagesTarget&&(this.errorMessagesTarget.classList.remove("success-messages"),this.errorMessagesTarget.classList.add("error-messages"),this.errorMessagesTarget.innerHTML=e)}},{key:"showSuccessMessage",value:function(e){this.errorMessagesTarget&&(this.errorMessagesTarget.classList.remove("error-messages"),this.errorMessagesTarget.classList.add("success-messages"),this.errorMessagesTarget.innerHTML=e)}},{key:"injectDropdownWhenReady",value:function(){var e=this.element.querySelector("#handsontable-section .table-action-buttons");e instanceof HTMLElement&&this.addButtons(e)}},{key:"addButtons",value:function(e){var t=document.getElementById("dashboard-dropdown");
2if(t){var n=document.querySelector(".handsontable-submit-container form");n&&(e.prepend(n),e.appendChild(t),t.classList.remove("hidden"))}}},{key:"toggleUploadMethod",value:function(e){this.clearErrorMessages(),this.hideDownloadErrorOptions();var t=e.target;if(t){this.currentUploadMethod="csv"===t.value?"csv":"handsontable",this.repointStagedFilesForm(),this.element.querySelectorAll('input[name="append"]').forEach(function(e){e.setAttribute("form","csv"===t.value?"csv-provision-form":"handsontable-provision-form")});var n=document.getElementById("handsontable-section"),r=document.getElementById("csv-upload-section"),o=document.getElementById("dynamic-columns-picker");if(n&&r){var i=this.tabConfig(),a=i.loadTable,u=i.dynamicLanguageColumns,c=a||u,s=this.element.querySelectorAll(".load-table-btn");"handsontable"===t.value?(c&&!this.tableRevealed||n.classList.remove("hidden"),r.classList.add("hidden"),c&&!this.tableRevealed||null===o||void 0===o||o.classList.remove("hidden"),s.forEach(function(e){return e.classList.remove("hidden")})):"csv"===t.value&&(n.classList.add("hidden"),r.classList.remove("hidden"),null===o||void 0===o||o.classList.add("hidden"),s.forEach(function(e){return e.classList.add("hidden")}))}}}},{key:"toggleAppendMode",value:function(e){var t,n=e.target;n&&this.hasImportantTextTarget&&(this.importantTextTarget.textContent=null!==(t=n.dataset.bannerText)&&void 0!==t?t:"")}},{key:"toggleIdKind",value:function(e){var t,n=e.target;n&&this.hasDownloadIdInputTarget&&(this.downloadIdInputTarget.placeholder=null!==(t=n.dataset.placeholder)&&void 0!==t?t:"")}},{key:"clearFileInput",value:function(){var e=this.element.querySelector('input[type="file"][name="csv_file"]');e&&(e.value="",this.removeButtonTarget.disabled=!0),this.clearErrorMessages()}},{key:"fileSelected",value:function(){this.fileInputTarget.files&&this.fileInputTarget.files.length>0?this.removeButtonTarget.disabled=!1:this.removeButtonTarget.disabled=!0,this.clearErrorMessages()}},{key:"stagedFilesInputTargetConnected",value:function(e){e.addEventListener("change",this.stagedFilesChangeListener),e.setAttribute("form",this.activeProvisionFormId())}},{key:"stagedFilesInputTargetDisconnected",value:function(e){var t;e.removeEventListener("change",this.stagedFilesChangeListener),null===(t=this.batchTransports.get(e))||void 0===t||t.cancel(),this.batchTransports.delete(e),this.batchChipRefs.delete(e),this.degradedInputs.delete(e),this.stagedFileSets.delete(e),this.stagedFolderNames.delete(e)}},{key:"stagingTokenInputTargetConnected",value:function(e){e.setAttribute("form",this.activeProvisionFormId())}},{key:"stagedFilesBatchCancelTargetConnected",value:function(e){e.addEventListener("click",this.batchCancelListener)}},{key:"stagedFilesBatchCancelTargetDisconnected",value:function(e){e.removeEventListener("click",this.batchCancelListener)}},{key:"handleStagedFilesChanged",value:function(e){var t,n,r=this,o=e.target;this.degradedInputs.delete(o);var i=Array.from(null!==(t=o.files)&&void 0!==t?t:[]),a=this.filterFolderSelection(i),u=a.accepted,c=a.skipped,s=a.folderName,l=this.stagingEnabledValue?{maxFiles:this.sessionMaxFilesValue,maxTotalBytes:this.sessionMaxTotalBytesValue}:{maxFiles:this.maxFilesValue,maxTotalBytes:this.maxTotalBytesValue},f=this.validateStagedSelection(u,l).error;if(f){var d;this.stagingEnabledValue&&(null===(d=this.batchTransports.get(o))||void 0===d||d.cancel()),this.stagedFileSets.set(o,[]),this.stagedFolderNames.set(o,null),this.renderStagedList(o,[]),this.renderSummary(o,[],null);var p="".concat(f," (folder contained ").concat(i.length," file").concat(1===i.length?"":"s",")");this.renderCapsMessage(o,p),this.syncInputFiles(o,[])}else if(this.stagedFileSets.set(o,u),this.stagedFolderNames.set(o,s),this.renderStagedList(o,u),this.renderSummary(o,u,s),this.renderSkippedMessage(o,c),this.stagingEnabledValue){this.syncInputFiles(o,[]);var h=this.batchTransportFor(o);h.cancel(),h.start(u)}else this.syncInputFiles(o,u);var v=null!==(n=this.stagedFileSets.get(o))&&void 0!==n?n:[];this.stagedNames=new Set(v.map(function(e){return r.normalizeStagedName(e.name)}
2)),this.dispatchStagedFilesChanged()}},{key:"filterFolderSelection",value:function(e){var t=this,n=[],r=new Set,o=[],i=null;return e.forEach(function(e){if(!t.isIgnorableFolderEntry(e)){var a=t.rejectionReasonFor(e);if(a)o.push({name:t.skippedLabelFor(e),reason:a});else{var u=t.normalizeStagedName(e.name);r.has(u)?o.push({name:t.skippedLabelFor(e),reason:"duplicate name"}):(r.add(u),null===i&&(i=t.folderNameFrom(e)),n.push(e))}}}),{accepted:n,skipped:o,folderName:i}}},{key:"isIgnorableFolderEntry",value:function(e){var t=e.name.toLowerCase();return A.has(t)||t.startsWith("._")}},{key:"rejectionReasonFor",value:function(e){var t=this.webkitRelativePathOf(e);return t&&t.split("/").length>2?"in a subfolder":e.name.startsWith(".")?"hidden":this.isTopLevelAcceptedFile(e)?null:"unsupported type"}},{key:"skippedLabelFor",value:function(e){var t=this.webkitRelativePathOf(e);if(!t)return e.name;var n=t.split("/");return n.length>1?n.slice(1).join("/"):e.name}},{key:"isTopLevelAcceptedFile",value:function(e){var t=this.webkitRelativePathOf(e);if(!t||2!==t.split("/").length)return!1;if(e.name.startsWith("."))return!1;var n=e.name.lastIndexOf(".");if(n<=0)return!1;var r=e.name.slice(n+1).toLowerCase();return R.has(r)}},{key:"folderNameFrom",value:function(e){var t=this.webkitRelativePathOf(e);return(null===t||void 0===t?void 0:t.split("/")[0])||"Selected folder"}},{key:"webkitRelativePathOf",value:function(e){return e.webkitRelativePath}},{key:"renderSkippedMessage",value:function(e,t){var n=this,r=t.length;if(0!==r){var o=this.capsMessageTargetFor(e);if(o){var i=document.createElement("span");i.className="staged-files-skipped-count",i.textContent="".concat(r," file").concat(1===r?"":"s"," skipped");var a=document.createElement("button");a.type="button",a.className="staged-files-skipped-trigger",a.textContent="View Details",a.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),n.showSkippedModal(t)});var u=document.createElement("span");u.className="staged-files-skipped",u.append(i,a),this.renderCapsMessage(e,null,"warning"),o.classList.add("warning-messages"),o.appendChild(u),this.syncDisclosureVisibility(o)}}else this.renderCapsMessage(e,null)}},{key:"showSkippedModal",value:function(e){var t=document.createElement("div");t.className="toolkit-confirm-delete-modal__overlay staged-files-skipped-modal",t.innerHTML='\n      <div class="toolkit-confirm-delete-modal__dialog" role="alertdialog" aria-modal="true">\n        <div class="toolkit-confirm-delete-modal__content">\n          <div class="toolkit-confirm-delete-modal__icon toolkit-confirm-delete-modal__icon--warning">\n            <i class="fas fa-exclamation-triangle" aria-hidden="true"></i>\n          </div>\n          <h3 class="toolkit-confirm-delete-modal__title"></h3>\n          <p class="toolkit-confirm-delete-modal__message"></p>\n          <ul class="staged-files-skipped-modal__list"></ul>\n          <div class="toolkit-confirm-delete-modal__actions">\n            <button type="button" class="toolkit-button-component toolkit-button-component--orange">OK</button>\n          </div>\n        </div>\n      </div>\n    ';var n=1===e.length?"":"s";t.querySelector(".toolkit-confirm-delete-modal__title").textContent="".concat(e.length," file").concat(n," skipped"),t.querySelector(".toolkit-confirm-delete-modal__message").textContent="".concat(1===e.length?"This file was":"The
2se files were"," not staged. Everything else in the folder was.");var r=t.querySelector(".staged-files-skipped-modal__list");e.forEach(function(e){var t=document.createElement("li"),n=document.createElement("span");n.className="staged-files-skipped-modal__name",n.textContent=e.name;var o=document.createElement("span");o.className="staged-files-skipped-modal__reason",o.textContent=e.reason,t.append(n,o),r.appendChild(t)});var o=function(){t.remove(),document.removeEventListener("keydown",i)},i=function(e){"Escape"===e.key&&o()};document.addEventListener("keydown",i),t.addEventListener("click",function(e){e.target===t&&o()}),t.querySelector("button").addEventListener("click",o),document.body.appendChild(t),t.querySelector("button").focus()}},{key:"syncInputFiles",value:function(e,t){try{var n=new DataTransfer;t.forEach(function(e){return n.items.add(e)}),e.files=n.files}catch(r){}0===t.length&&(e.value="")}},{key:"normalizeStagedName",value:function(e){return e.replace(C,"").normalize("NFC")}},{key:"validateStagedSelection",value:function(e,t){var n=this,r=e.map(function(e){return n.normalizeStagedName(e.name)});if(e.length>t.maxFiles)return{names:[],error:"Too many files staged (max ".concat(t.maxFiles,"); ").concat(e.length," selected")};var o=e.reduce(function(e,t){return e+t.size},0);if(o>t.maxTotalBytes)return{names:[],error:"Total staged size ".concat(this.formatBytes(o)," exceeds the ").concat(this.formatBytes(t.maxTotalBytes)," limit")};var i=r.filter(function(t,r){return e[r].size>n.maxFileBytesValue});if(i.length>0)return{names:[],error:"Over the ".concat(this.formatBytes(this.maxFileBytesValue)," per-file limit: ").concat(i.join(", "))};var a=new Set,u=new Set;return r.forEach(function(e){a.has(e)&&u.add(e),a.add(e)}),u.size>0?{names:[],error:"Duplicate staged file name: ".concat(Array.from(u).join(", "))}:{names:r,error:null}}},{key:"formatBytes",value:function(e){if(e<1024)return"".concat(e," B");for(var t=["KB","MB","GB"],n=e/1024,r=0;n>=1024&&r<t.length-1;)n/=1024,r+=1;return"".concat(n.toFixed(1)," ").concat(t[r])}},{key:"sectionFor",value:function(e){return e.closest(".staged-files-section")}},{key:"listTargetFor",value:function(e){var t=this.sectionFor(e);return t?this.stagedFilesListTargets.find(function(e){return t.contains(e)}):void 0}},{key:"capsMessageTargetFor",value:function(e){var t=this.sectionFor(e);return t?this.stagedFilesCapsMessageTargets.find(function(e){return t.contains(e)}):void 0}},{key:"summaryTargetFor",value:function(e){var t=this.sectionFor(e);return t?this.stagedFilesSummaryTargets.find(function(e){return t.contains(e)}):void 0}},{key:"clearTargetFor",value:function(e){var t=this.sectionFor(e);return t?this.stagedFilesClearTargets.find(function(e){return t.contains(e)}):void 0}},{key:"inputForSection",value:function(e){return this.stagedFilesInputTargets.find(function(t){return e.contains(t)})}},{key:"activeProvisionFormId",value:function(){return"csv"===this.currentUploadMethod?"csv-provision-form":"handsontable-provision-form"}},{key:"repointStagedFilesForm",value:function(){var e=this.activeProvisionFormId();this.stagedFilesInputTargets.forEach(function(t){return t.setAttribute("form",e)}),this.stagingTokenInputTargets.forEach(function(t){return t.setAttribute("form",e)})}},{key:"handsontableStagedInput",value:function(){return this.stagedFilesInputTargets[0]}},{key:"renderCapsMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error",r=this.capsMessageTargetFor(e);r&&(r.textContent=null!==t&&void 0!==t?t:"",r.classList.remove("error-messages","warning-messages"),t&&r.classList.add("warning"===n?"warning-messages":"error-messages"),this.syncDisclosureVisibility(r))}},{key:"renderStagedList",value:function(e,t){var n=this,r=this.listTargetFor(e);if(r){r.innerHTML="";var o=new Map;t.forEach(function(t){var i=n.normalizeStagedName(t.name),a=document.createElement("span");a.className="staged-files-list__chip",a.dataset.fileName=i;var u=document.createElement("span");u.className="staged-files-list__chip-label",u.textContent="".concat(i," (").concat(n.formatBytes(t.size),")"),a.appendChild(u);var c=document.createElement("button");if(c.type="button",c.className="staged-files-list__chip-remove",c.textContent="\xd7",c.setAttribute("aria-label","Remove ".concat(i)),c.addEventListener("click",function(){return n.removeStagedFile(e,t)}),a.appendChild(c),n.stagingEnabledValue&&!n.degradedInputs.has(e)){var s=n.appendBatchChipControl
2s(e,a,i);s&&o.set(i,s)}r.appendChild(a)}),this.batchChipRefs.set(e,o),this.updateDisclosure(r,t.length)}}},{key:"appendBatchChipControls",value:function(e,t,n){var r=this.batchChipTemplateFor(e);if(!r)return null;var o=r.content.cloneNode(!0),i=o.querySelector(".staged-files-list__chip-batch-state"),a=o.querySelector(".staged-files-list__chip-batch-progress"),u=o.querySelector(".staged-files-list__chip-batch-progress-bar"),c=o.querySelector(".staged-files-list__chip-batch-retry"),s=o.querySelector(".staged-files-list__chip-batch-remove");return i&&a&&u&&c&&s?(t.appendChild(o),{stateEl:i,progressEl:a,progressBarEl:u,retryBtn:c,removeBtn:s}):null}},{key:"batchChipTemplateFor",value:function(e){var t=this.sectionFor(e);return t?this.stagedFilesBatchChipTemplateTargets.find(function(e){return t.contains(e)}):void 0}},{key:"updateDisclosure",value:function(e,t){var n=e.closest("details");if(n instanceof HTMLDetailsElement){var r=n.querySelector(".staged-files-disclosure__label");r&&(r.textContent="Files (".concat(t,")"),r.classList.toggle("hidden",0===t)),0===t&&(n.open=!1),this.syncDisclosureVisibility(n)}}},{key:"syncDisclosureVisibility",value:function(e){var t,n,r,o=e.closest("details");if(o instanceof HTMLDetailsElement){var i=null===(t=null===(n=o.querySelector(".staged-files-disclosure__label"))||void 0===n?void 0:n.classList.contains("hidden"))||void 0===t||t,a=o.querySelector(".staged-files-caps-message"),u=""!==(null!==(r=null===a||void 0===a?void 0:a.textContent)&&void 0!==r?r:"").trim();o.classList.toggle("hidden",i&&!u),o.classList.toggle("staged-files-disclosure--message-only",i),i&&(o.open=!1)}}},{key:"renderSummary",value:function(e,t,n){var r=this.summaryTargetFor(e),o=this.clearTargetFor(e);if(r&&o){if(0===t.length)return r.textContent="",r.classList.add("hidden"),void o.classList.add("hidden");var i=t.reduce(function(e,t){return e+t.size},0),a=null!==n&&void 0!==n?n:"Selected folder";r.textContent="".concat(a," \xb7 ").concat(t.length," file").concat(1===t.length?"":"s"," \xb7 ").concat(this.formatBytes(i)),r.classList.remove("hidden"),o.classList.remove("hidden")}}},{key:"removeStagedFile",value:function(e,t){var n,r,o,i=this,a=this.normalizeStagedName(t.name),u=(null!==(n=this.stagedFileSets.get(e))&&void 0!==n?n:[]).filter(function(e){return e!==t});this.stagedFileSets.set(e,u),this.renderStagedList(e,u),this.renderSummary(e,u,null!==(r=this.stagedFolderNames.get(e))&&void 0!==r?r:null),this.renderCapsMessage(e,null),this.syncInputFiles(e,this.stagingEnabledValue&&!this.degradedInputs.has(e)?[]:u),this.stagedNames=new Set(u.map(function(e){return i.normalizeStagedName(e.name)})),this.dispatchStagedFilesChanged(),this.stagingEnabledValue&&!this.degradedInputs.has(e)&&(null===(o=this.batchTransports.get(e))||void 0===o||o.removeFiles([a]))}},{key:"clearStagedFilesClick",value:function(e){var t,n=e.currentTarget.closest(".staged-files-section"),r=n?this.inputForSection(n):void 0;r&&(this.stagingEnabledValue&&(null===(t=this.batchTransports.get(r))||void 0===t||t.cancel()),this.clearStagedInput(r))}},{key:"handleBatchCancelClick",value:function(e){var t,n=e.currentTarget.closest(".staged-files-section"),r=n?this.inputForSection(n):void 0;r&&(null===(t=this.batchTransports.get(r))||void 0===t||t.cancel(),this.clearStagedInput(r))}},{key:"clearStagedInput",value:function(e){this.stagedFileSets.set(e,[]),this.stagedFolderNames.set(e,null),this.renderStagedList(e,[]),this.renderSummary(e,[],null),this.renderCapsMessage(e,null),this.syncInputFiles(e,[]),this.stagedNames=new Set,this.dispatchStagedFilesChanged()}},{key:"batchTransportFor",value:function(e){var t=this,n=this.batchTransports.get(e);if(n)return n;var r={openPath:this.stagingOpenPathValue,batchesPath:this.stagingBatchesPathValue,filesPath:this.stagingFilesPathValue,sessionPath:this.stagingCancelPathValue,batchMaxFiles:this.batchMaxFilesValue,batchMaxBytes:this.batchMaxBytesValue,batchConcurrency:this.batchConcurrencyValue,onBatchesChanged:function(n){return t.handleBatchesChanged(e,n)},onSessionInvalid:function(n){return t.handleSessionInvalid(e,n)},onOpenFailed:function(n){return t.handleOpenFailed(e,n)}};return n=new d(r),this.batchTransports.set(e,n),n}},{key:"handleBatchesChanged",value:function(e,t){var n;if(this.updateBatchChipsUI(e,t),this.syncStagingTokenValue(e),this.updateSubmitAvailability(e),this.updateBatchCancelVisibility(e,t),e.disabled=t.some(function(e){return"staged"!==e.status}),t.find(function(e){return"failed"===e.status&&("transport"===e.failureReason||"server"===e.failureReason)})){var r=null!==(n=this.stagedFileSets.get(e))&&void 0!==n?n:[];this.fitsPhase1Caps(r)?this.degradeToPhase1(e,"A batch failed to upload after retrying."):this.renderCapsMessage(e,"A batch failed to upload after retrying. Retry the failed files above, or Clear and pick fewer.","warning")}}},{key:"updateBatchChipsUI",value:function(e,t){var n=this,r=this.batchChipRefs.get(e);
2r&&t.forEach(function(t){t.names.forEach(function(o){var i=r.get(o);i&&(i.stateEl.textContent=n.batchStateLabel(t),i.progressEl.setAttribute("aria-valuenow",String(t.progressPercent)),i.progressBarEl.style.width="".concat(t.progressPercent,"%"),i.retryBtn.classList.toggle("hidden",!t.canRetry),i.retryBtn.onclick=function(){var r;return null===(r=n.batchTransports.get(e))||void 0===r?void 0:r.retryBatch(t.id)},i.removeBtn.classList.toggle("hidden",!t.offerRemove),i.removeBtn.onclick=function(){var t,r=(null!==(t=n.stagedFileSets.get(e))&&void 0!==t?t:[]).find(function(e){return n.normalizeStagedName(e.name)===o});r&&n.removeStagedFile(e,r)})})})}},{key:"batchStateLabel",value:function(e){var t;switch(e.status){case"queued":return"Queued";case"uploading":return"Uploading ".concat(e.progressPercent,"%");case"staged":return"Staged";case"failed":return null!==(t=e.message)&&void 0!==t?t:"Failed";default:return""}}},{key:"updateSubmitAvailability",value:function(e){var t,n,r=(null!==(t=null===(n=this.batchTransports.get(e))||void 0===n?void 0:n.pendingNames().length)&&void 0!==t?t:0)>0;this.submitButtons().forEach(function(e){e.disabled=r})}},{key:"submitButtons",value:function(){return Array.from(this.element.querySelectorAll('.handsontable-submit-container button[type="submit"], .handsontable-submit-container input[type="submit"], .csv-upload-form button[type="submit"], .csv-upload-form input[type="submit"]'))}},{key:"blockSubmitForPendingBatches",value:function(){var e=this.handsontableStagedInput(),t=e?this.batchTransports.get(e):void 0;if(!t)return!1;var n=t.pendingNames();return 0!==n.length&&(this.showErrorMessages("Still uploading: ".concat(n.join(", "),". Wait for every staged file to finish before submitting.")),!0)}},{key:"updateBatchCancelVisibility",value:function(e,t){var n=this.batchCancelTargetFor(e);n&&n.classList.toggle("hidden",!t.some(function(e){return"staged"!==e.status}))}},{key:"batchCancelTargetFor",value:function(e){var t=this.sectionFor(e);return t?this.stagedFilesBatchCancelTargets.find(function(e){return t.contains(e)}):void 0}},{key:"syncStagingTokenValue",value:function(e){var t,n,r=this.stagingTokenInputTargetFor(e);r&&(r.value=null!==(t=null===(n=this.batchTransports.get(e))||void 0===n?void 0:n.currentToken())&&void 0!==t?t:"")}},{key:"stagingTokenInputTargetFor",value:function(e){var t=this.sectionFor(e);return t?this.stagingTokenInputTargets.find(function(e){return t.contains(e)}):void 0}},{key:"handleSessionInvalid",value:function(e,t){this.batchTransports.delete(e),this.batchChipRefs.delete(e),this.degradedInputs.delete(e),this.stagedFileSets.set(e,[]),this.stagedFolderNames.set(e,null),this.renderStagedList(e,[]),this.renderSummary(e,[],null),this.syncInputFiles(e,[]),this.stagedNames=new Set,this.dispatchStagedFilesChanged();var n=this.stagingTokenInputTargetFor(e);n&&(n.value=""),e.disabled=!1,this.updateBatchCancelVisibility(e,[]),this.renderCapsMessage(e,"".concat(t," The upload session expired -- please re-select the folder to re-stage the files."))}},{key:"handleOpenFailed",value:function(e,t){var n,r=null!==(n=this.stagedFileSets.get(e))&&void 0!==n?n:[];this.fitsPhase1Caps(r)?this.degradeToPhase1(e,"Could not start batched upload (".concat(t,").")):(e.disabled=!1,this.renderCapsMessage(e,"Could not start batched upload (".concat(t,"). Re-select the folder to retry, or remove files to fit a single upload.")))}},{key:"fitsPhase1Caps",value:function(e){return!(e.length>this.maxFilesValue)&&e.reduce(function(e,t){return e+t.size},0)<=this.maxTotalBytesValue}},{key:"degradeToPhase1",value:function(e,t){var n,r,o=null!==(n=this.stagedFileSets.get(e))&&void 0!==n?n:[];null===(r=this.batchTransports.get(e))||void 0===r||r.cancel(),this.batchTransports.delete(e),this.batchChipRefs.delete(e),this.degradedInputs.add(e);var i=this.stagingTokenInputTargetFor(e);i&&(i.value=""),e.disabled=!1,this.renderStagedList(e,o),this.updateBatchCancelVisibility(e,[]),this.updateSubmitAvailability(e),this.syncInputFiles(e,o),this.renderCapsMessage(e,"".concat(t," Falling back to a single direct upload for these files."),"warning")}},{key:"dispatchStagedFilesChanged",value:function(){var e=this,t=Array.from(this.stagedNames);this.element.dispatchEvent(new CustomEvent("api-dashboard:staged-files-changed",{detail:{names:t,files:t.map(function(t){return{name:t,extension:e.extensionOf(t)}})},bubbles:!0}))}},{key:"extensionOf",value:function(e){var t=e.lastIndexOf(".");return t<=0?"":e.slice(t+1).toLowerCase()}},{key:"isFilenameCandidate",value:function(e){if(void 0===e||null===e)return!1;var t=this.normalizeStagedName(e);return""!==t&&!t.includes("://")&&!t.startsWith("eb:attachment/")}},{key:"runGridAttachmentPreCheck",value:function(){var e,t=this,n=this.handsontableStagedInput(),r=n&&null!==(e=this.stagedFileSets.get(n))&&void 0!==e?e:[],o=new Set(r.map(function(e){return t.normalizeStagedName(e.name)}
2));if(0===o.size)return!1;var i=[],a=new Set;if(this.lastGatheredRows.forEach(function(e,n){E.forEach(function(r){var u=e[r];if(t.isFilenameCandidate(u)){var c=t.normalizeStagedName(u);a.add(c),o.has(c)||i.push({rows:[n+1],field:r,message:"'".concat(c,"' is not among the staged files.")})}})}),i.length>0)return this.dispatchHandsontableErrors(i),this.showErrorMessages("Please fix the highlighted attachment cells before submitting."),!0;if(n){var u=Array.from(o).filter(function(e){return!a.has(e)});u.length>0?this.renderCapsMessage(n,"Staged but not referenced by any cell: ".concat(u.join(", ")),"warning"):this.renderCapsMessage(n,null)}return!1}},{key:"showDownloadErrorOptions",value:function(){this.element.querySelectorAll(".download-error-csv").forEach(function(e){return e.classList.remove("hidden")}),this.element.querySelectorAll(".download-error-xlsx").forEach(function(e){return e.classList.remove("hidden")})}},{key:"hideDownloadErrorOptions",value:function(){this.hideErrorDownloadLinks(),this.uploadId=null}},{key:"hideErrorDownloadLinks",value:function(){this.element.querySelectorAll(".download-error-csv").forEach(function(e){return e.classList.add("hidden")}),this.element.querySelectorAll(".download-error-xlsx").forEach(function(e){return e.classList.add("hidden")})}},{key:"downloadErrorCsv",value:function(e){if(e.preventDefault(),this.uploadId){var t="/admin/api_dashboard_download/errors?upload_id=".concat(this.uploadId,"&report_format=csv");window.location.href=t}else console.error("No upload ID available for error CSV download.")}},{key:"downloadErrorXlsx",value:function(){if(this.uploadId){var e="/admin/api_dashboard_download/errors?upload_id=".concat(this.uploadId,"&report_format=xlsx");window.location.href=e}else console.error("No upload ID available for error XLSX download.")}},{key:"preloadLanguages",value:function(){var e=this;if(this.clearSingleErrorMessages(),this.hasLanguagePreloadVoteIdTarget){var t=this.languagePreloadVoteIdTarget.value.trim();if(t){var n=this.tabConfig().preloadPath;if(n){var r=new URL(n,window.location.origin);r.searchParams.set("vote_id",t),fetch(r.toString(),{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(){var t=_(b().m(function t(n){var r,o;return b().w(function(t){for(;;)switch(t.n){case 0:if(n.ok){t.n=2;break}return t.n=1,n.json();case 1:return r=t.v,e.showSingleErrorMessage(r.error||"Failed to load languages."),t.a(2);case 2:return t.n=3,n.json();case 3:o=t.v,e.populatePreloadSelect(o.secondary_languages);case 4:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}()).catch(function(){e.showSingleErrorMessage("An unexpected error occurred while loading languages.")})}else this.showSingleErrorMessage("Preload path not configured.")}else this.showSingleErrorMessage("Please enter a Vote ID.")}}},{key:"downloadAndProceed",value:function(){if(this.hasLanguagePreloadVoteIdTarget&&this.hasLanguagePreloadSelectTarget){var e=this.languagePreloadVoteIdTarget.value.trim();if(e){var t=this.languagePreloadSelectTarget,n=Array.from(t.options).filter(function(e){return e.selected}).map(function(e){return e.value});if(0!==n.length){var r=this.tabConfig().downloadUrl;if(r){var o=new URL(r,window.location.origin);o.searchParams.set("vote_id",e),n.forEach(function(e){return o.searchParams.append("languages[]",e)});var i=document.createElement("a");i.href=o.toString(),document.body.appendChild(i),i.click(),document.body.removeChild(i),this.showSingleSuccessMessage("Download successful!")}else this.showSingleErrorMessage("Download path not configured.")}else this.showSingleErrorMessage("Please select at least one language.")}else this.showSingleErrorMessage("Please enter a Vote ID.")}}},{key:"populatePreloadSelect",value:function(e){if(this.hasLanguagePreloadSelectTarget){var t=this.languagePreloadSelectTarget;if($(t).data("select2"))try{$(t).select2("destroy")}catch(n){}t.innerHTML="",e.forEach(function(e){var n=document.createElement("option");n.value=e.code,n.text=e.name,n.selected=!0,t.appendChild(n)}),$(t).select2({placeholder:"Select languages..."}),this.hasLanguagePickerSectionTarget&&(this.languagePickerSectionTarget.classList.remove("hidden"),this.languagePickerSectionTarget.style.display="flex"),this.hasDownloadSubmitButtonTarget&&this.downloadSubmitButtonTarget.classList.remove("hidden")}}},{key:"syncVoteId",value:function(e){var t=e.target.value,n=document.getElementById("handsontable-vote-id-field");n&&(n.value=t);var r=document.getElementById("csv-vote-id-field");r&&(r.value=t)}},{key:"tabConfig",value:function(){var e,t,n,r=document.getElementById("dashboard-tab-config");return{loadTable:"true"===(null===r||void 0===r?void 0:r.dataset.loadTable),dynamicLanguageColumns:"true"===(null===r||void 0===r?void 0:r.dataset.dynamicLanguageColumns),preloadPath:null!==(e=null===r||void 0===r?void 0:r.dataset.preloadPath)&&void 0!==e?e:"",downloadUrl:null!==(t=null===r||void 0===r?void 0:r.dataset.downloadUrl)&&void 0!==t?t:"",urlValidate:null!==(n=null===r||void 0===r?void 0:r.dataset.urlValidate)&&void 0!==n?n:"",dryRunUi:"true"===(null===r||void 0===r?void 0:r.dataset.dryRunUi)}}},{key:"revealGrid",value:function(){var e,t,n;null===(e=document.getElementById("handsontable-section"))||void 0===e||e.classList.remove("hidden"),null===(t=document.querySelector(".handsontable-submit-container"))||void 0===t||t.classList.remove("hidden"),null===(n=this.getHandsontableController())||void 0===n||n.refresh(),this.tableRevealed=!0}},{key:"loadTable",value:function(){var e=this;if(this.clearErrorMessages(),this.hasVoteIdInputTarget){var t=this.voteIdInputTarget.value.trim();t?this.tabConfig().dynamicLanguageColumns?this.loadDynamicLanguageColumns(t,function(){return e.loadTableRows(t)}):this.loadTableRows(t):this.showErrorMessages("Please enter a Vote ID.")}}},{key:"loadTableRows",value:function(e){var t=this,n=this.tabConfig(),r=n.loadTable,o=n.dynamicLanguageColumns,i=n.downloadUrl;if(r)if(i){var a=new URL(i,window.location.origin);a.searchParams.set("vote_id",e),a.searchParams.set("html","false"),o&&this.currentLanguageColumns.forEach(function(e){return a.searchParams.append("languages[]",e.key)}),fetch(a.toString(),{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(){var e=_(b().m(function e(n){var r,o,i,a;return b().w(function(e){for(;;)switch(e.n){case 0:if(n.ok){e.n=2;break}return e.n=1,n.json().catch(function(){return{}});case 1:return i=e.v,t.showErrorMessages(i.error||"Failed to load the table."),e.a(2);case 2:return e.n=3,n.json();case 3:a=e.v,t.revealGrid(),null===(r=t.getHandsontableController())||void 0===r||r.loadRows(null!==(o=a.rows)&&void 0!==o?o:[]);case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(){t.showErrorMessages("An unexpected error occurred while loading the table.")})}else this.showErrorMessages("Download path not configured.");else this.revealGrid()}},{key:"loadDynamicLanguageColumns",value:function(e,t){var n=this,r=this.tabConfig().preloadPath;if(r){var o=new URL(r,window.location.origin);o.searchParams.set("vote_id",e),fetch(o.toString(),{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(){var e=_(b().m(function e(r){var o,i,a,u,c;return b().w(function(e){for(;;)switch(e.n){case 0:if(r.ok){e.n=2;break}return e.n=1,r.json().catch(function(){return{}});case 1:return i=e.v,n.showErrorMessages(i.error||"Failed to load languages."),e.a(2);case 2:return e.n=3,r.json();case 3:a=e.v,n.errorMessagesTarget.innerHTML="",(u=n.getHandsontableController())&&0===n.baseHandsontableColumns.length&&(n.baseHandsontableColumns=n.baseColumnsFrom(u)),c=a.secondary_languages.map(function(e){return e.code}),n.currentLanguageColumns=[],n.initCreateSelect2(a.secondary_languages,c),null===(o=document.getElementById("dynamic-columns-picker"))||void 0===o||o.classList.remove("hidden"),t();case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(){n.showErrorMessages("An unexpected error occurred while loading languages.")})}else this.showErrorMessages("Preload path not configured.")}},{key:"initCreateSelect2",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(this.hasLanguageCreateSelectTarget){var r=this.languageCreateSelectTarget;if($(r).data("select2"))try{$(r).select2("destroy")}catch(i){}r.innerHTML="",e.forEach(function(e){var t=document.createElement("option");t.value=e.code,t.text=e.name,t.selected=n.includes(e.code),r.appendChild(t)});var o=$(r).select2({placeholder:"Select languages..."});o.on("select2:select",function(e){var n=e.params.data.id,r=e.params.data.text;t.currentLanguageColumns.push({key:n,header:r}),t.rebuildHandsontable()}),o.on("select2:unselect",function(e){var n=e.params.data.id;t.currentLanguageColumns=t.currentLanguageColumns.filter(function(e){return e.key!==n}),t.rebuildHandsontable()}),this.currentLanguageColumns=n.map(function(t){var n=e.find(function(e){return e.code===t});return n?{key:t,header:n.name}:null}).filter(function(e){return null!==e}),this.currentLanguageColumns.length>0&&this.rebuildHandsontable()}}},{key:"rebuildHandsontable",value:function(){var e=this,t=this.getHandsontableController();if(t&&t.isReady()){var n=[].concat(h(this.baseHandsontableColumns),h(this.currentLanguageColumns));t.rebuildColumns(n)}else requestAnimationFrame(function(){return setTimeout(function(){return e.rebuildHandsontable()},50)})}},{key:"getHandsontableController",value:function(){var e=this.element.querySelector(".handsontable-wrapper");return e?this.application.getControllerForElementAndIdentifier(e,"admin--apis-dashboards--ag-grid-provision-component--ag-grid-provision-component"):null}},{key:"baseColumnsFrom",value:function(e){var t;return(null!==(t=e.columnDefsValue)&&void 0!==t?t:[]).map(function(e){var t;return{key:null!==(t=e.colId)&&void 0!==t?t:e.field,header:e.headerName}})}}],r&&O(n.prototype,r),i&&O(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);L.targets=["errorMessages","errorMessagesSingle","fileInput","removeButton","languagePreloadVoteId","languagePickerSection","languagePreloadSelect","voteIdInput","languageCreateSelect","downloadIdInput","downloadSubmitButton","importantText","stagedFilesInput","stagedFilesList","stagedFilesCapsMessage","stagedFilesSummary","stagedFilesClear","stagingTokenInput","stagedFilesBatchCancel","stagedFilesBatchChipTemplate","dryRunPanel"],L.values={maxFiles:Number,maxTotalBytes:Number,maxFileBytes:Number,stagingEnabled:Boolean,batchMaxFiles:Number,batchMaxBytes:Number,sessionMaxFiles:Number,sessionMaxTotalBytes:Number,batchConcurrency:Number,sessionExpiry:Number,stagingOpenPath:String,stagingBatchesPath:String,stagingFilesPath:String,stagingCancelPath:String}},1843:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return _}});var r=n(8179),o=n(4546),i=n(737),a=n(6935),u=n(2790);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?s(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n){return t=b(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,n||[],b(e).constructor):t.apply(e,n))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function y(e,t,n,r){var o=m(b(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},m.apply(null,arguments)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}var w,_=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;if(y(t,"connect",this,3)([]),this.hasGridTarget){var n=l({theme:i.HQ,localeText:a.V,columnDefs:this.columnDefsValue,rowData:[],rowClassRules:{has_error:function(e){var t;return"error"===(null===(t=e.data)||void 0===t?void 0:t.row_status)},has_warning:function(e){var t;return"warning"===(null===(t=e.data)||void 0===t?void 0:t.row_status)}},domLayout:"autoHeight",defaultColDef:{resizable:!0,sortable:!0,filter:!0,filterParams:a.m},stopEditingWhenCellsLoseFocus:!0,onCellValueChanged:function(t){e.handleCellValueChanged(t)}},u.T);this.gridApi=(0,r.Dvw)(this.gridTarget,n),this.rowDataUrlValue&&this.fetchRowData()}}},{key:"disconnect",value:function(){y(t,"disconnect",this,3)([])}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"validate",value:function(){var e,t,n=this;if(this.hasValidateUrlValue&&this.validateUrlValue){var r=this.hasValidateButtonTarget?this.validateButtonTarget:null;r&&(r.disabled=!0);var o=null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"";fetch(this.validateUrlValue,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":o},credentials:"same-origin"}).then(function(e){if(!e.ok)throw new Error("Validate failed: ".concat(e.status));return e.json()}).then(function(e){var t=Array.isArray(e.rows)?e.rows:[];n.gridApi&&n.gridApi.setGridOption("rowData",t),n.showValidateStatus(e.valid,e.error_count)}).catch(function(e){console.error("[AiVoterListGridComponent] validate error:",e),n.showValidateStatusError()}).finally(function(){r&&(r.disabled=!1)})}}},{key:"fetchRowData",value:function(){var e=this;this.gridApi&&(this.gridApi.setGridOption("loading",!0),fetch(this.rowDataUrlValue,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){if(!e.ok)throw new Error("Fetch failed: ".concat(e.status));return e.json()}).then(function(t){var n;if(e.gridApi){var r=Array.isArray(t)?t:null!==(n=t.rows)&&void 0!==n?n:[];e.gridApi.setGridOption("rowData",r),e.gridApi.setGridOption("loading",!1),e.autoSizeNonFlexColumns()}}).catch(function(t){var n;console.error("[AiVoterListGridComponent] fetchRowData error:",t),null===(n=e.gridApi)||void 0===n||n.setGridOption("loading",!1)}))}}
2,{key:"handleCellValueChanged",value:function(e){var t,n,r,o=this,i=e.colDef,a=e.newValue,u=e.oldValue,c=e.node,s=null===(t=c.data)||void 0===t?void 0:t.id,l=i.field;if(l&&void 0!==s&&null!==s){var d=this.updateUrlTemplateValue.replace(":id",String(s)),p=null!==(n=null===(r=document.querySelector('meta[name="csrf-token"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"";fetch(d,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":p},credentials:"same-origin",body:JSON.stringify(f({},l,a))}).then(function(e){return e.json().then(function(t){return{ok:e.ok,json:t}})}).then(function(e){var t=e.ok,n=e.json;if(t&&n.row)c.setData(n.row);else{c.setDataValue(l,u);var r=o.extractError(n);console.warn("[AiVoterListGridComponent] update rejected:",r),r&&o.showRowError(c.data,r)}}).catch(function(e){c.setDataValue(l,u),console.error("[AiVoterListGridComponent] PATCH error:",e)})}}},{key:"extractError",value:function(e){return"string"===typeof e.errors?e.errors:e.errors&&"object"===typeof e.errors?Object.values(e.errors).flat().join(", "):"Update failed"}},{key:"showRowError",value:function(e,t){this.gridApi&&this.gridApi.forEachNode(function(t){var n=t.data;n&&n.id===e.id&&t.setData(l(l({},n),{},{row_status:"error"}))})}},{key:"showValidateStatus",value:function(e,t){if(this.hasValidateStatusTarget){var n=this.validateStatusTarget;e?(n.textContent="Valid \u2014 no errors",n.className="ai-voter-list-grid-validate-status inline_success",this.hasDownloadButtonTarget&&(this.downloadButtonTarget.hidden=!0)):(n.textContent="".concat(t," error").concat(1===t?"":"s"," found"),n.className="ai-voter-list-grid-validate-status inline_error",this.hasDownloadButtonTarget&&(this.downloadButtonTarget.hidden=!1))}}},{key:"showValidateStatusError",value:function(){if(this.hasValidateStatusTarget){var e=this.validateStatusTarget;e.textContent="Validation request failed",e.className="ai-voter-list-grid-validate-status inline_error"}}}])&&d(n.prototype,o),c&&d(n,c),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,c}(o.AgGridBaseController);_.targets=[].concat(function(e){if(Array.isArray(e))return c(e)}(w=o.AgGridBaseController.targets)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(w)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(w)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),["grid","validateButton","validateStatus","downloadButton"]),_.values=l(l({},o.AgGridBaseController.values),{},{rowDataUrl:String,updateUrlTemplate:String,validateUrl:String,downloadUrl:String})},8523:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggleContainer",value:function(e){this.readStateContainerTarget.classList.add("hide"),this.changeStateContainerTarget.classList.remove("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["readStateContainer","changeStateContainer"]},6121:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"fileSelected",value:function(){this.fileInputTarget.files&&(this.fileInputTarget.files[0].name,this.fileThumbTarget.innerHTML="<img src='".concat(URL.createObjectURL(this.fileInputTarget.files[0]),'\' width="300" height="200" >'))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["fileThumb","fileInput"]},495:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"fileSelected",value:function(){if(this.fileInputTarget.files){var e=this.fileInputTarget.files[0].name;this.fileNameLabelTarget.innerHTML=e}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["fileNameLabel","fileInput"]},3107:function(e,t,n){"use strict";function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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 a,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).injectedActionsWrapper=null,e.injectedNoticeDesktop=null,e.injectedNoticeMobile=null,e.actionsBtn=null,e.actionsMenu=null,e.outsideClickHandler=null,e.escapeHandler=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;this.hasNavBarTarget&&this.portalNavBar(),this.actionLinksValue.length>0&&this.buildAndInjectActionMenu(),this.toolbarNoticeValue&&this.buildAndInjectToolbarNotice(),this.outsideClickHandler=function(t){var n;e.actionsMenu&&!e.actionsMenu.hidden&&(null!==(n=e.actionsBtn)&&void 0!==n&&n.contains(t.target)||e.actionsMenu.contains(t.target)||e.close())},document.addEventListener("click",this.outsideClickHandler),this.escapeHandler=function(t){"Escape"===t.key&&e.actionsMenu&&!e.actionsMenu.hidden&&e.close()},document.addEventListener("keydown",this.escapeHandler)}},{key:"disconnect",value:function(){var e,t,n;null===(e=this.injectedActionsWrapper)||void 0===e||e.remove(),this.injectedActionsWrapper=null,null===(t=this.injectedNoticeDesktop)||void 0===t||t.remove(),this.injectedNoticeDesktop=null,null===(n=this.injectedNoticeMobile)||void 0===n||n.remove(),this.injectedNoticeMobile=null,this.actionsBtn=null,this.actionsMenu=null,this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.escapeHandler&&(document.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null)}},{key:"handleNavCheckProxy",value:function(e){if(this.secureTallyUrlValue){var t=e.detail.targetHref;this.checkProxyAndRedirect(t)}}},{key:"portalNavBar",value:function(){var e,t=this,n=this.navBarTarget.firstElementChild;if(n){n.addEventListener("shared--searchable-dropdown-component--searchable-dropdown-component:checkProxy",function(e){return t.handleNavCheckProxy(e)});var r=null===(e=this.element.nextElementSibling)||void 0===e?void 0:e.querySelector(".ag-grid-component-title-group");r?r.prepend(n):this.navBarTarget.hidden=!1}}},{key:"buildAndInjectToolbarNotice",value:function(){var e=this,t=this.element.nextElementSibling;if(t){var n=function(t){var n=document.createElement("span");return n.className="result-header__toolbar-notice ".concat(t),n.innerHTML=e.toolbarNoticeValue,n},r=t.querySelector(".ag-grid-component-title-group");null!==r&&void 0!==r&&r.parentElement&&(this.injectedNoticeDesktop=n("result-header__toolbar-notice--desktop"),r.parentElement.insertBefore(this.injectedNoticeDesktop,r.nextSibling));var o=t.querySelector(".ag-grid-component-quick-filter-bar");null!==o&&void 0!==o&&o.parentElement&&(this.injectedNoticeMobile=n("result-header__toolbar-notice--mobile"),o.parentElement.insertBefore(this.injectedNoticeMobile,o.nextSibling))}}},{key:"buildAndInjectActionMenu",value:function(){var e,t=this,n=document.createElement("div");n.className="result-header__actions-wrapper";var o=document.createElement("button");o.type="button",o.className="result-header__actions-btn",o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.innerHTML='Actions <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
2',o.addEventListener("click",function(){return t.toggle()}),this.actionsBtn=o;var i=document.createElement("div");i.className="result-header__actions-dropdown",i.hidden=!0;var a,u=r(this.actionLinksValue);try{var c=function(){var e=a.value;if(e.divider){var n=document.createElement("hr");n.className="result-header__actions-divider",i.appendChild(n)}else{var r,o,u=document.createElement("a");if(u.href=null!==(r=e.url)&&void 0!==r?r:"#",u.className="result-header__actions-option",e.icon){var c=document.createElement("i");c.className="fas fa-".concat(e.icon),c.setAttribute("aria-hidden","true"),u.appendChild(c)}var s=document.createElement("span");s.textContent=null!==(o=e.label)&&void 0!==o?o:"",u.appendChild(s),"jquery"===e.modal?u.rel="modal:open":"turbo"===e.modal&&(u.dataset.turbo="true",u.dataset.turboFrame="modal"),e.checkProxy&&t.secureTallyUrlValue?u.addEventListener("click",function(n){n.preventDefault(),t.close(),t.checkProxyAndRedirect(e.url)}):e.warningModal?u.addEventListener("click",function(n){var r;n.preventDefault(),t.close(),t.showWarningModal([{text:e.warningModal.message,red:!0}],null!==(r=e.warningModal.confirmLabel)&&void 0!==r?r:"OK",function(){var n;return t.submitWithMethod(e.url,null!==(n=e.method)&&void 0!==n?n:"get")},{title:e.warningModal.title,confirmFirst:!0})}):(e.method&&(u.dataset.method=e.method),e.confirm&&(u.dataset.confirm=e.confirm)),i.appendChild(u)}};for(u.s();!(a=u.n()).done;)c()}catch(l){u.e(l)}finally{u.f()}this.actionsMenu=i,n.appendChild(o),n.appendChild(i),this.injectedActionsWrapper=n;var s=null===(e=this.element.nextElementSibling)||void 0===e?void 0:e.querySelector(".ag-grid-component-search-row");s?s.prepend(n):this.hasNavBarTarget?(this.navBarTarget.hidden=!1,this.navBarTarget.appendChild(n)):(n.classList.add("result-header__actions-inline"),this.element.appendChild(n))}},{key:"toggle",value:function(){var e;this.actionsMenu&&(this.actionsMenu.hidden?(this.actionsMenu.hidden=!1,null===(e=this.actionsBtn)||void 0===e||e.setAttribute("aria-expanded","true")):this.close())}},{key:"close",value:function(){var e;this.actionsMenu&&(this.actionsMenu.hidden=!0,null===(e=this.actionsBtn)||void 0===e||e.setAttribute("aria-expanded","false"))}},{key:"checkProxyAndRedirect",value:function(e){var t=this;fetch(this.secureTallyUrlValue,{headers:{Accept:"application/json"}}).then(function(e){return e.json()}).then(function(n){n.allow_redirect?window.location.href=e:n.low_security_with_proxy?t.showProxyModal(e):t.showBallotModal(n.votes_remaining,e,n.proxy_opened)})}},{key:"showProxyModal",value:function(e){this.showWarningModal([{text:"This vote has proxy vote active.\nIf the results are viewed, the administrator won't be able to record the proxy vote.",red:!0}],"Close Proxy Entry",function(){window.location.href=e},{title:"Close Proxy Entry and View Results",confirmFirst:!0})}},{key:"showBallotModal",value:function(e,t,n){var r=[{text:"".concat(e," voters have not voted. These voters may submit paper ballots.")},{text:"If results are viewed, no more paper ballots can be recorded by administrators",red:!0}];n&&r.push({text:"This vote has proxy vote active.\nIf the results are viewed, the administrator won't be able to record the proxy vote.",red:!0}),this.showWarningModal(r,"Close Paper Ballot Entry",function(){window.location.href=t},{title:"Close Paper Ballot Entry and View Results",confirmFirst:!0})}},{key:"showWarningModal",value:function(e,t,n){var o,i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=a.title,c=void 0===u?"Warning":u,s=a.confirmFirst,l=void 0!==s&&s;null===(o=document.getElementById("proxy-warning-modal-overlay"))||void 0===o||o.remove(),null===(i=document.getElementById("proxy-warning-modal-style"))||void 0===i||i.remove();var f=document.createElement("style");f.id="proxy-warning-modal-style",f.textContent="\n      @media (max-width: 620px) {\n        #proxy-warning-modal-overlay .toolkit-confirm-delete-modal__actions {\n          flex-direction: column;\n        }\n        #proxy-warning-modal-overlay .toolkit-confirm-delete-modal__actions > * {\n          width: 100%;\n          white-space: normal;\n        }\n      }\n    ",document.head.appendChild(f);var d=document.createElement("div");d.id="proxy-warning-modal-overlay",d.className="toolkit-confirm-delete-modal__overlay";var p=document.createElement("div");p.className="toolkit-confirm-delete-modal__dialog",p.style.maxWidth="620px",p.setAttribute("role","alertdialog"),p.setAttribute("aria-modal","true");var h=document.createElement("div");h.className="toolkit-confirm-delete-modal__content";var v=document.createElement("div");v.className="toolkit-confirm-delete-modal__icon toolkit-confirm-delete-modal__icon--warning",v.innerHTML='<i class="fas fa-exclamation-triangle"></i>';var y=document.createElement("h3");y.className="toolkit-confirm-delete-modal__title",y.textContent=c,h.appendChild(v),h.appendChild(y);var m,b=r(e);try{var g=function(){var e=m.value,t=document.createElement("p");t.className="toolkit-confirm-delete-modal__message",t.style.fontSize="1.5rem",e.red&&(t.style.cssText="color: #dc2626; font-weight: 500; font-size: 1.5rem;");var n=e.text.split("\n");
2n.forEach(function(e,r){t.appendChild(document.createTextNode(e)),r<n.length-1&&t.appendChild(document.createElement("br"))}),h.appendChild(t)};for(b.s();!(m=b.n()).done;)g()}catch(k){b.e(k)}finally{b.f()}var w=document.createElement("div");w.className="toolkit-confirm-delete-modal__actions";var _=function(){d.remove(),f.remove()},O=document.createElement("button");O.className="toolkit-button-component toolkit-button-component--blue-stroke",O.type="button",O.textContent="Cancel",O.addEventListener("click",_);var T=document.createElement("button");T.className="toolkit-button-component toolkit-button-component--orange",T.type="button",T.textContent=t,T.addEventListener("click",function(){_(),n()}),l?(w.appendChild(T),w.appendChild(O)):(w.appendChild(O),w.appendChild(T)),h.appendChild(w),p.appendChild(h),d.appendChild(p),d.addEventListener("click",function(e){e.target===d&&_()}),document.body.appendChild(d)}},{key:"submitWithMethod",value:function(e,t){var n=document.createElement("form");n.action=e,n.method=["get","post"].includes(t.toLowerCase())?t.toLowerCase():"post";var r=document.querySelector('meta[name="csrf-token"]');if(r){var o=document.createElement("input");o.type="hidden",o.name="authenticity_token",o.value=r.content,n.appendChild(o)}if(!["get","post"].includes(t.toLowerCase())){var i=document.createElement("input");i.type="hidden",i.name="_method",i.value=t,n.appendChild(i)}document.body.appendChild(n),n.submit()}}],o&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.values={actionLinks:Array,toolbarNotice:String,secureTallyUrl:String},f.targets=["navBar"]},7711:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).documentClickHandler=null,e.escapeHandler=null,e.resizeHandler=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.documentClickHandler=function(t){e.element.contains(t.target)||e.closeAllDropdowns()},document.addEventListener("click",this.documentClickHandler),this.escapeHandler=function(t){"Escape"===t.key&&e.closeAllDropdowns()},document.addEventListener("keydown",this.escapeHandler),this.resizeHandler=function(){return e.openDropdowns().forEach(function(t){return e.clampToViewport(t)})},window.addEventListener("resize",this.resizeHandler)}},{key:"disconnect",value:function(){this.documentClickHandler&&(document.removeEventListener("click",this.documentClickHandler),this.documentClickHandler=null),this.escapeHandler&&(document.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null)}},{key:"onBarClick",value:function(e){var t=e.target;if(!t.closest(".ag-grid-component-export-dropdown")){var n=t.closest("[data-results-toolbar-dropdown-toggle]"),r=n?this.dropdownFor(n):null,o=!!r&&!r.hidden;this.closeAllDropdowns(),n&&r&&!o&&(r.hidden=!1,n.setAttribute("aria-pressed","true"),this.clampToViewport(r))}}},{key:"clampToViewport",value:function(e){this.clearClamp(e);var t=document.documentElement.clientWidth-8,n=t-8;e.getBoundingClientRect().width>n&&(e.style.minWidth="".concat(n,"px"),e.style.maxWidth="".concat(n,"px"));var r=e.getBoundingClientRect(),o=Math.min(0,t-r.right);0!==(o+=Math.max(0,8-(r.left+o)))&&(e.style.transform="translateX(".concat(Math.round(o),"px)"))}},{key:"clearClamp",value:function(e){e.style.removeProperty("transform"),e.style.removeProperty("min-width"),e.style.removeProperty("max-width")}},{key:"openDropdowns",value:function(){return Array.from(this.element.querySelectorAll(".ag-grid-component-export-dropdown")).filter(function(e){return!e.hidden})}},{key:"dropdownFor",value:function(e){var t,n;return null!==(t=null===(n=e.parentElement)||void 0===n?void 0:n.querySelector(".ag-grid-component-export-dropdown"))&&void 0!==t?t:null}},{key:"closeAllDropdowns",value:function(){var e=this;this.element.querySelectorAll(".ag-grid-component-export-dropdown").forEach(function(t){t.hidden=!0,e.clearClamp(t)}),this.element.querySelectorAll("[data-results-toolbar-dropdown-toggle]").forEach(function(e){return e.setAttribute("aria-pressed","false")})}}],r&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI)},8425:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.returnCheckboxTarget.checked&&document.getElementById("returnAddressFields").classList.remove("hidden"),this.remitCheckboxTarget.checked&&document.getElementById("remitAddressFields").classList.remove("hidden"),this.electionIdFieldTarget.addEventListener("change",function(t){e.updateDownloadLink()}),this.downloadElectionDataLinkTarget.addEventListener("click",function(t){e.electionIdFieldTarget.value?(e.csvFilenameTarget.innerHTML="election_".concat(e.electionIdFieldTarget.value,".csv"),e.useElectionFieldTarget.value=String(!0)):(t.preventDefault(),alert("Please select an election"))}),this.updateDownloadLink()}},{key:"updateDownloadLink",value:function(){var e=this.electionIdFieldTarget.value;this.downloadElectionDataLinkTarget.href="/admin/postal_batches/".concat(this.data.get("postal-batch-id-value"),"/elections/").concat(e,"/csv_download"),this.editElectionLinkTarget.href="/admin/elections/".concat(e,"/edit")}},{key:"toggleReturnAddressFields",value:function(e){var t=e.target,n=document.getElementById("returnAddressFields");t.checked?n.classList.remove("hidden"):n.classList.add("hidden")}},{key:"toggleRemitAddressFields",value:function(e){var t=e.target,n=document.getElementById("remitAddressFields");t.checked?n.classList.remove("hidden"):n.classList.add("hidden")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["returnCheckbox","remitCheckbox","electionIdField","downloadElectionDataLink","csvFilename","useElectionField","editElectionLink"]},3269:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function u(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return a(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(a(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,a(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,a(p,"constructor",f),a(f,"constructor",l),l.displayName="GeneratorFunction",a(f,o,"GeneratorFunction"),a(p),a(p,o,"Generator"),a(p,r,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(i=function(){return{w:u,m:h}})()}function a(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}a=function(e,t,n,r){function i(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},a(e,t,n,r)}function u(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,c,"next",e)}function c(e){u(i,r,o,a,c,"throw",e)}a(void 0)})}}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function f(e,t,n){return t=p(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}n.r(t),n.d(t,{default:function(){return v}});var v=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=f(this,t,[].concat(r))).abortController=null,e.regionNames={na:"\ud83c\udde8\ud83c\udde6 North America",ca:"\ud83c\udde8\ud83c\udde6 North America",eu:"\ud83c\uddea\ud83c\uddfa Europe"},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){this.hideAll(),this.clearButtonTarget.hidden=!0,this.checkClipboardOnLoad()}},{key:"checkClipboardOnLoad",value:(l=c(i().m(function e(){var t,n;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,navigator.clipboard&&navigator.clipboard.readText){e.n=1;break}return e.a(2);case 1:return e.n=2,navigator.clipboard.readText();case 2:t=e.v,(n=null===t||void 0===t?void 0:t.trim())&&this.isGlobalId(n)&&(this.inputTarget.value=n,this.clearButtonTarget.hidden=!1,this.processInput(n)),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,this,[[0,3]])})),function(){return l.apply(this,arguments)})},{key:"onPaste",value:function(e){var t,n=this,r=null===(t=e.clipboardData)||void 0===t||null===(t=t.getData("text"))||void 0===t?void 0:t.trim();r&&setTimeout(function(){n.processInput(r)},10)}},{key:"onInput",value:function(){var e=this.inputTarget.value.trim();0===e.length?(this.hideAll(),this.clearButtonTarget.hidden=!0):(this.clearButtonTarget.hidden=!1,this.isGlobalId(e)?this.processInput(e):this.hideAll())}},{key:"clear",value:function(){this.inputTarget.value="",this.hideAll(),this.clearButtonTarget.hidden=!0,this.inputTarget.focu
2s(),this.abortController&&(this.abortController.abort(),this.abortController=null)}},{key:"isGlobalId",value:function(e){return/^[a-z]{2}_[a-z]{3}_[a-z0-9]{26}$/i.test(e)}},{key:"parseGlobalId",value:function(e){if(!this.isGlobalId(e))return null;var t=r(e.toLowerCase().split("_"),3);return{region:t[0],model:t[1],uuid:t[2]}}},{key:"processInput",value:(u=c(i().m(function e(t){var n,r,o,a;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=this.parseGlobalId(t)){e.n=1;break}return this.hideAll(),e.a(2);case 1:return this.abortController&&this.abortController.abort(),this.showLoading(),this.abortController=new AbortController,e.p=2,e.n=3,fetch("".concat(this.urlValue,"?global_id=").concat(encodeURIComponent(t)),{method:"GET",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"},signal:this.abortController.signal});case 3:return r=e.v,e.n=4,r.json();case 4:(o=e.v).found?this.showResult(o,n):this.showNotFound(o.error||"Record not found"),e.n=7;break;case 5:if(e.p=5,"AbortError"!==(a=e.v).name){e.n=6;break}return e.a(2);case 6:console.error("Smart search error:",a),this.showNotFound("An error occurred while searching");case 7:return e.p=7,this.abortController=null,e.f(7);case 8:return e.a(2)}},e,this,[[2,5,7,8]])})),function(e){return u.apply(this,arguments)})},{key:"showLoading",value:function(){this.hideAll(),this.loadingTarget.hidden=!1}},{key:"showNotFound",value:function(e){this.hideAll(),this.notFoundMessageTarget.textContent=e,this.notFoundTarget.hidden=!1}},{key:"showResult",value:function(e,t){this.hideAll();var n=this.regionNames[t.region]||t.region.toUpperCase();this.badgeTarget.textContent=e.type_display,this.regionTarget.textContent=n,this.globalIdTarget.textContent=e.global_id,this.nameTarget.textContent=e.name||"N/A",this.emailTarget.textContent=e.email||"N/A",this.renderActions(e),this.resultsTarget.hidden=!1}},{key:"renderActions",value:function(e){var t=this;this.actionsContainerTarget.innerHTML="",e.actions.forEach(function(e){var n=document.createElement("a");n.href=e.url,n.target="_blank",n.className="toolkit-smart-search__results-link","impersonate"===e.type&&n.classList.add("toolkit-smart-search__results-link--impersonate"),n.textContent="".concat(e.label," \u2192"),t.actionsContainerTarget.appendChild(n)})}},{key:"hideAll",value:function(){this.loadingTarget.hidden=!0,this.notFoundTarget.hidden=!0,this.resultsTarget.hidden=!0}}],o&&s(n.prototype,o),a&&s(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a,u,l}(n(5396).xI);v.targets=["input","clearButton","loading","notFound","notFoundMessage","results","badge","region","globalId","name","email","actionsContainer"],v.values={url:String}},2460:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).clickOutsideListener=void 0,e.keyDownListener=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.clickOutsideListener=function(t){return e.handleClickOutside(t)},this.keyDownListener=function(t){return e.handleKeyDown(t)}}},{key:"disconnect",value:function(){this.removeGlobalListeners()}},{key:"toggle",value:function(e){e.preventDefault(),e.stopPropagation(),this.isOpen()?this.close():this.open()}},{key:"open",value:function(){this.menuTarget.classList.add("open"),this.arrowTarget.classList.add("open-up"),document.addEventListener("click",this.clickOutsideListener),document.addEventListener("keydown",this.keyDownListener)}},{key:"close",value:function(){this.menuTarget.classList.remove("open"),this.arrowTarget.classList.remove("open-up"),this.removeGlobalListeners()}},{key:"isOpen",value:function(){return this.menuTarget.classList.contains("open")}},{key:"handleClickOutside",value:function(e){this.element.contains(e.target)||this.close()}},{key:"handleKeyDown",value:function(e){"Escape"===e.key&&this.close()}},{key:"removeGlobalListeners",value:function(){document.removeEventListener("click",this.clickOutsideListener),document.removeEventListener("keydown",this.keyDownListener)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["menu","arrow"]},6997:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).SUBMIT_DELAY=200,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.IndustryFieldSetup()}},{key:"IndustryFieldSetup",value:function(){var e=this,t=(0,o.T)();t&&this.element.querySelectorAll("select").forEach(function(n){t(n).on("change",function(t){setTimeout(function(){e.formTarget.requestSubmit()},e.SUBMIT_DELAY)})})}},{key:"handleCheckboxChange",value:function(e){this.formTarget.requestSubmit()}},{key:"handleDeleteUser",value:function(e){confirm("Are you sure you want to delete this user? This action cannot be undone.")&&this.formTarget.requestSubmit()}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["form","deleteUserCheckbox"]},2952:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.organizationsTarget.addEventListener("change",this.organizationSelected.bind(this))}},{key:"organizationSelected",value:function(){var e=window.location.href;Turbo.visit("/admin/vote_boxes/render_users?organization_id=".concat(this.organizationsTarget.value),{action:"replace"}),history.pushState(null,null,e)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["organizations"]},5366:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.organizationsTarget.addEventListener("change",this.organizationSelected.bind(this))}},{key:"organizationSelected",value:function(){var e=window.location.href;Turbo.visit("/admin/vote_boxes/render_users?organization_id=".concat(this.organizationsTarget.value),{action:"replace"}),history.pushState(null,null,e)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["organizations"]},5889:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"clickClipboardButton",value:function(e){var t=this;e.preventDefault(),navigator.clipboard.writeText(this.uriHiddenInputTarget.value),this.clipboardButtonTarget.innerText="Copied!",setTimeout(function(){t.clipboardButtonTarget.innerText="Copy Code"},3e3)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["clipboardButton","uriHiddenInput"]},773:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return w}});var r=n(5396),o=n(7832);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function f(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return d(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(d(t={},r,function(){return this}),t),p=s.prototype=u.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,d(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=s,d(p,"constructor",s),d(s,"constructor",c),c.displayName="GeneratorFunction",d(s,o,"GeneratorFunction"),d(p),d(p,o,"Generator"),d(p,r,function(){return this}),d(p,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:h}})()}function d(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}d=function(e,t,n,r){function i(t,n){d(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},d(e,t,n,r)}function p(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}var h=function(e){var t=Math.min(e,20);return Math.min(28+24*t,508)},v='Your voter list is empty. Add at least one voter, then select "Validate list" again.',y="append-voters--voters-grid-component--voters-grid-component",m="application--toolkit--drop-zone-component--drop-zone-component",b=function(){var e=document.querySelector('meta[name="csrf-token"]');return e&&e.getAttribute("content")||""},g=function(e,t){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":b()},body:JSON.stringify(t),credentials:"same-origin"}).then(function(){var e,t=(e=f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}return e.a(2,Promise.reject({status:t.status,body:n}));case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,u,"next",e)}function u(e){p(i,r,o,a,u,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}())},w=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).validationId=null,e.voterListUploadId=null,e.hotInitialized=!1,e.validating=!1,e.listValidated=!1,e.channel=null,e.hot=null,e.importMethod=null,e.statusPollTimer=null,e.statusPollGeneration=0,e.beforeStreamRenderListener=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.validationId=null,this.hotInitialized=!1,this.channel=this.createSubscription(),this.beforeStreamRenderListener=this.handleBeforeStreamRender.bind(this),document.addEventListener("turbo:before-stream-render",this.beforeStreamRenderListener),this.resetUI();var e=this.element.querySelector('input[name="append_import_method"]:checked');e?(this.importMethod=e.value,this.showMethodPanels(e.value),"typing_or_copying"===e.value&&this.initHot()):this.showMethodPanels(null)}},{key:"disconnect",value:function(){this.stopStatusPolling(),this.beforeStreamRenderListener&&(document.removeEventListener("turbo:before-stream-render",this.beforeStreamRenderListener),this.beforeStreamRenderListener=null),this.channel&&(this.channel.unsubscribe(),this.channel=null),this.hot&&(this.hot.destroy(),this.hot=null),this.hotInitialized=!1}},{key:"selectMethod",value:function(e){var t=e.target.value;this.importMethod=t,this.showMethodPanels(t),this.resetUI(),"typing_or_copying"===t&&this.initHot()}},{key:"revalidate",value:function(e){"typing_or_copying"!==this.importMethod?this.validateIngestionList(e):this.validateTypingList(e)}},{key:"handleListEdited",value:function(){this.listValidated&&!this.validating&&this.markListStale()}},{key:"validateTypingList",value:function(e){if(e&&e.preventDefault&&e.preventDefault(),this.element.querySelector('[data-controller~="'.concat(y,'"]'))){var t=this.gridController();if(!t)return void this.showError("Please wait for the table to finish loading.");t.clearRowErrors();var n=t.gatherRows();return n.length?(this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!0),void this.submitIngestion({source:"inline_rows",source_params:{rows:n}})):void this.showError(v)}if(this.hot){var r=(this.hotConfigValue.columns||[]).map(function(e){return e.data}),o=this.hot.getData().filter(function(e){return e.some(function(e){return null!==e&&void 0!==e&&""!==e})}).map(function(e){var t={};return r.forEach(function(n,r){var o=e[r];t[n]=null!==o&&void 0!==o?String(o):null}),t});o.length?(this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!0),this.submitIngestion({source:"inline_rows",source_params:{rows:o}})):this.showError(v)}else this.showError("Please wait for the table to finish loading.")}},{key:"markGridErrors",value:function(e){var t,n=this.gridController();n&&n.showRowErrors(null!==(t=e.row_errors)&&void 0!==t?t:[])}},{key:"invalidListMessage",value:function(e){var t,n,r=null!==(t=e.list_errors)&&void 0!==t?t:[];if(r.length)return r.join(" ");var o=this.errorsCount(e),i=1===o?"There is an error in your list that must be fixed before continuing.":"There are ".concat(o," errors in your list that must be fixed before continuing.");if(!this.gridController()||0===(null!==(n=e.row_errors)&&void 0!==n?n:[]).length)return 1===o?"".concat(i,' Select "Download List" to view the error and explanation in a spreadsheet. ')+'Then, fix the error, and verify by selecting "Validate List" again.':"".concat(i,' Select "Download List" to view the errors and explanations in a spreadsheet. ')+'Then, fix the errors, and verify by selecting "Validate List" again.';var a=e.row_errors_truncated?' More rows failed than we can mark \u2014 "Download List" has the full set.':"";return 1===o?"".concat(i," It is listed in the Errors column and highlighted in the table below \u2014 correct it ")+'there, then select "Validate List" again. You can also select "Download List" to review '+"it in a spreadsheet.".concat(a):"".concat(i," They are listed in the Errors column and highlighted in the table below \u2014 ")+'correct them there, then select "Validate List" again. You can also select '+'"Download List" to review them in a spreadsheet.'.concat(a)}},{key:"errorsCount",value:function(e){var t,n,r=null!==(t=e.errors_count)&&void 0!==t?t:0;if(r>0)return r;var o=null!==(n=e.row_errors)&&void 0!==n?n:[],i=o.reduce(function(e,t){var n;return e+Object.values(null!==(n=t.fields)&&void 0!==n?n:{}).reduce(function(e,t){return e+t.length},0)},0);return Math.max(i,o.length,1)}},{key:"gridController",value:function(){var e=this.element.querySelector('[data-controller~="'.concat(y,'"]'));return e?this.application.getControllerForElementAndIdentifier(e,y):null}},{key:"handleGridCellError",value:function(e){var t=e.detail||{};t.message&&this.setResult(t.message,"error")}},{key:"handleGridTruncated",value:function(e){var t=e.detail||{};this.setResult("You can add at most ".concat(t.maxRows," voters at a time. Rows beyond that limit were not added."),"warning")}},{key:"pickFile",value:function(e){var t=e&&e.detail||{};t.fileId&&t.accessToken?this.submitIngestion({source:"picker",source_params:{file_id:t.fileId,access_token:t.accessToken}}):this.showError("Could not read file from Google Picker.")}},{key:"handlePickerFilePicked",value:function(e){this.pickFile(e)}},{key:"handleUrlSubmitted",value:function(e){var t=e&&e.detail&&e.detail.url;t?this.submitIngestion({source:"public_url",source_params:{url:t}}):this.showError("Please paste a Google Sheets URL.")}},{key:"submitPublicUrl",value:function(e){e&&e.preventDefault&&e.preventDefault();var t=this.hasPublicUrlInputTarget?this.publicUrlInputTarget.value.trim():"";t?this.submitIngestion({source:"public_url",source_params:{url:t}}):this.showError("Please paste a Google Sheets URL.")}},{key:"handleCsvFileSelected",value:function(e){var t=e.target;t&&"file"===t.type&&this.submitCsvUpload()}},{key:"submitCsvUpload",value:function(){var e,t=this,n=this.csvFileInput(),r=null===n||void 0===n||null===(e=n.files)||void 0===e?void 0:e[0];if(r){var o=new FormData;o.append("source","csv_upload"),o.append("file",r),this.resetUI(),this.show(this.overlayTarget),this.setStatus("Uploading CSV...");var i=this.data.get("validate-url")||"";fetch(i,{method:"POST",headers:{Accept:"text/vnd.turbo-stream.html, application/json","X-CSRF-Token":b()},credentials:"same-origin",body:o}).then(function(e){return(e.headers.get("Content-Type")||"").includes("text/vnd.turbo-stream.html")?e.text().then(function(e){var n=e.match(/data-voter-list-upload-id="(\d+)"/);n&&(t.voterListUploadId=parseInt(n[1],10)),window.Turbo.renderStreamMessage(e),t.hide(t.overlayTarget),t.hasCsvUploadPanelTarget&&t.hide(t.csvUploadPanelTarget),t.hasMapperPanelTarget&&t.show(t.mapperPanelTarget)}):e.json().then(function(e){var n=e.error||"Could not process the CSV file. Please retry.";t.showError(n),t.hide(t.overlayTarget),t.clearCsvFileInput()})}).catch(function(){t.showError("Could not upload the CSV file. Please retry."),t.hide(t.overlayTarget),t.clearCsvFileInput()})}else this.showError("Please select a CSV file.")}},{key:"confirmImport",value:function(e){var t=this;e&&e.preventDefault&&e.preventDefault(),this.validationId?(this.disableConfirmButton(),this.listValidated=!1,this.show(this.overlayTarget),this.setStatus("Adding voters to your election..."),g(this.data.get("confirm-url")||"",{voters_validation_id:this.validationId}).catch(function(e){t.hasOverlayTarget&&t.hide(t.overlayTarget),e&&409===e.status?t.markListStale(e.body&&e.body.error||"You changed the list after it was validated. Select Validate list again before adding these voters."):(t.listValidated=!0,t.enableConfirmButton(),t.showError("Could not start the import. Please retry."))})):this.showError("No validation in progress.")}},{key:"validateIngestionList",value:function(e){var t=this;e&&e.preventDefault&&e.preventDefault(),this.validationId?(this.validating=!0,this.listValidated=!1,this.disableConfirmButton(),this.hasMapperPanelTarget&&this.hide(this.mapperPanelTarget),this.show(this.overlayTarget),this.setStatus("Validating voters..."),g(this.data.get("start-validation-url")||"",{voters_validation_id:this.validationId}).then(function(){return t.startStatusPolling()}).catch(function(e){t.validating=!1,t.hide(t.overlayTarget),t.hasMapperPanelTarget&&t.show(t.mapperPanelTarget);var n=e&&e.body&&e.body.error||"Could not start validation. Please retry.";t.showError(n)})):this.showError("Ingestion state lost. Please start over.")}},{key:"updateStagingCell",value:function(e){var t=this;if(!this.validating){var n=e.target,r=n.getAttribute("data-attr-name")||"";if("errors"!==r){var o=n.innerText.trim(),i=n.getAttribute("data-attr-value")||"";if(o!==i){var a=n.closest("tr"),u=null===a||void 0===a?void 0:a.getAttribute("data-voter-line-validation-id");u&&r&&g(this.data.get("update-voter-line-url")||"",{voter_line_validation_id:parseInt(u,10),attribute_name:r,attribute_value:o}).then(function(){n.setAttribute("data-attr-value",o),t.handleListEdited()}).catch(function(){n.innerText=i,t.showError("Could not save the change. Please retry.")})}}}}},{key:"handleColumnMapping",value:function(e){var t=this,n=e.target,r=n.getAttribute("data-url");if(r&&this.hasMapperPanelTarget){var o=(n.getAttribute("data-method")||"patch").toUpperCase(),i=document.querySelector('meta[name="csrf-token"]'),a=i?i.content:"";fetch(r,{method:o,headers:{"Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":a,"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript"},body:new URLSearchParams({mapped_column:n.value}).toString(),credentials:"same-origin"}).then(function(){var e=t.mapperPanelTarget.querySelector("#voter_list_notices");e&&Array.from(t.mapperPanelTarget.querySelectorAll("select[data-url]")).every(function(e){return""!==e.value})&&(e.innerHTML="")}).catch(function(){})}}},{key:"confirmMapping",value:function(e){var t=this;e&&e.preventDefault&&e.preventDefault(),this.voterListUploadId?(this.hasMapperPanelTarget&&this.hide(this.mapperPanelTarget),this.show(this.overlayTarget),this.setStatus("Loading voters..."),g(this.data.get("confirm-mapping-url")||"",{voter_list_upload_id:this.voterListUploadId}).then(function(e){t.validationId=e.voters_validation_id,t.startStatusPolling()}).catch(function(e){t.hide(t.overlayTarget),t.hasMapperPanelTarget&&t.show(t.mapperPanelTarget);var n=e&&e.body&&e.body.error||"Could not start validation. Please retry.";t.showError(n)})):this.showError("Mapping state lost. Please start over.")}},{key:"submitIngestion",value:function(e){var t=this;this.resetUI(),this.show(this.overlayTarget),this.setStatus("Uploading spreadsheet...");var n=this.data.get("validate-url")||"";fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/vnd.turbo-stream.html, application/json","X-CSRF-Token":b()},credentials:"same-origin",body:JSON.stringify(e)}).then(function(e){return(e.headers.get("Content-Type")||"").includes("text/vnd.turbo-stream.html")?e.text().then(function(e){var n=e.match(/data-voter-list-upload-id="(\d+)"/);n&&(t.voterListUploadId=parseInt(n[1],10)),window.Turbo.renderStreamMessage(e),t.hide(t.overlayTarget),t.hide(t.googleSheetsPanelTarget),t.hasMapperPanelTarget&&t.show(t.mapperPanelTarget)}):e.json().then(function(n){if(!e.ok){var r=n.error||"Could not upload the spreadsheet. Please retry.";return t.showError(r),void t.hide(t.overlayTarget)}t.validationId=n.voters_validation_id,t.validating=!0,t.hasValidateButtonTarget&&(t.validateButtonTarget.disabled=!0),t.setStatus("Validating voters..."),t.startStatusPolling()})}).catch(function(){t.showError("Could not upload the spreadsheet. Please retry."),t.hide(t.overlayTarget)})}},{key:"csvFileInput",value:function(){return this.hasCsvDropZoneTarget?this.csvDropZoneTarget.querySelector('input[type="file"]'):this.hasCsvFileInputTarget?this.csvFileInputTarget:null}},{key:"clearCsvFileInput",value:function(){var e;if(this.hasCsvDropZoneTarget){null===(e=this.dropZoneController())||void 0===e||e.removeFile(new Event("reset"));var t=this.csvFileInput();t&&(t.value="")}}},{key:"dropZoneController",value:function(){if(!this.hasCsvDropZoneTarget)return null;var e=this.csvDropZoneTarget.querySelector('[data-controller~="'.concat(m,'"]'));return e?this.application.getControllerForElementAndIdentifier(e,m):null}},{key:"createSubscription",value:function(){var e=this;return o.A.subscriptions.create({channel:"AppendVotersChannel",user_id:this.data.get("user-id")},{connected:function(){return e.reconcileValidationStatus()},disconnect
2ed:function(){},received:this.cableReceived.bind(this)})}},{key:"cableReceived",value:function(e){switch(e.type){case"ingestion":this.handleIngestion(e);break;case"validation":this.handleValidation(e);break;case"commit":this.handleCommit(e);break;case"invitations":this.handleInvitations(e)}}},{key:"handleValidation",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.staleAttempt(e.voters_validation_id))switch(e.status){case"start":this.validating=!0,null===(t=this.gridController())||void 0===t||t.clearRowErrors(),this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!0),this.hasOverlayTarget&&this.show(this.overlayTarget),this.setStatus("Validating voters..."),this.updateProgress(0,0),this.startStatusPolling();break;case"progress":this.updateProgress(e.processed||0,e.total||0);break;case"done":if(!n){this.reconcileValidationStatus();break}this.validating=!1,this.stopStatusPolling(),e.valid?(this.listValidated=!0,this.enableConfirmButton(),this.hasOverlayTarget&&this.hide(this.overlayTarget),this.hasValidateButtonTarget&&"typing_or_copying"!==this.importMethod&&this.hide(this.validateButtonTarget),this.hasMapperPanelTarget&&"typing_or_copying"!==this.importMethod&&this.show(this.mapperPanelTarget),this.setResult('Everything looks good! Select "Add Voters" to continue.',"success")):(this.listValidated=!1,this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!1),this.hasOverlayTarget&&this.hide(this.overlayTarget),this.markGridErrors(e),this.setResult(this.invalidListMessage(e),"error"),this.hasDownloadErrorsButtonTarget&&e.error_csv_url&&(this.downloadErrorsButtonTarget.setAttribute("href",e.error_csv_url),this.show(this.downloadErrorsButtonTarget)),this.hasMapperPanelTarget&&"typing_or_copying"!==this.importMethod?this.show(this.mapperPanelTarget):this.disableConfirmButton());break;case"error":if(!n){this.reconcileValidationStatus();break}this.validating=!1,this.stopStatusPolling(),this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!1),this.hasOverlayTarget&&this.hide(this.overlayTarget),this.showError("Validation failed. Please retry."),this.hasMapperPanelTarget&&this.show(this.mapperPanelTarget)}}},{key:"handleIngestion",value:function(e){if(!this.staleAttempt(e.voters_validation_id)){if("done"!==e.status)return this.hasOverlayTarget&&this.hide(this.overlayTarget),void this.showError("Ingestion failed. Please start over.");this.validationId=e.voters_validation_id,this.setStatus("Validating voters..."),this.startStatusPolling()}}},{key:"staleAttempt",value:function(e){return!e||!this.validationId||e!==this.validationId}},{key:"startStatusPolling",value:function(){var e=this;this.stopStatusPolling(),this.statusPollGeneration+=1,this.statusPollTimer=window.setInterval(function(){return e.reconcileValidationStatus()},5e3)}},{key:"stopStatusPolling",value:function(){null!==this.statusPollTimer&&(window.clearInterval(this.statusPollTimer),this.statusPollTimer=null)}},{key:"reconcileValidationStatus",value:function(){var e=this,t=this.data.get("validation-status-url")||"",n=this.validationId,r=this.statusPollGeneration;t&&n&&null!==this.statusPollTimer&&fetch("".concat(t,"?voters_validation_id=").concat(n),{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(t){t&&null!==e.statusPollTimer&&n===e.validationId&&r===e.statusPollGeneration&&("completed"!==t.state||"valid"!==t.status&&"invalid"!==t.status?"failed"===t.state&&e.handleValidation({type:"validation",status:"error",voters_validation_id:n},!0):e.handleValidation({type:"validation",status:"done",valid:"valid"===t.status,error_csv_url:t.error_csv_url,errors_count:t.errors_count,list_errors:t.list_errors,row_errors:t.row_errors,row_errors_truncated:t.row_errors_truncated,voters_validation_id:n},!0))}).catch(function(){})}},{key:"handleCommit",value:function(e){if(!this.staleAttempt(e.voters_validation_id))switch(e.status){case"commit_start":this.hasOverlayTarget&&this.show(this.overlayTarget),this.setStatus("Adding voters to your election...");break;case"commit_progress":this.updateProgress(e.processed||0,e.total||0),this.setStatus("Importing row ".concat(e.processed," of ").concat(e.total,"..."));break;case"commit_done":this.setStatus("Voters successfully added! Sending invitations now...");break;case"commit_error":this.hasOverlayTarget&&this.hide(this.overlayTarget),this.setResult("Import failed. Please contact support.","error")}}},{key:"handleInvitations",value:function(e){if(!this.staleAttempt(e.voters_validation_id))switch(e.status){case"invitations_start":this.setStatus("Preparing invitations...");break;case"invitations_progress":this.updateProgress(e.processed||0,e.total||0);break;case"invitations_done":this.hasOverlayTarget&&this.hide(this.overlayTarget),this.hasSuccessMessageTarget&&(this.successMessageTarget.textContent="Voters successfully added! ".concat(e.invitations," invitations queued."),this.show(this.successMessageTarget)),this.setResult("Voters successfully added!","success"),window.location.href=this.data.get("success-url")||"";break;case"invitations_error":this.hasOverlayTarget&&this.hide(this.overlayTarget),this.setResult("Invitations could not be created. Please contact support.","error")}}},{key:"handleBeforeStreamRender",value:function(e){var t=e.target;if(t&&"append_voters_mapper_panel"===t.getAttribute("target")){var n=t.querySelector("template"),r=null===n||void 0===n?void 0:n.content.querySelector("[data-voters-validation-id]");if(r){var o=Number(r.dataset.votersValidationId);this.validationId&&o===this.validationId||e.preventDefault()}}}},{key:"initHot",value:function(){var e=this;if(!this.hotInitialized){var t=this.hotConfigValue;if(t&&t.columns&&t.columns.length){var n=document.getElementById("hands_on_table");if(n)if("undefined"!==typeof Handsontable){var r,o=(r=t.remaining_extra_keys,Math.max(0,Math.trunc(null!==r&&void 0!==r?r:0)));this.hot=new Handsontable(n,{columns:t.columns,colHeaders:t.column_headers,rowHeaders:function(e){return String(e+1+(t.last_taken_row||0))}
2,minSpareRows:o,maxRows:o,dataSchema:t.columns.reduce(function(e,t){return e[t.data]=null,e},{}),autoWrapRow:!0,autoWrapCol:!0,stretchH:"all",width:"100%",height:h(o),rowHeights:24,pasteMode:"overwrite",preventOverflow:"horizontal",contextMenu:!1,afterChange:function(t,n){t&&"loadData"!==n&&e.handleListEdited()}}),this.hotInitialized=!0}else console.error("[AppendVotersController] Handsontable not loaded")}}}},{key:"showMethodPanels",value:function(e){this.hasTypingPanelTarget&&this.typingPanelTarget.classList.toggle("hide","typing_or_copying"!==e),this.hasGoogleSheetsPanelTarget&&this.googleSheetsPanelTarget.classList.toggle("hide","google_sheets"!==e),this.hasCsvUploadPanelTarget&&this.csvUploadPanelTarget.classList.toggle("hide","csv_upload"!==e),this.hasValidateButtonTarget&&this.validateButtonTarget.classList.toggle("hide","typing_or_copying"!==e)}},{key:"startOver",value:function(){this.resetUI();var e=this.element.querySelector('input[name="append_import_method"]:checked');e&&this.showMethodPanels(e.value)}},{key:"resetUI",value:function(){this.stopStatusPolling(),this.validationId=null,this.validating=!1,this.listValidated=!1,this.disableConfirmButton(),this.hasDownloadErrorsButtonTarget&&this.hide(this.downloadErrorsButtonTarget),this.hasSuccessMessageTarget&&this.hide(this.successMessageTarget),this.hasOverlayTarget&&this.hide(this.overlayTarget),this.hasResultMessageTarget&&this.hide(this.resultMessageTarget),this.hasMapperPanelTarget&&(this.hide(this.mapperPanelTarget),this.mapperPanelTarget.innerHTML=""),this.voterListUploadId=null,this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!1),this.setStatus(""),this.updateProgress(0,0)}},{key:"setStatus",value:function(e,t){this.hasStatusMessageTarget&&(this.statusMessageTarget.textContent=e||"",this.statusMessageTarget.classList.remove("inline_success","inline_error","inline_warning"),"success"===t&&this.statusMessageTarget.classList.add("inline_success"),"warning"===t&&this.statusMessageTarget.classList.add("inline_warning"),"error"===t&&this.statusMessageTarget.classList.add("inline_error"))}},{key:"showError",value:function(e){this.setResult(e,"error")}},{key:"setResult",value:function(e,t){this.hasResultMessageTarget&&(this.resultMessageTarget.textContent=e||"",this.resultMessageTarget.classList.remove("inline_success","inline_error","inline_warning"),"success"===t&&this.resultMessageTarget.classList.add("inline_success"),"warning"===t&&this.resultMessageTarget.classList.add("inline_warning"),"error"===t&&this.resultMessageTarget.classList.add("inline_error"),e?this.show(this.resultMessageTarget):this.hide(this.resultMessageTarget))}},{key:"updateProgress",value:function(e,t){this.hasProgressBarTarget&&(this.progressBarTarget.hidden=!t,this.progressBarTarget.value=e||0,t&&(this.progressBarTarget.max=t)),this.hasProgressLabelTarget&&(this.progressLabelTarget.textContent=t?"".concat(e," / ").concat(t):"")}},{key:"markListStale",value:function(e){this.listValidated=!1,this.disableConfirmButton(),this.setResult(e||"",e?"warning":void 0),this.hasValidateButtonTarget&&(this.validateButtonTarget.disabled=!1,this.show(this.validateButtonTarget))}},{key:"enableConfirmButton",value:function(){this.hasConfirmButtonTarget&&(this.confirmButtonTarget.disabled=!1,this.confirmButtonTarget.classList.remove("toolkit-button-component--disabled"))}},{key:"disableConfirmButton",value:function(){this.hasConfirmButtonTarget&&(this.confirmButtonTarget.disabled=!0,this.confirmButtonTarget.classList.add("toolkit-button-component--disabled"))}},{key:"show",value:function(e){e&&e.classList&&e.classList.remove("hide")}},{key:"hide",value:function(e){e&&e.classList&&e.classList.add("hide")}}],r&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);w.targets=["methodSelector","typingPanel","googleSheetsPanel","validateButton","publicUrlInput","overlay","statusMessage","progressBar","progressLabel","confirmButton","downloadErrorsButton","successMessage","resultMessage","mapperPanel","csvUploadPanel","csvDropZone","csvFileInput"],w.values={hotConfig:{type:Object,default:{}}}},1833:function(e,t,n){"use strict";n.r(t),n.d(t,{CHANGED_EVENT:function(){return k},ERRORS_COL_ID:function(){return _},MAX_VISIBLE_ROWS:function(){return j},MIN_VISIBLE_ROWS:function(){return S},NARROW_MAX_WIDTH:function(){return E},SAVE_ERROR_EVENT:function(){return O},SAVE_ERROR_MESSAGE:function(){return T},TOUCH_ROW_HEIGHT:function(){return P},default:function(){return x},visibleRowsFor:function(){return C}});var r=n(8179),o=n(4546),i=n(737),a=n(6935),u=n(2790),c=n(6149),s=n(7343);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?l(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function v(e,t,n){return t=g(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,y()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function m(e,t,n,r){var o=b(g(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=g(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},b.apply(null,arguments)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}var _="errors",O="append-voters-review-grid:error",T="Could not save the change. Please retry.",k="append-voters-review-grid:changed",j=10,S=3,P=44,E=639;function C(e){return Math.min(Math.max(e,S),j)}var x=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=v(this,t,[].concat(r))).revertingCells=new Set,e.reviewResizeHandler=null,e.reviewResizeTimer=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;if(m(t,"connect",this,3)([]),this.hasGridTarget){var n=f(f(f({theme:i.zA,localeText:a.V,columnDefs:(0,c.g)(this.columnDefsValue),rowData:this.rowDataValue,domLayout:"normal",suppressMovableColumns:!0,suppressDragLeaveHidesColumns:!0,suppressRowDrag:!0,rowGroupPanelShow:"never",cellSelection:{handle:{mode:"fill"}},fillOperation:function(e){return e.initialValues[e.values.length%e.initialValues.length]},rowNumbers:{width:50,minWidth:50},stopEditingWhenCellsLoseFocus:!0,suppressContextMenu:!0},this.coarsePointer?{rowHeight:P,singleClickEdit:!0}:{}),{},{defaultColDef:{sortable:!1,resizable:!0,suppressMovable:!0,suppressHeaderMenuButton:!0},onCellValueChanged:function(t){return e.persistCell(t)},onFirstDataRendered:function(){return e.fitColumns()},popupParent:document.body},this.gridOptionsValue),u.T);this.gridApi=(0,r.Dvw)(this.gridTarget,n),this.sizeBoxToRows(),this.reviewResizeHandler=function(){return e.scheduleResize()},window.addEventListener("resize",this.reviewResizeHandler),window.addEventListener("orientationchange",this.reviewResizeHandler)}}},{key:"disconnect",value:function(){this.reviewResizeHandler&&(window.removeEventListener("resize",this.reviewResizeHandler),window.removeEventListener("orientationchange",this.reviewResizeHandler),this.reviewResizeHandler=null),null!==this.reviewResizeTimer&&(window.clearTimeout(this.reviewResizeTimer),this.reviewResizeTimer=null),m(t,"disconnect",this,3)([])}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"coarsePointer",get:function(){var e,t,n;return null!==(e=null===(t=(n=window).matchMedia)||void 0===t||null===(t=t.call(n,"(pointer: coarse)"))||void 0===t?void 0:t.matches)&&void 0!==e&&e}},{key:"rowHeight",get:function(){return this.coarsePointer?P:i.we}}
2,{key:"persistCell",value:function(e){var t=this,n=e.column.getColId();if(n!==_){var r=e.data.id;if(null!==r&&void 0!==r){var o="".concat(r,":").concat(n);if(this.revertingCells.has(o))this.revertingCells.delete(o);else{var i=null===e.newValue||void 0===e.newValue?"":String(e.newValue),a=e.oldValue;i!==(null===a||void 0===a?"":String(a))&&fetch(this.updateUrlValue,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":(0,s.GQ)()},credentials:"same-origin",body:JSON.stringify({voter_line_validation_id:r,attribute_name:n,attribute_value:i})}).then(function(n){n.ok?t.element.dispatchEvent(new CustomEvent(k,{bubbles:!0})):t.revertCell(e,o)}).catch(function(){return t.revertCell(e,o)})}}}}},{key:"revertCell",value:function(e,t){this.revertingCells.add(t),e.node.setDataValue(e.column.getColId(),e.oldValue),this.element.dispatchEvent(new CustomEvent(O,{bubbles:!0,detail:{message:T}}))}},{key:"scheduleResize",value:function(){var e=this;null!==this.reviewResizeTimer&&window.clearTimeout(this.reviewResizeTimer),this.reviewResizeTimer=window.setTimeout(function(){e.reviewResizeTimer=null,e.sizeBoxToRows(),e.fitColumns()},150)}},{key:"sizeBoxToRows",value:function(){var e=C(this.rowDataValue.length)*this.rowHeight;this.gridTarget.style.height="".concat(i.fH+e+this.verticalBorders(),"px")}},{key:"verticalBorders",value:function(){var e,t,n=this.gridTarget.querySelector(".ag-root-wrapper"),r=n&&(null===(e=(t=window).getComputedStyle)||void 0===e?void 0:e.call(t,n));if(!r)return 2;var o=parseFloat(r.borderTopWidth),i=parseFloat(r.borderBottomWidth);return Number.isNaN(o)||Number.isNaN(i)?2:o+i}},{key:"fitColumns",value:function(){var e;window.innerWidth<=E||null===(e=this.gridApi)||void 0===e||e.sizeColumnsToFit()}}])&&p(n.prototype,o),l&&p(n,l),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,l}(o.AgGridBaseController);x.values=f(f({},o.AgGridBaseController.values),{},{rowData:Array,updateUrl:String})},9849:function(e,t,n){"use strict";n.r(t),n.d(t,{CELL_ERROR_CLASS:function(){return O},CELL_ERROR_EVENT:function(){return k},CHANGED_EVENT:function(){return j},ERRORS_COLUMN_MIN_WIDTH:function(){return P},ERRORS_COL_ID:function(){return S},MAX_VISIBLE_ROWS:function(){return T},NARROW_CHROME_ALLOWANCE:function(){return I},NARROW_MAX_WIDTH:function(){return C},NARROW_MIN_COLUMN_WIDTH:function(){return R},NARROW_MIN_EMAIL_COLUMN_WIDTH:function(){return L},NARROW_MIN_ERRORS_COLUMN_WIDTH:function(){return E},NARROW_MIN_VISIBLE_ROWS:function(){return B},NARROW_ROW_NUMBER_WIDTH:function(){return A},TOUCH_ROW_HEIGHT:function(){return x},TRUNCATED_EVENT:function(){return _},boxRowsHeight:function(){return N},default:function(){return H},isNarrowViewport:function(){return D},minColumnWidthFor:function(){return V},rowHeightFor:function(){return M},visibleRowsFor:function(){return F}});var r=n(8179),o=n(4546),i=n(737),a=n(6935),u=n(2790);function c(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEac
2h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function v(e,t,n){return t=g(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,y()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function m(e,t,n,r){var o=b(g(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=g(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},b.apply(null,arguments)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}var _="append-voters-grid:truncated",O="append-voters-grid__cell--error",T=20,k="append-voters-grid:cell-error",j="append-voters-grid:changed",S="errors",P=200,E=150,C=639,x=44,A=36,R=140,L=180,I=300,B=4;function D(e){return e.width<=C}function M(e){return e.coarsePointer?x:i.we}function F(e,t,n){var r=Math.max(1,Math.min(e,T));if(!D(t))return r;var o=Math.floor((t.height-I)/n);return Math.min(r,Math.max(B,o))}function N(e,t,n,r){var o=F(t,n,r),i=function(t){return e[t]||r},a=0;if(!D(n)){for(var u=0;u<o;u+=1)a+=i(u);return a}for(var c=n.height-I,s=0;s<o;s+=1){var l=a+i(s);if(s>=B&&l>c)break;a=l}return a}function V(e){return e&&/email/i.test(e)?L:R}var H=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=v(this,t,[].concat(r))).lastPasteGrowthNodeIds=null,e.blankTopUpScheduled=!1,e.revealObserver=null,e.hasBeenSized=!1,e.rowErrors=new Map,e.submittedRowIndexes=[],e.resizeHandler=null,e.resizeTimer=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;if(m(t,"connect",this,3)([]),this.hasGridTarget){var n=this.viewport,o=D(n),s=f(f(f({theme:i.zA,localeText:a.V,columnDefs:[this.errorsColumnDef(o)].concat(c(o?this.narrowColumnDefs():this.columnDefsValue)),rowData:this.buildBlankRows(this.rowCapacity),domLayout:"normal",suppressMovableColumns:!0,suppressDragLeaveHidesColumns:!0,suppressRowDrag:!0,rowGroupPanelShow:"never",cellSelection:{handle:{mode:"fill"}},fillOperation:function(e){return e.initialValues[e.values.length%e.initialValues.length]},rowNumbers:o?{width:A,minWidth:A}:{width:50,minWidth:50},stopEditingWhenCellsLoseFocus:!0},n.coarsePointer?{rowHeight:x,singleClickEdit:!0}:{}),{},{undoRedoCellEditing:!0,undoRedoCellEditingLimit:20,suppressContextMenu:!0,processDataFromClipboard:function(t){return e.growGridForPaste(t)}
2,onCellValueChanged:function(t){return e.handleCellValueChanged(t)},onCellClicked:function(t){return e.handleCellClicked(t)},onFirstDataRendered:function(){return e.fitColumns()},onModelUpdated:function(){return e.sizeBoxToRows()},onUndoEnded:function(t){return e.handleUndoEnded(t)},popupParent:document.body,defaultColDef:{editable:!0,sortable:!1,resizable:!0,suppressMovable:!0,suppressHeaderMenuButton:!0,cellClassRules:d({},O,function(t){return e.cellHasError(t.node.rowIndex,t.colDef)})}},this.gridOptionsValue),u.T);this.gridApi=(0,r.Dvw)(this.gridTarget,s),this.sizeBoxToRows(),this.gridBlurHandler=function(t){var n,r=t.target;e.gridTarget.contains(r)||null===(n=e.gridApi)||void 0===n||n.clearCellSelection()},document.addEventListener("mousedown",this.gridBlurHandler),this.resizeHandler=function(){return e.scheduleResize()},window.addEventListener("resize",this.resizeHandler),window.addEventListener("orientationchange",this.resizeHandler),this.observeReveal()}}},{key:"disconnect",value:function(){var e;null===(e=this.revealObserver)||void 0===e||e.disconnect(),this.revealObserver=null,this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("orientationchange",this.resizeHandler),this.resizeHandler=null),null!==this.resizeTimer&&(window.clearTimeout(this.resizeTimer),this.resizeTimer=null),m(t,"disconnect",this,3)([])}},{key:"viewport",get:function(){var e,t,n;return{width:window.innerWidth,height:window.innerHeight,coarsePointer:null!==(e=null===(t=(n=window).matchMedia)||void 0===t||null===(t=t.call(n,"(pointer: coarse)"))||void 0===t?void 0:t.matches)&&void 0!==e&&e}}},{key:"errorsColumnDef",value:function(e){var t=this;return{colId:S,headerName:"Errors",editable:!1,resizable:!0,suppressMovable:!0,suppressHeaderMenuButton:!0,suppressNavigable:!0,suppressPaste:!0,lockPosition:"left",hide:!0,wrapText:!0,autoHeight:!0,minWidth:e?E:P,valueGetter:function(e){var n;return t.rowErrorMessage(null===(n=e.node)||void 0===n?void 0:n.rowIndex)},cellClassRules:d({},O,function(e){return Boolean(t.rowErrorMessage(e.node.rowIndex))})}}},{key:"rowErrorMessage",value:function(e){var t,n;return null===e||void 0===e?"":null!==(t=null===(n=this.rowErrors.get(e))||void 0===n?void 0:n.message)&&void 0!==t?t:""}},{key:"narrowColumnDefs",value:function(){var e=this;return this.columnDefsValue.map(function(t){return f({minWidth:V(e.resolveColId(t))},t)})}},{key:"handleCellClicked",value:function(e){var t;if(this.viewport.coarsePointer){var n=this.cellErrorMessage(null===(t=e.node)||void 0===t?void 0:t.rowIndex,e.colDef);n&&this.element.dispatchEvent(new CustomEvent(k,{bubbles:!0,detail:{message:n}}))}}},{key:"scheduleResize",value:function(){var e=this;null!==this.resizeTimer&&window.clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(function(){e.resizeTimer=null,e.fitColumns()},150)}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"showRowErrors",value:function(e){var t=this;this.rowErrors=new Map,e.forEach(function(e){var n=t.gridRowIndexFor(e.index);null!==n&&t.rowErrors.set(n,e)}),this.setErrorsColumnVisible(this.rowErrors.size>0),this.repaintErrors()}},{key:"gridRowIndexFor",value:function(e){if(0===this.submittedRowIndexes.length)return e;var t=this.submittedRowIndexes[e];return void 0===t?null:t}},{key:"clearRowErrors",value:function(){0!==this.rowErrors.size&&(this.rowErrors=new Map,this.setErrorsColumnVisible(!1),this.repaintErrors())}},{key:"setErrorsColumnVisible",value:function(e){this.gridApi&&(this.gridApi.setColumnsVisible([S],e),this.fitColumns())}},{key:"repaintErrors",value:function(){var e;null===(e=this.gridApi)||void 0===e||e.redrawRows()}},{key:"cellHasError",value:function(e,t){return this.cellErrorMessages(e,t).length>0}},{key:"cellErrorMessage",value:function(e,t){return this.cellErrorMessages(e,t).join("; ")}},{key:"cellErrorMessages",value:function(e,t){if(null===e||void 0===e)return[];var n=this.rowErrors.get(e);if(!n)return[];var r=this.resolveColId(t);return r&&n.fields[r]?n.fields[r]:this.namesNoRenderedColumn(n)?[n.message]:[]}},{key:"namesNoRenderedColumn",value:function(e){var t=this.getColKeys();return!Object.keys(e.fields).some(function(e){return t.includes(e)})}},{key:"gatherRows",value:function(){var e,t=this,n=this.getColKeys(),r=[];null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){var t;e.data&&r.push({gridIndex:null!==(t=e.rowIndex)&&void 0!==t?t:r.length,row:e.data})});var o=r.slice(0,Math.max(0,this.maxRowsValue)).filter(function(e){var n=e.row;return t.rowHasContent(n)});return this.submittedRowIndexes=o.map(function(e){return e.gridIndex}),o.map(function(e){var t=e.row,r={};
2return n.forEach(function(e){var n=t[e];r[e]=null!==n&&void 0!==n?String(n):null}),r})}},{key:"rowHasContent",value:function(e){return this.getColKeys().some(function(t){var n=e[t];return null!==n&&void 0!==n&&""!==n})}},{key:"getColKeys",value:function(){var e=this;return this.columnDefsValue.map(function(t){return e.resolveColId(t)}).filter(function(e){return Boolean(e)})}},{key:"resolveColId",value:function(e){var t;return null!==(t=e.colId)&&void 0!==t?t:"string"===typeof e.field?e.field.split(".")[0]:void 0}},{key:"rowCapacity",get:function(){return Math.max(0,Math.trunc(this.maxRowsValue||0))}},{key:"sizeBoxToRows",value:function(){var e=this.viewport,t=N(this.measuredRowHeights(),this.rowCapacity,e,M(e)),n="".concat(i.fH+t+this.horizontalScrollHeight()+this.verticalBorders(),"px");this.gridTarget.style.height!==n&&(this.gridTarget.style.height=n)}},{key:"measuredRowHeights",value:function(){var e=this.gridApi;if(!e)return[];for(var t=Math.min(e.getDisplayedRowCount(),T),n=[],r=0;r<t;r+=1){var o,i;n.push(null!==(o=null===(i=e.getDisplayedRowAtIndex(r))||void 0===i?void 0:i.rowHeight)&&void 0!==o?o:0)}return n}},{key:"horizontalScrollHeight",value:function(){var e,t=this.gridTarget.querySelector(".ag-body-horizontal-scroll");return null!==(e=null===t||void 0===t?void 0:t.offsetHeight)&&void 0!==e?e:0}},{key:"verticalBorders",value:function(){var e,t,n=this.gridTarget.querySelector(".ag-root-wrapper"),r=n&&(null===(e=(t=window).getComputedStyle)||void 0===e?void 0:e.call(t,n));if(!r)return 2;var o=parseFloat(r.borderTopWidth),i=parseFloat(r.borderBottomWidth);return Number.isNaN(o)||Number.isNaN(i)?2:o+i}},{key:"buildBlankRows",value:function(e){var t=this.getColKeys();return Array.from({length:Math.max(e,0)},function(){var e={};return t.forEach(function(t){e[t]=null}),e})}},{key:"growGridForPaste",value:function(e){if(!this.gridApi)return e.data;var t=this.gridApi.getFocusedCell();if(!t)return e.data;if(t.column.getColId()===S){var n,r=this.getColKeys()[0];if(!r)return null;this.gridApi.setFocusedCell(t.rowIndex,r),t=null!==(n=this.gridApi.getFocusedCell())&&void 0!==n?n:t}this.lastPasteGrowthNodeIds=null;var o=this.trimTrailingBlankLines(e.data);if(0===o.length)return null;var i=this.gridApi.getDisplayedRowCount(),a=t.rowIndex+o.length-i;if(a<=0)return o;var u=this.maxRowsValue-i,c=Math.min(a,u);if(c>0){var s,l=this.gridApi.applyTransaction({add:this.buildBlankRows(c)});this.lastPasteGrowthNodeIds=(null!==(s=null===l||void 0===l?void 0:l.add)&&void 0!==s?s:[]).map(function(e){return e.id}).filter(function(e){return void 0!==e})}if(a<=u)return o;this.announceTruncation();var f=this.maxRowsValue-t.rowIndex;return f>0?o.slice(0,f):null}},{key:"trimTrailingBlankLines",value:function(e){for(var t=e.length;t>0&&e[t-1].every(function(e){return""===(null!==e&&void 0!==e?e:"")});)t-=1;return e.slice(0,t)}},{key:"announceTruncation",value:function(){this.element.dispatchEvent(new CustomEvent(_,{bubbles:!0,detail:{maxRows:this.maxRowsValue}}))}},{key:"handleUndoEnded",value:function(e){var t=this;if(e.operationPerformed){var n=this.lastPasteGrowthNodeIds;if(this.lastPasteGrowthNodeIds=null,n&&this.gridApi){var r=n.map(function(e){return t.gridApi.getRowNode(e)}).filter(function(e){return!!e});r.length===n.length&&(r.some(function(e){return!e.data||t.rowHasContent(e.data)})||this.gridApi.applyTransaction({remove:r.map(function(e){return e.data})}))}}}},{key:"handleCellValueChanged",value:function(e){this.scheduleBlankTopUp(),this.element.dispatchEvent(new CustomEvent(j,{bubbles:!0}))}},{key:"scheduleBlankTopUp",value:function(){var e=this;this.blankTopUpScheduled||(this.blankTopUpScheduled=!0,Promise.resolve().then(function(){e.blankTopUpScheduled=!1,e.appendBlankRowIfLastRowFilled()}))}},{key:"appendBlankRowIfLastRowFilled",value:function(){if(this.gridApi){var e=this.gridApi.getDisplayedRowCount();if(!(0===e||e>=this.maxRowsValue)){var t=this.gridApi.getDisplayedRowAtIndex(e-1);null!==t&&void 0!==t&&t.data&&this.rowHasContent(t.data)&&this.gridApi.applyTransaction({add:this.buildBlankRows(1)})}}}},{key:"observeReveal",value:function(){var e=this;"undefined"!==typeof ResizeObserver&&(this.revealObserver=new ResizeObserver(function(t){t.some(function(e){return e.contentRect.width>0})?e.hasBeenSized||(e.hasBeenSized=!0,e.fitColumns()):e.hasBeenSized=!1}),this.revealObserver.observe(this.gridTarget))}},{key:"fitColumns",value:function(){var e;D(this.viewport)||null===(e=this.gridApi)||void 0===e||e.sizeColumnsToFit(),this.sizeBoxToRows()}}],o&&p(n.prototype,o),s&&p(n,s),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,s}(o.AgGridBaseController);H.values=f(f({},o.AgGridBaseController.values),{},{maxRows:Number})},9437:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=(0,o.T)();e?e(this.languageSelectTarget).select2().on("change",this.changeLanguage.bind(this)):this.languageSelectTarget.addEventListener("change",this.changeLanguage.bind(this))}},{key:"changeLanguage",value:function(e){var t=e.target.value,n=new URL(window.location.href);n.searchParams.set("locale",t),window.location.href=n.toString()}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["languageSelect"]},4546:function(e,t,n){"use strict";n.r(t),n.d(t,{AgGridBaseController:function(){return B},EMPTY_SET:function(){return L},FILTERS_PANEL_ID:function(){return x},GRID_BOTTOM_MARGIN:function(){return P},GRID_STATE_SAVE_DEBOUNCE_MS:function(){return E},MIN_GRID_HEIGHT:function(){return S},MIN_USABLE_FLEX_WIDTH:function(){return C},TOOL_PANEL_TITLES:function(){return A}});var r=n(5396),o=n(7751),i=n(8179),a=n(5404),u=n(7787);function c(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return p(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,p(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,p(f,"constructor",s),p(s,"constructor",c),c.displayName="GeneratorFunction",p(s,o,"GeneratorFunction"),p(f),p(f,o,"Generator"),p(f,r,function(){return this}),p(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:i,m:h}})()}function p(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,t,n,r){function i(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},p(e,t,n,r)}function h(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){h(i,r,o,a,u,"next",e)}function u(e){h(i,r,o,a,u,"throw",e)}a(void 0)})}}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=m(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function m(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,j(r.key),r)}}function w(e,t,n){return t=O(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_()?Reflect.construct(t,n||[],O(e).constructor):t.apply(e,n))}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}function k(e,t,n){return(t=j(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}i.syG.registerModules([o.fKx]);var S=400,P=24,E=2e3,C=120,x="filters-new",A=k({columns:"Columns"},x,"Filters"),R={aggregation:!0,cellSelection:!0,columnGroup:!0,columnOrder:!0,columnPinning:!0,columnSizing:!0,columnVisibility:!0,filter:!0,focusedCell:!0,pagination:!0,pivot:!0,rowGroup:!0,rowGroupExpansion:!0,rowPinning:!0,rowSelection:!0,scroll:!0,sort:!0,ssrmRowGroupExpansion:!0},L=Object.freeze(new Set),I=function(e){var t=null===e||void 0===e?void 0:e.id;return"string"===typeof t||"number"===typeof t?t:null},B=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=w(this,t,[].concat(r))).gridApi=null,e.rowSelectableCallback=function(e){var t;return!1!==(null===(t=e.data)||void 0===t?void 0:t.row_selectable)},e.isBasicMode=!0,e.isRestoringState=!1,e.saveGridStateTimer=null,e.lastPersistedState=null,e.pendingAutoSize=!1,e.hasRowSelection=!1,e.resizeHandler=null,e.heightOb
2server=null,e.outsideClickHandler=null,e.gridBlurHandler=null,e.actionAjaxSuccessHandler=null,e.modalRefreshObserver=null,e.lastClickX=null,e.followAnchorNodeId=null,e.pendingFollowScrollFrame=!1,e.menuDragged=!1,e.lazyRowActionsToken=0,e.rowActionsCache=new Map,e.rowActionsInflight=new Map,e.pendingAutoSizeNonFlexFrame=!1,e.pendingAutoSizeScope=null,e.suppressAggFuncInHeader=!0,e.pivotHeaderQuirkColDefOverrides={wrapHeaderText:!1,autoHeaderHeight:!1},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.licenseKeyValue&&o.hFV.setLicenseKey(this.licenseKeyValue),this.outsideClickHandler=function(t){e.hasExportDropdownTarget&&!e.exportDropdownTarget.hidden&&(e.exportToggleTarget.contains(t.target)||e.exportDropdownTarget.contains(t.target)||e.closeExportDropdown())},document.addEventListener("click",this.outsideClickHandler),this.hasActionsMenuTarget&&(this.actionAjaxSuccessHandler=function(t){var n=t.target;n.matches(".ag-grid-component-action-link[data-remote]")&&(n.matches('[rel~="modal:open"]')||e.refreshAfterRemoteAction())},this.actionsMenuTarget.addEventListener("ajax:success",this.actionAjaxSuccessHandler)),this.setupMenuDrag(),this.modalRefreshObserver=new MutationObserver(function(t){var n,r=y(t);try{for(r.s();!(n=r.n()).done;){var o,i,a=n.value;null!==(o=(i=a.target).closest)&&void 0!==o&&o.call(i,".jquery-modal")&&a.addedNodes.forEach(function(t){t instanceof HTMLElement&&(t.matches("[data-ag-grid-refresh]")?[t]:Array.from(t.querySelectorAll("[data-ag-grid-refresh]"))).forEach(function(t){t.addEventListener("ajax:success",function(){return e.refreshAfterRemoteAction()},{once:!0})})})}}catch(u){r.e(u)}finally{r.f()}}),this.modalRefreshObserver.observe(document.body,{childList:!0,subtree:!0})}},{key:"fetchGridState",value:(h=v(d().m(function e(){var t,n,r;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.gridStateUrlValue){e.n=1;break}return e.a(2,null);case 1:return e.p=1,e.n=2,fetch(this.gridStateUrlValue,{headers:{Accept:"application/json"},credentials:"same-origin"});case 2:if((t=e.v).ok){e.n=3;break}return e.a(2,null);case 3:return e.n=4,t.json();case 4:return n=e.v,r=null===n||void 0===n?void 0:n.state,e.a(2,r&&Object.keys(r).length>0?r:null);case 5:return e.p=5,e.v,e.a(2,null)}},e,this,[[1,5]])})),function(){return h.apply(this,arguments)})},{key:"saveGridState",value:function(){var e=this;this.gridApi&&this.gridStateUrlValue&&!this.isRestoringState&&(null!==this.saveGridStateTimer&&clearTimeout(this.saveGridStateTimer),this.saveGridStateTimer=setTimeout(function(){e.saveGridStateTimer=null,e.persistGridState()},E))}},{key:"persistGridState",value:function(){var e,t,n=this;if(this.gridApi&&this.gridStateUrlValue){var r=this.transformStateForPersist(f(f({},this.gridApi.getState()),{},{mode:this.isBasicMode?"basic":"advanced"})),o=JSON.stringify({state:r});if(o!==this.lastPersistedState){this.lastPersistedState=o;var i=null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"";fetch(this.gridStateUrlValue,{method:"PUT",headers:{"Content-Type":"application/json","X-CSRF-Token":i},credentials:"same-origin",body:o}).then(function(e){e.ok||(n.lastPersistedState=null)}).catch(function(){n.lastPersistedState=null})}}}},{key:"pruneUnknownColIds",value:function(e){var t=this.knownColIds();if(0===t.size)return e;var n=f({},e),r=n.filter;if(r){var o=f({},r);["filterModel","columnFilterState","selectableFilters"].forEach(function(e){var n=o[e];n&&(o[e]=Object.fromEntries(Object.entries(n).filter(function(e){var n=s(e,1)[0];return t.has(n)})))}),n.filter=o}var i=n.sort;return null!==i&&void 0!==i&&i.sortModel&&(n.sort=f(f({},i),{},{sortModel:i.sortModel.filter(function(e){return t.has(e.colId)})})),n}},{key:"knownColIds",value:function(){var e,t,n,r=null===(e=this.gridApi)||void 0===e?void 0:e.getColumns();if(r&&r.length>0)return new Set(r.map(function(e){return e.getColId()}));var o=null!==(t=null===(n=this.gridApi)||void 0===n?void 0:n.getColumnDefs())&&void 0!==t?t:[];return new Set(o.flatMap(function(e){var t,n=null!==(t=e.colId)&&void 0!==t?t:e.field;return n?[n]:[]}))}},{key:"cancelPendingGridStateSave",value:function(){null!==this.saveGridStateTimer&&(clearTimeout(this.saveGridStateTimer),this.saveGridStateTimer=null)}},{key:"persistGridStateNow",value:function(){this.cancelPendingGridStateSave(),this.persistGridState()}},{key:"disconnect",value:function(){var e;this.cancelPendingGridStateSave(),this.lastPersistedState=null,this.isRestoringState=!1,this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),null===(e=this.heightOb
2server)||void 0===e||e.disconnect(),this.heightObserver=null,this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.gridBlurHandler&&(document.removeEventListener("mousedown",this.gridBlurHandler),this.gridBlurHandler=null),this.actionAjaxSuccessHandler&&this.hasActionsMenuTarget&&(this.actionsMenuTarget.removeEventListener("ajax:success",this.actionAjaxSuccessHandler),this.actionAjaxSuccessHandler=null),this.modalRefreshObserver&&(this.modalRefreshObserver.disconnect(),this.modalRefreshObserver=null),this.gridApi&&(this.gridApi.destroy(),this.gridApi=null)}},{key:"refreshAfterRemoteAction",value:function(){}},{key:"downloadAndRefresh",value:(p=v(d().m(function e(t){var n,r,o,i,a,u,c;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch(t,{credentials:"same-origin"});case 1:n=e.v,e.n=3;break;case 2:return e.p=2,e.v,alert("Download failed. Please try again."),e.a(2);case 3:if(n.ok){e.n=4;break}return alert("Download failed. Please try again."),e.a(2);case 4:return e.n=5,n.blob();case 5:r=e.v,o=n.headers.get("content-disposition")||"",i=o.match(/filename="?([^";]+)"?/),a=i?i[1]:"download",u=URL.createObjectURL(r),(c=document.createElement("a")).href=u,c.download=a,document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(u),this.refreshAfterRemoteAction();case 6:return e.a(2)}},e,this,[[0,2]])})),function(e){return p.apply(this,arguments)})},{key:"toggleColumnsPanel",value:function(){this.gridApi&&(this.closeExportDropdown(),"columns"===this.gridApi.getOpenedToolPanel()?this.closeToolPanels():(this.gridApi.setSideBarVisible(!0),this.gridApi.openToolPanel("columns"),this.mountToolPanelHeader(),this.hasColumnsToggleTarget&&this.columnsToggleTarget.setAttribute("aria-pressed","true"),this.hasFilterToggleTarget&&this.filterToggleTarget.setAttribute("aria-pressed","false")))}},{key:"toggleFilterPanel",value:function(){this.gridApi&&(this.closeExportDropdown(),"filters-new"===this.gridApi.getOpenedToolPanel()?this.closeToolPanels():(this.gridApi.setSideBarVisible(!0),this.gridApi.openToolPanel("filters-new"),this.mountToolPanelHeader(),this.hasFilterToggleTarget&&this.filterToggleTarget.setAttribute("aria-pressed","true"),this.hasColumnsToggleTarget&&this.columnsToggleTarget.setAttribute("aria-pressed","false")))}},{key:"toggleViewMode",value:function(){this.isBasicMode?this.switchToAdvanced():this.switchToBasic()}},{key:"toggleExportDropdown",value:function(){if(this.hasExportDropdownTarget){var e=!this.exportDropdownTarget.hidden;this.closeToolPanels(),e?this.closeExportDropdown():(this.exportDropdownTarget.hidden=!1,this.hasExportToggleTarget&&this.exportToggleTarget.setAttribute("aria-pressed","true"))}}},{key:"closeToolPanels",value:function(){var e;null===(e=this.gridApi)||void 0===e||e.closeToolPanel(),this.hasColumnsToggleTarget&&this.columnsToggleTarget.setAttribute("aria-pressed","false"),this.hasFilterToggleTarget&&this.filterToggleTarget.setAttribute("aria-pressed","false")}},{key:"setupToolPanelHeaders",value:function(){var e=this;this.gridApi&&(this.gridApi.addEventListener("toolPanelVisibleChanged",function(){return e.mountToolPanelHeader()}),this.gridApi.addEventListener("filterChanged",function(){return e.syncClearAllFiltersButton()}),this.mountToolPanelHeader())}},{key:"mountToolPanelHeader",value:function(){var e,t=this;if(this.gridApi){var n=this.gridApi.getOpenedToolPanel();if(n){var r=this.element.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)");if(r)if(r.querySelector(":scope > .ag-grid-tool-panel-header"))this.syncClearAllFiltersButton();else{var o=document.createElement("div");o.className="ag-grid-tool-panel-header";var i=document.createElement("span");i.className="ag-grid-tool-panel-header__title",i.textContent=null!==(e=A[n])&&void 0!==e?e:"";var a=document.createElement("button");if(a.type="button",a.className="ag-grid-tool-panel-header__close",a.title="Close panel",a.setAttribute("aria-label","Close panel"),a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',a.addEventListener("click",function(){return t.closeToolPanels()}),n===x){var u=document.createElement("button");u.type="button",u.className="ag-grid-tool-panel-header__clear-all",u.textContent="Clear all",u.title="Remove all filters",u.addEventListener("click",function(){return t.clearAllPanelFilters()}),o.append(i,u,a)}else o.append(i,a);r.prepend(o),this.syncClearAllFiltersButton()}}}}},{key:"syncClearAllFiltersButton",value:function(){var e=this.element.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden) > .ag-grid-tool-panel-header .ag-grid-tool-panel-header__clear-all");e&&this.gridApi&&(e.disabled=!this.hasActiveFilters())}},{key:"hasActiveFilters",value:function(){var e,t;return Object.keys(null!==(e=null===(t=this.gridApi)||void 0===t?void 0:t.getFilterModel())&&void 0!==e?e:{}).length>0}},{key:"hasActiveGridState",value:function(){var e;return!!this.gridApi&&(this.hasActiveFilters()||(null!==(e=this.gridApi.getRowGroupColumns())&&void 0!==e?e:[]).length>0||this.gridApi.isPivotMode())}},{key:"syncClearFiltersButton",value:function(){this.gridApi&&this.hasClearFiltersButtonTarget&&(this.clearFiltersButtonTarget.style.display=this.hasActiveGridState()?"":"none")}},{key:"clearAllPanelFilters",value:function(){this.gridApi&&(this.gridApi.setFilterModel({}),this.resetFilterPanelCards(),this.persistGridStateNow())}},{key:"resetFilterPanelCards",value:function(){if(this.gridApi){var e=this.gridApi.getState(),t=e.sideBar;if(null!==t&&void 0!==t&&t.toolPanels&&x in t.toolPanels){var n=f(f({},e),{}
2,{sideBar:f(f({},t),{},{toolPanels:f(f({},t.toolPanels),{},k({},x,{filters:[]}))})});this.gridApi.setState(n,Object.keys(R)),this.mountToolPanelHeader(),this.syncClearAllFiltersButton()}}}},{key:"switchToBasic",value:function(){throw new Error("".concat(this.constructor.name," must implement switchToBasic()"))}},{key:"switchToAdvanced",value:function(){throw new Error("".concat(this.constructor.name," must implement switchToAdvanced()"))}},{key:"setGridChromeHidden",value:function(e){this.hasColumnsToggleTarget&&(this.columnsToggleTarget.hidden=e),this.hasFilterToggleTarget&&(this.filterToggleTarget.hidden=e),this.hasExportToggleTarget&&(this.exportToggleTarget.hidden=e),e&&(this.closeExportDropdown(),this.closeToolPanels())}},{key:"setActiveToggle",value:function(e){if(this.hasViewToggleBasicTarget&&this.hasViewToggleAdvancedTarget){var t="ag-grid-view-toggle__btn--active";"basic"===e?(this.viewToggleBasicTarget.classList.add(t),this.viewToggleAdvancedTarget.classList.remove(t)):(this.viewToggleAdvancedTarget.classList.add(t),this.viewToggleBasicTarget.classList.remove(t)),this.hasViewToggleMobileTarget&&(this.viewToggleMobileTarget.textContent="basic"===e?"Basic":"Advanced")}}},{key:"closeExportDropdown",value:function(){this.hasExportDropdownTarget&&(this.exportDropdownTarget.hidden=!0,this.hasExportToggleTarget&&this.exportToggleTarget.setAttribute("aria-pressed","false"))}},{key:"initDynamicHeight",value:function(){var e=this;this.resizeHandler=function(){return e.updateGridHeight()},window.addEventListener("resize",this.resizeHandler),this.heightObserver=new ResizeObserver(function(){return e.updateGridHeight()}),this.heightObserver.observe(document.body);var t=0,n=function(){e.updateGridHeight()&&++t<3&&requestAnimationFrame(n)};requestAnimationFrame(n)}},{key:"updateGridHeight",value:function(){if(!this.hasGridTarget)return!1;var e=this.gridTarget.getBoundingClientRect(),t=window.innerHeight-e.top-P,n=Math.max(t,S),r=parseFloat(this.gridTarget.style.height)||0;return!(Math.abs(n-r)<1)&&(this.gridTarget.style.height="".concat(n,"px"),!0)}},{key:"syncPanelButtonStates",value:function(){if(this.gridApi){var e=this.gridApi.getOpenedToolPanel();this.hasColumnsToggleTarget&&this.columnsToggleTarget.setAttribute("aria-pressed","columns"===e?"true":"false"),this.hasFilterToggleTarget&&this.filterToggleTarget.setAttribute("aria-pressed","filters-new"===e?"true":"false")}}},{key:"preserveFlexOnAutoSize",value:function(){return!1}},{key:"autoSizeExcludedColIds",value:function(){return L}},{key:"transformStateForPersist",value:function(e){return e}},{key:"afterResetColumns",value:function(){}},{key:"autoSizeNonFlexColumns",value:function(e){var t=this;this.gridApi&&(this.pendingAutoSizeNonFlexFrame?this.widenPendingAutoSizeScope(e):(this.pendingAutoSizeNonFlexFrame=!0,this.pendingAutoSizeScope=null!==e&&void 0!==e?e:null,requestAnimationFrame(function(){var e;t.pendingAutoSizeNonFlexFrame=!1;var n=t.pendingAutoSizeScope;if(t.pendingAutoSizeScope=null,t.gridApi){var r=null!==(e=t.gridApi.getAllDisplayedColumns())&&void 0!==e?e:[];if(0!==r.length){var o=new Set(["ag-Grid-RowNumbersColumn","ag-Grid-SelectionColumn"].concat(c(t.autoSizeExcludedColIds()))),i=t.preserveFlexOnAutoSize()&&t.hasRoomToFitColumns(),a=(i?r.filter(function(e){return null==e.getColDef().flex}):r).map(function(e){return e.getColId()}).filter(function(e){return!o.has(e)}),u=n?a.filter(function(e){return n.includes(e)}):a;u.length>0&&(t.gridApi.autoSizeColumns(u),t.gridApi.applyColumnState({state:u.map(function(e){var n,r;return f({colId:e,width:(null!==(n=null===(r=t.gridApi)||void 0===r||null===(r=r.getColumn(e))||void 0===r?void 0:r.getActualWidth())&&void 0!==n?n:0)+5},i?{}:{flex:null})})}));var s=t.gridTarget.clientWidth;if(r.reduce(function(e,t){return e+t.getActualWidth()},0)<s&&a.length>0){var l=a[a.length-1];t.gridApi.applyColumnState({state:[{colId:l,flex:1}]})}}}})))}},{key:"hasRoomToFitColumns",value:function(){var e,t,n=null!==(e=null===(t=this.gridApi)||void 0===t?void 0:t.getAllDisplayedColumns())&&void 0!==e?e:[],r=n.filter(function(e){return null!=e.getColDef().flex}).length;if(0===r)return!0;var o=n.filter(function(e){return null==e.getColDef().flex}).reduce(function(e,t){return e+t.getActualWidth()},0);return this.gridTarget.clientWidth-o>=r*C}},{key:"widenPendingAutoSizeScope",value:function(e){null!==this.pendingAutoSizeScope&&(this.pendingAutoSizeScope=e?c(new Set([].concat(c(this.pendingAutoSizeScope),c(e)))):null)}},{key:"renderActions",value:function(e){var t,n=this;this.lazyRowActionsToken++;var r=this.actionsMenuTarget.querySelector(".ag-grid-component-actions-menu__actions");
2if(r){r.innerHTML="";var o=e.map(function(e){return e.id}).filter(function(e){return void 0!==e&&null!==e}),i=e.length,a=this.selectionActionsValue.filter(function(t){return!(void 0!==t.minSelection&&i<t.minSelection)&&(!(void 0!==t.maxSelection&&i>t.maxSelection)&&((!t.hideOnSelectAll||!n.isSelectAllActive())&&(!(t.requireAllRowsField&&!e.every(function(e){return e[t.requireAllRowsField]}))&&(!(t.restrictSelectedIdsToRowField&&!e.some(function(e){return e[t.restrictSelectedIdsToRowField]}))&&!(t.urlFromRowField&&(null===(r=e[0])||void 0===r||!r[t.urlFromRowField]))))));var r});if(this.hasRowActionsUrlValue&&this.rowActionsUrlValue&&1===i)this.fetchAndRenderLazyRowActions(e[0],r,o,a);else{var u=this.rowActionsFieldValue||"actions",c=e.map(function(e){return Array.isArray(e[u])?e[u]:[]}),s=null!==(t=c[0])&&void 0!==t?t:[],l=1===c.length?s:s.filter(function(e){return Boolean(e.appendSelectedIds)&&c.slice(1).every(function(t){return t.some(function(t){return t.label===e.label})})});this.renderResolvedActions(r,l,a,o,e,i)}}}},{key:"renderResolvedActions",value:function(e,t,n,r,o,i){var u=this,c=function(e,t){var n,i,a=function(e){var t=e.restrictSelectedIdsToRowField;return t?o.filter(function(e){return e[t]}).map(function(e){return e.id}).filter(function(e){return void 0!==e&&null!==e}):r}(e);if(!e.appendSelectedIds||0===a.length)return t;var u=null!==(n=e.appendSelectedIdsParam)&&void 0!==n?n:"ids",c=new Set(new URLSearchParams(null!==(i=t.split("?")[1])&&void 0!==i?i:"").getAll("".concat(u,"[]"))),s=a.filter(function(e){return!c.has(String(e))});if(0===s.length)return t;var l=s.map(function(e){return"".concat(u,"[]=").concat(e)}).join("&");return t+(t.includes("?")?"&".concat(l):"?".concat(l))},s=1===i&&t.length>0,l=document.createElement("div");if(l.className="ag-grid-component-actions-menu__title",!s&&0===n.length)return l.textContent="Actions unavailable for selection",void e.appendChild(l);l.textContent="Actions",e.appendChild(l);var f=function(e,t){var n=document.createElement("a");if(n.className="ag-grid-component-action-link",n.href=t,e.method&&"get"!==e.method&&(n.dataset.method=e.method,!1!==e.remote&&(n.dataset.remote="true")),e.emitEvent){var i=e.emitEvent;n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),u.hideActionsMenu(),document.dispatchEvent(new CustomEvent(i,{detail:{ids:r,rows:o}}))})}if(e.rel&&(n.rel=e.rel),e.target&&(n.target=e.target),e.turbo_frame){var c=e.turbo_frame;n.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var n=document.querySelector("turbo-frame#".concat(c));n&&n.setAttribute("src",t)})}else if(e.confirm||e.confirm_title||e.confirm_danger){var s=!1;n.addEventListener("click",function(){var r=v(d().m(function r(o){return d().w(function(r){for(;;)switch(r.n){case 0:if(!s){r.n=1;break}return r.a(2);case 1:return o.preventDefault(),o.stopPropagation(),r.n=2,(0,a.j)({title:e.confirm_title,danger:e.confirm_danger,message:e.confirm});case 2:if(r.v){r.n=3;break}return r.a(2);case 3:if(!e.refreshAfterDownload){r.n=5;break}return r.n=4,u.downloadAndRefresh(t);case 4:return r.a(2);case 5:s=!0,n.click(),requestAnimationFrame(function(){s=!1});case 6:return r.a(2)}},r)}));return function(e){return r.apply(this,arguments)}}())}if(e.icon){var l=document.createElement("i");l.className="fa fa-".concat(e.icon),l.setAttribute("aria-hidden","true"),n.appendChild(l)}return n.appendChild(document.createTextNode(" ".concat(e.label))),n};s?t.forEach(function(t){e.appendChild(f(t,c(t,t.url||"#")))}):n.forEach(function(t){if(t.batchDelete){var n=document.createElement("button");if(n.className="ag-grid-component-action-link",n.type="button",t.icon){var i=document.createElement("i");i.className="fa fa-".concat(t.icon),i.setAttribute("aria-hidden","true"),n.appendChild(i)}return n.appendChild(document.createTextNode(" ".concat(t.label))),n.addEventListener("click",v(d().m(function e(){var n,o,i,a,u,c,s,l,f;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a=null!==(n=t.confirm)&&void 0!==n?n:"Remove ".concat(r.length," organization(s)? This cannot be undone."),window.confirm(a)){e.n=1;break}return e.a(2);case 1:u=null!==(o=null===(i=document.querySelector('meta[name="csrf-token"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"",c=y(r),e.p=2,c.s();case 3:if((s=c.n()).done){e.n=5;break}return l=s.value,e.n=4,fetch("/organizations/".concat(l),{method:"DELETE",headers:{"X-CSRF-Token":u,"X-Requested-With":"XMLHttpRequest"}});case 4:e.n=3;break;case 5:e.n=7;break;case 6:e.p=6,f=e.v,c.e(f);case 7:return e.p=7,c.f(),e.f(7);case 8:window.location.reload();case 9:return e.a(2)}},e,null,[[2,6,7,8]])}
2))),void e.appendChild(n)}var a,u,s=t.url||"#";if(t.urlFromRowField)s=String(null!==(a=null===(u=o[0])||void 0===u?void 0:u[t.urlFromRowField])&&void 0!==a?a:"#");else if(t.urlTemplate){var l;s=t.urlTemplate.replace("{id}",String(null!==(l=r[0])&&void 0!==l?l:""))}else s=c(t,s);e.appendChild(f(t,s))})}},{key:"fetchAndRenderLazyRowActions",value:(l=v(d().m(function e(t,n,r,o){var i,a,u,c,s;return d().w(function(e){for(;;)switch(e.n){case 0:if(i=this.lazyRowActionsToken,null!==(a=I(t))){e.n=1;break}return this.renderResolvedActions(n,[],o,r,[t],1),e.a(2);case 1:if(!(u=this.rowActionsCache.get(String(a)))){e.n=2;break}return n.innerHTML="",this.renderResolvedActions(n,u,o,r,[t],1),e.a(2);case 2:return(c=document.createElement("div")).className="ag-grid-component-actions-menu__title",c.textContent="Loading actions\u2026",n.appendChild(c),e.n=3,this.fetchRowActions(a);case 3:if(s=e.v,i===this.lazyRowActionsToken){e.n=4;break}return e.a(2);case 4:n.innerHTML="",this.renderResolvedActions(n,s,o,r,[t],1);case 5:return e.a(2)}},e,this)})),function(e,t,n,r){return l.apply(this,arguments)})},{key:"fetchRowActions",value:function(e){var t=this,n=String(e),r=this.rowActionsCache.get(n);if(r)return Promise.resolve(r);var o=this.rowActionsInflight.get(n);if(o)return o;var i=this.rowActionsUrlValue.replace("{id}",n),a=fetch(i,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){return e.ok?e.json():{row_actions:[]}}).then(function(e){var r=Array.isArray(e.row_actions)?e.row_actions:[];return t.rowActionsCache.set(n,r),r}).catch(function(){return[]}).finally(function(){return t.rowActionsInflight.delete(n)});return this.rowActionsInflight.set(n,a),a}},{key:"prefetchVisibleRowActions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.hasRowActionsUrlValue&&this.rowActionsUrlValue&&this.gridApi){var n=[];if(this.gridApi.forEachNode(function(t){var r=I(t.data);if(null!==r){var o=String(r);e.rowActionsCache.has(o)||e.rowActionsInflight.has(o)||n.push(r)}}),0!==n.length)for(var r=0,o=function(){var t=v(d().m(function t(){var o;return d().w(function(t){for(;;)switch(t.n){case 0:if(!(r<n.length)){t.n=2;break}return o=n[r++],t.n=1,e.fetchRowActions(o).catch(function(){});case 1:t.n=0;break;case 2:return t.a(2)}},t)}));return function(){return t.apply(this,arguments)}}(),i=0;i<Math.min(t,n.length);i++)o()}}},{key:"resetRowActionsCache",value:function(){this.rowActionsCache.clear(),this.rowActionsInflight.clear()}},{key:"hideActionsMenu",value:function(){this.hasActionsMenuTarget&&this.actionsMenuTarget.classList.remove("visible")}},{key:"clearActions",value:function(){this.lazyRowActionsToken++;var e=this.actionsMenuTarget.querySelector(".ag-grid-component-actions-menu__actions");e&&(e.innerHTML="")}},{key:"buildSideBarConfig",value:function(e){return!!e&&{toolPanels:[{id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columns",toolPanel:"agColumnsToolPanel",toolPanelParams:{suppressColumnSelectAll:!1,suppressPivotMode:this.hideAggregationPanelsValue,suppressRowGroups:this.hideAggregationPanelsValue,suppressValues:this.hideAggregationPanelsValue,suppressPivots:this.hideAggregationPanelsValue}},{id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filter",toolPanel:"agNewFiltersToolPanel"}],defaultToolPanel:""}}},{key:"withPivotAwareResetColumns",value:function(e){var t,n=this;return(null!==(t=e.defaultItems)&&void 0!==t?t:[]).map(function(t){return"resetColumns"!==t?t:{name:"Reset Columns",action:function(){e.api.resetColumnState(),e.api.isPivotMode()&&e.api.setGridOption("pivotMode",!1),n.autoSizeNonFlexColumns(),n.afterResetColumns()}}})}},{key:"resetColumnsOnlyMainMenuItems",value:function(e){return this.withPivotAwareResetColumns(f(f({},e),{},{defaultItems:["resetColumns"]}))}},{key:"basicColDefs",value:function(e){return e.map(function(e){return f(f({},e),{},{suppressMovable:!0,enableRowGroup:!1,enablePivot:!1})})}},{key:"withActionsValueFormatter",value:function(e){return e.map(function(e){return"actionsCellRenderer"===e.cellRenderer&&void 0===e.valueFormatter?f(f({},e),{},{valueFormatter:function(){return""}}):e})}},{key:"withRankComparator",value:function(e){return(0,u.m)(e,function(e){var t=e.context,n=null===t||void 0===t?void 0:t.rankField;if("string"!==typeof n)return e;var r=Array.isArray(null===t||void 0===t?void 0:t.valueOrder)?t.valueOrder:null;return f(f({},e),{},{comparator:function(e,t,o,i){var a,u,c=null===o||void 0===o||null===(a=o.data)||void 0===a?void 0:a[n],s=null===i||void 0===i||null===(u=i.data)||void 0===u?void 0:u[n];return void 0!==c&&void 0!==s?Number(c)-Number(s):r?r.indexOf(String(e))-r.indexOf(String(t)):String(null!==e&&void 0!==e?e:"").localeCompare(String(null!==t&&void 0!==t?t:""))}})})}},{key:"setupFollowSelection",value:function(){var e,t,n=this;this.followSelectionValue&&(this.hasActionsMenuTarget&&this.actionsMenuTarget.classList.add("ag-grid-component-actions-menu--follow"),this.hasGridTarget&&(this.gridTarget.addEventListener("mousedown",function(e){e.target.closest(".ag-selection-checkbox")&&(n.lastClickX=e.clientX)}),null===(e=this.gridApi)||void 0===e||e.addEventListener("bodyScroll",function(){return n.scheduleFollowScrollUpdate()}),null===(t=this.gridApi)||void 0===t||t.addEventListener("rowSelected",function(e){return n.handleFollowRowSelected(e)})))}},{key:"getLoadedSelectedNodes",value:function(){if(!this.gridApi)return[];for(var e=[],t=this.gridApi.getDisplayedRowCount(),n=0;n<t;n++){var r=this.gridApi.getDisplayedRowAtIndex(n);r&&!r.group&&r.isSelected()&&e.push(r)}return e}},{key:"handleFollowRowSelected",value:function(e){if(this.followSelectionValue)if("string"===typeof e.source&&e.source.includes("SelectAll")){var t,n=this.getLoadedSelectedNodes();this.followAnchorNodeId=n.length>0&&null!==(t=n[0].id)&&void 0!==t?t:null}else{var r,o=e.node;if(o.isSelected())this.followAnchorNodeId=null!==(r=o.id)&&void 0!==r?r:null;else if(o.id===this.followAnchorNodeId){var i,a=this.getLoadedSelectedNodes();this.followAnchorNodeId=a.length>0&&null!==(i=a[a.length-1].id)&&void 0!==i?i:null}}}},{key:"getFollowAnchorNode",value:function(){if(!this.gridApi)return null;if(this.followAnchorNodeId){var e=this.gridApi.getRowNode(this.followAnchorNodeId);if(null!==e&&void 0!==e&&e.isSelected())return e}var t=this.getLoadedSelectedNodes();return t.length>0?t[t.length-1]:null}},{key:"scheduleFollowScrollUpdate",value:function(){var e=this;this.pendingFollowScrollFrame||(this.pendingFollowScrollFrame=!0,requestAnimationFrame(function(){e.pendingFollowScrollFrame=!1,e.updateFollowScrollVisibility()}))}},{key:"updateFollowScrollVisibility",value:function(){if(this.followSelectionValue&&this.gridApi&&this.hasActionsMenuTarget){var e=this.isSelectAllActive()?this.get
2SelectAllAnchorNode():this.getFollowAnchorNode();if(e){var t=this.gridTarget.querySelector('[row-id="'.concat(CSS.escape(String(e.id)),'"]')),n=this.gridTarget.querySelector(".ag-body-viewport");if(t&&n){var r=t.getBoundingClientRect(),o=n.getBoundingClientRect(),i=r.bottom>o.top&&r.top<o.bottom;if(this.actionsMenuTarget.style.display=i?"":"none",i&&!this.menuDragged){var a,u=this.resolveFollowSelectionColumnX(t);this.positionMenuNearClick(r.top+r.height/2,null!==(a=null!==u&&void 0!==u?u:this.lastClickX)&&void 0!==a?a:0)}}else this.actionsMenuTarget.style.display="none"}}}},{key:"resolveFollowSelectionColumnX",value:function(e){if(!this.hasFollowSelectionColumnValue||!this.followSelectionColumnValue)return null;var t=e.querySelector('[col-id="'.concat(CSS.escape(this.followSelectionColumnValue),'"]'));return t?t.getBoundingClientRect().left:null}},{key:"isSelectAllActive",value:function(){return!1}},{key:"getSelectAllAnchorNode",value:function(){return null}},{key:"positionMenuNearClick",value:function(e,t){var n,r,o=this.actionsMenuTarget,i=o.parentElement;if(i){var a=o.offsetWidth||275,u=o.offsetHeight||220,c=i.getBoundingClientRect(),s=null!==(n=null===(r=this.gridApi)||void 0===r||null===(r=r.getAllDisplayedColumns()[0])||void 0===r?void 0:r.getActualWidth())&&void 0!==n?n:48,l=window.innerHeight-u-16,f=this.hasGridTarget?this.gridTarget.getBoundingClientRect():null,d=f?f.bottom-u-8:l,p=Math.min(l,d),h=Math.min(Math.max(e+15,0),Math.max(p,0)),v=c.left+s+8,y=window.innerWidth-a-8,m=Math.min(Math.max(t+8,v),Math.max(y,v));o.style.top="".concat(h-c.top,"px"),o.style.left="".concat(m-c.left,"px"),o.style.right="auto",o.style.bottom="auto"}}},{key:"setupMenuDrag",value:function(){var e=this;if(this.hasActionsMenuTarget&&this.draggableMenuValue){var t=this.actionsMenuTarget;t.classList.add("ag-grid-component-actions-menu--draggable"),this.hasSelectedCountTarget&&(this.selectedCountTarget.title="Drag to move"),t.addEventListener("mousedown",function(n){if(0===n.button&&n.target.closest(".ag-grid-component-actions-menu__count")){var r=t.parentElement.getBoundingClientRect(),o=t.getBoundingClientRect(),i=n.clientX-o.left,a=n.clientY-o.top,u=!1,c=function(c){if(u||!(Math.hypot(c.clientX-n.clientX,c.clientY-n.clientY)<4)){u=!0,e.menuDragged=!0,t.classList.add("ag-grid-component-actions-menu--dragging");var s=Math.min(Math.max(c.clientX-i,8),window.innerWidth-o.width-8),l=Math.min(Math.max(c.clientY-a,8),window.innerHeight-o.height-8);t.style.left="".concat(s-r.left,"px"),t.style.top="".concat(l-r.top,"px"),t.style.right="auto",t.style.bottom="auto"}},s=function(){document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",s),t.classList.remove("ag-grid-component-actions-menu--dragging")};document.addEventListener("mousemove",c),document.addEventListener("mouseup",s),n.preventDefault()}})}}},{key:"resetMenuPosition",value:function(){if(this.hasActionsMenuTarget){this.menuDragged=!1;var e=this.actionsMenuTarget;e.style.top="",e.style.left="",e.style.right="",e.style.bottom=""}}}],r&&g(n.prototype,r),i&&g(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,l,p,h}(r.xI);B.targets=["grid","actionsMenu","selectedCount","viewToggleBasic","viewToggleAdvanced","viewToggleMobile","columnsToggle","filterToggle","exportToggle","exportDropdown","clearFiltersButton"],B.values={licenseKey:String,columnDefs:Array,gridOptions:Object,gridStateUrl:String,advancedColumnDefs:Array,selectionActions:Array,followSelection:Boolean,followSelectionColumn:String,rowActionsField:String,rowActionsUrl:String,hideAggregationPanels:Boolean,draggableMenu:{type:Boolean,default:!0}}},8513:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return pe}});var r=n(8179),o=n(4546);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEac
2h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||f(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function f(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var v=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.widths=new Map,this.scope="",this.sharedColIds=new Set},(t=[{key:"setScope",value:function(e){this.scope=null===e||void 0===e?"":String(e)}},{key:"setSharedColIds",value:function(e){this.sharedColIds=new Set(e)}},{key:"keyFor",value:function(e){return!this.scope||this.sharedColIds.has(e)?e:"".concat(this.scope,":").concat(e)}},{key:"parseKey",value:function(e){var t=e.indexOf(":");return-1===t?{scope:"",colId:e}:{scope:e.slice(0,t),colId:e.slice(t+1)}}},{key:"recordResize",value:function(e){var t,n;if(e.finished&&"uiColumnResized"===e.source){var r,o=new Set(null!==(t=e.flexColumns)&&void 0!==t?t:[]),i=l(null!==(n=e.columns)&&void 0!==n?n:[]);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.has(a)||this.widths.set(this.keyFor(a.getColId()),a.getActualWidth())}}catch(u){i.e(u)}finally{i.f()}}}},{key:"seedFrom",value:function(e){var t=e.userSizedWidths;if(t&&"object"===typeof t&&!Array.isArray(t))for(var n=0,r=Object.entries(t);n<r.length;n++){var o=s(r[n],2),i=o[0],a=o[1];"number"===typeof a&&(this.widths.has(i)||this.widths.set(i,a))}}},{key:"toPersistShape",value:function(){return Object.fromEntries(this.widths.entries())}},{key:"colIds",value:function(){var e,t=new Set,n=l(this.widths.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value,o=this.parseKey(r),i=o.scope,a=o.colId;""!==i&&i!==this.scope||t.add(a)}}catch(u){n.e(u)}finally{n.f()}return c(t)}},{key:"applyTo",value:function(e,t){var n=this;if(0!==this.widths.size){var r=c(this.widths.entries()).map(function(e){var t=s(e,2),r=t[0],o=t[1];return a(a({},n.parseKey(r)),{},{width:o})}).filter(function(e){var r=e.scope,o=e.colId;return(""===r||r===n.scope)&&t.has(o)}).map(function(e){return{colId:e.colId,width:e.width,flex:null}});0!==r.length&&e.applyColumnState({state:r})}}},{key:"clear",value:function(){for(var e=0,t=c(this.widths.keys());e<t.length;e++){var n=t[e],r=this.parseKey(n).scope;""!==r&&r!==this.scope||this.widths.delete(n)}}},{key:"isEmpty",value:function(){return 0===this.widths.size}}])&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}(),y=n(573),m=n(8990),b=n(8882),g=n(8787),w=n(7374),_=n(1720),O=n(7592),T=n(7198),k=n(5138),j=n(2309),S=n(737),P=n(6935),E=n(7787);function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?C(Object(n),!0).forEach(function(t){A(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function A(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return L(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function I(e,t){var n=function(e){var t=e?/^(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2}):(\d{2}))?/.exec(e):null;if(!t)return null;var n=R(t.map(Number),7),r=n[1],o=n[2],i=n[3],a=n[4],u=n[5],c=n[6];return new Date(r,o-1,i,a||0,u||0,c||0)}(t);return n?(n.setHours(0,0,0,0),n<e?-1:n>e?1:0):-1}function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(t){M(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){var n=Number(e),r=Number(t);return Number.isNaN(n)&&Number.isNaN(r)?0:Number.isNaN(n)?-1:Number.isNaN(r)?1:n-r}function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function H(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q(e){return function(e){if(Array.isArray(e))return U(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return U(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var G=n(1708),z=n(5404),W=["mode"];function K(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;
2!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||Q(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(e,t){if(e){if("string"==typeof e)return X(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Y(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function $(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return J(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(J(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,J(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,J(f,"constructor",s),J(s,"constructor",c),c.displayName="GeneratorFunction",J(s,o,"GeneratorFunction"),J(f),J(f,o,"Generator"),J(f,r,function(){return this}),J(f,"toString",function(){return"[object Generator]"}),($=function(){return{w:i,m:d}})()}function J(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}J=function(e,t,n,r){function i(t,n){J(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},J(e,t,n,r)}function Z(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function ee(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){Z(i,r,o,a,u,"next",e)}function u(e){Z(i,r,o,a,u,"throw",e)}a(void 0)})}}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach(function(t){re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function re(e,t,n){return(t=ie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ie(r.key),r)}}function ie(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function ae(e,t,n){return t=le(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ue()?Reflect.construct(t,n||[],le(e).constructor):t.apply(e,n))}function ue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ue=function(){return!!e})()}function ce(e,t,n,r){var o=se(le(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function se(){return se="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=le(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},se.apply(null,arguments)}function le(e){return le=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},le(e)}function fe(e,t){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fe(e,t)}var de,pe=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=ae(this,t,[].concat(r))).headerContextMenuBlocker=null,e.hasActiveRange=!1,e.totalRowCount=0,e.dataFetchGeneration=0,e.pendingRestoreState=null,e.userSizedColumns=new v,e.initialStateSettled=!1,e.saveRequestedBeforeSettle=!1,e.handleGridRefresh=function(){e.refreshRowData()},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fe(e,t)}(t,e),n=t,i=[{key:"connect",value:function(){var e,n,o,i=this;ce(t,"connect",this,3)([]),this.persistUserColumnWidthsValue&&(this.userSizedColumns.setSharedColIds(this.sharedWidthColIdsValue),this.userSizedColumns.setScope(this.widthScopeValue)),this.element.addEventListener("grid:refresh",this.handleGridRefresh);var a=this.advancedColumnDefsValue.length>0,u=this.buildSideBarConfig(a),c=null!==(e=this.gridOptionsValue.defaultColDef)&&void 0!==e?e:{},s=ne(ne({theme:this.resolveTheme(),localeText:P.V,columnDefs:this.decorateColumnDefs(this.withRankComparator(this.withActionsValueFormatter(a?this.basicColDefs(this.columnDefsValue):this.columnDefsValue))),sideBar:u,enableFilterHandlers:!0,autoGroupColumnDef:{comparator:function(e,t,n,r){var o,a,u,c,s,l,f,d=null!==(o=n.field)&&void 0!==o?o:"",p=d?null===(a=i.gridApi)||void 0===a||null===(a=a.getColumn(d))||void 0===a?void 0:a.getColDef():null;return null!==p&&void 0!==p&&null!==(u=p.context)&&void 0!==u&&u.countSort?(null!==(c=null===(s=n.allLeafChildren)||void 0===s?void 0:s.length)&&void 0!==c?c:0)-(null!==(l=null===(f=r.allLeafChildren)||void 0===f?void 0:f.length)&&void 0!==l?l:0):String(null!==e&&void 0!==e?e:"").localeCompare(String(null!==t&&void 0!==t?t:""))}},components:{statusCellRenderer:y.M,actionsCellRenderer:m.H,dropdownActionsCellRenderer:b.U,linkCellRenderer:g.w,postLinkCellRenderer:w.q,multilineTextCellRenderer:_.W,maskedTextCellRenderer:O.w,iconBadgeCellRenderer:T.U,electionNameCellRenderer:k.Y,statusTestFilter:j.$},filterHandlers:{statusTestFilter:j.N},onSelectionChanged:function(e){i.handleSelectionChanged(e)},onCellSelectionChanged:function(){i.handleRangeSelectionChanged()},onColumnRowGroupChanged:function(){i.autoSizeNonFlexColumns()},onRowGroupOpened:function(){i.autoSizeNonFlexColumns()},onModelUpdated:function(){i.pendingAutoSize&&(i.pendingAutoSize=!1,i.autoSizeNonFlexColumns()),i.refreshFooterRow()},onColumnResized:function(e){i.persistUserColumnWidthsValue&&i.userSizedColumns.recordResize(e)},onStateUpdated:function(){i.saveGridState()},getMainMenuItems:function(e){return i.withPivotAwareResetColumns(e)},getContextMenuItems:this.exportUrlValue?function(e){var t;return i.withServerExportMenuItems(null!==(t=e.defaultItems)&&void 0!==t?t:[])}:void 0,processCellForClipboard:function(e){return(0,G.Vl)(e)},onRowDragEnd:this.rowReorderUrlValue?function(){return i.persistRowOrder()}:void 0,onFilterChanged:this.rowReorderUrlValue?function(){return i.syncRowDragSuppression()}:void 0},this.gridOptionsValue),{},{defaultColDef:ne({filterParams:P.m},c)});null!==(n=this.gridOptionsValue)&&void 0!==n&&n.treeData&&!s.getDataPath&&(s.getDataPath=function(e){return e.group_path});var l=s.rowSelection;l&&"object"===typeof l&&(l.isRowSelectable=this.rowSelectableCallback),this.hasGridTarget&&(this.gridApi=(0,r.Dvw)(this.gridTarget,s),this.syncDefaultExportParams(),this.setupToolPanelHeaders(),"autoHeight"===(null===(o=this.gridOptionsValue)||void 0===o?void 0:o.domLayout)||this.initDynamicHeight(),this.loadGridState(),this.setupFollowSelection(),a&&(this.isBasicMode=!0,this.setBasicModeColumnOptions(),this.headerContextMenuBlocker=function(e){i.isBasicMode&&e.target.closest(".ag-header")&&(e.stopImmediatePropagation(),e.preventDefault())},this.gridTarget.addEventListener("contextmenu",this.headerContextMenuBlocker,!0)),this.rowDataUrlValue?this.fetchRowData(this.rowDataUrlValue):this.rowDataValue.length>0&&(this.pendingAutoSize=!0,this.gridApi.setGridOption("rowData",this.rowDataValue)),this.gridBlurHandler=function(e){var t,n=e.target;if(!i.gridTarget.contains(n)){var r=i.hasExportToggleTarget?i.exportToggleTarget.closest(".ag-grid-component-export-wrapper"):null;null!==r&&void 0!==r&&r.contains(n)||(null===(t=i.gridApi)||void 0===t||t.clearCellSelection(),i.hasActiveRange=!1,i.syncDefaultExportParams())}},document.addEventListener("mousedown",this.gridBlurHandler))}},{key:"disconnect",value:function(){this.pendingRestoreState=null,this.headerContextMenuBlocker&&this.hasGridTarget&&(this.gridTarget.removeEventListener("contextmenu",this.headerContextMenuBlocker,!0),this.headerContextMenuBlocker=null),this.element.removeEventListener("grid:refresh",this.handleGridRefresh),ce(t,"disconnect",this,3)([])}},{key:"refreshRowData",value:function(){var e=this;if(this.gridApi&&this.rowDataUrlValue){var t=++this.dataFetchGeneration;fetch(this.rowDataUrlValue,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){if(!e.ok)throw new Error("Failed to refresh row data: ".concat(e.status));return e.json()}).then(function(n){var r;if(t===e.dataFetchGeneration&&e.gridApi){var o=Array.isArray(n)?n:null!==(r=n.rows)&&void 0!==r?r:[];e.gridApi.setGridOption("rowData",o)}}).catch(function(n){t===e.dataFetchGeneration&&console.error("[AgGridComponent] refreshRowData error:",n)})}}},{key:"onFilterTextBoxChanged",value:function(){if(this.gridApi&&this.hasQuickFilterInputTarget){var e=this.quickFilterInputTarget.value;this.gridApi.setGridOption("quickFilterText",e),this.syncRowDragSuppression()}}},{key:"syncRowDragSuppression",value:function(){this.gridApi&&this.rowReorderUrlValue&&this.gridApi.setGridOption("suppressRowDrag",this.reorderUnsafe())}},{key:"reorderUnsafe",value:function(){var e,t;return this.hasQuickFilterInputTarget&&this.quickFilterInputTarget.value.trim().length>0||null!==(e=null===(t=this.gridApi)||void 0===t?void 0:t.isAnyFilterPresent())&&void 0!==e&&e}},{key:"persistRowOrder",value:function(){var e,t;if(this.gridApi&&this.rowReorderUrlValue&&!this.reorderUnsafe()){var n=[];if(this.gridApi.forEachNodeAfterFilterAndSort(function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.id;void 0!==r&&null!==r&&n.push(r)}),0!==n.length){var r=null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"";fetch(this.rowReorderUrlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":r},credentials:"same-origin",body:JSON.stringify({votes_in_order:n,offset:0})}).catch(function(e){console.error("[AgGridComponent] persistRowOrder error:",e)})}}}},{key:"switchToBasic",value:function(){var e;this.gridApi&&(this.isBasicMode=!0,this.gridApi.setGridOption("loading",!0),this.setActiveToggle("basic"),this.setBasicModeColumnOptions(),this.hasFilterToggleTarget&&(this.gridApi.closeToolPanel(),this.filterToggleTarget.style.display="none",this.filterToggleTarget.setAttribute("aria-pressed","fal
2se")),this.hasColumnsToggleTarget&&(this.columnsToggleTarget.style.display="none",this.columnsToggleTarget.setAttribute("aria-pressed","false")),this.hasExportToggleTarget&&this.closeExportDropdown(),this.hasActiveRange=!1,this.hasRowSelection=!1,this.syncDefaultExportParams(),null===(e=this.gridApi)||void 0===e||e.clearCellSelection(),this.applyModeColumnDefs(this.rowDataUrlValue,this.basicColDefs(this.columnDefsValue)),this.saveGridState())}},{key:"switchToAdvanced",value:function(){var e;this.gridApi&&(this.isBasicMode=!1,this.gridApi.setGridOption("loading",!0),this.setActiveToggle("advanced"),this.setAdvancedModeColumnOptions(),this.hasFilterToggleTarget&&(this.filterToggleTarget.style.display=""),this.hasColumnsToggleTarget&&(this.columnsToggleTarget.style.display=""),this.hasActiveRange=!1,this.hasRowSelection=!1,this.syncDefaultExportParams(),null===(e=this.gridApi)||void 0===e||e.clearCellSelection(),this.applyModeColumnDefs(this.advancedRowDataUrlValue,this.advancedColumnDefsValue),this.saveGridState())}},{key:"exportCsv",value:function(e){var t=this.resolveExportTitle(e);if(this.hasActiveRange)this.exportRangeData("csv",t);else if(this.exportUrlValue)this.triggerServerExport("csv");else{var n,r,o=function(e){return(0,G.Vl)(e)},i=function(e){return(0,G.cQ)(e)},a=this.csvPrependContent(t),u=this.resolveExportFileName("csv");this.hasRowSelection?null===(n=this.gridApi)||void 0===n||n.exportDataAsCsv(ne(ne({},this.buildSelectionExportParams()),{},{processCellCallback:o,processRowGroupCallback:i,prependContent:a,fileName:u})):null===(r=this.gridApi)||void 0===r||r.exportDataAsCsv({processCellCallback:o,processRowGroupCallback:i,prependContent:a,fileName:u}),this.closeExportDropdown()}}},{key:"exportExcel",value:function(e){var t=this.resolveExportTitle(e);if(this.hasActiveRange)this.exportRangeData("excel",t);else if(this.exportUrlValue)this.triggerServerExport("xlsx");else{var n,r,o=function(e){return(0,G.Vl)(e)},i=function(e){return(0,G.cQ)(e)},a=this.excelPrependContent(t),u=this.resolveExportFileName("xlsx");this.hasRowSelection?null===(n=this.gridApi)||void 0===n||n.exportDataAsExcel(ne(ne({},this.buildSelectionExportParams()),{},{processCellCallback:o,processRowGroupCallback:i,prependContent:a,fileName:u})):null===(r=this.gridApi)||void 0===r||r.exportDataAsExcel({processCellCallback:o,processRowGroupCallback:i,prependContent:a,fileName:u}),this.closeExportDropdown()}}},{key:"triggerServerExport",value:(l=ee($().m(function e(t){var n,r,o,i,a,u,c,s,l,f;return $().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.closeExportDropdown(),o=this.selectedRowIds(),i=null!==(n=null===(r=document.querySelector('meta[name="csrf-token"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",e.p=1,e.n=2,fetch(this.exportUrlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":i,Accept:"text/vnd.turbo-stream.html, text/html, application/xhtml+xml"},credentials:"same-origin",body:JSON.stringify({format:t,mode:o.length>0?"rows":"all",row_ids:o.length>0?o:void 0,search_text:this.hasQuickFilterInputTarget&&this.quickFilterInputTarget.value.trim()||void 0,filter_model:null!==(a=null===(u=this.gridApi)||void 0===u?void 0:u.getFilterModel())&&void 0!==a?a:{},advanced:!this.isBasicMode})});case 2:if((s=e.v).ok){e.n=3;break}throw new Error("Request failed: ".concat(s.status));case 3:return e.n=4,s.text();case 4:(l=e.v).trim()&&(null===(c=window.Turbo)||void 0===c||c.renderStreamMessage(l)),e.n=6;break;case 5:e.p=5,f=e.v,console.error("[AgGridComponent] export error:",f),alert("Export failed. Please try again.");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return l.apply(this,arguments)})},{key:"withServerExportMenuItems",value:function(e){var t=this,n=e.filter(function(e){return"export"!==e});return n.push({name:"Export",icon:'<span class="ag-icon ag-icon-save"></span>',subMenu:[{name:"CSV Export",icon:'<span class="ag-icon ag-icon-csv"></span>',action:function(){return t.exportCsv()}},{name:"Excel Export",icon:'<span class="ag-icon ag-icon-excel"></span>',action:function(){return t.exportExcel()}}]}),n}},{key:"selectedRowIds",value:function(){return this.hasRowSelection&&this.gridApi?this.gridApi.getSelectedNodes().map(function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.id}).filter(function(e){return null!=e}).map(String):[]}},{key:"confirmAndPost",value:(s=ee($().m(function e(t,n){var r,o,i,a,u;return $().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return e.n=2,(0,z.j)(n);case 2:if(e.v){e.n=3;break}return e.a(2,!1);case 3:return i=null!==(r=null===(o=document.querySelector('meta[name="csrf-token"]'))||void 0===o?void 0:o.content)&&void 0!==r?r:"",e.p=4,e.n=5,fetch(t,{method:"POST",headers:{"X-CSRF-Token":i,"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"});case 5:if((a=e.v).ok){e.n=6;break}throw new Error("Request failed: ".concat(a.status));case 6:return e.a(2,!0);case 7:return e.p=7,u=e.v,console.error("[AgGridComponent] confirmAndPost error:",u),alert("Export failed. Please try again."),e.a(2,!1)}},e,null,[[4,7]])})),function(e,t){return s.apply(this,arguments)})},{key:"resolveExportTitle",value:function(e){return"string"===typeof e&&e?e:this.exportTitleValue||void 0}},{key:"resolveExportFileName",value:function(e){var t=this.exportFileNameValue||this.slugify(this.exportTitleValue)||"exp
2ort",n=new Date,r=function(e){return String(e).padStart(2,"0")},o="".concat(n.getFullYear(),"-").concat(r(n.getMonth()+1),"-").concat(r(n.getDate()),"_").concat(r(n.getHours()),"_").concat(r(n.getMinutes()));return"".concat(t,"-").concat(o,".").concat(e)}},{key:"slugify",value:function(e){return(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}},{key:"csvPrependContent",value:function(e){return e?[[{data:{value:e}}]]:void 0}},{key:"excelPrependContent",value:function(e){return e?[{cells:[{data:{type:"String",value:e}}]}]:void 0}},{key:"fetchQuestionData",value:function(e,t){var n=this;this.gridApi&&(this.gridApi.setGridOption("loading",!0),this.hasActiveRange=!1,this.hasRowSelection=!1,this.syncDefaultExportParams(),this.gridApi.clearCellSelection(),this.gridApi.setFilterModel(null),this.gridApi.resetColumnState(),this.hasQuickFilterInputTarget&&(this.quickFilterInputTarget.value="",this.gridApi.setGridOption("quickFilterText","")),fetch(e,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){if(!e.ok)throw new Error("Failed to fetch question data: ".concat(e.status));return e.json()}).then(function(e){var r,o,i;n.gridApi&&(n.pendingAutoSize=!0,n.persistUserColumnWidthsValue&&n.userSizedColumns.setScope(t),n.gridApi.setGridOption("columnDefs",n.decorateColumnDefs(null!==(r=e.column_defs)&&void 0!==r?r:[])),n.drainPendingRestoreState(),n.persistUserColumnWidthsValue&&n.applyUserSizedWidths(),n.gridApi.setGridOption("rowData",null!==(o=e.rows)&&void 0!==o?o:[]),n.gridApi.setGridOption("pinnedBottomRowData",null!==(i=e.footer_row)&&void 0!==i?i:[]),n.gridApi.setGridOption("loading",!1))}).catch(function(e){var t;console.error("[AgGridComponent] fetchQuestionData error:",e),null===(t=n.gridApi)||void 0===t||t.setGridOption("loading",!1)}))}},{key:"setBasicModeColumnOptions",value:function(){var e;if(this.gridApi){var t=null!==(e=this.gridOptionsValue.defaultColDef)&&void 0!==e?e:{};this.gridApi.setGridOption("defaultColDef",ne(ne({filterParams:P.m},t),{},{suppressHeaderMenuButton:!0})),this.gridApi.setGridOption("suppressDragLeaveHidesColumns",!0),Object.keys(this.basicModeOptionsValue).length>0&&this.gridApi.updateGridOptions(this.basicModeOptionsValue)}}},{key:"setAdvancedModeColumnOptions",value:function(){var e;if(this.gridApi){var t=null!==(e=this.gridOptionsValue.defaultColDef)&&void 0!==e?e:{};this.gridApi.setGridOption("defaultColDef",ne({filterParams:P.m},t)),this.gridApi.setGridOption("suppressDragLeaveHidesColumns",!1),Object.keys(this.advancedModeOptionsValue).length>0&&this.gridApi.updateGridOptions(this.advancedModeOptionsValue)}}},{key:"handleRangeSelectionChanged",value:function(){var e,t,n,r,o,i=null===(e=this.gridApi)||void 0===e?void 0:e.getCellRanges();if(!i||0===i.length)return this.hasActiveRange=!1,void this.syncDefaultExportParams();var a=i[0],u=null!==(t=null===(n=a.startRow)||void 0===n?void 0:n.rowIndex)&&void 0!==t?t:0,c=null!==(r=null===(o=a.endRow)||void 0===o?void 0:o.rowIndex)&&void 0!==r?r:0,s=Math.abs(c-u)+1;this.hasActiveRange=s>1||a.columns.length>1,this.syncDefaultExportParams()}},{key:"buildRangeExportParams",value:function(){if(!this.gridApi)return null;var e=this.gridApi.getCellRanges();if(!e||0===e.length)return null;var t,n,r=e[0],o="bottom"===r.startRow.rowPinned,i="bottom"===r.endRow.rowPinned,a=o||i,u=r.columns.map(function(e){return e.getColId()});if(o&&i)t=0,n=-1;else if(i)t=r.startRow.rowIndex,n=this.gridApi.getDisplayedRowCount()-1;else if(o)t=0,n=r.endRow.rowIndex;else{var c=r.startRow.rowIndex,s=r.endRow.rowIndex;t=Math.min(c,s),n=Math.max(c,s)}return{columnKeys:u,shouldRowBeSkipped:function(e){var r,o=e.node;if("bottom"===o.rowPinned)return!a;var i=null!==(r=o.rowIndex)&&void 0!==r?r:-1;return i<t||i>n}}}},{key:"buildSelectionExportParams",value:function(){return{shouldRowBeSkipped:function(e){var t=e.node;return"bottom"!==t.rowPinned&&!t.isSelected()}}}},{key:"syncDefaultExportParams",value:function(){if(this.gridApi){var e,t={};this.hasActiveRange?t=null!==(e=this.buildRangeExportParams())&&void 0!==e?e:{}:this.hasRowSelection&&(t=this.buildSelectionExportParams());var n=ne({processCellCallback:function(e){return(0,G.Vl)(e)},processRowGroupCallback:function(e){return(0,G.cQ)(e)}},t);this.gridApi.setGridOption("defaultCsvExportParams",ne(ne({},n),{},{fileName:this.resolveExportFileName("csv")})),this.gridApi.setGridOption("defaultExcelExportParams",ne(ne({},n),{},{fileName:this.resolveExportFileName("xlsx")}))}}},{key:"exportRangeData",value:function(e,t){if(this.gridApi){var n=this.buildRangeExportParams();if(n){var r=function(e){return(0,G.Vl)(e)},o=function(e){return(0,G.cQ)(e)};if("csv"===e){var i=this.csvPrependContent(t);this.gridApi.exportDataAsCsv(ne(ne({},n),{},{processCellCallback:r,processRowGroupCallback:o,prependContent:i,fileName:this.resolveExportFileName("csv")}))}else{var a=this.excelPrependContent(t);this.gridApi.exportDataAsExcel(ne(ne({},n),{},{processCellCallback:r,processRowGroupCallback:o,prependContent:a,fileName:this.resolveExportFileName("xlsx")}))}this.closeExportDropdown()}}}},{key:"fetchGridStateResult",value:(c=ee($().m(function e(){var t,n,r;return $().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.gridStateUrlValue){e.n=1;break}return e.a(2,{ok:!0,state:null});case 1:return e.p=1,e.n=2,fetch(this.gridStateUrlValue,{headers:{Accept:"application/json"},credentials:"same-origin"});case 2:if((t=e.v).ok){e.n=3;break}return e.a(2,{ok:!1,state:null});case 3:return e.n=4,t.json();case 4:return n=e.v,r=null===n||void 0===n?void 0:n.state,e.a(2,{ok:!0,state:r&&Object.keys(r).length>0?r:null});case 5:return e.p=5,e.v,e.a(2,{ok:!1,state:null})}},e,this,[[1,5]])})),function(){return c.apply(this,arguments)})},{key:"loadGridState",value:(u=ee($().m(function e(){var t,n,r,o,i,a;return $().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.fetchGridStateResult();case 1:if(t=e.v,n=t.ok,r=t.state,this.gridApi){e.n=2;break}return e.a(2);case 2:if(n){e.n=3;break}return e.a(2);case 3:if(r){e.n=4;break}return this.settleInitialState(),e.a(2);case 4:if(o=r.mode,i=Y(r,W),this.persistUserColumnWidthsValue&&this.userSizedColumns.seedFrom(i),0!==Object.keys(i).length){e.n=5;break}return this.settleInitialState(),e.a(2);case 5:if(a=this.advancedColumnDefsValue.length>
20,this.isRestoringState=!0,"advanced"!==o||!a){e.n=6;break}return this.pendingRestoreState=i,this.switchToAdvanced(),e.a(2);case 6:if(0!==this.knownColIds().size){e.n=7;break}return this.pendingRestoreState=i,e.a(2);case 7:this.applyRestoredState(i);case 8:return e.a(2)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"drainPendingRestoreState",value:function(){if(this.pendingRestoreState){var e=this.pendingRestoreState;this.pendingRestoreState=null,this.applyRestoredState(e)}}},{key:"discardPendingRestoreState",value:function(){var e=null!==this.pendingRestoreState;this.pendingRestoreState=null,this.isRestoringState=!1,e&&this.settleInitialState()}},{key:"applyRestoredState",value:function(e){var t=this;if(this.gridApi){var n=Object.fromEntries(Object.entries(e).filter(function(e){return"userSizedWidths"!==K(e,1)[0]})),r=this.gridStateKeysValue,o=0===r.length&&!this.persistUserColumnWidthsValue,i=o?n:Object.fromEntries(Object.entries(n).filter(function(e){var t=K(e,1)[0];return r.includes(t)}));try{Object.keys(i).length>0&&this.setScopedState(i,!o)}finally{requestAnimationFrame(function(){t.isRestoringState=!1,t.syncPanelButtonStates(),t.persistUserColumnWidthsValue&&t.applyUserSizedWidths(),t.settleInitialState()})}}}},{key:"applyUserSizedWidths",value:function(){this.gridApi&&this.userSizedColumns.applyTo(this.gridApi,this.knownColIds())}},{key:"setScopedState",value:function(e,t){if(this.gridApi){var n=this.pruneUnknownColIds(e);if(t){var r=ne(ne({},this.gridApi.getState()),n),o=Object.keys(r).filter(function(e){return!(e in n)});this.gridApi.setState(r,o)}else this.gridApi.setState(n)}}},{key:"settleInitialState",value:function(){this.initialStateSettled=!0,this.saveRequestedBeforeSettle&&(this.saveRequestedBeforeSettle=!1,this.saveGridState())}},{key:"saveGridState",value:function(){this.initialStateSettled?ce(t,"saveGridState",this,3)([]):this.saveRequestedBeforeSettle=!0}},{key:"autoSizeExcludedColIds",value:function(){return this.persistUserColumnWidthsValue?new Set(this.userSizedColumns.colIds()):o.EMPTY_SET}},{key:"transformStateForPersist",value:function(e){if(!this.persistUserColumnWidthsValue)return e;var t=this.gridStateKeysValue;return ne(ne({},Object.fromEntries(Object.entries(e).filter(function(e){var n=K(e,1)[0];return"mode"===n||t.includes(n)}))),{},{userSizedWidths:this.userSizedColumns.toPersistShape()})}},{key:"afterResetColumns",value:function(){this.persistUserColumnWidthsValue&&(this.userSizedColumns.clear(),this.persistGridStateNow())}},{key:"fetchRowData",value:function(e){this.fetchRowDataWithColumnDefs(e,null)}},{key:"resolveTheme",value:function(){return this.plainHeaderValue?S.Qt:S.HQ}},{key:"decorateColumnDefs",value:function(e){return function(e,t){var n;if(!t.length||!e.length)return e;var r=function(e){return!Array.isArray(e.children)},o=e.reduce(function(e,t,n){return r(t)?[].concat(q(e),[n]):e},[]),i=o.find(function(t){return!0!==e[t].hide}),a=null!==(n=null!==i&&void 0!==i?i:o[0])&&void 0!==n?n:-1,u=function(e){return t.map(function(t){var n,r;return null!==(n=null===(r=e.data)||void 0===r?void 0:r[t])&&void 0!==n?n:""}).join(" ")},c=function(){return""};return e.map(function(e,t){return r(e)?V(V({},e),{},{getQuickFilterText:t===a?u:c}):V(V({},e),{},{children:(0,E.m)(e.children,function(e){return V(V({},e),{},{getQuickFilterText:c})})})})}(function(e){return(0,E.m)(e,function(e){var t;return null!==(t=e.context)&&void 0!==t&&t.numericSort?D(D({},e),{},{comparator:F}):e})}(function(e){return(0,E.m)(e,function(e){var t;return"agDateColumnFilter"===e.filter?x(x({},e),{},{filterParams:x(x({},null!==(t=e.filterParams)&&void 0!==t?t:{}),{},{comparator:I})}):e})}(this.withStatusCountsUrl(e))),this.quickFilterFieldsValue)}},{key:"withStatusCountsUrl",value:function(e){var t=this;return this.filterValuesUrlValue?e.map(function(e){var n,r=e.filter;return r&&"object"===typeof r&&"statusTestFilter"===r.component?ne(ne({},e),{},{filterParams:ne(ne({},null!==(n=e.filterParams)&&void 0!==n?n:{}),{},{statusCountsUrl:t.filterValuesUrlValue})}):e}):e}},{key:"applyModeColumnDefs",value:function(e,t){e?this.fetchRowDataWithColumnDefs(e,t):this.gridApi&&(this.pendingAutoSize=!0,this.gridApi.setGridOption("c
2olumnDefs",this.decorateColumnDefs(t)),this.gridApi.setGridOption("loading",!1),this.drainPendingRestoreState())}},{key:"fetchRowDataWithColumnDefs",value:function(e,t){var n,r=this;if(!e)return console.error("[AgGridComponent] fetchRowDataWithColumnDefs called without a url"),null===(n=this.gridApi)||void 0===n||n.setGridOption("loading",!1),void this.discardPendingRestoreState();var o=++this.dataFetchGeneration;fetch(e,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){if(!e.ok)throw new Error("Failed to fetch row data: ".concat(e.status));return e.json()}).then(function(e){var n,i;if(o===r.dataFetchGeneration&&r.gridApi){var a,u=Array.isArray(e)?e:null!==(n=e.rows)&&void 0!==n?n:[];null!==t?r.gridApi.setGridOption("columnDefs",r.decorateColumnDefs(t)):!Array.isArray(e)&&e.column_defs&&r.gridApi.setGridOption("columnDefs",r.decorateColumnDefs(e.column_defs)),r.totalRowCount=u.length,r.pendingAutoSize=!0,r.gridApi.setGridOption("rowData",u),r.footerCountsValue.labelField||null!==(i=r.footerCountsValue.sumFields)&&void 0!==i&&i.length||r.gridApi.setGridOption("pinnedBottomRowData",Array.isArray(e)?[]:null!==(a=e.footer_row)&&void 0!==a?a:[]),r.gridApi.setGridOption("loading",!1),r.drainPendingRestoreState()}}).catch(function(e){var t;o===r.dataFetchGeneration&&(console.error("[AgGridComponent] fetchRowData error:",e),null===(t=r.gridApi)||void 0===t||t.setGridOption("loading",!1),r.discardPendingRestoreState())})}},{key:"handleSelectionChanged",value:function(e){var t=e.api.getSelectedRows(),n=t.length;this.hasRowSelection=n>0,this.syncDefaultExportParams(),this.hasActionsMenuTarget&&(n>0?(this.actionsMenuTarget.classList.add("visible"),this.actionsMenuTarget.style.display="",this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent="".concat(n," selected")),this.renderActions(t),this.followSelectionValue&&this.updateFollowScrollVisibility()):(this.actionsMenuTarget.classList.remove("visible"),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=""),this.clearActions(),this.followSelectionValue&&this.resetMenuPosition()))}},{key:"refreshFooterRow",value:function(){var e;if(this.gridApi){var t=this.footerCountsValue;if(t.labelField||null!==(e=t.sumFields)&&void 0!==e&&e.length){var n=this.gridApi.getDisplayedRowCount(),r={};if(t.labelField){var o,i=null!==(o=t.countLabel)&&void 0!==o?o:"rows";r[t.labelField]=n===this.totalRowCount?"".concat(this.totalRowCount," ").concat(i):"".concat(n," of ").concat(this.totalRowCount," ").concat(i)}if(t.sumFields&&t.sumFields.length>0){var a={};t.sumFields.forEach(function(e){a[e]=0}),this.gridApi.forEachNodeAfterFilter(function(e){e.data&&t.sumFields.forEach(function(t){var n;a[t]+=Number(null!==(n=e.data[t])&&void 0!==n?n:0)})}),Object.assign(r,a)}this.gridApi.setGridOption("pinnedBottomRowData",[r])}}}}],i&&oe(n.prototype,i),a&&oe(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,i,a,u,c,s,l}(o.AgGridBaseController);pe.targets=[].concat(function(e){if(Array.isArray(e))return X(e)}(de=o.AgGridBaseController.targets)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(de)||Q(de)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),["quickFilterInput"]),pe.values=ne(ne({},o.AgGridBaseController.values),{},{rowDataUrl:String,rowData:Array,advancedRowDataUrl:String,basicModeOptions:Object,advancedModeOptions:Object,footerCounts:Object,rowReorderUrl:String,exportTitle:String,exportFileName:String,exportUrl:String,filterValuesUrl:String,plainHeader:Boolean,quickFilterFields:Array,persistUserColumnWidths:Boolean,gridStateKeys:Array,sharedWidthColIds:Array,widthScope:String})},8640:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return g}});var r=n(8179),o=n(4546),i=n(737),a=n(6935),u=n(2790);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?c(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function d(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function p(e,t,n){return t=m(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,h()?Reflect.construct(t,n||[],m(e).constructor):t.apply(e,n))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function v(e,t,n,r){var o=y(m(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function y(){return y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},y.apply(null,arguments)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}var g=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=p(this,t,[].concat(r))).validateClickHandler=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;if(v(t,"connect",this,3)([]),this.hasGridTarget){var n=s(s({theme:i.zA,localeText:a.V,columnDefs:this.buildEditableColumnDefs(this.columnDefsValue),rowData:this.rowDataValue,domLayout:"autoHeight",suppressMovableColumns:!0,suppressDragLeaveHidesColumns:!0,suppressRowDrag:!0,rowGroupPanelShow:"never",cellSelection:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,processDataFromClipboard:function(t){return e.clampPasteToGrid(t)},onFirstDataRendered:function(){return e.autoSizeNonFlexColumns()},onCellValueChanged:function(t){return e.autoSizeNonFlexColumns()},popupParent:document.body,getMainMenuItems:function(t){return e.resetColumnsOnlyMainMenuItems(t)},defaultColDef:{sortable:!1,resizable:!0,suppressMovable:!0,lockPinned:!0,suppressHeaderMenuButton:!0,filterParams:a.m}},this.gridOptionsValue),u.T);this.gridApi=(0,r.Dvw)(this.gridTarget,n),this.gridBlurHandler=function(t){var n,r=t.target;e.gridTarget.contains(r)||null===(n=e.gridApi)||void 0===n||n.clearCellSelection()},document.addEventListener("mousedown",this.gridBlurHandler),this.wireValidateButton()}}},{key:"disconnect",value:function(){if(this.validateClickHandler){var e=document.getElementById("validate_list");null===e||void 0===e||e.removeEventListener("click",this.validateClickHandler),this.validateClickHandler=null}v(t,"disconnect",this,3)([])}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"buildEditableColumnDefs",value:function(e){var t=this;return e.map(function(e){var n,r=null!==(n=e.colId)&&void 0!==n?n:"string"===typeof e.field?e.field.split(".")[0]:void 0;return s(s({},e),{},{editable:function(e){return t.isCellEditable(e.data,r)},cellClassRules:l(l({},"ag-grid-editable-cell--locked",function(e){return!t.isCellEditable(e.data,r)}),"ag-grid-editable-cell--row-locked",function(e){return t.isRowFullyLocked(e.data)})})})}},{key:"isCellEditable",value:function(e,t){if(!e||!t)return!1;var n=e[t];return!(!n||"boolean"!==typeof n.read_only)&&!n.read_only}},{key:"isRowFullyLocked",value:function(e){if(!e)return!1;var t=Object.values(e).filter(function(e){return!!e});return 0!==t.length&&t.every(function(e){return!0===e.read_only})}},{key:"clampPasteToGrid",value:function(e){if(!this.gridApi)return e.data;var t=this.gridApi.getFocusedCell();if(!t)return e.data;var n=this.gridApi.getDisplayedRowCount()-t.rowIndex;return n<=0?null:e.data.length>n?e.data.slice(0,n):e.data}},{key:"wireValidateButton",value:function(){var e=this,t=document.getElementById("validate_list");t&&(this.validateClickHandler=function(n){n.preventDefault(),e.handleValidateClick(t)},t.addEventListener("click",this.validateClickHandler))}},{key:"handleValidateClick",value:function(e){var t,n=this;null===(t=this.gridApi)||void 0===t||t.stopEditing(),e.classList.add("disabled"),e.innerHTML="Validating rows, please wait...";var r=this.gatherGridData(),o=r.headers,i=r.rows,a=this.gatherFilterIds();this.postValidate(e,o,i,a).then(function(t){return n.handleValidateResponse(t,e)}).catch(function(){return n.handleValidateFailure(e)})}},{key:"gatherGridData",value:function(){var e,t=this.columnDefsValue.map(function(e){var t,n="string"===typeof e.field?e.field:"";return null!==(t=e.colId)&&void 0!==t?t:n.split(".")[0]}),n=[];return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){var r=e.data;r&&n.push(t.map(function(e){var t=r[e];return void 0===(null===t||void 0===t?void 0:t.value)||null===(null===t||void 0===t?void 0:t.value)?"":String(t.value)}))}),{headers:t,rows:n}}},{key:"gatherFilterIds",value:function(){return Array.from(document.querySelectorAll("#invitations_array input")).map(function(e){return e.value})}},{key:"postValidate",value:function(e,t,n,r){var o,i,a=e.dataset.url;if(!a)return Promise.reject(new Error("Validate button is missing data-url"));var u=new URLSearchParams;t.forEach(function(e){return u.append("headers[".concat(e,"]"),"")}
2),n.forEach(function(e,t){e.forEach(function(e){return u.append("rows[".concat(t,"][]"),e)})}),r.forEach(function(e){return u.append("filter[]",e)});var c=null!==(o=null===(i=document.querySelector('meta[name="csrf-token"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";return fetch(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Accept:"application/json","X-CSRF-Token":c,"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin",body:u.toString()}).then(function(e){if(!e.ok)throw new Error("Validate request failed: ".concat(e.status));return e.json()})}},{key:"handleValidateResponse",value:function(e,t){var n,r=document.getElementById("voter_list_notices"),o=document.getElementById("download_list"),i=document.getElementById("upload_list"),a=document.getElementById("update-reason");t.classList.remove("disabled"),t.innerHTML='<i class="fas fa-check"></i>Validate list';var u=[];(null!==(n=null===a||void 0===a?void 0:a.value)&&void 0!==n?n:"").trim().length||u.push("Edit Reason is required"),e.valid?null===o||void 0===o||o.classList.add("disabled"):(null===o||void 0===o||o.classList.remove("disabled"),u.push("There are errors in your list that must be fixed before continuing. To view the errors and explanations, click Download List. Then, fix the errors, and verify by selecting Validate List again.")),r&&(u.length>0?(null===i||void 0===i||i.classList.add("disabled"),r.innerHTML=u.map(function(e){return'<span class="inline_error">'.concat(e,"</span><br>")}).join("")):(null===i||void 0===i||i.classList.remove("disabled"),r.innerHTML='<span class="inline_success">Everything looks good!</span>'))}},{key:"handleValidateFailure",value:function(e){e.classList.remove("disabled"),e.innerHTML='<i class="fas fa-check"></i>Validate list';var t=document.getElementById("voter_list_notices");t&&(t.innerHTML='<span class="inline_error">Something went wrong validating your list. Please try again.</span>')}}],o&&f(n.prototype,o),c&&f(n,c),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,c}(o.AgGridBaseController);g.values=s(s({},o.AgGridBaseController.values),{},{rowData:Array})},98:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return P}});var r=n(8179),o=n(4546),i=n(737),a=n(6935),u=n(2790),c=n(5404);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return p(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");
vendor: 3,570 bytes, line 2
2if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,p(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,p(f,"constructor",s),p(s,"constructor",c),c.displayName="GeneratorFunction",p(s,o,"GeneratorFunction"),p(f),p(f,o,"Generator"),p(f,r,function(){return this}),p(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:i,m:h}})()}function p(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,t,n,r){function i(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},p(e,t,n,r)}function h(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function g(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function w(e,t,n){return t=k(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_()?Reflect.construct(t,n||[],k(e).constructor):t.apply(e,n))}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function O(e,t,n,r){var o=T(k(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function T(){return T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},T.apply(null,arguments)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}
2function j(e,t){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},j(e,t)}var S,P=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=w(this,t,[].concat(r))).errorMap=new Map,e.errorMessages=new Map,e.validationTimer=null,e.validationRequestId=0,e.lastValidationRowIndexMap=[],e.lastOutputRowIndexMap=[],e.lastPasteGrowthNodeIds=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&j(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;if(O(t,"connect",this,3)([]),this.hasGridTarget){var n=y(y({theme:i.zA,localeText:a.V,columnDefs:this.buildGrowableColumnDefs(this.columnDefsValue),rowData:this.buildBlankRows(this.initialBlankRowsValue),domLayout:"autoHeight",suppressMovableColumns:!0,suppressDragLeaveHidesColumns:!0,suppressRowDrag:!0,rowGroupPanelShow:"never",cellSelection:!0,rowNumbers:{width:50,minWidth:50},stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,processDataFromClipboard:function(t){return e.growGridForPaste(t)},onCellValueChanged:function(t){return e.handleCellValueChanged(t)},onFirstDataRendered:function(){return e.autoSizeNonFlexColumns()},onUndoEnded:function(t){return e.handleUndoEnded(t)},popupParent:document.body,getMainMenuItems:function(t){return e.resetColumnsOnlyMainMenuItems(t)},defaultColDef:{editable:!0,sortable:!1,resizable:!0,suppressMovable:!0,suppressHeaderMenuButton:!0,filterParams:a.m}},this.gridOptionsValue),u.T);this.gridApi=(0,r.Dvw)(this.gridTarget,n),this.gridBlurHandler=function(t){var n,r=t.target;e.gridTarget.contains(r)||null===(n=e.gridApi)||void 0===n||n.clearCellSelection()},document.addEventListener("mousedown",this.gridBlurHandler),this.writeOutput()}}},{key:"disconnect",value:function(){this.validationTimer&&(clearTimeout(this.validationTimer),this.validationTimer=null),O(t,"disconnect",this,3)([])}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"gatherRows",value:function(){var e,t=[];return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){e.data&&t.push(e.data)}),t}},{key:"writeOutput",value:function(){var e=this.gatherNonBlankRows(),t=e.rows,n=e.rowIndexMap;this.lastOutputRowIndexMap=n,this.hasOutputTarget&&(this.outputTarget.value=JSON.stringify(t))}},{key:"gatherNonBlankRows",value:function(){var e,t=this,n=[],r=[];return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){if(e.data&&null!==e.rowIndex){var o=e.data;t.rowHasContent(o)&&(n.push(o),r.push(e.rowIndex))}}),{rows:n,rowIndexMap:r}}},{key:"buildGrowableColumnDefs",value:function(e){var t=this;return e.map(function(e){var n=t.resolveColId(e);return y(y({},e),{},{cellClassRules:m({},"ag-grid-growable-cell--error",function(e){return t.isCellInError(e.node.rowIndex,n)})})})}},{key:"isCellInError",value:function(e,t){if(null===e||!t)return!1;var n=this.errorMap.get(e);return!!n&&n.has(t)}},{key:"resolveColId",value:function(e){var t;return null!==(t=e.colId)&&void 0!==t?t:"string"===typeof e.field?e.field.split(".")[0]:void 0}},{key:"getColKeys",value:function(e){var t=this;return e.map(function(e){return t.resolveColId(e)}).filter(function(e){return Boolean(e)})}},{key:"buildBlankRows",value:function(e){var t=this.getColKeys(this.columnDefsValue);return Array.from({length:Math.max(e,0)},function(){var e={};return t.forEach(function(t){e[t]=""}),e})}},{key:"growGridForPaste",value:function(e){if(!this.gridApi)return e.data;var t=this.gridApi.getFocusedCell();if(!t)return e.data;this.lastPasteGrowthNodeIds=null;var n=this.gridApi.getDisplayedRowCount(),r=t.rowIndex+e.data.length-n;if(r<=0)return e.data;var o=this.maxRowsValue-n,i=Math.min(r,o);if(i>0){var a,u=this.gridApi.applyTransaction({add:this.buildBlankRows(i)});this.lastPasteGrowthNodeIds=(null!==(a=null===u||void 0===u?void 0:u.add)&&void 0!==a?a:[]).map(function(e){return e.id}).filter(function(e){return void 0!==e})}if(r<=o)return e.data;alert("Pasted data exceeds the ".concat(this.maxRowsValue,"-row limit. Rows beyond the limit were not added."));var c=this.maxRowsValue-t.rowIndex;return c>0?e.data.slice(0,c):null}},{key:"handleUndoEnded",value:function(e){var t=this;if(e.operationPerformed){var n=this.lastPasteGrowthNodeIds;if(this.lastPasteGrowthNodeIds=null,n&&this.gridApi){var r=n.map(function(e){return t.gridApi.getRowNode(e)}).filter(function(e){return!!e});r.length===n.length&&(r.some(function(e){return!e.data||t.rowHasContent(e.data)})||(this.gridApi.applyTransaction({remove:r.map(function(e){return e.data})}),this.writeOutput()))}}}}
2,{key:"handleCellValueChanged",value:function(e){this.notifyDirty(),this.appendBlankRowIfLastRowFilled(e),this.writeOutput(),this.scheduleValidation(),this.autoSizeNonFlexColumns()}},{key:"notifyDirty",value:function(){this.element.dispatchEvent(new CustomEvent("handsontable-changed",{bubbles:!0}))}},{key:"appendBlankRowIfLastRowFilled",value:function(e){if(this.gridApi){var t=this.gridApi.getDisplayedRowCount();null!==e.rowIndex&&e.rowIndex===t-1&&(t>=this.maxRowsValue||this.rowHasContent(e.data)&&this.gridApi.applyTransaction({add:this.buildBlankRows(1)}))}}},{key:"rowHasContent",value:function(e){return Object.values(e).some(function(e){return""!==(null!==e&&void 0!==e?e:"").toString().trim()})}},{key:"scheduleValidation",value:function(){var e=this;this.validationTimer&&clearTimeout(this.validationTimer),this.validationTimer=setTimeout(function(){return e.runValidation()},600)}},{key:"runValidation",value:function(){var e,t,n=this;if(this.validateUrlValue){var r=this.element.closest("form");if(r){var o=this.gatherNonBlankRows(),i=o.rows,a=o.rowIndexMap;this.lastValidationRowIndexMap=a;var u=new FormData(r);u.set("election_info",JSON.stringify(i));var c=null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",s=++this.validationRequestId;fetch(this.validateUrlValue,{method:"POST",headers:{Accept:"application/json","X-CSRF-Token":c,"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin",body:u}).then(function(e){if(!e.ok)throw new Error("Validate request failed: ".concat(e.status));return e.json()}).then(function(e){s===n.validationRequestId&&n.applyErrorMap(e)}).catch(function(){})}}}},{key:"handleHighlightMultipleCells",value:function(e){var t,n,r,o=this,i=null!==(t=null===(n=e.detail)||void 0===n?void 0:n.cells)&&void 0!==t?t:[];if(0!==i.length){var a=this.getColKeys(this.columnDefsValue);i.forEach(function(e){var t,n=e.row,r=e.col,i=e.message,u=o.lastOutputRowIndexMap[n];if(void 0!==u){var c=a[r];if(c){var s=null!==(t=o.errorMap.get(u))&&void 0!==t?t:new Set;s.add(c),o.errorMap.set(u,s),i&&o.errorMessages.set(u,i)}}}),null===(r=this.gridApi)||void 0===r||r.refreshCells({force:!0})}}},{key:"handleFillFirstRow",value:function(e){var t;if(this.gridApi){var n=null===(t=e.detail)||void 0===t?void 0:t.firstRow;if(n){var r=this.gridApi.getDisplayedRowAtIndex(0);r&&(this.getColKeys(this.columnDefsValue).forEach(function(e){void 0!==n[e]&&r.setDataValue(e,n[e])}),this.writeOutput())}}}},{key:"handleAddRows",value:function(){if(this.gridApi){var e=this.gridApi.getDisplayedRowCount(),t=this.maxRowsValue-e;t<=0||(this.gridApi.applyTransaction({add:this.buildBlankRows(Math.min(40,t))}),this.writeOutput())}}},{key:"handleRevalidateRows",value:function(){this.scheduleValidation()}},{key:"handleClearRows",value:(f=d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:if(this.gridApi){e.n=1;break}return e.a(2);case 1:if(!(this.gatherNonBlankRows().rows.length>0)){e.n=3;break}return e.n=2,(0,c.j)({message:"Are you sure you want to clear all rows?"});case 2:if(e.v){e.n=3;break}return e.a(2);case 3:this.gridApi.setGridOption("rowData",this.buildBlankRows(this.initialBlankRowsValue)),this.errorMap=new Map,this.errorMessages=new Map,this.lastPasteGrowthNodeIds=null,this.gridApi.refreshCells({force:!0}),this.writeOutput(),this.dispatchRowErrors();case 4:return e.a(2)}},e,this)}),p=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=f.apply(e,t);function i(e){h(o,n,r,i,a,"next",e)}function a(e){h(o,n,r,i,a,"throw",e)}i(void 0)})},function(){return p.apply(this,arguments)})},{key:"applyErrorMap",value:function(e){var t,n,r=this,o=this.getColKeys(this.columnDefsValue);this.errorMap=new Map,this.errorMessages=new Map,(null!==(t=e.election_errors)&&void 0!==t?t:[]).forEach(function(e){var t=r.lastValidationRowIndexMap[e.row];if(void 0!==t){var n=new Set(e.cols.map(function(e){return o[e]}).filter(function(e){return Boolean(e)}));r.errorMap.set(t,n),e.errors.length>0&&r.errorMessages.set(t,e.errors.join(" || "))}}),null===(n=this.gridApi)||void 0===n||n.refreshCells({force:!0}),this.dispatchRowErrors()}},{key:"dispatchRowErrors",value:function(){var e=Array.from(this.errorMessages.entries()).sort(function(e,t){return s(e,1)[0]-s(t,1)[0]}).map(function(e){var t=s(e,2);return{row:t[0],message:t[1]}});document.dispatchEvent(new CustomEvent("row-validation-errors",{detail:{errors:e}}))}}],o&&b(n.prototype,o),l&&b(n,l),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,l,f,p}(o.AgGridBaseController);P.targets=[].concat(function(e){if(Array.isArray(e))return f(e)}(S=o.AgGridBaseController.targets)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(S)||l(S)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),["output"]),P.values=y(y({},o.AgGridBaseController.values),{},{validateUrl:String,initialBlankRows:Number,maxRows:Number})},4850:function(e,t,n){"use strict";n.d(t,{W:function(){return o},_:function(){return r}});var r="ag-grid-accent-text";function o(e){var t=document.createElement("span");return t.className=r,t.textContent=e,t}},8990:function(e,t,n){"use strict";n.d(t,{H:function(){return d}});var r=n(5404);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,o,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return i(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,i(p,"constructor",f),i(f,"constructor",l),l.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}}function l(e){return f.apply(this,arguments)}function f(){return(f=s(o().m(function e(t){var n,r,i,a,u;return o().w(function(e){for(;;)switch(e.n){case 0:return u=null!==(n=null===(r=document.querySelector('meta[name="csrf-token"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",e.n=1,fetch(null!==(i=t.url)&&void 0!==i?i:"#",{method:(null!==(a=t.method)&&void 0!==a?a:"get").toUpperCase(),headers:{"X-CSRF-Token":u,"X-Requested-With":"XMLHttpRequest",Accept:"text/html, application/xhtml+xml"},credentials:"same-origin"});case 1:window.location.reload();case 2:return e.a(2)}},e)}))).apply(this,arguments)}var d=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},t=[{key:"init",value:function(e){var t,n=this;if(this.eGui=document.createElement("div"),this.eGui.className="ag-actions-cell",!e.node.group){var i=null===(t=e.data)||void 0===t?void 0:t.row_actions;Array.isArray(i)&&0!==i.length&&i.forEach(function(e){if("badge"===e.type){var t=document.createElement("span");t.className="ag-actions-cell__badge",t.textContent=e.label,n.eGui.appendChild(t)}else{var i=document.createElement("a");if(i.className="toolkit-button-component toolkit-button-component--toolbar-chip",e.icon&&i.classList.add("toolkit-button-component--with-icon"),i.href=e.url||"#",e.rel&&(i.rel=e.rel),e.target&&(i.target=e.target),e.turbo_frame){var a=e.turbo_frame,u=e.url||"#";i.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=document.querySelector("turbo-frame#".concat(a));t&&t.setAttribute("src",u)})}else e.confirm||e.confirm_title||e.confirm_danger?i.addEventListener("click",function(){var t=s(o().m(function t(n){return o().w(function(t){for(;;)switch(t.n){case 0:return n.preventDefault(),n.stopPropagation(),t.n=1,(0,r.j)({title:e.confirm_title,danger:e.confirm_danger,message:e.confirm,confirmLabel:e.label});case 1:if(!t.v){t.n=2;break}return t.n=2,l(e);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}()):e.method&&"get"!==e.method&&(i.dataset.method=e.method,!1!==e.remote&&(i.dataset.remote="true"));if(e.icon){var c=document.createElement("i");c.className="fas fa-".concat(e.icon),c.setAttribute("aria-hidden","true"),i.appendChild(c)}var f=document.createElement("span");f.textContent=e.label,i.appendChild(f),n.eGui.appendChild(i)}})}}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}}],t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},8882:function(e,t,n){"use strict";n.d(t,{U:function(){return d}});var r=n(5404);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,o,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return i(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,i(p,"constructor",f),i(f,"constructor",l),l.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}}function l(e){return f.apply(this,arguments)}function f(){return(f=s(o().m(function e(t){var n,r,i,a,u,c;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=null!==(n=null===(r=document.querySelector('meta[name="csrf-token"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",e.p=1,e.n=2,fetch(null!==(a=t.url)&&void 0!==a?a:"#",{method:(null!==(u=t.method)&&void 0!==u?u:"get").toUpperCase(),headers:{"X-CSRF-Token":i,"X-Requested-With":"XMLHttpRequest",Accept:"text/html, application/xhtml+xml"},credentials:"same-origin"});case 2:if((c=e.v).ok){e.n=3;break}throw new Error("Request failed (".concat(c.status,")"));case 3:window.location.reload(),e.n=5;break;case 4:e.p=4,e.v,alert('Failed to complete "'.concat(t.label,'". Please try again.'));case 5:return e.a(2)}},e,null,[[1,4]])}))).apply(this,arguments)}var d=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0,this.button=void 0,this.menu=null,this.menuItemEls=[],this.actions=[],this.activeIndex=0,this.gridApi=null,this.alwaysBelow=!1,this.openRightward=!1,this.onCloseTrigger=function(){t.closeMenu(!1)},this.onDocumentClick=function(e){var n,r=e.target;null!==(n=t.menu)&&void 0!==n&&n.contains(r)||t.eGui.contains(r)||t.closeMenu(!1)},this.onDocumentKeyDown=function(e){if(t.menu)switch(e.key){case"Escape":e.preventDefault(),e.stopPropagation(),t.closeMenu(!0);break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),t.focusItem((t.activeIndex+1)%t.menuItemEls.length);break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),t.focusItem((t.activeIndex-1+t.menuItemEls.length)%t.menuItemEls.length);break;case"Home":e.preventDefault(),t.focusItem(0);break;case"End":e.preventDefault(),t.focusItem(t.menuItemEls.length-1);break;case"Tab":t.closeMenu(!1)}}},t=[{key:"init",value:function(e){var t,n,r,o=this;if(this.eGui=document.createElement("div"),this.eGui.className="ag-dropdown-actions-cell",this.alwaysBelow=null!==(t=e.alwaysBelow)&&void 0!==t&&t,this.openRightward=null!==(n=e.openRightward)&&void 0!==n&&n,!e.node.group){var i=null===(r=e.data)||void 0===r?void 0:r.row_actions;
2Array.isArray(i)&&0!==i.length&&(this.gridApi=e.api,i.forEach(function(e){if("badge"===e.type){var t=document.createElement("span");t.className="ag-actions-cell__badge",t.textContent=e.label,o.eGui.appendChild(t)}}),this.actions=i.filter(function(e){return"badge"!==e.type}),0!==this.actions.length&&(this.buildTrigger(),this.eGui.appendChild(this.button)))}}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}},{key:"destroy",value:function(){this.closeMenu(!1)}},{key:"buildTrigger",value:function(){var e=this;this.button=document.createElement("button"),this.button.type="button",this.button.className="toolkit-button-component toolkit-button-component--toolbar-chip ag-dropdown-actions-cell__trigger",this.button.setAttribute("aria-haspopup","menu"),this.button.setAttribute("aria-expanded","false"),this.button.setAttribute("aria-label","Actions");var t=document.createElement("i");t.className="fas fa-ellipsis-h",t.setAttribute("aria-hidden","true"),this.button.appendChild(t),this.button.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation(),e.menu?e.closeMenu(!1):e.openMenu()}),this.button.addEventListener("keydown",function(t){"ArrowDown"!==t.key&&"ArrowUp"!==t.key&&"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e.menu||e.openMenu(),e.focusItem("ArrowUp"===t.key?e.menuItemEls.length-1:0))})}},{key:"isOpen",value:function(){return null!==this.menu}},{key:"openMenu",value:function(){0!==this.actions.length&&this.openMenuInternal()}},{key:"openMenuInternal",value:function(){var e,t,n,r=this;this.menu||(this.menu=document.createElement("div"),this.menu.className="ag-dropdown-actions-menu",this.menu.setAttribute("role","menu"),this.menuItemEls=this.actions.map(function(e,t){return r.buildMenuItem(e,t)}),this.menuItemEls.forEach(function(e){var t;return null===(t=r.menu)||void 0===t?void 0:t.appendChild(e)}),document.body.appendChild(this.menu),this.positionMenu(),this.button.setAttribute("aria-expanded","true"),this.activeIndex=0,this.focusItem(0),document.addEventListener("click",this.onDocumentClick,!0),document.addEventListener("keydown",this.onDocumentKeyDown,!0),document.addEventListener("scroll",this.onCloseTrigger,!0),window.addEventListener("resize",this.onCloseTrigger),null===(e=this.gridApi)||void 0===e||e.addEventListener("bodyScroll",this.onCloseTrigger),null===(t=this.gridApi)||void 0===t||t.addEventListener("columnResized",this.onCloseTrigger),null===(n=this.gridApi)||void 0===n||n.addEventListener("columnMoved",this.onCloseTrigger))}},{key:"closeMenu",value:function(e){var t,n,r;this.menu&&(this.menu.remove(),this.menu=null,this.menuItemEls=[],this.button.setAttribute("aria-expanded","false"),document.removeEventListener("click",this.onDocumentClick,!0),document.removeEventListener("keydown",this.onDocumentKeyDown,!0),document.removeEventListener("scroll",this.onCloseTrigger,!0),window.removeEventListener("resize",this.onCloseTrigger),null===(t=this.gridApi)||void 0===t||t.removeEventListener("bodyScroll",this.onCloseTrigger),null===(n=this.gridApi)||void 0===n||n.removeEventListener("columnResized",this.onCloseTrigger),null===(r=this.gridApi)||void 0===r||r.removeEventListener("columnMoved",this.onCloseTrigger),e&&this.button.focus())}},{key:"focusItem",value:function(e){0!==this.menuItemEls.length&&(this.activeIndex=e,this.menuItemEls.forEach(function(t,n){t.tabIndex=n===e?0:-1}),this.menuItemEls[e].focus())}},{key:"positionMenu",value:function(){if(this.menu){var e,t=this.button.getBoundingClientRect(),n=this.menu.getBoundingClientRect(),r=window.innerHeight,o=window.innerWidth,i=t.bottom+4;!this.alwaysBelow&&i+n.height>r&&(i=Math.max(4,t.top-n.height-4)),this.openRightward?((e=t.left)+n.width>o-4&&(e=t.right-n.width),e<4&&(e=4)):((e=t.right-n.width)<4&&(e=t.left),e+n.width>o&&(e=o-n.width-4)),this.menu.style.position="fixed",this.menu.style.top="".concat(i,"px"),this.menu.style.left="".concat(e,"px")}}},{key:"buildMenuItem",value:function(e,t){var n=this,i=document.createElement("a");if(i.className="ag-dropdown-actions-menu__item",i.setAttribute("role","menuitem"),i.tabIndex=0===t?0:-1,i.href=e.url||"#",e.rel&&(i.rel=e.rel),e.target&&(i.target=e.target),i.addEventListener("click",function(){e.rel?setTimeout(function(){return n.closeMenu(!1)},0):n.closeMenu(!1)}),e.turbo_frame){var a=e.turbo_frame,u=e.url||"#";i.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=document.querySelector("turbo-frame#".concat(a));t&&t.setAttribute("src",u)})}else e.confirm||e.confirm_title||e.confirm_danger?i.addEventListener("click",function(){var t=s(o().m(function t(n){return o().w(function(t){for(;;)switch(t.n){case 0:return n.preventDefault(),n.stopPropagation(),t.n=1,(0,r.j)({title:e.confirm_title,danger:e.confirm_danger,message:e.confirm,confirmLabel:e.label});case 1:if(!t.v){t.n=2;break}return t.n=2,l(e);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}()):e.method&&"get"!==e.method&&(i.dataset.method=e.method,!1!==e.remote&&(i.dataset.remote="true"));if(e.icon){var c=document.createElement("i");c.className="fas fa-".concat(e.icon),c.setAttribute("aria-hidden","true"),i.appendChild(c)}var f=document.createElement("span");return f.textContent=e.label,i.appendChild(f),i}}],t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},5138:function(e,t,n){"use strict";n.d(t,{Y:function(){return a}});var r=n(1708);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},(t=[{key:"init",value:function(e){var t,n;if(this.eGui=document.createElement("div"),e.node.group)this.eGui.textContent=null!==(n=e.value)&&void 0!==n?n:"";else if(e.node.rowPinned){var r,o,i=null!==(r=e.data)&&void 0!==r?r:{};this.eGui.textContent=null!==(o=i.footer_label)&&void 0!==o?o:""}else{var a,u=null!==(t=e.data)&&void 0!==t?t:{};1!==u.row_type?this.renderElection(e,u):this.renderVoteBox(u,null===(a=e.linkOut)||void 0===a||a)}}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}},{key:"renderElection",value:function(e,t){var n,r,o=t.id,i=null!==(n=t.type_label)&&void 0!==n?n:"",a=t.link_url;this.eGui.className="root-ag-election-name-cell";var u=document.createElement(a?"a":"span");u.className="root-ag-election-name-cell__name",u.textContent=null!==(r=e.value)&&void 0!==r?r:"",a&&(u.href=a),this.eGui.appendChild(u);var c=document.createElement("span");if(c.className="root-ag-election-name-cell__meta",i){var s=document.createElement("span");
2s.className="root-ag-election-name-cell__type",s.textContent=i,c.appendChild(s)}if(void 0!==o&&null!==o){var l=document.createElement("span");l.className="root-ag-election-name-cell__id",l.textContent="".concat(o),c.appendChild(l)}this.eGui.appendChild(c)}},{key:"renderVoteBox",value:function(e,t){var n,o=e.entity_id,i=null!==(n=e.name)&&void 0!==n?n:"",a=e.childCount;this.eGui.className="root-ag-election-name-cell root-ag-election-name-cell--vote-box";var u=document.createElement(t?"a":"span");u.className="root-ag-election-name-cell__name",u.textContent=i,t&&void 0!==o&&null!==o&&(u.href="/vote_boxes/".concat(o,"/dashboard")),this.eGui.appendChild(u);var c=document.createElement("span");if(c.className="root-ag-election-name-cell__meta",void 0!==a&&null!==a){var s=document.createElement("span");s.className="root-ag-election-name-cell__box-count",s.textContent=(0,r.sz)(a),c.appendChild(s)}if(void 0!==o&&null!==o){var l=document.createElement("span");l.className="root-ag-election-name-cell__id",l.textContent="".concat(o),c.appendChild(l)}this.eGui.appendChild(c)}}])&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},7198:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}n.d(t,{U:function(){return i}});var i=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},(t=[{key:"init",value:function(e){this.eGui=document.createElement("div"),this.eGui.className="ag-icon-badge-cell";var t=document.createElement("div");t.textContent=null==e.value?"":String(e.value),this.eGui.appendChild(t);var n=e.data,r=e.badgeField?null===n||void 0===n?void 0:n[e.badgeField]:void 0;if(r){var o=document.createElement("div");if(o.className="ag-icon-badge-cell__badge",e.iconClass){var i=document.createElement("i");i.className=e.iconClass,i.setAttribute("aria-hidden","true"),o.appendChild(i),o.appendChild(document.createTextNode(" "))}o.appendChild(document.createTextNode(r)),this.eGui.appendChild(o)}}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},8787:function(e,t,n){"use strict";n.d(t,{w:function(){return a}});var r=n(1978);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},t=[{key:"init",value:function(e){var t,n,o;this.eGui=document.createElement("span");var i=null!==(t=e.urlField)&&void 0!==t?t:"edit_url",a=null===(n=e.data)||void 0===n?void 0:n[i],u=null!==(o=e.value)&&void 0!==o?o:"";if(a){var c=document.createElement("a");c.href=a,c.textContent=u,c.draggable=!1,e.newTab&&(c.target="_blank",c.rel="noopener"),e.styled||(c.style.color="inherit",c.style.textDecoration="none"),c.addEventListener("click",function(e){(0,r.s)(c)&&e.preventDefault()}),this.eGui.appendChild(c)}else this.eGui.textContent=u}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}}],t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},7592:function(e,t,n){"use strict";n.d(t,{w:function(){return a}});var r=n(1280);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},(t=[{key:"init",value:function(e){var t,n,o=null!==(t=null===(n=e.colDef)||void 0===n?void 0:n.field)&&void 0!==t?t:"value",i=null==e.value?"":String(e.value);this.eGui=(0,r.Qi)(i,e,o)}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}}])&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},1720:function(e,t,n){"use strict";n.d(t,{W:function(){return s}});var r=n(1280),o=n(4632),i=n(1978),a=n(4850);function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},t=[{key:"init",value:function(e){var t,n,u,c,s,l,f,d,p=this;this.eGui=document.createElement("div"),this.eGui.style.lineHeight="normal";var h=null!==(t=null===(n=e.colDef)||void 0===n?void 0:n.field)&&void 0!==t?t:"",v=e.data,y=h?null===v||void 0===v?void 0:v["".concat(h,"_multiline")]:void 0,m=null!==(u=null!==y&&void 0!==y?y:e.value)&&void 0!==u?u:"",b=e.urlField?null===v||void 0===v?void 0:v[e.urlField]:void 0,g=null!==(c=e.accentLineIndexe
2s)&&void 0!==c?c:[],w=null!==(s=e.maskLineIndexes)&&void 0!==s?s:[],_=null!==(l=e.copyLineIndexes)&&void 0!==l?l:[],O=null!==(f=e.postLink)&&void 0!==f&&f,T=!!e.accentField&&!(null===v||void 0===v||!v[e.accentField]),k=void 0!==e.urlField,j=m.split("\n"),S=e.prefixField?null===v||void 0===v?void 0:v[e.prefixField]:void 0;if(k){var P=null!==(d=e.linkLineIndex)&&void 0!==d?d:j.length-1;j.forEach(function(t,n){var u=n===P&&!!b,c=0===n&&S?p.buildPrefix(S,e.prefixClass):void 0,s=_.includes(n)&&!!t;if(u&&O){var l=p.buildPostLinkLine(t,b);return c&&l.insertBefore(c,l.firstChild),s&&l.appendChild((0,o.g)(t)),void p.eGui.appendChild(l)}var f=document.createElement(u?"a":"span");if(f.textContent=t,f.style.display="block",u?(f.href=b,f.setAttribute("draggable","false"),f.style.color="inherit",f.style.textDecoration="none",f.addEventListener("click",function(e){(0,i.s)(f)&&e.preventDefault()})):g.includes(n)&&f.classList.add("multiline-text-cell-renderer__accent-line"),!u&&n===P&&T&&f.classList.add(a._),!u&&w.includes(n)&&t&&(0,r.Fh)(f,e,"".concat(h,":").concat(n)),c)if(u){var d=document.createElement("span");d.style.display="block",f.style.display="inline",d.appendChild(c),d.appendChild(f),s&&d.appendChild((0,o.g)(t)),p.eGui.appendChild(d)}else f.insertBefore(c,f.firstChild),s&&f.appendChild((0,o.g)(t)),p.eGui.appendChild(f);else p.eGui.appendChild(s?p.withCopyButton(f,t):f)})}else j.forEach(function(t,n){n>0&&p.eGui.appendChild(document.createElement("br")),0===n&&S&&p.eGui.appendChild(p.buildPrefix(S,e.prefixClass)),w.includes(n)?p.eGui.appendChild((0,r.Qi)(t,e,"".concat(h,":").concat(n))):(p.eGui.appendChild(document.createTextNode(t)),_.includes(n)&&t&&p.eGui.appendChild((0,o.g)(t)))})}},{key:"withCopyButton",value:function(e,t){if("A"!==e.tagName)return e.appendChild((0,o.g)(t)),e;var n=document.createElement("span");return n.style.display="block",e.style.display="inline",n.appendChild(e),n.appendChild((0,o.g)(t)),n}},{key:"buildPrefix",value:function(e,t){var n=document.createElement("span");return n.textContent="".concat(e," "),t&&(n.className=t),n}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}},{key:"buildPostLinkLine",value:function(e,t){var n,r,o=document.createElement("span");o.style.display="block";var a=document.createElement("a");a.textContent=e,a.setAttribute("draggable","false"),a.style.color="inherit",a.style.textDecoration="none",a.href=t;var u=document.createElement("form");u.method="post",u.action=t,u.style.display="none";var c=null!==(n=null===(r=document.querySelector('meta[name="csrf-token"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",s=document.createElement("input");return s.type="hidden",s.name="authenticity_token",s.value=c,u.appendChild(s),a.addEventListener("click",function(e){e.preventDefault(),(0,i.s)(a)||u.submit()}),o.appendChild(a),o.appendChild(u),o}}],t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},7374:function(e,t,n){"use strict";n.d(t,{q:function(){return c}});var r=n(1978),o=n(4632),i=n(4850);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var c=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},t=[{key:"init",value:function(e){var t,n;this.eGui=document.createElement("span");var a=null!==(t=e.urlField)&&void 0!==t?t:"post_url",u=e.data,c=null===u||void 0===u?void 0:u[a],s=null!==(n=e.value)&&void 0!==n?n:"",l=e.prefixField?null===u||void 0===u?void 0:u[e.prefixField]:void 0;if(l){var f=document.createElement("span");f.textContent="".concat(l," "),e.prefixClass&&(f.className=e.prefixClass),this.eGui.appendChild(f)}if(c){var d,p,h=document.createElement("a");h.href=c,h.textContent=s,h.draggable=!1,h.style.color="inherit",h.style.textDecoration="none";var v=document.createElement("form");v.method="post",v.action=c,v.style.display="none";var y=null!==(d=null===(p=document.querySelector('meta[name="csrf-token"]'))||void 0===p?void 0:p.content)&&void 0!==d?d:"",m=document.createElement("input");m.type="hidden",m.name="authenticity_token",m.value=y,v.appendChild(m),h.addEventListener("click",function(e){e.preventDefault(),(0,r.s)(h)||v.submit()}),this.eGui.appendChild(h),this.eGui.appendChild(v)}else{var b=!!e.accentField&&!(null===u||void 0===u||!u[e.accentField]);this.eGui.appendChild(b?(0,i.W)(s):document.createTextNode(s))}e.copyValue&&s&&this.eGui.appendChild((0,o.g)(String(s)))}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}}],t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},573:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){a(i,r,o,u,c,"next",e)}function c(e){a(i,r,o,u,c,"throw",e)}u(void 0)})}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}n.d(t,{M:function(){return f},V:function(){return l}});var l="eb:select-cell-saved",f=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0},(t=[{key:"init",value:function(e){var t,n,o=this;if(this.eGui=document.createElement("div"),e.node.group){var a;this.eGui.textContent=null!==(a=e.value)&&void 0!==a?a:""}else{var c=null!==(t=null===(n=e.colDef)||void 0===n?void 0:n.field)&&void 0!==t?t:"",s=e.data,f=s[c+"_select"];if(f){this.eGui.style.width="100%";var d=document.createElement("select");if(d.style.width="100%",d.style.maxWidth="100%",f.blank_option){var p=document.createElement("option");p.value="",p.textContent=f.blank_option,d.appendChild(p)}return f.options.forEach(function(e){var t=e.id,n=e.name,r=document.createElement("option");r.value=String(t),r.textContent=n,String(t)===String(f.value)&&(r.selected=!0),d.appendChild(r)}),d.addEventListener("change",u(r().m(function t(){var n,a,u,s,p,h,v;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return u=f.options.find(function(e){var t=e.id;return String(t)===d.value}),s=u?u.id:"",p=null!==(n=null===(a=document.querySelector('meta[name="csrf-token"]'))||void 0===a?void 0:a.content)&&void 0!==n?n:"",t.p=1,t.n=2,fetch(f.patch_url,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":p},body:JSON.stringify(f.patch_wrapper?i({},f.patch_wrapper,[i({id:f.patch_id},f.patch_value_key,s)]):i({},f.patch_value_key,s))});case 2:return h=t.v,t.n=3,h.json();case 3:"ok"===(v=t.v).status?(o.eGui.dispatchEvent(new CustomEvent(l,{bubbles:!0,detail:{field:c,value:s,response:v}})),f.value=s,e.node.setDataValue(c,u?u.name:"")):d.value=String(f.value),t.n=5;break;case 4:t.p=4,t.v,d.value=String(f.value);case 5:return t.a(2)}},t,null,[[1,4]])}))),void this.eGui.appendChild(d)}var h,v=s[c+"_html"];v?(this.eGui.className="ag-status-cell",this.eGui.innerHTML=v.replace(/>\s+</g,"><").trim()):this.eGui.textContent=null!==(h=e.value)&&void 0!==h?h:""}}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}}])&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},7787:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?r(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){return e.map(function(e){var n=e.children;return Array.isArray(n)?o(o({},e),{},{children:a(n,t)}):t(e)})}n.d(t,{m:function(){return a}})},5404:function(e,t,n){"use strict";function r(e){var t,n="string"===typeof e?{message:e}:e,r=null!==(t=n.confirmLabel)&&void 0!==t?t:"Confirm",o=document.createElement("div");o.className="toolkit-confirm-delete-modal__overlay";var i=n.title?'<h3 class="toolkit-confirm-delete-modal__title">'.concat(n.title,"</h3>"):"";o.innerHTML='\n    <div class="toolkit-confirm-delete-modal__dialog" role="alertdialog" aria-modal="true">\n      <div class="toolkit-confirm-delete-modal__content">\n        <div class="toolkit-confirm-delete-modal__icon toolkit-confirm-delete-modal__icon--warning">\n          <i class="fas fa-exclamation-triangle" aria-hidden="true"></i>\n        </div>\n        '.concat(i,'\n        <p class="toolkit-confirm-delete-modal__message"></p>\n        <div class="toolkit-confirm-delete-modal__actions">\n          <button type="button" class="toolkit-button-component toolkit-button-component--orange">').concat(r,'</button>\n          <button type="button" class="toolkit-button-component toolkit-button-component--blue-stroke">Cancel</button>\n        </div>\n      </div>\n    </div>\n  ');var a=o.querySelector(".toolkit-confirm-delete-modal__message");if(n.danger){var u=document.createElement("span");u.className="ag-grid-confirm-message--warning",u.textContent=n.danger,a.appendChild(u),n.message&&(a.appendChild(document.createElement("br")),a.appendChild(document.createTextNode(n.message)))}else n.message&&n.message.split("\n").forEach(function(e,t){if(t>0&&a.appendChild(document.createElement("br")),0===t){var n=document.createElement("span");n.className="ag-grid-confirm-message--warning",n.textContent=e,a.appendChild(n)}else a.appendChild(document.createTextNode(e))});return document.body.appendChild(o),new Promise(function(e){var t=function(t){o.remove(),document.removeEventListener("keydown",n),e(t)},n=function(e){"Escape"===e.key&&t(!1)};document.addEventListener("keydown",n),o.addEventListener("click",function(e){e.target===o&&t(!1)}),o.querySelector(".toolkit-button-component--orange").addEventListener("click",function(){return t(!0)}),o.querySelector(".toolkit-button-component--blue-stroke").addEventListener("click",function(){return t(!1)})})}n.d(t,{j:function(){return r}})},4632:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}n.d(t,{g:function(){return l}});var a="ag-grid-copy-button",u="Copy",c="Copied!",s=1200;function l(e){var t=document.createElement("button");t.type="button",t.className=a,t.title=u,t.setAttribute("aria-label","".concat(u," ").concat(e)),t.draggable=!1;var n,r=document.createElement("i");r.className="fas fa-copy",r.setAttribute("aria-hidden","true"),t.appendChild(r);return t.addEventListener("mousedown",function(e){return e.stopPropagation()}),t.addEventListener("click",function(o){o.preventDefault(),o.stopPropagation(),function(e){return f.apply(this,arguments)}(e).then(function(e){e&&(r.className="fas fa-check",t.title=c,t.classList.add("".concat(a,"--copied")),window.clearTimeout(n),n=window.setTimeout(function(){r.className="fas fa-copy",t.title=u,t.classList.remove("".concat(a,"--copied"))},s))})}),t}function f(){var e;return e=r().m(function e(t){var n;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null===(n=navigator.clipboard)||void 0===n||!n.writeText){e.n=4;break}return e.p=1,e.n=2,navigator.clipboard.writeText(t);case 2:return e.a(2,!0);case 3:e.p=3,e.v;case 4:return e.a(2,d(t))}},e,null,[[1,3]])}),f=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})},f.apply(this,arguments)}function d(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();var n=document.execCommand("copy");return t.remove(),n}},737:function(e,t,n){"use strict";n.d(t,{HQ:function(){return o},Qt:function(){return a},fH:function(){return u},lj:function(){return i},we:function(){return c},zA:function(){return s}});
2var r=n(8179),o=r.zl0.withParams({headerBackgroundColor:"#262D34",headerTextColor:"#ffffff",headerColumnResizeHandleColor:"#606060",headerHeight:56,columnBorder:{style:"solid",color:"rgba(255,255,255,0.25)"},fontSize:14,oddRowBackgroundColor:"#f0f4f8",rowHoverColor:"#d0e4f0",selectedRowBackgroundColor:"#dce6f0",rowBorder:{style:"solid",color:"#e5e7eb"},checkboxCheckedBorderColor:"#172837",checkboxCheckedBackgroundColor:"#172837",checkboxUncheckedBorderColor:"#d1d5db",checkboxUncheckedBackgroundColor:"#ffffff",inputBorder:{style:"solid",color:"#d1d5db"},inputFocusBorder:{style:"solid",color:"#1d4ed8"},columnDropCellBackgroundColor:"#262D34",columnDropCellTextColor:"#ffffff"}).withPart((0,r.ykk)({css:"\n      /* Header: uppercase bold labels */\n      .ag-header-cell-label, .ag-header-group-cell-label {\n        font-weight: 700;\n        text-transform: uppercase;\n        font-size: 1.5rem;\n        letter-spacing: 0.05em;\n      }\n      /* Force header text color on all header children (icons, sort arrows, etc.) */\n      .ag-header *, .ag-header-cell *, .ag-header-group-cell * {\n        color: var(--ag-header-text-color) !important;\n      }\n      /* Sort indicator icon is display:none (zero width) until sorted, so its\n         column would otherwise narrow and wrap the header text. Scoped to\n         ag-header-cell-sorted-* (AG Grid's own sort-state class) so only the\n         column actually being sorted reserves the space, not every column. */\n      .ag-header-cell-sorted-asc .ag-sort-indicator-container,\n      .ag-header-cell-sorted-desc .ag-sort-indicator-container,\n      .ag-header-cell-sorted-mixed .ag-sort-indicator-container {\n        min-width: calc(var(--ag-icon-size, 16px) + var(--ag-spacing, 4px));\n      }\n      .ag-header-row > .ag-header-cell:last-of-type,\n      .ag-header-row > .ag-header-group-cell:last-of-type,\n      .ag-row > .ag-cell:last-of-type {\n        border-right: none !important;\n      }\n      .ag-header-row > .ag-header-cell:last-of-type::after,\n      .ag-header-row > .ag-header-group-cell:last-of-type::after {\n        display: none !important;\n      }\n      /* Panel title bar (Choose Columns dialog) */\n      .ag-panel-title-bar { background-color: var(--ag-header-background-color) !important; }\n      .ag-panel-title-bar *, .ag-column-select-header, .ag-column-select-header * {\n        color: var(--ag-header-text-color) !important;\n      }\n      /* Group-by drop zone bar */\n      .ag-column-drop-horizontal { background-color: var(--ag-header-background-color) !important; }\n      .ag-column-drop-horizontal *, .ag-column-drop-empty-message { color: var(--ag-header-text-color) !important; }\n      /* Cell: flex-align so single-line cells sit flush with multi-line status cells */\n      .ag-cell { display: flex; align-items: center; overflow: hidden; }\n      /* Status cell renderer layout */\n      .ag-cell .ag-status-cell {\n        display: flex; flex-direction: column; line-height: 1.3;\n        gap: 1px; padding: 6px 0; min-width: 0; overflow: hidden;\n      }\n      /* Pagination panel: left-aligned */\n      .ag-paging-panel { justify-content: flex-start; }\n      /* Sidebar: hide right-rail tab strip (buttons are used instead) */\n      .ag-side-buttons { display: none !important; }\n      /* Floating filter row */\n      .ag-floating-filter { background-color: #f9fafb; }\n      /* Filter active indicator */\n      .ag-header-cell-filter-button.ag-filter-active {\n        --ag-background-color: rgba(255, 128, 2, 0.75) !important;\n        background: rgba(255, 128, 2, 0.9) !important;\n        background-color: rgba(255, 128, 2, 0.9) !important;\n        border-radius: 3px;\n        padding: 2px 4px;\n        box-shadow: none !important;\n        border: none !important;\n        outline: none !important;\n        position: relative;\n      }\n      .ag-header-cell-filter-button.ag-filter-active .ag-icon-filter { color: #ffffff !important; }\n      .ag-header-cell-filter-button.ag-filter-active::after {\n        content: '';\n        position: absolute;\n        top: 0;\n        right: 0;\n        width: 7px;\n        height: 7px;\n        background-color: #FFAB57E6;\n        border-radius: 50%;\n        transform: translate(2px, -2px);\n      }\n      /* Remove blue border AG-Grid puts on header cell when column is filtered */\n      .ag-header-cell:has(.ag-filter-active) {\n        border-color: rgba(255,255,255,0.25) !important;\n        outline: none !important;\n        box-shadow: none !important;\n      }\n      .ag-floating-filter-input input,\n      .ag-floating-filter .ag-text-field-input,\n      .ag-floating-filter .ag-input-field-input {\n        height: 24px; min-height: 24px; padding: 0 6px; font-size: 1.2rem;\n        background-color: #ffffff; color: #172837 !important;\n        border: 1px solid #d1d5db; border-radius: 3px; width: 100%;\n      }\n      .ag-floating-filter-button-button, .ag-floating-filter-button-button .ag-icon { color: #1d4ed8 !important; }\n      /* Columns tool panel */\n      .ag-column-select { background-color: #ffffff; color: #172837; }\n      .ag-column-select-header {\n        background-color: #ffffff; border-bottom: 1px solid #e5e7eb;\n        padding: 6px 8px; color: #172837 !important;\n      }\n      .ag-column-select-header * { color: #172837 !important; }\n      .ag-column-select .ag-virtual-list-item { background-color: #ffffff; }\n      .ag-column-select-column, .ag-column-select-column-group { background-color: #ffffff; color: #172837; }
2\n      .ag-column-select-column:hover, .ag-column-select-column-group:hover { background-color: #eff6ff; }\n      .ag-column-select-column-label, .ag-column-select-column-group-label { font-size: 1.2rem; }\n      /* Sidebar panel body */\n      .ag-tool-panel-wrapper, .ag-filter-toolpanel { background-color: #ffffff; color: #172837; }\n      /* Tool panel title bar \u2014 mounted by ag_grid_base_controller because the tab strip that\n         would otherwise close a panel is hidden above. Stacking it over the panel body means\n         the body can no longer claim the wrapper's full height. */\n      .ag-tool-panel-wrapper { display: flex; flex-direction: column; }\n      .ag-tool-panel-wrapper > .ag-tool-panel-content { height: auto; flex: 1 1 auto; min-height: 0; }\n      .ag-grid-tool-panel-header {\n        display: flex; align-items: center; justify-content: space-between; gap: 8px;\n        flex: 0 0 auto; padding: 6px 8px;\n        background-color: #f0f4f8; border-bottom: 1px solid #e5e7eb;\n      }\n      .ag-grid-tool-panel-header__title {\n        font-size: 1.2rem; font-weight: 600; letter-spacing: 0.04em;\n        text-transform: uppercase; color: #172837;\n      }\n      .ag-grid-tool-panel-header__clear-all {\n        margin-left: auto; flex: 0 0 auto;\n        padding: 2px 6px; background: transparent; border: none; border-radius: 3px;\n        font-size: 1.1rem; font-weight: 600; color: #1d4ed8; cursor: pointer;\n      }\n      .ag-grid-tool-panel-header__clear-all:hover:not(:disabled) { background-color: #dce6f0; }\n      .ag-grid-tool-panel-header__clear-all:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 1px; }\n      .ag-grid-tool-panel-header__clear-all:disabled { color: #9ca3af; cursor: default; }\n      .ag-grid-tool-panel-header__close {\n        display: inline-flex; align-items: center; justify-content: center;\n        width: 20px; height: 20px; padding: 0; flex: 0 0 auto;\n        background: transparent; border: none; border-radius: 3px;\n        color: #172837; cursor: pointer;\n      }\n      .ag-grid-tool-panel-header__close:hover { background-color: #dce6f0; }\n      .ag-grid-tool-panel-header__close:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 1px; }\n      /* New filter panel (agNewFiltersToolPanel) */\n      .ag-filter-panel-container { background-color: #ffffff; padding: 4px; }\n      .ag-filter-card { background-color: #ffffff; }\n      .ag-filter-card-add { padding: 4px 0; }\n      .ag-filter-add-select .ag-picker-field-wrapper {\n        height: 26px; min-height: 26px; background-color: #f9fafb; color: #172837;\n        border: 1px solid #d1d5db; border-radius: 3px; padding: 0 8px;\n        font-size: 1.2rem;\n      }\n      .ag-filter-add-select .ag-picker-field-wrapper *,\n      .ag-filter-add-select .ag-picker-field-display,\n      .ag-filter-add-select .ag-label { font-size: 1.2rem !important; color: #9ca3af; }\n      .ag-filter-add-select .ag-picker-field-wrapper:focus-within { border-color: #1d4ed8; }\n      .ag-filter-toolpanel-header, .ag-filter-toolpanel-group-title-bar {\n        background-color: #f0f4f8 !important; color: #172837 !important;\n      }\n      .ag-filter-toolpanel-header *, .ag-filter-toolpanel-group-title-bar * { color: #172837 !important; }\n      .ag-filter-toolpanel .ag-icon, .ag-filter-toolpanel .ag-group-title-bar-icon { color: #1d4ed8; }\n      .ag-filter-toolpanel-group-item { color: #172837; }\n      .ag-filter-toolpanel-group-item:hover { background-color: #eff6ff; }\n      /* Set filter popup (portalled to <body> \u2014 outside component scope).\n       * Note: withPart CSS is already scoped to the theme, so no prefix needed. */\n      .ag-filter {\n        background-color: #ffffff; color: #172837;\n        border: 1px solid #e5e7eb;\n        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n      }\n      .ag-filter .ag-set-filter-list { background-color: #ffffff; }\n      .ag-filter .ag-virtual-list-item,\n      .ag-filter .ag-set-filter-item { color: #172837; }\n      .ag-filter .ag-virtual-list-item:hover { background-color: #eff6ff; }\n      .ag-filter .ag-set-filter-item-value { color: #172837; }\n      /* Panel search inputs \u2014 left padding accounts for the icon preceding the input */\n      .ag-mini-filter .ag-input-field-input,\n      .ag-column-select-header .ag-text-field-input,\n      .ag-filter-toolpanel-search .ag-text-field-input {\n        height: 26p
2x; min-height: 26px; padding: 0 8px 0 26px; font-size: 1.2rem;\n        background-color: #f9fafb; color: #172837;\n        border: 1px solid #d1d5db; border-radius: 3px;\n      }\n      .ag-mini-filter .ag-input-field-input:focus,\n      .ag-column-select-header .ag-text-field-input:focus,\n      .ag-filter-toolpanel-search .ag-text-field-input:focus { border-color: #1d4ed8; }\n      /* Text filter popup \u2014 value input and condition-type dropdown */\n      .ag-filter .ag-text-field-input-wrapper .ag-text-field-input {\n        height: 26px; min-height: 26px; padding: 0 8px 0 26px; font-size: 1.2rem;\n        background-color: #f9fafb; color: #172837;\n        border: 1px solid #d1d5db; border-radius: 3px; width: 100%;\n      }\n      .ag-filter .ag-text-field-input-wrapper .ag-text-field-input:focus {\n        border-color: #1d4ed8; outline: none;\n      }\n      /* Scoped to ag-filter-select, not ag-text-filter: the latter is absent from the filter popup's\n         DOM, so these rules never applied and the select kept AG-Grid's default 32px vs the input's 26px. */\n      .ag-filter .ag-filter-select .ag-picker-field-wrapper {\n        height: 26px; min-height: 26px; box-sizing: border-box;\n        background-color: #f9fafb; color: #172837;\n        border: 1px solid #d1d5db; border-radius: 3px; padding: 0 8px;\n        font-size: 1.2rem;\n      }\n      .ag-filter .ag-filter-select .ag-picker-field-wrapper:focus-within { border-color: #1d4ed8; }\n      .ag-filter .ag-filter-select .ag-picker-field-display,\n      .ag-filter .ag-filter-select .ag-picker-field-wrapper * { font-size: 1.2rem !important; color: #172837; }\n      .ag-filter .ag-filter-select .ag-picker-field-display { line-height: 24px; margin: 0; }\n      /* Number filter popup \u2014 value input, same compact sizing as the text filter input above */\n      .ag-filter .ag-number-field-input {\n        height: 26px; min-height: 26px; padding: 0 8px 0 26px; font-size: 1.2rem;\n        background-color: #f9fafb; color: #172837;\n        border: 1px solid #d1d5db; border-radius: 3px; width: 100%;\n      }\n      .ag-filter .ag-number-field-input:focus {\n        border-color: #1d4ed8; outline: none;\n      }\n      /* Filter popup footer: de-emphasized into a small text-link \u2014 AG-Grid's\n         default bordered/uppercase button is too heavy for a popup footer. */\n      .ag-filter-apply-panel {\n        padding: 4px 8px;\n        border-top: 1px solid #e5e7eb;\n        gap: 4px;\n      }\n      .ag-filter-apply-panel-button {\n        background-color: transparent;\n        border: none;\n        box-shadow: none;\n        padding: 2px 6px;\n        height: auto;\n        min-height: 0;\n        margin-left: 0;\n        font-size: 1.1rem;\n        font-weight: 500;\n        text-transform: none;\n        color: #172837;\n        border-radius: 3px;\n      }\n      .ag-filter-apply-panel-button:hover {\n        background-color: #eff6ff;\n      }\n      .ag-filter-apply-panel-button:active {\n        background-color: #dbeafe;\n      }\n      /* Date filter: suppress the magnifying-glass ::before that the Quartz theme\n         injects into all .ag-filter-filter input wrappers \u2014 it overlaps the\n         browser's native date-picker calendar icon. */\n      .ag-date-filter .ag-input-wrapper::before {\n        display: none !important;\n      }\n      /* Pinned bottom (Totals) row: column separators */\n      .ag-floating-bottom .ag-cell {\n        border-right: 1px solid #d1d5db;\n        font-weight: 600;\n      }\n      .ag-checkbox-input-wrapper:has(input:disabled) {\n        background-color: #D6D6D6 !important;\n        opacity: 1 !important;\n        cursor: not-allowed !important;\n      }\n    "})),i=o.withPart((0,r.ykk)({css:"\n      .ag-header-cell-label, .ag-header-group-cell-label {\n        font-size: 1.15rem;\n      }\n    "})),a=o.withPart((0,r.ykk)({css:"\n      .ag-header-cell-label, .ag-header-group-cell-label {\n        font-weight: 600;\n        text-transform: none;\n        letter-spacing: normal;\n      }\n    "}
2)),u=32,c=30,s=o.withParams({headerBackgroundColor:"#cde0ef",headerTextColor:"#000000",columnBorder:{style:"solid",color:"rgba(0,0,0,0.15)"},headerHeight:u,rowHeight:c,headerColumnResizeHandleHeight:"40%"}).withPart((0,r.ykk)({css:"\n      .ag-header-cell-label, .ag-header-group-cell-label {\n        font-size: 1.15rem;\n        font-weight: 500;\n      }\n      /* Cell editor inputs ignore the grid's fontSize param and use AG-Grid's raw\n         default (18px), rendering oversized against this theme's 14px cell text.\n         Pin to the same font-size var + fill the row height across all three\n         editable grids (editable, growable, provision) that share this theme. */\n      .ag-cell-editor .ag-input-field-input,\n      .ag-cell-editor .ag-text-field-input {\n        font-size: var(--ag-font-size);\n        height: 100%;\n        min-height: 100%;\n      }\n      /* .ag-cell's flex only centers vertically, so justify-content centers horizontally. */\n      .ag-row-number-header, .ag-row-number-cell {\n        font-size: 1.15rem;\n        font-weight: 450;\n        justify-content: center;\n        text-align: center;\n      }\n    "}))},6149:function(e,t,n){"use strict";n.d(t,{g:function(){return u}});var r=["errorFieldKeys","highlightWhenAnyError"];function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return e.map(function(e){var t,n=e,o=n.errorFieldKeys,a=!0===n.highlightWhenAnyError;if(!(!!o&&o.length>0)&&!a)return e;n.errorFieldKeys,n.highlightWhenAnyError;return i(i({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,r)),{},{cellClassRules:i({"ag-grid-cell--has-error":function(e){var t,n,r=null!==(t=null===(n=e.data)||void 0===n?void 0:n.error_fields)&&void 0!==t?t:[];return a?r.length>0:(null!==o&&void 0!==o?o:[]).some(function(e){return r.includes(e)})}},null!==(t=e.cellClassRules)&&void 0!==t?t:{})})})}},1708:function(e,t,n){"use strict";function r(e){return 0===e?"Empty":"".concat(e," election").concat(1===e?"":"s")}function o(e){var t=e.value,n=e.node;if(null!==n&&void 0!==n&&n.group&&!n.data){var r,o,i;if(null==t||""===t)return"";var a=null!==(r=null!==(o=n.allChildrenCount)&&void 0!==o?o:null===(i=n.childrenAfterFilter)||void 0===i?void 0:i.length)&&void 0!==r?r:0;return"".concat(t," (").concat(a,")")}return Array.isArray(t)?t.join(" "):t}function i(e){var t,n,r,o,i=e.node,a=e.column,u=null===a||void 0===a?void 0:a.getColDef().field,c=i.data;if(c&&u){var s=c[u];return null==s?"":String(s)}var l=null!==(t=i.key)&&void 0!==t?t:"";if(!l)return"";var f=null!==(n=null!==(r=i.allChildrenCount)&&void 0!==r?r:null===(o=i.childrenAfterFilter)||void 0===o?void 0:o.length)&&void 0!==n?n:0;return"".concat(l," (").concat(f,")")}function a(e,t){var n,o,i;return null!==(n=null!==(o=null!==(i=function(e,t){if("status_label"===e&&t){var n=t.status_plain;return"string"===typeof n?n:void 0}}(null===e||void 0===e?void 0:e.field,t))&&void 0!==i?i:function(e,t){var n;if("electionNameCellRenderer"===(null===e||void 0===e?void 0:e.cellRenderer)&&t){var o=t[String(null!==(n=e.field)&&void 0!==n?n:"name")];if("string"===typeof o&&""!==o){if(1===t.row_type){var i=[o],a=t.childCount;
2return"number"===typeof a&&i.push(r(a)),void 0!==t.entity_id&&null!==t.entity_id&&i.push(String(t.entity_id)),i.join(" ")}var u=[o];return"string"===typeof t.type_label&&t.type_label&&u.push(t.type_label),void 0!==t.id&&null!==t.id&&u.push(String(t.id)),u.join(" ")}}}(e,t))&&void 0!==o?o:function(e,t){if(e&&t){var n=t["".concat(e,"_text")];return"string"===typeof n&&""!==n?n:void 0}}(null===e||void 0===e?void 0:e.field,t))&&void 0!==n?n:function(e,t){if("multilineTextCellRenderer"===(null===e||void 0===e?void 0:e.cellRenderer)){var n=null===e||void 0===e?void 0:e.field;if(n&&t){var r=t["".concat(n,"_multiline")];if("string"===typeof r&&""!==r){var o=r.split("\n").map(function(e){return e.trim()}).filter(function(e){return""!==e});return o.length>0?o.join(" | "):void 0}}}}(e,t)}n.d(t,{Vl:function(){return o},cQ:function(){return i},sz:function(){return r},yh:function(){return a}})},6935:function(e,t,n){"use strict";n.d(t,{V:function(){return o},m:function(){return r}});var r={buttons:["clear"]},o={clearFilter:"Clear Filter"}},2309:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}n.d(t,{$:function(){return u},N:function(){return c}});var u=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0,this.params=void 0,this.statusOptions=[],this.statusInputs=[],this.statusTextSpans=[],this.testTextSpan=void 0,this.statusCounts=null,this.testCount=null,this.voteBoxTextSpan=null,this.voteBoxCount=null,this.selectAllInput=void 0,this.includeTestInput=void 0,this.includeVoteBoxesInput=null,this.showVoteBoxes=!0},(t=[{key:"init",value:function(e){var t;this.params=e,this.statusOptions=null!==(t=e.statuses)&&void 0!==t?t:[],this.showVoteBoxes=!1!==e.showVoteBoxes,this.eGui=document.createElement("div"),this.eGui.className="ag-grid-status-test-filter",this.build(),this.renderFromModel(e.model),this.fetchStatusCounts()}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(e){return this.params=e,this.renderFromModel(e.model),!0}},{key:"build",value:function(){var e=this;this.statusTextSpans=[];var t=document.createElement("div");t.className="ag-grid-status-test-filter__section";var n=document.createElement("label");n.className="ag-grid-status-test-filter__option ag-grid-status-test-filter__option--all",this.selectAllInput=document.createElement("input"),this.selectAllInput.type="checkbox",this.selectAllInput.addEventListener("change",function(){var t=e.selectAllInput.checked;e.selectAllInputs().forEach(function(e){return e.checked=t}),e.emitChange(),e.syncSelectAll()});var r=document.createElement("span");if(r.textContent="(Select All)",n.appendChild(this.selectAllInput),n.appendChild(r),t.appendChild(n),this.statusInputs=this.statusOptions.map(function(n){var r=document.createElement("label");r.className="ag-grid-status-test-filter__option";var o=document.createElement("input");o.type="checkbox",o.value=n,o.addEventListener("change",function(){e.emitChange(),e.syncSelectAll()});var i=document.createElement("span");return i.textContent=n,e.statusTextSpans.push(i),r.appendChild(o),r.appendChild(i),t.appendChild(r),o}),this.showVoteBoxes){var o=document.createElement("label");o.className="ag-grid-status-test-filter__option",this.includeVoteBoxesInput=document.createElement("input"),this.includeVoteBoxesInput.type="checkbox",this.includeVoteBoxesInput.addEventListener("change",function(){e.emitChange(),e.syncSelectAll()});var i=document.createElement("span");i.textContent="Vote box",this.voteBoxTextSpan=i,o.appendChild(this.includeVoteBoxesInput),o.appendChild(i),t.appendChild(o)}var a=document.createElement("div");a.className="ag-grid-status-test-filter__divider";var u=document.createElement("div");u.className="ag-grid-status-test-filter__section";var c=document.createElement("label");c.className="ag-grid-status-test-filter__option",this.includeTestInput=document.createElement("input"),this.includeTestInput.type="checkbox",this.includeTestInput.addEventListener("change",function(){e.emitChange(),e.syncSelectAll()});var s=document.createElement("span");s.textContent="Test votes",this.testTextSpan=s,c.appendChild(this.includeTestInput),c.appendChild(s),u.appendChild(c),this.eGui.appendChild(t),this.eGui.appendChild(a),this.eGui.appendChild(u)}},{key:"renderFromModel",value:function(e){var t=null===e||void 0===e?void 0:e.statuses,n=void 0===t,r=new Set(null!==t&&void 0!==t?t:[]);
2this.statusInputs.forEach(function(e){e.checked=n||r.has(e.value)}),this.includeTestInput.checked="Not test"!==(null===e||void 0===e?void 0:e.test),this.includeVoteBoxesInput&&(this.includeVoteBoxesInput.checked=!1!==(null===e||void 0===e?void 0:e.voteBoxes)),this.syncSelectAll()}},{key:"fetchStatusCounts",value:function(){var e=this,t=this.params.statusCountsUrl;t&&fetch("".concat(t,"?column=status"),{credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(e){return e.ok?e.json():{counts:{},test_count:void 0,vote_box_count:void 0}}).then(function(t){var n,r,o;e.statusCounts=null!==(n=t.counts)&&void 0!==n?n:{},e.testCount=null!==(r=t.test_count)&&void 0!==r?r:null,e.voteBoxCount=null!==(o=t.vote_box_count)&&void 0!==o?o:null,e.applyStatusCounts(),e.applyTestCount(),e.applyVoteBoxCount()}).catch(function(){})}},{key:"applyStatusCounts",value:function(){var e=this;if(this.statusCounts){var t=this.statusCounts;this.statusTextSpans.forEach(function(n,r){var o=e.statusOptions[r],i=t[o];n.textContent=void 0===i?o:"".concat(o," (").concat(i,")")})}}},{key:"applyTestCount",value:function(){null!==this.testCount&&(this.testTextSpan.textContent="Test votes (".concat(this.testCount,")"))}},{key:"applyVoteBoxCount",value:function(){null!==this.voteBoxCount&&this.voteBoxTextSpan&&(this.voteBoxTextSpan.textContent="Vote box (".concat(this.voteBoxCount,")"))}},{key:"selectAllInputs",value:function(){var e=[].concat(r(this.statusInputs),[this.includeTestInput]);return this.includeVoteBoxesInput?[].concat(r(e),[this.includeVoteBoxesInput]):e}},{key:"syncSelectAll",value:function(){var e=this.selectAllInputs(),t=e.filter(function(e){return e.checked}).length;this.selectAllInput.checked=t===e.length,this.selectAllInput.indeterminate=t>0&&t<e.length}},{key:"emitChange",value:function(){this.params.onModelChange(this.computeModel())}},{key:"computeModel",value:function(){var e=this.statusInputs.filter(function(e){return e.checked}).map(function(e){return e.value}),t=e.length===this.statusInputs.length,n=!this.includeTestInput.checked,r=!!this.includeVoteBoxesInput&&!this.includeVoteBoxesInput.checked;if(t&&!n&&!r)return null;var o={filterType:"statusTest"};return t||(o.statuses=e),n&&(o.test="Not test"),r&&(o.voteBoxes=!1),o}}])&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function c(){return{doesFilterPass:function(e){var t,n=e.model;if(!n)return!0;var r=e.data;return(!1!==n.voteBoxes||1!==r.row_type)&&(1===r.row_type||!(void 0!==n.statuses&&!n.statuses.includes(null!==(t=r.status_label)&&void 0!==t?t:""))&&(("Not test"!==n.test||!0!==r.test)&&("Test"!==n.test||!0===r.test)))},getModelAsString:function(e){if(!e)return"";var t=[];return e.statuses&&t.push(e.statuses.join(", ")),"Not test"===e.test&&t.push("excl. test"),!1===e.voteBoxes&&t.push("excl. vote boxes"),t.join(" \xb7 ")}}}},7343:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}
2(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}n.d(t,{B2:function(){return d},GQ:function(){return f},PE:function(){return h},ug:function(){return v}});var l="The voter list has changed. Please validate again.";function f(){var e,t;return null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:""}function d(e){return fetch(e,{method:"POST",headers:{Accept:"application/json","X-CSRF-Token":f()},credentials:"same-origin"}).then(function(e){return e.json().then(function(t){return{ok:e.ok,json:t}})})}function p(e,t){return fetch(e,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":f()},credentials:"same-origin",body:JSON.stringify(t)}).then(function(e){return e.json().then(function(t){return{ok:e.ok,json:t}})})}function h(e){return"string"===typeof e.errors?e.errors:e.errors&&"object"===typeof e.errors?Object.values(e.errors).flat().join(", "):"Update failed"}var v=function(){return e=function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"[GridEditQueue]";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pendingChanges=new Map,this.flushScheduled=!1,this.suppressChangeTracking=!1,this.inFlightNodes=new Set,this.heldChanges=new Map,this.updateUrlTemplate=t,this.batchUpdateUrl=n,this.callbacks=r,this.logLabel=o},t=[{key:"suppressed",get:function(){return this.suppressChangeTracking}},{key:"queueChange",value:function(e,t,n,r){var o,i=String(e.id),a=e.data,u=null!==(o=this.pendingChanges.get(i))&&void 0!==o?o:{node:e,isNew:void 0===(null===a||void 0===a?void 0:a.id)||null===(null===a||void 0===a?void 0:a.id),attributes:{},oldValues:{}};t in u.oldValues||(u.oldValues[t]=r),u.attributes[t]=n,this.pendingChanges.set(i,u),this.scheduleFlush()}},{key:"scheduleFlush",value:function(){var e=this;this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(function(){return e.flush()}))}},{key:"flush",value:function(){var e=this;if(this.flushScheduled=!1,0!==this.pendingChanges.size){var t=Array.from(this.pendingChanges.values());this.pendingChanges.clear();var n=[];t.forEach(function(t){var r=String(t.node.id);e.inFlightNodes.has(r)?e.holdChange(r,t):n.push(t)}),0!==n.length&&(1!==n.length||n[0].isNew?this.sendBatchUpdate(n):this.sendSingleUpdate(n[0]))}}},{key:"holdChange",value:function(e,t){var n=this.heldChanges.get(e);n?(Object.entries(t.oldValues).forEach(function(e){var t=a(e,2),r=t[0],o=t[1];r in n.oldValues||(n.oldValues[r]=o)}),Object.assign(n.attributes,t.attributes)):this.heldChanges.set(e,t)}},{key:"markInFlight",value:function(e){var t=this;e.forEach(function(e){return t.inFlightNodes.add(String(e.node.id))})}},{key:"releaseInFlight",value:function(e){var t=this;e.forEach(function(e){var n,r=String(e.node.id);t.inFlightNodes.delete(r);var o=t.heldChanges.get(r);o&&(t.heldChanges.delete(r),null!==o.node.rowIndex&&(o.isNew=null==(null===(n=o.node.data)||void 0===n?void 0:n.id),t.pendingChanges.set(r,o),t.scheduleFlush()))})}},{key:"sendSingleUpdate",value:function(e){var t,n=this,r=null===(t=e.node.data)||void 0===t?void 0:t.id;void 0!==r&&null!==r&&(this.markInFlight([e]),p(this.updateUrlTemplate.replace(":id",String(r)),e.attributes).then(function(t){var r=t.ok,o=t.json;if(!r){var i,a;n.rollback(e);var u=h(o);return console.warn("".concat(n.logLabel," update rejected:"),u),void(null===(i=(a=n.callbacks).onError)||void 0===i||i.call(a,u))}o.row?n.applyServerRow(e,o.row):n.callbacks.onRemoveNode(e.node),n.callbacks.onPersisted(l,o)}).catch(function(t){n.rollback(e),console.error("".concat(n.logLabel," PATCH error:"),t)}).finally(function(){n.releaseInFlight([e])}))}},{key:"sendBatchUpdate",value:function(e){var t=this;this.markInFlight(e);var n=e.map(function(e){return{id:e.isNew?null:e.node.data.id,attributes:e.attributes}});p(this.batchUpdateUrl,{changes:n}).then(function(n){var r=n.ok,o=n.json;if(!r){var i,a;e.forEach(function(e){return t.discardFailedEntry(e)});var u=h(o);return console.warn("".concat(t.logLabel," batch_update rejected:"),u),void(null===(i=(a=t.callbacks).onError)||void 0===i||i.call(a,u))}var c=Array.isArray(o.rows)?o.rows:[];e.forEach(function(e,n){var r=c[n];r?t.applyServerRow(e,r):t.callbacks.onRemoveNode(e.node)}),t.callbacks.onPersisted(l,o)}).catch(function(n){e.forEach(function(e){return t.discardFailedEntry(e)}),console.error("".concat(t.logLabel," batch_update error:"),n)}).finally(function(){t.releaseInFlight(e)})}},{key:"applyServerRow",value:function(e,t){var n,r,i,a,u=String(e.node.id),c=o(o({},null!==(n=null===(r=this.heldChanges.get(u))||void 0===r?void 0:r.attributes)&&void 0!==n?n:{}),null!==(i=null===(a=this.pendingChanges.get(u))||void 0===a?void 0:a.attributes)&&void 0!==i?i:{});e.node.setData(0===Object.keys(c).length?t:o(o({},t),c))}},{key:"rollback",value:function(e){this.suppressChangeTracking=!0,Object.entries(e.oldValues).forEac
2h(function(t){var n=a(t,2),r=n[0],o=n[1];e.node.setDataValue(r,o)}),this.suppressChangeTracking=!1}},{key:"discardFailedEntry",value:function(e){e.isNew?this.callbacks.onRemoveNode(e.node):this.rollback(e)}}],t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},1280:function(e,t,n){"use strict";n.d(t,{Fh:function(){return c},Qi:function(){return s}});var r="ag-grid-masked-cell",o="ag-grid-masked-cell--revealed",i="Click to reveal",a="Click to hide";var u=null;function c(e,t,n){e.classList.add(r);var c=function(e){var t,n=e.data;return n?(null!==(t=n.__revealedMaskedCells)&&void 0!==t||(n.__revealedMaskedCells={}),n.__revealedMaskedCells):{}}(t),s=function(){var t=!0===c[n];e.classList.toggle(o,t),e.title=t?a:i};s(),e.addEventListener("click",function(e){e.stopPropagation();var t=!0===c[n];u&&(u.flags[u.key]=!1,u=null),document.querySelectorAll(".".concat(o)).forEach(function(e){e.classList.remove(o),e.title=i}),t||(c[n]=!0,u={flags:c,key:n}),s()})}function s(e,t,n){var r=document.createElement("span");return r.textContent=e,e&&c(r,t,n),r}},2790:function(e,t,n){"use strict";n.d(t,{T:function(){return r}});var r={suppressCsvExport:!0,suppressExcelExport:!0}},1978:function(e,t,n){"use strict";function r(e){var t=window.getSelection();return!(!t||t.isCollapsed||""===t.toString().trim())&&(t.containsNode(e,!0)||null!==t.anchorNode&&e.contains(t.anchorNode)||null!==t.focusNode&&e.contains(t.focusNode))}n.d(t,{s:function(){return r}})},1032:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(5260);function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=s(this,t,[].concat(r))).resizeObserver=null,e.mutationObserver=null,e.pendingFrame=null,e.lastWidth=-1,e.applying=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this,t=this.barElement;this.resizeObserver=new ResizeObserver(function(){return e.handleResize()}),this.resizeObserver.observe(t),this.mutationObserver=new MutationObserver(function(){e.applying||e.scheduleRecompute()}),this.mutationObserver.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","hidden","class"]}),this.scheduleRecompute()}},{key:"disconnect",value:function(){var e,t;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(t=this.mutationObserver)||void 0===t||t.disconnect(),null!==this.pendingFrame&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null)}},{key:"barElement",get:function(){return this.element}},{key:"handleResize",value:function(){var e=this.barElement.clientWidth;e!==this.lastWidth&&(this.lastWidth=e,this.scheduleRecompute())}},{key:"scheduleRecompute",value:function(){var e=this;null!==this.pendingFrame&&cancelAnimationFrame(this.pendingFrame),this.pendingFrame=requestAnimationFrame(function(){e.pendingFrame=null,e.recompute()})}},{key:"recompute",value:function(){var e=this.barElement,t=this.managedLabels(e),n=this.collapsibleChips(e),r=t.length>0&&!this.isStacked(e);this.applyMaxWidth(t,null),this.setChipsCollapsed(n,!1);var o=this.effectiveFlexItems(e);if(!(this.countRows(o)<=1)&&!(r&&this.clipLabels(t,o)<=1)&&0!==n.length){var i=this.countRows(o);this.setChipsCollapsed(n,!0),this.countRows(o)>=i?this.setChipsCollapsed(n,!1):r&&this.clipLabels(t,o)}}},{key:"clipLabels",value:function(e,t){this.applyMaxWidth(e,null);var n=this.countRows(t);if(n<=1)return n;var r=Math.max.apply(Math,i(e.map(function(e){return e.offsetWidth})));this.applyMaxWidth(e,this.minLabelWidthValue);var o=this.countRows(t);if(o>=n)return this.applyMaxWidth(e,null),n;var a=this.largestWidthForRowCount(e,t,o,this.minLabelWidthValue,r);return this.applyMaxWidth(e,a),o}},{key:"largestWidthForRowCount",value:function(e,t,n,r,o){for(var i=r,a=o,u=r;a-i>=8;){var c=Math.round((i+a)/2);this.applyMaxWidth(e,c),this.countRows(t)===n?(u=c,i=c):a=c}return u}},{key:"applyMaxWidth",value:function(e,t){var n;this.applying=!0,e.forEach(function(e){null===t?e.style.removeProperty("max-width"):e.style.maxWidth="".concat(t,"px")}),null===(n=this.mutationObserver)||void 0===n||n.takeRecords(),this.applying=!1}},{key:"managedLabels",value:function(e){return Array.from(e.querySelectorAll(".shared--searchable-dropdown-component__label"))}},{key:"collapsibleChips",value:function(e){return Array.from(e.querySelectorAll(".toolkit-button-component--toolbar-chip")).filter(function(e){return null!==e.querySelector(".toolkit-button-component__toolbar-chip-label")&&null!==e.querySelector("svg, i, img")})}},{key:"setChipsCollapsed",value:function(e,t){var n;this.applying=!0,e.forEach(function(e){e.setAttribute("data-chip-labels",t?"collapsed":"expanded")}),null===(n=this.mutationObserver)||void 0===n||n.takeRecords(),this.applying=!1}},{key:"isStacked",value:function(e){return"1"===getComputedStyle(e).getPropertyValue("--ag-toolbar-stacked").trim()}},{key:"isRendered",value:function(e){if("none"===getComputedStyle(e).display||e.hidden)return!1;var t=e.getBoundingClientRect();return t.width>0&&t.height>0}},{key:"effectiveFlexItems",value:function(e){var t=this,n=[],r=function(e){Array.from(e.children).forEac
2h(function(e){var o=e;"contents"===getComputedStyle(o).display?r(o):t.isRendered(o)&&n.push(o)})};return r(e),n}},{key:"countRows",value:function(e){return(0,o.c)(e)}}])&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);p.values={minLabelWidth:{type:Number,default:72}}},232:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ie}});var r=n(8179),o=n(4546),i=n(8990),a=n(8882),u=n(5138),c=n(7198);function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return l(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(l(t={},r,function(){return this}),t),p=f.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,r,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,t,n,r){function i(t,n){l(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},l(e,t,n,r)}function f(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){f(i,r,o,a,u,"next",e)}function u(e){f(i,r,o,a,u,"throw",e)}a(void 0)})}}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var v=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0,this.input=void 0,this.params=void 0,this.url=null,this.onChange=function(){t.persist()}},t=[{key:"init",value:function(e){var t,n,r,o,i;if(this.params=e,this.eGui=document.createElement("div"),this.eGui.className="ag-toggle-checkbox-cell",!e.node.group){var a=e.data;this.url=null!==(t=null===a||void 0===a?void 0:a[null!==(n=e.urlField)&&void 0!==n?n:"toggle_url"])&&void 0!==t?t:null;var u=e.disabledField?null===a||void 0===a?void 0:a[e.disabledField]:void 0,c="ag-toggle-".concat(null!==(r=null===(o=e.colDef)||void 0===o?void 0:o.field)&&void 0!==r?r:"cell","-").concat(null!==(i=e.node.id)&&void 0!==i?i:e.node.rowIndex);this.input=document.createElement("input"),this.input.type="checkbox",this.input.id=c,this.input.checked=e.value===this.checkedValue(),this.input.disabled=!this.url||Boolean(u);var s=document.createElement("label");s.htmlFor=c,u&&(this.eGui.title=u),this.input.disabled||this.input.addEventListener("change",this.onChange),this.eGui.appendChild(this.input),this.eGui.appendChild(s)}}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(){return!1}},{key:"destroy",value:function(){var e;null===(e=this.input)||void 0===e||e.removeEventListener("change",this.onChange)}},{key:"checkedValue",value:function(){var e;return null!==(e=this.params.checkedValue)&&void 0!==e?e:"Yes"}},{key:"uncheckedValue",value:function(){var e;return null!==(e=this.params.uncheckedValue)&&void 0!==e?e:"No"}},{key:"persist",value:(o=d(s().m(function e(){var t,n,r,o,i,a;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=this.input.checked,o=null!==(t=null===(n=document.querySelector('meta[name="csrf-token"]'))||void 0===n?void 0:n.content)&&void 0!==t?t:"",this.input.disabled=!0,e.p=1,e.n=2,fetch("".concat(this.url,"?value=").concat(r),{method:"PATCH",headers:{"X-CSRF-Token":o,"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},credentials:"same-origin"});case 2:if((i=e.v).ok){e.n=3;break}throw new Error("Request failed (".concat(i.status,")"));case 3:return a=this,e.n=4,this.lockedReasonFrom(i);case 4:a.recordLock.call(a,e.v),this.commit(r),e.n=6;break;case 5:e.p=5,e.v,this.input.checked=!r,this.input.disabled=!1,alert("Failed to update this setting. Please try again.");case 6:return e.a(2)}},e,this,[[1,5]])})),function(){return o.apply(this,arguments)})},{key:"lockedReasonFrom",value:(r=d(s().m(function e(t){var n,r;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,t.json();case 1:return r=e.v,e.a(2,null!==(n=null===r||void 0===r?void 0:r.locked)&&void 0!==n?n:null);case 2:return e.p=2,e.v,e.a(2,null)}},e,null,[[0,2]])})),function(e){return r.apply(this,arguments)})},{key:"recordLock",value:function(e){var t=this.params.disabledField;t&&this.params.data&&(this.params.data[t]=e)}},{key:"commit",value:function(e){var t,n=null===(t=this.params.colDef)||void 0===t?void 0:t.field;n&&this.params.data&&(this.params.data[n]=e?this.checkedValue():this.uncheckedValue(),this.params.node.setDataValue(n,e?this.checkedValue():this.uncheckedValue()))}}],t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o}(),y=n(8787),m=n(7374),b=n(573),g=n(1720),w=n(7592);function _(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O(r.key),r)}}function O(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var T=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.eGui=void 0,this.eNameValueWrapper=void 0,this.eLabel=void 0,this.eValue=void 0,this.eMessage=void 0,this.api=void 0,this.onSelectionChanged=function(){return t.refreshValue()}},(t=[{key:"init",value:function(e){this.api=e.api,this.eGui=document.createElement("div"),this.eGui.className="ag-status-name-value ag-status-panel ag-status-panel-selected-row-count",this.eNameValueWrapper=document.createElement("span"),this.eLabel=document.createElement("span"),this.eNameValueWrapper.appendChild(this.eLabel),this.eNameValueWrapper.appendChild(document.createTextNode(":\xa0")),this.eValue=document.createElement("span"),this.eValue.className="ag-status-name-value-value",this.eNameValueWrapper.appendChild(this.eV
2alue),this.eGui.appendChild(this.eNameValueWrapper),this.eMessage=document.createElement("span"),this.eMessage.className="ag-status-panel-selected-row-count__message",this.eGui.appendChild(this.eMessage),this.api.addEventListener("selectionChanged",this.onSelectionChanged),this.api.addEventListener("modelUpdated",this.onSelectionChanged),this.refresh(e)}},{key:"getGui",value:function(){return this.eGui}},{key:"refresh",value:function(e){var t;return this.eLabel.textContent=null!==(t=e.label)&&void 0!==t?t:"Voters Selected",this.refreshValue(),!0}},{key:"destroy",value:function(){this.api.removeEventListener("selectionChanged",this.onSelectionChanged),this.api.removeEventListener("modelUpdated",this.onSelectionChanged)}},{key:"refreshValue",value:function(){var e=this.getSelectedCount(),t=this.isSelectAllActive()&&e>0;t?(this.eNameValueWrapper.classList.add("ag-hidden"),this.eMessage.classList.remove("ag-hidden"),this.eMessage.textContent="The first ".concat(e," records are selected, alternatively, before selecting, filter the list.")):(this.eMessage.classList.add("ag-hidden"),this.eNameValueWrapper.classList.remove("ag-hidden"),this.eValue.textContent=String(e)),this.eGui.classList.toggle("ag-status-panel-selected-row-count--warning",t),this.eGui.classList.toggle("ag-hidden",0===e),this.eGui.setAttribute("aria-hidden",String(0===e))}},{key:"isSelectAllActive",value:function(){var e=this.api.getServerSideSelectionState();return!0===(null===e||void 0===e?void 0:e.selectAll)}},{key:"getSelectedCount",value:function(){for(var e=0,t=this.api.getDisplayedRowCount(),n=0;n<t;n++){var r=this.api.getDisplayedRowAtIndex(n);if(!r||void 0===r.data)break;r.group||r.isSelected()&&e++}return e}}])&&_(e.prototype,t),n&&_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}(),k=n(2309),j=n(737),S=n(6149),P=n(6935),E=n(1708),C=n(7323),x=["mode"],A=["toolPanelHeaderName"];function R(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function L(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return I(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(I(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,I(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,I(f,"constructor",s),I(s,"constructor",c),c.displayName="GeneratorFunction",I(s,o,"GeneratorFunction"),I(f),I(f,o,"Generator"),I(f,r,function(){return this}),I(f,"toString",function(){return"[object Generator]"}),(L=function(){return{w:i,m:d}})()}function I(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}I=function(e,t,n,r){function i(t,n){I(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},I(e,t,n,r)}function B(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function D(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){B(i,r,o,a,u,"next",e)}function u(e){B(i,r,o,a,u,"throw",e)}a(void 0)})}}function M(e){return function(e){if(Array.isArray(e))return U(e)}(e)||F(e)||q(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function N(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
2if(!n){if(Array.isArray(e)||(n=q(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function V(e,t){return G(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||q(e,t)||H()}function H(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){if(e){if("string"==typeof e)return U(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function G(e){if(Array.isArray(e))return e}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){K(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function K(e,t,n){return(t=X(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,X(r.key),r)}}function X(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function Y(e,t,n){return t=ee(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,$()?Reflect.construct(t,n||[],ee(e).constructor):t.apply(e,n))}function $(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return($=function(){return!!e})()}function J(e,t,n,r){var o=Z(ee(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function Z(){return Z="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=ee(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Z.apply(null,arguments)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ee(e)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},te(e,t)}var ne={undelivered:{status_label:{filterType:"set",values:["Undelivered"]}}},re=["turnout","total_voters","turnout_pct"],oe="ag-grid-component-wrapper--booting",ie=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return(e=Y(this,t,[].concat(o))).voteBoxAwareRowSelectableCallback=function(t){var n;return e.rowSelectableCallback(t)&&(e.selectableVoteBoxRowsValue||1!==(null===(n=t.data)||void 0===n?void 0:n.row_type))},e.voteBoxesHidden=!1,e.modeForcedByDeepLink=!1,e.lastFooterRowData=[],e.sideBarConfig=!1,e.requestGridApiHandler=null,e.pendingExportFormat=null,e.sortOutsideClickHandler=null,e.filterMenuOutsideClickHandler=null,e.asyncFilterValuesCache=new Map,e.hasPersistedState=!1,e.lastDisplayedColIds=[],e.asyncFilterCountsCache=new Map,e.externalFilters=null,e.refreshSearchDebounced=(n=null,function(){null!==n&&clearTimeout(n),n=setTimeout(function(){var t;n=null,e.resetRowActionsCache(),null===(t=e.gridApi)||void 0===t||t.refreshServerSide({purge:!0})},375)}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&te(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e,n,o,s,l,f=this;if(J(t,"connect",this,3)([]),this.hasGridTarget){this.seedSearchFromUrl();var d=this.advancedColumnDefsValue.length>0,p=d?ne[null!==(e=this.initialGridFilterParam)&&void 0!==e?e:""]:void 0;d&&p&&(this.isBasicMode=!1,this.modeForcedByDeepLink=!0),this.sideBarConfig=this.buildSideBarConfig(d);var h=null!==(n=this.gridOptionsValue.defaultColDef)&&void 0!==n?n:{},_=W(W(W(W(W(W({theme:this.resolveTheme(),localeText:P.V,rowModelType:"serverSide",cac
2heBlockSize:this.cacheBlockSizeValue},this.paginationValue?{pagination:!0,paginationPageSize:this.cacheBlockSizeValue}:{}),{},{enableFilterHandlers:!0,rowBuffer:this.rowBufferValue,animateRows:!1,rowHeight:56},this.footerRowHeightValue>0?{getRowHeight:function(e){return"bottom"===e.node.rowPinned?f.footerRowHeightValue:void 0}}:{}),{},{getChildCount:function(e){return null===e||void 0===e?void 0:e.childCount},getRowId:function(e){var t;if(null!=e.data.id){var n,r=(null!==(n=e.parentKeys)&&void 0!==n?n:[]).join("/");return r?"".concat(r,"::").concat(e.data.id):String(e.data.id)}var o=Object.entries(e.data).map(function(e){var t=V(e,2),n=t[0],r=t[1];return"".concat(n,":").concat(String(r))}).join("|"),i=(null!==(t=e.parentKeys)&&void 0!==t?t:[]).join("/");return"grp_".concat(e.level,"_").concat(i,"_").concat(o)},getContextMenuItems:function(e){var t,n=(null!==(t=e.defaultItems)&&void 0!==t?t:[]).filter(function(e){return"export"!==e});if(f.disableContextMenuExportValue)return n;var r=[{name:"CSV Export",icon:'<span class="ag-icon ag-icon-csv"></span>',action:function(){return f.exportCsv()}}];return(f.supportsXlsxExport()||f.hasActiveCellRange())&&r.push({name:"Excel Export",icon:'<span class="ag-icon ag-icon-excel"></span>',action:function(){return f.exportXlsx()}}),n.push({name:"Export",icon:'<span class="ag-icon ag-icon-save"></span>',subMenu:r}),n},processCellForClipboard:function(e){var t,n,r=null===(t=e.node)||void 0===t?void 0:t.data;return null!==(n=(0,E.yh)(e.column.getColDef(),r))&&void 0!==n?n:(0,E.Vl)(e)},getMainMenuItems:function(e){var t,n=null!==(t=e.column)&&void 0!==t&&t.getColDef().enableRowGroup?e.defaultItems:e.defaultItems.filter(function(e){return"rowGroup"!==e});return f.withPivotAwareResetColumns(W(W({},e),{},{defaultItems:n}))},onFirstDataRendered:function(){f.autoSizeNonFlexColumns(),f.prefetchVisibleRowActions()},onModelUpdated:function(){if(f.pendingAutoSize){var e,t=null===(e=f.gridApi)||void 0===e?void 0:e.getDisplayedRowAtIndex(0);void 0!==(null===t||void 0===t?void 0:t.data)&&(f.pendingAutoSize=!1,f.autoSizeNonFlexColumns())}f.isSelectAllActive()&&f.handleSelectionChanged(),f.prefetchVisibleRowActions()},onColumnRowGroupChanged:function(){f.pendingAutoSize=!0,f.updateHeaderCheckbox(),f.handleSelectionChanged(),f.syncClearFiltersButton()},onFilterChanged:function(){f.updateHeaderCheckbox(),f.syncClearFiltersButton(),f.resetRowActionsCache()},onCellSelectionChanged:function(e){var t;if(e.finished){var n=null===(t=f.gridApi)||void 0===t?void 0:t.getCellRanges();if(null!==n&&void 0!==n&&n.length){var r,o=N(n);try{for(o.s();!(r=o.n()).done;){var i,a=r.value;if(a.startRow&&a.endRow&&a.columns.some(function(e){return"ag-Grid-SelectionColumn"===e.getColId()}))for(var u=Math.min(a.startRow.rowIndex,a.endRow.rowIndex),c=Math.max(a.startRow.rowIndex,a.endRow.rowIndex),s=null===(i=f.gridApi)||void 0===i?void 0:i.getDisplayedRowAtIndex(u),l=!(null!==s&&void 0!==s&&s.isSelected()),d=u;d<=c;d++){var p;null===(p=f.gridApi)||void 0===p||null===(p=p.getDisplayedRowAtIndex(d))||void 0===p||p.setSelected(l)}}}catch(h){o.e(h)}finally{o.f()}}}},onSelectionChanged:function(){f.handleSelectionChanged()},onRowSelected:function(e){f.checkboxOpensActionsMenuValue&&"checkboxSelected"===e.source&&f.openRowActionsMenu(e.node)},onCellDoubleClicked:function(e){f.handleCellDoubleClicked(e)},onStateUpdated:function(e){var t=new Set(["columnSizing","columnOrder","columnPinning","columnVisibility","columnGroup","sort","filter","rowGroup","pivot","aggregation","sideBar"]),n=new Set(["columnVisibility","columnPinning"]);e.sources.some(function(e){return t.has(e)})&&f.saveGridState(),e.sources.some(function(e){return n.has(e)})&&f.autoSizeNonFlexColumns(f.newlyDisplayedColIds()),e.sources.some(function(e){return"sort"===e||"pivot"===e})&&f.syncClearFiltersButton()},onColumnPivotModeChanged:function(e){f.syncCountColumnForPivotMode()},suppressAggFuncInHeader:this.suppressAggFuncInHeader},this.enableRowDragValue?{rowDragEntireRow:!1,rowDragManaged:!1}:{}),this.hasVoteBoxDetailUrlValue?{masterDetail:!this.isBasicMode,detailRowAutoHeight:!0,isRowMaster:function(e){return 1===(null===e||void 0===e?void 0:e.row_type)},detailCellRendererParams:{detailGridOptions:{theme:this.resolveTheme(),columnDefs:this.detailColumnDefs(),defaultColDef:{resizable:!0,suppressHeaderMenuButton:!0},cellSelection:!0===this.gridOptionsValue.cellSelection},getDetailRowData:function(e){var t,n=null===(t=e.data)||void 0===t?void 0:t.entity_id;if(null!=n&&f.voteBoxDetailUrlValue){var r=f.voteBoxDetailUrlValue.replace("{vote_box_id}",String(n));fetch(r,{credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(e){return e.ok?e.json():{rows:[]}}).then(function(t){var n;return e.successCallback(null!==(n=t.rows)&&void 0!==n?n:[])}).catch(function(){return e.successCallback([])})}else e.successCallback([])}}}:{}),this.gridOptionsValue),{},{columnDefs:this.applyRowDragColDef(this.withActionsValueFormatter((0,S.g)(this.hydrateColDefs(this.isBasicMode?this.basicColDefs(this.columnDefsValue):this.advancedColumnDefsValue)))),defaultColDef:this.isBasicMode?W(W({filterParams:P.m},h),{},{suppressHeaderMenuButton:!0},this.pivotHeaderQuirkColDefOverrides):W(W({filterParams:P.m},h),this.pivotHeaderQuirkColDefOverrides),suppressDragLeaveHidesColumns:this.isBasicMode,suppressMovableColumns:this.isBasicMode,cellSelection:this.buildCellSelection(),enableCellTextSelection:this.buildCellTextSelection(),autoGroupColumnDef:W({minWidth:220},this.pivotHeaderQuirkColDefOverrides),rowSelection:W(W({mode:"multiRow",checkboxes:!0,headerCheckbox:this.alwaysShowHeaderCheckboxValue},null!==(o=this.gridOptionsValue.rowSelection)&&void 0!==o?o:{}),{},{isRowSelectable:this.voteBoxAwareRowSelectableCallback}),components:W({statusCellRenderer:b.M,actionsCellRenderer:i.H,dropdownActionsCellRenderer:a.U,linkCellRenderer:y.w,postLinkCellRenderer:m.q,multilineTextCellRenderer:g.W,maskedTextCellRenderer:w.w,iconBadgeCellRenderer:c.U,toggleCheckboxCellRenderer:v,selectedRowCountStatusPanel:T,electionNameCellRenderer:u.Y,statusTestFilter:k.$},null!==(s=this.gridOptionsValue.components)&&void 0!==s?s:{}),filterHandlers:{statusTestFilter:k.N}});this.gridApi=(0,r.Dvw)(this.gridTarget,_),this.syncCountColumnForPivotMode(),this.setupToolPanelHeaders(),this.enableRowDragValue&&(this.setupGri
2dReadyForExternalDropZones(),this.gridTarget.classList.add("ssrm-row-drag"),this.gridTarget.classList.toggle("ssrm-row-drag--panel-open",this.voteBoxesHidden)),this.setupFollowSelection(),this.isBasicMode||(this.setActiveToggle("advanced"),this.sideBarConfig&&this.gridApi.setGridOption("sideBar",this.sideBarConfig),this.hasColumnsToggleTarget&&(this.columnsToggleTarget.style.display=""),this.hasFilterToggleTarget&&(this.filterToggleTarget.style.display="")),this.element.classList.remove(oe),this.gridBlurHandler=function(e){var t,n=e.target;if(!f.gridTarget.contains(n)){var r=f.hasExportToggleTarget?f.exportToggleTarget.closest(".ag-grid-component-export-wrapper"):null;if(null===r||void 0===r||!r.contains(n)){var o=f.hasSortToggleTarget?f.sortToggleTarget.closest(".ag-grid-component-sort-wrapper"):null;if(null===o||void 0===o||!o.contains(n)){var i=f.hasFilterMenuToggleTarget?f.filterMenuToggleTarget.closest(".ag-grid-component-filter-wrapper"):null;null!==i&&void 0!==i&&i.contains(n)||null===(t=f.gridApi)||void 0===t||t.clearCellSelection()}}}},document.addEventListener("mousedown",this.gridBlurHandler),this.hasSortDropdownTarget&&(this.sortOutsideClickHandler=function(e){f.sortDropdownTarget.hidden||f.sortToggleTarget.contains(e.target)||f.sortDropdownTarget.contains(e.target)||f.closeSortDropdown()},document.addEventListener("click",this.sortOutsideClickHandler)),this.hasFilterMenuDropdownTarget&&(this.filterMenuOutsideClickHandler=function(e){f.filterMenuDropdownTarget.hidden||f.filterMenuToggleTarget.contains(e.target)||f.filterMenuDropdownTarget.contains(e.target)||f.closeFilterMenuDropdown()},document.addEventListener("click",this.filterMenuOutsideClickHandler)),"autoHeight"===(null===(l=this.gridOptionsValue)||void 0===l?void 0:l.domLayout)||this.initDynamicHeight();var O=this.loadGridState();p&&O.then(function(){var e;return null===(e=f.gridApi)||void 0===e?void 0:e.setFilterModel(p)}),O.then(function(){return f.applyDefaultFilterModelIfUnset()}),O.then(function(){return f.applyDefaultSortIfUnset()}),O.then(function(){return f.syncClearFiltersButton()}),O.then(function(){var e;return null===(e=f.gridApi)||void 0===e?void 0:e.setGridOption("serverSideDatasource",f.buildDatasource())})}else this.element.classList.remove(oe)}},{key:"buildDatasource",value:function(){var e=this,t=!this.isBasicMode&&this.hasAdvancedGridDataUrlValue&&this.advancedGridDataUrlValue?this.advancedGridDataUrlValue:this.gridDataUrlValue;return new C.M(t,function(){return e.searchTextValue},function(t){return e.applyFooterRow(t)},function(){return e.voteBoxesHidden},function(){return e.externalFilters})}},{key:"applyDefaultSortIfUnset",value:function(){var e;if(this.gridApi&&!this.currentSortState()){var t=this.sortOptionsValue.find(function(e){return e.default_dir});t&&this.gridApi.applyColumnState({state:[{colId:t.col_id,sort:null!==(e=t.default_dir)&&void 0!==e?e:"asc",sortIndex:0}],defaultState:{sort:null,sortIndex:null}})}}},{key:"applyDefaultFilterModelIfUnset",value:function(){if(this.gridApi&&!this.hasPersistedState){var e=this.defaultFilterModelValue;e&&0!==Object.keys(e).length&&(Object.keys(this.gridApi.getFilterModel()).length>0||this.gridApi.setFilterModel(e))}}},{key:"applyDefaultFilterModel",value:function(){if(this.gridApi){var e=this.defaultFilterModelValue;e&&0!==Object.keys(e).length&&this.gridApi.setFilterModel(e)}}},{key:"initialGridFilterParam",get:function(){return new URLSearchParams(location.search).get("grid_filter")}},{key:"hasVisibleTurnoutFooterColumn",value:function(){var e=this;return re.some(function(t){var n,r;return null!==(n=null===(r=e.gridApi)||void 0===r||null===(r=r.getColumn(t))||void 0===r?void 0:r.isVisible())&&void 0!==n&&n})}},{key:"declaresTurnoutFooterColumn",value:function(){var e,t;return[].concat(M(null!==(e=this.columnDefsValue)&&void 0!==e?e:[]),M(null!==(t=this.advancedColumnDefsValue)&&void 0!==t?t:[])).some(function(e){var t,n;return re.includes(String(null!==(t=null!==(n=e.colId)&&void 0!==n?n:e.field)&&void 0!==t?t:""))})}},{key:"resolveFooterRows",value:function(e){return this.declaresTurnoutFooterColumn()?this.hasVisibleTurnoutFooterColumn()?e:[]:e}},{key:"applyFooterRow",value:function(e){var t;this.lastFooterRowData=e,null===(t=this.gridApi)||void 0===t||t.setGridOption("pinnedBottomRowData",this.resolveFooterRows(e))}}
2,{key:"setupGridReadyForExternalDropZones",value:function(){var e=this;this.dispatchGridReady(),this.requestGridApiHandler=function(){return e.dispatchGridReady()},document.addEventListener("votes:dashboard:request-grid-api",this.requestGridApiHandler)}},{key:"dispatchGridReady",value:function(){document.dispatchEvent(new CustomEvent("votes:dashboard:grid-ready",{detail:{gridApi:this.gridApi}}))}},{key:"disconnect",value:function(){this.sortOutsideClickHandler&&(document.removeEventListener("click",this.sortOutsideClickHandler),this.sortOutsideClickHandler=null),this.filterMenuOutsideClickHandler&&(document.removeEventListener("click",this.filterMenuOutsideClickHandler),this.filterMenuOutsideClickHandler=null),this.requestGridApiHandler&&(document.removeEventListener("votes:dashboard:request-grid-api",this.requestGridApiHandler),this.requestGridApiHandler=null),J(t,"disconnect",this,3)([])}},{key:"onSearchChanged",value:function(){this.gridApi&&this.hasSearchInputTarget&&(this.searchTextValue=this.searchInputTarget.value,this.updateHeaderCheckbox(),this.syncClearFiltersButton(),this.syncSearchToUrl(),this.refreshSearchDebounced())}},{key:"syncSearchToUrl",value:function(){if(this.searchParamValue){var e=new URL(window.location.href),t=this.searchTextValue.trim();t?e.searchParams.set(this.searchParamValue,t):e.searchParams.delete(this.searchParamValue),window.history.replaceState(window.history.state,"",e)}}},{key:"seedSearchFromUrl",value:function(){var e,t;if(this.searchParamValue){var n=null!==(e=null===(t=new URLSearchParams(location.search).get(this.searchParamValue))||void 0===t?void 0:t.trim())&&void 0!==e?e:"";this.searchTextValue=n,this.hasSearchInputTarget&&(this.searchInputTarget.value=n)}}},{key:"toggleSortDropdown",value:function(){var e;if(this.hasSortDropdownTarget){var t=!this.sortDropdownTarget.hidden;null===(e=this.gridApi)||void 0===e||e.closeToolPanel(),this.hasColumnsToggleTarget&&this.columnsToggleTarget.setAttribute("aria-pressed","false"),this.hasFilterToggleTarget&&this.filterToggleTarget.setAttribute("aria-pressed","false"),this.closeExportDropdown(),t?this.closeSortDropdown():(this.renderSortOptions(),this.sortDropdownTarget.hidden=!1,this.hasSortToggleTarget&&this.sortToggleTarget.setAttribute("aria-pressed","true"))}}},{key:"closeSortDropdown",value:function(){this.hasSortDropdownTarget&&(this.sortDropdownTarget.hidden=!0,this.hasSortToggleTarget&&this.sortToggleTarget.setAttribute("aria-pressed","false"))}},{key:"currentSortState",value:function(){var e,t,n=(null!==(e=null===(t=this.gridApi)||void 0===t?void 0:t.getColumnState())&&void 0!==e?e:[]).find(function(e){return null!=e.sort});return n?{colId:n.colId,sort:n.sort}:null}},{key:"renderSortOptions",value:function(){var e=this;if(this.hasSortDropdownTarget){var t=this.sortDropdownTarget;t.innerHTML="";var n=this.currentSortState();this.sortOptionsValue.forEach(function(r){var o=document.createElement("div");o.className="ag-grid-component-sort-row";var i=document.createElement("span");i.className="ag-grid-component-sort-row__label",i.textContent=r.label,o.appendChild(i);var a=document.createElement("span");a.className="ag-grid-component-sort-row__dirs",["asc","desc"].forEach(function(t){var o=document.createElement("button");o.type="button";var i=(null===n||void 0===n?void 0:n.colId)===r.col_id&&n.sort===t;o.className=i?"ag-grid-component-sort-dir ag-grid-component-sort-dir--active":"ag-grid-component-sort-dir",o.textContent="asc"===t?"\u2191":"\u2193",o.setAttribute("aria-pressed",String(i)),o.setAttribute("aria-label","Sort by ".concat(r.label," ").concat("asc"===t?"ascending":"descending")),o.addEventListener("click",function(){return e.selectSort(r.col_id,t)}),a.appendChild(o)}),o.appendChild(a),t.appendChild(o)});var r=document.createElement("button");r.type="button",r.className="ag-grid-component-sort-option",r.textContent="Clear sort",r.addEventListener("click",function(){return e.clearSort()}),t.appendChild(r)}}},{key:"selectSort",value:function(e,t){this.gridApi&&(this.gridApi.applyColumnState({state:[{colId:e,sort:t,sortIndex:0}],defaultState:{sort:null,sortIndex:null}}),this.renderSortOptions())}},{key:"clearSort",value:function(){var e;null===(e=this.gridApi)||void 0===e||e.applyColumnState({defaultState:{sort:null,sortIndex:null}}),this.renderSortOptions()}},{key:"toggleFilterMenu",value:function(){var e;if(this.hasFilterMenuDropdownTarget){var t=!this.filterMenuDropdownTarget.hidden;null===(e=this.gridApi)||void 0===e||e.closeToolPanel(),this.hasColumnsToggleTarget&&this.columnsToggleTarget.setAttribute("aria-pressed","fal
2se"),this.hasFilterToggleTarget&&this.filterToggleTarget.setAttribute("aria-pressed","false"),this.closeExportDropdown(),this.closeSortDropdown(),t?this.closeFilterMenuDropdown():(this.renderFilterMenu(),this.filterMenuDropdownTarget.hidden=!1,this.hasFilterMenuToggleTarget&&this.filterMenuToggleTarget.setAttribute("aria-pressed","true"))}}},{key:"closeFilterMenuDropdown",value:function(){this.hasFilterMenuDropdownTarget&&(this.filterMenuDropdownTarget.hidden=!0,this.hasFilterMenuToggleTarget&&this.filterMenuToggleTarget.setAttribute("aria-pressed","false"))}},{key:"activeFilterValues",value:function(e){var t,n,r,o;return null!==(r=null===(o=(null!==(t=null===(n=this.gridApi)||void 0===n?void 0:n.getFilterModel())&&void 0!==t?t:{})[e])||void 0===o?void 0:o.values)&&void 0!==r?r:[]}},{key:"renderFilterMenu",value:function(){var e=this;if(this.hasFilterMenuDropdownTarget){var t=this.filterMenuDropdownTarget;t.innerHTML="",this.filterOptionsValue.forEach(function(n){return t.appendChild(e.buildFilterSection(n))});var n=document.createElement("button");n.type="button",n.className="ag-grid-component-sort-option",n.textContent="Clear all filters",n.addEventListener("click",function(){return e.clearFilterMenuSelections()}),t.appendChild(n)}}},{key:"buildFilterSection",value:function(e){var t=this;if("date_range"===e.type)return this.buildDateRangeSection(e);var n=document.createElement("details");n.className="ag-grid-component-filter-section";var r=document.createElement("summary");r.className="ag-grid-component-filter-section__label";var o=document.createElement("span");o.textContent=e.label,r.appendChild(o);var i=document.createElement("span");i.className="ag-grid-component-filter-section__count",n.appendChild(r);var a=document.createElement("div");a.className="ag-grid-component-filter-section__body",n.appendChild(a);var u=function(){var n=t.activeFilterValues(e.col_id).length;i.textContent=n>0?String(n):"",n>0?r.appendChild(i):i.parentElement&&i.remove()};if(u(),e.async){var c=!1;n.addEventListener("toggle",function(){n.open&&!c&&(c=!0,a.textContent="Loading\u2026",t.fetchAsyncFilterValues(e.col_id).then(function(n){a.innerHTML="",t.appendFilterSearch(a),t.appendFilterCheckboxes(a,e.col_id,n,u)}))})}else{var s;this.appendFilterCheckboxes(a,e.col_id,null!==(s=e.values)&&void 0!==s?s:[],u)}return n}},{key:"buildDateRangeSection",value:function(e){var t,n,r=this,o=null!==(t=e.modes)&&void 0!==t?t:[{label:e.label,col_id:e.col_id}],i=o.map(function(e){return e.col_id}),a=document.createElement("details");a.className="ag-grid-component-filter-section";var u=document.createElement("summary");u.className="ag-grid-component-filter-section__label";var c=document.createElement("span");c.textContent=e.label,u.appendChild(c);var s=document.createElement("span");s.className="ag-grid-component-filter-section__count",a.appendChild(u);var l=document.createElement("div");l.className="ag-grid-component-filter-section__body ag-grid-component-filter-daterange",a.appendChild(l);var f=o.find(function(e){return r.activeDateFilter(e.col_id)}),d=f?this.activeDateFilter(f.col_id):null,p=document.createElement("select");p.className="ag-grid-component-filter-daterange__mode",p.setAttribute("aria-label","".concat(e.label," field")),o.forEach(function(e){var t=document.createElement("option");t.value=e.col_id,t.textContent=e.label,p.appendChild(t)}),p.value=null!==(n=null===f||void 0===f?void 0:f.col_id)&&void 0!==n?n:o[0].col_id;var h=this.buildDateInput(null===d||void 0===d?void 0:d.dateFrom),v=this.buildDateInput(null===d||void 0===d?void 0:d.dateTo),y=function(){var e=i.some(function(e){return r.activeDateFilter(e)});s.textContent=e?"1":"",e?u.appendChild(s):s.parentElement&&s.remove()};y();var m=function(){r.applyDateRangeFilter(p.value,i,h.value,v.value),[h,v].forEach(function(e){return r.markDateInputEmptiness(e)}),y()};return[p,h,v].forEach(function(e){return e.addEventListener("change",m)}),l.appendChild(p),l.appendChild(this.buildDateField("From",h)),l.appendChild(this.buildDateField("To",v)),a}},{key:"buildDateInput",value:function(e){var t,n=document.createElement("input");return n.type="date",n.className="ag-grid-component-filter-daterange__date",n.value=null!==(t=null===e||void 0===e?void 0:e.split(" ")[0])&&void 0!==t?t:"",this.markDateInputEmptiness(n),n}},{key:"markDateInputEmptiness",value:function(e){e.classList.toggle("ag-grid-component-filter-daterange__date--empty",""===e.value)}},{key:"buildDateField",value:function(e,t){var n=document.createElement("label");n.className="ag-grid-component-filter-daterange__field";var r=document.createElement("span");return r.className="ag-grid-component-filter-daterange__field-label",r.textContent=e,n.appendChild(r),n.appendChild(t),n}},{key:"activeDateFilter",value:function(e){var t,n,r;return null!==(r=(null!==(t=null===(n=this.gridApi)||void 0===n?void 0:n.getFilterModel())&&void 0!==t?t:{})[e])&&void 0!==r?r:null}},{key:"applyDateRangeFilter",value:function(e,t,n,r){var o;if(this.gridApi){var i=W({},null!==(o=this.gridApi.getFilterModel())&&void 0!==o?o:{});t.forEach(function(e){return delete i[e]}),n&&r&&(i[e]={filterType:"date",type:"inRange",dateFrom:"".concat(n," 00:00:00"),dateTo:"".concat(r," 00:00:00")}),this.gridApi.setFilterModel(i)}}},{key:"appendFilterSearch",value:function(e){var t=document.createElement("input");t.type="text",t.placeholder="Search",t.className="ag-grid-component-filter-search",t.addEventListener("input",function(){var n=t.value.trim().toLowerCase();e.querySelectorAll(".ag-grid-component-filter-option").forEach(function(e){var t,r,o=null!==(t=null===(r=e.dataset.value)||void 0===r?void 0:r.toLowerCase())&&void 0!==t?t:"";e.style.display=""===n||o.includes(n)?"":"none"})}),e.appendChild(t)}},{key:"appendFilterCheckboxes",value:function(e,t,n,r){var o=this,i=new Set(this.activeFilterValues(t));
2n.forEach(function(n){var a=document.createElement("label");a.className="ag-grid-component-filter-option",a.dataset.value=n;var u=document.createElement("input");u.type="checkbox",u.value=n,u.checked=i.has(n),u.addEventListener("change",function(){var n=Array.from(e.querySelectorAll("input[type=checkbox]")).filter(function(e){return e.checked}).map(function(e){return e.value});o.applyColumnFilter(t,n),r()});var c=document.createElement("span");if("test"===t&&"Test"===n){var s=document.createElement("span");s.className="votes--dashboard--election-component__election-test",s.textContent="Test",c.appendChild(s)}else c.textContent=n;a.appendChild(u),a.appendChild(c),e.appendChild(a)})}},{key:"applyColumnFilter",value:function(e,t){var n;if(this.gridApi){var r=W({},null!==(n=this.gridApi.getFilterModel())&&void 0!==n?n:{});t.length>0?r[e]={filterType:"set",values:t}:delete r[e],this.gridApi.setFilterModel(r)}}},{key:"clearFilterMenuSelections",value:function(){var e;null===(e=this.gridApi)||void 0===e||e.setFilterModel({}),this.renderFilterMenu()}},{key:"fetchAsyncFilterValues",value:function(e){var t=this,n=this.asyncFilterValuesCache.get(e);if(n)return Promise.resolve(n);if(!this.filterValuesUrlValue)return Promise.resolve([]);var r="".concat(this.filterValuesUrlValue,"?column=").concat(encodeURIComponent(e));return fetch(r,{headers:{Accept:"application/json"}}).then(function(e){return e.ok?e.json():{values:[]}}).then(function(n){var r,o=null!==(r=n.values)&&void 0!==r?r:[];return t.asyncFilterValuesCache.set(e,o),o}).catch(function(){return[]})}},{key:"setExternalFilters",value:function(e){this.externalFilters=this.hasActiveExternalFilters(e)?e:null,this.gridApi&&(this.gridApi.refreshServerSide({purge:!0}),this.updateHeaderCheckbox())}},{key:"hasActiveExternalFilters",value:function(e){return Object.values(e).some(function(e){return Array.isArray(e)&&e.length>0})}},{key:"switchToBasic",value:function(){this.gridApi&&(this.applyBasicMode(),this.applyViewColumnDefs(this.gridDataUrlValue,this.basicColDefs(this.columnDefsValue)),this.gridApi.setGridOption("pinnedBottomRowData",this.resolveFooterRows(this.lastFooterRowData)),this.saveGridState())}},{key:"applyBasicMode",value:function(){var e;if(this.gridApi){this.isBasicMode=!0,this.setActiveToggle("basic"),this.gridApi.closeToolPanel(),this.gridApi.setGridOption("sideBar",!1),this.hasColumnsToggleTarget&&(this.columnsToggleTarget.style.display="none",this.columnsToggleTarget.setAttribute("aria-pressed","false")),this.hasFilterToggleTarget&&(this.filterToggleTarget.style.display="none",this.filterToggleTarget.setAttribute("aria-pressed","false"));var t=null!==(e=this.gridOptionsValue.defaultColDef)&&void 0!==e?e:{};this.gridApi.setGridOption("defaultColDef",W(W({filterParams:P.m},t),{},{suppressHeaderMenuButton:!0})),this.gridApi.setGridOption("suppressDragLeaveHidesColumns",!0),this.gridApi.setGridOption("suppressMovableColumns",!0),this.gridApi.clearCellSelection(),this.gridApi.setGridOption("cellSelection",this.buildCellSelection()),this.gridApi.setGridOption("enableCellTextSelection",this.buildCellTextSelection()),this.hasVoteBoxDetailUrlValue&&(this.gridApi.setGridOption("masterDetail",!1),this.gridApi.redrawRows())}}},{key:"resizeGrid",value:function(){var e;this.hasRoomToFitColumns()&&(null===(e=this.gridApi)||void 0===e||e.sizeColumnsToFit())}},{key:"setVoteBoxesHidden",value:function(e){this.voteBoxesHidden!==e&&(this.voteBoxesHidden=e,this.gridApi&&(this.enableRowDragValue&&(this.gridApi.setGridOption("rowDragEntireRow",e),this.gridTarget.classList.toggle("ssrm-row-drag--panel-open",e)),this.resetRowActionsCache(),this.gridApi.refreshServerSide({purge:!0})))}},{key:"switchToAdvanced",value:function(){this.gridApi&&(this.applyAdvancedMode(),this.applyViewColumnDefs(this.advancedGridDataUrlValue,this.advancedColumnDefsValue),this.gridApi.setGridOption("pinnedBottomRowData",this.resolveFooterRows(this.lastFooterRowData)),this.saveGridState())}},{key:"applyAdvancedMode",value:function(){var e;if(this.gridApi){this.isBasicMode=!1,this.setActiveToggle("advanced");var t=null!==(e=this.gridOptionsValue.defaultColDef)&&void 0!==e?e:{};this.gridApi.setGridOption("defaultColDef",W({filterParams:P.m},t)),this.gridApi.setGridOption("suppressDragLeaveHidesColumns",!1),this.gridApi.setGridOption("suppressMovableColumns",!1),this.gridApi.clearCellSelection(),this.gridApi.setGridOption("cellSelection",this.buildCellSelection()),this.gridApi.setGridOption("enableCellTextSelection",this.buildCellTextSelection()),this.sideBarConfig&&this.gridApi.setGridOption("sideBar",this.sideBarConfig),this.hasColumnsToggleTarget&&(this.columnsToggleTarget.style.display=""),this.hasFilterToggleTarget&&(this.filterToggleTarget.style.display=""),this.hasVoteBoxDetailUrlValue&&(this.gridApi.setGridOption("masterDetail",!0),this.gridApi.redrawRows())}}},{key:"newlyDisplayedColIds",value:function(){var e,t,n=(null!==(e=null===(t=this.gridApi)||void 0===t?void 0:t.getAllDisplayedColumns())&&void 0!==e?e:[]).map(function(e){return e.getColId()}),r=new Set(this.lastDisplayedColIds);return this.lastDisplayedColIds=n,n.filter(function(e){return!r.has(e)})}},{key:"exportCsv",value:function(){if(this.closeExportDropdown(),this.gridApi){var e=this.gridApi.getCellRanges();if(e&&this.isActiveRange(e))this.exportSelectedCellsAsCsv(e);else{var t=this.resolveSelectionExportOptions();t?this.triggerAsyncExport("csv",t):(this.pendingExportFormat="csv",this.openExportConfirmModal())}}}},{key:"exportXlsx",value:function(){if(this.closeExportDropdown(),this.gridApi){var e=this.gridApi.getCellRanges();if(e&&this.isActiveRange(e))this.exportSelectedCellsAsXlsx(e);else{var t=this.supportsXlsxExport()?"xlsx":"csv",n=this.resolveSelectionExportOptions();n?this.triggerAsyncExport(t,n):(this.pendingExportFormat=t,this.openExportConfirmModal())}}}},{key:"supportsXlsxExport",value:function(){var e;return(null!==(e=this.exportFormatsValue)&&void 0!==e?e:[]).includes("xlsx")}},{key:"hasActiveCellRange",value:function(){if(!this.gridApi)return!1;var e=this.gridApi.getCellRanges();return!!e&&this.isActiveRange(e)}},{key:"openExportConfirmModal",value:function(){if(this.hasConfirmExportModalTarget){this.confirmExportModalTarget.removeAttribute("hidden"),document.body.style.overflow="hidden";var e=this.confirmExportModalTarget.querySelector("[data-action*='cancelExport']");e&&setTimeout(function(){return e.focus()},50)}}},{key:"closeExportConfirmModal",value:function(){this.hasConfirmExportModalTarget&&(this.confirmExportModalTarget.setAttribute("hidden",""),document.body.style.overflow="")}},{key:"backdropClickExportModal",value:function(e){e.target===this.confirmExportModalTarget&&this.closeExportConfirmModal()}},{key:"confirmExport",value:function(){this.closeExportConfirmModal();var e=this.pendingExportFormat;e&&this.gridApi&&(this.pendingExportFormat=null,this.triggerAsyncExport(e,{mode:"all",filter_model:this.gridApi.getFilterModel(),row_group_cols:this.getRowGroupColDefs(),search_text:this.searchTextValue||void 0,pivot_mode:this.gridApi.isPivotMode(),advanced:!this.isBasicMode}))}},{key:"cancelExport",value:function(){this.closeExportConfirmModal(),this.pendingExportFormat=null}},{key:"triggerAsyncExport",value:(d=D(L().m(function e(t){var n,r,o,i,a,u,c,s=arguments;return L().w(function(e){for(;;)switch(e.p=e.n){case 0:if(o=s.length>1&&void 0!==s[1]?s[1]:{},this.exportUrlValue){e.n=1;break}return e.a(2);case 1:if("inline_csv"!==this.exportModeValue){e.n=3;break}return e.n=2,this.downloadInlineCsv(o);case 2:return e.a(2);case 3:return i=null!==(n=null===(r=document.querySelector('meta[name="csrf-token"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",e.p=4,e.n=5,fetch(this.exportUrlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":i,Accept:"text/vnd.turbo-stream.html, text/html, application/xhtml+xml"},credentials:"same-origin",body:JSON.stringify(W({format:t},o))});case 5:if(!(a=e.v).ok){e.n=7;break}return e.n=6,a.text();case 6:(c=e.v).trim()&&(null===(u=window.Turbo)||void 0===u||u.render
2StreamMessage(c));case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:return e.a(2)}},e,this,[[4,8]])})),function(e){return d.apply(this,arguments)})},{key:"downloadInlineCsv",value:(f=D(L().m(function e(){var t,n,r,o,i,a,u,c,s=arguments;return L().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=s.length>0&&void 0!==s[0]?s[0]:{},o=null!==(t=null===(n=document.querySelector('meta[name="csrf-token"]'))||void 0===n?void 0:n.content)&&void 0!==t?t:"",e.p=1,e.n=2,fetch(this.exportUrlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":o,Accept:"text/csv"},credentials:"same-origin",body:JSON.stringify(W({format:"csv"},r))});case 2:if((i=e.v).ok){e.n=3;break}return e.a(2);case 3:return e.n=4,i.blob();case 4:a=e.v,u=URL.createObjectURL(a),(c=document.createElement("a")).href=u,c.download=this.inlineCsvFilename(i),c.click(),URL.revokeObjectURL(u),e.n=6;break;case 5:e.p=5,e.v;case 6:return e.a(2)}},e,this,[[1,5]])})),function(){return f.apply(this,arguments)})},{key:"inlineCsvFilename",value:function(e){var t,n,r=null!==(t=e.headers.get("Content-Disposition"))&&void 0!==t?t:"",o=/filename="?([^";]+)"?/.exec(r);return null!==(n=null===o||void 0===o?void 0:o[1])&&void 0!==n?n:"export.csv"}},{key:"applyViewColumnDefs",value:function(e,t){if(this.gridApi){var n=this.withActionsValueFormatter(t);this.hasAdvancedGridDataUrlValue&&this.advancedGridDataUrlValue?(this.applyDatasourceColumnDefs(n),this.resetGridState(n),this.applyDefaultFilterModel(),this.attachDatasource(e)):(this.gridApi.setGridOption("columnDefs",this.applyRowDragColDef(this.hydrateColDefs(n))),this.autoSizeNonFlexColumns(),this.pendingAutoSize=!0)}}},{key:"preserveFlexOnAutoSize",value:function(){var e,t;return this.fitColumnsByCountValue?(null!==(e=null===(t=this.gridApi)||void 0===t?void 0:t.getAllDisplayedColumns())&&void 0!==e?e:[]).filter(function(e){return!e.getColId().startsWith("ag-Grid-")}).length<=5:this.isBasicMode}},{key:"applyDatasourceColumnDefs",value:function(e){this.gridApi&&(this.resetRowActionsCache(),this.gridApi.setGridOption("columnDefs",this.applyRowDragColDef((0,S.g)(this.hydrateColDefs(e)))),this.autoSizeNonFlexColumns(),this.pendingAutoSize=!0)}},{key:"attachDatasource",value:function(e){var t=this;if(this.gridApi){var n=new C.M(e,function(){return t.searchTextValue},function(e){return t.applyFooterRow(e)},function(){return t.voteBoxesHidden},function(){return t.externalFilters});this.gridApi.setGridOption("serverSideDatasource",n)}}},{key:"enforceStructurallyHiddenColumns",value:function(){var e;if(this.gridApi){var t=(null!==(e=this.gridApi.getColumnDefs())&&void 0!==e?e:[]).flatMap(function(e){var t,n=e,r=null!==(t=n.colId)&&void 0!==t?t:n.field;return r&&n.hide&&n.suppressColumnsToolPanel?[{colId:r,hide:!0}]:[]});t.length>0&&this.gridApi.applyColumnState({state:t})}}},{key:"loadGridState",value:(l=D(L().m(function e(){var t,n,r,o=this;return L().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.fetchGridState();case 1:if(t=e.v,this.hasPersistedState=!!t,t&&this.gridApi){e.n=2;break}return e.a(2);case 2:n=t.mode,r=R(t,x),this.isRestoringState=!0,"advanced"===n&&this.advancedColumnDefsValue.length>0&&this.isBasicMode?(this.applyAdvancedMode(),this.applyColumnDefsForCurrentMode(this.advancedColumnDefsValue)):"basic"!==n||this.isBasicMode||this.modeForcedByDeepLink||(this.applyBasicMode(),this.applyColumnDefsForCurrentMode(this.basicColDefs(this.columnDefsValue))),this.gridApi.setState(this.pruneUnknownColIds(r)),this.enforceStructurallyHiddenColumns(),requestAnimationFrame(function(){o.isRestoringState=!1,o.enforceStructurallyHiddenColumns(),o.syncPanelButtonStates(),o.updateHeaderCheckbox(),o.syncClearFiltersButton()});case 3:return e.a(2)}},e,this)})),function(){return l.apply(this,arguments)})},{key:"applyColumnDefsForCurrentMode",value:function(e){this.gridApi&&this.gridApi.setGridOption("columnDefs",this.applyRowDragColDef(this.hydrateColDefs(e)))}},{key:"handleCellDoubleClicked",value:function(e){var t;if(this.enableDblclickNavValue&&!e.rowPinned){var n=e.data;n&&("organization_name"!==(null===(t=e.column)||void 0===t?void 0:t.getColId())?1!==n.row_type?n.link_url?window.location.assign(n.link_url):null!=n.id&&window.location.assign("/elections/".concat(n.id,"/edit")):null!=n.entity_id&&window.location.assign("/vote_boxes/".concat(n.entity_id,"/dashboard")):null!=n.organization_id&&window.location.assign("/organizations/".concat(n.organization_id,"/edit")))}}},{key:"handleSelectionChanged",value:function(){if(this.gridApi){var e=this.gridApi.getServerSideSelectionState(),t=this.getLoadedSelectedRows(),n=t.length,r=!0===(null===e||void 0===e?void 0:e.selectAll);this.hasRowSelection=n>0||r,this.hasActionsMenuTarget&&(n>0||r?(this.actionsMenuTarget.classList.add("visible"),this.actionsMenuTarget.style.display="",this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=r?"All selected":"".concat(n," selected")),this.renderActions(t),this.followSelectionValue&&this.updateFollowScrollVisibility()):(this.actionsMenuTarget.classList.remove("visible"),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=""),this.clearActions(),this.followSelectionValue&&this.resetMenuPosition()))}}},{key:"resolveTheme",value:function(){return this.compactHeaderValue?j.lj:this.plainHeaderValue?j.Qt:j.HQ}},{key:"isSelectAllActive",value:function(){var e,t=null===(e=this.gridApi)||void 0===e?void 0:e.getServerSideSelectionState();return!0===(null===t||void 0===t?void 0:t.selectAll)}},{key:"getSelectAllAnchorNode",value:function(){if(!this.gridApi)return null;for(var e=this.gridApi.getDisplayedRowCount(),t=0;t<e;t++){var n=this.gridApi.getDisplayedRowAtIndex(t);if(!n||void 0===n.data)break;if(!n.group)return n}return null}},{key:"getLoadedSelectedRows",value:function(){if(!this.gridApi)return[];for(var e=[],t=this.gridApi.getDisplayedRowCount(),n=0;n<t;n++){var r=this.gridApi.getDisplayedRowAtIndex(n);null!==r&&void 0!==r&&r.data&&!r.group&&r.isSelected()&&e.push(r.data)}return e}},{key:"refreshAfterRemoteAction",value:function(){var e;null===(e=this.gridApi)||void 0===e||e.refreshServerSide()}},{key:"isActiveRange",value:function(e){return!(!e||0===e.length)&&e.reduce(function(e,t){if(!t.startRow||!t.endRow)return e;var n=t.columns.filter(function(e){return"ag-Grid-SelectionColumn"!==e.getColId()}).length;return 0===n?e:e+(Math.abs(t.endRow.rowIndex-t.startRow.rowIndex)+1)*n},0)>1}},{key:"exportHeaderName",value:function(e){var t,n,r=e.getColDef(),o=null===(t=r.headerName)||void 0===t?void 0:t.trim();
2return o||String(null!==(n=r.field)&&void 0!==n?n:e.getColId()).replace(/_/g," ").replace(/^./,function(e){return e.toUpperCase()})}},{key:"resolveRangeSelection",value:function(e){var t,n,r=null!==(t=this.gridApi.getAllDisplayedColumns())&&void 0!==t?t:[],o=new Set(e.reduce(function(e,t){return e.concat(t.columns.map(function(e){return e.getColId()}))},[])),i=r.filter(function(e){return o.has(e.getColId())&&"ag-Grid-SelectionColumn"!==e.getColId()}),a=new Set,u=N(e);try{for(u.s();!(n=u.n()).done;){var c=n.value;if(c.startRow&&c.endRow)for(var s=Math.min(c.startRow.rowIndex,c.endRow.rowIndex),l=Math.max(c.startRow.rowIndex,c.endRow.rowIndex),f=s;f<=l;f++)a.add(f)}}catch(d){u.e(d)}finally{u.f()}return{cols:i,sortedIndices:Array.from(a).sort(function(e,t){return e-t})}}},{key:"exportSelectedCellsAsCsv",value:function(e){var t=this;if(this.gridApi){var n=this.resolveRangeSelection(e),r=n.cols,o=n.sortedIndices,i=[];i.push(r.map(function(e){return t.exportHeaderName(e)}));var a,u=N(o);try{var c=function(){var e=a.value,n=t.gridApi.getDisplayedRowAtIndex(e);if(!n)return 0;if(n.group){var o,u,c,s,l=null!==(o=null!==(u=null===(c=n.data)||void 0===c?void 0:c.childCount)&&void 0!==u?u:n.allChildrenCount)&&void 0!==o?o:0,f="".concat(null!==(s=n.key)&&void 0!==s?s:""," (").concat(l,")");return i.push(r.map(function(e,t){return 0===t?f:""})),0}if(!n.data)return 0;i.push(r.map(function(e){var t=e.getColDef(),r=n.data,o=(0,E.yh)(t,r);if(void 0!==o)return o;var i=t.field,a=i?r[i]:void 0;return Array.isArray(a)?a.join(" "):null!=a?String(a):""}))};for(u.s();!(a=u.n()).done;)c()}catch(p){u.e(p)}finally{u.f()}var s="\ufeff"+i.map(function(e){return e.map(function(e){return'"'.concat(e.replace(/"/g,'""'),'"')}).join(",")}).join("\n"),l=new Blob([s],{type:"text/csv;charset=utf-8;"}),f=URL.createObjectURL(l),d=document.createElement("a");d.href=f,d.download="export-selection.csv",d.click(),URL.revokeObjectURL(f)}}},{key:"resolveSelectionExportFileName",value:function(){var e=new Date,t=function(e){return String(e).padStart(2,"0")},n="".concat(e.getFullYear(),"-").concat(t(e.getMonth()+1),"-").concat(t(e.getDate()),"_").concat(t(e.getHours()),"_").concat(t(e.getMinutes()));return"export-selection-".concat(n,".xlsx")}},{key:"exportSelectedCellsAsXlsx",value:function(e){var t=this;if(this.gridApi){var n=this.resolveRangeSelection(e),r=n.cols,o=n.sortedIndices,i=new Set(o.map(function(e){var n;return null===(n=t.gridApi.getDisplayedRowAtIndex(e))||void 0===n?void 0:n.id}).filter(function(e){return void 0!==e}));this.gridApi.exportDataAsExcel({columnKeys:r,shouldRowBeSkipped:function(e){var t;return!i.has(null!==(t=e.node.id)&&void 0!==t?t:"")},fileName:this.resolveSelectionExportFileName(),processCellCallback:function(e){var t,n,r=null===(t=e.node)||void 0===t?void 0:t.data;return null!==(n=(0,E.yh)(e.column.getColDef(),r))&&void 0!==n?n:(0,E.Vl)(e)},processHeaderCallback:function(e){return t.exportHeaderName(e.column)},processRowGroupCallback:function(e){return(0,E.cQ)(e)}})}}},{key:"resetGridState",value:function(e){var t;if(this.gridApi){this.gridApi.setFilterModel({}),this.gridApi.setGridOption("pivotMode",!1);var n=(null!==(t=null!==e&&void 0!==e?e:this.gridApi.getColumnDefs())&&void 0!==t?t:[]).flatMap(function(e){var t,n,r=null!==(t=e.colId)&&void 0!==t?t:e.field;return r?[{colId:r,hide:null!==(n=e.hide)&&void 0!==n&&n}]:[]});this.gridApi.applyColumnState({state:n,defaultState:{sort:null,rowGroup:!1,rowGroupIndex:null,hide:!1}}),this.resetFilterPanelCards(),this.syncCountColumnForPivotMode()}}},{key:"syncCountColumnForPivotMode",value:function(){if(this.gridApi){var e=this.gridApi.isPivotMode();this.gridApi.applyColumnState({state:[{colId:"childCount",hide:!e,aggFunc:e?"count":null}]});var t=this.gridApi.getColumnDefs();if(t&&t.some(function(t){return"field"in t&&"childCount"===t.field&&t.suppressColumnsToolPanel!==!e})){var n=t.map(function(t){return"field"in t&&"childCount"===t.field?W(W({},t),{},{suppressColumnsToolPanel:!e}):t});this.gridApi.updateGridOptions({columnDefs:n})}}}},{key:"applyRowDragColDef",value:function(e){var t=this;if(!this.enableRowDragValue||0===e.length)return e;var n,r=G(n=e)||F(n)||q(n)||H(),o=r[0],i=U(r).slice(1);return[W(W({},o),{},{rowDrag:function(){return t.voteBoxesHidden}})].concat(M(i))}},{key:"detailColumnDefs",value:function(){var e;return this.applyToolPanelHeaderNames(null!==(e=this.columnDefsValue)&&void 0!==e?e:[]).map(function(e){var t,n=e.filter;return"statusTestFilter"!==(null===n||void 0===n?void 0:n.component)?e:W(W
2({},e),{},{filterParams:W(W({},null!==(t=e.filterParams)&&void 0!==t?t:{}),{},{showVoteBoxes:!1})})})}},{key:"hydrateColDefs",value:function(e){var t=this,n=e.map(function(e){var n=e.children;return Array.isArray(n)?W(W({},e),{},{children:t.hydrateColDefs(n)}):e});return this.applyToolPanelHeaderNames(this.applyFilterValueCallbacks(n))}},{key:"applyToolPanelHeaderNames",value:function(e){return e.map(function(e){var t,n=e,r=n.toolPanelHeaderName,o=R(n,A);if(!r)return e;var i=null!==(t=o.headerName)&&void 0!==t?t:"";return W(W({},o),{},{headerValueGetter:function(e){return"header"===e.location?i:r}})})}},{key:"applyFilterValueCallbacks",value:function(e){var t=this,n=e.map(function(e){var t=e.filterParams;return null!==t&&void 0!==t&&t.blankSentinel?W(W({},e),{},{filterParams:W(W({},t),{},{keyCreator:function(e){return null==e.value||""===e.value?"__blank__":e.value},valueFormatter:function(e){var t;return null==e.value||""===e.value?"(Blank)":null!==(t=e.value)&&void 0!==t?t:""}})}):e});return this.filterValuesUrlValue?n.map(function(e){if("agSetColumnFilter"===e.filter){var n,r,o,i;if(null!==(n=e.filterParams)&&void 0!==n&&n.values)return e;var a=String(null!==(r=null!==(o=e.field)&&void 0!==o?o:e.colId)&&void 0!==r?r:"");return W(W({},e),{},{filterParams:W(W(W({},P.m),null!==(i=e.filterParams)&&void 0!==i?i:{}),{},{values:function(e){fetch("".concat(t.filterValuesUrlValue,"?column=").concat(encodeURIComponent(a)),{credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(e){return e.json()}).then(function(n){var r,o;t.asyncFilterCountsCache.set(a,null!==(r=n.counts)&&void 0!==r?r:{}),e.success(null!==(o=n.values)&&void 0!==o?o:[])}).catch(function(){return e.success([])})},valueFormatter:function(e){var n,r,o=null!==(n=e.value)&&void 0!==n?n:"",i=null===(r=t.asyncFilterCountsCache.get(a))||void 0===r?void 0:r[o];return null!=i?"".concat(o," (").concat(i,")"):o}})})}var u,c=e.filter;return c&&"object"===typeof c&&"statusTestFilter"===c.component?W(W({},e),{},{filterParams:W(W({},null!==(u=e.filterParams)&&void 0!==u?u:{}),{},{statusCountsUrl:t.filterValuesUrlValue})}):e}):n}},{key:"resolveSelectionExportOptions",value:function(){var e=this;if(!this.gridApi)return null;var t=this.gridApi.getServerSideSelectionState();if(!0===(null===t||void 0===t?void 0:t.selectAll))return null;var n=this.gridApi.getSelectedNodes();if(0===n.length)return null;var r,o=n.filter(function(e){return e.group&&null!=e.key}).map(function(t){return e.buildGroupPath(t)}),i=o.filter(function(e){return!o.some(function(t){return t.length>e.length&&e.every(function(e,n){return t[n]===e})})}),a=new Map,u=N(n);try{for(u.s();!(r=u.n()).done;){var c,s=r.value;if(!s.group){var l=null===(c=s.data)||void 0===c?void 0:c.id;if(null!=l){var f=String(l);a.has(f)||a.set(f,new Set);var d=s.parent?this.buildGroupPath(s.parent):[];d.length>0&&a.get(f).add(JSON.stringify(d))}}}}catch(w){u.e(w)}finally{u.f()}var p=Array.from(a.keys());if(0===i.length&&0===p.length)return null;var h,v={},y=N(a);try{for(y.s();!(h=y.n()).done;){var m=V(h.value,2),b=m[0],g=m[1];0!==g.size&&(v[b]=Array.from(g).map(function(e){return JSON.parse(e)}))}}catch(w){y.e(w)}finally{y.f()}return{mode:i.length>0?"all":"rows",filter_model:this.gridApi.getFilterModel(),row_group_cols:this.getRowGroupColDefs(),selected_group_paths:i.length>0?i:void 0,row_ids:p.length>0?p:void 0,leaf_group_paths:Object.keys(v).length>0?v:void 0,search_text:this.searchTextValue||void 0,pivot_mode:this.gridApi.isPivotMode(),advanced:!this.isBasicMode}}},{key:"buildGroupPath",value:function(e){for(var t=[],n=e;null!==(r=n)&&void 0!==r&&r.group&&null!=n.key;){var r,o;t.unshift(String(n.key)),n=null!==(o=n.parent)&&void 0!==o?o:null}return t}},{key:"buildCellSelection",value:function(){return(!this.disableBasicCellSelectionValue||!this.isBasicMode)&&this.gridOptionsValue.cellSelection}},{key:"buildCellTextSelection",value:function(){return!1===this.buildCellSelection()}},{key:"updateHeaderCheckbox",value:function(){var e,t;if(this.gridApi&&this.enableHeaderCheckboxOnFilterValue){var n=this.gridApi.getFilterModel(),r=Object.keys(n).length>0,o=(null!==(e=this.gridApi.getRowGroupColumns())&&void 0!==e?e:[]).length>0,i=!!this.searchTextValue,a=r||o||i||this.alwaysShowHeaderCheckboxValue,u=null!==(t=this.gridOptionsValue.rowSelection)&&void 0!==t?t:{};this.gridApi.setGridOption("rowSelection",W(W({mode:"multiRow",checkboxes:!0},u),{},{headerCheckbox:a,isRowSelectable:this.voteBoxAwareRowSelectableCallback}))}}},{key:"hasActiveGridState",value:function(){return J(t,"hasActiveGridState",this,3)([])||!!this.searchTextValue||this.hasNonDefaultSort()}},{key:"hasNonDefaultSort",value:function(){var e,t=this.currentSortState();if(!t)return!1;var n=this.sortOptionsValue.find(function(e){return e.default_dir});return!n||t.colId!==n.col_id||t.sort!==(null!==(e=n.default_dir)&&void 0!==e?e:"asc")}},{key:"clearAllFilters",value:function(){this.gridApi&&(this.resetGridState(),this.hasSearchInputTarget&&(this.searchInputTarget.value=""),this.searchTextValue="",this.syncSearchToUrl(),this.gridApi.isPivotMode()&&this.gridApi.setGridOption("pivotMode",!1),this.applyDefaultSortIfUnset(),this.resetRowActionsCache(),this.gridApi.refreshServerSide({purge:!0}),this.updateHeaderCheckbox(),this.syncClearFiltersButton(),this.renderFilterMenu())}},{key:"getRowGroupColDefs",value:function(){var e;return this.gridApi?(null!==(e=this.gridApi.getRowGroupColumns())&&void 0!==e?e:[]).map(function(e){var t,n;return{id:e.getColId(),field:String(null!==(t=e.getColDef().field)&&void 0!==t?t:e.getColId()),displayName:String(null!==(n=e.getColDef().headerName)&&void 0!==n?n:e.getColId())}}):[]}},{key:"openRowActionsMenu",value:function(e){var t;if(this.gridApi&&!e.group){var n=null===(t=e.data)||void 0===t?void 0:t.row_actions;if(Array.isArray(n)&&0!==n.length){this.gridApi.ensureColumnVisible("row_actions");var r,o=N(this.gridApi.getCellRendererInstances({columns:["row_actions"],rowNodes:[e]}));try{for(o.s();!(r=o.n()).done;){var i=r.value;i instanceof a.U&&i.openMenu()}}catch(u){o.e(u)}finally{o.f()}}}}}],o&&Q(n.prototype,o),s&&Q(n,s),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,s,l,f,d}(o.AgGridBaseController);ie.targets=[].concat(M(o.AgGridBaseController.targets),["searchInput","confirmExportModal","sortToggle","sortDropdown","filterMenuToggle","filterMenuDropdown"]),ie.values=W(W({},o.AgGridBaseController.values),{},{gridDataUrl:String,cacheBlockSize:{type:Number,default:100},rowBuffer:{type:Number,default:50},pagination:Boolean,searchText:String,searchParam:String,exportUrl:String,advancedGridDataUrl:String,filterValuesUrl:String,exportMode:String,exportFormats:{type:Array,default:["csv"]},alwaysShowHeaderCheckbox:Boolean,selectableVoteBoxRows:Boolean,checkboxOpensActionsMenu:Boolean,enableHeaderCheckboxOnFilter:Boolean,disableBasicCellSelection:Boolean,disableContextMenuExport:Boolean,compactHeader:Boolean,plainHeader:Boolean,sortOptions:Array,filterOptions:Array,defaultFilterModel:Object,enableRowDrag:Boolean,voteBoxDetailUrl:String,fitColumnsByCount:Boolean,footerRowHeight:{type:Number,default:0},enableDblclickNav:Boolean})},7323:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}n.d(t,{M:function(){return u}});var u=function(){return e=function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return!1},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){return null};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}
2(this,e),this.gridDataUrl=void 0,this.getSearchText=void 0,this.setPinnedBottomRow=void 0,this.getExcludeVoteBoxes=void 0,this.getExternalFilters=void 0,this.gridDataUrl=t,this.getSearchText=n,this.setPinnedBottomRow=r,this.getExcludeVoteBoxes=o,this.getExternalFilters=i},t=[{key:"getRows",value:function(e){var t,n,i,a,u,c,s,l,f,d,p,h=this,v=e.request,y=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({startRow:null!==(t=v.startRow)&&void 0!==t?t:0,endRow:null!==(n=v.endRow)&&void 0!==n?n:100,sortModel:(null!==(i=v.sortModel)&&void 0!==i?i:[]).map(function(e){return{colId:e.colId,sort:e.sort}}),filterModel:null!==(a=v.filterModel)&&void 0!==a?a:{},rowGroupCols:(null!==(u=v.rowGroupCols)&&void 0!==u?u:[]).map(function(e){var t,n;return{id:e.id,field:null!==(t=e.field)&&void 0!==t?t:"",displayName:null!==(n=e.displayName)&&void 0!==n?n:""}}),groupKeys:null!==(c=v.groupKeys)&&void 0!==c?c:[],valueCols:(null!==(s=v.valueCols)&&void 0!==s?s:[]).map(function(e){var t,n;return{id:e.id,field:null!==(t=e.field)&&void 0!==t?t:"",aggFunc:null!==(n=e.aggFunc)&&void 0!==n?n:""}}),pivotCols:(null!==(l=v.pivotCols)&&void 0!==l?l:[]).map(function(e){var t,n;return{id:e.id,field:null!==(t=e.field)&&void 0!==t?t:"",displayName:null!==(n=e.displayName)&&void 0!==n?n:""}}),pivotMode:null!==(f=v.pivotMode)&&void 0!==f&&f,searchText:this.getSearchText()},this.getExcludeVoteBoxes()?{excludeVoteBoxes:!0}:{}),m=this.getExternalFilters();m&&Object.keys(m).length>0&&(y.externalFilters=m);var b=null!==(d=null===(p=document.querySelector('meta[name="csrf-token"]'))||void 0===p?void 0:p.content)&&void 0!==d?d:"";fetch(this.gridDataUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":b},credentials:"same-origin",body:JSON.stringify(y)}).then(function(e){if(!e.ok)throw new Error("SSRM block request failed: ".concat(e.status));return e.json()}).then(function(t){var n;e.success({rowData:t.rows,rowCount:t.lastRow}),h.setPinnedBottomRow(null!==(n=t.footerRow)&&void 0!==n?n:[])}).catch(function(t){console.error("[ServerSideDatasource] getRows error:",t),e.fail()})}}],t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}()},792:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return j}});var r=n(5396),o=n(6098),i=n(7344);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}o.ModuleRegistry.registerModules([i.JK]);var c=["#172837","#FF8002","#17BF3C","#F60020","#06AED5","#E07B00"],s=[void 0,[6,3],[2,2],[8,2,2,2]],l=["circle","square","diamond","triangle","cross"];function f(e){return c[e%c.length]}function d(e){return s[e%s.length]}function p(e){return l[e%l.length]}function h(e){return e.map(function(e){var t=a(e,2);return{x:t[0],y:t[1]}})}function v(e,t){var n,r=!(null===(n=e.y_axis)||void 0===n||!n.stacked);return e.series.map(function(e,n){var o=f(n),i={type:t,data:h(e.points),xKey:"x",yKey:"y",yName:e.n
2ame,stroke:o,lineDash:d(n),stacked:r,marker:{enabled:!0,shape:p(n),fill:o,stroke:o}};return"area"===t&&(i.fill=o,i.fillOpacity=.25),i})}function y(e){switch(e.type){case"bar":return function(e){var t,n=!(null===(t=e.y_axis)||void 0===t||!t.stacked);return e.series.map(function(e,t){return{type:"bar",data:h(e.points),xKey:"x",yKey:"y",yName:e.name,fill:f(t),stacked:n}})}(e);case"area":return v(e,"area");case"sparkline":return function(e){var t=e.series[0];return t?[{type:"line",data:h(t.points),xKey:"x",yKey:"y",yName:t.name,stroke:f(0),marker:{enabled:!1}}]:[]}(e);default:return v(e,"line")}}function m(e,t,n,r){return r?{type:t,position:e,label:{enabled:!1},line:{enabled:!1},gridLine:{enabled:!1}}:{type:t,position:e,title:n.title?{enabled:!0,text:n.title}:void 0,min:n.min,max:n.max,label:n.format?{format:n.format}:void 0}}function b(e,t){var n=i.ui.create(function(e,t){var n="sparkline"===t.type,r="bar"===t.type?"category":"number";return{container:e,title:n?void 0:{enabled:!0,text:t.title},legend:{enabled:!n&&t.series.length>1},series:y(t),axes:[m("bottom",r,t.x_axis||{},n),m("left","number",t.y_axis||{},n)]}}(e,t));return{destroy:function(){return n.destroy()}}}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function w(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _(e,t,n){return t=T(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,O()?Reflect.construct(t,n||[],T(e).constructor):t.apply(e,n))}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}var j=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=_(this,t,[].concat(r))).handle=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.hasCanvasTarget&&(this.handle=b(this.canvasTarget,this.configValue))}},{key:"disconnect",value:function(){var e;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null}}])&&g(n.prototype,r),o&&g(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);j.targets=["canvas"],j.values={config:Object}},112:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).boundKeyHandler=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.boundKeyHandler=this.handleKeydown.bind(this)}},{key:"disconnect",value:function(){this.removeKeyboardListener(),this.boundKeyHandler=null}},{key:"open",value:function(e){if(e.preventDefault(),e.stopPropagation(),this.hasOverlayTarget){this.overlayTarget.removeAttribute("hidden"),this.overlayTarget.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden",this.addKeyboardListener();var t=this.overlayTarget.querySelector('[data-action*="close"]');t&&setTimeout(function(){return t.focus()},100)}}},{key:"close",value:function(e){e&&e.preventDefault(),this.hasOverlayTarget&&(this.overlayTarget.setAttribute("hidden",""),this.overlayTarget.setAttribute("aria-hidden","true"),document.body.style.overflow="",this.removeKeyboardListener())}},{key:"backdropClick",value:function(e){e.target===this.overlayTarget&&this.close(e)}},{key:"confirm",value:function(e){this.close()}},{key:"handleKeydown",value:function(e){"Escape"===e.key&&this.close()}},{key:"addKeyboardListener",value:function(){this.boundKeyHandler&&document.addEventListener("keydown",this.boundKeyHandler)}},{key:"removeKeyboardListener",value:function(){this.boundKeyHandler&&document.removeEventListener("keydown",this.boundKeyHandler)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["overlay"],s.values={modalId:String}},5682:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(6923);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=s(this,t,[].concat(r))).clearingClickInProgress=!1,e.naturalLanguagePreviewTimeout=void 0,e.timeContainer=void 0,e.hourSelect=void 0,e.minuteSelect=void 0,e.ampmSelect=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.initializeWithRetry()}},{key:"initializeWithRetry",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=(0,o.T)();if(!r||"function"!==typeof r.fn.pickadate)return t<5?void window.setTimeout(function(){return e.initializeWithRetry(t+1)},200):(console.warn("[date-picker] dependencies not available after retries, using legacy fallback"),void this.initializeLegacyFallback());try{this.hasCalendarTarget&&this.initializeCalendar(),this.hasFullTarget?(this.syncInitialValue(),this.injectTimeUIOnOpen(),this.setupEventListeners(),this.toggleClearVisibility()):this.initializeLegacyFallback()}catch(n){console.error("[date-picker] initialization error",n),this.initializeLegacyFallback()}}},{key:"disconnect",value:function(){this.naturalLanguagePreviewTimeout&&window.clearTimeout(this.naturalLanguagePreviewTimeout)}},{key:"setupEventListeners",value:function(){var e=this;this.fullTarget.addEventListener("keydown",function(t){"Enter"!==t.key?"ArrowDown"===t.key&&(t.preventDefault(),e.open()):t.preventDefault()}),this.fullTarget.addEventListener("input",function(){e.toggleClearVisibility()}),this.fullTarget.addEventListener("keyup",function(){e.naturalLanguagePreviewTimeout&&window.clearTimeout(e.naturalLanguagePreviewTimeout),e.naturalLanguagePreviewTimeout=window.setTimeout(function(){e.handleNaturalLanguagePreview()},e.constructor.NATURAL_LANGUAGE_DEBOUNCE_MS)}),this.fullTarget.addEventListener("blur",function(){e.clearingClickInProgress||(e.naturalLanguagePreviewTimeout&&window.clearTimeout(e.naturalLanguagePreviewTimeout),e.applyNaturalLanguageParsing(),e.hideTooltip(),e.toggleClearVisibility())}),this.fullTarget.addEventListener("focus",function(){e.showTooltip(),e.toggleClearVisibility()}),this.hasClearTarget&&(this.clearTarget.addEventListener("mousedown",function(){e.clearingClickInProgress=!0}),this.clearTarget.addEventListener("click",function(t){return e.clear(t)}))}},{key:"ensureTooltipExists",value:function(){var e=this.element.querySelector(".date-picker-hint");e||((e=document.createElement("span")).className="date-picker-hint toolkit-date-picker__hint",e.textContent=e.dataset.text||"",(this.element.querySelector(".toolkit-date-picker__field-group")||this.element).appendChild(e))}},{key:"showTooltip",value:function(){var e=this.element.querySelector(".date-picker-hint");e&&(e.style.display="block",this.fullTarget.value.trim()?this.handleNaturalLanguagePreview():this.restoreTooltipText())}},{key:"hideTooltip",value:function(){var e=this.element.querySelector(".date-picker-hint");e&&(e.style.display="none")}},{key:"restoreTooltipText",value:function(){var e=this.element.querySelector(".date-picker-hint");null!==e&&void 0!==e&&e.dataset.text&&(e.textContent=e.dataset.text)}},{key:"clear",value:function(e){if(null===e||void 0===e||e.preventDefault(),null===e||void 0===e||e.stopPropagation(),this.hasDisplayTarget){this.displayTarget.value="",this.hasHiddenTarget&&(this.hiddenTarget.value="");var t=this.picker();try{null===t||void 0===t||t.clear()}catch(n){}this.restoreTooltipText(),this.hideTooltip(),this.displayTarget.dispatchEvent(new Event("change",{bubbles:!0})),this.clearingClickInProgress=!1,this.toggleClearVisibility()}}},{key:"toggleClearVisibility",value:function(){var e;if(this.hasClearTarget){var t=!(null===(e=this.displayTarget)||void 0===e||null===(e=e.value)||void 0===e||!e.trim()),n=document.activeElement===this.displayTarget;!t&&n&&this.restoreTooltipText(),this.clearTarget.style.display=t&&n?"inline-flex":"none"}}},{key:"open",value:function(e){var t;null===e||void 0===e||e.preventDefault(),null===e||void 0===e||e.stopPropagation();var n=this.picker();
2n||(this.initializeCalendar(),n=this.picker()),null===(t=n)||void 0===t||t.open()}},{key:"initializeCalendar",value:function(){var e,t,n=this,r=(0,o.T)();if(this.calendarTarget&&r&&!r(this.calendarTarget).data("hasPickadate")){var i=null===(e=this.fullTarget)||void 0===e?void 0:e.dataset.min,a=null===(t=this.fullTarget)||void 0===t?void 0:t.dataset.max,u={clear:"",closeOnSelect:!1,onClose:function(){return n.handleOnCalendarClose()},onSet:function(e){return n.handleOnDateSet(e)}};i&&(u.min=new Date(i)),a&&(u.max=new Date(a)),r(this.calendarTarget).pickadate(u),r(this.calendarTarget).data("hasPickadate",!0)}}},{key:"initializeLegacyFallback",value:function(){var e=(0,o.T)();e&&e(this.element).find(".datepicker_input").each(function(){if(!e(this).data("hasPickadate"))try{e(this).pickadate({clear:""}),e(this).data("hasPickadate",!0)}catch(n){console.warn("[date-picker] legacy initialization failed",n)}})}},{key:"injectTimeUIOnOpen",value:function(){var e=this,t=this.picker();t?(t.on("open",function(){e.tryInjectTimeUI(t,"open-event")}),t.on("render",function(){window.requestAnimationFrame(function(){e.tryInjectTimeUI(t,"render-event")})})):console.warn("[date-picker] picker missing, cannot bind events")}},{key:"tryInjectTimeUI",value:function(e,t){var n=(0,o.T)();if(n){var r=e.$root||n(this.calendarTarget).closest(".picker");if(r.length){var i=r.find(".picker__box");if(i.length&&(!this.timeContainer||!i[0].contains(this.timeContainer))){this.timeContainer||this.buildTimeUI();var a=r.find(".picker__footer");a.length?(this.timeContainer.classList.add("toolkit-date-picker__time--in-popup"),a.before(this.timeContainer)):i.append(this.timeContainer),this.syncTimeSelectsFromFull(),this.bindTimeEvents()}}}}},{key:"resetTimeRefs",value:function(){this.timeContainer=void 0,this.hourSelect=void 0,this.minuteSelect=void 0,this.ampmSelect=void 0}},{key:"bindTimeEvents",value:function(){var e=this;[this.hourSelect,this.minuteSelect,this.ampmSelect].forEach(function(t){null===t||void 0===t||t.addEventListener("change",function(){return e.updateFullFromSelects()})})}},{key:"is24HourFormat",value:function(){return"HH:mm"===this.element.getAttribute("data-time-format")}},{key:"syncInitialValue",value:function(){var e,t,n=null;if(null!==(e=this.displayTarget)&&void 0!==e&&e.value&&(n=this.parseDateTimeString(this.displayTarget.value)),!n&&this.hasHiddenTarget&&this.hiddenTarget.value){var r=this.hiddenTarget.value.match(/^(\d{4})-(\d{2})-(\d{2})$/),o=this.hiddenTarget.value.match(/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/);if(r){var a=i(r,4),u=a[1],c=a[2],s=a[3];n=new Date(parseInt(u),parseInt(c)-1,parseInt(s))}else if(o){var l=i(o,7),f=l[1],d=l[2],p=l[3],h=l[4],v=l[5],y=l[6];n=new Date(parseInt(f),parseInt(d)-1,parseInt(p),parseInt(h),parseInt(v),parseInt(y))}else n=new Date(this.hiddenTarget.value);isNaN(n.getTime())&&(n=null)}n&&!isNaN(n.getTime())&&(null===(t=this.picker())||void 0===t||t.set("select",n,{muted:!0}),this.displayTarget.value||(this.displayTarget.value=this.formatFullDateTime(n)),this.hasHiddenTarget&&(this.hiddenTarget.value=this.formatDateTimeForRails(n))),this.syncTimeSelectsFromFull()}},{key:"syncTimeSelectsFromFull",value:function(){var e;if(this.timeContainer){var t=null===(e=this.displayTarget)||void 0===e?void 0:e.value;if(t){var n=this.parseDateTimeString(t);if(n&&!isNaN(n.getTime())){var r=n.getHours(),o=n.getMinutes();if(this.is24HourFormat()){var i=String(r).padStart(2,"0"),a=String(o).padStart(2,"0");this.hourSelect&&(this.hourSelect.value=i),this.minuteSelect&&(this.minuteSelect.value=a)}else{var u=this.toHour12(r),c=r>=12?"PM":"AM",s=String(o).padStart(2,"0");this.hourSelect&&(this.hourSelect.value=u),this.minuteSelect&&(this.minuteSelect.value=s),this.ampmSelect&&(this.ampmSelect.value=c)}}}}}},{key:"syncTimeSelectsFromParsedDate",value:function(e){if(this.timeContainer){var t=e.getHours(),n=e.getMinutes();if(this.is24HourFormat()){var r=String(t).padStart(2,"0"),o=String(n).padStart(2,"0");this.hourSelect&&(this.hourSelect.value=r),this.minuteSelect&&(this.minuteSelect.value=o)}else{var i=this.toHour12(t),a=t>=12?"PM":"AM",u=String(n).padStart(2,"0");this.hourSelect&&(this.hourSelect.value=i),this.minuteSelect&&(this.minuteSelect.value=u),this.ampmSelect&&(this.ampmSelect.value=a)}}}},{key:"handleOnCalendarClose",value:function(){var e=this.picker(),t=null===e||void 0===e?void 0:e.get("select"),n=t?new Date(t.obj||t.pick):null;if(n&&!isNaN(n.getTime())){var r=this.parseDateTimeString(this.displayTarget.value);r&&!isNaN(r.getTime())?n.setHours(r.getHours(),r.getMinutes(),0,0):(this.hourSelect&&!this.hourSelect.value&&(this.hourSelect.value=this.defaultHour()),this.minuteSelect&&!this.minuteSelect.value&&(this.minuteSelect.value=this.defaultMinute()),this.is24HourFormat()||!this.ampmSelect||this.ampmSelect.value||(this.ampmSelect.value=this.defaultAmpm())),this.updateFull(n)}}},{key:"handleOnDateSet",value:function(e){var t=null;if(null!==e&&void 0!==e&&e.select)t=new Date(e.select);else{var n=this.picker(),r=null===n||void 0===n?void 0:n.get("select");r&&(t=new Date(r.obj||r.pick))}if(t&&!isNaN(t.getTime())){var o=this.parseDateTimeString(this.displayTarget.value);o&&!isNaN(o.getTime())?t.setHours(o.getHours(),o.getMinutes(),0,0):(this.hourSelect&&!this.hourSelect.value&&(this.hourSelect.value=this.defaultHour()),this.minuteSelect&&!this.minuteSelect.value&&(this.minuteSelect.value=this.defaultMinute()),this.is24HourFormat()||!this.ampmSelect||this.ampmSelect.value||(this.ampmSelect.value=this.defaultAmpm())),this.updateFull(t,{silent:!0})}}},{key:"updateFullFromSelects",value:function(){var e,t,n,r,o=this,i=this.picker(),a=null===i||void 0===i?void 0:i.get("select");r=a?new Date(a.obj||a.pick):this.parseDateTimeString(this.displayTarget.value)||new Date;var u=(null===(e=this.hourSelect)||void 0===e?void 0:e.value)||this.defaultHour(),c=(null===(t=this.minuteSelect)||void 0===t?void 0:t.value)||this.defaultMinute(),s=this.is24HourFormat()?parseInt(u,10):this.convertTo24Hour(parseInt(u,10),(null===(n=this.ampmSelect)||void 0===n?void 0:n.value)||this.defaultAmpm());r.setHours(s,parseInt(c,10),0,0);var l,f=this.formatDate(r);if(this.is24HourFormat())l="".concat(f," ").concat(u,":").concat(c);else{var d,p=(null===(d=this.ampmSelect)||void 0===d?void 0:d.value)||this.defaultAmpm();l="".concat(f," ").concat(u,":").concat(c," ").concat(p)}this.displayTarget.value=l,this.hasHiddenTarget&&(this.hiddenTarget.value=this.formatDateTimeForRails(r)),this.displayTarget.dispatchEvent(new Event("change",{bubbles:!0})),requestAnimationFrame(function(){return o.toggleClearVisibility()})}},{key:"updateFull",value:function(e){var t,n,r,o,i,a,u=this,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.formatDate(e);if(null!==(t=this.hourSelect)&&void 0!==t&&t.value&&null!==(n=this.minuteSelect)&&void 0!==n&&n.value){var l;r=this.hourSelect.value,o=this.minuteSelect.value,this.is24HourFormat()||(i=(null===(l=this.ampmSelect)||void 0===l?void 0:l.value)||this.defaultAmpm())}else{var f=e.getHours(),d=e.getMinutes();this.is24HourFormat()?(r=String(f).padStart(2,"0"),o=String(d).padStart(2,"0")):(r=this.toHour12(f),o=String(d).padStart(2,"0"),i=f>=12?"PM":"AM")}if(a=this.is24HourFormat()?"".concat(s," ").concat(r,":").concat(o):"".concat(s," ").concat(r,":").concat(o," ").concat(i),this.displayTarget.value=a,this.hasHiddenTarget){var p=new Date(e),h=this.is24HourFormat()?parseInt(r,10):this.convertTo24Hour(parseInt(r,10),i||this.defaultAmpm());p.setHours(h,parseInt(o,10),0,0),this.hiddenTarget.value=this.formatDateTimeForRails(p)}c.silent||this.displayTarget.dispatchEvent(new Event("change",{bubbles:!0})),requestAnimationFrame(function(){return u.toggleClearVisibility()})}},{key:"extractDatePart",value:function(e){var t=e.match(/^(\w+ \d{1,2}, \d{4})/);return t?t[1]:null}},{key:"defaultHour",value:function(){return this.is24HourFormat()?this.constructor.DEFAULT_HOUR_24:this.constructor.DEFAULT_HOUR_12}},{key:"defaultMinute",value:function(){return this.constructor.DEFAULT_MINUTE}},{key:"defaultAmpm",value:function(){return this.constructor.DEFAULT_AMPM}
2},{key:"buildTimeUI",value:function(){var e=this;this.timeContainer=document.createElement("div"),this.timeContainer.className="toolkit-date-picker__time";var t=this.is24HourFormat();if(this.hourSelect=document.createElement("select"),this.hourSelect.className="toolkit-date-picker__time-select",this.hourSelect.setAttribute("aria-label","Hour"),t)for(var n=0;n<=23;n++){var r=document.createElement("option"),o=String(n).padStart(2,"0");r.value=o,r.textContent=o,this.hourSelect.appendChild(r)}else for(var i=1;i<=12;i++){var a=document.createElement("option");a.value=String(i),a.textContent=String(i),this.hourSelect.appendChild(a)}this.minuteSelect=document.createElement("select"),this.minuteSelect.className="toolkit-date-picker__time-select",this.minuteSelect.setAttribute("aria-label","Minutes"),this.constructor.MINUTE_STEPS.forEach(function(t){var n=String(t).padStart(2,"0"),r=document.createElement("option");r.value=n,r.textContent=n,e.minuteSelect.appendChild(r)});var u=new Date,c=this.roundToQuarter(u),s=String(c.getMinutes()).padStart(2,"0");if(t){var l=String(c.getHours()).padStart(2,"0");this.hourSelect.value=l}else{var f=this.toHour12(c.getHours()),d=c.getHours()>=12?"PM":"AM";this.hourSelect.value=f,this.ampmSelect=document.createElement("select"),this.ampmSelect.className="toolkit-date-picker__time-select",this.ampmSelect.setAttribute("aria-label","AM or PM"),["AM","PM"].forEach(function(t){var n=document.createElement("option");n.value=t,n.textContent=t,e.ampmSelect.appendChild(n)}),this.ampmSelect.value=d}this.minuteSelect.value=s,this.timeContainer.appendChild(this.hourSelect),this.timeContainer.appendChild(document.createTextNode(":")),this.timeContainer.appendChild(this.minuteSelect),!t&&this.ampmSelect&&this.timeContainer.appendChild(this.ampmSelect)}},{key:"roundToQuarter",value:function(e){var t=e.getMinutes(),n=15*Math.round(t/15);return 60===n?(e.setHours(e.getHours()+1),e.setMinutes(0)):e.setMinutes(n),e.setSeconds(0),e.setMilliseconds(0),e}},{key:"toHour12",value:function(e){var t=e%12;return 0===t&&(t=12),String(t)}},{key:"convertTo24Hour",value:function(e,t){return"PM"===t&&12!==e?e+12:"AM"===t&&12===e?0:e}},{key:"formatDateTimeForRails",value:function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),o=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r," ").concat(o,":").concat(i,":").concat(a)}},{key:"picker",value:function(){var e=(0,o.T)();if(!e)return null;try{return e(this.calendarTarget).pickadate("picker")}catch(t){return null}}},{key:"formatDate",value:function(e){var t=this.element.getAttribute("data-date-format");if(!t){var n=this.constructor.MONTH_NAMES;return"".concat(n[e.getMonth()]," ").concat(e.getDate(),", ").concat(e.getFullYear())}var r=e.getDate(),o=e.getMonth()+1,i=e.getFullYear(),a=this.constructor.MONTH_NAMES,u=this.constructor.MONTH_NAMES_ABBR,c=a[e.getMonth()],s=u[e.getMonth()],l=String(r).padStart(2,"0"),f=String(o).padStart(2,"0"),d=String(i);return t.replace(/MMMM|MMM|YYYY|DD|MM|D/g,function(e){switch(e){case"MMMM":return c;case"MMM":return s;case"YYYY":return d;case"DD":return l;case"MM":return f;case"D":return String(r);default:return e}})}},{key:"handleNaturalLanguagePreview",value:function(){if(this.hasFullTarget){var e=this.fullTarget,t=this.element.querySelector(".date-picker-hint");if(t){var n=t.dataset.text||"",r=e.value.trim();if(r){var o=this.parseDateTimeString(r);o||(o=this.parseNaturalLanguage(r));var i=o?this.formatFullDateTime(o):null;i?(t.textContent=i,t.classList.add("toolkit-date-picker__hint--preview")):t.textContent="..."}else t.textContent=n}}}},{key:"applyNaturalLanguageParsing",value:function(){if(this.hasFullTarget){var e=this.fullTarget,t=(this.element.querySelector(".date-picker-hint"),e.value.trim());if(t)if(this.isAlreadyFormatted(t)){var n=this.parseDateTimeString(t);if(n&&!isNaN(n.getTime())){this.hasHiddenTarget&&(this.hiddenTarget.value=this.formatDateTimeForRails(n)),this.syncTimeSelectsFromParsedDate(n);var r=this.picker();r&&r.set("select",n,{muted:!0}
2)}this.restoreTooltipText()}else{var o=this.parseNaturalLanguage(t);if(o){var i=this.formatFullDateTime(o);e.value=i,this.hasHiddenTarget&&(this.hiddenTarget.value=this.formatDateTimeForRails(o)),this.syncTimeSelectsFromParsedDate(o);var a=this.picker();a&&a.set("select",o,{muted:!0}),e.dispatchEvent(new Event("change",{bubbles:!0}))}this.restoreTooltipText()}else this.restoreTooltipText()}}},{key:"isAlreadyFormatted",value:function(e){if(!e)return!1;var t,n=this.element.getAttribute("data-date-format"),r=this.is24HourFormat();t=n&&"MMMM D, YYYY"!==n?n.includes("/")?"\\d{1,4}\\/\\d{1,2}\\/\\d{1,4}":n.includes("-")?"\\d{1,4}-\\d{1,2}-\\d{1,4}":n.includes(".")?"\\d{1,4}\\.\\d{1,2}\\.\\d{1,4}":"[\\w\\d\\/\\.\\-, ]+":"\\w+ \\d{1,2}, \\d{4}";var o=r?"\\d{1,2}:\\d{2}":"\\d{1,2}:\\d{2} (AM|PM)";return new RegExp("^".concat(t," ").concat(o,"$")).test(e)}},{key:"parseNaturalLanguage",value:function(e){if("undefined"===typeof chrono)return null;try{var t=chrono.parseDate(e);return t?this.roundToQuarter(t):null}catch(n){return console.warn("[date-picker] natural language parsing error",n),null}}},{key:"formatFullDateTime",value:function(e){var t=this.formatDate(e),n=e.getHours(),r=e.getMinutes();if(this.is24HourFormat()){var o=String(n).padStart(2,"0"),i=String(r).padStart(2,"0");return"".concat(t," ").concat(o,":").concat(i)}var a=this.toHour12(n),u=n>=12?"PM":"AM",c=String(r).padStart(2,"0");return"".concat(t," ").concat(a,":").concat(c," ").concat(u)}},{key:"parseDateTimeString",value:function(e){if(!e)return null;var t=this.element.getAttribute("data-date-format"),n=this.element.getAttribute("data-time-format");if(!t||!n){var r=new Date(e);return isNaN(r.getTime())?null:r}var o,i=t.split(/[-\/\s,.]+/).filter(function(e){return e.length>0}),a=1,u={},c=i.map(function(e){return"DD"===e||"D"===e?(u[a]="day",a++,"(\\d{1,2})"):"MM"===e||"M"===e?(u[a]="month_num",a++,"(\\d{1,2})"):"MMMM"===e?(u[a]="month_name",a++,"(\\w+)"):"MMM"===e?(u[a]="month_abbr",a++,"(\\w+)"):"YYYY"===e||"YY"===e?(u[a]="year",a++,"(\\d{2,4})"):e}).join("[\\s,\\/.-]+");"HH:mm"===n?(o="(\\d{1,2}):(\\d{2})",u[a]="hour",u[a+1]="minute",a+=2):(o="(\\d{1,2}):(\\d{2})\\s+(AM|PM)",u[a]="hour",u[a+1]="minute",u[a+2]="ampm",a+=3);var s,l,f,d,p,h,v=new RegExp("^".concat(c,"\\s+").concat(o,"$")),y=e.match(v);if(!y)return null;for(var m=this.constructor.MONTH_NAMES,b=this.constructor.MONTH_NAMES_ABBR,g=1;g<y.length;g++){var w=u[g],_=y[g];switch(w){case"day":s=parseInt(_,10);break;case"month_num":l=parseInt(_,10)-1;break;case"month_name":-1===(l=m.indexOf(_))&&(l=void 0);break;case"month_abbr":-1===(l=b.indexOf(_))&&(l=void 0);break;case"year":(f=parseInt(_,10))<100&&(f+=f<50?2e3:1900);break;case"hour":d=parseInt(_,10);break;case"minute":p=parseInt(_,10);break;case"ampm":h=_}}return void 0===s||void 0===l||void 0===f||void 0===d||void 0===p?null:(h&&("PM"===h&&12!==d&&(d+=12),"AM"===h&&12===d&&(d=0)),new Date(f,l,s,d,p))}}],r&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);p.NATURAL_LANGUAGE_DEBOUNCE_MS=400,p.MINUTE_STEPS=[0,15,30,45,59],p.DEFAULT_HOUR_12="10",p.DEFAULT_HOUR_24="10",p.DEFAULT_MINUTE="15",p.DEFAULT_AMPM="AM",p.targets=["display","hidden","calendar","button","clear","full"],p.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],p.MONTH_NAMES_ABBR=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},3286:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"browse",value:function(){this.inputTarget.click()}},{key:"dragOver",value:function(e){e.preventDefault(),this.zoneTarget.classList.add("toolkit-drop-zone-component__zone--active")}},{key:"dragLeave",value:function(e){e.preventDefault(),this.zoneTarget.classList.remove("toolkit-drop-zone-component__zone--active")}},{key:"drop",value:function(e){var t;e.preventDefault(),this.zoneTarget.classList.remove("toolkit-drop-zone-component__zone--active");var n=null===(t=e.dataTransfer)||void 0===t?void 0:t.files;n&&n.length>0&&(this.inputTarget.files=n,this.showFile(n[0]),this.inputTarget.dispatchEvent(new Event("change",{bubbles:!0})))}},{key:"fileSelected",value:function(){var e=this.inputTarget.files;e&&e.length>0&&this.showFile(e[0])}},{key:"removeFile",value:function(e){e.stopPropagation(),this.inputTarget.value="",this.hideFile()}},{key:"showFile",value:function(e){this.filenameTarget.textContent=e.name,this.filesizeTarget.textContent=this.formatSize(e.size),this.fileInfoTarget.classList.add("toolkit-drop-zone-component__file-info--visible"),this.zoneTarget.classList.add("toolkit-drop-zone-component__zone--has-file")}},{key:"hideFile",value:function(){this.filenameTarget.textContent="",this.filesizeTarget.textContent="",this.fileInfoTarget.classList.remove("toolkit-drop-zone-component__file-info--visible"),this.zoneTarget.classList.remove("toolkit-drop-zone-component__zone--has-file")}},{key:"formatSize",value:function(e){return e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(1)," KB"):"".concat((e/1048576).toFixed(1)," MB")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["zone","input","filename","filesize","fileInfo"]},770:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l="toolkit-image-drop-zone-component__zone",f="toolkit-image-drop-zone-component__actions--visible",d=["empty","has-image","pending","uploading"],p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).dragCounter=0,e.baseState="empty",e.pendingObjectUrl=null,e.form=null,e.onSubmitStart=function(){return e.startUploading()},e.onFetchError=function(){return e.failUploading()},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e,t;this.baseState=this.hasImageValue?"has-image":"empty",this.form=this.element.closest("form"),null===(e=this.form)||void 0===e||e.addEventListener("turbo:submit-start",this.onSubmitStart),null===(t=this.form)||void 0===t||t.addEventListener("turbo:fetch-request-error",this.onFetchError)}},{key:"disconnect",value:function(){var e,t;null===(e=this.form)||void 0===e||e.removeEventListener("turbo:submit-start",this.onSubmitStart),null===(t=this.form)||void 0===t||t.removeEventListener("turbo:fetch-request-error",this.onFetchError),this.reset()}},{key:"dragEnter",value:function(e){e.preventDefault(),this.dragCounter+=1,this.overlayTarget.textContent=this.dropToReplaceTextValue,this.setDragActive(!0)}},{key:"dragOver",value:function(e){e.preventDefault()}},{key:"dragLeave",value:function(e){e.preventDefault(),this.dragCounter=Math.max(0,this.dragCounter-1),0===this.dragCounter&&this.setDragActive(!1)}},{key:"drop",value:function(e){var t;e.preventDefault(),this.dragCounter=0,this.setDragActive(!1);var n=null===(t=e.dataTransfer)||void 0===t?void 0:t.files;n&&n.length>0&&(this.inputTarget.files=n,this.inputTarget.dispatchEvent(new Event("change",{bubbles:!0})))}},{key:"fileSelected",value:function(){var e;this.clearError();var t=null===(e=this.inputTarget.files)||void 0===e?void 0:e[0];t&&this.acceptFile(t)&&this.preview(t)}},{key:"reset",value:function(){this.inputTarget.value="",this.inputTarget.disabled=!1,this.pendingObjectUrl&&(URL.revokeObjectURL(this.pendingObjectUrl),this.pendingObjectUrl=null),this.clearError(),this.actionsTarget.hidden=!0,this.actionsTarget.classList.remove(f),this.actionsTarget.querySelectorAll("button").forEach(function(e){e.disabled=!1}),this.element.removeAttribute("aria-busy"),this.hasImageValue&&this.imageUrlValue?(this.imageTarget.src=this.imageUrlValue,this.imageTarget.hidden=!1,this.captionTarget.textContent=this.replaceHintValue,this.setState("has-image")):(this.imageTarget.removeAttribute("src"),this.imageTarget.hidden=!0,this.captionTarget.textContent="",this.setState("empty"))}},{key:"acceptFile",value:function(e){var t=this.inputTarget.accept.split(",").map(function(e){return e.trim()}).filter(Boolean);return t.length>0&&-1===t.indexOf(e.type)?(this.rejectFile(this.invalidTypeMessageValue),!1):!(this.maxFileSizeValue>0&&e.size>this.maxFileSizeValue)||(this.rejectFile(this.tooLargeMessageValue),!1)}},{key:"rejectFile",value:function(e){this.inputTarget.value="",this.showError(e)}},{key:"preview",value:function(e){this.pendingObjectUrl&&URL.revokeObjectURL(this.pendingObjectUrl),this.pendingObjectUrl=URL.createObjectURL(e),this.imageTarget.src=this.pendingObjectUrl,this.imageTarget.hidden=!1,this.captionTarget.textContent=this.pendingHintValue,this.actionsTarget.hidden=!1,this.actionsTarget.classList.add(f),this.setState("pending")}},{key:"startUploading",value:function(){this.inputTarget.disabled=!0,this.actionsTarget.querySelectorAll("button").forEach(function(e){e.disabled=!0}),this.overlayTarget.textContent=this.uploadingTextValue,this.element.setAttribute("aria-busy","true"),this.setState("uploading")}},{key:"failUploading",value:function(){this.inputTarget.disabled=!1,this.actionsTarget.querySelectorAll("button").forEach(function(e){e.disabled=!1}),this.element.removeAttribute("aria-busy"),this.showError(this.networkMessageValue),this.setState("pending")}},{key:"showError",value:function(e){this.errorTarget.textContent=e,this.zoneTarget.classList.add("".concat(l,"--error"))}},{key:"clearError",value:function(){this.errorTarget.textContent="",this.zoneTarget.classList.remove("".concat(l,"--error"))}},{key:"setState",value:function(e){var t=this;d.forEach(function(n){return t.zoneTarget.classList.toggle("".concat(l,"--").concat(n),n===e)}),this.baseState=e,0===this.dragCounter&&this.element.setAttribute("data-state",e)}},{key:"setDragActive",value:function(e){this.zoneTarget.classList.toggle("".concat(l,"--active"),e),this.element.setAttribute("data-state",e?"active":this.baseState)}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);p.targets=["zone","input","image","placeholder","caption","overlay","error","actions"],p.values={maxFileSize:Number,hasImage:Boolean,imageUrl:String,invali
vendor: 1,284 bytes, line 2
2dTypeMessage:String,tooLargeMessage:String,networkMessage:String,replaceHint:String,pendingHint:String,dropToReplaceText:String,uploadingText:String}},3070:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=(0,o.T)();e&&"function"===typeof e.fn.multipleSelect?e(this.selectTarget).multipleSelect({allSelected:!0,selectAll:!0,formatAllSelected:function(){return"All"},formatSelectAll:function(){return"Select All / None"},maxHeight:"600",placeholder:this.placeholderValue||"Select",width:"100%"}):console.warn("[MultipleSelectComponent] multipleSelect plugin not loaded.")}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["select"],f.values={placeholder:String}},8051:function(e,t,n){"use strict";n.d(t,{P:function(){return a}});var r="application--toolkit--toast-component",o="application--toolkit--toast-component--toast-component",i=6e3;function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i,a=document.getElementById("toast-viewport-top_right");if(a){var u=document.createElement("div");u.id="toast-".concat(Math.random().toString(36).slice(2)),u.className="".concat(r,"__item ").concat(r,"__item--").concat(t," toast--entering"),u.setAttribute("role","danger"===t?"alert":"status"),u.setAttribute("aria-live","danger"===t?"assertive":"polite"),u.setAttribute("aria-atomic","true"),u.setAttribute("data-controller",o),u.setAttribute("data-".concat(o,"-duration-value"),String(n)),u.setAttribute("data-".concat(o,"-auto-dismiss-value"),"true"),u.setAttribute("data-".concat(o,"-target"),"toast");var c=document.createElement("div");c.className="".concat(r,"__icon");var s=document.createElement("i");s.className="danger"===t?"fa fa-times-circle":"fa fa-check-circle",s.setAttribute("aria-hidden","true"),c.appendChild(s),u.appendChild(c);var l=document.createElement("div");l.className="".concat(r,"__content");var f=document.createElement("div");f.className="".concat(r,"__message"),f.textContent=e,l.appendChild(f),u.appendChild(l);var d=document.createElement("button");d.type="button",d.className="".concat(r,"__close"),d.setAttribute("aria-label","Dismiss notification"),d.setAttribute("data-action","click->".concat(o,"#dismiss"));var p=document.createElement("i");p.className="fa fa-times",p.setAttribute("aria-hidden","true"),d.appendChild(p),u.appendChild(d);var h=document.createElement("div");h.className="".concat(r,"__progress"),h.setAttribute("data-".concat(o,"-target"),"progressBar"),h.setAttribute("role","progressbar"),h.setAttribute("aria-label","Time remaining"),h.setAttribute("aria-valuemin","0"),h.setAttribute("aria-valuemax","100"),h.setAttribute("aria-valuenow","100"),u.appendChild(h),a.appendChild(u)}}},1954:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).timeoutId=null,e.intervalId=null,e.startTime=0,e.remainingTime=0,e.isPaused=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;this.remainingTime=this.durationValue,requestAnimationFrame(function(){e.toastTarget.classList.remove("toast--entering"),e.toastTarget.classList.add("toast--visible")}),this.autoDismissValue&&this.durationValue>0&&this.startCountdown(),this.toastTarget.addEventListener("mouseenter",this.pause.bind(this)),this.toastTarget.addEventListener("mouseleave",this.resume.bind(this)),this.toastTarget.addEventListener("keydown",this.handleKeyDown.bind(this))}},{key:"disconnect",value:function(){this.clearTimers(),this.toastTarget.removeEventListener("mouseenter",this.pause.bind(this)),this.toastTarget.removeEventListener("mouseleave",this.resume.bind(this)),this.toastTarget.removeEventListener("keydown",this.handleKeyDown.bind(this))}},{key:"handleKeyDown",value:function(e){"Escape"!==e.key&&"Esc"!==e.key||(e.preventDefault(),this.dismiss())}},{key:"dismiss",value:function(){this.clearTimers(),this.animateExit()}},{key:"pause",value:function(){if(!this.isPaused&&this.autoDismissValue){this.isPaused=!0,this.clearTimers();var e=Date.now()-this.startTime;if(this.remainingTime=Math.max(0,this.remainingTime-e),this.hasProgressBarTarget){var t=this.progressBarTarget.getBoundingClientRect().width/this.progressBarTarget.parentElement.getBoundingClientRect().width*100;this.progressBarTarget.style.width="".concat(t,"%"),this.progressBarTarget.style.transition="none"}}}},{key:"resume",value:function(){this.isPaused&&this.autoDismissValue&&(this.isPaused=!1,this.remainingTime>0?this.startCountdown():this.dismiss())}},{key:"startCountdown",value:function(){var e=this;this.startTime=Date.now(),this.hasProgressBarTarget&&this.animateProgressBar(),this.timeoutId=window.setTimeout(function(){e.dismiss()},this.remainingTime)}},{key:"animateProgressBar",value:function(){var e=this;if(this.hasProgressBarTarget){var t=this.progressBarTarget;t.style.transition="width ".concat(this.remainingTime,"ms linear"),t.style.width="0%",this.intervalId=window.setInterval(function(){var n=Date.now()-e.startTime,r=Math.max(0,100-n/e.durationValue*100);t.setAttribute("aria-valuenow",Math.round(r).toString()),r<=0&&e.clearInterval()},100)}}},{key:"animateExit",value:function(){var e=this;this.toastTarget.classList.remove("toast--visible"),this.toastTarget.classList.add("toast--exiting"),setTimeout(function(){e.toastTarget.remove()},200)}},{key:"clearTimers",value:function(){null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.clearInterval()}},{key:"clearInterval",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){null!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)})}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["toast","progressBar"],s.values={duration:{type:Number,default:5e3},autoDismiss:{type:Boolean,default:!0}}},4872:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).observer=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.enforceMaxToasts(),this.observeToastAdditions()}},{key:"disconnect",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null)}},{key:"enforceMaxToasts",value:function(){var e=this,t=this.getToasts(),n=t.length-this.maxToastsValue;n>0&&t.slice(0,n).forEach(function(t){e.dismissToast(t)})}},{key:"observeToastAdditions",value:function(){var e=this;this.observer=new MutationObserver(function(t){t.forEach(function(t){"childList"===t.type&&t.addedNodes.length>0&&t.addedNodes.forEach(function(t){t instanceof HTMLElement&&e.isToastElement(t)&&e.enforceMaxToasts()})})}),this.observer.observe(this.element,{childList:!0,subtree:!1})}},{key:"getToasts",value:function(){return Array.from(this.element.querySelectorAll('[data-controller*="toast-component"]'))}},{key:"isToastElement",value:function(e){var t;return e.hasAttribute("data-controller")&&!0===(null===(t=e.getAttribute("data-controller"))||void 0===t?void 0:t.includes("toast-component"))}},{key:"dismissToast",value:function(e){new CustomEvent("toast:dismiss",{bubbles:!0,cancelable:!0});var t=this.application.getControllerForElementAndIdentifier(e,"application--toolkit--toast-component");t&&"function"===typeof t.dismiss?t.dismiss():e.remove()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={maxToasts:{type:Number,default:5}}},9314:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).showTimeout=null,e.hideTimeout=null,e.isVisible=!1,e.touchTriggered=!1,e.handleMouseEnter=function(){e.touchTriggered||e.scheduleShow()},e.handleMouseLeave=function(){e.touchTriggered||e.scheduleHide()},e.handleFocusIn=function(){e.show()},e.handleFocusOut=function(){e.hide()},e.handleTouchStart=function(t){t.stopPropagation(),e.touchTriggered=!0,e.isVisible?e.hide():e.show(),setTimeout(function(){e.touchTriggered=!1},300)},e.handleOutsideTouch=function(t){e.isVisible&&(e.element.contains(t.target)||e.hide())},e.handleScroll=function(){e.isVisible&&e.hide()},e.handleKeydown=function(t){"Escape"===t.key&&e.isVisible&&e.hide()},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.bindEvents()}},{key:"disconnect",value:function(){this.cleanup(),this.unbindEvents()}},{key:"bindEvents",value:function(){var e=this.triggerTarget;e.addEventListener("mouseenter",this.handleMouseEnter),e.addEventListener("mouseleave",this.handleMouseLeave),e.addEventListener("focusin",this.handleFocusIn),e.addEventListener("focusout",this.handleFocusOut),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),document.addEventListener("touchstart",this.handleOutsideTouch,{passive:!0}),document.addEventListener("scroll",this.handleScroll,{passive:!0,capture:!0}),document.addEventListener("keydown",this.handleKeydown)}},{key:"unbindEvents",value:function(){var e=this.triggerTarget;e.removeEventListener("mouseenter",this.handleMouseEnter),e.removeEventListener("mouseleave",this.handleMouseLeave),e.removeEventListener("focusin",this.handleFocusIn),e.removeEventListener("focusout",this.handleFocusOut),e.removeEventListener("touchstart",this.handleTouchStart),document.removeEventListener("touchstart",this.handleOutsideTouch),document.removeEventListener("scroll",this.handleScroll,{capture:!0}),document.removeEventListener("keydown",this.handleKeydown)}},{key:"scheduleShow",value:function(){var e=this;this.cancelTimers(),this.showTimeout=setTimeout(function(){return e.show()},this.delayValue)}},{key:"scheduleHide",value:function(){var e=this;this.cancelTimers(),this.hideTimeout=setTimeout(function(){return e.hide()},100)}},{key:"show",value:function(){this.cancelTimers(),this.positionBubble(),this.bubbleTarget.classList.add("tooltip-component__bubble--visible"),this.bubbleTarget.setAttribute("aria-hidden","false"),this.isVisible=!0}},{key:"hide",value:function(){this.cancelTimers(),this.bubbleTarget.classList.remove("tooltip-component__bubble--visible"),this.bubbleTarget.setAttribute("aria-hidden","true"),this.isVisible=!1}},{key:"cancelTimers",value:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}},{key:"cleanup",value:function(){this.cancelTimers(),this.hide()}},{key:"positionBubble",value:function(){var e,t=this.bubbleTarget,n=this.triggerTarget,r=null!==(e=this.constructor.GAP)&&void 0!==e?e:8;this.setPlacementClass(this.placementValue),t.style.top="-9999px",t.style.left="-9999px",t.style.visibility="hidden",t.style.opacity="0",t.style.display="block";var o,i,a=n.getBoundingClientRect(),u=t.getBoundingClientRect(),c=this.resolvePlacement(this.placementValue,a,u,r);switch(this.setPlacementClass(c),c){case"top":default:o=a.top-u.height-r,i=a.left+a.width/2-u.width/2;break;case"bottom":o=a.bottom+r,i=a.left+a.width/2-u.width/2;break;case"left":o=a.top+a.height/2-u.height/2,i=a.left-u.width-r;break;case"right":o=a.top+a.height/2-u.height/2,i=a.right+r}var s=window.innerWidth,l=window.innerHeight,f=0;"top"!==c&&"bottom"!==c||(i<8?(f=i-8,i=8):i+u.width>s-8&&(f=i+u.width-(s-8),i=s-8-u.width)),"left"!==c&&"right"!==c||(o<8?o=8:o+u.height>l-8&&(o=l-8-u.height)),t.style.top="".concat(o,"px"),t.style.left="".concat(i,"px"),t.style.visibility="",t.style.opacity="",t.style.display="",this.positionArrow(c,f)}},{key:"resolvePlacement",value:function(e,t,n,r){var o=window.innerWidth,i=window.innerHeight,a={top:t.top-n.height-r>=0,bottom:t.bottom+n.height+r<=i,left:t.left-n.width-r>=0,right:t.right+n.width+r<=o};if(a[e])return e;
2var u={top:"bottom",bottom:"top",left:"right",right:"left"}[e];if(a[u])return u;for(var c=0,s=["top","bottom","right","left"];c<s.length;c++){var l=s[c];if(a[l])return l}return e}},{key:"setPlacementClass",value:function(e){var t=this.bubbleTarget;t.classList.remove("tooltip-component__bubble--top","tooltip-component__bubble--bottom","tooltip-component__bubble--left","tooltip-component__bubble--right"),t.classList.add("tooltip-component__bubble--".concat(e))}},{key:"positionArrow",value:function(e,t){var n=this.arrowTarget;n.style.left="",n.style.top="",n.style.transform="","top"!==e&&"bottom"!==e||0===t||(n.style.left="calc(50% + ".concat(t,"px)"),n.style.transform="translateX(-50%)")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["trigger","bubble","arrow"],s.values={placement:{type:String,default:"top"},delay:{type:Number,default:200}},s.GAP=8},7826:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).boundKeyHandler=null,e.boundTurboVisitHandler=null,e.boundTurboFetchHandler=null,e.boundNavigateHandler=null,e.fieldStates=[],e.pendingNavigationUrl=null,e.pendingFetchEvent=null,e.formElement=null,e.isNavigating=!1,e.boundTurboSubmitEndHandler=null,e.pendingIsTurboStream=!1,e.postSaveUrl=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.boundKeyHandler=this.handleKeydown.bind(this),this.boundTurboVisitHandler=this.handleTurboBeforeVisit.bind(this),this.boundTurboFetchHandler=this.handleTurboBeforeFetch.bind(this),this.boundTurboSubmitEndHandler=this.handleTurboSubmitEnd.bind(this),this.formElement=document.getElementById(this.formIdValue),this.formElement?(this.initializeFieldStates(),document.addEventListener("turbo:before-visit",this.boundTurboVisitHandler),document.addEventListener("turbo:before-fetch-request",this.boundTurboFetchHandler),document.addEventListener("turbo:submit-end",this.boundTurboSubmitEndHandler),this.boundNavigateHandler=this.handleNavigateRequest.bind(this),document.addEventListener("unsaved-changes:navigate",this.boundNavigateHandler),this.interceptLinkClicks()):console.warn('UnsavedChangesModal: Form with id "'.concat(this.formIdValue,'" not found'))}},{key:"disconnect",value:function(){this.removeKeyboardListener(),this.boundTurboVisitHandler&&document.removeEventListener("turbo:before-visit",this.boundTurboVisitHandler),this.boundTurboFetchHandler&&document.removeEventListener("turbo:before-fetch-request",this.boundTurboFetchHandler),this.boundTurboSubmitEndHandler&&document.removeEventListener("turbo:submit-end",this.boundTurboSubmitEndHandler),this.boundNavigateHandler&&document.removeEventListener("unsaved-changes:navigate",this.boundNavigateHandler),this.boundKeyHandler=null,this.boundTurboVisitHandler=null,this.boundTurboFetchHandler=null,this.boundTurboSubmitEndHandler=null,this.boundNavigateHandler=null,this.fieldStates=[]}},{key:"initializeFieldStates",value:function(){if(this.formElement){var e=this.formElement.querySelectorAll("input, textarea, select");this.fieldStates=Array.from(e).map(function(e){var t={element:e,originalValue:e.value};return e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type)&&(t.originalChecked=e.checked),t})}}},{key:"isDirty",value:function(){return this.fieldStates.some(function(e){var t=e.element,n=e.originalValue,r=e.originalChecked;return t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type)?t.checked!==r:t.value!==n})}},{key:"shouldShowModal",value:function(){return!!this.isFormVisible()&&this.isDirty()}},{key:"isFormVisible",value:function(){return!!this.formElement&&null!==this.formElement.offsetParent}},{key:"handleNavigateRequest",value:function(e){var t,n,r,o=e,i=null===(t=o.detail)||void 0===t?void 0:t.url;if(i){var a=null!==(n=null===(r=o.detail)||void 0===r?void 0:r.turboStream)&&void 0!==n&&n;this.shouldShowModal()?(this.pendingNavigationUrl=i,this.pendingIsTurboStream
2=a,this.open()):a?fetch(i,{method:"GET",headers:{Accept:"text/vnd.turbo-stream.html, text/html, application/xhtml+xml"},credentials:"same-origin"}).then(function(e){return e.text()}).then(function(e){"undefined"!==typeof window.Turbo&&window.Turbo.renderStreamMessage&&window.Turbo.renderStreamMessage(e)}).catch(function(e){return console.error("Failed to fetch turbo stream:",e)}):"undefined"!==typeof window.Turbo&&window.Turbo.visit?window.Turbo.visit(i):window.location.href=i}}},{key:"interceptLinkClicks",value:function(){var e=this,t=this.hasFormWrapperTarget?this.formWrapperTarget:this.formElement;t&&t.addEventListener("click",function(t){var n=t.target.closest("a[href]");if(n){var r=n.getAttribute("href");r&&!r.startsWith("#")&&(n.hasAttribute("download")||e.shouldShowModal()&&(t.preventDefault(),t.stopPropagation(),e.pendingNavigationUrl=r,e.open()))}})}},{key:"handleTurboBeforeVisit",value:function(e){if(!this.isNavigating){var t=e;this.hasOverlayTarget&&!this.overlayTarget.hasAttribute("hidden")||this.shouldShowModal()&&(e.preventDefault(),this.pendingNavigationUrl=t.detail.url,this.open())}}},{key:"handleTurboBeforeFetch",value:function(e){var t;if(!this.isNavigating){var n=e;if((!this.hasOverlayTarget||this.overlayTarget.hasAttribute("hidden"))&&"GET"===((null===(t=n.detail.fetchOptions.method)||void 0===t?void 0:t.toUpperCase())||"GET")){var r=n.detail.url.toString();if(this.formElement&&r===this.formElement.action)return;var o=n.detail.fetchOptions.headers,i="";if(o instanceof Headers)i=o.get("Accept")||"";else if(o&&"object"===typeof o){var a=o;i=a.Accept||a.accept||""}var u=i.includes("text/vnd.turbo-stream.html"),c=i.includes("text/html")&&n.detail.fetchOptions.headers;(u||c)&&(this.hasAllowedUrlPatternValue&&this.allowedUrlPatternValue&&r.includes(this.allowedUrlPatternValue)||this.shouldShowModal()&&(e.preventDefault(),this.pendingNavigationUrl=r,this.pendingIsTurboStream=u,this.open()))}}}},{key:"open",value:function(){if(this.hasOverlayTarget){this.overlayTarget.removeAttribute("hidden"),this.overlayTarget.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden",this.addKeyboardListener();var e=this.overlayTarget.querySelector('[data-action*="cancel"]');e&&setTimeout(function(){return e.focus()},100)}}},{key:"close",value:function(){this.hasOverlayTarget&&(this.overlayTarget.setAttribute("hidden",""),this.overlayTarget.setAttribute("aria-hidden","true"),document.body.style.overflow="",this.removeKeyboardListener()),this.pendingNavigationUrl=null,this.pendingIsTurboStream=!1}},{key:"cancel",value:function(e){e&&e.preventDefault(),this.close()}},{key:"discard",value:function(e){var t=this;e&&e.preventDefault(),this.isNavigating=!0,this.removeAllTurboListeners(),this.pendingNavigationUrl&&(this.pendingIsTurboStream?fetch(this.pendingNavigationUrl,{method:"GET",headers:{Accept:"text/vnd.turbo-stream.html, text/html, application/xhtml+xml","Turbo-Frame":"_top"},credentials:"same-origin"}).then(function(e){if(e.ok)return e.text();throw new Error("Network response was not ok")}).then(function(e){"undefined"!==typeof window.Turbo&&window.Turbo.renderStreamMessage&&window.Turbo.renderStreamMessage(e)}).catch(function(e){console.error("Failed to fetch turbo stream:",e),"undefined"!==typeof window.Turbo&&window.Turbo.visit?window.Turbo.visit(t.pendingNavigationUrl):window.location.href=t.pendingNavigationUrl}):"undefined"!==typeof window.Turbo&&window.Turbo.visit?window.Turbo.visit(this.pendingNavigationUrl):window.location.href=this.pendingNavigationUrl),this.close()}},{key:"save",value:function(e){if(e&&e.preventDefault(),this.formElement){if(document.dispatchEvent(new CustomEvent("unsaved-changes:saving",{detail:{url:this.pendingNavigationUrl,turboStream:this.pendingIsTurboStream},bubbles:!0})),this.pendingIsTurboStream)return this.close(),void this.formElement.requestSubmit();this.postSaveUrl=this.pendingNavigationUrl,this.close(),this.formElement.requestSubmit()}}},{key:"handleTurboSubmitEnd",value:function(e){var t,n;if(this.formElement){var r=e;if((null===(t=r.detail)||void 0===t||null===(t=t.formSubmission)||void 0===t?void 0:t.formElement)===this.formElement){var o=this.postSaveUrl;this.postSaveUrl=null,null!==(n=r.detail)&&void 0!==n&&n.success&&o&&(this.isNavigating=!0,this.removeAllTurboListeners(),"undefined"!==typeof window.Turbo&&window.Turbo.visit?window.Turbo.visit(o):window.location.href=o)}}}},{key:"removeAllTurboListeners",value:function(){this.boundTurboVisitHandler&&document.removeEventListener("turbo:before-visit",this.boundTurboVisitHandler),this.boundTurboFetchHandler&&document.removeEventListener("turbo:before-fetch-request",this.boundTurboFetchHandler)}},{key:"backdropClick",value:function(e){e.target===this.overlayTarget&&this.cancel(e)}},{key:"handleKeydown",value:function(e){"Escape"===e.key&&this.cancel()}},{key:"addKeyboardListener",value:function(){this.boundKeyHandler&&document.addEventListener("keydown",this.boundKeyHandler)}},{key:"removeKeyboardListener",value:function(){this.boundKeyHandler&&document.removeEventListener("keydown",this.boundKeyHandler)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["overlay","formWrapper"],s.values={modalId:String,formId:String,isEdit:Boolean,allowedUrlPattern:String}},6344:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return f},default:function(){return d}});var r=n(6846),o=n(6609);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=(0,r.mapValues)({LOAD_ADDITIONAL_RESULTS:"load_additional_results"},function(e){return"".concat("ballot-design--wizard--prior-question-results-component",":").concat(e)}),d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"viewMore",value:function(){this.emitLoadAdditionalResults()}},{key:"toggleQuestionPreview",value:function(e){var t=e.target,n=t.id.split("-").pop();this.updateQuestionPreviewVisibility(n),this.hideAllPreviews(n),this.revertLinks(n),this.updateTriggerLabel(t)}},{key:"hideAllPreviews",value:function(e){this.questionPreviewTargets.filter(function(t){return t.id!=="question-preview-".concat(e)}).forEach(function(e){e.classList.remove("visible")})}},{key:"revertLinks",value:function(e){this.showQuestionLinkTargets.filter(function(t){return t.id!=="show-question-link-".concat(e)}).forEach(function(e){e.textContent="View"})}},{key:"updateTriggerLabel",value:function(e){"View"===e.textContent?e.textContent="Hide":e.textContent="View"}},{key:"updateQuestionPreviewVisibility",value:function(e){var t=this.questionPreviewTargets.find(function(t){return t.id==="question-preview-".concat(e)});t&&t.classList.toggle("visible")}},{key:"emitLoadAdditionalResults",value:function(){this.dispatch(f.LOAD_ADDITIONAL_RESULTS,{prefix:null})}}])&&i(n.prototype,r),o&&i(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(o.BaseController);d.targets=["questionPreview","showQuestionLink"]},5906:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6344);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.addListeners(),this.populateResults()}},{key:"submit",value:function(){this.searchbuttonTarget.click()}},{key:"keywordInputChange",value:function(){this.resetFormLimit()}},{key:"clearInput",value:function(){this.clearKeywordInput(),this.populateResults()}},{key:"clearKeywordInput",value:function(){this.keywordInputTarget.value=""}},{key:"populateResults",value:function(){this.submit()}},{key:"loadAdditionalResults",value:function(){this.incresseFormLimit(),this.submit()}},{key:"incresseFormLimit",value:function(){var e=Number(this.formLimitValueTarget.value)+5;this.formLimitValueTarget.value=String(e)}},{key:"resetFormLimit",value:function(){this.formLimitValueTarget.value=String(5)}},{key:"addListeners",value:function(){var e=this;document.addEventListener(o.EVENTS.LOAD_ADDITIONAL_RESULTS,function(){e.loadAdditionalResults()})}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["clearButton","searchbutton","keywordInput","formLimitValue"]},3426:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"submitForm",value:function(e){return e.preventDefault(),!1}},{key:"formClick",value:function(e){var t=e.target,n=t.classList;if(n.contains("example"))return this.insertExampleIntoField(t),e.preventDefault(),!0;n.contains("show_more_examples")&&this.revealAdditionalExamples(t)}},{key:"insertExampleIntoField",value:function(e){var t=e.closest(".fieldset").querySelector("input, textarea");if("INPUT"!==t.tagName)if("TEXTAREA"!==t.tagName);else{var n=e.dataset.values.split(",").filter(function(e){return e}).join("\\\n").replace(/\\/g,"");t.value=n}else{var r=e.dataset.value||e.textContent,o=[t.value,r].filter(function(e){return e}).join(" ");t.value=o}}},{key:"revealAdditionalExamples",value:function(e){e.closest(".fieldset").querySelectorAll(".example").forEach(function(e){e.removeAttribute("hidden")}),e.remove()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["examples_area","formElement"]},9250:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.examplesTarget.addEventListener("click",this.clickHandler),this.originalFormAction=this.formElementTarget.getAttribute("action"),this.alternatFormAction=this.alternatFormAction||this.formElementTarget.dataset.createQuestionRoute,this.form=this.element.querySelector("form"),this.blankQuestionOption&&(this.blankQuestionListener=this.blankQuestionOption.addEventListener("change",this.updateFormAction))}},{key:"handleFormChange",value:function(e){if("INPUT"===e.target.tagName){var t=e.target.getAttribute("for");if(null!==t){if("question_template_type_blank"!==t)return this.formElementTarget.action=this.originalFormAction,void(this.formElementTarget.method="GET");this.formElementTarget.action=this.alternatFormAction,this.formElementTarget.method="POST"}}}},{key:"clickHandler",value:function(e){var t=e.target,n=e.target.id.split("-")[1],r=document.querySelector("#example-".concat(n));r&&(e.preventDefault(),e.stopPropagation(),r.hasAttribute("hidden")?(t.innerText="Hide sample",r.removeAttribute("hidden")):(t.innerText="Sample",r.setAttribute("hidden","hidden")))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["examples","formElement"]},1502:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(6609);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}
2function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l="ballots--choice-group-instructions-component",f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).groups=[],e.answerGroupMap={},e.scoredAnswerIds=new Set,e.selectionCounts={},e.formElement=null,e.boundChangeHandler=null,e.boundSlateHandler=null,e.boundResizeHandler=null,e.isCollapsed=!1,e.slateQuestionIds=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.parseData(),this.attachFormListener(),this.attachResizeListener(),this.calculateSelectionCounts(),this.updateAllGroups(),this.checkAbstainVisibility()}},{key:"disconnect",value:function(){this.detachFormListener(),this.detachResizeListener(),this.slateQuestionIds=null}},{key:"parseData",value:function(){try{this.groups=JSON.parse(this.groupsValue),this.answerGroupMap=JSON.parse(this.answerGroupMapValue),this.scoredAnswerIds=new Set(JSON.parse(this.scoredAnswerIdsValue))}catch(e){console.error("Failed to parse choice group data:",e),this.groups=[],this.answerGroupMap={},this.scoredAnswerIds=new Set}}},{key:"attachFormListener",value:function(){var e=this,t=this.element.closest("form");t?(this.formElement=t,this.boundChangeHandler=function(t){var n=t.target;("INPUT"!==n.tagName||"checkbox"!==n.type&&"radio"!==n.type)&&"SELECT"!==n.tagName||e.handleSelectionChange()},this.boundSlateHandler=function(){e.handleSelectionChange()},t.addEventListener("change",this.boundChangeHandler),t.addEventListener("slate:selections-applied",this.boundSlateHandler)):console.warn("No parent form found for choice group instructions")}},{key:"detachFormListener",value:function(){this.formElement&&(this.boundChangeHandler&&this.formElement.removeEventListener("change",this.boundChangeHandler),this.boundSlateHandler&&this.formElement.removeEventListener("slate:selections-applied",this.boundSlateHandler),this.formElement=null,this.boundChangeHandler=null,this.boundSlateHandler=null)}},{key:"handleSelectionChange",value:function(){this.calculateSelectionCounts(),this.updateAllGroups(),this.checkAbstainVisibility()}},{key:"calculateSelectionCounts",value:function(){var e=this;this.selectionCounts={},this.groups.forEach(function(t){e.selectionCounts[t.id]=0});var t=this.element.closest("form");t&&t.querySelectorAll('input[type="checkbox"]:checked, input[type="radio"]:checked, select:not(:disabled)').forEach(function(t){var n=e.extractAnswerId(t);if(n){if("SELECT"===t.tagName){if(!e.scoredAnswerIds.has(n))return;if(""===t.value)return}(e.answerGroupMap[n]||[]).forEach(function(t){e.selectionCounts[t]=(e.selectionCounts[t]||0)+1})}})}},{key:"extractAnswerId",value:function(e){if("radio"===e.type&&e.value){var t=parseInt(e.value,10);if(!isNaN(t))return t}var n=e.id.match(/answers_(\d+)/);return n?parseInt(n[1],10):null}},{key:"updateAllGroups",value:function(){var e=this;this.groups.forEach(function(t){e.updateGroupUI(t)})}},{key:"updateGroupUI",value:function(e){var t=this.selectionCounts[e.id]||0,n=e.min_required,r=e.max_allowed||n,o="neutral";t<n||r&&t>r?o="invalid":t>=n&&(o="valid"),this.updateProgressBar(e.id,t,r,o),this.updateCountText(e.id,t,r),this.updateStatusIcon(e.id,o),this.updateGroupContainer(e.id,o)}},{key:"updateProgressBar",value:function(e,t,n,r){var o=this.findTargetByGroupId(this.progressBarTargets,e);if(o){var i=n>0?Math.min(t/n*100,100):0;o.style.width="".concat(i,"%"),o.setAttribute("aria-valuenow",t.toString()),o.classList.remove("status-valid","status-invalid"),"neutral"!==r&&o.classList.add("status-".concat(r))}}},{key:"updateCountText",value:function(e,t,n){var r=this.findTargetByGroupId(this.countTextTargets,e);r&&(r.textContent="".concat(t," / ").concat(n))}},{key:"updateStatusIcon",value:function(e,t){var n=this.findTargetByGroupId(this.statusIconTargets,e);
2if(n){var r=n.querySelector("i");r&&(r.className="",r.className="valid"===t?"fas fa-check-circle":"invalid"===t?"fas fa-times-circle":"fas fa-circle"),n.classList.remove("status-valid","status-invalid"),"neutral"!==t&&n.classList.add("status-".concat(t))}}},{key:"updateGroupContainer",value:function(e,t){var n=this.findTargetByGroupId(this.groupItemTargets,e);n&&(n.classList.remove("status-valid","status-invalid"),"neutral"!==t&&n.classList.add("status-".concat(t)))}},{key:"findTargetByGroupId",value:function(e,t){return e.find(function(e){return e.dataset.groupId===t.toString()})}},{key:"getSlateQuestionIds",value:function(){if(null!==this.slateQuestionIds)return this.slateQuestionIds;var e=new Set;return Object.keys(this.answerGroupMap).forEach(function(t){var n=document.querySelector('input[id*="answers_'.concat(t,'"], select[id*="answers_').concat(t,'"]'));if(n||(n=document.querySelector('input[value="'.concat(t,'"]'))),n){var r=n.closest('[id^="question_"]');if(r){var o=r.id.match(/^question_(\d+)$/);o&&e.add(o[1])}}}),this.slateQuestionIds=e,e}},{key:"checkAbstainVisibility",value:function(){var e=this.getSlateQuestionIds();if(0!==e.size){var t=Array.from(e).every(function(e){return null!==document.querySelector("#ballot_data_questions_".concat(e,"_answers_abstain:checked,")+"#ballot_data_questions_".concat(e,"_answer_abstain:checked"))});this.element.hidden=t}}},{key:"toggleCollapse",value:function(){if(this.hasGroupsListTarget){this.isCollapsed=!this.isCollapsed;var e,t,n=this.groupsListTarget,r="".concat(l,"__groups--collapsed"),o="".concat(l,"__collapse-icon--collapsed");this.isCollapsed?(n.classList.add(r),this.hasCollapseToggleTarget&&this.collapseToggleTarget.setAttribute("aria-expanded","false"),null===(e=this.collapseIconTarget)||void 0===e||e.classList.add(o)):(n.classList.remove(r),this.hasCollapseToggleTarget&&this.collapseToggleTarget.setAttribute("aria-expanded","true"),null===(t=this.collapseIconTarget)||void 0===t||t.classList.remove(o))}}},{key:"attachResizeListener",value:function(){var e=this;this.boundResizeHandler=function(){return e.handleResize()},window.addEventListener("resize",this.boundResizeHandler),this.handleResize()}},{key:"detachResizeListener",value:function(){this.boundResizeHandler&&(window.removeEventListener("resize",this.boundResizeHandler),this.boundResizeHandler=null)}},{key:"handleResize",value:function(){if(this.hasGroupsListTarget){var e=window.innerWidth<=480,t="".concat(l,"__groups--collapsed");if(!e&&this.isCollapsed){var n;this.isCollapsed=!1,this.groupsListTarget.classList.remove(t),this.hasCollapseToggleTarget&&this.collapseToggleTarget.setAttribute("aria-expanded","true");var r="".concat(l,"__collapse-icon--collapsed");null===(n=this.collapseIconTarget)||void 0===n||n.classList.remove(r)}}}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.BaseController);f.targets=["groupItem","progressBar","countText","statusIcon","collapseToggle","collapseIcon","groupsList"],f.values={groups:String,answerGroupMap:String,scoredAnswerIds:String}},8303:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return h},default:function(){return v}});var r=n(6846),o=n(6609),i=n(9600),a=n(2402),u=n(2034);function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}
2function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var h=(0,r.mapValues)({FOCUS_QUESTION_BY_INDEX:"focus_question_by_index",FOCUS_QUESTION_BY_LETTER:"focus_question_by_letter",NUMBER_PRESSED:"number_pressed",NUMBER_CLEARED:"number_cleared",CLEAR_FOCUS:"clear_focus",CHECK_ANSWER_BY_NUMBER:"check_answer_by_number",FOCUS_HEADER:"focus_header",UNFOCUS_HEADER:"unfocus_header"},function(e){return"".concat("ballots--form-component",":").concat(e)}),v=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.advancedKeybindingsDisabled()||(this.reset(),this.addListeners())}},{key:"handleEnter",value:function(e){if(!this.advancedKeybindingsDisabled()&&!this.answerInputIsFocused){if(e.preventDefault(),this.pressedLetters.length>0)return this.handleFocusQuestion();if(this.pressedNumbers.length>0)return this.handleCheckAnswer();if(this.headerIsFocused)return this.handleHeaderFocused();var t=this.focusedQuestionIndex+1;if(t<this.questionsCountValue)return this.emitFocusQuestionByIndex(t);this.submitHasFocus()?this.submit():this.focusSubmit()}}},{key:"handleDelete",value:function(e){if(!this.advancedKeybindingsDisabled()&&!this.answerInputIsFocused){if(e.preventDefault(),this.pressedLetters.length>0)return this.resetPressedLetters(!0);if(this.pressedNumbers.length>0)return this.resetPressedNumbers(!0);if(this.submitHasFocus())return this.removeFocusSubmit(),this.emitFocusQuestionByIndex(this.focusedQuestionIndex);var t=this.focusedQuestionIndex-1;return t>=0?this.emitFocusQuestionByIndex(t):this.emitFocusQuestionByIndex(0)}}},{key:"advancedKeybindingsDisabled",value:function(){return!this.advancedKeybindingActiveValue}},{key:"reset",value:function(){this.ballotEnabled=!0,this.headerIsFocused=!1,this.resetPressedNumbers(),this.resetPressedLetters()}},{key:"headerIsPresent",value:function(){return Boolean(document.getElementById("".concat(u.UNIQUE_ID)))}},{key:"handleHeaderFocused",value:function(){this.emitUnfocusHeader(),this.headerIsFocused=!1,this.ballotEnabled?this.emitFocusQuestionByIndex(0):this.focusSubmit()}},{key:"initialFocus",value:function(){this.advancedKeybindingsDisabled()||(this.headerIsPresent()?(this.emitFocusHeader(),this.headerIsFocused=!0):this.emitFocusQuestionByIndex(0))}},{key:"handleCheckAnswer",value:function(){this.emitCheckAnswerByNumber(this.pressedNumbersJoined()),this.resetPressedNumbers()}},{key:"handleFocusQuestion",value:function(){if(!this.focusableQuestion())return this.emitQuestionNotFound(),void this.resetPressedLetters();this.emitUnfocusHeader(),this.emitFocusQuestionByLetter(this.pressedLettersJoined()),this.emitHideKeyPressed(),this.resetPressedLetters(),this.resetPressedNumbers()}},{key:"focusableQuestion",value:function(){return function(e){for(var t=0,n="A".charCodeAt(0),r=0;r<e.length;r++)t=26*t+(e.charAt(r).charCodeAt(0)-n+1);return t}(this.pressedLettersJoined())<=this.questionsCountValue}},{key:"resetPressedNumbers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.pressedNumbers=[],e&&this.emitNumberCleared()}},{key:"pressedNumbersJoined",value:function(){return Number(this.pressedNumbers.join(""))}},{key:"resetPressedLetters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.pressedLetters=[],e&&this.emitHideKeyPressed()}},{key:"pressedLettersJoined",value:function(){return this.pressedLetters.join("")}},{key:"submitHasFocus",value:function(){return this.submitButtonTarget===document.activeElement}},{key:"focusSubmit",value:function(){this.hasSubmitButtonTarget&&(this.emitClearFocus(),this.submitButtonTarget.focu
2s())}},{key:"removeFocusSubmit",value:function(){this.submitButtonTarget.blur()}},{key:"submit",value:function(){this.hasSubmitButtonTarget&&this.submitButtonTarget.click()}},{key:"handleNumberPressed",value:function(e){this.pressedNumbers.push(Number(e)),this.emitNumberPressed(this.pressedNumbersJoined())}},{key:"handleLetterPressed",value:function(e){this.pressedLetters.push(e.toUpperCase()),this.emitShowKeyPressed(this.pressedLettersJoined())}},{key:"keyPressed",value:function(e){if(!this.answerInputIsFocused){var t=e.key;return t.match(/[0-9]/)?this.handleNumberPressed(t):t.match(/^[a-z]$/i)?this.handleLetterPressed(t):void 0}}},{key:"questionFocused",value:function(e){var t=e.orderIndex;this.focusedQuestionIndex=t}},{key:"updateAnswerInputFocused",value:function(e){this.answerInputIsFocused=e}},{key:"updateBallotEnabled",value:function(e){this.ballotEnabled=e}},{key:"addListeners",value:function(){var e=this;document.addEventListener("keydown",function(t){e.keyPressed(t)}),document.addEventListener(i.EVENTS.QUESTION_FOCUSED,function(t){e.questionFocused(t.detail)}),document.addEventListener(i.EVENTS.ANSWER_INPUT_FOCUSED,function(){e.updateAnswerInputFocused(!0)}),document.addEventListener(i.EVENTS.ANSWER_INPUT_UNFOCUSED,function(){e.updateAnswerInputFocused(!1)}),document.addEventListener(u.EVENTS.BALLOT_DISABLED,function(){e.updateBallotEnabled(!1)}),document.addEventListener(u.EVENTS.BALLOT_ENABLED,function(){e.updateBallotEnabled(!0)}),window.addEventListener("load",function(){e.initialFocus()})}},{key:"emitCheckAnswerByNumber",value:function(e){this.dispatch(h.CHECK_ANSWER_BY_NUMBER,{detail:{number:e}})}},{key:"emitFocusQuestionByIndex",value:function(e){this.dispatch(h.FOCUS_QUESTION_BY_INDEX,{detail:{index:e}})}},{key:"emitNumberPressed",value:function(e){this.dispatch(h.NUMBER_PRESSED,{detail:{number:e}})}},{key:"emitNumberCleared",value:function(){this.dispatch(h.NUMBER_CLEARED)}},{key:"emitFocusQuestionByLetter",value:function(e){this.dispatch(h.FOCUS_QUESTION_BY_LETTER,{detail:{letter:e}})}},{key:"emitClearFocus",value:function(){this.dispatch(h.CLEAR_FOCUS)}},{key:"emitFocusHeader",value:function(){this.dispatch(h.FOCUS_HEADER)}},{key:"emitUnfocusHeader",value:function(){this.dispatch(h.UNFOCUS_HEADER)}},{key:"emitShowKeyPressed",value:function(e){this.dispatch(a.EVENTS.SHOW,{detail:{key:e,identifier:this.keyOverlayIdentifierValue}})}},{key:"emitHideKeyPressed",value:function(){this.dispatch(a.EVENTS.HIDE,{detail:{identifier:this.keyOverlayIdentifierValue}})}},{key:"emitQuestionNotFound",value:function(){this.dispatch(a.EVENTS.SHAKE,{detail:{identifier:this.keyOverlayIdentifierValue}})}}],r&&c(n.prototype,r),o&&c(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(o.BaseController);v.targets=["submitButton"],v.values={questionsCount:Number,advancedKeybindingActive:Boolean,keyOverlayIdentifier:String}},2034:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return h},UNIQUE_ID:function(){return p},default:function(){return v}});var r=n(6846),o=n(8303),i=n(2402),a=n(6609);function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p="ballots--header-component",h=(0,r.mapValues)({BALLOT_DISABLED:"ballot_disabled",BALLOT_ENABLED:"ballot_enabled"},function(e){return"".concat(p,":").concat(e)}),v=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.addListeners(),this.populateVariables(),this.initialChecks()}},{key:"enableQuorum",value:function(){this.disableBallot(),this.disableProxyVoteToMember()}},{key:"enableVote",value:function(){this.enableBallot(),this.disableProxyVoteToMember()}},{key:"enableProxyVoteToAdmin",value:function(){this.disableBallot()}},{key:"enableProxyVoteToMember",value:function(){var e;this.disableBallot(),null===(e=this.proxyVoteToMemberSelectorComponent)||void 0===e||e.classList.remove("hide")}},{key:"populateVariables",value:function(){this.questionsElements=Array.from(document.querySelectorAll(".question")),this.proxyVoteToMemberSelectorComponent=document.querySelector(".ballots-proxy-voter-component"),this.slatePanelElement=document.querySelector(".ballots--slate-panel"),this.bottomInstructionsElement=document.querySelector(".ballots--choice-group-instructions-bottom")}},{key:"initialChecks",value:function(){document.querySelector("#vote_mode_register_quorum")&&this.quorumRadioButtonTarget.checked&&this.disableBallot(),document.querySelector("#vote_mode_proxy_vote_to_member")&&this.proxyVoteToMemberRadioButtonTarget.checked&&this.enableProxyVoteToMember(),document.querySelector("#vote_mode_proxy_vote_to_admin")&&this.proxyVoteToAdminRadioButtonTarget.checked&&this.enableProxyVoteToAdmin()}},{key:"disableProxyVoteToMember",value:function(){var e;null===(e=this.proxyVoteToMemberSelectorComponent)||void 0===e||e.classList.add("hide")}},{key:"disableBallot",value:function(){var e,t;this.questionsElements.forEach(function(e){return e.classList.add("hide")}),null===(e=this.slatePanelElement)||void 0===e||e.classList.add("hide"),null===(t=this.bottomInstructionsElement)||void 0===t||t.classList.add("hide"),this.emitBallotDisabled()}},{key:"enableBallot",value:function(){var e,t;this.questionsElements.forEach(function(e){return e.classList.remove("hide")}),null===(e=this.slatePanelElement)||void 0===e||e.classList.remove("hide"),null===(t=this.bottomInstructionsElement)||void 0===t||t.classList.remove("hide"),this.emitBallotEnabled()}},{key:"focus",value:function(){this.containerTarget.scrollIntoView({behavior:"smooth",block:"nearest"}),this.containerTarget.classList.add("focus"),this.focused=!0}},{key:"removeFocus",value:function(){this.containerTarget.classList.remove("focus"),this.focused=!1,this.emitHideKeyPressed()}},{key:"checkAnswerByNumber",value:function(e){var t=e.number;if(this.focused){var n=this.optionTargets.find(function(e){return e.id==="header_option_".concat(t)});if(!n)return this.emitNotifyAnswerNotFound();this.emitHideKeyPressed(),n.focus(),n.click()}}},{key:"addListeners",value:function(){var e=this;document.addEventListener(o.EVENTS.FOCUS_HEADER,function(){e.focus()}),document.addEventListener(o.EVENTS.UNFOCUS_HEADER,function(){e.removeFocus()}),document.addEventListener(o.EVENTS.NUMBER_PRESSED,function(t){e.emitShowKeyPressed(t.detail.number)}),document.addEventListener(o.EVENTS.NUMBER_CLEARED,function(){e.emitHideKeyPressed()}),document.addEventListener(o.EVENTS.CHECK_ANSWER_BY_NUMBER,function(t){e.checkAnswerByNumber(t.detail)})}},{key:"emitBallotDisabled",value:function(){this.dispatch(h.BALLOT_DISABLED)}},{key:"emitBallotEnabled",value:function(){this.dispatch(h.BALLOT_ENABLED)}},{key:"emitNotifyAnswerNotFound",value:function(){this.dispatch(i.EVENTS.SHAKE,{detail:{identifier:this.keyOverlayIdentifierValue}})}},{key:"emitShowKeyPressed",value:function(e){this.focused&&this.dispatch(i.EVENTS.SHOW,{detail:{key:e,identifier:this.keyOverlayIdentifierValue}})}},{key:"emitHideKeyPressed",value:function(){this.dispatch(i.EVENTS.HIDE,{detail:{identifier:this.keyOverlayIdentifierValue}})}}])&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(a.BaseController);v.targets=["quorumRadioButton","proxyVoteToMemberRadioButton","proxyVoteToAdminRadioButton","container","keyOverlay","option"],v.values={keyOverlayIdentifier:String}},8456:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(2224);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.scope.element.innerText=(0,o.joinUnlessMissingOrSame)(this.data.get("prefix"),this.data.get("suffix"))}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},2402:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return f},default:function(){return d}});var r=n(6846),o=n(6609);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=(0,r.mapValues)({SHOW:"show",HIDE:"hide",SHAKE:"shake"},function(e){return"".concat("ballots--key-overlay-component",":").concat(e)}),d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.addListeners()}},{key:"shake",value:function(){var e=this;this.keyOverlayTarget.classList.add("error"),setTimeout(function(){e.hide(),e.keyOverlayTarget.classList.remove("error")},700)}},{key:"show",value:function(e){this.keyOverlayTarget.innerHTML=e,this.keyOverlayTarget.classList.add("visible")}},{key:"hide",value:function(){this.keyOverlayTarget.innerHTML="",this.keyOverlayTarget.classList.remove("visible")}},{key:"matchIdentifier",value:function(e,t){var n=e.identifier,r=e.key,o=void 0===r?null:r;this.identifierValue===n&&this[t](o)}},{key:"addListeners",value:function(){var e=this;document.addEventListener(f.SHOW,function(t){e.matchIdentifier(t.detail,"show")}),document.addEventListener(f.HIDE,function(t){e.matchIdentifier(t.detail,"hide")}),document.addEventListener(f.SHAKE,function(t){e.matchIdentifier(t.detail,"shake")})}}])&&i(n.prototype,r),o&&i(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(o.BaseController);d.targets=["keyOverlay"],d.values={identifier:String}},786:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this,t=(0,o.T)();if(t){var n=t(this.languageSelectTarget).select2();n.on("change",function(){e.redirectToLocale(n.val())})}else this.languageSelectTarget.addEventListener("change",function(){e.redirectToLocale(e.languageSelectTarget.value)})}},{key:"redirectToLocale",value:function(e){var t=new URL(window.location.href);t.searchParams.set("locale",e),window.location.href=t.href}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["languageSelect"]},8460:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ae}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var a=function(){return e=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=this.extractNumber(t),this.answered=n},(t=[{key:"extractNumber",value:function(e){var t=e.match(/\d+$/);return t?parseInt(t[0],10):null}}])&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function u(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var f=function(){return e=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=t,this.min=n,this.max=r,this.answers=this.getAnswers()},(t=[{key:"getAnswers",value:function(){var e=this;return u(document.querySelectorAll(this.answerListSelector)).filter(function(e){return!e.id.endsWith("_abstain")}).map(function(t){return new a(t.id,e.responseToAnswer(t))})}},{key:"checkIfAbstained",value:function(){var e=document.querySelector(this.abstentionSelector);return!!e&&e.checked}},{key:"hasSelections",get:function(){return this.answered>0}},{key:"answered",get:function(){return this.answers.filter(function(e){return e.answered}).length}},{key:"abstentionSelector",get:function(){return[this.singleAbstainSelector,this.multipleAbstainSelector].join(",")}},{key:"singleAbstainSelector",get:function(){return"#question_".concat(this.id," input[type=radio]#ballot_data_questions_").concat(this.id,"_answer_abstain")}},{key:"multipleAbstainSelector",get:function(){return"#question_".concat(this.id," input[type=checkbox]#ballot_data_questions_").concat(this.id,"_answers_abstain")}},{key:"outOfRange",value:function(){return this.answered<this.min||this.answered>this.max}},{key:"answerListSelectorToListenTo",get:function(){return this.answerListSelector}}])&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n){return t=y(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}
2function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var b=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,(r=[{key:"answerListSelector",get:function(){return"#question_".concat(this.id," input[type=radio], #question_").concat(this.id," input[type=checkbox]")}},{key:"responseToAnswer",value:function(e){return e.checked}}])&&d(n.prototype,r),o&&d(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(f);function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}function w(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _(e,t,n){return t=T(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,O()?Reflect.construct(t,n||[],T(e).constructor):t.apply(e,n))}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}var j=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),_(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}(t,e),n=t,(r=[{key:"answerListSelector",get:function(){return"#question_".concat(this.id," select")}},{key:"responseToAnswer",value:function(e){return e.value}}])&&g(n.prototype,r),o&&g(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(f);function S(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,P(r.key),r)}}function P(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function E(e,t,n){return t=x(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,C()?Reflect.construct(t,n||[],x(e).constructor):t.apply(e,n))}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}var R=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),E(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}(t,e),n=t,(r=[{key:"answerListSelector",get:function(){return"#question_".concat(this.id," input[type=radio], #question_").concat(this.id," input[type=checkbox]")}},{key:"responseToAnswer",value:function(e){return e.checked}}])&&S(n.prototype,r),o&&S(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(f);function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,I(r.key),r)}}function I(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function B(e,t,n){return t=M(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,D()?Reflect.construct(t,n||[],M(e).constructor):t.apply(e,n))}function D(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(D=function(){return!!e})()}
2function M(e){return M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},M(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}var N=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),B(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(t,e),n=t,(r=[{key:"answerListSelector",get:function(){return"#question_".concat(this.id," select")}},{key:"answerListSelectorToListenTo",get:function(){return"#question_".concat(this.id," select")}},{key:"responseToAnswer",value:function(e){return e.value}}])&&L(n.prototype,r),o&&L(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(f);function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,H(r.key),r)}}function H(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function q(e,t,n){return t=G(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,U()?Reflect.construct(t,n||[],G(e).constructor):t.apply(e,n))}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function z(e,t){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},z(e,t)}var W=function(e){function t(e,n,r,o,i){var a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(a=q(this,t,[e,n,r])).availableVotes=o,a.allowIncomplete=i,a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&z(e,t)}(t,e),n=t,(r=[{key:"answerListSelector",get:function(){return"#question_".concat(this.id," input[type=number]")}},{key:"responseToAnswer",value:function(e){return e.value?e.value:"0"}},{key:"answered",get:function(){return this.answers.map(function(e){return parseInt(e.answered)}).reduce(function(e,t){return e+t},0)}},{key:"choices",get:function(){return this.answers.map(function(e){return parseInt(e.answered)}).filter(function(e){return 0!==e}).length}},{key:"outOfRange",value:function(){var e=this.min>this.choices||this.max<this.choices,t=this.answered>this.availableVotes,n=!this.allowIncomplete&&this.answered<this.availableVotes;return e||t||n}}])&&V(n.prototype,r),o&&V(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(f);function K(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Q(r.key),r)}}function Q(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function X(e,t,n){return t=$(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Y()?Reflect.construct(t,n||[],$(e).constructor):t.apply(e,n))}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$(e)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}var Z=function(e){function t(e,n,r,o,i){var a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(a=X(this,t,[e,n,r])).availableVotes=o,a.allowIncomplete=i,a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}(t,e),n=t,(r=[{key:"answerListSelector",get:function(){return"#question_".concat(this.id," input[type=number]")}},{key:"responseToAnswer",value:function(e){return e.value?e.value:"0"}},{key:"answered",get:function(){return this.answers.map(function(e){return parseInt(e.answered)}).reduce(function(e,t){return e+t},0)}},{key:"choices",get:function(){return this.answers.map(function(e){return parseInt(e.answered)}).filter(function(e){return 0!==e}).length}},{key:"outOfRange",value:function(){var e=this.min>this.choices||this.max<this.choices,t=this.answered>this.availableVotes,n=!this.allowIncomplete&&this.answered<this.availableVotes;return e||t||n}}])&&K(n.prototype,r),o&&K(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(f);function ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,te(r.key),r)}}function te(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function ne(e,t,n){return t=oe(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,re()?Reflect.construct(t,n||[],oe(e).constructor):t.apply(e,n))}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(re=function(){return!!e})()}function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ie(e,t){return ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ie(e,t)}var ae=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ne(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ie(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.check(),this.listenToAnswers()}},{key:"check",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"initial",t=document.querySelector(".question > div.message.message--error");this.question=this.buildQuestion(),this.checkAbstained(),("initial"!==e||null!=t||this.question.hasSelections)&&this.validateSelection(),this.updatePointsUsed(),this.updateChoicesUsed()}},{key:"buildQuestion",value:function(){if("plurality"===this.kindValue)return new b(this.idValue,this.minValue,this.maxValue);if("plurality-split-weight"===this.kindValue)return new Z(this.idValue,this.minValue,this.maxValue,this.availableV
2otesValue,this.allowIncompleteValue);if("preferential"===this.kindValue)return new j(this.idValue,this.minValue,this.maxValue);if("approval"===this.kindValue)return new R(this.idValue,this.minValue,this.maxValue);if("scored"===this.kindValue)return new N(this.idValue,this.minValue,this.maxValue);if("cumulative"===this.kindValue)return new W(this.idValue,this.minValue,this.maxValue,this.availableVotesValue,this.allowIncompleteValue);throw new Error("Not recognized type of question")}},{key:"checkAbstained",value:function(){this.element.hidden=this.question.checkIfAbstained()}},{key:"validateSelection",value:function(){this.question.outOfRange()?(this.element.classList.remove("neutral"),this.element.classList.remove("good"),this.element.classList.add("error")):(this.element.classList.remove("neutral"),this.element.classList.remove("error"),this.element.classList.add("good"))}},{key:"updatePointsUsed",value:function(){document.querySelector("#question_".concat(this.question.id," .points-used")).innerText=this.question.answered}},{key:"updateChoicesUsed",value:function(){"cumulative"!==this.kindValue&&"plurality-split-weight"!==this.kindValue||(document.querySelector("#question_".concat(this.question.id," .used-choices")).innerText=this.question.choices)}},{key:"listenToAnswers",value:function(){var e=this;document.querySelectorAll(this.question.answerListSelectorToListenTo).forEac
2h(function(t){t.addEventListener("change",e.check.bind(e))});var t=document.querySelector(this.question.abstentionSelector);if(t){t.addEventListener("change",this.check.bind(this));var n=this.element.closest("form");n&&n.addEventListener("slate:selections-applied",this.check.bind(this))}}}],r&&ee(n.prototype,r),o&&ee(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);ae.values={id:Number,min:Number,max:Number,kind:String,availableVotes:Number,allowIncomplete:Boolean}},8857:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.changeBannerToError()}},{key:"changeBannerToError",value:function(){document.querySelectorAll("#link-error").length>0&&(this.bannerTarget.classList.remove("green-banner"),this.bannerTarget.classList.add("red-banner"))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["banner"]},9600:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return p},default:function(){return h}});var r=n(6846),o=n(6609),i=n(8303),a=n(2402);function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=(0,r.mapValues)({QUESTION_FOCUSED:"question_focused",ANSWER_INPUT_FOCUSED:"answer_input_focused",ANSWER_INPUT_UNFOCUSED:"answer_input_unfocused"},function(e){return"".concat("ballots--question-component",":").concat(e)}),h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.addListeners()}},{key:"focus",value:function(){this.focused=!0,this.scrollIntoView(this.containerTarget),this.containerTarget.classList.add("focus"),this.emitQuestionFocused()}},{key:"scrollIntoView",value:function(e){e.scrollIntoView({behavior:"smooth",block:"nearest"})}},{key:"removeFocus",value:function(){this.focused=!1,this.containerTarget.classList.remove("focus"),this.emitHideKeyPressed()}},{key:"focusQuestionByIndex",value:function(e){var t=e.index;this.orderIndexValue===t?this.focus():this.removeFocus()}},{key:"focusQuestionByLetter",value:function(e){var t=e.letter;this.letterIdentifierValue===t?this.focus():this.removeFocus()}},{key:"findAnswerRow",value:function(e){var t='[data-answer-row="'.concat(this.questionIdValue,"_").concat(e,'"]');return document.querySelector(t)}},{key:"focusAnswerRow",value:function(e){var t=this.findAnswerRow(e);t&&t.classList.add("focus")}},{key:"unfocusAnswerRow",value:function(e){var t=this.findAnswerRow(e);t&&t.classList.remove("focus")}},{key:"findAnswer",value:function(e){var t='[data-answer-index="'.concat(this.questionIdValue,"_").concat(e,'"]');return document.querySelector(t)}},{key:"removeAnswerFocus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.focused&&this.activeAnswerIndex){var t=e||this.findAnswer(this.activeAnswerIndex);t&&(t.blur(),this.clearListeners(t),this.unfocusAnswerRow(this.activeAnswerIndex),this.activeAnswerIndex=null,this.emitAnswerInputUnfocused())}}},{key:"clearListeners",value:function(e){e.removeEventListener("change",function(){}),e.removeEventListener("keydown",function(){})}},{key:"isWriteIn",value:function(e){return Boolean(e.getAttribute("data-write-in"))}},{key:"isAbstain",value:function(e){return Boolean(e.getAttribute("data-abstain"))}},{key:"addEnterKeyListener",value:function(e){var t=this;e.addEventListener("keydown",function(n){"Enter"===n.key&&(n.stopPropagation(),n.preventDefault(),t.removeAnswerFocus(e))})}},{key:"handleTextInput",value:function(e,t){this.activeAnswerIndex=t,e.focus(),e.click(),this.emitAnswerInputFocused(),this.focusAnswerRow(t),this.addEnterKeyListener(e)}},{key:"handleSelectInput",value:function(e,t){var n=this;this.activeAnswerIndex=t,e.focus(),e.showPicker(),this.emitAnswerInputFocused(),this.focusAnswerRow(t),e.addEventListener("change",function(){return n.removeAnswerFocus(e)})}},{key:"findWriteInAnswer",value:function(e){var t='[data-write-in-answer-index="'.concat(this.questionIdValue,"_").concat(e,'"]');return document.querySelector(t)}},{key:"handleWriteIn",value:function(e,t){this.activeAnswerIndex=t,e.focus(),e.click(),this.emitAnswerInputFocused(),this.focusAnswerRow(t),this.addWriteInEnterKeyListener(e,t)}},{key:"addWriteInEnterKeyListener",value:function(e,t){var n=this;e.addEventListener("keydown",function(r){if("Enter"===r.key){r.stopPropagation(),r.preventDefault(),n.clearListeners(e);var o=n.findWriteInAnswer(t);if(!o)return n.removeAnswerFocus();["preferential"].includes(n.questionTypeValue)&&n.handleSelectInput(o,t),["plurality","cumulative"].includes(n.questionTypeValue)&&n.handleTextInput(o,t)}})}},{key:"handleAbstain",value:function(e){e.focus(),e.click()}},{key:"checkAnswerByNumber",value:function(e){var t=e.number;if(this.focused){var n=this.findAnswer(t);if(!n)return this.emitNotifyAnswerNotFound();if(this.scrollIntoView(n),this.emitHideKeyPressed(),this.isWriteIn(n))return this.handleWriteIn(n,t);if(this.isAbstain(n))return this.handleAbstain(n);["cumulative"].includes(this.questionTypeValue)&&this.handleTextInput(n,t),["scored","preferential"].includes(this.questionTypeValue)&&this.handleSelectInput(n,t),["nomination","plurality","approval"].includes(this.questionTypeValue)&&(n.focus(),n.click())}}},{key:"addListeners",value:function(){var e=this;this.advancedKeybindingActiveValue&&(document.addEventListener(i.EVENTS.FOCUS_QUESTION_BY_INDEX,function(t){e.focusQuestionByIndex(t.detail)}),document.addEventListener(i.EVENTS.FOCUS_QUESTION_BY_LETTER,function(t){e.focusQuestionByLetter(t.detail)}),document.addEventListener(i.EVENTS.NUMBER_PRESSED,function(t){e.emitShowKeyPressed(t.detail.number)}),document.addEventListener(i.EVENTS.NUMBER_CLEARED,function(){e.emitHideKeyPressed()}),document.addEventListener(i.EVENTS.CHECK_ANSWER_BY_NUMBER,function(t){e.checkAnswerByNumber(t.detail)}),document.addEventListener(i.EVENTS.CLEAR_FOCUS,function(){e.removeFocus()}))}},{key:"emitQuestionFocused",value:function(){this.dispatch(p.QUESTION_FOCUSED,{detail:{orderIndex:this.orderIndexValue,letterIdentifier:this.letterIdentifierValue}})}},{key:"emitAnswerInputFocused",value:function(){this.dispatch(p.ANSWER_INPUT_FOCUSED)}},{key:"emitAnswerInputUnfocused",value:function(){this.dispatch(p.ANSWER_INPUT_UNFOCUSED)}},{key:"emitNotifyAnswerNotFound",value:function(){this.dispatch(a.EVENTS.SHAKE,{detail:{identifier:this.keyOverlayIdentifierValue}})}},{key:"emitShowKeyPressed",value:function(e){this.focused&&this.dispatch(a.EVENTS.SHOW,{detail:{key:e,identifier:this.keyOverlayIdentifierValue}})}},{key:"emitHideKeyPressed",value:function(){this.dispatch(a.EVENTS.HIDE,{detail:{identifier:this.keyOverlayIdentifierValue}})}}],r&&u(n.prototype,r),o&&u(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(o.BaseController);h.targets=["container"],h.values={orderIndex:Number,letterIdentifier:String,questionId:Number,advancedKeybindingActive:Boolean,questionType:String,keyOverlayIdentifier:String}},6234:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggleSelection",value:function(){this.inputTarget.checked?this.element.classList.add("selected"):this.element.classList.remove("selected")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["input"]},4135:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){window.EB&&window.EB.Ballots&&(window.EB.Ballots.initRowHighlights(),window.EB.Ballots.initAbstain(),window.EB.Ballots.selectRowOnClick(),window.EB.Ballots.initAutoSelectWriteIn(),window.EB.Ballots.uniquelySelectAbstain(),window.EB.Ballots.showHiddenEmailInput(),window.EB.Ballots.showHiddenWriteIns())}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},5141:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){window.EB&&window.EB.Ballots&&window.EB.Ballots.showHiddenWriteIns()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},5968:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this.selectInputTarget.getAttribute("data-vote-id"),t=this.selectInputTarget.getAttribute("data-voters-source"),n=this.selectInputTarget.getAttribute("data-invitation-key");({candidate_names:this.setupSelectInput,sample_candidate_names:this.setupSampleSelectInput})[t](this.selectInputTarget,e,n)}},{key:"setupSelectInput",value:function(e,t,n){var r=(0,o.T)();if(r){var i="/votes/".concat(t,"/voters/proxy_candidates");r(e).select2({width:450,allowClear:!0,ajax:{url:i,dataType:"json",delay:250,data:function(e){return{search_term:e.term,page:e.page||1,answer_limit:10,per_page:10,invitation_key:n}},processResults:function(e,t){return e.results.map(function(e){return e.id=e.text}),t.page=t.page||1,t.per_page=t.per_page||10,{results:e.results,pagination:{more:t.page*t.per_page<e.meta.total}}}}})}}},{key:"setupSampleSelectInput",value:function(e,t,n){var r="/votes/".concat(t,"/voters/sample_invitations"),i={answer_limit:10,invitation_key:n};Rails.ajax({url:r,type:"get",data:new URLSearchParams(Object.keys(i).map(function(e){return[e,i[e]]})),success:function(t){var n=(0,o.T)();n&&n(e).select2({allowClear:!0,width:450,data:t.results})}})}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["selectInput"]},7916:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var r=n(5396),o=n(9403);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return c(l,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,c(p,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(p),c(p,o,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:h}})()}function c(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,n,r){function i(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},c(e,t,n,r)}function s(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function f(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e,t,n){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}
2function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}var y=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(t,e),n=t,r=[{key:"applySlate",value:(c=u().m(function e(t){var r,i,a,c,s,l,f,d,p;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),r=t.currentTarget,i=r.dataset.slateId){e.n=1;break}return console.error("Slate ID not found. Button dataset:",r.dataset),alert("Invalid group selection"),e.a(2);case 1:return e.p=1,this.setLoading(r,!0),this.disableAllButtons(!0),a={choice_group_id:i},e.n=2,fetch("/ballot/".concat(this.invitationKeyValue,"/slates/apply"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":this.csrfToken(),Accept:"text/vnd.turbo-stream.html"},body:JSON.stringify(a)});case 2:return c=e.v,e.n=3,c.text();case 3:if(s=e.v,c.ok){e.n=4;break}return s.includes("<turbo-stream")?o.V.renderStreamMessage(s):alert("Error: ".concat(c.status)),this.disableAllButtons(!1),e.a(2);case 4:if(l=s.match(/<turbo-stream[^>]*action="slate_selections"[^>]*><template>([^<]*)<\/template><\/turbo-stream>/),f=null,l&&l[1])try{f=JSON.parse(l[1])}catch(n){console.error("[Slate] Failed to parse selections JSON:",n)}(d=s.replace(/<turbo-stream[^>]*action="slate_selections"[^>]*><template>[^<]*<\/template><\/turbo-stream>/g,"")).trim()&&o.V.renderStreamMessage(d),f&&this.applySelectionsToForm(f),e.n=6;break;case 5:e.p=5,p=e.v,console.error("Failed to apply slate:",p),alert(p instanceof Error?p.message:"Failed to apply group");case 6:return e.p=6,this.setLoading(r,!1),this.disableAllButtons(!1),e.f(6);case 7:return e.a(2)}},e,this,[[1,5,6,7]])}),f=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=c.apply(e,t);function i(e){s(o,n,r,i,a,"next",e)}function a(e){s(o,n,r,i,a,"throw",e)}i(void 0)})},function(e){return f.apply(this,arguments)})},{key:"applySelectionsToForm",value:function(e){var t=this,n=[];Object.keys(e).forEach(function(e){var t=document.getElementById("question_".concat(e));t&&t.querySelectorAll('input[type="checkbox"]:not([id*="abstain"]), input[type="radio"]:not([id*="abstain"])').forEach(function(e){e.checked=!1;var t=e.closest(".question_row, tr");t&&t.classList.remove("selected")})}),Object.entries(e).forEach(function(e){var r=i(e,2),o=r[0],a=r[1];if(a&&"object"===typeof a)switch(a.type){case"single":case"multi":t.applyChoiceSelections(o,a.answerIds,n);break;case"scored":t.applyScoredSelections(o,a.answerIds,a.value)}});var r=this.element.closest("form");r&&r.dispatchEvent(new CustomEvent("slate:selections-applied",{bubbles:!0,detail:{inputCount:n.length}}))}},{key:"applyChoiceSelections",value:function(e,t,n){Array.isArray(t)&&t.forEach(function(t){var r=document.getElementById("question_".concat(e));if(r){var o=r.querySelector('input[type="checkbox"][id*="answers_'.concat(t,'"]'));if(o||(o=r.querySelector('input[type="radio"][value="'.concat(t,'"]'))),o){o.checked=!0;var i=o.closest(".question_row, tr");i&&i.classList.add("selected"),n.push(o)}}})}},{key:"applyScoredSelections",value:function(e,t,n){Array.isArray(t)&&null!=n&&t.forEach(function(t){if(t in n){var r=document.getElementById("question_".concat(e));if(r){var o=r.querySelector('select[id*="answers_'.concat(t,'"]'));o&&(o.value=n[t],o.dispatchEvent(new Event("change",{bubbles:!0})))}}})}}
2,{key:"setLoading",value:function(e,t){t?(e.classList.add("ballots--slates-component__button--loading"),e.disabled=!0):e.classList.remove("ballots--slates-component__button--loading")}},{key:"disableAllButtons",value:function(e){this.buttonsContainerTarget.querySelectorAll("button").forEach(function(t){t.disabled=e})}},{key:"csrfToken",value:function(){var e=document.querySelector('meta[name="csrf-token"]');return e?e.content:""}}],r&&l(n.prototype,r),a&&l(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,c,f}(r.xI);y.targets=["buttonsContainer"],y.values={invitationKey:String}},4058:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"submit",value:function(){this.submitButtonTarget.click()}},{key:"edit",value:function(){this.editButtonTarget.click()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(6609).BaseController);s.targets=["submitButton","editButton"]},5276:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})}}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}n.r(t),n.d(t,{default:function(){return p}});var p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,o=[{key:"writeInUpdate",value:function(e){var t=e.target.getAttribute("data-answer-draft-id"),n=e.target.getAttribute("data-invitation-key"),r=e.target.getAttribute("data-question-id"),o=e.target.getAttribute("data-answer-index"),i={text:e.target.value,question_id:r,index:o};t?this.updateAnswer(t,i,r,o):this.createAnswer(n,i,r,o)}},{key:"toggleInfoButton",value:function(e){this.hasAddInfoButtonTarget&&(0===e.target.value.trim().length?this.addInfoButtonTarget.classList.add("disabled-button"):this.addInfoButtonTarget.classList.remove("disabled-button"))}},{key:"createAnswer",value:(l=a(r().m(function e(t,n,o,i){var a,u,c=this;return r().w(function(e){for(;;)switch(e.n){case 0:a="/voters/".concat(t,"/answer_drafts"),u=i?"#question_".concat(o,"_add_profile_").concat(i):"#question_".concat(o,"_add_profile"),this.sendAjaxRequest("post",a,n,o,i,function(e){var t=i?'[data-question-id="'.concat(o,'"][data-answer-index="').concat(i,'"]'):'[data-question-id="'.concat(o,'"]'),n=c.element.querySelector(t);n&&n.setAttribute("data-answer-draft-id",e.answer_draft_id);var r=document.querySelector(u);r&&(r.href="/voters/answer_drafts/".concat(e.answer_draft_id,"/edit"))});case 1:return e.a(2)}},e,this)})),function(e,t,n,r){return l.apply(this,arguments)})},{key:"updateAnswer",value:(c=a(r().m(function e(t,n,o,i){var a;return r().w(function(e){for(;;)switch(e.n){case 0:a="/voters/answer_drafts/".concat(t),this.sendAjaxRequest("patch",a,n,o,i);case 1:return e.a(2)}},e,this)})),function(e,t,n,r){return c.apply(this,arguments)})},{key:"sendAjaxRequest",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a=o?"#question_".concat(r,"_error_container_").concat(o):"#question_".concat(r,"_error_container"),u=document.querySelector(a);Rails.ajax({url:t,type:e,data:new URLSearchParams(Object.entries(n)),success:function(e){u.innerHTML="",i&&i(e)},error:function(e){var t=e.errors;u.innerHTML="",t.forEach(function(e){var t=document.createElement("p");t.classList.add("help_text","error-message"),t.textContent=e,u.appendChild(t)})}})}},{key:"handleButtonClick",value:function(){var e=this,t=this.addInfoButtonTarget.href;this.addInfoButtonTarget.classList.contains("programatic-click")&&t.endsWith("edit")?this.addInfoButtonTarget.classList.remove("programatic-click"):(event.preventDefault(),this.addInfoButtonTarget.disabled=!0,setTimeout(function(){e.addInfoButtonTarget.disabled=!1,e.addInfoButtonTarget.classList.add("programatic-click"),e.addInfoButtonTarget.click()},500))}}],o&&u(n.prototype,o),i&&u(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i,c,l}(n(5396).xI);p.targets=["addInfoButton"]},2732:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this.containerTarget.dataset,t=e.questionId;window.EB.Ballots.hiddenWriteFromSelectList=window.EB.Ballots.hiddenWriteFromSelectList||{};var n=window.EB.Ballots.hiddenWriteFromSelectList,r=(0,o.T)();r&&(this.form=this.selectInputTarget.form.addEventListener("change",this.handleFormChange.bind(this)),this.$selectInput=r(this.selectInputTarget),this.answerLimit=e.answerLimit,this.allowShuffle=e.allowShuffle,this.searchSeed=e.searchSeed,this.containerTarget.classList.contains("js_hidden_writein")?(n["question_".concat(t)]=n["question_".concat(t)]||[],n["question_".concat(t)].push(this.setupInput.bind(this))):this.setupInput())}},{key:"setupInput",value:function(){({candidate_names:this.setupSelectInput.bind(this),sample_candidate_names:this.setupSampleSelectInput.bind(this)})[this.containerTarget.dataset.listToUse](this.selectInputTarget)}},{key:"setupSelectInput",value:function(){var e=this;this.$selectInput.select2({allowClear:!0,ajax:{url:this.containerTarget.dataset.url,dataType:"json",delay:250,data:function(t){return{term:t.term,page:t.page||1,answer_limit:e.answerLimit,allow_shuffle:e.allowShuffle,search_seed:e.searchSeed,per_page:10}},processResults:function(e,t){return e.results.map(function(e){return e.id=e.text}),t.page=t.page||1,t.per_page=t.per_page||10,{results:e.results,pagination:{more:t.page*t.per_page<e.meta.total}}}}}).on("select2:select",this.handleSelectionMade.bind(this))}},{key:"handleSelectionMade",value:function(e){this.syncAnswerDraft(),this.containerTarget.querySelector("td:last-child").textContent.trim()&&e.target.value&&this.hasCheckboxTarget&&!this.checkboxTarget.checked&&this.checkboxTarget.click()}},{key:"syncAnswerDraft",value:function(){"true"===this.selectInputTarget.dataset.collectAnswerData&&this.selectInputTarget.value&&this.selectInputTarget.dispatchEvent(new Event("change",{bubbles:!0}))}},{key:"handleFormChange",value:function(e){if(this.hasCheckboxTarget){var t=e.target;t.name==this.checkboxTarget.name&&"radio"==t.getAttribute("type")&&t!=this.checkboxTarget&&this.$selectInput.val(null).trigger("change")}}},{key:"setupSampleSelectInput",value:function(){var e={answer_limit:this.answerLimit,allow_shuffle:this.allowShuffle};this.allowShuffle&&(e.search_seed=this.searchSeed),Rails.ajax({url:this.containerTarget.dataset.url,type:"get",data:new URLSearchParams(Object.keys(e).map(function(t){return[t,e[t]]})),success:this.fetchSampleDataSuccess.bind(this)})}},{key:"changes",value:function(e){e.target.checked||this.$selectInput.val(null).trigger("change")}},{key:"fetchSampleDataSuccess",value:function(e){e.results.map(function(e){return e.id=e.text}),this.$selectInput.select2({allowClear:!0,data:e.results}).on("select2:select",this.handleSelectionMade.bind(this))}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["selectInput","container"],f.optionalTargets=["checkbox"]},6609:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEac
2h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},l.apply(null,arguments)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}n.r(t),n.d(t,{BaseController:function(){return p}});var p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,r=[{key:"dispatch",value:function(e,n){this.logger("@".concat(e),n);var r,i,a,u,c,s=o(o({},n),{},{prefix:""});return(r=t,i="dispatch",a=this,c=l(f(1&(u=3)?r.prototype:r),i,a),2&u&&"function"==typeof c?function(e){return c.apply(a,e)}:c)([e,s])}},{key:"logger",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#a2dbff";console.groupCollapsed("%c".concat(e),"color: ".concat(n,"; font-weight: bold;")),t&&console.log("details:",t),console.groupEnd()}}],r&&a(n.prototype,r),i&&a(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(n(5396).xI)},7943:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).initialFormState=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.initialFormState=this.serializeForm(this.formTarget),this.updateExtraMembersLimit(),this.checkFormModification()}},{key:"allowMultipleUsersSwitch",value:function(){this.allowMultipleMembersTarget.checked?(this.multipleMembersCountTarget.readOnly=!1,this.multipleMembersCountTarget.classList.remove("toolkit-text-field-input--readonly")):(this.multipleMembersCountTarget.value="1",this.multipleMembersCountTarget.readOnly=!0,this.multipleMembersCountTarget.classList.add("toolkit-text-field-input--readonly"))}},{key:"updateExtraMembersLimit",value:function(){""===this.multipleMembersCountTarget.value&&(this.multipleMembersCountTarget.value="1")}},{key:"onPricingAndBillingUnlimitedAllClick",value:function(){this.pricingAndBillingUnlimitedCheckboxTargets.forEach(function(e){e.checked=!0})}},{key:"serializeForm",value:function(e){return new URLSearchParams(new FormData(e)).toString()}},{key:"checkFormModification",value:function(){var e=this.serializeForm(this.formTarget);this.submitButtonTarget.disabled=this.initialFormState===e}},{key:"onEnableAllFeaturesClick",value:function(){this.featuresCheckboxTargets.forEach(function(e){e.checked=!0}),this.checkFormModification()}},{key:"onEnableAllUnlimitedPricingAndBillingClick",value:function(){console.log("Enabling all unlimited pricing and billing options"),this.pricingAndBillingUnlimitedCheckboxTargets.forEach(function(e){e.checked=!0}),this.checkFormModification()}},{key:"confirmPrimaryOrganizationChange",value:function(e){e.preventDefault(),alert("Changing the primary organization will affect all organizations under it. Some organizations may have votes in progress. Proceed with caution.")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["allowMultipleMembers","multipleMembersCount","pricingAndBillingUnlimitedCheckbox","featuresCheckbox","form","submitButton"]},4097:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.dispatchQuantityChanged()}},{key:"onChange",value:function(){this.dispatchQuantityChanged()}},{key:"dispatchQuantityChanged",value:function(){var e=parseInt(this.creditsSelectTarget.value,10)||0,t=e+1,n=this.selectedCreditsQuantity,r=t*this.pricePerPackCentsValue,o=this.formatDollars(r);this.dispatch("quantityChanged",{detail:{credits:e,quantity:t,lineLabel:"".concat(n," Extra voter credits"),totalCents:r,totalFormatted:o,linePriceFormatted:"$".concat(o)},bubbles:!0})}},{key:"formatDollars",value:function(e){return(e/100).toFixed(2)}},{key:"selectedCreditsQuantity",get:function(){var e,t=null===(e=this.creditsSelectTarget.selectedOptions)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.text;return parseInt(t||"0",10)||0}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["creditsSelect"],s.values={pricePerPackCents:Number}},4477:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"expand",value:function(e){this.itemsListTarget.querySelectorAll(".hidden").forEach(function(e){e.classList.remove("hidden")}),e.target instanceof HTMLElement&&e.target.remove()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={initialCount:Number},s.targets=["itemsList"]},9157:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"disconnect",value:function(){document.querySelectorAll(".discount-coupon--link-component")[0].style.display="none"}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI)},9543:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"enableSubmit",value:function(e){this.submitButtonTarget.disabled=!this.surveyCompleted()}},{key:"surveyCompleted",value:function(){return this.dateSelectTarget.value.length>0&&this.frequencySelectTarget.value.length>0}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["dateSelect","frequencySelect","submitButton"]},7212:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this,t=(0,o.T)();t&&(this.$form=t(this.formTarget),t(".existing_download_modal").remove(),t("#download_multiple_reports_modal_component").modal().addClass("existing_download_modal"),this.$buttons=this.$form.find(".btn"),this.$reportCheckboxes=this.$form.find(".report_type_checkbox").on("change",this.handleCheckBoxChange.bind(this)),this.$form.on("submit",this.handleFormSubmit().bind(this)),this.$fomatInput=t(this.formatInputTarget),t(this.csvButtonTarget).on("click",function(){e.$fomatInput.val("csv")}),t(this.excelButtonTarget).on("click",function(){e.$fomatInput.val("xls")}),this.handleCheckBoxChange())}},{key:"handleCheckBoxChange",value:function(){var e=!this.$reportCheckboxes.is(":checked");this.$buttons=this.$form.find(".btn").prop("disabled",e)}},{key:"handleFormSubmit",value:function(){var e=this;return function(){e.formTarget.submit()}}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["form","formatInput","csvButton","excelButton"]},616:function(e,t,n){"use strict";function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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 a,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.element.addEventListener("turbo:submit-end",function(t){t.detail.success&&e.reload_location(t)}),this.remove_old_modal()}},{key:"enableSubmitButton",value:function(e){this.submitButtonTarget.disabled=!1}},{key:"reload_location",value:function(e){location.reload()}},{key:"remove_old_modal",value:function(){var e,t=r(document.getElementsByClassName("add-to-vote-box-component"));try{for(t.s();!(e=t.n()).done;){var n=e.value;"none"===n.style.display&&n.remove()}}catch(o){t.e(o)}finally{t.f()}}}])&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.targets=["submitButton"]},3922:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"showColorPicker",value:function(){this.customizeColorsCheckboxTarget.checked?this.pickColorsTarget.classList.remove("hide"):(this.pickColorsTarget.classList.add("hide"),this.orangeCheckboxTarget.checked=!0,this.buttonColorTarget.className="btn btn--orange",this.textColorTarget.className="orange-text")}},{key:"showOrange",value:function(){this.buttonColorTarget.className="btn btn--orange",this.textColorTarget.className="orange-text"}},{key:"showBlue",value:function(){this.buttonColorTarget.className="btn btn--dark-blue",this.textColorTarget.className="dark-blue-text"}},{key:"showGreen",value:function(){this.buttonColorTarget.className="btn btn--green",this.textColorTarget.className="green-text"}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["orangeCheckbox","pickColors","customizeColorsCheckbox","buttonColor","textColor"]},466:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"enableProxyDefinitionOptions",value:function(){this.proxyDefinitionCheckboxTarget.checked?(this.proxyDefinitionOptionsTarget.classList.remove("hide"),this.checkDefaultRadioInput()):(this.proxyDefinitionOptionsTarget.classList.add("hide"),this.defaultRadioTarget.checked=!0)}},{key:"checkDefaultRadioInput",value:function(){this.administratorRadioTarget.disabled?this.administratorOnlyRadioTarget.checked=!0:this.administratorRadioTarget.checked=!0}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["proxyDefinitionOptions","proxyDefinitionCheckbox","defaultRadio","administratorRadio","administratorOnlyRadio"]},7199:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).lastSavedValue="",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.lastSavedValue=this.textFieldTarget.value}},{key:"handleEditIcon",value:function(){this.hideEditIcon(),this.textFieldTarget.select()}},{key:"showEditIcon",value:function(){this.editIconTarget.style.visibility="visible"}},{key:"hideEditIcon",value:function(){this.editIconTarget.style.visibility="hidden"}},{key:"submitOnChange",value:function(){var e=this.textFieldTarget.value;if(e!==this.lastSavedValue){this.lastSavedValue=e;var t=this.textFieldTarget.closest("form");t&&("undefined"!==typeof window.Rails?window.Rails.fire(t,"submit"):t.requestSubmit())}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["editIcon","textField"]},4197:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"handleEditIcon",value:function(){this.hideEditIcon(),this.textFieldTarget.select()}},{key:"showEditIcon",value:function(){this.editIconTarget.style.visibility="visible"}},{key:"hideEditIcon",value:function(){this.editIconTarget.style.visibility="hidden"}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["editIcon","textField"]},3818:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).questionsObserver=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.observeQuestions()}},{key:"disconnect",value:function(){var e;null===(e=this.questionsObserver)||void 0===e||e.disconnect()}},{key:"toggle",value:function(){if(this.hasManageLinkTarget){var e=this.checkboxTarget.checked;this.manageLinkTarget.classList.toggle("hide",!e)}}},{key:"observeQuestions",value:function(){var e=this,t=document.getElementById("questions");t&&(this.updateQuestionsVisibility(t),this.questionsObserver=new MutationObserver(function(){e.updateQuestionsVisibility(t)}),this.questionsObserver.observe(t,{childList:!0}))}},{key:"updateQuestionsVisibility",value:function(e){var t=e.querySelectorAll(".question").length>0;this.hasManageButtonTarget&&this.manageButtonTarget.classList.toggle("hide",!t),this.hasEmptyMessageTarget&&this.emptyMessageTarget.classList.toggle("hide",t)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["manageLink","checkbox","manageButton","emptyMessage"]},5778:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return _}});var r=n(5396);function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function d(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var p=0;function h(e){return"__private_"+p+++"_"+e}var v=function(){return window.NProgress},y=h("getAllCheckboxes"),m=h("showProcessingStatusMessage"),b=h("showFailureMessage"),g=h("startProgress"),w=h("stopProgress"),_=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=c(this,t,[].concat(r)),Object.defineProperty(e,w,{value:S}),Object.defineProperty(e,g,{value:j}),Object.defineProperty(e,b,{value:k}),Object.defineProperty(e,m,{value:T}),Object.defineProperty(e,y,{value:O}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.verifyInProgressCopyVoters()}},{key:"switchAllSelections",value:function(e){var t=e.target.checked;
2d(this,y)[y]().forEach(function(e){e.checked=t}),this.changeSubmitButtonDisableAttribute(!t)}},{key:"switchCheckbox",value:function(e){var t=d(this,y)[y]().some(function(e){return e.checked});this.changeSubmitButtonDisableAttribute(!t)}},{key:"submit",value:function(e){var t=this;e.preventDefault();var n=this.getAllSelectedTargetElectionsIds();Rails.ajax({type:"post",url:"/elections/".concat(this.sourceElectionId,"/voter_list/copy/copies"),data:new URLSearchParams(n.map(function(e){return["target_election_ids[]",e]})).toString(),success:function(e){t.initCopyVotersStatusCheck()},error:function(e){d(t,b)[b]()}})}},{key:"sourceElectionId",get:function(){return this.sourceElectionIdTarget.value}},{key:"processingStatusMessageClass",set:function(e){return this.statusMessageOutputTarget.className=e}},{key:"processingStatusMessageText",set:function(e){return this.statusMessageOutputTarget.textContent=e}},{key:"changeSubmitButtonDisableAttribute",value:function(e){this.submitButtonTarget.disabled=e}},{key:"getAllSelectedTargetElectionsIds",value:function(){return d(this,y)[y]().filter(function(e){return e.checked}).map(function(e){return e.value})}},{key:"scheduleCopyVotersStatusCheck",value:function(){var e=this;Rails.ajax({type:"get",url:"/elections/".concat(this.sourceElectionId,"/voter_list/copy/copies/status"),success:function(t){t&&t.done?(d(e,m)[m](t),d(e,w)[w]()):setTimeout(function(){e.scheduleCopyVotersStatusCheck()},500)},error:function(t){d(e,w)[w](),d(e,b)[b]()}})}},{key:"verifyInProgressCopyVoters",value:function(){var e=this;Rails.ajax({type:"get",url:"/elections/".concat(this.sourceElectionId,"/voter_list/copy/copies/status"),success:function(t){0!==Object.entries(t).length&&t&&!t.done&&e.initCopyVotersStatusCheck()}})}},{key:"initCopyVotersStatusCheck",value:function(){d(this,g)[g](),this.processingStatusMessageClass="message",this.processingStatusMessageText="",this.scheduleCopyVotersStatusCheck()}},{key:"toggleIncompatibleElections",value:function(e){var t=this.incompatibleElectionsDivTarget.classList.toggle("hide");e.target.textContent=t?"view details":"hide details"}}],r&&a(n.prototype,r),o&&a(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);function O(){return o(document.querySelectorAll('#copy-voter-list-page-component table tbody input[type="checkbox"]'))}function T(e){e.error?d(this,b)[b]():(this.processingStatusMessageClass="message message--success",this.processingStatusMessageText="Copy completed!")}function k(){this.processingStatusMessageClass="message message--error",this.processingStatusMessageText="Copy Failed."}function j(){var e,t;null===(e=v())||void 0===e||e.configure({parent:"#copy-voter-list-page-component"}),null===(t=v())||void 0===t||t.start()}function S(){var e,t;null===(e=v())||void 0===e||e.done(),null===(t=v())||void 0===t||t.configure({parent:"body"})}_.targets=["sourceElectionId","submitButton","statusMessageOutput","incompatibleElectionsDiv"]},4492:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this,t=new Date(this.currentTimeTarget.value),n=new Date(this.timerEndDateTarget.value).getTime()/1e3-t.getTime()/1e3,r=setInterval(function(){var t=parseInt(n/60,10),o=parseInt(n%60,10);n--,t=t<10?"0"+t:t,o=o<10?"0"+o:o,e.countdownTimerTarget.textContent=t+":"+o,n<0&&(clearInterval(r),e.countdownTimerTarget.textContent="00:00",e.blinkElement(e.countdownTimerTarget,e.countdownTimerComponentTarget))},1e3)}},{key:"blinkElement",value:function(e,t){var n=0,r=setInterval(function(){e.style.visibility="hidden"==e.style.visibility?"":"hidden",10===n++&&(clearInterval(r),t.style.visibility="hidden")},1e3)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["currentTime","timerEndDate","countdownTimer","countdownTimerComponent"]},253:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"changeSelectedOrganization",value:function(e){var t=this.selectInputTarget.value,n=document.querySelector("#edit_org_link"),r=document.querySelector("#election_primary_contact > a"),o=document.querySelector(".organization-location > a");this.updateLinkHref(this.editButtonTarget,t),this.updateLinkHref(n,t),this.updateLinkHref(r,t),this.updateLinkHref(o,t),this.updateCurrentOrganization(t)}},{key:"updateCurrentOrganization",value:function(e){if(e){var t=this.getElectionDurationType();if("calendar_range"===t){var n=document.querySelector('input[name="election[start_date]"]'),r=document.querySelector('input[name="election[end_date]"]'),o=new URLSearchParams({organization_id:e,start_date:(null===n||void 0===n?void 0:n.value)||"",end_date:(null===r||void 0===r?void 0:r.value)||"",duration_type:t||""}),i="/elections/refresh_date_formats?".concat(o.toString()),a=document.getElementById("voting_time_form");a&&"src"in a&&(a.dataset.orgRefreshed="true",a.src=i)}}}},{key:"getElectionDurationType",value:function(){var e=document.querySelector('input[name="election[duration_type]"]:checked');return(null===e||void 0===e?void 0:e.value)||null}},{key:"updateLinkHref",value:function(e,t){if(e){var n=e.getAttribute("href");n=n.replace(/\d+/,t),e.setAttribute("href",n)}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["selectInput","editButton"]},5595:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"clickRemoveButton",value:function(e){e.preventDefault();var t=(0,o.T)();t&&t("#election_vote_box_id").val("")}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},333:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(6923);function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw i}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=window.location.search,t=new URLSearchParams(e).get("vote_type");if(document.querySelectorAll(".elections.new").length){var n=this.element.closest("turbo-frame");"true"===(null===n||void 0===n?void 0:n.dataset.orgRefreshed)?delete n.dataset.orgRefreshed:"motion"===t?this.timerRadioButtonTarget.click():this.calendarRangeRadioButtonTarget.click()}this.setupDateTimeValidation()}},{key:"setupDateTimeValidation",value:function(){var e=this,t=this.startDatePickerTarget.querySelector(":scope .toolkit-date-picker__input"),n=this.endDatePickerTarget.querySelector(":scope .toolkit-date-picker__input");t&&n&&(t.addEventListener("change",function(){setTimeout(function(){e.updateEndDateMinimum(t,n),e.filterEndTimeOptions()},100)}),n.addEventListener("change",function(){setTimeout(function(){return e.filterEndTimeOptions()},100)}),n.addEventListener("focus",function(){n.value&&!e.parseDateTimeString(n.value)||setTimeout(function(){e.updateEndDateMinimum(t,n),e.filterEndTimeOptions()},50)}),t.value&&setTimeout(function(){return e.updateEndDateMinimum(t,n)},100),new MutationObserver(function(t){var n,r=i(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;"childList"===o.type&&o.addedNodes.length>0&&Array.from(o.addedNodes).some(function(e){var t,n,r;return e instanceof HTMLElement&&((null===(t=e.classList)||void 0===t?void 0:t.contains("toolkit-date-picker__time"))||(null===(n=e.classList)||void 0===n?void 0:n.contains("picker__box"))||(null===(r=e.querySelector)||void 0===r?void 0:r.call(e,".toolkit-date-picker__time")))})&&setTimeout(function(){e.filterEndTimeOptions(),e.attachTimeSelectListeners()},100)}}catch(a){r.e(a)}finally{r.f()}}).observe(document.body,{childList:!0,subtree:!0}))}},{key:"attachTimeSelectListeners",value:function(){var e=this,t=document.querySelector(".picker--opened .toolkit-date-picker__time");if(t){var n=t.querySelector('select[aria-label="Hour"]'),r=t.querySelector('select[aria-label="Minutes"]'),o=t.querySelector('select[aria-label="AM or PM"]');n&&!n.dataset.listenerAttached&&(n.addEventListener("change",function(){setTimeout(function(){return e.filterEndTimeOptions()},50)}),n.dataset.listenerAttached="true"),r&&!r.dataset.listenerAttached&&(r.addEventListener("change",function(){setTimeout(function(){return e.filterEndTimeOptions()},50)}),r.dataset.listenerAttached="true"),o&&!o.dataset.listenerAttached&&(o.addEventListener("change",function(){setTimeout(function(){return e.filterEndTimeOptions()},50)}),o.dataset.listenerAttached="true")}}},{key:"filterEndTimeOptions",value:function(){var e=this.startDatePickerTarget.querySelector(":scope .toolkit-date-picker__input"),t=this.endDatePickerTarget.querySelector(":scope .toolkit-date-picker__input");if(null!==e&&void 0!==e&&e.value&&null!==t&&void 0!==t&&t.value){var n=this.parseDateTimeString(e.value),r=this.parseDateTimeString(t.value);n&&r&&(n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()?this.filterTimeSelects(n):this.restoreAllTimeOptions())}}},{key:"filterTimeSelects",value:function(e){var t=null,n=this.endDatePickerTarget.querySelector(".picker");if(n&&(t=n.querySelector(".toolkit-date-picker__time")),!t){var r=document.querySelector(".picker--opened");r&&(t=r.querySelector(".toolkit-date-picker__time"))}if(!t)for(var o=document.querySelectorAll(".picker"),i=0,a=Array.from(o);i<a.length;i++){var u=a[i];if(null!==u.offsetParent){var c=u.querySelector(".toolkit-date-picker__time");if(c){t=c;break}}}if(t){var s=t.querySelector('select[aria-label="Hour"]'),l=t.querySelector('select[aria-label="Minutes"]'),f=t.querySelector('select[aria-label="AM or PM"]');if(s&&l){var d=null===f,p=e.getHours(),h=e.getMinutes(),v=s.value,y=parseInt(v)||0,m=null===f||void 0===f?void 0:f.value;
2if(d){if(Array.from(s.options).forEach(function(e){var t=parseInt(e.value)<p;e.disabled=t,e.style.display=t?"none":""}),y<p){var b=Array.from(s.options).find(function(e){return!e.disabled&&parseInt(e.value)>=p});b&&(s.value=b.value)}var g=parseInt(s.value)||0;if(g===p){if(Array.from(l.options).forEach(function(e){var t=parseInt(e.value)<=h;e.disabled=t,e.style.display=t?"none":""}),(parseInt(l.value)||0)<=h){var w=Array.from(l.options).find(function(e){return!e.disabled&&parseInt(e.value)>h});w&&(l.value=w.value)}}else g>p&&this.restoreOptions(l)}else{var _=this.toHour12(p),O=p>=12?"PM":"AM";if(f&&(Array.from(f.options).forEach(function(e){var t="PM"===O&&"AM"===e.value;e.disabled=t,e.style.display=t?"none":""}),"PM"===O&&"AM"===m&&(f.value="PM",f.dispatchEvent(new Event("change",{bubbles:!0})))),((null===f||void 0===f?void 0:f.value)||m)===O){Array.from(s.options).forEach(function(e){var t,n=parseInt(e.value);t=(12===n?0:n)<(12===_?0:_),e.disabled=t,e.style.display=t?"none":""});var T=parseInt(s.value),k=Array.from(s.options).find(function(e){return parseInt(e.value)===T});if(null!==k&&void 0!==k&&k.disabled){var j=Array.from(s.options).find(function(e){return!e.disabled});j&&(s.value=j.value)}if(parseInt(s.value)===_){if(Array.from(l.options).forEach(function(e){var t=parseInt(e.value)<=h;e.disabled=t,e.style.display=t?"none":""}),(parseInt(l.value)||0)<=h){var S=Array.from(l.options).find(function(e){return!e.disabled&&parseInt(e.value)>h});S&&(l.value=S.value)}}else this.restoreOptions(l)}else this.restoreOptions(s),this.restoreOptions(l)}}}}},{key:"filterOptions",value:function(e,t){if(e.value,Array.from(e.options).forEach(function(e){var n=t(e.value);e.disabled=!n,e.style.display=n?"":"none"}),e.value&&!t(e.value)){var n=Array.from(e.options).find(function(e){return!e.disabled});n&&(e.value=n.value,e.dispatchEvent(new Event("change",{bubbles:!0})))}}},{key:"restoreOptions",value:function(e){Array.from(e.options).forEach(function(e){e.disabled=!1,e.style.display=""})}},{key:"restoreAllTimeOptions",value:function(){var e=this,t=document.querySelector(".picker--opened .toolkit-date-picker__time");t&&t.querySelectorAll("select").forEach(function(t){return e.restoreOptions(t)})}},{key:"toHour12",value:function(e){var t=e%12;return 0===t&&(t=12),t}},{key:"updateEndDateMinimum",value:function(e,t){if(e.value){var r=this.parseDateTimeString(e.value);if(r){var i=this.endDatePickerTarget.querySelector(":scope .datepicker_input");if(i){var a=(0,o.T)();if(a){var u=a(i);try{var c=u.pickadate("picker");if(c&&"function"===typeof c.set){var s=t.value,l=this.parseDateTimeString(s);l&&l>=r?(c.set("min",[r.getFullYear(),r.getMonth(),r.getDate()],{muted:!0}),t.value!==s&&(t.value=s)):(!l||l<r)&&c.set("min",[r.getFullYear(),r.getMonth(),r.getDate()],{muted:!0})}}catch(n){}}}}}}},{key:"parseDateTimeString",value:function(e){var t=this.element.querySelector("[data-date-format]"),n=null===t||void 0===t?void 0:t.getAttribute("data-date-format"),r=null===t||void 0===t?void 0:t.getAttribute("data-time-format");if(!n||!r)return null;var o,i=n.match(/[-\/\s,. ]/),a=(i&&i[0],n.split(/[-\/\s,.]+/).filter(function(e){return e.length>0})),u=1,c={},s=a.map(function(e){return"DD"===e||"D"===e?(c[u]="day",u++,"(\\d{1,2})"):"MM"===e||"M"===e?(c[u]="month_num",u++,"(\\d{1,2})"):"MMMM"===e?(c[u]="month_name",u++,"(\\w+)"):"MMM"===e?(c[u]="month_abbr",u++,"(\\w+)"):"YYYY"===e||"YY"===e?(c[u]="year",u++,"(\\d{2,4})"):e}).join("[\\s,\\/.-]+");"HH:mm"===r?(o="(\\d{1,2}):(\\d{2})",c[u]="hour",c[u+1]="minute",u+=2):(o="(\\d{1,2}):(\\d{2})\\s+(AM|PM)",c[u]="hour",c[u+1]="minute",c[u+2]="ampm",u+=3);var l,f,d,p,h,v,y=new RegExp("^".concat(s,"\\s+").concat(o,"$")),m=e.match(y);if(!m)return null;for(var b=["January","February","March","April","May","June","July","August","September","October","November","December"],g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=1;w<m.length;w++){var _=c[w],O=m[w];switch(_){case"day":l=parseInt(O,10);break;case"month_num":f=parseInt(O,10)-1;break;case"month_name":-1===(f=b.indexOf(O))&&(f=void 0);break;case"month_abbr":-1===(f=g.indexOf(O))&&(f=void 0);break;case"year":(d=parseInt(O,10))<100&&(d+=d<50?2e3:1900);break;case"hour":p=parseInt(O,10);break;case"minute":h=parseInt(O,10);break;case"ampm":v=O}}return void 0===l||void 0===f||void 0===d||void 0===p||void 0===h?null:(v&&("PM"===v&&12!==p&&(p+=12),"AM"===v&&12===p&&
2(p=0)),new Date(d,f,l,p,h))}},{key:"enableTimerOptions",value:function(){this.operationalTimerDurationMinutesInputTarget.disabled=!1,this.operationalTimerDurationSecondsInputTarget.disabled=!1,this.timerOptionsTarget.classList.remove("hide"),this.calendarOptionsTarget.classList.add("hide")}},{key:"enableCalendarOptions",value:function(){this.calendarOptionsTarget.classList.remove("hide"),this.timerOptionsTarget.classList.add("hide"),this.operationalTimerDurationMinutesInputTarget.disabled=!0,this.operationalTimerDurationMinutesInputTarget.value="03",this.operationalTimerDurationSecondsInputTarget.disabled=!0,this.operationalTimerDurationSecondsInputTarget.value="00",this.virtualTimerDurationMinutesInputTarget.value="03",this.virtualTimerDurationSecondsInputTarget.value="00"}},{key:"textIntoStartDateField",value:function(e){e.preventDefault(),e.stopPropagation();var t=e.target.textContent.trim(),n=this.startDatePickerTarget.querySelector(":scope .toolkit-date-picker__input"),r=this.startDatePickerTarget.querySelector(':scope input[type="hidden"]');if(n){var o=chrono.parseDate(t);if(o){var i=this.formatDateForInput(o);n.value=i,r&&(r.value=this.formatDateTimeForRails(o)),n.dispatchEvent(new Event("change",{bubbles:!0}));var a=this.endDatePickerTarget.querySelector(":scope .toolkit-date-picker__input");a&&this.updateEndDateMinimum(n,a)}else n.value=t}}},{key:"textIntoEndDateField",value:function(e){e.preventDefault(),e.stopPropagation();var t=e.target.textContent.trim(),n=this.endDatePickerTarget.querySelector(":scope .toolkit-date-picker__input"),r=this.endDatePickerTarget.querySelector(':scope input[type="hidden"]');if(n){var o=chrono.parseDate(t);if(o){var i=this.formatDateForInput(o);n.value=i,r&&(r.value=this.formatDateTimeForRails(o)),n.dispatchEvent(new Event("change",{bubbles:!0}))}else n.value=t}}},{key:"toggleVirtualTimerOptions",value:function(){this.virtualTimerDurationMinutesInputTarget.toggleAttribute("disabled"),this.virtualTimerDurationSecondsInputTarget.toggleAttribute("disabled")}},{key:"mirrorOperationalTimerMinutesToVirtualTimerMinutes",value:function(){this.virtualTimerDurationMinutesInputTarget.value=this.operationalTimerDurationMinutesInputTarget.value}},{key:"mirrorOperationalTimerSecondsToVirtualTimerSeconds",value:function(){this.virtualTimerDurationSecondsInputTarget.value=this.operationalTimerDurationSecondsInputTarget.value}},{key:"formatDateTimeForRails",value:function(e){var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),o=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r," ").concat(o,":").concat(i,":").concat(a)}},{key:"formatDateForInput",value:function(e){var t,n=this.element.querySelector("[data-date-format]"),r=null===n||void 0===n?void 0:n.getAttribute("data-date-format"),o=null===n||void 0===n?void 0:n.getAttribute("data-time-format");if(r){var i=e.getDate(),a=e.getMonth()+1,u=e.getFullYear(),c=["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()],s=String(i).padStart(2,"0"),l=String(a).padStart(2,"0"),f=String(u);t=r.replace("MMMM",c).replace("DD",s).replace("MM",l).replace("YYYY",f).replace("D",String(i))}else t="".concat(["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()]," ").concat(e.getDate(),", ").concat(e.getFullYear());if("HH:mm"===o){var d=e.getHours().toString().padStart(2,"0"),p=e.getMinutes().toString().padStart(2,"0");return"".concat(t," ").concat(d,":").concat(p)}var h=e.getHours(),v=h%12||12,y=h>=12?"PM":"AM",m=e.getMinutes().toString().padStart(2,"0");return"".concat(t," ").concat(v,":").concat(m," ").concat(y)}}])&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);p.targets=["operationalTimerDurationMinutesInput","operationalTimerDurationSecondsInput","virtualTimerDurationMinutesInput","virtualTimerDurationSecondsInput","timerOptions","calendarOptions","timerRadioButton","calendarRangeRadioButton","endD
2ateInput","startDateInput","startDatePicker","endDatePicker"]},2298:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.voterListUnusableForTest=parseInt(this.element.dataset.sourceVoterListLength,10)>6,this.voterListUnusableForTest&&this.isTestRadioTarget.checked&&(this.copyVoterListCheckboxTarget.checked=!1,this.copyVoterListCheckboxTarget.disabled=!0)}},{key:"updateForm",value:function(e){this.voterListUnusableForTest&&(e.target.checked&&"true"===e.target.value?(this.previousCopyVoterListCheckboxValue=this.copyVoterListCheckboxTarget.checked,this.copyVoterListCheckboxTarget.checked=!1,this.copyVoterListCheckboxTarget.disabled=!0,this.cantBeCopiedHelpTextTarget.classList.remove("hidden")):(this.copyVoterListCheckboxTarget.checked=this.previousCopyVoterListCheckboxValue,this.copyVoterListCheckboxTarget.disabled=!1,this.cantBeCopiedHelpTextTarget.classList.add("hidden")))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["copyVoterListCheckbox","cantBeCopiedHelpText","isTestRadio"]},9490:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){var e=this,t=(0,o.T)();if(t){var n=t(this.languageSelectTarget).select2();n.on("change",function(){e.redirectToLocale(n.val())})}else this.languageSelectTarget.addEventListener("change",function(){e.redirectToLocale(e.languageSelectTarget.value)})}},{key:"redirectToLocale",value:function(e){try{var t=new URL(window.location.href);t.searchParams.set("locale",e),window.location.href=t.href}catch(n){console.warn("Failed to update locale in URL, using fallback.",n),window.location.href=window.location.pathname+"?locale="+encodeURIComponent(e)}}}],r&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["languageSelect"]},444:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.element.addEventListener("turbo:submit-end",function(t){return e.handleSubmitResponse(t)})}},{key:"updateView",value:function(e){this.errorMessageTarget.classList.add("hide"),NProgress.start(),this.skipPersistenceInputTarget.value="true",this.formTarget.requestSubmit()}},{key:"selectMultiVoteWinnerDeclaration",value:function(e){"individual_thresholds"==this.multiVoteWinnerDeclarationSelectTarget.value?this.winnerDeclarationInputTarget.value="":this.winnerDeclarationInputTarget.value=this.multiVoteWinnerDeclarationSelectTarget.value,this.updateView()}},{key:"saveQuorumWinnersSettingsButton",value:function(e){e.preventDefault(),NProgress.start(),this.errorMessageTarget.classList.add("hide"),this.buttonsGroupContainerTarget.classList.add("hide"),this.skipPersistenceInputTarget.value="false",this.formTarget.requestSubmit()}},{key:"cancelQuorumWinnersSettingsButton",value:function(e){e.preventDefault(),NProgress.start(),window.top.location=this.pageSourceHiddenFieldTarget.value}},{key:"sanitizeTypedValue",value:function(e){var t=e.target;t&&(t.value=t.value.replace(/[^0-9]/g,""),t.classList.contains("percent-value")&&parseInt(t.value,10)>100&&(t.value="100"))}},{key:"handleSubmitResponse",value:function(e){"false"===this.skipPersistenceInputTarget.value?e.detail.success?window.top.location=this.pageSourceHiddenFieldTarget.value:(this.errorMessageTarget.classList.remove("hide"),this.buttonsGroupContainerTarget.classList.remove("hide"),NProgress.done()):NProgress.done()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["form","skipPersistenceInput","saveQuorumWinnersSettingsButton","cancelQuorumWinnersSettingsButton","pageSourceHiddenField","buttonsGroupContainer","errorMessage","multiVoteWinnerDeclarationSelect","winnerDeclarationInput"]},6162:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function f(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e,t,n){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}n.r(t),n.d(t,{default:function(){return y}});var y=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=d(this,t,[].concat(r))).voterListUnusableForTest=void 0,e.previousCopyVoterListCheckboxValue=void 0,e.mode="single",e.isDirty=!1,e.timerRelatedKeywords=/end date|countdown timer|voting duration/i,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;this.voterListUnusableForTest=parseInt(this.element.dataset.sourceVoterListLength,10)>5,this.voterListUnusableForTest&&this.isTestRadioTarget.checked&&(this.copyVoterListCheckboxTarget.checked=!1,this.copyVoterListCheckboxTarget.disabled=!0);var t=this.element.querySelector("form");if(t){t.querySelectorAll("input, textarea, select").forEach(function(t){t.addEventListener("input",function(){e.isDirty=!0})});var n=document.getElementById("multiple_duplicate_component");n&&n.addEventListener("handsontable-changed",function(){e.isDirty=!0});var r=document.getElementById("voting-time-form");r&&r.addEventListener("change",function(){document.dispatchEvent(new CustomEvent("revalidate-rows"))}),t.addEventListener("submit",function(){e.isDirty=!1}),window.addEventListener("beforeunload",function(t){e.isDirty&&t.preventDefault()})}}},{key:"updateForm",value:function(e){if(this.voterListUnusableForTest){var t,n=e.target;n.checked&&"true"===n.value?(this.previousCopyVoterListCheckboxValue=this.copyVoterListCheckboxTarget.checked,this.copyVoterListCheckboxTarget.checked=!1,this.copyVoterListCheckboxTarget.disabled=!0,this.cantBeCopiedHelpTextTarget.classList.remove("hidden")):(this.copyVoterListCheckboxTarget.checked=null!==(t=this.previousCopyVoterListCheckboxValue)&&void 0!==t&&t,this.copyVoterListCheckboxTarget.disabled=!1,this.cantBeCopiedHelpTextTarget.classList.add("hidden"))}}},{key:"toggleMode",value:function(){"single"===this.mode?(this.mode="multiple",this.showMultipleMode()):(this.mode="single",this.showSingleMode())}},{key:"handleError",value:function(e){var t=this,n=u(e.detail,3),r=n[0];if(n[1],n[2],this.errorMessageTarget.innerText="",this.errorMessageTarget.classList.add("hidden"),r.errors&&0!==r.errors.length){var o=[],a=new Set;
2r.errors.forEach(function(e){var n=e.errors.filter(function(e){return t.timerRelatedKeywords.test(e)}),r=e.errors.filter(function(e){return!t.timerRelatedKeywords.test(e)});r.length>0&&o.push(i(i({},e),{},{errors:r})),n.forEach(function(e){return a.add(e)})}),o.forEach(function(e){if("number"===typeof e.row&&Array.isArray(e.cols)){var n=e.errors.join(" || "),r=e.cols.map(function(t){return{row:e.row,col:t,message:n}});t.sendHighlightMultiple(r)}});var c=[o.map(function(e){var t=e.errors.join(" || ");return"number"===typeof e.row?"Row ".concat(e.row+1,": ").concat(t):t}).filter(Boolean).join("\n"),Array.from(a).join("\n")].filter(Boolean).join("\n");c&&(this.errorMessageTarget.innerText="Please fix the following errors:\n".concat(c),this.errorMessageTarget.classList.remove("hidden"))}}},{key:"handleGrowableRowErrors",value:function(e){var t,n,o=this,i=null!==(t=null===(n=e.detail)||void 0===n?void 0:n.errors)&&void 0!==t?t:[];if(0===i.length)return this.errorMessageTarget.innerText="",void this.errorMessageTarget.classList.add("hidden");var a=[],u=new Set;i.forEach(function(e){var t=e.row,n=e.message.split(" || "),r=n.filter(function(e){return!o.timerRelatedKeywords.test(e)}),i=n.filter(function(e){return o.timerRelatedKeywords.test(e)});r.length>0&&a.push("Row ".concat(t+1,": ").concat(r.join(" || "))),i.forEac
2h(function(e){return u.add(e)})});var c=[].concat(a,r(Array.from(u))).join("\n");this.errorMessageTarget.innerText="Please fix the following errors:\n".concat(c),this.errorMessageTarget.classList.remove("hidden")}},{key:"sendHighlightMultiple",value:function(e){document.dispatchEvent(new CustomEvent("highlight-multiple-cells",{detail:{cells:e}}))}},{key:"fillFirstRow",value:function(e){document.dispatchEvent(new CustomEvent("fill-first-row",{detail:{firstRow:e}}))}},{key:"addRows",value:function(){document.dispatchEvent(new CustomEvent("add-rows"))}},{key:"clearRows",value:function(){document.dispatchEvent(new CustomEvent("clear-rows"))}},{key:"showSingleMode",value:function(){this.multipleDuplicateElementsTarget.classList.add("hidden-table"),this.multipleDuplicateButtonsTarget.classList.add("hidden"),this.multipleDuplicateButtonsTableTarget.classList.add("hidden"),this.singleDuplicateElementsTarget.classList.remove("hidden"),this.singleDuplicateButtonsTarget.classList.remove("hidden"),this.toggleButtonTarget.textContent="Multiple Motions";var e=document.getElementById("duplicate_form");e&&(e.action="/votes/duplicate");var t=document.getElementById("multipleDuplicateTable");t&&(t.style.display="none"),this.isDirty=!1}},{key:"showMultipleMode",value:function(){this.singleDuplicateElementsTarget.classList.add("hidden"),this.singleDuplicateButtonsTarget.classList.add("hidden"),this.multipleDuplicateElementsTarget.classList.remove("hidden-table"),this.multipleDuplicateButtonsTarget.classList.remove("hidden"),this.multipleDuplicateButtonsTableTarget.classList.remove("hidden"),this.toggleButtonTarget.textContent="Single Motion",this.toggleButtonTarget.classList.add("hidden");var e=document.getElementById("duplicate_form");e&&(e.action="/votes/multiple_duplicate");var t=document.getElementById("multipleDuplicateTable");t&&(t.style.display=""),this.isDirty=!1;var n=document.getElementById("key_field"),r=document.getElementById("vote_title_field"),o=document.getElementById("ballot_question_field"),i={vote_key:n?n.value:"",vote_title:r?r.value:"",ballot_question_title:o?o.value:""};this.fillFirstRow(i)}}],o&&l(n.prototype,o),a&&l(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);y.targets=["copyVoterListCheckbox","cantBeCopiedHelpText","isTestRadio","errorMessage","toggleButton","singleDuplicateElements","singleDuplicateButtons","multipleDuplicateElements","multipleDuplicateButtons","multipleDuplicateButtonsTable"]},3446:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"filter",value:function(e){var t=e.currentTarget.dataset;if("false"===t.tally){e.preventDefault();var n=e.currentTarget.href,r=t.election;this._redirectIfAllowed(r,n)}}},{key:"_redirectIfAllowed",value:function(e,t){var n=this;Rails.ajax({type:"get",url:"/elections/".concat(e,"/secure_tally_results"),success:function(e){e.allow_redirect?window.location.replace(t):e.low_security_with_proxy?n._buildProxyModal(t,e.low_security_with_proxy):n._buildModal(e.votes_remaining,t,e.proxy_opened)}})}},{key:"_buildModal",value:function(e,t,n){var r=(0,o.T)();if(r){r("#result-locker-modal").remove();var i=this._createModalStructure(e,t,n);r("body").append(i),r("#result-locker-modal").modal()}}},{key:"_createModalStructure",value:function(e,t,n){var r=this._createProxyMessage(n);return'\n    <div id="result-locker-modal" class="modal">\n      <h3 class="template_error">Warning</h3>\n      <p>\n        '.concat(e,' voters have not voted. These voters may submit paper ballots.\n      </p>\n\n      <p class="template_error">\n        If results are viewed, no more paper ballots can be recorded by administrators\n      </p>\n      ').concat(r,'\n      <div class="actions">\n        <a class="btn btn--orange" rel="modal:close">Cancel</a>\n        <a class="btn btn--orange" href="').concat(t,'">Close Paper Ballot Entry and View Results</a>\n      </div>\n    </div>\n    ')}},{key:"_buildProxyModal",value:function(e,t){var n=(0,o.T)();if(n){n("#result-locker-proxy-modal").remove();var r=this._createProxyModalStructure(e,t);n("body").append(r),n("#result-locker-proxy-modal").modal()}}},{key:"_createProxyModalStructure",value:function(e,t){var n=this._createProxyMessage(t);return'\n    <div id="result-locker-proxy-modal" class="modal">\n      <h3 class="template_error">Warning</h3>\n      '.concat(n,'\n      <div class="actions">\n      <a class="btn btn--orange" rel="modal:close">Cancel</a>\n      <a class="btn btn--orange" href="').concat(e,'">Close Proxy Entry and View Results</a>\n    </div>\n    ')}},{key:"_createProxyMessage",value:function(e){return e?'\n            <p class="template_error">\n                This vote has proxy vote active. If the results are viewed, the administrator won\'t be able to record the proxy vote.\n            </p>\n        ':""}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},6748:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"filter",value:function(e){var t=e.currentTarget.dataset;if("false"===t.tally&&"true"===t.completed||"false"===t.tally&&"before"===t.viewable){e.preventDefault();var n=e.currentTarget.href,r=t.election;this._redirectIfAllowed(r,n)}}},{key:"_redirectIfAllowed",value:function(e,t){var n=this;Rails.ajax({type:"get",url:"/elections/".concat(e,"/secure_tally_results"),success:function(e){e.allow_redirect?window.location.replace(t):e.low_security_with_proxy?n._buildProxyModal(t,e.low_security_with_proxy):n._buildModal(e.votes_remaining,t,e.proxy_opened)}})}},{key:"_buildModal",value:function(e,t,n){var r=(0,o.T)();if(r){r("#result-locker-modal").remove();var i=this._createModalStructure(e,t,n);r("body").append(i),r("#result-locker-modal").modal()}}},{key:"_createModalStructure",value:function(e,t,n){var r=this._createProxyMessage(n);return'\n    <div id="result-locker-modal" class="modal">\n      <h3 class="template_error">Warning</h3>\n      <p>\n        '.concat(e,' voters have not voted. These voters may submit paper ballots.\n      </p>\n\n      <p class="template_error">\n        If results are viewed, no more paper ballots can be recorded by administrators\n      </p>\n      ').concat(r,'\n      <div class="actions">\n        <a class="btn btn--orange" rel="modal:close">Cancel</a>\n        <a class="btn btn--orange" href="').concat(t,'">Close Paper Ballot Entry and View Results</a>\n      </div>\n    </div>\n    ')}},{key:"_buildProxyModal",value:function(e,t){var n=(0,o.T)();if(n){n("#result-locker-proxy-modal").remove();var r=this._createProxyModalStructure(e,t);n("body").append(r),n("#result-locker-proxy-modal").modal()}}},{key:"_createProxyModalStructure",value:function(e,t){var n=this._createProxyMessage(t);return'\n    <div id="result-locker-proxy-modal" class="modal">\n      <h3 class="template_error">Warning</h3>\n      '.concat(n,'\n      <div class="actions">\n      <a class="btn btn--orange" rel="modal:close">Cancel</a>\n      <a class="btn btn--orange" href="').concat(e,'">Close Proxy Entry and View Results</a>\n    </div>\n    ')}},{key:"_createProxyMessage",value:function(e){return e?'\n            <p class="template_error">\n                This vote has proxy vote active. If the results are viewed, the administrator won\'t be able to record the proxy vote.\n            </p>\n        ':""}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},5884:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.tearoffCheckbox=this.element.querySelector("#include_ballot_tearoff"),this.ballotCheckbox=this.element.querySelector("#include_ballot_tearoff"),this.ballotCheckbox&&!this.ballotCheckbox.checked&&(this.tearoffCheckbox.checked=!1,this.tearoffCheckbox.disabled=!0)}},{key:"createSuccess",value:function(e){var t=this;this.noVotersMessageTarget.classList.add("hidden"),0!==e.detail[0].number_of_voters?(this.generatePDFTarget.classList.add("hidden"),this.downloadPDFTarget.classList.remove("hidden"),this.element.querySelectorAll("input").forEach(function(e){return e.disabled=!0}),window.NProgress.configure({parent:"#".concat(this.element.id)}),window.NProgress.set(0),this.scheduledCheck=function(){t.schedulePrintedNoticesURLCheck(e.detail[0])},this.scheduledCheck()):this.noVotersMessageTarget.classList.remove("hidden")}},{key:"ballotCheckClicked",value:function(e){this.tearoffCheckbox&&(e.target.checked?(this.tearoffCheckbox.checked=!1,this.tearoffCheckbox.disabled=!1,this.tearoffCheckbox.checked=this.tearoffCheckboxPreviousValue):(this.tearoffCheckboxPreviousValue=this.tearoffCheckbox.checked,this.tearoffCheckbox.checked=!1,this.tearoffCheckbox.disabled=!0))}},{key:"schedulePrintedNoticesURLCheck",value:function(e){var t=(0,o.T)();t&&t.get(e.printed_notices_path,this.parseNoticeProgressCheckResponse.bind(this))}},{key:"parseNoticeProgressCheckResponse",value:function(e){var t=e&&e.url||"",n=e&&e.progress||0;if(""!=t){this.element.classList.remove("window.NProgress-custom-parent"),window.NProgress.configure({parent:"body"}),window.NProgress.set(1);var r="window.open('"+t+"', '_blank'); return false",i=(0,o.T)();i&&i("#download_pdf").html('<button onclick="'+r+'" class="btn btn--orange">Download</button>')}else window.NProgress.set(n),setTimeout(this.scheduledCheck.bind(this),1e3)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["generatePDF","downloadPDF","form","noVotersMessage"]},8465:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}n.r(t),n.d(t,{default:function(){return d}});var d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"sort",value:(s=r().m(function e(t){var n,o,i,a,u,c,s,l,f,d,p,h,v,y;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),n=t.currentTarget,o=n.dataset,i=o.column,a=o.direction,u=o.turboFrame,i&&a&&u){e.n=1;break}return console.error("[question-results] Missing required data attributes"),e.a(2);case 1:if(c=document.getElementById(u)){e.n=2;break}return console.error("[question-results] Frame not found: ".concat(u)),e.a(2);case 2:return s=window.scrollY,(l=new URL(window.location.href)).searchParams.set("question_".concat(this.questionIdValue,"_sort_column"),i),l.searchParams.set("question_".concat(this.questionIdValue,"_sort_direction"),a),c.setAttribute("aria-busy","true"),e.p=3,e.n=4,fetch(l.toString(),{headers:{"Turbo-Frame":u}});case 4:if((f=e.v).ok){e.n=5;break}throw new Error("HTTP ".concat(f.status,": ").concat(f.statusText));case 5:return e.n=6,f.text();case 6:d=e.v,p=new DOMParser,h=p.parseFromString(d,"text/html"),(v=h.getElementById(u))?c.innerHTML=v.innerHTML:console.warn("[question-results] New frame not found in response: ".concat(u)),window.history.replaceState({},"",l.toString()),e.n=8;break;case 7:e.p=7,y=e.v,console.error("[question-results] Failed to sort results:",y);case 8:return e.p=8,c.removeAttribute("aria-busy"),window.scrollTo(0,s),e.f(8);case 9:return e.a(2)}},e,this,[[3,7,8,9]])}),l=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function a(e){i(o,n,r,a,u,"next",e)}function u(e){i(o,n,r,a,u,"throw",e)}a(void 0)})},function(e){return l.apply(this,arguments)})}],o&&a(n.prototype,o),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,u,s,l}(n(5396).xI);d.values={questionId:Number}},2829:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(3430);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.electionId=parseInt(this.electionIdTarget.value)}},{key:"toggle",value:function(e){if(this.obfuscationTarget.checked)return e.preventDefault();confirm("Showing the weighted vote by vote detail may allow linking of voters to their choices using the voting weights. This cannot be undone. Proceed?")?(o.A.post("/elections/".concat(this.electionId,"/obfuscation"),{},{headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').getAttribute("content")}}).then(function(){window.location.reload()}),this.obfuscationTarget.disabled=!0):e.preventDefault()}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["obfuscation","electionId"]},8278:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(7832);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).messageInterval=null,e.currentMessageIndex=0,e.subscription=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){}},{key:"disconnect",value:function(){this.stopMessageRotation(),this.unsubscribeFromTranslationProgress()}},{key:"show",value:function(){this.hasOverlayTarget&&(this.overlayTarget.classList.add("visible"),this.startMessageRotation(),this.subscription||this.subscribeToTranslationProgress())}},{key:"hide",value:function(){this.hasOverlayTarget&&(this.overlayTarget.classList.remove("visible"),this.stopMessageRotation())}},{key:"startMessageRotation",value:function(){var e=this;this.currentMessageIndex=0,this.updateMessage(),this.messageInterval=window.setInterval(function(){e.currentMessageIndex=(e.currentMessageIndex+1)%e.messagesValue.length,e.updateMessage()},3e3)}},{key:"stopMessageRotation",value:function(){this.messageInterval&&(clearInterval(this.messageInterval),this.messageInterval=null)}},{key:"updateMessage",value:function(){this.hasMessageTarget&&this.messagesValue.length>0&&(this.messageTarget.textContent=this.messagesValue[this.currentMessageIndex])}},{key:"subscribeToTranslationProgress",value:function(){var e=this;console.log("Subscribing to TranslationProgressChannel"),this.subscription=o.A.subscriptions.create("TranslationProgressChannel",{connected:function(){console.log("Connected to TranslationProgressChannel")},disconnected:function(){console.log("Disconnected from TranslationProgressChannel")},received:function(t){console.log("Received data from TranslationProgressChannel:",t),"translation_complete"!==t.type&&"translation_failed"!==t.type||e.handleTranslationComplete(t)}})}},{key:"unsubscribeFromTranslationProgress",value:function(){this.subscription&&(console.log("Unsubscribing from TranslationProgressChannel"),this.subscription.unsubscribe(),this.subscription=null)}},{key:"handleTranslationComplete",value:function(e){console.log("Translation complete, reloading page"),this.hide(),setTimeout(function(){window.location.reload()},500)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["overlay","message"],f.values={messages:Array}},6904:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}
2function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function l(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var f=0;function d(e){return"__private_"+f+++"_"+e}var p=d("focusAccessKeyInput"),h=d("syncCallback"),v=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=a(this,t,[].concat(r)),Object.defineProperty(e,h,{value:m}),Object.defineProperty(e,p,{value:y}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=l(this,h)[h]();e(),this.accessKeyInputTarget.addEventListener("input",e),this.passwordInputTarget.addEventListener("input",e),l(this,p)[p]()}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);function y(){var e=this;setTimeout(function(){e.hasAccessKeyInputTarget&&e.accessKeyInputTarget.focus()},10)}function m(){var e=this;return function(){e.submitTarget.disabled=0===e.accessKeyInputTarget.value.length||0===e.passwordInputTarget.value.length}}v.targets=["submit","accessKeyInput","passwordInput"]},2338:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return l(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(l(t={},r,function(){return this}),t),p=f.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,r,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,t,n,r){function i(t,n){l(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},l(e,t,n,r)}function f(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function p(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,u,"next",e)}function u(e){p(i,r,o,a,u,"throw",e)}a(void 0)})}}var v=function(){var e=h(s().m(function e(t){var n;return s().w(function(e){for(;;)switch(e.n){case 0:return n=[new ClipboardItem(f({},t.type,t))],e.n=1,navigator.clipboard.write(n);case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),y=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,r=[{key:"qrButtonClicked",value:function(e){var t=e.target;this.copyQrImageToClipBoard(this.qrImageTagTarget,t)}},{key:"copyQrImageToClipBoard",value:(u=h(s().m(function e(t,n){var r,o,i,a;return s().w(function(e){for(;;
2)switch(e.n){case 0:if(!(r=t.getAttribute("src"))){e.n=4;break}return e.n=1,fetch(r);case 1:return o=e.v,e.n=2,o.blob();case 2:return i=e.v,e.n=3,v(i);case 3:a=n.innerHTML,n.innerHTML="Copied!",setTimeout(function(){n.innerHTML=a},1e3);case 4:return e.a(2)}},e)})),function(e,t){return u.apply(this,arguments)})}],r&&o(n.prototype,r),a&&o(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,u}(r.xI);y.targets=["qrButton","qrImageTag"]},5616:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"handleDelayChange",value:function(){var e=this.kioskUrl();this.kioskLinkTarget.innerText=e,this.copyButtonTarget.setAttribute("data-text-to-copy",e);var t=new URL(this.qrCodeUrlValue,window.location.origin);t.searchParams.set("path",e),this.qrCodeFrameTarget.src=t.toString()}},{key:"launch",value:function(){window.location.assign(this.kioskUrl())}},{key:"kioskUrl",value:function(){var e=new URL(this.launchButtonTarget.getAttribute("data-kiosk-base-url"));return this.delaySelectTarget.value&&e.searchParams.append("delay",this.delaySelectTarget.value),e.toString()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["delaySelect","kioskLink","launchButton","copyButton","qrCodeFrame"],s.values={qrCodeUrl:String}},9610:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){}},{key:"toogleSecondayNav",value:function(){this.secondaryNavTarget.classList.toggle("visible"),this.secondaryNavButtonTarget.classList.toggle("open")}},{key:"tooglewMobileMenu",value:function(){this.headerNavTarget.classList.toggle("visible"),this.mobileMenuIconTarget.classList.toggle("open"),this.hideOverflow()}},{key:"hideOverflow",value:function(){document.querySelector("body").classList.toggle("hide-overflow")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["mobileMenuOverlay","secondaryNav","secondaryNavButton","headerNav","mobileMenuIcon"]},7786:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this,t=this.stickyBarTarget.offsetTop;window.onscroll=function(){return e.checkPageScroll(t)}}},{key:"checkPageScroll",value:function(e){window.scrollY>=e?this.stickyBarTarget.classList.add("sticky"):this.stickyBarTarget.classList.remove("sticky")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["stickyBar"]},2694:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.isContextLoaded()?this.clearContextRefreshAttemptedFlag():this.runMacWorkaroundIfNeeded()}},{key:"isContextLoaded",value:function(){return this.contextLoadedValue}},{key:"clearContextRefreshAttemptedFlag",value:function(){localStorage.getItem("zoomContextRefreshAttempted")&&localStorage.removeItem("zoomContextRefreshAttempted")}},{key:"setContextRefreshAttemptedFlag",value:function(){localStorage.setItem("zoomContextRefreshAttempted","true")}},{key:"hasAttemptedContextRefresh",value:function(){return"true"===localStorage.getItem("zoomContextRefreshAttempted")}},{key:"runMacWorkaroundIfNeeded",value:function(){this.macWorkaroundNeededValue&&(this.hasAttemptedContextRefresh()?(this.clearContextRefreshAttemptedFlag(),console.error("Zoom context still missing after refresh attempt")):(this.logger("Zoom Mac Workaround triggered",null,"#b526b0"),this.setContextRefreshAttemptedFlag(),setTimeout(function(){window.location.reload()},500)))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(6609).BaseController);s.targets=[],s.values={contextLoaded:Boolean,macWorkaroundNeeded:Boolean}},858:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(6609),o=n(3057),i=n(9422);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var a=r&&r.prototype instanceof s?r:s,l=Object.create(a.prototype);return u(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,u(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,u(p,"constructor",f),u(f,"constructor",l),l.displayName="GeneratorFunction",u(f,o,"GeneratorFunction"),u(p),u(p,o,"Generator"),u(p,r,function(){return this}),u(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:h}})()}function u(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,n,r){function i(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},u(e,t,n,r)}function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function f(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e,t,n){return t=v(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},h.apply(null,arguments)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}
2function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}var m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}(t,e),n=t,r=[{key:"connect",value:(w=s(a().m(function e(){return a().w(function(e){for(;;)switch(e.n){case 0:return this.runMacWorkaroundIfNeeded(),e.n=1,this.initializeZoom();case 1:return e.n=2,this.updateMeetingParticipants();case 2:this.setupListeners();case 3:return e.a(2)}},e,this)})),function(){return w.apply(this,arguments)})},{key:"inviteParticipants",value:(g=s(a().m(function e(){var t;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.hideErrorMessage(),this.disableInviteButton(),e.p=1,e.n=2,o.Ay.sendAppInvitationToAllParticipants();case 2:e.n=4;break;case 3:e.p=3,t=e.v,console.error(t),this.showErrorMessage("Something went wrong when inviting participants");case 4:return e.p=4,this.enableInviteButton(),e.f(4);case 5:return e.a(2)}},e,this,[[1,3,4,5]])})),function(){return g.apply(this,arguments)})},{key:"sendFocusAppMessage",value:(b=s(a().m(function e(){var t,n,r=this;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.hideErrorMessage(),this.disableStartVoteButton(),e.p=1,t={id:i.MESSAGES.FOCUS_APP},e.n=2,o.Ay.sendMessage({payload:t});case 2:this.logger("New message sent:",t),e.n=4;break;case 3:e.p=3,n=e.v,console.error(n),this.showErrorMessage("The configuration of the Zoom SDK encountered an error.");case 4:return e.p=4,setTimeout(function(){r.enableStartVoteButton()},1500),e.f(4);case 5:return e.a(2)}},e,this,[[1,3,4,5]])})),function(){return b.apply(this,arguments)})},{key:"sendUnfocusAppMessage",value:(m=s(a().m(function e(){var t,n,r=this;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.hideErrorMessage(),this.disableCloseWindowButton(),e.p=1,t={id:i.MESSAGES.UNFOCUS_APP},e.n=2,o.Ay.sendMessage({payload:t});case 2:this.logger("New message sent:",t),e.n=4;break;case 3:e.p=3,n=e.v,console.error(n),this.showErrorMessage("There was a problem to send unfocus message");case 4:return e.p=4,setTimeout(function(){r.enableCloseWindowButton()},1500),e.f(4);case 5:return e.a(2)}},e,this,[[1,3,4,5]])})),function(){return m.apply(this,arguments)})},{key:"runMacWorkaroundIfNeeded",value:function(){this.macWorkaroundNeededValue?localStorage.getItem("zoomContextRefreshAttempted")?(localStorage.removeItem("zoomContextRefreshAttempted"),console.error("Zoom context still missing after refresh attempt"),this.showErrorMessage("There was an error connecting to Zoom. Please restart the application.")):(localStorage.setItem("zoomContextRefreshAttempted","true"),setTimeout(function(){window.location.reload()},500)):localStorage.getItem("zoomContextRefreshAttempted")&&localStorage.removeItem("zoomContextRefreshAttempted")}},{key:"initializeZoom",value:(p=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,o.Ay.config({capabilities:this.hostCapabilities()});case 1:t=e.v,this.logger("Zoom JS SDK Configuration",t),e.n=3;break;case 2:e.p=2,n=e.v,console.error(n),this.showErrorMessage("There was an error configuring the Zoom SDK");case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return p.apply(this,arguments)})},{key:"hostCapabilities",value:function(){return["shareApp","sendAppInvitationToAllParticipants","bringAppToFront","sendMessage","onMessage","expandApp","sendAppToBackground","onSendAppInvitation","onParticipantChange","getMeetingParticipants"]}},{key:"getParticipantsCount",value:(f=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.Ay.getMeetingParticipants();case 1:return t=e.v,n=t.participants,e.a(2,n.length-1)}},e)})),function(){return f.apply(this,arguments)})},{key:"updateMeetingParticipants",value:(c=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.n){case 0:if(this.inMeetingValue){e.n=1;break}return e.a(2);case 1:return e.n=2,this.getParticipantsCount();case 2:t=e.v,n="Meeting Participants: ".concat(t,"/").concat(this.votersCountValue),this.participantsMessageTarget.textContent=n;case 3:return e.a(2)}},e,this)})),function(){return c.apply(this,arguments)})},{key:"setupListeners",value:function(){var e=this;o.Ay.onSendAppInvitation(function(t){e.logger("@onSendAppInvitation:",t)}),o.Ay.onParticipantChange(function(t){e.logger("@onParticipantChange:",t),e.updateMeetingParticipants()})}},{key:"logger",value:function(e,n){var r,o,i,a,u,c="[ZoomIntegration] ".concat(e);(r=t,o="logger",i=this,u=h(v(1&(a=3)?r.prototype:r),o,i),2&a&&"function"==typeof u?function(e){return u.apply(i,e)}:u)([c,n,"#b526b0"])}},{key:"enableInviteButton",value:function(){this.inviteButtonTarget.disabled=!1}},{key:"disableInviteButton",value:function(){this.inviteButtonTarget.disabled=!0}},{key:"enableStartVoteButton",value:function(){this.startVoteButtonTarget.disabled=!1}},{key:"disableStartVoteButton",value:function(){this.startVoteButtonTarget.disabled=!0}},{key:"enableCloseWindowButton",value:function(){this.closeWindowButtonTarget.disabled=!1}},{key:"disableCloseWindowButton",value:function(){this.closeWindowButtonTarget.disabled=!0}},{key:"showErrorMessage",value:function(e){this.errorMessageTarget.classList.remove("hide"),this.errorMessageTarget.textContent=e}},{key:"hideErrorMessage",value:function(){this.errorMessageTarget.classList.add("hide")}}],r&&l(n.prototype,r),u&&l(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u,c,f,p,m,b,g,w}(r.BaseController);m.targets=["inviteButton","errorMessage","startVoteButton","closeWindowButton","participantsMessage"],m.values={userHost:Boolean,inMeeting:Boolean,macWorkaroundNeeded:Boolean,votersCount:Number}},9422:function(e,t,n){"use strict";n.r(t),n.d(t,{MESSAGES:function(){return m},default:function(){return b}});var r=n(6609),o=n(3057);function i(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var a=r&&r.prototype instanceof s?r:s,l=Object.create(a.prototype);return u(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,u(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,u(p,"constructor",f),u(f,"constructor",l),l.displayName="GeneratorFunction",u(f,o,"GeneratorFunction"),u(p),u(p,o,"Generator"),u(p,r,function(){return this}),u(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:h}})()}function u(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,n,r){function i(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},u(e,t,n,r)}function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function f(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e,t,n){return t=v(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},h.apply(null,arguments)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}var m={FOCUS_APP:"focus_app",UNFOCUS_APP:"unfocus_app"},b=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}(t,e),n=t,r=[{key:"connect",value:(g=s(a().m(function e(){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.initializeZoom();case 1:this.setupListeners();case 2:return e.a(2)}},e,this)})),function(){return g.apply(this,arguments)})},{key:"initializeZoom",value:(b=s(a().m(function e(){var t,n;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,o.Ay.config({capabilities:this.guestCapabilites()});case 1:t=e.v,this.logger("Zoom JS SDK Configuration",t),e.n=3;break;case 2:e.p=2,n=e.v,console.error(n),this.showErrorMessage("There was an error configuring the Zoom SDK");case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return b.apply(this,arguments)})},{key:"guestCapabilites",value:function(){return["shareApp","onMessage","expandApp","bringAppToFront","sendAppToBackgroun
2d"]}},{key:"focusApp",value:(p=s(a().m(function e(){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.Ay.bringAppToFront();case 1:return e.n=2,o.Ay.expandApp({action:"expand"});case 2:return e.a(2)}},e)})),function(){return p.apply(this,arguments)})},{key:"unfocusApp",value:(f=s(a().m(function e(){return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.Ay.sendAppToBackground();case 1:return e.a(2)}},e)})),function(){return f.apply(this,arguments)})},{key:"handleMessage",value:(c=s(a().m(function e(t){var n,r,o;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=i(i({},m.FOCUS_APP,"focusApp"),m.UNFOCUS_APP,"unfocusApp"),r=n[t.id],e.p=1,this.hideErrorMessage(),e.n=2,this[r]();case 2:e.n=4;break;case 3:e.p=3,o=e.v,console.error(o),this.showErrorMessage("There was an error to process the message");case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return c.apply(this,arguments)})},{key:"setupListeners",value:function(){var e=this;o.Ay.onMessage(function(t){var n=t.timestamp,r=t.payload;e.logger("(".concat(n,") New message received:"),r),e.handleMessage(r)})}},{key:"logger",value:function(e,n){var r,o,i,a,u,c="[ZoomIntegration] ".concat(e);(r=t,o="logger",i=this,u=h(v(1&(a=3)?r.prototype:r),o,i),2&a&&"function"==typeof u?function(e){return u.apply(i,e)}:u)([c,n,"#b526b0"])}},{key:"showErrorMessage",value:function(e){this.errorMessageTarget.classList.remove("hide"),this.errorMessageTarget.textContent=e}},{key:"hideErrorMessage",value:function(){this.errorMessageTarget.classList.add("hide")}}],r&&l(n.prototype,r),u&&l(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u,c,f,p,b,g}(r.BaseController);b.targets=["errorMessage"],b.values={userHost:Boolean,inMeeting:Boolean}},9917:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"click",value:function(e){e.preventDefault(),this.meetsWindow&&!this.meetsWindow.closed?this.meetsWindow.focus():this.meetsWindow=window.open(this.linkTarget.href,this.linkTarget.target)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["link"]},9355:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}n.r(t),n.d(t,{default:function(){return d}});var d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=c(this,t,[].concat(r))).pollingInterval=null,e.POLLING_INTERVAL_MS=1e4,e.POLLING_ENABLED=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){this.POLLING_ENABLED?this.shouldPoll()&&this.startPolling():console.info("[MeetingsManager] Polling disabled - using Turbo Streams for real-time updates")}},{key:"disconnect",value:function(){this.stopPolling()}},{key:"shouldPoll",value:function(){return!!this.organizationKeyValue&&""!==this.organizationKeyValue}},{key:"startPolling",value:function(){var e=this;this.pollingInterval=window.setInterval(function(){e.fetchElections()},this.POLLING_INTERVAL_MS)}},{key:"stopPolling",value:function(){null!==this.pollingInterval&&(window.clearInterval(this.pollingInterval),this.pollingInterval=null)}},{key:"fetchElections",value:(s=r().m(function e(){var t,n,o,i;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,t="/m/".concat(this.organizationKeyValue),e.n=1,fetch(t,{headers:{Accept:"text/javascript","X-Requested-With":"XMLHttpRequest"}});case 1:if((n=e.v).ok){e.n=2;break}return console.error("Failed to fetch elections:",n.statusText),e.a(2);case 2:return e.n=3,n.text();case 3:o=e.v,this.updateContainer(o),e.n=5;break;case 4:e.p=4,i=e.v,console.error("Error fetching elections:",i);case 5:return e.a(2)}},e,this,[[0,4]])}),l=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function a(e){i(o,n,r,a,u,"next",e)}function u(e){i(o,n,r,a,u,"throw",e)}a(void 0)})},function(){return l.apply(this,arguments)})},{key:"updateContainer",value:function(e){this.containerTarget.innerHTML=e}}],o&&a(n.prototype,o),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,u,s,l}(n(5396).xI);d.targets=["container"],d.values={organizationKey:String}},2004:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r)))._observer=null,e._handlePageShow=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.filterVotedElections(),this.observeTurboStreamUpdates(),this.handleBFCacheRestore()}},{key:"disconnect",value:function(){this._observer&&(this._observer.disconnect(),this._observer=null),this._handlePageShow&&(window.removeEventListener("pageshow",this._handlePageShow),this._handlePageShow=null)}},{key:"filterVotedElections",value:function(){var e=this.votedKeysValue;this.element.querySelectorAll("[data-election-button]").forEach(function(t){var n=t,r=n.dataset.electionId;r&&e.length>0&&e.includes(parseInt(r,10))?n.style.display="none":n.style.display=""}),this.toggleEmptyState()}},{key:"toggleEmptyState",value:function(){var e=this.element.querySelectorAll("[data-election-button]"),t=Array.from(e).filter(function(e){return"none"!==e.style.display}),n=this.element.querySelector("[data-empty-state]");0!==t.length||n?t.length>0&&n&&n.remove():this.showEmptyState()}},{key:"showEmptyState",value:function(){this.element.insertAdjacentHTML("beforeend",'\n      <div id="meetings_manager_empty_state" data-empty-state>\n        When Meeting Votes are live, the buttons to access the voting process will appear here.\n      </div>\n    ')}},{key:"observeTurboStreamUpdates",value:function(){var e=this;this._observer=new MutationObserver(function(){e.filterVotedElections()}),this._observer.observe(this.element,{childList:!0,subtree:!0})}},{key:"handleBFCacheRestore",value:function(){this._handlePageShow=function(e){e.persisted&&window.location.reload()},window.addEventListener("pageshow",this._handlePageShow)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={votedKeys:Array}},8506:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;window.addEventListener("productfruits_ready",function(){window.productFruits.api.announcementsV2.listen("newsfeed-unread-count-changed",function(t){var n=t.count;n>
29?(e.badgeCounterTarget.style.visibility="visible",e.badgeCounterTarget.innerHTML="9+"):0==n?e.badgeCounterTarget.style.visibility="hidden":(e.badgeCounterTarget.style.visibility="visible",e.badgeCounterTarget.innerHTML=n)}),window.productFruits.api.announcementsV2.attachNewsWidgetToElement(e.bellIconTarget)})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["bellIcon","badgeCounter"]},8256:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=(0,o.T)();e&&e(this.formTarget).on("change",this.postFormToSaveChanges().bind(this))}},{key:"postFormToSaveChanges",value:function(){var e=this;return function(){Rails.fire(e.formTarget,"submit")}}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["form"]},2065:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){NProgress.done()}},{key:"connect",value:function(){var e=this;r(this.element.children).map(function(t){return e.activateScript(t)})}},{key:"disconnect",value:function(){var e=this;r(this.element.children).map(function(t){return e.removeScript(t)})}},{key:"removeScript",value:function(e){var t;"SCRIPT"===e.nodeName&&(null===(t=e.parentElement)||void 0===t||t.removeChild(e))}},{key:"activateScript",value:function(e){if("SCRIPT"===e.nodeName){var t=document.createElement("script");t.textContent=e.textContent,t.async=!1,this.copyElementAttributes(t,e),this.replaceElementWithElement(e,t)}}},{key:"replaceElementWithElement",value:function(e,t){var n=e.parentElement;if(n)return n.replaceChild(t,e)}},{key:"copyElementAttributes",value:function(e,t){for(var n=0,o=r(t.attributes);n<o.length;n++){var i=o[n],a=i.name,u=i.value;e.setAttribute(a,u)}}}])&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.targets=[]},6084:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(9403);function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=s(this,t,[].concat(r))).fields=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this;EB.Elections.Notifications.init(),this.initializeFields(),this.formTarget.addEventListener("turbo:submit-end",function(t){return e.handleSubmitResponse(t)})}},{key:"handleLanguageChange",value:function(e){e.preventDefault();var t=e.target.value,n=this.getElectionId(),r="/elections/".concat(n,"/notifications/new?notice_type=").concat(this.noticeTypeValue,"&type_of=result&language_code=").concat(t);o.V.visit(r,{action:"replace"})}},{key:"saveScheduleButton",value:function(e){e.preventDefault(),this.disableActionButtons(),this.formTarget.requestSubmit()}},{key:"previewButton",value:function(e){e.preventDefault(),this.disableActionButtons(),this.previewTarget.value="true",this.formTarget.requestSubmit()}},{key:"backButton",value:function(e){this.disableActionButtons(),this.checkDirty()&&confirm("You have unsaved changes, do you want to save them?")&&(e.preventDefault(),this.formTarget.requestSubmit())}},{key:"editVotingResultsSettingsButton",value:function(e){var t=e.target.getAttribute("href");this.disableActionButtons(),e.preventDefault(),this.checkDirty()&&confirm("You have unsaved changes, do you want to save them?")?(this.redirectUrlTarget.value=t,this.formTarget.requestSubmit()):this.redirectBrowserTo(t)}},{key:"initializeFields",value:function(){this.fields=i(this.formTarget.querySelectorAll("input, textarea")),this.fields.forEach(function(e){return e.originalValue=e.value})}},{key:"handleSubmitResponse",value:function(e){if(e.detail.success){var t,n=null===(t=e.detail)||void 0===t||null===(t=t.fetchResponse)||void 0===t?void 0:t.header("redirect_url");n&&this.redirectBrowserTo(n)}else this.enableActionButtons()}},{key:"checkDirty",value:function(){return this.fields.some(function(e){return e.originalValue!=e.value})}},{key:"disableActionButtons",value:function(){this.submitButtonTarget.classList.add("disabled"),this.backButtonTarget.classList.add("disabled"),this.editVotingResultsSettingsButtonTarget.classList.add("disabled"),this.hasPreviewButtonTarget&&this.previewButtonTarget.classList.add("disabled")}},{key:"enableActionButtons",value:function(){this.submitButtonTarget.classList.remove("disabled"),this.backButtonTarget.classList.remove("disabled"),this.editVotingResultsSettingsButtonTarget.classList.remove("disabled"),this.hasPreviewButtonTarget&&this.previewButtonTarget.classList.remove("disabled")}},{key:"redirectBrowserTo",value:function(e){window.top.location=e}},{key:"getElectionId",value:function(){var e=window.location.pathname.match(/\/elections\/(\d+)\//);return e?e[1]:""}}])&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);p.targets=["form","submitButton","previewButton","backButton","editVotingResultsSettingsButton","redirectUrl","preview","languageSelect"],p.values={noticeType:String}},6966:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"submit",value:function(e){this.formTarget.requestSubmit()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["form"]},3194:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396),o=n(9403),i=n(6923);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=(0,i.T)();e&&"function"===typeof e.fn.multipleSelect?(e(this.selectTarget).multipleSelect({filter:!0,minimumCountSelected:5,onClick:this.getVotersCount.bind(this),onCheckAll:this.getVotersCount.bind(this),onUncheckAll:this.getVotersCount.bind(this)}),"true"===this.data.get("emptySelectedGroupIds")&&e(this.selectTarget).multipleSelect("checkAll")):console.warn("[NotificationGroupsSelectComponent] multipleSelect plugin not loaded.")}},{key:"getVotersCount",value:function(){var e=this.selectTarget.selectedOptions,t=Array.from(e).map(function(e){return e.value}),n=this.data.get("voteId"),r=this.data.get("noticeType"),i=new URLSearchParams({group_ids:t,notice_type:r}).toString(),a="/elections/".concat(n,"/notifications/notified_invitations_count?").concat(i);fetch(a,{method:"GET",headers:{Accept:"text/vnd.turbo-stream.html"},credentials:"include"}).then(function(e){return e.text()}).then(function(e){return o.V.renderStreamMessage(e)})}}])&&a(n.prototype,r),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u}(r.xI);d.targets=["select"]},9173:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).state=new Map,e.currentLocale=null,e.dateInput=null,e.lastKnownTime=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){if(this.initDatePicker(),this.initDateChangeHandler(),this.hasLanguageSelectTarget&&this.hasSubjectsTarget&&this.hasBodiesTarget)return this.initializeState(),void this.change();this.initializeState()}},{key:"initDatePicker",value:function(){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;window.EB&&window.EB.Datepicker&&"function"===typeof window.EB.Datepicker.initDatePickers?window.EB.Datepicker.initDatePickers(new Date):t<20&&setTimeout(function(){return e(t+1)},25)};setTimeout(function(){return e()},0)}},{key:"initDateChangeHandler",value:function(){var e=this;this.dateInput=this.element.querySelector("input.datepicker"),this.dateInput&&(this.lastKnownTime=this.extractTimePart(this.dateInput.value),this.dateInput.addEventListener("input",function(){var t=e.extractTimePart(e.dateInput.value);t&&(e.lastKnownTime=t)}),this.dateInput.addEventListener("change",function(){var t=e.dateInput.value||"",n=e.extractDatePart(t);if(n)if(n===e.formatDate(new Date)){var r=e.nextHourTimeString();e.dateInput.value="".concat(n," ").concat(r),e.lastKnownTime=r}else{var o=e.lastKnownTime||e.extractTimePart(t);o&&(e.dateInput.value="".concat(n," ").concat(o))}}))}},{key:"change",value:function(e){if(this.hasLanguageSelectTarget){var t=(null===e||void 0===e?void 0:e.target)||this.languageSelectTarget;if(t){var n=t.value;this.currentLocale&&this.captureLocaleFromDOM(this.currentLocale),this.hasSubjectsTarget&&this.toggleGroups(this.subjectsTarget,n),this.hasBodiesTarget&&this.toggleGroups(this.resolveBodiesContainer(),n),this.applyLocaleToDOM(n),this.ensureDefaultBodyContent(n),this.currentLocale=n,this.attachInputListeners(n)}}}},{key:"toggleGroups",value:function(e,t){Array.from(e.querySelectorAll("[data-locale]")).forEach(function(e){e.dataset.locale===t?(e.style.display="",e.classList.remove("notice_title__row--hidden")):(e.style.display="none",e.classList.add("notice_title__row--hidden"))})}},{key:"extractDatePart",value:function(e){var t=e.match(/^(\w+ \d{1,2}, \d{4})/);return t?t[1]:null}},{key:"extractTimePart",value:function(e){var t=e.match(/(\d{1,2}):(\d{2})\s?(AM|PM)/i);return t?"".concat(t[1],":").concat(t[2]," ").concat(t[3].toUpperCase()):null}},{key:"nextHourTimeString",value:function(){var e=new Date,t=e.getHours()+(e.getMinutes()>0?1:0),n=(t%=24)>=12?"PM":"AM",r=t%12;return 0===r&&(r=12),"".concat(r,":00 ").concat(n)}},{key:"ensureDefaultBodyContent",value:function(e){if(this.hasBodiesTarget){var t=this.resolveBodiesContainer().querySelector(".notice_body__locale--".concat(e));if(t){var n=t.querySelector('textarea[name*="[front]"]')||t.querySelector('input[type="hidden"][name*="[front]"]');if(n){var r=n.value;if(!(r&&r.trim().length>0)){var o=t.dataset.defaultFront;if(o){n.value=o;var i=t.querySelector('[data-form-component-target="bodyEditor"]');i&&0===i.innerHTML.trim().length&&(i.innerHTML=o);var a=this.state.get(e)||{subject:"",front:""};this.state.set(e,{subject:a.subject,front:o})}}}}}}},{key:"resolveBodiesContainer",value:function(){return this.hasBodiesTarget?Array.from(this.element.querySelectorAll('[data-form-component-target="bodies"]')).reverse().find(function(e){return e.querySelector("[data-locale]")})||this.bodiesTarget:this.element}},{key:"initializeState",value:function(){var e=this,t=new Set;this.hasSubjectsTarget&&this.subjectsTarget.querySelectorAll("[data-locale]").forEach(function(e){return t.add(e.dataset.locale||"")}),this.hasBodiesTarget&&this.resolveBodiesContainer().querySelectorAll("[data-locale]").forEach(function(e){return t.add(e.dataset.locale||"")}),t.forEach(function(t){t&&e.state.set(t,{subject:e.readSubjectValue(t),front:e.readFrontV
2alue(t)})});var n=this.hasLanguageSelectTarget?this.languageSelectTarget.value:null;this.currentLocale=n||Array.from(t)[0]||null}},{key:"readSubjectValue",value:function(e){if(!this.hasSubjectsTarget)return"";var t=this.subjectsTarget.querySelector(".notice_title__locale--".concat(e)),n=null===t||void 0===t?void 0:t.querySelector('input[name*="[subject]"]');return(null===n||void 0===n?void 0:n.value)||""}},{key:"readFrontValue",value:function(e){if(!this.hasBodiesTarget)return"";var t=this.resolveBodiesContainer().querySelector(".notice_body__locale--".concat(e));if(!t)return"";var n=t.querySelector('textarea[name*="[front]"]'),r=t.querySelector('input[type="hidden"][name*="[front]"]');return(null===n||void 0===n?void 0:n.value)||(null===r||void 0===r?void 0:r.value)||""}},{key:"captureLocaleFromDOM",value:function(e){var t=this.state.get(e)||{subject:"",front:""};this.state.set(e,{subject:this.readSubjectValue(e)||t.subject,front:this.readFrontValue(e)||t.front})}},{key:"applyLocaleToDOM",value:function(e){var t=this.state.get(e);if(t){if(this.hasSubjectsTarget){var n=this.subjectsTarget.querySelector(".notice_title__locale--".concat(e)),r=null===n||void 0===n?void 0:n.querySelector('input[name*="[subject]"]');r&&r.value!==t.subject&&(r.value=t.subject)}if(this.hasBodiesTarget){var o=this.resolveBodiesContainer().querySelector(".notice_body__locale--".concat(e));if(o){var i=o.querySelector('textarea[name*="[front]"]'),a=o.querySelector('input[type="hidden"][name*="[front]"]');i&&i.value!==t.front&&(i.value=t.front),a&&a.value!==t.front&&(a.value=t.front);var u=o.querySelector('[data-form-component-target="bodyEditor"]');u&&u.innerHTML.trim()!==t.front.trim()&&(u.innerHTML=t.front)}}}}},{key:"attachInputListeners",value:function(e){var t,n=this,r=this.hasSubjectsTarget?this.subjectsTarget.querySelector(".notice_title__locale--".concat(e)):null,o=null===(t=this.resolveBodiesContainer())||void 0===t?void 0:t.querySelector(".notice_body__locale--".concat(e)),i=null===r||void 0===r?void 0:r.querySelector('input[name*="[subject]"]'),a=null===o||void 0===o?void 0:o.querySelector('textarea[name*="[front]"]'),u=null===o||void 0===o?void 0:o.querySelector('input[type="hidden"][name*="[front]"]'),c=function(){var t,r;n.state.set(e,{subject:(null===i||void 0===i?void 0:i.value)||(null===(t=n.state.get(e))||void 0===t?void 0:t.subject)||"",front:(null===a||void 0===a?void 0:a.value)||(null===u||void 0===u?void 0:u.value)||(null===(r=n.state.get(e))||void 0===r?void 0:r.front)||""})};i&&(i.oninput=c),a&&(a.oninput=c),u&&(u.oninput=c)}},{key:"onSubmit",value:function(){var e=this;this.currentLocale&&this.captureLocaleFromDOM(this.currentLocale),this.state.forEach(function(t,n){if(e.hasSubjectsTarget){var r=e.subjectsTarget.querySelector(".notice_title__locale--".concat(n)),o=null===r||void 0===r?void 0:r.querySelector('input[name*="[subject]"]');o&&(o.value=t.subject)}if(e.hasBodiesTarget){var i=e.resolveBodiesContainer().querySelector(".notice_body__locale--".concat(n));if(i){var a=i.querySelector('textarea[name*="[front]"]'),u=i.querySelector('input[type="hidden"][name*="[front]"]');a&&(a.value=t.front),u&&(u.value=t.front)}}})}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["languageSelect","subjects","bodies","subjectInput","bodyEditor"]},105:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"populate",value:function(e){var t=e.target.selectedOptions[0],n=(null===t||void 0===t?void 0:t.dataset.subject)||"",r=(null===t||void 0===t?void 0:t.dataset.front)||this.defaultContentValue||"",o=(null===t||void 0===t?void 0:t.dataset.additionalInstructions)||"";this.updateSubject(n),this.updateEditor(r),this.updateAdditionalInstructions(o)}},{key:"updateSubject",value:function(e){var t=document.getElementById(this.subjectFieldIdValue);t&&(t.value=e)}},{key:"updateAdditionalInstructions",value:function(e){if(this.hasAdditionalInstructionsFieldIdValue){var t=document.getElementById(this.additionalInstructionsFieldIdValue);t&&(t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))}}},{key:"updateEditor",value:function(e){var t=document.getElementById(this.editorIdValue);if(t){var n=t.closest(".rich_text_editor_component");if(n){var r=t.querySelector(".ql-editor"),o=n.querySelector('input[type="hidden"]');r&&o&&(r.innerHTML=e,o.value=e,o.dispatchEvent(new Event("change",{bubbles:!0})))}}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={subjectFieldId:String,editorId:String,defaultContent:String,additionalInstructionsFieldId:String}},5653:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"close",value:function(){this.element.remove()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},5486:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).objectUrl=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"preview",value:function(){var e,t=null===(e=this.inputTarget.files)||void 0===e?void 0:e[0];t&&(this.revokeObjectUrl(),this.objectUrl=URL.createObjectURL(t),this.hasImageTarget&&(this.imageTarget.src=this.objectUrl,this.imageTarget.hidden=!1),this.hasEmptyTarget&&(this.emptyTarget.hidden=!0))}},{key:"disconnect",value:function(){this.revokeObjectUrl()}},{key:"revokeObjectUrl",value:function(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["input","image","empty"]},2584:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"clickEditButton",value:function(e){e.preventDefault(),this.organizationKeyLabelTarget.classList.add("hide"),this.inputTarget.value=this.organizationKeyLabelTarget.innerText.trim(),this.inputTarget.classList.remove("hide"),this.editButtonTarget.classList.add("hide"),this.submitButtonTarget.classList.remove("hide"),this.cancelButtonTarget.classList.remove("hide")}},{key:"clickCancelButton",value:function(e){e.preventDefault(),this.organizationKeyLabelTarget.classList.remove("hide"),this.inputTarget.classList.add("hide"),this.editButtonTarget.classList.remove("hide"),this.submitButtonTarget.classList.add("hide"),this.cancelButtonTarget.classList.add("hide"),this.errorContainerTarget.innerHTML=""}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["form","organizationKeyLabel","input","editButton","cancelButton","submitButton","errorContainer"]},3770:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.fileUploadInputListener()}},{key:"clickFileInput",value:function(e){e.preventDefault(),this.logoFileInputTarget.click()}},{key:"fileUploadInputListener",value:function(){var e=this;this.logoFileInputTarget.onchange=function(){var t=e.logoFileInputTarget.files[0];t&&(e.logoUploadFormTarget.classList.remove("no-logo"),e.logoImageTarget.src=URL.createObjectURL(t),e.logoImageTarget.classList.remove("hide"),e.submitLogoButtonTarget.classList.remove("hide"),e.editLogoButtonTarget.classList.add("hide"),e.noLogoLabelTarget&&e.noLogoLabelTarget.classList.add("hide"))}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["logoUploadForm","editLogoButton","submitLogoButton","logoFileInput","logoImage","noLogoLabel"]},4234:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"changeToBallotAccess",value:function(e){"true"===e.target.value?this.meetingVoteInstructionsContainerTarget.classList.add("hide"):this.meetingVoteInstructionsContainerTarget.classList.remove("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["meetingVoteInstructionsContainer"]},9757:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.element.addEventListener("turbo:submit-end",function(e){e.detail.success&&window.location.reload()})}},{key:"checkPhrase",value:function(){var e=this.phraseInputTarget.value;this.submitButtonTarget.disabled="transfer"!==e}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["submitButton","phraseInput"]},7642:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){if("#edit_org_key"===window.location.hash){this.orgKeyFieldTarget.focus(),this.orgKeyFieldContainerTarget.classList.add("flash_highlight"),window.history.replaceState(null,null," ");var e=this.orgKeyFieldTarget.value.length;this.orgKeyFieldTarget.setSelectionRange(e,e)}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["orgKeyField","orgKeyFieldContainer"]},8590:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).movedActionBar=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.portalActionBar()}},{key:"disconnect",value:function(){this.movedActionBar=null}},{key:"portalActionBar",value:function(){if(this.hasActionsSlotTarget){var e=document.querySelector(".table-action-bar");e&&(this.actionsSlotTarget.appendChild(e),this.movedActionBar=e)}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["actionsSlot"]},1269:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"triggerFormSubmit",value:function(e){var t=e.target.closest("form");t&&t.requestSubmit()}},{key:"toggleEditable",value:function(e){this.readOnlyDivTarget.classList.toggle("hidden"),this.editDivTarget.classList.toggle("hidden")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["readOnlyDiv","editDiv"]},6903:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"formChange",value:function(e){"organization[webhook_mode]"===e.target.name&&this.formTarget.submit()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["form"]},4276:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"clickEditButton",value:function(e){e.preventDefault(),this.organizationKeyLabelTarget.classList.add("hide"),this.inputTarget.value=this.organizationKeyLabelTarget.innerText.trim(),this.inputTarget.classList.remove("hide"),this.editButtonTarget.classList.add("hide"),this.submitButtonTarget.classList.remove("hide"),this.cancelButtonTarget.classList.remove("hide")}},{key:"clickCancelButton",value:function(e){e.preventDefault(),this.organizationKeyLabelTarget.classList.remove("hide"),this.inputTarget.classList.add("hide"),this.editButtonTarget.classList.remove("hide"),this.submitButtonTarget.classList.add("hide"),this.cancelButtonTarget.classList.add("hide"),this.errorContainerTarget.innerHTML=""}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["form","organizationKeyLabel","input","editButton","cancelButton","submitButton","errorContainer"]},5874:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}
vendor: 1,314 bytes, line 2
2(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.loadExistingMappings()}},{key:"addRow",value:function(){var e=this.createRow("","");this.containerTarget.appendChild(e),this.syncToHidden()}},{key:"removeRow",value:function(e){var t=e.currentTarget.closest(".saml-attribute-editor__row");t&&(t.remove(),this.syncToHidden())}},{key:"fieldChanged",value:function(){this.syncToHidden()}},{key:"loadExistingMappings",value:function(){var e=this.hiddenFieldTarget.value;if(e&&"{}"!==e&&"null"!==e)try{for(var t=JSON.parse(e),n=0,o=Object.entries(t);n<o.length;n++){var i=r(o[n],2),a=i[0],u=i[1],c=this.createRow(a,String(u));this.containerTarget.appendChild(c)}}catch(s){}}},{key:"createRow",value:function(e,t){var n=document.createElement("div");n.className="saml-attribute-editor__row";var r=document.createElement("select");r.className="saml-attribute-editor__key",r.dataset.action="change->organization--sso--saml--provider-form-component--saml-attribute-editor#fieldChanged",[{value:"",label:"Select field..."},{value:"email",label:"Email"},{value:"subject_id",label:"Subject ID"},{value:"display_name",label:"Display Name"},{value:"given_name",label:"Given Name"},{value:"family_name",label:"Family Name"},{value:"groups",label:"Groups"}].forEach(function(t){var n=document.createElement("option");n.value=t.value,n.textContent=t.label,t.value===e&&(n.selected=!0),r.appendChild(n)});var o=document.createElement("input");o.type="text",o.className="saml-attribute-editor__value saml-provider-form-component__input",o.placeholder="SAML attribute name (e.g. urn:oid:0.9.2342...)",o.value=t,o.dataset.action="input->organization--sso--saml--provider-form-component--saml-attribute-editor#fieldChanged";var i=document.createElement("button");return i.type="button",i.className="btn btn--red-stroke btn--small",i.dataset.action="organization--sso--saml--provider-form-component--saml-attribute-editor#removeRow",i.textContent="Remove",n.appendChild(r),n.appendChild(o),n.appendChild(i),n}},{key:"syncToHidden",value:function(){var e=this.containerTarget.querySelectorAll(".saml-attribute-editor__row"),t={};e.forEach(function(e){var n,r,o=null===(n=e.querySelector(".saml-attribute-editor__key"))||void 0===n?void 0:n.value,i=null===(r=e.querySelector(".saml-attribute-editor__value"))||void 0===r?void 0:r.value;o&&i&&(t[o]=i)}),this.hiddenFieldTarget.value=JSON.stringify(t)}}])&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.targets=["container","hiddenField"]},7451:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}
2(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function u(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return a(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(a(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,a(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,a(p,"constructor",f),a(f,"constructor",l),l.displayName="GeneratorFunction",a(f,o,"GeneratorFunction"),a(p),a(p,o,"Generator"),a(p,r,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(i=function(){return{w:u,m:h}})()}function a(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}a=function(e,t,n,r){function i(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},a(e,t,n,r)}function u(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}n.r(t),n.d(t,{default:function(){return h}});var h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,o=[{key:"import",value:(s=i().m(function e(){var t,n,r,o,a;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=this.metadataUrlTarget.value.trim()){e.n=1;break}return this.showStatus("Please enter a metadata URL","error"),e.a(2);case 1:return this.setLoading(!0),this.showStatus("Importing metadata...","info"),e.p=2,r=(null===(n=document.querySelector('meta[name="csrf-token"]'))||void 0===n?void 0:n.content)||"",e.n=3,fetch(this.urlValue,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":r,Accept:"application/json"},body:JSON.stringify({metadata_url:t})});case 3:return o=e.v,e.n=4,o.json();case 4:a=e.v,o.ok&&a.success?(this.populateFields(a.fields),this.showStatus("Metadata imported successfully!","success")):this.showStatus(a.error||"Import failed","error"),e.n=6;break;case 5:e.p=5,e.v,this.showStatus("Network error. Please try again.","error");case 6:return e.p=6,this.setLoading(!1),e.f(6);case 7:return e.a(2)}},e,this,[[2,5,6,7]])}),f=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function i(e){u(o,n,r,i,a,"next",e)}function a(e){u(o,n,r,i,a,"throw",e)}i(void 0)})},function(){return f.apply(this,arguments)})},{key:"populateFields",value:function(e){for(var t=0,n=Object.entries({idp_entity_id:"idpEntityId",idp_sso_service_url:"idpSsoServiceUrl",idp_slo_service_url:"idpSloServiceUrl",idp_cert:"idpCert",idp_cert_fingerprint:"idpCertFingerprint",name_identifier_format:"nameIdentifierFormat"});t<n.length;t++){var o=r(n[t],2),i=o[0],a=o[1],u=e[i];if(u){var c=this["".concat(a,"Target")];c&&(c.value=u)}}}}
2,{key:"setLoading",value:function(e){this.importButtonTarget.disabled=e,this.importButtonTarget.textContent=e?"Importing...":"Import Metadata"}},{key:"showStatus",value:function(e,t){this.hasImportStatusTarget&&(this.importStatusTarget.textContent=e,this.importStatusTarget.className="saml-provider-form-component__import-status saml-provider-form-component__import-status--".concat(t))}}],o&&c(n.prototype,o),a&&c(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a,s,f}(n(5396).xI);h.targets=["metadataUrl","importButton","importStatus","idpEntityId","idpSsoServiceUrl","idpSloServiceUrl","idpCert","idpCertFingerprint","nameIdentifierFormat"],h.values={url:String}},2024:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"clickEditButton",value:function(e){e.preventDefault(),this.organizationKeyLabelTarget.classList.add("hide"),this.inputTarget.value=this.organizationKeyLabelTarget.innerText.trim(),this.inputTarget.classList.remove("hide"),this.editButtonTarget.classList.add("hide"),this.submitButtonTarget.classList.remove("hide"),this.cancelButtonTarget.classList.remove("hide"),this.copyUrlButtonTarget.classList.add("hide"),this.copyQrButtonTarget.classList.add("hide")}},{key:"clickCancelButton",value:function(e){e.preventDefault(),this.organizationKeyLabelTarget.classList.remove("hide"),this.inputTarget.classList.add("hide"),this.editButtonTarget.classList.remove("hide"),this.submitButtonTarget.classList.add("hide"),this.cancelButtonTarget.classList.add("hide"),this.errorContainerTarget.innerHTML="",this.copyUrlButtonTarget.classList.remove("hide"),this.copyQrButtonTarget.classList.remove("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["form","organizationKeyLabel","input","editButton","cancelButton","submitButton","errorContainer","copyUrlButton","copyQrButton"]},1351:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.element.addEventListener("turbo:submit-end",this.handleResponse.bind(this))}},{key:"disconnect",value:function(){this.element.removeEventListener("turbo:submit-end",this.handleResponse.bind(this))}},{key:"handleResponse",value:function(e){var t,n=null===(t=e.detail)||void 0===t||null===(t=t.fetchResponse)||void 0===t?void 0:t.response;if(console.log("Headers recebidos:",n.headers),null!==n&&void 0!==n&&n.ok){var r=n.headers.get("Turbo-Location");r&&(e.preventDefault(),window.location.href=r)}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},2012:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=/\/m\/\w+$/.test(document.referrer),t=/\/results\/\w+/.test(document.referrer),n="true"===sessionStorage.getItem("visitedMeetingVote");e?(this.showButton(),sessionStorage.setItem("visitedMeetingVote","true")):t&&n?this.showButton():(this.hideButton(),sessionStorage.removeItem("visitedMeetingVote"))}},{key:"hideButton",value:function(){this.element.style.display="none"}},{key:"showButton",value:function(){this.element.style.display="block"}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},7904:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).leftListItemCount=0,e.rightListItemCount=0,e.leftListSelectedItems=[],e.rightListSelectedItems=[],e.observer=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.loadInfo(),this.updateItemsSelectedText(),this.addListenersToSearchBar(),this.checkClearButtonVisibility(this.leftSearchBarTarget,this.leftClearButtonTarget),this.checkClearButtonVisibility(this.rightSearchBarTarget,this.rightClearButtonTarget)}},{key:"onMoveButtonClick",value:function(e){"left"===e.currentTarget.dataset.movedirection?this.leftListSelectedItems=[]:this.rightListSelectedItems=[],this.updateInfo()}},{key:"onItemClick",value:function(e){var t=e.currentTarget,n=t.dataset.value,r="left"===t.dataset.list;this.alreadyClicked(n,r)?this.unselectItem(t,r):this.selectItem(t,r),this.updateInfo()}},{key:"onSelectAllButtonClick",value:function(e){var t=this,n="left"===e.currentTarget.dataset.list,r=(n?this.leftListTarget:this.rightListTarget).querySelectorAll("li"),o=this.allItemsSelected(n?"left":"right");r.forEach(function(e){var r=e.dataset.value;o?t.unselectItem(e,n):t.alreadyClicked(r,n)||t.selectItem(e,n)}),this.updateInfo()}},{key:"addListenersToSearchBar",value:function(){var e=this;this.leftSearchBarTarget.addEventListener("keydown",function(t){"Enter"===t.key&&e.onSearchInputChange(t)}),this.leftSearchBarTarget.addEventListener("focus",function(){e.addMutationObserverToTextField(e.leftSearchBarTarget.id)}),this.leftSearchBarTarget.addEventListener("input",function(t){e.checkClearButtonVisibility(e.leftSearchBarTarget,e.leftClearButtonTarget)}),this.leftClearButtonTarget.addEventListener("click",function(){e.leftSearchBarTarget.value="",e.checkClearButtonVisibility(e.leftSearchBarTarget,e.leftClearButtonTarget)}),this.rightSearchBarTarget.addEventListener("keydown",function(t){"Enter"===t.key&&e.onSearchInputChange(t)}),this.rightSearchBarTarget.addEventListener("focus",function(){e.addMutationObserverToTextField(e.rightSearchBarTarget.id)}),this.rightSearchBarTarget.addEventListener("input",function(t){e.checkClearButtonVisibility(e.rightSearchBarTarget,e.rightClearButtonTarget)}),this.rightClearButtonTarget.addEventListener("click",function(){e.rightSearchBarTarget.value="",e.checkClearButtonVisibility(e.rightSearchBarTarget,e.rightClearButtonTarget)})}},{key:"checkClearButtonVisibility",value:function(e,t){t.style.display=e.value.length>0?"block":"none"}},{key:"onSearchInputChange",value:function(e){this.leftListSelectedItems=[],this.rightListSelectedItems=[],this.updateInfo()}},{key:"alreadyClicked",value:function(e,t){return t?this.leftListSelectedItems.includes(e):this.rightListSelectedItems.includes(e)}},{key:"selectItem",value:function(e,t){e.classList.add("selected"),t?this.leftListSelectedItems.push(e.dataset.value):this.rightListSelectedItems.push(e.dataset.value)}},{key:"unselectItem",value:function(e,t){e.classList.remove("selected"),t?this.leftListSelectedItems=this.leftListSelectedItems.filter(function(t){return t!==e.dataset.value}):this.rightListSelectedItems=this.rightListSelectedItems.filter(function(t){return t!==e.dataset.value})}},{key:"updateHiddenFields",value:function(){this.leftListSelectedItemsInputTarget.value=this.leftListSelectedItems.join(","),this.rightListSelectedItemsInputTarget.value=this.rightListSelectedItems.join(",")}},{key:"updateInfo",value:function(){this.updateItemsSelectedText(),this.updateHiddenFields(),this.checkToggleAllButtonText(),this.checkMoveButtonDisabledStatus()}},{key:"checkMoveButtonDisabledStatus",value:function(){0===this.left
2ListSelectedItems.length?this.moveButtonLeftTarget.setAttribute("disabled","disabled"):this.moveButtonLeftTarget.removeAttribute("disabled"),0===this.rightListSelectedItems.length?this.moveButtonRightTarget.setAttribute("disabled","disabled"):this.moveButtonRightTarget.removeAttribute("disabled")}},{key:"loadInfo",value:function(){this.leftListItemCount=this.leftListTarget.querySelectorAll("li").length,this.rightListItemCount=this.rightListTarget.querySelectorAll("li").length}},{key:"updateItemsSelectedText",value:function(){this.itemsSelectedTextLeftTarget.innerText="".concat(this.leftListSelectedItems.length),this.itemsSelectedTextRightTarget.innerText="".concat(this.rightListSelectedItems.length)}},{key:"checkToggleAllButtonText",value:function(){this.allItemsSelected("left")&&this.leftListItemCount>0?this.selectAllButtonLeftTarget.innerText="Deselect All":this.selectAllButtonLeftTarget.innerText="Select All",this.allItemsSelected("right")&&this.rightListItemCount>0?this.selectAllButtonRightTarget.innerText="Deselect All":this.selectAllButtonRightTarget.innerText="Select All"}},{key:"allItemsSelected",value:function(e){return"left"===e?this.leftListSelectedItems.length===this.leftListItemCount:this.rightListSelectedItems.length===this.rightListItemCount}},{key:"addMutationObserverToTextField",value:function(e){this.observer&&this.observer.disconnect(),this.observer=new MutationObserver(function(t){var n=document.getElementById(e),r=n.value.length;n.focus(),n.setSelectionRange(r,r)}),this.observer.observe(document.getElementById("organizations--results--box-filtering-component"),{childList:!0})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["leftListSelectedItemsInput","rightListSelectedItemsInput","selectAllButton","leftList","rightList","itemsSelectedTextLeft","itemsSelectedTextRight","selectAllButtonLeft","selectAllButtonRight","moveButtonLeft","moveButtonRight","leftSearchBar","rightSearchBar","leftClearButton","rightClearButton"]},2731:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){}},{key:"copyCredentials",value:function(e){var t=e.currentTarget,n=this.accessKeyTextTarget.textContent||"",r=this.passwordTextTarget.textContent||"",o="Access Key: ".concat(n,"\nPassword: ").concat(r);this.fallbackCopyToClipboard(o,t)}},{key:"fallbackCopyToClipboard",value:function(e,t){var n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="2em",n.style.height="2em",n.style.padding="0",n.style.border="none",n.style.outline="none",n.style.boxShadow="none",n.style.background="transparent",n.style.fontSize="16px",document.body.appendChild(n),n.focus(),n.select();try{n.setSelectionRange(0,99999)}catch(o){}var r=!1;try{r=document.execCommand("copy")}catch(o){}
2document.body.removeChild(n),r?this.showCopyFeedback(t,"Credentials"):this.showCopyError(t)}},{key:"showConfirmationModal",value:function(e){e.preventDefault(),this.hasModalOverlayTarget&&this.modalOverlayTarget.classList.remove("otc--available-page-component__modal_hidden")}},{key:"closeModal",value:function(){this.hasModalOverlayTarget&&this.modalOverlayTarget.classList.add("otc--available-page-component__modal_hidden")}},{key:"proceedToVoting",value:function(){this.votingFormTarget.submit()}},{key:"showCopyFeedback",value:function(e,t){var n=e.textContent;e.textContent="".concat(t," Copied!"),e.classList.add("otc--available-page-component__copy_credentials_button--success"),setTimeout(function(){e.textContent=n,e.classList.remove("otc--available-page-component__copy_credentials_button--success")},2e3)}},{key:"showCopyError",value:function(e){var t=e.textContent;e.textContent="Failed",e.classList.add("otc--available-page-component__copy_credentials_button--error"),setTimeout(function(){e.textContent=t,e.classList.remove("otc--available-page-component__copy_credentials_button--error")},2e3)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["accessKeyText","passwordText","modalOverlay","votingForm"]},4620:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).stripe=void 0,e.cardElement=void 0,e.addressElement=void 0,e.elements=void 0,e.addressState={},e.addressComplete=!1,e.electionBuddyDetailsPerCountry={CA:{name:"ElectionBuddy Inc.",address:"9622 42 Avenue #210 Edmonton AB CA",taxId:"865070783"},US:{name:"ElectionBuddy Inc.",address:"5301 S Superstition Mtn. Dr. Suite 104 #137 Gold Canyon AZ US",taxId:"98-1050820"}},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){console.log("[CreditCardForm] Controller connected"),console.log("[CreditCardForm] addressValue:",this.addressValue),console.log("[CreditCardForm] hasAddressElementTarget:",this.hasAddressElementTarget),this.initializeCardElement(),this.addressValue&&this.hasAddressElementTarget&&this.initializeAddressElement()}},{key:"disconnect",value:function(){}},{key:"handleTaxIdChange",value:function(){this.billingDetailsCheckboxTarget.checked&&!this.billingDetailsContainerTarget.classList.contains("hide")&&this.populateBillingDetailsWithAddressAndTaxId()}},{key:"initializeCardElement",value:function(){this.stripePublishableKeyValue?(console.log("[Credit
2CardForm] Initializing Card Element"),this.stripe||(this.stripe=Stripe(this.stripePublishableKeyValue)),this.elements=this.stripe.elements(),this.cardElement=this.elements.create("card",{hidePostalCode:!0}),console.log("[CreditCardForm] Card element created, mounting to target"),this.cardElement.mount("#".concat(this.cardElementTarget.id)),console.log("[CreditCardForm] Card Element mounted successfully")):console.warn("[CreditCardForm] Stripe publishable key not available")}},{key:"initializeAddressElement",value:function(){var e=this;if(this.stripe){console.log("[CreditCardForm] Initializing Address Element");var t=this.amountValue&&this.amountValue>0?this.amountValue:1,n=this.stripe.elements({mode:"payment",amount:t,currency:"usd"});this.addressElement=n.create("address",{mode:"billing",style:{base:{fontFamily:"Lato, sans-serif",fontSize:"16px",color:"#424770","::placeholder":{color:"#9ca7af"}},invalid:{color:"#fa755a"}}});var r=document.querySelector("#stripe_address");if(console.log("[CreditCardForm] Address container element:",r),r){try{this.addressElement.mount("#stripe_address"),console.log("[CreditCardForm] Address Element mounted successfully")}catch(o){return void console.error("[CreditCardForm] Failed to mount Address Element:",o)}this.addressElement.on("change",function(t){var n;e.addressState=(null===(n=t.value)||void 0===n?void 0:n.address)||{},e.addressComplete=Boolean(t.complete),e.clearAddressError(),e.updateAddressFields()})}else console.error("[CreditCardForm] Address container element not found")}else console.warn("[CreditCardForm] Stripe publishable key not available")}},{key:"updateAddressFields",value:function(){this.hasAddressLine1Target&&this.addressLine1Target&&(this.addressLine1Target.value=this.addressState.line1||""),this.hasAddressLine2Target&&this.addressLine2Target&&(this.addressLine2Target.value=this.addressState.line2||""),this.hasAddressCityTarget&&this.addressCityTarget&&(this.addressCityTarget.value=this.addressState.city||""),this.hasAddressStateTarget&&this.addressStateTarget&&(this.addressStateTarget.value=this.addressState.state||""),this.hasAddressPostalCodeTarget&&this.addressPostalCodeTarget&&(this.addressPostalCodeTarget.value=this.addressState.postal_code||""),this.hasAddressCountryTarget&&this.addressCountryTarget&&(this.addressCountryTarget.value=this.addressState.country||"")}},{key:"submit",value:function(e){var t=this;e.preventDefault(),this.appendCompanyDetailsOnSubmit(),this.addressValue&&this.hasAddressElementTarget&&!this.validateAddress()||(this.stripe&&this.cardElement?this.stripe.createToken(this.cardElement).then(function(e){if(e.error)return console.warn("[CreditCardForm] Stripe token error:",e.error.message),void(t.hasCardErrorsTarget&&(t.cardErrorsTarget.textContent=e.error.message));e.token&&(t.hasCardErrorsTarget&&(t.cardErrorsTarget.textContent=""),t.submitToken(e.token.id))}):console.warn("[CreditCardForm] Stripe not initialized, cannot submit"))}},{key:"validateAddress",value:function(){return this.addressComplete?(this.clearAddressError(),!0):(this.hasAddressErrorsTarget&&(this.addressErrorsTarget.textContent="Please complete your billing address."),!1)}},{key:"clearAddressError",value:function(){this.hasAddressErrorsTarget&&(this.addressErrorsTarget.textContent="")}},{key:"submitToken",value:function(e){var t=document.createElement("input");t.setAttribute("type","hidden"),t.setAttribute("name","stripe_token"),t.setAttribute("value",e),this.formTarget.appendChild(t),this.formTarget.submit()}},{key:"toggleBillingDetails",value:function(){this.billingDetailsContainerTarget.classList.toggle("hide"),this.billingDetailsContainerTarget.classList.contains("hide")?this.billingDetailsInputTarget.value="":this.populateBillingDetailsWithAddressAndTaxId()}},{key:"appendCompanyDetailsOnSubmit",value:function(){if(this.hasBillingDetailsCheckboxTarget&&this.hasBillingDetailsInputTarget)if(this.billingDetailsCheckboxTarget.checked){var e=this.billingDetailsInputTarget.value,t=this.obtainElectionBuddyDetails();e&&!e.includes("ElectionBuddy Inc.")?this.billingDetailsInputTarget.value="".concat(e).concat(t):e||(this.billingDetailsInputTarget.value=t)}else this.billingDetailsInputTarget.value=""}},{key:"populateBillingDetailsWithAddressAndTaxId",value:function(){var e=this.buildAddressString(),t=this.getTaxIdLine(),n="";e&&(n+=e),t&&(n+=(n?"\n":"")+t),this.billingDetailsInputTarget.value=n}},{key:"buildAddressString",value:function(){var e,t,n,r,o,i,a=[],u=null===(e=this.addressLine1Target)||void 0===e?void 0:e.value;u&&a.push(u);var c=null===(t=this.addressLine2Target)||void 0===t?void 0:t.value;c&&a.push(c);var s=null===(n=this.addressCityTarget)||void 0===n?void 0:n.value,l=null===(r=this.addressStateTarget)||void 0===r?void 0:r.value,f=null===(o=this.addressPostalCodeTarget)||void 0===o?void 0:o.value,d=null===(i=this.addressCountryTarget)||void 0===i?void 0:i.value;
2if(s||l||f){var p=[s,l,f].filter(Boolean).join(", ");p&&a.push(p)}return d&&a.push(d),a.join("\n")}},{key:"getTaxIdLine",value:function(){var e,t=document.getElementById("tax_id"),n=null===t||void 0===t||null===(e=t.value)||void 0===e?void 0:e.trim();return n?"Tax ID: ".concat(n):""}},{key:"obtainElectionBuddyDetails",value:function(){var e=this.countryCodeTarget.value,t=this.electionBuddyDetailsPerCountry[e]||this.electionBuddyDetailsPerCountry.CA;return"\n".concat(t.name,"\n").concat(t.address,"\nTax ID: ").concat(t.taxId)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["billingDetailsContainer","billingDetailsInput","form","billingDetailsCheckbox","cardErrors","addressErrors","cardElement","countryCode","addressElement","addressLine1","addressLine2","addressCity","addressState","addressPostalCode","addressCountry"],s.values={stripePublishableKey:String,address:Boolean,amount:Number}},4364:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"updateFromQuantity",value:function(e){var t=e.detail||{},n=Number(t.quantity),r=t.totalFormatted,o=t.lineLabel,i=t.linePriceFormatted,a=t.pricePerItemCents;if(this.hasLineLabelTarget)if("string"===typeof o&&o.length>0)this.lineLabelTarget.textContent=o;else if(a&&Number.isFinite(n)){var u=n>
21?"s":"";this.lineLabelTarget.textContent="".concat(n," Reminder").concat(u)}if(this.hasLinePriceTarget)if("string"===typeof i&&i.length>0)this.linePriceTarget.textContent=i;else{var c=a||this.pricePerItemCentsValue;c&&(this.linePriceTarget.textContent="$".concat((c/100).toFixed(2)," each"))}this.hasTotalAmountTarget&&r&&(this.totalAmountTarget.textContent="$".concat(r))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["lineLabel","linePrice","totalAmount"],s.values={pricePerItemCents:Number}},2076:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})}}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}n.r(t),n.d(t,{default:function(){return p}});var p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this.ensureQuantityInput();console.log("[PageComponent] Initialized quantity input:",null===e||void 0===e?void 0:e.value)}},{key:"updateQuantity",value:function(e){var t=e.detail||{},n=Number(t.quantity),r=Number(t.credits),o=Number(t.totalCents),i=this.ensureQuantityInput();i&&Number.isFinite(n)&&(i.value=String(n));var a=document.getElementById("pay_with_existing_card_button");if(a){var u=new URL(a.href,window.location.origin);Number.isFinite(n)&&u.searchParams.set("quantity",String(n)),Number.isFinite(r)&&u.searchParams.set("credits",String(r)),a.href=u.toString()}var c=document.querySelector("[data-payments--stripe--transaction-component-amount-value]");c&&Number.isFinite(o)&&c.setAttribute("data-payments--stripe--transaction-component-amount-value",String(o));var s=document.querySelector("[data-payments--stripe--address-component-amount-value]");s&&Number.isFinite(o)&&s.setAttribute("data-payments--stripe--address-component-amount-value",String(o))}},{key:"handleExistingCardClick",value:function(e){var t=e.target.closest("#pay_with_existing_card_button");t&&"true"!==t.dataset.remote&&(e.preventDefault(),e.stopPropagation(),this.postExistingCard(t))}},{key:"postExistingCard",value:(f=a(r().m(function e(t){var n,o,i,a,u;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return o=t.textContent,t.textContent="Charging card...",t.style.pointerEvents="none",i=(null===(n=document.querySelector('meta[name="csrf-token"]'))||void 0===n?void 0:n.getAttribute("content"))||"",e.p=1,e.n=2,fetch(t.href,{method:"POST",headers:{"X-CSRF-Token":i,"X-Requested-With":"XMLHttpRequest"}});case 2:return a=e.v,e.n=3,a.json();case 3:if("success"!==(u=e.v).status){e.n=4;break}return window.location.href=u.redirect_url,e.a(2);case 4:if("requires_action"!==u.status){e.n=6;break}return e.n=5,this.handle3dsAuthentication(u.client_secret,u.payment_intent_id,u.confirm_url);case 5:return e.a(2);case 6:"error"===u.status&&this.showPaymentError(u.message||"Payment failed. Please try again."),e.n=8;break;case 7:e.p=7,e.v,console.error("[PageComponent] Existing card payment failed"),this.showPaymentError("An error occurred while processing your payment. Please try again.");case 8:return e.p=8,t.textContent=o,t.style.pointerEvents="",e.f(8);case 9:return e.a(2)}},e,this,[[1,7,8,9]])})),function(e){return f.apply(this,arguments)})},{key:"handle3dsAuthentication",value:(l=a(r().m(function e(t,n,o){var i,a;return r().w(function(e){for(;;)switch(e.n){case 0:if(i=this.getStripePublishableKey()){e.n=1;break}return this.showPaymentError("Payment authentication is not available. Please refresh and try again."),e.a(2);case 1:return a=Stripe(i),e.n=2,a.handleNextAction({clientSecret:t});case 2:return e.v.error&&console.error("[PageComponent] 3DS authentication failed"),e.n=3,this.confirmPayment(n,o);case 3:return e.a(2)}},e,this)})),function(e,t,n){return l.apply(this,arguments)})},{key:"confirmPayment",value:(c=a(r().m(function e(t,n){var o,i,a,u;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=(null===(o=document.querySelector('meta[name="csrf-token"]'))||void 0===o?void 0:o.getAttribute("content"))||"",e.p=1,e.n=2,fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":i},body:JSON.stringify({payment_intent_id:t})});case 2:return a=e.v,e.n=3,a.json();case 3:"success"===(u=e.v).status?window.location.href=u.redirect_url:this.showPaymentError(u.message||"Payment confirmation failed. Please try again."),e.n=5;break;
2case 4:e.p=4,e.v,console.error("[PageComponent] Payment confirmation failed"),this.showPaymentError("Payment confirmation failed. Please try again.");case 5:return e.a(2)}},e,this,[[1,4]])})),function(e,t){return c.apply(this,arguments)})},{key:"getStripePublishableKey",value:function(){var e=document.querySelector("[data-payments--stripe--transaction-component-stripe-publishable-key-value]");if(e)return e.getAttribute("data-payments--stripe--transaction-component-stripe-publishable-key-value");var t=document.querySelector("[data-payments--stripe--card-component-stripe-publishable-key-value]");if(t)return t.getAttribute("data-payments--stripe--card-component-stripe-publishable-key-value");var n=document.querySelector("[data-stripe-publishable-key]");return n?n.getAttribute("data-stripe-publishable-key"):null}},{key:"showPaymentError",value:function(e){var t=document.querySelector(".flash-messages, .alert-container, [data-flash-target]");t?(t.innerHTML='<div class="alert alert-danger">'.concat(e,"</div>"),t.scrollIntoView({behavior:"smooth",block:"center"})):alert(e)}},{key:"ensureQuantityInput",value:function(){var e=document.getElementById("payment_form");if(!e)return null;var t=e.querySelector('input[name="quantity"]');if(!t){var n=document.querySelector('input[name="quantity"][readonly]'),r=(null===n||void 0===n?void 0:n.value)||"2";(t=document.createElement("input")).type="hidden",t.name="quantity",t.value=r,e.appendChild(t)}return t}}],o&&u(n.prototype,o),i&&u(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i,c,l,f}(n(5396).xI)},4138:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.updateButtons(),this.updateTotal()}},{key:"increment",value:function(){var e=this.currentQuantity;e<this.maxValue&&(this.quantityInputTarget.value=String(e+1),this.onChange())}},{key:"decrement",value:function(){var e=this.currentQuantity;e>this.minValue&&(this.quantityInputTarget.value=String(e-1),this.onChange())}},{key:"inputChanged",value:function(){var e=parseInt(this.quantityInputTarget.value);(isNaN(e)||e<this.minValue)&&(e=this.minValue),e>this.maxValue&&(e=this.maxValue),this.quantityInputTarget.value=String(e),this.onChange()}},{key:"onChange",value:function(){this.updateButtons(),this.updateTotal(),this.dispatchQuantityChanged()}},{key:"currentQuantity",get:function(){return parseInt(this.quantityInputTarget.value)||this.minValue}},{key:"totalCents",get:function(){return this.currentQuantity*this.priceValue}},{key:"updateButtons",value:function(){var e=this.currentQuantity;this.decrementBtnTarget.disabled=e<=this.minValue,this.incrementBtnTarget.disabled=e>=this.maxValue}},{key:"updateTotal",value:function(){this.totalPriceTarget.textContent="$".concat(this.formatDollars(this.totalCents))}},{key:"dispatchQuantityChanged",value:function(){this.dispatch("quantityChanged",{detail:{quantity:this.currentQuantity,totalCents:this.totalCents,totalFormatted:this.formatDollars(this.totalCents),pricePerItemCents:this.priceValue},bubbles:!0})}},{key:"formatDollars",value:function(e){return(e/100).toFixed(2)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["quantityInput","totalPrice","decrementBtn","incrementBtn"],s.values={min:Number,max:Number,price:Number}},1141:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d={base:{fontFamily:"Lato, sans-serif",fontSize:"16px",color:"#424770","::placeholder":{color:"#9ca7af"}},invalid:{color:"#fa755a"}},p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=c(this,t,[].concat(r))).stripe=void 0,e.addressElement=void 0,e.addressState={},e.billingName="",e.addressComplete=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){console.log("[AddressComponent] Controller connected",{mode:this.modeValue}),this.initializeAddressElement()}},{key:"disconnect",value:function(){console.log("[AddressComponent] Controller disconnected"),this.addressElement&&this.addressElement.destroy()}},{key:"initializeAddressElement",value:function(){var e,t=this;if(this.stripePublishableKeyValue){this.stripe||(this.stripe=Stripe(this.stripePublishableKeyValue));var n={mode:this.modeValue||"setup",currency:"usd"};if(console.log("[AddressComponent] Initializing with:",{mode:this.modeValue,amountRaw:this.amountValue,amountType:typeof this.amountValue}),"payment"===this.modeValue){var r=Number(this.amountValue);console.log("[AddressComponent] Converted amount:",r),!isNaN(r)&&r>0?(n.amount=r,console.log("[AddressComponent] Added amount to config:",r)):(console.log("[AddressComponent] Amount is 0 or invalid - using setup mode instead of payment mode"),n.mode="setup")}console.log("[AddressComponent] Final elements config:",n);var o=this.stripe.elements(n);if(this.addressElement=o.create("address",{mode:"billing",fields:{ph
2one:"never"},defaultValues:{address:{country:(null===(e=this.addressCountryTarget)||void 0===e?void 0:e.value)||"US"}},style:d}),document.querySelector("#stripe_address")){try{this.addressElement.mount("#stripe_address")}catch(i){return void console.error("[AddressComponent] Failed to mount Address Element:",i)}this.addressElement.on("change",function(e){var n,r,o=(null===(n=e.value)||void 0===n?void 0:n.address)||{};t.billingName=(null===(r=e.value)||void 0===r?void 0:r.name)||"",t.addressState=o,t.addressComplete=Boolean(e.complete),t.clearError(),t.updateHiddenFields(),t.dispatchAddressChange(),console.log("[AddressComponent] Address ready:",t.addressComplete)})}else console.error("[AddressComponent] Address container element not found")}else console.warn("[AddressComponent] Stripe publishable key not available")}},{key:"getAddressState",value:function(){return this.addressState||{}}},{key:"getBillingDetails",value:function(){var e=this.hasAddressLine1Target?this.addressLine1Target.value:this.addressState.line1,t=this.hasAddressLine2Target?this.addressLine2Target.value:this.addressState.line2,n=this.hasAddressCityTarget?this.addressCityTarget.value:this.addressState.city,r=this.hasAddressStateTarget?this.addressStateTarget.value:this.addressState.state,o=this.hasAddressPostalCodeTarget?this.addressPostalCodeTarget.value:this.addressState.postal_code,i=this.hasAddressCountryTarget?this.addressCountryTarget.value:this.addressState.country,a={line1:e||this.addressState.line1,line2:t||this.addressState.line2,city:n||this.addressState.city,state:r||this.addressState.state,postal_code:o||this.addressState.postal_code,country:i||this.addressState.country};return console.log("[AddressComponent] getBillingDetails - stored state:",this.addressState),console.log("[AddressComponent] getBillingDetails - from fields:",{line1:e,city:n,state:r,postalCode:o,country:i}),{name:this.billingName,address:a}}},{key:"dispatchAddressChange",value:function(){this.element.dispatchEvent(new CustomEvent("address-changed",{detail:{address:this.addressState},bubbles:!0}))}},{key:"validate",value:function(){return this.addressComplete?(this.clearError(),!0):(this.showError("Please complete your billing address."),!1)}},{key:"showError",value:function(e){this.hasAddressErrorsTarget&&(this.addressErrorsTarget.textContent=e)}},{key:"clearError",value:function(){this.hasAddressErrorsTarget&&(this.addressErrorsTarget.textContent="")}},{key:"updateHiddenFields",value:function(){var e=this;Object.entries({addressLine1:"line1",addressLine2:"line2",addressCity:"city",addressState:"state",addressPostalCode:"postal_code",addressCountry:"country"}).forEach(function(t){var n=o(t,2),r=n[0],i=n[1],a=e["".concat(r,"Target")];a&&a instanceof HTMLInputElement&&(a.value=e.addressState[i]||"")})}}])&&a(n.prototype,r),i&&a(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);p.targets=["addressElement","addressErrors","addressLine1","addressLine2","addressCity","addressState","addressPostalCode","addressCountry"],p.values={stripePublishableKey:String,mode:String,amount:Number}},83:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).electionBuddyDetailsPerCountry={CA:{name:"ElectionBuddy Inc.",address:"9622 42 Avenue #210 Edmonton AB CA",taxId:"865070783"},US:{name:"ElectionBuddy Inc.",address:"5301 S Superstition Mtn. Dr. Suite 104 #137 Gold Canyon AZ US",taxId:"98-1050820"}},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){console.log("[BillingDetailsComponent] Controller connected"),this.attachFormListener()}},{key:"disconnect",value:function(){}},{key:"attachFormListener",value:function(){var e=this,t=this.element.closest("form");t?t.addEventListener("submit",function(){console.log("[BillingDetailsComponent] Form submitting, preparing billing details"),e.prepareBillingDetailsForSubmit()}):console.warn("[BillingDetailsComponent] Parent form not found")}},{key:"prepareBillingDetailsForSubmit",value:function(){if(this.checkboxTarget.checked){var e=this.inputTarget.value,t=this.obtainElectionBuddyDetails();e&&!e.includes("ElectionBuddy Inc.")?this.inputTarget.value="".concat(e).concat(t):e||(this.inputTarget.value=t)}else this.inputTarget.value=""}},{key:"toggleBillingDetails",value:function(){this.containerTarget.classList.toggle("hide"),this.containerTarget.classList.contains("hide")?this.inputTarget.value="":this.populateBillingDetailsWithAddressAndTaxId()}},{key:"handleTaxIdChange",value:function(){this.checkboxTarget.checked&&!this.containerTarget.classList.contains("hide")&&this.populateBillingDetailsWithAddressAndTaxId()}},{key:"handleAddressChange",value:function(){this.checkboxTarget.checked&&!this.containerTarget.classList.contains("hide")&&this.populateBillingDetailsWithAddressAndTaxId()}},{key:"prepareBillingDetails",value:function(){this.prepareBillingDetailsForSubmit()}},{key:"populateBillingDetailsWithAddressAndTaxId",value:function(){var e=this.buildAddressString(),t=this.getTaxIdLine(),n="";e&&(n+=e),t&&(n+=(n?"\n":"")+t),this.inputTarget.value=n}},{key:"buildAddressString",value:function(){if(!this.hasPaymentsStripeAddressComponentOutlet)return console.log("[BillingDetails] No address component outlet available"),"";var e=this.paymentsStripeAddressComponentOutlet.getAddressState();console.log("[BillingDetails] Building address from state:",e);var t=[];if(e.line1&&t.push(e.line1),e.line2&&t.push(e.line2),e.city||e.state||e.postal_code){var n=[e.city,e.state,e.postal_code].filter(Boolean).join(", ");n&&t.push(n)}e.country&&t.push(e.country);var r=t.join("\n");return console.log("[BillingDetails] Built address string:",r),r}},{key:"getTaxIdLine",value:function(){var e,t=document.getElementById("tax_id"),n=null===t||void 0===t||null===(e=t.value)||void 0===e?void 0:e.trim();return n?"Tax ID: ".concat(n):""}},{key:"obtainElectionBuddyDetails",value:function(){var e=document.getElementById("country_code"),t=(null===e||void 0===e?void 0:e.value)||"CA",n=this.electionBuddyDetailsPerCountry[t]||this.electionBuddyDetailsPerCountry.CA;return"\n".concat(n.name,"\n").concat(n.address,"\nTax ID: ").concat(n.taxId)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["container","input","checkbox"],s.outlets=["payments--stripe--address-component"]},2486:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).stripe=void 0,e.cardElement=void 0,e.elements=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){console.log("[CardComponent] Controller connected",{mode:this.modeValue}),this.initializeCardElement()}},{key:"disconnect",value:function(){this.cardElement&&this.cardElement.destroy()}},{key:"initializeCardElement",value:function(){this.stripePublishableKeyValue?(this.stripe||(this.stripe=Stripe(this.stripePublishableKeyValue)),this.elements=this.stripe.elements(),this.cardElement=this.elements.create("card",{hidePostalCode:!0}),this.cardElement.mount("#".concat(this.cardElementTarget.id))):console.warn("[CardComponent] Stripe publishable key not available")}},{key:"handleNextAction",value:function(e){return this.stripe?this.stripe.handleNextAction({clientSecret:e}):Promise.reject(new Error("Stripe not initialized"))}},{key:"createToken",value:function(e){var t=this;if(!this.stripe||!this.cardElement)return console.warn("[CardComponent] Stripe not initialized"),Promise.reject("Stripe not initialized");var n,r,o,i,a,u,c={};return e?(c.name=e.name,c.address_line1=(null===(n=e.address)||void 0===n?void 0:n.line1)||"",c.address_line2=(null===(r=e.address)||void 0===r?void 0:r.line2)||"",c.address_city=(null===(o=e.address)||void 0===o?void 0:o.city)||"",c.address_state=(null===(i=e.address)||void 0===i?void 0:i.state)||"",c.address_zip=(null===(a=e.address)||void 0===a?void 0:a.postal_code)||"",c.address_country=(null===(u=e.address)||void 0===u?void 0:u.country)||"",console.log("[CardComponent] Creating token with billing details:",c)):console.log("[CardComponent] Creating token without billing details"),this.stripe.createToken(this.cardElement,c).then(function(e){return e.error?(t.showError(e.error.message),{error:e.error}):(console.log("[CardComponent] Token created successfully:",e.token),t.clearError(),{token:e.token})})}},{key:"showError",value:function(e){this.hasCardErrorsTarget&&(this.cardErrorsTarget.textContent=e)}},{key:"clearError",value:function(){this.hasCardErrorsTarget&&(this.cardErrorsTarget.textContent="")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["cardElement","cardErrors"],s.values={stripePublishableKey:String,mode:String}},6409:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
vendor: 4,568 bytes, line 2
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).logPrefix="[CreditCardFormSetup]",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"submissionErrorMessage",get:function(){return"We could not save your card. Please try again, or contact support if the problem continues."}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(3613).default)},3613:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})}}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}n.r(t),n.d(t,{default:function(){return p}});var p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=s(this,t,[].concat(r))).isReady=!1,e.logPrefix="StripeForm",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){this.refreshReadiness(),console.log("[".concat(this.logPrefix,"] Controller connected"))}},{key:"disconnect",value:function(){this.isReady=!1}},{key:"paymentsStripeCardComponentOutletConnected",value:function(){console.log("[".concat(this.logPrefix,"] Card controller connected")),this.refreshReadiness()}},{key:"paymentsStripeCardComponentOutletDisconnected",value:function(){this.refreshReadiness()}},{key:"paymentsStripeAddressComponentOutletConnected",value:function(){console.log("[".concat(this.logPrefix,"] Address controller connected")),this.refreshReadiness()}},{key:"paymentsStripeAddressComponentOutletDisconnected",value:function(){this.refreshReadiness()}},{key:"submit",value:(h=a(r().m(function e(t){var n,o;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:if(console.log("[".concat(this.logPrefix,"] Submit triggered")),t.preventDefault(),this.disableSubmitButton(),this.isReady){e.n=1;break}return console.warn("[".concat(this.logPrefix,"] Required dependencies are not ready")),console.log("[".concat(this.logPrefix,"] - hasCard:"),this.hasPaymentsStripeCardComponentOutlet),console.log("[".concat(this.logPrefix,"] - hasAddress:"),this.hasPaymentsStripeAddressComponentOutlet),this.enableSubmitButton(),e.a(2);case 1:if(e.p=1,!this.hasPaymentsStripeAddressComponentOutlet||this.paymentsStripeAddressComponentOutlet.validate()){e.n=2;break}return console.warn("[".concat(this.logPrefix,"] Address validation failed")),e.a(2);case 2:if(this.requireCardValue){e.n=4;break}return console.log("[".concat(this.logPrefix,"] Submitting without card tokenization")),e.n=3,this.submitFormViaFetch();case 3:return e.a(2);case 4:return n=this.hasPaymentsStripeAddressComponentOutlet?this.paymentsStripeAddressComponentOutlet.getBillingDetails():void 0,e.n=5,this.paymentsStripeCardComponentOutlet.createToken(n);case 5:if(!(o=e.v).error){e.n=6;break}return console.error("[".concat(this.logPrefix,"] Token creation failed")),e.a(2);case 6:if(!o.token){e.n=7;break}return console.log("[".concat(this.logPrefix,"] Token created successfully")),e.n=7,this.submitToken(o.token.id);case 7:e.n=9;break;case 8:e.p=8,e.v,console.error("[".concat(this.logPrefix,"] Token creation failed"));case 9:return e.p=9,this.enableSubmitButton(),e.f(9);case 10:return e.a(2)}},e,this,[[1,8,9,10]])})),function(e){return h.apply(this,arguments)})},{key:"refreshReadiness",value:function(){var e=this.hasPaymentsStripeCardComponentOutlet,t=this.hasPaymentsStripeAddressComponentOutlet;this.isReady=(!this.requireCardValue||e)&&t,this.requireCardValue&&!e&&console.warn("[".concat(this.logPrefix,"] Card controller not found")),t||console.warn("[".concat(this.logPrefix,"] Address controller not found")),this.isReady&&console.log("[".concat(this.logPrefix,"] Card and Address controllers are live and ready"))}},{key:"disableSubmitButton",value:function(){var e=this.element.querySelector(".credit-card-form-component__submit-button");e&&(e.disabled=!0)}},{key:"enableSubmitButton",value:function(){var e=this.element.querySelector(".credit-card-form-component__submit-button");e&&(e.disabled=!1)}},{key:"submitToken",value:(p=a(r().m(function e(t){var n;return r().w(function(e){for(;;)switch(e.n){case 0:return(n=document.createElement("input")).setAttribute("type","hidden"),n.setAttribute("name","stripe_token"),n.setAttribute("value",t),this.formTarget.appendChild(n),e.n=1,this.submitFormViaFetch();case 1:return e.a(2)}},e,this)})),function(e){return p.apply(this,arguments)})},{key:"submitFormViaFetch",value:(f=a(r().m(function e(){var t,n,o,i,a;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=new FormData(this.formTarget),o=(null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.getAttribute("content"))||"",e.p=1,e.n=2,fetch(this.formTarget.action,{method:this.formTarget.method||"POST",body:n,headers:{"X-CSRF-Token":o,"X-Requested-With":"XMLHttpRequest"}});case 2:return i=e.v,e.n=3,i.json();case 3:if("success"!==(a=e.v).status){e.n=4;break}window.location.href=a.redirect_url,e.n=7;break;case 4:if("requires_action"!==a.status){e.n=6;break}return console.log("[".concat(this.logPrefix,"] 3DS authentication required")),e.n=5,this.handle3dsAuthentication(a.client_secret,a.payment_intent_id,a.confirm_url);case 5:e.n=7;break;case 6:"error"===a.status&&this.showPaymentError(a.message||"Payment failed. Please try again.");case 7:e.n=9;break;case 8:e.p=8,e.v,console.error("[".concat(this.logPrefix,"] Form submission failed")),this.showPaymentError(this.submissionErrorMessage);case 9:return e.a(2)}},e,this,[[1,8]])})),function(){return f.apply(this,arguments)})},{key:"submissionErrorMessage",get:function(){return"An error occurred confirming this transaction. Please check your payment status and contact support if you were charged but did not receive confirmation."}},{key:"handle3dsAuthentication",value:(l=a(r().m(function e(t,n,o){return r().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.hasPaymentsStripeCardComponentOutlet){e.n=1;break}return console.error("[".concat(this.logPrefix,"] Card controller not available for 3DS authentication")),this.showPaymentError("Payment authentication is not available. Please refresh and try again."),e.a(2);case 1:return e.p=1,e.n=2,this.paymentsStripeCardComponentOutlet.handleNextAction(t);case 2:return e.v.error?console.error("[".concat(this.logPrefix,"] 3DS authentication failed")):console.log("[".concat(this.logPrefix,"] 3DS authentication succeeded, c
2onfirming payment")),e.n=3,this.confirmPayment(n,o);case 3:e.n=5;break;case 4:e.p=4,e.v,console.error("[".concat(this.logPrefix,"] 3DS authentication error")),this.showPaymentError("Authentication failed. Please try again.");case 5:return e.a(2)}},e,this,[[1,4]])})),function(e,t,n){return l.apply(this,arguments)})},{key:"confirmPayment",value:(c=a(r().m(function e(t,n){var o,i,a,u,c;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=(null===(o=document.querySelector('meta[name="csrf-token"]'))||void 0===o?void 0:o.getAttribute("content"))||"",a=n||this.buildConfirmUrl(),e.p=1,e.n=2,fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":i},body:JSON.stringify({payment_intent_id:t})});case 2:return u=e.v,e.n=3,u.json();case 3:"success"===(c=e.v).status?window.location.href=c.redirect_url:this.showPaymentError(c.message||"Payment confirmation failed. Please try again."),e.n=5;break;case 4:e.p=4,e.v,console.error("[".concat(this.logPrefix,"] Payment confirmation failed")),this.showPaymentError(this.submissionErrorMessage);case 5:return e.a(2)}},e,this,[[1,4]])})),function(e,t){return c.apply(this,arguments)})},{key:"buildConfirmUrl",value:function(){var e=this.formTarget.action;try{var t=new URL(e),n=t.pathname.split("/"),r=n.indexOf("payments");return r>=0&&(t.pathname=n.slice(0,r+1).join("/")+"/confirm"),t.toString()}catch(a){var o=e.split("/"),i=o.indexOf("payments");return i>=0?o.slice(0,i+1).join("/")+"/confirm":e+"/confirm"}}},{key:"showPaymentError",value:function(e){if(this.hasPaymentsStripeCardComponentOutlet){var t=this.paymentsStripeCardComponentOutlet;if(t.cardErrorsTarget)return t.cardErrorsTarget.textContent=e,void t.cardErrorsTarget.scrollIntoView({behavior:"smooth",block:"center"})}var n=document.querySelector(".flash-messages, .alert-container, [data-flash-target]");n?(n.innerHTML='<div class="alert alert-danger">'.concat(e,"</div>"),n.scrollIntoView({behavior:"smooth",block:"center"})):alert(e)}}],o&&u(n.prototype,o),i&&u(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i,c,l,f,p,h}(n(5396).xI);p.targets=["form"],p.outlets=["payments--stripe--card-component","payments--stripe--address-component"],p.values={requireCard:{type:Boolean,default:!0}}},5173:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).logPrefix="[TransactionComponent]",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(3613).default)},536:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(5396),o=n(132);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;
2!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return c(l,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,c(p,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(p),c(p,o,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:h}})()}function c(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,n,r){function i(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},c(e,t,n,r)}function s(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function f(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e,t,n){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}var y={"image/png":[137,80,78,71],"image/jpeg":[255,216,255]},m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;EB.TextEditor.init();var t=this.element.querySelector("#answer_picture, #answer_draft_picture");t&&t.addEventListener("change",this.enableCropImage.bind(this)),this.answerFormTarget.addEventListener("turbo:submit-end",function(t){return e.handleSubmitResponse(t)}),document.addEventListener("turbo:before-fetch-response",function(t){t.detail.fetchResponse.response.headers.get("X-Flag")&&e.closeModal()})}},{key:"imageInputChange",value:(c=u().m(function e(t){var n,r,o,i;return u().w(function(e){for(;;)switch(e.n){case 0:if(r=parseInt(this.imageInputTarget.dataset.maxFileSize||"0",10),o=null===(n=t.target.files)||void 0===n?void 0:n[0]){e.n=1;break}return this.unsupportedFormatHelpTextTarget.classList.add("hide"),e.a(2);case 1:return e.n=2,this.detectImageMimeType(o);case 2:if(e.v){e.n=3;break}return this.unsupportedFormatHelpTextTarget.classList.remove("hide"),this.imageInputTarget.value="",e.a(2);case 3:if(this.unsupportedFormatHelpTextTarget.classList.add("hide"),i=document.querySelector(".image-help-text")){e.n=4;break}return e.a(2);case 4:o.size>r?(i.style.color="red",this.imageInputTarget.value=""):i.style.color="";case 5:return e.a(2)}},e,this)}),f=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=c.apply(e,t);function i(e){s(o,n,r,i,a,"next",e)}function a(e){s(o,n,r,i,a,"throw",e)}i(void 0)})},function(e){return f.apply(this,arguments)})},{key:"detectImageMimeType",value:function(e){return new Promise(function(t){var n=new FileReader;
2n.onloadend=function(e){var n,r=new Uint8Array(null===(n=e.target)||void 0===n?void 0:n.result),o=Object.entries(y).find(function(e){return i(e,2)[1].every(function(e,t){return r[t]===e})});t(o?o[0]:null)},n.onerror=function(){return t(null)},n.readAsArrayBuffer(e.slice(0,4))})}},{key:"toggleFullscreen",value:function(e){var t=document.querySelector(".turbo-modal-component__modal"),n=this.fullscreenButtonTarget.querySelector("span");e.preventDefault(),t.classList.contains("fullscreen")?(t.classList.remove("fullscreen"),n.textContent="Fullscreen"):(t.classList.add("fullscreen"),n.textContent="Exit Fullscreen")}},{key:"closeModal",value:function(){var e=document.querySelector(".turbo-modal-component__close-modal");e&&e.click()}},{key:"enableCropImage",value:function(e){var t=this,n=e.currentTarget;if(window.FileReader&&n){if(!n.files||!n.files[0])return;var r=new FileReader;r.onload=function(e){var n,r=null===(n=e.target)||void 0===n?void 0:n.result,o=document.querySelector("#crop_image");if(o){t.removeCroppie(o),o.innerHTML="";var i=new Croppie(o,{viewport:{width:100,height:100,type:"circle"},boundary:{width:100,height:120}});i.bind({url:r,zoom:0}),i.element.addEventListener("update",function(){t.updateCropCoordinates(i)})}},r.readAsDataURL(n.files[0]),this.updateText()}else this.submitImage()}},{key:"removeCroppie",value:function(e){var t=e.dataset.croppie;t&&t.destroy()}},{key:"updateCropCoordinates",value:function(e){var t=e.get().points;this.cropXTarget.value=t[0],this.cropYTarget.value=t[1],this.cropWTarget.value=t[2]-t[0],this.cropHTarget.value=t[3]-t[1]}},{key:"updateText",value:function(){this.dragHelpTextTarget.classList.remove("hide"),this.resizeHelpTextTarget.classList.remove("hide"),this.uploadImageButtonTarget.textContent=o.A.t("pages.vote.ballot.question.nomination.profile.edit_image")}},{key:"submitImage",value:function(){this.answerFormTarget&&Rails.fire(this.answerFormTarget,"submit")}},{key:"changePdfInput",value:function(e){var t=e.target;if(t.files&&t.files.length>0){var n=t.files[0].name;this.pdfFileNameTarget.textContent=n,this.uploadPdfButtonTarget.textContent=o.A.t("pages.vote.ballot.question.nomination.profile.edit_pdf"),this.removePdfButtonTarget.classList.remove("hide")}}},{key:"handleSubmitResponse",value:function(e){var t=document.querySelector(".questions--answers--candidate-profile-modal");this.element.parentElement.removeAttribute("src"),t.remove()}},{key:"enableTurboForm",value:function(e){this.syncQuillEditors(),this.answerFormTarget.setAttribute("data-turbo","true")}},{key:"syncQuillEditors",value:function(){this.answerFormTarget.querySelectorAll(".rich_text_editor_component").forEach(function(e){var t=e.querySelector(".ql-editor"),n=e.querySelector("input.rich_text_textarea");if(t&&n){var r=t.innerHTML.replace(/(<p><br><\/p>)+$/,"");n.value=r}})}}],r&&l(n.prototype,r),a&&l(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,c,f}(r.xI);m.targets=["fullscreenButton","answerForm","uploadImageButton","imageInput","dragHelpText","resizeHelpText","unsupportedFormatHelpText","uploadPdfButton","pdfFileName","removePdfButton","cropX","cropY","cropW","cropH"]},6489:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"checkMinMaxError",value:function(e,t){this.errorMessageTarget.textContent=e>t?"Min exceeds Max.":""}},{key:"validateMinMax",value:function(){var e=parseInt(this.minInputTarget.value),t=parseInt(this.maxInputTarget.value);this.checkMinMaxError(e,t)}},{key:"resetAnswerLimit",value:function(e){var t=e.currentTarget.dataset.id,n=document.querySelector("#question_".concat(t,"_question_allow_writeins")),r=document.querySelector("#question_".concat(t,"_question_answer_limit"));n.checked||(r.value=1)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["minInput","maxInput","errorMessage"]},1945:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=/^-?\d+$/,f=".questions--scored--scoring-options-modal-component__row",d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).draggedRow=null,e.floatingRow=null,e.pointerOffsetY=0,e.onPointerMove=function(t){return e.pointerMove(t)},e.onPointerUp=function(){return e.endDrag()},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.hasErrorsValue&&this.paintFormatErrors()}},{key:"paintFormatErrors",value:function(){var e=this;this.scoreInputTargets.forEach(function(t){e.scoreErrorMessage(t.value)&&t.classList.add("is-invalid")}),this.labelInputTargets.forEach(function(e){""===e.value.trim()&&e.classList.add("is-invalid")})}},{key:"disconnect",value:function(){this.endDrag()}},{key:"addOption",value:function(){var e=this.rowTemplateTarget.content.cloneNode(!0);this.rowsTarget.appendChild(e)}},{key:"deleteOption",value:function(e){var t;null===(t=e.currentTarget.closest(f))||void 0===t||t.remove()}},{key:"dragStart",value:function(e){if(0===e.button){var t=e.currentTarget.closest(f);if(t){e.preventDefault(),this.draggedRow=t;var n=t.getBoundingClientRect();this.pointerOffsetY=e.clientY-n.top,this.floatingRow=this.buildFloatingRow(t,n),document.body.appendChild(this.floatingRow),t.classList.add("is-placeholder"),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)}}}},{key:"pointerMove",value:function(e){if(this.floatingRow&&this.draggedRow){var t=this.rowsTarget.getBoundingClientRect(),n=this.floatingRow.offsetHeight,r=Math.min(Math.max(e.clientY-this.pointerOffsetY,t.top),t.bottom-n);this.floatingRow.style.top="".concat(r,"px");var o=this.rowUnderPointer(e.clientY);if(o&&o!==this.draggedRow){var i=o.getBoundingClientRect(),a=e.clientY-i.top>i.height/2;o.insertAdjacentElement(a?"afterend":"beforebegin",this.draggedRow)}}}},{key:"endDrag",value:function(){var e,t;document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),null===(e=this.floatingRow)||void 0===e||e.remove(),this.floatingRow=null,null===(t=this.draggedRow)||void 0===t||t.classList.remove("is-placeholder"),this.draggedRow=null}},{key:"buildFloatingRow",value:function(e,t){var n=e.cloneNode(!0),r=e.querySelectorAll("input");return n.querySelectorAll("input").forEach(function(e,t){var n,o;e.value=null!==(n=null===(o=r[t])||void 0===o?void 0:o.value)&&void 0!==n?n:""}),n.classList.add("is-floating"),n.style.position="fixed",n.style.left="".concat(t.left,"px"),n.style.top="".concat(t.top,"px"),n.style.width="".concat(t.width,"px"),n}},{key:"rowUnderPointer",value:function(e){var t,n=this;return null!==(t=this.rowTargets.find(function(t){if(t===n.draggedRow)return!1;var r=t.getBoundingClientRect();return e>=r.top&&e<=r.bottom}))&&void 0!==t?t:null}},{key:"toggleNotApplicable",value:function(){this.naLabelTarget.classList.toggle("hide",!this.naCheckboxTarget.checked)}},{key:"validateScore",value:function(e){var t=e.currentTarget;return this.applyScoreValidation(t)}},{key:"applyScoreValidation",value:function(e){var t=this.scoreErrorMessage(e.value);return e.classList.toggle("is-invalid",!!t),!t}},{key:"scoreErrorMessage",value:function(e){var t=e.trim();return t?l.test(t)?t.replace("-","").replace(/^0+(?=\d)/,"").length>12?"Score is too large":null:"Score must be a whole number":"Score is required"}},{key:"allScoresValid",value:function(){var e=this;return this.scoreInputTargets.map(function(t){return e.applyScoreValidation(t)}).every(Boolean)}},{key:"validateLabel",value:function(e){var t=e.currentTarget;return this.applyLabelValidation(t)}},{key:"applyLabelValidation",value:function(e){var t=""!==e.value.trim();return e.classList.toggle("is-invalid",!t),t}},{key:"allLabelsValid",value:function(){var e=this;return this.labelInputTargets.map(function(t){return e.applyLabelValidation(t)}).every(Boolean)}},{key:"save",value:function(){this.allScoresValid(),this.allLabelsValid(),this.formTarget.requestSubmit()}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);
2d.targets=["rows","row","rowTemplate","form","saveButton","naCheckbox","naLabel","scoreInput","labelInput"],d.values={hasErrors:Boolean}},958:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"resetModalForm",value:function(e){window.document.getElementById("".concat(e.target.href.split("#")[1],"_form")).reset()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},3186:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.originalFormTarget=this.formTarget.action}},{key:"changeSelection",value:function(e){this.formTarget.action=e.target.dataset.path}},{key:"saveButtonClick",value:function(e){e.preventDefault();var t=(0,o.T)();this.formTarget.action===this.originalFormTarget?t&&t.modal.close():(t&&t(e.target).addClass("disabled").text("Saving ..."),Rails.fire(this.formTarget,"submit"))}},{key:"success",value:function(){var e=this.containerTarget;e.parentElement.removeChild(e);var t=(0,o.T)();t&&t.modal.close()}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["form","saveButton","container"]},5292:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"updateTotal",value:function(){var e=(parseInt(this.quantitySelectTarget.value)*this.pricePerReminderValue/100).toFixed(2);this.totalPriceTarget.textContent="$".concat(e)}},{key:"showNewCardForm",value:function(){this.existingCardSectionTarget.classList.add("hidden"),this.newCardSectionTarget.classList.remove("hidden")}},{key:"showExistingCardForm",value:function(){this.newCardSectionTarget.classList.add("hidden"),this.existingCardSectionTarget.classList.remove("hidden")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["quantitySelect","totalPrice","form","existingCardSection","newCardSection"],s.values={pricePerReminder:Number}},5904:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.updateButtons(),this.updateTotal()}},{key:"increment",value:function(){var e=this.currentQuantity;e<this.maxValue&&(this.quantityInputTarget.value=String(e+1),this.onChange())}},{key:"decrement",value:function(){var e=this.currentQuantity;e>this.minValue&&(this.quantityInputTarget.value=String(e-1),this.onChange())}},{key:"inputChanged",value:function(){var e=parseInt(this.quantityInputTarget.value);(isNaN(e)||e<this.minValue)&&(e=this.minValue),e>this.maxValue&&(e=this.maxValue),this.quantityInputTarget.value=String(e),this.onChange()}},{key:"onChange",value:function(){this.updateButtons(),this.updateTotal(),this.dispatchQuantityChanged()}},{key:"currentQuantity",get:function(){return parseInt(this.quantityInputTarget.value)||this.minValue}},{key:"totalCents",get:function(){return this.currentQuantity*this.priceValue}},{key:"updateButtons",value:function(){var e=this.currentQuantity;this.decrementBtnTarget.disabled=e<=this.minValue,this.incrementBtnTarget.disabled=e>=this.maxValue}},{key:"updateTotal",value:function(){this.totalPriceTarget.textContent="$".concat(this.formatDollars(this.totalCents))}},{key:"dispatchQuantityChanged",value:function(){this.dispatch("quantityChanged",{detail:{quantity:this.currentQuantity,totalCents:this.totalCents,totalFormatted:this.formatDollars(this.totalCents),pricePerItemCents:this.priceValue},bubbles:!0})}},{key:"formatDollars",value:function(e){return(e/100).toFixed(2)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["quantityInput","totalPrice","decrementBtn","incrementBtn"],s.values={min:Number,max:Number,price:Number}},7806:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}n.r(t),n.d(t,{default:function(){return d}});var d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=c(this,t,[].concat(r))).stripe=void 0,e.card=void 0,e.usingNewCard=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){this.usingNewCard=!this.hasExistingCardSectionTarget,this.usingNewCard&&this.initializeStripe()}},{key:"updateTotal",value:function(){var e=(parseInt(this.quantitySelectTarget.value)*this.pricePerReminderValue/100).toFixed(2);this.totalPriceTarget.textContent="$".concat(e)}},{key:"showNewCardForm",value:function(){this.existingCardSectionTarget.classList.add("hidden"),this.newCardSectionTarget.classList.remove("hidden"),this.usingNewCard=!0,this.initializeStripe()}},{key:"showExistingCardForm",value:function(){this.newCardSectionTarget.classList.add("hidden"),this.existingCardSectionTarget.classList.remove("hidden"),this.usingNewCard=!1}},{key:"initializeStripe",value:function(){if(!this.stripe){this.stripe=Stripe(this.stripeKeyValue);var e=this.stripe.elements({fonts:[{cssSrc:"//fonts.googleapis.com/css?family=Lato:400,400italic,700,700italic"}],locale:"auto"});this.card=e.create("card",{iconStyle:"solid",hidePostalCode:!0,style:{base:{fontFamily:"Lato",fontSize:"18px"}}}),this.card.mount(this.cardElementTarget)}}},{key:"submit",value:(s=r().m(function e(t){var n,o,i,a;return r().w(function(e){for(;;)switch(e.n){case 0:if(this.usingNewCard){e.n=1;break}return"undefined"!==typeof NProgress&&NProgress.start(),e.a(2);case 1:return t.preventDefault(),"undefined"!==typeof NProgress&&NProgress.start(),this.submitButtonTarget.disabled=!0,e.n=2,this.stripe.createToken(this.card,{name:this.fullNameValue});case 2:n=e.v,o=n.token,(i=n.error)?((a=document.getElementById("card-errors"))&&(a.textContent=i.message),this.submitButtonTarget.disabled=!1,"undefined"!==typeof NProgress&&NProgress.done()):this.stripeResponseHandler(o);case 3:return e.a(2)}},e,this)}),l=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function a(e){i(o,n,r,a,u,"next",e)}function u(e){i(o,n,r,a,u,"throw",e)}a(void 0)})},function(e){return l.apply(this,arguments)})},{key:"stripeResponseHandler",value:function(e){var t=document.createElement("input");t.setAttribute("type","hidden"),t.setAttribute("name","stripe_token"),t.setAttribute("value",e.id),this.formTarget.appendChild(t),this.formTarget.submit()}}],o&&a(n.prototype,o),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,u,s,l}(n(5396).xI);d.targets=["quantitySelect","totalPrice","form","existingCardSection","newCardSection","cardElement","submitButton"],d.values={pricePerReminder:Number,stripeKey:String,fullName:String}},2357:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.hideTextNode=document.createTextNode("Hide Settings"),this.showTextNode=document.createTextNode("Show Settings")}},{key:"backButton",value:function(e){e.preventDefault(),"true"===this.dirtyInputTarget.value&&confirm("You have unsaved changes, do you want to save them?")&&this.saveSettingsButton(e),window.top.location=e.target.getAttribute("href")}},{key:"saveSettingsButton",value:function(e){var t="".concat(this.identifier,":saveSettings");e.preventDefault(),this.dirtyInputTarget.value=!1,e.target.classList.add("disabled"),this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0}))}},{key:"optionsToggleButton",value:function(e){var t="".concat(this.identifier,":toggleSettings"),n="show"==this.hideSettingsButtonTarget.dataset.showHideStatus?"hide":"show",o="show"==n?this.hideTextNode:this.showTextNode,i=r(this.hideSettingsButtonTarget.childNodes).filter(function(e){return e.nodeType==Node.TEXT_NODE})[0];e.preventDefault(),this.hideSettingsButtonTarget.replaceChild(o,i),this.hideSettingsButtonTarget.dataset.showHideStatus=n,this.element.dispatchEvent(new CustomEvent(t,{detail:{showHideStatus:n},bubbles:!0}))}},{key:"shareButton",value:function(e){"true"===this.dirtyInputTarget.value?(e.preventDefault(),alert("Please save your changes first before clicking Share")):NProgress.start()}},{key:"printButton",value:function(e){var t=document.title;e.preventDefault(),document.title="Voting Results",window.print(),document.title=t}},{key:"downloadReportButton",value:function(e){e.preventDefault(),"true"===this.dirtyInputTarget.value?alert("Please save your changes first before clicking Download"):window.top.location=e.target.getAttribute("href")}},{key:"preventDownloadReportOnResultsAccessNotAllowed",value:function(e){e.preventDefault(),alert("You can only download the report after the vote is completed")}}])&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.targets=["hideSettingsButton","dirtyInput"]},6491:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"saveResultsSettingsButton",value:function(e){var t,n="".concat(this.identifier,":saveSettings");this.element.dispatchEvent(new CustomEvent(n,{bubbles:!0})),this.containerTarget.classList.add("hide"),this.savingMessageTarget.classList.remove("hide"),null===(t=document.querySelector('[data-controller="'.concat(this.votingResultsSettingsDataControllerHiddenFieldTarget.value,'"]')))||void 0===t||null===(t=t.querySelectorAll("input, select, textarea, button"))||void 0===t||t.forEach(function(e){return e.disabled=!0}),window.top.location=this.pageSourceHiddenFieldTarget.value}},{key:"cancelResultsSettingsButton",value:function(e){NProgress.start(),window.top.location=this.pageSourceHiddenFieldTarget.value}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
vendor: 1,318 bytes, line 2
2(n(5396).xI);s.targets=["container","saveResultsSettingsButton","cancelResultsSettingsButton","pageSourceHiddenField","votingResultsSettingsDataControllerHiddenField","savingMessage"]},7213:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).acceptedValue=void 0,e.voteIdValue=void 0,e.csrfTokenValue=void 0,e.optionValue=void 0,e.weightedValue=void 0,e.hightIntegrityVoteValue=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.acceptedValue=this.data.get("accepted"),this.voteIdValue=this.data.get("vote-id"),this.csrfTokenValue=this.data.get("csrf-token"),this.hightIntegrityVoteValue=this.data.get("high-integrity-vote")}},{key:"handleClick",value:function(e){var t,n,r=e.currentTarget;if(this.optionValue=null!==(t=r.dataset.option)&&void 0!==t?t:null,this.weightedValue=null!==(n=r.dataset.weighted)&&void 0!==n?n:null,"true"===this.hightIntegrityVoteValue&&"true"!==this.acceptedValue){e.preventDefault();var i=(0,o.T)();i&&(i("body").append(this.modal()),i("#export-result-modal").modal())}}},{key:"modal",value:function(){return'\n    <div id="export-result-modal" class="modal">\n      <h3 class="template_error">Warning</h3>\n      <p>If 1 or more of your Reporting Groups have 1 vote, you can potentially link these voters to their voting choices. Do you want continue and view Reporting Group results?</p>\n      <div class="actions">\n        <form action="/elections/'.concat(this.voteIdValue,'/reports/results/acceptances" method="post">\n          <input type="hidden" name="_method" value="put" />\n          <input type="hidden" name="vote_id" value="').concat(this.voteIdValue,'" />\n          <input type="hidden" name="option" value="').concat(this.optionValue,'" />\n          <input type="hidden" name="weighted" value="').concat(this.weightedValue,'" />\n          <input type="hidden" name="authenticity_token" value="').concat(this.csrfTokenValue,'" />\n          <button type="submit" class="btn btn--orange">Continue</button>\n        </form>\n        <a class="btn btn--orange" rel="modal:close">Cancel</a>\n      </div>\n    </div>\n    ')}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["dialog"]},7933:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.element.addEventListener("turbo:submit-end",function(e){return NProgress.done()})}},{key:"updateOverview",value:function(e){NProgress.start(),this.skipPersistenceInputTarget.value="true",this.formTarget.requestSubmit()}},{key:"triggerSaveSettings",value:function(e){NProgress.start(),e.preventDefault(),this.formTarget.requestSubmit()}},{key:"triggerToggleSettings",value:function(e){"show"===e.detail.showHideStatus?this.containerTarget.classList.remove("hidden"):this.containerTarget.classList.add("hidden")}},{key:"handleVoterViewResultsChange",value:function(e){e.detail.fromModal?this.element.querySelector('input[name="results_viewable_for_voter"][value="'.concat(e.detail.voterViewResultsType,'"]')).click():this.updateOverview()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["container","form","skipPersistenceInput"]},6519:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"fireEvent",value:function(e){var t,n="".concat(this.identifier,":voterViewResultsType"),r="true"===(null!==(t=e.target.dataset.fromModal)&&void 0!==t?t:"false");e.preventDefault(),this.element.dispatchEvent(new CustomEvent(n,{detail:{voterViewResultsType:e.target.value,fromModal:r},bubbles:!0}))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},3262:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"handleSaveVoterResultsSettings",value:function(e){this.dirtyInputTarget.value="false"}},{key:"loadReport",value:function(e){"true"===this.dirtyInputTarget.value&&(e.preventDefault(),alert("Please save your changes first before accessing the report"))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["dirtyInput"]},3154:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return f(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),p=s.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,f(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=s,f(p,"constructor",s),f(s,"constructor",c),c.displayName="GeneratorFunction",f(s,o,"GeneratorFunction"),f(p),f(p,o,"Generator"),f(p,r,function(){return this}),f(p,"toString",function(){return"[object Generator]"}),(l=function(){return{w:i,m:h}})()}function f(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}f=function(e,t,n,r){function i(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},f(e,t,n,r)}function d(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){h(i,r,o,a,u,"next",e)}function u(e){h(i,r,o,a,u,"throw",e)}a(void 0)})}}var y=function(){var e=v(l().m(function e(t){var n;return l().w(function(e){for(;;)switch(e.n){case 0:return n=[new ClipboardItem(d({},t.type,t))],e.n=1,navigator.clipboard.write(n);case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),a(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.originalQrButtonContent=this.qrButtonTarget.innerHTML,this.qrContainerElement=this.qrImageContainerTarget,this.qrImageElement=this.qrImageTagTarget,this.copyQRInsideModal=this.copyQRCodeInsideModalButtonTarget,this.copyQRInsideModal.addEventListener("click",this.copyQRCodeButtonClicked.bind(this))}},{key:"qrButtonClicked",value:function(e){var t=e.target;t.innerText.match(/copy/i)?this.copyQrImageToClipBoard(this.qrImageElement,t):this.openModal()}},{key:"copyQRCodeButtonClicked",value:function(e){var t=e.target;this.copyQrImageToClipBoard(this.qrImageElement,t)}},{key:"copyQrImageToClipBoard",value:(c=v(l().m(function e(t,n){var r,o,i,a;return l().w(function(e){for(;;
2)switch(e.n){case 0:if(!(r=t.getAttribute("src"))){e.n=4;break}return e.n=1,fetch(r);case 1:return o=e.v,e.n=2,o.blob();case 2:return i=e.v,e.n=3,y(i);case 3:a=n.innerHTML,n.innerHTML="Copied!",setTimeout(function(){n.innerHTML=a},1e3);case 4:return e.a(2)}},e)})),function(e,t){return c.apply(this,arguments)})},{key:"openModal",value:function(){var e=(0,o.T)();e&&e(this.qrContainerElement).modal()}}],r&&i(n.prototype,r),u&&i(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u,c}(r.xI);m.targets=["qrImageContainer","qrButton","qrImageTag","copyQRCodeInsideModalButton"]},6474:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).clickOutsideListener=void 0,e.keyDownListener=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.clickOutsideListener=function(t){return e.handleClickOutside(t)},this.keyDownListener=function(t){return e.handleKeyDown(t)}}},{key:"disconnect",value:function(){this.removeGlobalListeners()}},{key:"toggle",value:function(e){e.preventDefault(),this.isOpen()?this.close():this.open()}},{key:"open",value:function(){this.menuTarget.classList.add("open"),this.arrowTarget.classList.add("open-up"),document.addEventListener("click",this.clickOutsideListener),document.addEventListener("keydown",this.keyDownListener)}},{key:"close",value:function(){this.menuTarget.classList.remove("open"),this.arrowTarget.classList.remove("open-up"),this.removeGlobalListeners()}},{key:"isOpen",value:function(){return this.menuTarget.classList.contains("open")}},{key:"handleClickOutside",value:function(e){this.element.contains(e.target)||this.close()}},{key:"handleKeyDown",value:function(e){"Escape"===e.key&&this.close()}},{key:"removeGlobalListeners",value:function(){document.removeEventListener("click",this.clickOutsideListener),document.removeEventListener("keydown",this.keyDownListener)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["menu","arrow"]},570:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"validate",value:function(){var e=this.inputTarget,t=Number(e.getAttribute("max")),n=Number(e.value);this.messageTarget.textContent=t&&n>t?"The maximum allowed value is ".concat(t,"."):""}},{key:"increment",value:function(e){e.preventDefault(),this.inputTarget.stepUp(),this.validate(),this.dispatchEvent()}},{key:"decrement",value:function(e){e.preventDefault(),this.inputTarget.stepDown(),this.validate(),this.dispatchEvent()}},{key:"dispatchEvent",value:function(){this.inputTarget.dispatchEvent(new Event("change",{bubbles:!0}))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["input","message"]},550:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"initialize",value:function(){var e=this;this.membershipTierTarget.addEventListener("change",function(t){return e.changeSelectTextColor(t.target)}),this.changeSelectTextColor(this.membershipTierTarget)}},{key:"changeSelectTextColor",value:function(e){""===e.value?e.classList.add("placeholder"):e.classList.remove("placeholder")}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["membershipTier"]},4054:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f="multiple-select:loaded",d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).onPluginLoaded=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this;this.tryInitialize()||(console.warn("[MultipleSelectComponent] multipleSelect plugin not loaded yet \u2014 waiting for '".concat(f,"'.")),this.onPluginLoaded=function(){return e.tryInitialize()},document.addEventListener(f,this.onPluginLoaded))}},{key:"disconnect",value:function(){this.onPluginLoaded&&(document.removeEventListener(f,this.onPluginLoaded),this.onPluginLoaded=null)}},{key:"tryInitialize",value:function(){var e=(0,o.T)();return!(!e||"function"!==typeof e.fn.multipleSelect)&&(e(this.selectTarget).multipleSelect({allSelected:!0,selectAll:!0,formatAllSelected:function(){return"All"},formatSelectAll:function(){return"Select All / None"},maxHeight:"600",placeholder:"State"}),this.onPluginLoaded&&(document.removeEventListener(f,this.onPluginLoaded),this.onPluginLoaded=null),!0)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);d.targets=["select"]},56:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.addEventListeners()}},{key:"addEventListeners",value:function(){var e=this,t=document.querySelector(".shared--organization-types-component select"),n=document.querySelector(".shared--relationship-with-org");t&&n&&t.addEventListener("change",function(){t.value&&e.removeHiddenClass(n)}),t.value||n.classList.add("hidden")}},{key:"removeHiddenClass",value:function(e){e.classList.remove("hidden")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI)},9570:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"initialize",value:function(){this.addEventListeners(),this.applyInitialStyles(),this.setInitialOrganizationTypeOtherValue()}},{key:"addEventListeners",value:function(){this.orgTypeSelectTarget.addEventListener("change",this.handleOrgTypeChange.bind(this)),this.predefinedOtherSelectTarget.addEventListener("change",this.handlePredefinedOtherChange.bind(this))}},{key:"applyInitialStyles",value:function(){this.changeSelectTextColor(this.orgTypeSelectTarget),this.displayOrganizationTypeOther(this.orgTypeSelectTarget),this.changeSelectTextColor(this.predefinedOtherSelectTarget),this.displayOtherTextInput(this.predefinedOtherSelectTarget)}},{key:"handleOrgTypeChange",value:function(e){var t=e.target;this.displayOrganizationTypeOther(t),this.changeSelectTextColor(t)}},{key:"handlePredefinedOtherChange",value:function(e){var t=e.target;this.updateOtherTextInput(t),this.changeSelectTextColor(t),this.displayOtherTextInput(t)}},{key:"changeSelectTextColor",value:function(e){e.classList.toggle("placeholder",""===e.value)}},{key:"displayOrganizationTypeOther",value:function(e){var t=e.options[e.selectedIndex].text,n=this.predefinedOtherOptionsValue[t];this.resetPredefinedSelectAndTextInput(),n?this.populatePredefinedOptions(n):this.showTextInput()}},{key:"resetPredefinedSelectAndTextInput",value:function(){this.predefinedOtherSelectTarget.innerHTML="",this.organizationTypeOtherValue||(this.textTarget.value="")}},{key:"populatePredefinedOptions",value:function(e){var t=this;this.predefinedOtherSelectTarget.classList.remove("hidden"),this.textTarget.classList.add("hidden");var n=this.createOptionElement("","Select a type");n.hidden=!0,this.predefinedOtherSelectTarget.appendChild(n),e.forEach(function(e){t.predefinedOtherSelectTarget.appendChild(t.createOptionElement(e))}),this.changeSelectTextColor(this.predefinedOtherSelectTarget)}},{key:"showTextInput",value:function(){this.predefinedOtherSelectTarget.classList.add("hidden"),this.textTarget.classList.remove("hidden")}},{key:"createOptionElement",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=document.createElement("option");return n.value=e,n.textContent=t,n}},{key:"displayOtherTextInput",value:function(e){var t=e.value.includes("Other");this.textTarget.classList.toggle("hidden",!t),t&&(this.textTarget.value="")}},{key:"updateOtherTextInput",value:function(e){this.textTarget.value=e.value}},{key:"setInitialOrganizationTypeOtherValue",value:function(){var e=this;this.organizationTypeOtherValue&&(Array.from(this.predefinedOtherSelectTarget.options).some(function(t){return t.value===e.organizationTypeOtherValue})?(this.predefinedOtherSelectTarget.value=this.organizationTypeOtherValue,this.textTarget.classList.add("hidden")):(this.textTarget.value=this.organizationTypeOtherValue,this.textTarget.classList.remove("hidden"),this.predefinedOtherSelectTarget.classList.add("hidden")))}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["orgTypeSelect","predefinedOtherSelect","text"],s.values={predefinedOtherOptions:Object,organizationTypeOther:String}},8772:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){Pagy.init(this.element)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},6950:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"initialize",value:function(){var e=this;this.relationshipWithOrgTarget.addEventListener("change",function(t){return e.changeSelectTextColor(t.target)}),this.changeSelectTextColor(this.relationshipWithOrgTarget)}},{key:"changeSelectTextColor",value:function(e){""===e.value?e.classList.add("placeholder"):e.classList.remove("placeholder"),e.value.toLowerCase().includes("voter")?this.showVoterMessage():this.hideVoterMessage()}},{key:"showVoterMessage",value:function(){this.voterMessageTarget.classList.remove("hidden")}},{key:"hideVoterMessage",value:function(){this.voterMessageTarget.classList.add("hidden")}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["relationshipWithOrg","voterMessage"]},203:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(5396),o=n(7749),i=n(6923);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var h={default:[[{size:[]}],["bold","italic","underline","link","video","strike"],[{color:["#000000","#FFFFFF","#E60000","#FF9900","#FFFF00","#008A00","#0066CC","#9933FF"]},{background:["#FFFFFF","#FACCCC","#FFEBCC","#FFFFCC","#CCE8CC","#CCE0F5","#EBD6FF","#BBBBBB"]}],[{list:"ordered"},{list:"bullet"}],[{align:[]}],["divider","clean"]],minimal:[],email:[[{size:[]}],["bold","italic","underline","link","strike"],[{color:["#000000","#FFFFFF","#E60000","#FF9900","#FFFF00","#008A00","#0066CC","#9933FF"]},{background:["#FFFFFF","#FACCCC","#FFEBCC","#FFFFCC","#CCE8CC","#CCE0F5","#EBD6FF","#BBBBBB"]}],[{list:"bullet"}],[{align:[]}],["divider","clean"]]},v=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=l(this,t,[].concat(r))).saved=!0,e.quill=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){var e,t=this;this.initializeQuill(),setTimeout(function(){t.removeTrailingBreaks(),t.inputTarget.value=t.getEditorContent()},0),setInterval(this.updateInputValueWithQuillContent.bind(this),2e3),window.onbeforeunload=function(){if(!t.saved)return"There are unsaved changes. Are you sure you want to leave?"};var n=window.EB.RichTextFields&&window.EB.RichTextFields[this.containerTarget.dataset.id];null===n||void 0===n||null===(e=n.childrenInitCallback)||void 0===e||e.call(n,this)}},{key:"initializeQuill",value:function(){var e=this;this.quill=new o.Ay(this.textContainerTarget,this.getOptions());var t=this.textContainerTarget.querySelector(".ql-editor");t&&t.addEventListener("keydown",function(t){"Enter"===t.key&&t.shiftKey&&(t.stopImmediatePropagation(),t.preventDefault(),document.execCommand("insertLineBreak"),e.quill.update(
2))},!0),this.quill.on("text-change",function(){e.saved=!1,e.emitContentChangeEvent()}),"true"===this.containerTarget.dataset.disabled&&this.quill.enable(!1),this.addToolbarTooltips(),this.registerVideoHandler()}},{key:"emitContentChangeEvent",value:function(){var e=this.isEditorEmpty(),t=new CustomEvent("quill:content-changed",{detail:{isEmpty:e,content:this.quill.getText()},bubbles:!0});this.element.dispatchEvent(t)}},{key:"isEditorEmpty",value:function(){var e=this.quill.getText().trim(),t=null!==this.textContainerTarget.querySelector(".ql-editor img"),n=null!==this.textContainerTarget.querySelector(".ql-editor iframe");return""===e&&!t&&!n}},{key:"updateInputValueWithQuillContent",value:function(){if(!this.saved){var e=this.getEditorContent();this.inputTarget.value=e;var t=(0,i.T)();t&&t(".rich_text_textarea").trigger("change"),this.saved=!0}}},{key:"removeTrailingBreaks",value:function(){var e=this.quill.getLength();if(!(e<=1)){var t=a(this.quill.getLine(e-1),1)[0];if(t){var n=this.quill.getIndex(t),r=t.length()-1;if(!(r<=0)){for(var i,u=t.domNode,c=document.createTreeWalker(u,NodeFilter.SHOW_TEXT);null!==(i=c.nextNode());){var s;if(""!==(null!==(s=i.textContent)&&void 0!==s?s:"").trim())return}u.querySelector("img, iframe")||this.quill.deleteText(n,r,o.Ay.sources.SILENT)}}}}},{key:"getEditorContent",value:function(){var e,t,n=this.textContainerTarget.querySelector(".ql-editor");if(!n)return"";for(var r=n.innerHTML,o=-1,i=!1,a=r.length-1;a>=0;a--){var u=r[a];if(">"!==u)if("<"!==u){if(!i&&""!==u.trim()){o=a;break}}else i=!1;else i=!0}if(-1===o)return"";var c=null!==(e=null===(t=r.substring(o+1).match(/^(<\/[a-zA-Z][^>]*>)+/))||void 0===t?void 0:t[0])&&void 0!==e?e:"";return r.substring(0,o+1)+c}},{key:"getOptions",value:function(){var e=o.Ay.import("delta");return{modules:{toolbar:h[this.containerTarget.dataset.toolbarStyle]||h.default,clipboard:{matchers:[["BR",function(t,n){return(new e).insert({break:!0})}]]}},theme:"snow",placeholder:this.containerTarget.dataset.placeholder||""}}},{key:"registerVideoHandler",value:function(){this.quill.getModule("toolbar").addHandler("video",this.videoHandler.bind(this))}},{key:"videoHandler",value:function(){var e=this.quill.getSelection(!0),t=prompt("Enter the video URL:");if(t){var n=this.adjustVideoUrl(t);this.quill.insertEmbed(e.index,"video",n,o.Ay.sources.USER),this.saved=!1}}},{key:"adjustVideoUrl",value:function(e){var t=e.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?(.*&)?v=|youtube\.com\/embed\/|youtu\.be\/)([\w\-]{11})(\?.*)?$/);if(t&&t[2]){var n=t[2],r=t[3]||"";return"https://www.youtube.com/embed/".concat(n).concat(r)}var o=e.match(/^(?:https?:\/\/)?(?:www\.)?vimeo\.com\/(?:.*\/)?(\d+)(?:$|\/|\?)/);if(o&&o[1]){var i=o[1];return"https://player.vimeo.com/video/".concat(i)}var a=e.match(/^(https?:\/\/(?:[\w\.-]+\.wistia\.com))\/(medias|embed)\/([a-zA-Z0-9]+)/);if(a&&a[1]&&a[3]){var u=a[1],c=a[3];return"".concat(u,"/embed/iframe/").concat(c)}var s=e.match(/^(?:https?:\/\/)?(?:www\.)?dailymotion\.com\/video\/([a-zA-Z0-9]+)/);if(s&&s[1]){var l=s[1];return"https://www.dailymotion.com/embed/video/".concat(l)}return e}},{key:"addToolbarTooltips",value:function(){var e=this;[{selector:".ql-picker-label",title:"Font Size"},{selector:"button.ql-bold",title:"Bold"},{selector:"button.ql-italic",title:"Italic"},{selector:"button.ql-underline",title:"Underline"},{selector:"button.ql-link",title:"Link"},{selector:"button.ql-strike",title:"Strike"},{selector:".ql-color.ql-color-picker",title:"Color"},{selector:".ql-background.ql-color-picker",title:"Background Color"},{selector:"button.ql-list",title:"Ordered List"},{selector:'button.ql-list[value="bullet"]',title:"Bullet List"},{selector:".ql-align",title:"Align"},{selector:"button.ql-video",title:"Video"}].forEach(function(t){var n=t.selector,r=t.title,o=e.containerTarget.querySelector(n);o&&o.setAttribute("title",r)})}}],r&&c(n.prototype,r),u&&c(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u}(r.xI);v.targets=["input","container","textContainer"]},6770:function(e,t,n){"use strict";function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
vendor: 1,957 bytes, line 2
2if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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 a,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).btn=null,e.dropdown=null,e.outsideClickHandler=null,e.escapeHandler=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){this.bindButton(),this.buildDropdownIfAbsent(),this.attachGlobalListeners()}},{key:"bindButton",value:function(){var e=this,t=this.element.querySelector(":scope > .shared--searchable-dropdown-component__btn");this.btn=null!==t&&void 0!==t?t:this.buildButton(),"true"!==this.btn.dataset.clickBound&&(this.btn.dataset.clickBound="true",this.btn.addEventListener("click",function(){return e.toggle()}))}},{key:"buildDropdownIfAbsent",value:function(){var e=this.element.querySelector(":scope > .shared--searchable-dropdown-component__dropdown");e?this.dropdown=e:this.buildDropdown()}},{key:"attachGlobalListeners",value:function(){var e=this;this.outsideClickHandler=function(t){e.isOpen()&&!e.element.contains(t.target)&&e.close()},document.addEventListener("click",this.outsideClickHandler),this.escapeHandler=function(t){"Escape"===t.key&&e.isOpen()&&e.close()},document.addEventListener("keydown",this.escapeHandler)}},{key:"disconnect",value:function(){this.outsideClickHandler&&(document.removeEventListener("click",this.outsideClickHandler),this.outsideClickHandler=null),this.escapeHandler&&(document.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null)}},{key:"truncate",value:function(e,t){return e.length>t?e.slice(0,t)+"\u2026":e}},{key:"label",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.truncateAtValue;return t>0?this.truncate(e,t):e}},{key:"buildButton",value:function(){var e,t=this.itemsValue.find(function(e){return e.current}),n=this.label(null!==(e=null===t||void 0===t?void 0:t.label)&&void 0!==e?e:this.fallbackLabelValue,this.buttonTruncateAtValue),r=document.createElement("button");return r.type="button",r.className="shared--searchable-dropdown-component__btn",r.setAttribute("aria-haspopup","true"),r.setAttribute("aria-expanded","false"),r.innerHTML='<span class="shared--searchable-dropdown-component__label">'.concat(n,'</span><span class="shared--searchable-dropdown-component__arrow" aria-hidden="true">&#9660;</span>'),this.element.appendChild(r),r}},{key:"buildDropdown",value:function(){var e,t=this,n=document.createElement("div");n.className="shared--searchable-dropdown-component__dropdown",n.hidden=!0;var o=document.createElement("ul");o.className="shared--searchable-dropdown-component__pinned";var i=document.createElement("ul");if(i.className="shared--searchable-dropdown-component__list",null!==(e=this.backLinkValue)&&void 0!==e&&e.url){var a,u=document.createElement("li");u.className="shared--searchable-dropdown-component__back-link-item";var c=document.createElement("a");c.href=this.backLinkValue.url,c.textContent=null!==(a=this.backLinkValue.label)&&void 0!==a?a:"",u.appendChild(c),o.appendChild(u)}var s=null,l=null,f=[];if(this.searchableValue){var d=document.createElement("li");d.className="shared--searchable-dropdown-component__search-item",(s=document.createElement("input")).type="text",s.className="shared--searchable-dropdown-component__search",s.placeholder=this.searchPlaceholderValue,s.autocomplete="off",d.appendChild(s),o.appendChild(d),(l=document.createElement("li")).className="shared--searchable-dropdown-component__search-empty",l.textContent=this.emptyStateTextValue||"No results found",l.hidden=!0,i.appendChild(l)}var p,h=r(this.itemsValue);try{var v=function(){var e=p.value;if(e.divider){var n=document.createElement("li");return n.className="shared--searchable-dropdown-component__divider",n.setAttribute("role","separator"),n.setAttribute("aria-hidden","true"),n.textContent="",i.appendChild(n),0}if(e.current&&t.excludeCurrentItemValue)return 0;var r=document.createElement("li");if(e.current&&!t.excludeCurrentItemValue){var o=document.createElement("span");o.className="shared--searchable-dropdown-component__current-indicator",o.setAttribute("aria-hidden","true"),o.textContent="\u25b6",r.appendChild(o)}if(e.disabled){var a,u=document.createElement("span");u.className="shared--searchable-dropdown-component__link--disabled",u.dataset.tooltip=null!==(a=e.tooltip)&&void 0!==a?a:"",u.textContent=e.label,r.appendChild(u)}else{var c=document.createElement("a");c.href=e.url;var s=e.primary?"Primary - ".concat(e.label):e.label;c.textContent=t.label(s),c.title=s,e.primary&&(c.style.fontWeight="bold"),"jquery"===e.modal&&(c.rel="modal:open"),"turbo"===e.modal&&(c.dataset.turbo="true",c.dataset.turboFrame="modal"),e.checkProxy?c.addEventListener("click",function(n){n.preventDefault(),t.close(),t.dis
2patch("checkProxy",{detail:{targetHref:e.url}})}):(e.method&&(c.dataset.method=e.method),e.confirm&&(c.dataset.confirm=e.confirm)),r.appendChild(c)}if(i.appendChild(r),t.searchableValue){var l=e.primary?"Primary - ".concat(e.label):e.label;f.push({li:r,searchText:l.toLowerCase()})}};for(h.s();!(p=h.n()).done;)v()}catch(y){h.e(y)}finally{h.f()}s&&l&&s.addEventListener("input",function(){var e=s.value.toLowerCase().trim(),t=0;f.forEach(function(n){var r=n.li,o=n.searchText,i=!e||o.includes(e);r.hidden=!i,i&&t++}),l.hidden=t>0,i.scrollTop=0}),this.dropdown=n,o.childElementCount>0&&n.appendChild(o),n.appendChild(i),this.element.appendChild(n)}},{key:"isOpen",value:function(){return!!this.dropdown&&!this.dropdown.hidden}},{key:"toggle",value:function(){this.isOpen()?this.close():this.open()}},{key:"open",value:function(){var e=this;this.dropdown&&this.btn&&(this.dropdown.hidden=!1,this.btn.setAttribute("aria-expanded","true"),this.searchableValue&&requestAnimationFrame(function(){var t;e.dropdown&&!e.dropdown.style.minWidth&&(e.dropdown.style.minWidth="".concat(e.dropdown.offsetWidth,"px"));var n=null===(t=e.dropdown)||void 0===t?void 0:t.querySelector(".shared--searchable-dropdown-component__search");null===n||void 0===n||n.focus()}))}},{key:"close",value:function(){if(this.dropdown&&this.btn&&(this.dropdown.hidden=!0,this.btn.setAttribute("aria-expanded","false"),this.searchableValue)){var e=this.dropdown.querySelector(".shared--searchable-dropdown-component__search");e&&(e.value="",e.dispatchEvent(new Event("input")))}}}],o&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.values={items:Array,fallbackLabel:String,searchable:Boolean,searchPlaceholder:String,backLink:Object,truncateAt:Number,buttonTruncateAt:Number,excludeCurrentItem:Boolean,emptyStateText:String}},8866:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggle",value:function(){this.panelTarget.classList.toggle("hidden")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["panel"]},6334:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396),o=n(7749),i=n(6923);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){window.EB.RichTextFields=window.EB.RichTextFields||{},window.EB.RichTextFields[this.containerTarget.dataset.id]=this}},{key:"childrenInitCallback",value:function(e){var t=this,n=(0,i.T)();if(n){var r=n(this.variablesSelectTarget).select2({placeholder:"Variables",value:null});r.on("select2:select",function(n){t.insertVariableIntoTemplate(e.quill,r,n)(n)}),r.on("change",function(e){e.stopPropagation()}),r.val(null).trigger("change");var o=this.variablesSelectTarget.nextElementSibling,a=e.quill.container.previousElementSibling;o&&a.append(o)}}},{key:"insertVariableIntoTemplate",value:function(e,t,n){return function(r){var i=n.target.value,a=e.getSelection(!0);i&&(e.insertText(a.index,i,o.Ay.sources.USER),e.setSelection(a.index+i.length,o.Ay.sources.SILENT),t.val(null).trigger("change"))}}}])&&a(n.prototype,r),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u}(r.xI);d.targets=["container","variablesSelect"]},1118:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).progressClassNames=["nprogress-busy"],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.openModal(),window.EB=window.EB||{},window.EB.TurboModal=this}},{key:"openModal",value:function(){this.modalTarget.isOpened||(this.modalTarget.style.display="inline-block",document.body.style.overflow="hidden")}},{key:"hideModal",value:function(){document.body.style.overflow="",this.element.parentElement.removeAttribute("src"),this.modalTarget.remove(),this.findHTMLElement().remove()}},{key:"disconnect",value:function(){document.body.style.overflow=""}},{key:"closeWithKeyboard",value:function(e){"Escape"===e.code&&this.hideModal()}}
2,{key:"closeBackground",value:function(e){e&&this.blockModalClosing(e)||this.hideModal()}},{key:"toggleFullScreen",value:function(){this.modalTarget.isFullScreen=!this.modalTarget.isFullScreen,this.modalTarget.isFullScreen?this.modalTarget.classList.add("fullscreen"):this.modalTarget.classList.remove("fullscreen")}},{key:"findHTMLElement",value:function(){return document.querySelector(".turbo-modal-component")}},{key:"blockModalClosing",value:function(e){return this.modalTarget.contains(e.target)||"search"===e.target.type||this.progressClassNames.includes(e.target.className)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["modal"]},6512:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"passwordChange",value:function(e){this._toggleSubmitButton(!this._passwordsFilled())}},{key:"_passwordsFilled",value:function(){return this.password.length>0&&this.passwordConfirmation.length>0}},{key:"_toggleSubmitButton",value:function(e){this.submitButtonTarget.disabled=e}},{key:"password",get:function(){return this.passwordTarget.value}},{key:"passwordConfirmation",get:function(){return this.passwordConfirmationTarget.value}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["password","passwordConfirmation","submitButton"]},3677:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"clickClipboardButton",value:function(e){var t=this;e.preventDefault(),navigator.clipboard.writeText(this.uriHiddenInputTarget.value),this.clipboardButtonTarget.innerText="Copied!",setTimeout(function(){t.clipboardButtonTarget.innerText="Copy Code"},3e3)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["clipboardButton","uriHiddenInput"]},2461:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(o=[{key:"selectRole",value:function(e){this.adminRoleTarget.value=e.target.value}},{key:"submit",value:function(e){e.preventDefault(),this._createAdminInvitation()}},{key:"_createAdminInvitation",value:function(){var e=this;this._cleanErrorMessages(),Rails.ajax({type:"post",url:"/users/organizations/".concat(this.organizationId,"/invitations"),data:this._transformData(),success:function(t){e._refreshPage()},error:function(t,n,r){e._setErrorMessages(t)}})}},{key:"_transformData",value:function(){return new URLSearchParams({email:this.adminEmail,first_name:this.adminFirstName,last_name:this.adminLastName,role:this.adminRole}).toString()}},{key:"_refreshPage",value:function(){window.location.reload()}},{key:"_setErrorMessages",value:function(e){var t=document.querySelector("#invitation-form-error"),n=Object.entries(e).map(function(e){var t=r(e,2),n=t[0],o=t[1],i=n.replace(/_/g," ");return"role"===n?"<li>Role must be selected</li>":"<li>".concat(i," ").concat(o.join(", "),"</li>")}).join("");t.classList.remove("hide"),t.querySelector("ul").innerHTML=n}},{key:"_cleanErrorMessages",value:function(){document.querySelector("#invitation-form-error").classList.add("hide")}},{key:"adminEmail",get:function(){return this.adminEmailTarget.value}},{key:"adminFirstName",get:function(){return this.adminFirstNameTarget.value}},{key:"adminLastName",get:function(){return this.adminLastNameTarget.value}},{key:"adminRole",get:function(){return this.adminRoleTarget.value}},{key:"organizationId",get:function(){return this.organizationIdTarget.value}}])&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);f.targets=["adminEmail","adminFirstName","adminLastName","adminRole","organizationId"]},6943:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(3430);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).selectedRole=void 0,e.organizationIds=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(i=[{key:"connect",value:function(){this.organizationIds=this.organizationIdsTargets.map(function(e){return e.value})}},{key:"selectRole",value:function(e){var t=e.target;this.selectedRole=t.value}},{key:"submit",value:function(e){e.preventDefault(),this.hideError(),this.consumeEndpoint()}},{key:"consumeEndpoint",value:function(){var e=this;r.A.post(this.formTarget.action,this.buildPayload(),{headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').getAttribute("content")}}).then(function(t){e.invokeRefreshPage()}).catch(function(t){e.displayError(t.response.data)})}},{key:"buildPayload",value:function(){return{email:this.userEmailTarget.value,first_name:this.userFirstNameTarget.value,last_name:this.userLastNameTarget.value,role:this.selectedRole,organization_ids:this.organizationIds}}},{key:"invokeRefreshPage",value:function(){window.location.reload()}},{key:"displayError",value:function(e){this.manipulateErrorContainer(e)}},{key:"hideError",value:function(){this.manipulateErrorContainer([])}},{key:"composeError",value:function(e){return 0===e.length?"":e.map(function(e){return"<li>".concat(e,"</li>")}).join("")}},{key:"manipulateErrorContainer",value:function(e){var t=this.composeError(e);this.errorContainerTarget.innerHTML=t,this.errorContainerTarget.classList.toggle("hide",""===t)}}])&&o(n.prototype,i),u&&o(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,i,u}(n(5396).xI);l.targets=["form","errorContainer","userEmail","userFirstName","userLastName","organizationIds"]},2798:function(e,t,n){"use strict";n.d(t,{v:function(){return u}});var r=n(3430);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,o,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return i(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,i(p,"constructor",f),i(f,"constructor",l),l.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}var u=function(){var e,t=(e=o().m(function e(t){var n,i,a,u=arguments;return o().w(function(e){for(;;)switch(e.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:{},e.n=1,r.A.get(t,{headers:{Accept:"text/vnd.turbo-stream.html","X-CSRF-Token":c()},params:n});case 1:return i=e.v,a=i.data,e.a(2,a)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){a(i,r,o,u,c,"next",e)}function c(e){a(i,r,o,u,c,"throw",e)}u(void 0)})});return function(e){return t.apply(this,arguments)}}(),c=function(){var e;return(null===(e=document.querySelector('meta[name="csrf-token"]'))||void 0===e?void 0:e.getAttribute("content"))||""}},8711:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggleBallotOptions",value:function(e){this.ballotOptionsContainerTarget.classList.contains("hide")?this.ballotOptionsContainerTarget.classList.remove("hide"):this.ballotOptionsContainerTarget.classList.add("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["ballotOptionsContainer"]},6883:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"toggleOrganizationLogo",value:function(e){var t=e.target.checked;this.organizationLogoSectionTarget.classList.toggle("hide",!t)}},{key:"updateLogoPreview",value:function(e){var t=e.target,n=this.logoPreviewTarget;if(t.files&&t.files[0]){var r=new FileReader;r.onload=function(e){n.innerHTML='<img src="'.concat(e.target.result,'" alt="Logo Preview" width="100" height="100" />')},r.readAsDataURL(t.files[0])}}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["organizationLogoSection","logoPreview"]},1243:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggleBallotOptions",value:function(e){this.ballotOptionsContainerTarget.classList.contains("hide")?this.ballotOptionsContainerTarget.classList.remove("hide"):this.ballotOptionsContainerTarget.classList.add("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["ballotOptionsContainer"]},9978:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=i(this,t,[e])).doubleEnvelopeInputComponent=void 0,n.addressInputComponent=void 0,n._letterCheckboxTarget=void 0,n._postcardCheckboxTarget=void 0,n.doubleEnvelopeInputComponent=document.querySelector(".double-envelope-input-component"),n.addressInputComponent=document.querySelector(".address-input-component"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggleOptions",value:function(e){var t=e.target.getAttribute("data-notice-identifier");this.slideContainer(this.container(t)),this.toggleIcon(t),"postcard"!==t&&"letter"!==t||this.openAddressInput(),"letter"===t&&this.openDoubleEnvelopeInput()}},{key:"container",value:function(e){return this.targets.find("".concat(e,"Container"))}},{key:"slideContainer",value:function(e){e.classList.contains("hide")?e.classList.remove("hide"):e.classList.add("hide")}},{key:"toggleIcon",value:function(e){var t=document.querySelector("#".concat(e,"_notice_selection"));t.classList.contains("active_setting")?t.classList.remove("active_setting"):t.classList.add("active_setting")}},{key:"openAddressInput",value:function(){(this.postcardCheckboxTarget.checked||this.letterCheckboxTarget.checked)&&this.addressInputComponent.classList.remove("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["emailContainer","smsContainer","letterContainer","postcardContainer","printedContainer","manualContainer","letterCheckbox","postcardCheckbox"]},4105:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).selects=void 0,e.handleChange=function(t){var n=t.target,r=n.value;e.selects.forEach(function(e){e!==n&&(e.value=r)})},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.selects=document.querySelectorAll('select[name$="election[country_code]"]'),this.selects.forEach(function(t){return t.addEventListener("change",e.handleChange)})}},{key:"disconnect",value:function(){var e=this;this.selects.forEach(function(t){return t.removeEventListener("change",e.handleChange)})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},4883:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.changeCountrySelection()}},{key:"changeCountrySelection",value:function(){"other"===this.countrySelectTarget.value?(this.countryContainerTarget.classList.remove("hide"),this.countryTextTarget.setAttribute("name","return_address[country]")):(this.countryContainerTarget.classList.add("hide"),this.countryTextTarget.removeAttribute("name"))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["countryContainer","countrySelect","countryText"]},2923:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=i(this,t,[e])).addressInputComponent=void 0,n.addressInputComponent=document.querySelector(".address-input-component"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"enableCustomAddress",value:function(){this.addressInputComponent.classList.toggle("hide",!1)}},{key:"disableCustomAddress",value:function(){var e=this.shouldHideInputComponent();this.addressInputComponent.classList.toggle("hide",e)}},{key:"shouldHideInputComponent",value:function(){return!document.querySelector("#postcard_notice_selection > input[type=checkbox]").checked}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["customRadioButton"]},2723:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=i(this,t,[e])).addressInputComponent=void 0,n.addressInputComponent=document.querySelector(".address-input-component"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"noEnvelope",value:function(){this.toggleInputComponents(!1,!0)}},{key:"single",value:function(){this.toggleInputComponents(!1,!0)}},{key:"double",value:function(){}},{key:"toggleInputComponents",value:function(e,t){this.addressInputComponent.classList.toggle("hide",!t)}},{key:"shouldHideInputComponent",value:function(){var e=document.querySelector("#postcard_notice_selection > input[type=checkbox]"),t=document.querySelector("#return_address_double_envelope_custom");return e.checked||t.checked}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},4863:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){document.querySelector(".election-notice-type--send-time-component")}},{key:"changes",value:function(e){"scheduled"===e.currentTarget.value?this.scheduledDateInputContainerTarget.removeAttribute("hidden"):this.scheduledDateInputContainerTarget.setAttribute("hidden","hidden")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["scheduledDateInput","scheduledDateInputContainer","scheduledOptionRadio"]},9383:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.updateFocus()}},{key:"exit",value:function(e){e.preventDefault(),this.exitButtonTarget.click()}},{key:"clearInput",value:function(e){e.preventDefault(),this.clearInputTarget()}},{key:"inputChange",value:function(e){this.inputHasChanged=!0,this.disableAccessBallot(),this.hideMessage(),this.updateSubmitStatus(e.target.value)}},{key:"handleEnter",value:function(e){e.preventDefault(),this.shouldClearInput()?this.clearInputTarget():this.submit()}},{key:"shouldClearInput",value:function(){return!this.inputHasChanged&&this.messageIsErrorValue}},{key:"submit",value:function(){this.searchButtonTarget.click()}},{key:"clearInputTarget",value:function(){this.inputTarget.value="",this.hideMessage()}},{key:"updateSubmitStatus",value:function(e){e.length>0?this.enableSubmit():this.disableSubmit()}},{key:"updateFocus",value:function(){this.invitationPresentValue?this.accessBallotButtonTarget.focus():this.inputTarget.focus()}},{key:"enableSubmit",value:function(){this.searchButtonTarget.disabled=!1}},{key:"disableSubmit",value:function(){this.searchButtonTarget.disabled=!0}},{key:"disableAccessBallot",value:function(){this.accessBallotButtonTarget.classList.add("disabled")}},{key:"hideMessage",value:function(){this.messageContainerTarget.classList.add("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(6609).BaseController);s.targets=["input","messageContainer","searchButton","accessBallotButton","exitButton"],s.values={messageIsError:Boolean,invitationPresent:Boolean}},7996:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"markReviewItem",value:function(e){e.preventDefault();var t=e.target;t.disabled=!0,t.textContent="Processing...";var n=(0,o.T)();if(!n)return t.disabled=!1,t.textContent="Confirm",void alert("Error finishing. Try again.");n.post(this.urlValue,{task:this.taskValue}).done(function(){window.location.reload()}).fail(function(){t.disabled=!1,t.textContent="Confirm",alert("Error finishing. Try again.")})}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.values={task:String,url:String}},255:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.updateVisibility()}},{key:"toggleSetting",value:function(){this.activationCheckboxTarget.checked,this.updateVisibility()}},{key:"onAuthenticationTypeChange",value:function(){this.activationCheckboxTarget.checked&&this.updateConfigurationSections()}},{key:"updateVisibility",value:function(){this.activationCheckboxTarget.checked?(this.innerSettingsTarget.classList.add("active"),this.innerSettingsTarget.style.display="block",this.multifactorContainerTarget.classList.add("active_setting"),this.showRadioOptions(),this.updateConfigurationSections()):(this.innerSettingsTarget.classList.remove("active"),this.multifactorContainerTarget.classList.remove("active_setting"),this.innerSettingsTarget.style.display="none",this.hideAllSections())}},{key:"showRadioOptions",value:function(){this.smsOptionTarget.style.display="block",this.passwordOptionTarget.style.display="block"}},{key:"updateConfigurationSections",value:function(){var e=this.smsRadioTarget.checked,t=this.passwordRadioTarget.checked;e?(this.smsSectionTarget.classList.remove("hide"),this.smsSectionTarget.style.display="block"):(this.smsSectionTarget.classList.add("hide"),this.smsSectionTarget.style.display="none"),t?(this.passwordSectionTarget.classList.remove("hide"),this.passwordSectionTarget.style.display="block"):(this.passwordSectionTarget.classList.add("hide"),this.passwordSectionTarget.style.display="none")}},{key:"hideAllSections",value:function(){this.smsOptionTarget.style.display="none",this.passwordOptionTarget.style.display="none",this.smsSectionTarget.classList.add("hide"),this.passwordSectionTarget.classList.add("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["multifactorContainer","activationCheckbox","innerSettings","smsOption","passwordOption","smsSection","passwordSection","smsRadio","passwordRadio","countryCodeSection","passwordContent","adminContactCheckbox","countryCode"]},6035:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).submitTimeout=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggleSetting",value:function(e){this.activationCheckboxTarget.checked?this.settingsSectionTarget.classList.add("active"):this.settingsSectionTarget.classList.remove("active")}},{key:"submitVoteKeyOnChange",value:function(e){var t=this;this.submitTimeout&&clearTimeout(this.submitTimeout),this.submitTimeout=setTimeout(function(){t.submitVoteKeyForm()},500)}},{key:"submitVoteKeyOnBlur",value:function(e){this.submitTimeout&&clearTimeout(this.submitTimeout),this.submitVoteKeyForm()}},{key:"submitVoteKeyForm",value:function(){this.hasVoteKeyFormTarget&&this.voteKeyFormTarget.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))}},{key:"disconnect",value:function(){this.submitTimeout&&clearTimeout(this.submitTimeout)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["activationCheckbox","settingsSection","voteKeyField","voteKeyForm"]},1707:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.hasSplitWeightCheckboxTarget&&this.splitWeightCheckboxTarget.disabled&&(this.splitWeightCheckboxTarget.checked=!1)}},{key:"toggleSetting",value:function(e){this.activationCheckboxTarget.checked?this.settingsSectionTarget.classList.add("active"):this.settingsSectionTarget.classList.remove("active")}},{key:"onWeightDistributionChange",value:function(e){this.weightPrecisionTarget.value="0"}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["activationCheckbox","settingsSection","weightPrecision","splitWeightCheckbox"]},4591:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;EB.Datepicker.initDatePickers(new Date),this.element.addEventListener("turbo:submit-start",function(){e.submitButtonTarget.disabled=!0,e.submitButtonTarget.value="Saving...",e.submitButtonTarget.classList.add("btn--disabled")}),this.element.addEventListener("turbo:submit-end",function(t){if(t.detail.success){var n=e.element.querySelector('[rel="modal:close"]');null===n||void 0===n||n.click();var r=document.querySelector(".turbo-modal-component__close-modal");null===r||void 0===r||r.click(),e.reload_location(t)}else e.submitButtonTarget.disabled=!1,e.submitButtonTarget.value="Save Vote Box",e.submitButtonTarget.classList.remove("btn--disabled")})}},{key:"textIntoStartDateField",value:function(e){e.preventDefault(),this.startDateInputTarget.value=e.target.textContent,this.startDateInputTarget.focus()}},{key:"textIntoEndDateField",value:function(e){e.preventDefault(),this.endDateInputTarget.value=e.target.textContent,this.endDateInputTarget.focus()}},{key:"reload_location",value:function(e){location.reload()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["endDateInput","startDateInput","submitButton"]},9195:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var r=n(5396),o=n(9403),i=n(2798);function a(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var a=r&&r.prototype instanceof s?r:s,l=Object.create(a.prototype);return u(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,u(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,u(p,"constructor",f),u(f,"constructor",l),l.displayName="GeneratorFunction",u(f,o,"GeneratorFunction"),u(p),u(p,o,"Generator"),u(p,r,function(){return this}),u(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:h}})()}function u(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,n,r){function i(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},u(e,t,n,r)}function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function f(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e,t,n){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}var y=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=d(this,t,[].concat(r))).tableRowCheckboxes=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.defineTriggers(),document.addEventListener("turbo:frame-load",function(){e.defineTriggers()})}},{key:"defineTriggers",value:function(){this.tableRowCheckboxes=this.tableRowTargets.map(function(e){return e.querySelector('input[type="checkbox"]')}).filter(function(e){return null!==e}),this.assignActionToCheckboxes()}},{key:"assignActionToCheckboxes",value:function(){var e=this;
2this.tableRowCheckboxes.forEach(function(t){t.addEventListener("click",function(n){e.interactWithActionsMenu(t)})})}},{key:"interactWithActionsMenu",value:(f=s(a().m(function e(t){var n,r,o;return a().w(function(e){for(;;)switch(e.n){case 0:if(this.closeAll(),0!==(n=this.voteItemIds()).length){e.n=1;break}return e.a(2);case 1:return r=t.getAttribute("turbo-stream-id"),o=document.getElementById(r),e.n=2,this.getActions(n,r);case 2:o.classList.toggle("hide",!1);case 3:return e.a(2)}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"voteItemIds",value:function(){return this.tableRowCheckboxes.filter(function(e){return e.checked}).map(function(e){return e.getAttribute("data-id")})}},{key:"closeAll",value:function(){Array.from(document.querySelectorAll("[id^=vote_item_actions_vote_]")).forEach(function(e){return e.classList.toggle("hide",!0)})}},{key:"getActions",value:(c=s(a().m(function e(t,n){var r,u;return a().w(function(e){for(;;)switch(e.n){case 0:return r={vote_item_ids:t,turbo_stream_id:n,vote_box_id:this.voteBoxIdValue},e.n=1,(0,i.v)(this.actionsUrlValue,r);case 1:u=e.v,o.V.renderStreamMessage(u);case 2:return e.a(2)}},e,this)})),function(e,t){return c.apply(this,arguments)})}],r&&l(n.prototype,r),u&&l(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u,c,f}(r.xI);y.targets=["table","actionsMenu","tableRow"],y.values={actionsUrl:String,voteBoxId:Number}},7923:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"toggleDisplay",value:function(){this.displayDivTarget.classList.toggle("hide"),this.editDivTarget.classList.toggle("hide")}},{key:"onSaveClick",value:function(e){this.toggleDisplay();var t=this.inputFieldTarget.value;if(t.length<5||t.length>60)return alert("Title must be between 5 and 60 characters"),void e.preventDefault();this.h1TitleTarget.textContent=this.inputFieldTarget.value}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["displayDiv","editDiv","h1Title","inputField"]},8545:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"enableSubmit",value:function(e){e.target.value.length>0&&(this.buttonTarget.disabled=!1)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["button"]},9152:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(573);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).onMappingSaved=function(t){var n;if(e.hasNoticeTarget){var r=t.detail;e.noticeTarget.hidden=!0===(null===r||void 0===r||null===(n=r.response)||void 0===n?void 0:n.all_columns_mapped)}},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.element.addEventListener(o.V,this.onMappingSaved)}},{key:"disconnect",value:function(){this.element.removeEventListener(o.V,this.onMappingSaved)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["notice"]},5162:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=document.querySelector("#consent_terms_text");null!==e&&(e.classList.add("consent-terms"),e.removeAttribute("id"))}},{key:"disableConsentTerms",value:function(){this.customConsentTermsCheckboxTarget.checked=!1,this.defaultConsentTermsTarget.classList.add("hide"),this.customConsentTermsTarget.classList.add("hide")}},{key:"enableDefaultConsentTerms",value:function(){this.customConsentTermsCheckboxTarget.checked=!1,this.defaultConsentTermsTarget.classList.remove("hide"),this.customConsentTermsTarget.classList.add("hide")}},{key:"enableCustomConsentTerms",value:function(){this.noConsentTermsTarget.checked=!1,this.defaultConsentTermsCheckboxTarget.checked=!1,this.defaultConsentTermsTarget.classList.add("hide"),this.customConsentTermsTarget.classList.remove("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["noConsentTerms","defaultConsentTermsCheckbox","customConsentTermsCheckbox","defaultConsentTerms","customConsentTerms"]},4064:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return B}});var r=n(8179),o=n(4546),i=n(737),a=n(6149),u=n(7343),c=n(5404);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;
vendor: 5,190 bytes, line 2
2!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return f(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),p=s.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,f(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=s,f(p,"constructor",s),f(s,"constructor",c),c.displayName="GeneratorFunction",f(s,o,"GeneratorFunction"),f(p),f(p,o,"Generator"),f(p,r,function(){return this}),f(p,"toString",function(){return"[object Generator]"}),(l=function(){return{w:i,m:h}})()}function f(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}f=function(e,t,n,r){function i(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},f(e,t,n,r)}function d(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){d(i,r,o,a,u,"next",e)}function u(e){d(i,r,o,a,u,"throw",e)}a(void 0)})}}function h(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,P(r.key),r)}}function b(e,t,n){return t=O(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,g()?Reflect.construct(t,n||[],O(e).constructor):t.apply(e,n))}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function w(e,t,n,r){var o=_(O(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function _(){return _="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=O(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},_.apply(null,arguments)}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?k(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function S(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function E(e,t,n){return fetch(e,j({method:t,headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":(0,u.GQ)()},credentials:"same-origin"},void 0===n?{}:{body:JSON.stringify(n)})).then(function(e){return e.text().then(function(t){var n={};if(t)try{var r=JSON.parse(t);null!==r&&"object"===typeof r&&(n=r)}catch(o){}return{ok:e.ok,status:e.status,json:n}})})}var C=/^[0-9]\d*(\.\d+)?$/,x="weight",A="errors",R=/^[A-Za-z][A-Za-z0-9_]*$/,L=["export"],I=["cut","paste"],B=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=b(this,t,[].concat(r))).topUpScheduled=!1,e.editQueue=void 0,e.currentColumnDefs=[],e.validating=!1,e.invali
2dWeightNodes=new Map,e.showErrorsColumn=!1,e.declaredColumns=[],e.addColumnLabel=void 0,e.settingsChangeHandler=null,e.undoKeyHandler=null,e.pasteUndoStack=[],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;if(w(t,"connect",this,3)([]),this.hasGridTarget){this.currentColumnDefs=this.columnDefsValue,this.declaredColumns=Array.isArray(this.declaredColumnsValue)?h(this.declaredColumnsValue):[],this.renderDeclaredColumnChips(),this.showErrorsColumn=this.anyRowHasErrors(this.rowDataValue),this.editQueue=new u.ug(this.updateUrlTemplateValue,this.batchUpdateUrlValue,{onPersisted:function(t,n){e.clearStaleValidationBanner(),e.syncGroupSelectors(n),e.showValidateStatusMessage(t,!0)},onRemoveNode:function(t){return e.removeNode(t)}},"[EditorGridComponent]");var n={theme:i.zA,columnDefs:this.buildColumnDefs(),rowData:this.rowDataValue,pagination:!0,paginationPageSize:20,paginationPageSizeSelector:[20,50,100,200],domLayout:"autoHeight",rowNumbers:{contextMenuItems:function(t){var n;return e.buildContextMenuItems((null!==(n=t.defaultItems)&&void 0!==n?n:[]).filter(function(e){return!I.includes(e)}),t)}},getContextMenuItems:function(t){var n;return e.buildContextMenuItems(null!==(n=t.defaultItems)&&void 0!==n?n:[],t)},cellSelection:{handle:{mode:"fill"}},undoRedoCellEditing:!0,undoRedoCellEditingLimit:20,stopEditingWhenCellsLoseFocus:!0,defaultColDef:{resizable:!0,sortable:!0,filter:!0},processDataFromClipboard:function(t){return e.processClipboard(t)},onCellValueChanged:function(t){e.queueChange(t)},onPaginationChanged:function(){return e.scheduleBlankRowTopUp()}};this.gridApi=(0,r.Dvw)(this.gridTarget,n),this.scanInitialWeights(),this.topUpBlankRows(),this.settingsChangeHandler=function(t){var n,r=t.target;null!==r&&void 0!==r&&null!==(n=r.closest)&&void 0!==n&&n.call(r,"form.voter_list_election_form")&&e.refreshColumnDefs()},document.addEventListener("ajax:complete",this.settingsChangeHandler),this.undoKeyHandler=function(t){return e.interceptUndo(t)},this.gridTarget.addEventListener("keydown",this.undoKeyHandler,!0)}}},{key:"disconnect",value:function(){this.settingsChangeHandler&&(document.removeEventListener("ajax:complete",this.settingsChangeHandler),this.settingsChangeHandler=null),this.undoKeyHandler&&this.hasGridTarget&&(this.gridTarget.removeEventListener("keydown",this.undoKeyHandler,!0),this.undoKeyHandler=null),w(t,"disconnect",this,3)([])}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"validate",value:function(){var e=this;this.validateUrlValue&&this.gridApi&&!this.readOnlyValue&&(this.validating=!0,this.applyGridEditableState(),(0,u.B2)(this.validateUrlValue).then(function(t){var n,r=t.ok,o=t.json;if(!r)throw new Error("Validate failed");var i=Array.isArray(o.rows)?o.rows:[];null===(n=e.gridApi)||void 0===n||n.setGridOption("rowData",i),e.pasteUndoStack=[],e.topUpBlankRows(),e.invalidWeightNodes.clear(),e.scanInitialWeights(),e.showErrorsColumn=e.anyRowHasErrors(i),e.applyGridEditableState(),e.showValidateStatus(o.valid,o.errors_count),e.jumpToFirstError()}).catch(function(t){console.error("[EditorGridComponent] validate error:",t),e.showValidateStatusMessage("Validation request failed",!0)}).finally(function(){e.validating=!1,e.applyGridEditableState()}))}},{key:"addColumn",value:function(e){var t,n=this;if(null===e||void 0===e||e.preventDefault(),this.hasNewColumnNameTarget&&this.customColumnsUrlValue){var r=this.newColumnNameTarget.value.trim(),o=this.addColumnClientError(r);o?this.showAddColumnStatus(o,!0):(this.setAddColumnBusy(!0),this.showAddColumnStatus('Adding "'.concat(r,'"\u2026'),!1,!0),null===(t=this.editQueue)||void 0===t||t.flush(),E(this.customColumnsUrlValue,"POST",{name:r}).then(function(e){var t=e.ok,o=e.status,i=e.json;if(t){var a="string"===typeof i.name?i.name:r;return n.declaredColumns=Array.isArray(i.custom_voter_columns)?i.custom_voter_columns:[].concat(h(n.declaredColumns),[a]),n.newColumnNameTarget.value="",n.renderDeclaredColumnChips(),n.refreshColumnDefs().then(function(e){n.showAddColumnStatus('Added "'.concat(a,e?'".':'", but the grid could not be refreshed \u2014 reload the page to see it.'),!e)})}n.showAddColumnStatus(n.addColumnErrorMessage(o,i),!0)}).catch(function(e){console.error("[EditorGridComponent] add column error:",e),n.showAddColumnStatus("Could not add the column. Please try again.",!0)}).finally(function(){return n.setAddColumnBusy(!1)}))}}},{key:"addColumnClientError",value:function(e){return""===e?"Enter a name for the new column.":R.test(e)?this.declaredColumns.length>=15?"You can add up to ".concat(15," custom columns."):this.declaredColumns.some(function(t){return t.toLowerCase()===e.toLowerCase()})?'"'.concat(e,'" is already one of your custom columns.'):null:"Use only letters, numbers and underscores (no spaces), beginning with a letter."}},{key:"addColumnErrorMessage",value:function(e,t){return"string"===typeof t.errors&&""!==t.errors?t.errors:403===e?"You do not have permission to change this voter list.":"Could not add the column. Please try again."}},{key:"renderDeclaredColumnChips",value:function(){var e=this;if(this.hasDeclaredColumnChipsTarget){var t=this.declaredColumnChipsTarget;t.textContent="",t.classList.toggle("hide",0===this.declaredColumns.length),this.declaredColumns.forEach(function(n){var r=document.createElement("span");r.className="voter-list-editor-grid-add-column__chip";var o=document.createElement("span");o.textContent=n,r.appendChild(o);var i=document.createElement("button");i.type="button",i.className="voter-list-editor-grid-add-column__chip-remove skip_auto_submit skip_update_settings",i.setAttribute("aria-label","Remove c
2olumn ".concat(n)),i.textContent="\xd7",i.addEventListener("click",function(){return e.removeColumn(n)}),r.appendChild(i),t.appendChild(r)})}}},{key:"removeColumn",value:function(e){var t=this;this.customColumnsUrlValue&&(0,c.j)({title:"Remove column",danger:'Removing "'.concat(e,'" also deletes anything already typed into it.'),message:"This cannot be undone.",confirmLabel:"Remove column"}).then(function(n){var r;if(n)return t.setRemoveColumnBusy(!0),t.showAddColumnStatus('Removing "'.concat(e,'"\u2026'),!1,!0),null===(r=t.editQueue)||void 0===r||r.flush(),E("".concat(t.customColumnsUrlValue,"/").concat(encodeURIComponent(e)),"DELETE").then(function(n){var r=n.ok,o=n.status,i=n.json;if(r)return t.declaredColumns=Array.isArray(i.custom_voter_columns)?i.custom_voter_columns:t.declaredColumns.filter(function(t){return t.toLowerCase()!==e.toLowerCase()}),t.renderDeclaredColumnChips(),t.refreshColumnDefs().then(function(n){t.showAddColumnStatus('Removed "'.concat(e,n?'".':'", but the grid could not be refreshed \u2014 reload the page.'),!n)});t.showAddColumnStatus(t.removeColumnErrorMessage(o,i),!0)}).catch(function(e){console.error("[EditorGridComponent] remove column error:",e),t.showAddColumnStatus("Could not remove the column. Please try again.",!0)}).finally(function(){return t.setRemoveColumnBusy(!1)})})}},{key:"removeColumnErrorMessage",value:function(e,t){return"string"===typeof t.errors&&""!==t.errors?t.errors:403===e?"You do not have permission to change this voter list.":"Could not remove the column. Please try again."}},{key:"setRemoveColumnBusy",value:function(e){this.hasDeclaredColumnChipsTarget&&this.declaredColumnChipsTarget.querySelectorAll("button").forEach(function(t){t.disabled=e})}},{key:"setAddColumnBusy",value:function(e){if(this.hasNewColumnNameTarget&&(this.newColumnNameTarget.disabled=e),this.hasAddColumnButtonTarget){var t,n,r=this.addColumnButtonTarget;e?(null!==(t=this.addColumnLabel)&&void 0!==t||(this.addColumnLabel=null!==(n=r.textContent)&&void 0!==n?n:"Add"),r.textContent="Adding\u2026"):this.addColumnLabel&&(r.textContent=this.addColumnLabel),r.disabled=e,r.setAttribute("aria-busy",String(e))}}},{key:"showAddColumnStatus",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.hasAddColumnStatusTarget){var r=""===e?"hide":n?"is-busy":t?"inline_error":"inline_success";this.addColumnStatusTarget.textContent=e,this.addColumnStatusTarget.className="voter-list-editor-grid-add-column__status ".concat(r)}}},{key:"queueChange",value:function(e){if(!this.editQueue.suppressed){var t=e.colDef.field;t&&(t===x&&this.trackWeightValidity(e),this.editQueue.queueChange(e.node,t,e.newValue,e.oldValue),this.scheduleBlankRowTopUp())}}},{key:"scheduleBlankRowTopUp",value:function(){var e=this;this.topUpScheduled||(this.topUpScheduled=!0,queueMicrotask(function(){e.topUpScheduled=!1,e.topUpBlankRows()}))}},{key:"buildContextMenuItems",value:function(e,t){var n,r=this,o=e.filter(function(e){return"string"!==typeof e||!L.includes(e)});if(this.readOnlyValue||!this.hasBatchDestroyUrlValue)return o;var i=t.node,a=Number(null===i||void 0===i||null===(n=i.data)||void 0===n?void 0:n.id);if(!i||!Number.isInteger(a)||a<=0)return o;var u={name:"Delete voter",icon:'<i class="fas fa-trash" aria-hidden="true"></i>',action:function(){r.deleteRow(i,a)}};return o.length>0?[].concat(h(o),["separator",u]):[u]}},{key:"deleteRow",value:(v=p(l().m(function e(t,n){var r,o,i,a,u;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:return null===(r=this.editQueue)||void 0===r||r.flush(),o=!1,i=0,a={},e.p=1,e.n=2,E(this.batchDestroyUrlValue,"DELETE",{ids:[n]});case 2:u=e.v,o=u.ok,i=u.status,a=u.json,e.n=4;break;case 3:return e.p=3,e.v,this.showValidateStatusMessage("Could not reach the server. No voters were removed.",!0),e.a(2);case 4:if(o){e.n=5;break}return this.showValidateStatusMessage(this.deleteErrorMessage(i,a),!0),e.a(2);case 5:this.removeNode(t),this.clearStaleValidationBanner(),this.showValidateStatusMessage("1 voter removed. The voter list has changed. Please validate again.",!1);case 6:return e.a(2)}},e,this,[[1,3]])}
2)),function(e,t){return v.apply(this,arguments)})},{key:"deleteErrorMessage",value:function(e,t){return void 0!==t.errors?(0,u.PE)(t):403===e?"You do not have permission to remove voters from this list.":"Could not remove the voter. Please try again."}},{key:"removeNode",value:function(e){var t;this.invalidWeightNodes.delete(String(e.id)),this.updateWeightGate(),null===(t=this.gridApi)||void 0===t||t.applyTransaction({remove:[e.data]}),this.scheduleBlankRowTopUp()}},{key:"buildColumnDefs",value:function(){var e=this,t=this.isEditable(),n=this.currentColumnDefs.map(function(n){var r=t&&Boolean(n.editable);return j(j({},n),{},{editable:r,cellClass:r?e.withEditableCellClass(n.cellClass):n.cellClass},n.field===A?{hide:!e.showErrorsColumn}:{})});return(0,a.g)(n)}},{key:"withEditableCellClass",value:function(e){var t=Array.isArray(e)?e:"string"===typeof e?[e]:[];return[].concat(h(t),["voter-list-editor-grid-cell--editable"])}},{key:"isEditable",value:function(){return!this.readOnlyValue&&!this.validating}},{key:"applyGridEditableState",value:function(){var e;null===(e=this.gridApi)||void 0===e||e.setGridOption("columnDefs",this.buildColumnDefs())}},{key:"refreshColumnDefs",value:function(){var e=this;return this.gridApi&&this.columnDefsUrlValue?fetch(this.columnDefsUrlValue,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){return e.json()}).then(function(t){var n=Array.isArray(t.column_defs)?t.column_defs:[];return 0!==n.length&&(e.currentColumnDefs=n,e.applyGridEditableState(),!0)}).catch(function(e){return console.error("[EditorGridComponent] column_defs refresh error:",e),!1}):Promise.resolve(!1)}},{key:"trackWeightValidity",value:function(e){var t,n=String(e.node.id),r=e.newValue;!r||C.test(String(r))?this.invalidWeightNodes.delete(n):this.invalidWeightNodes.set(n,(null!==(t=e.node.rowIndex)&&void 0!==t?t:0)+1),this.updateWeightGate()}},{key:"scanInitialWeights",value:function(){var e=this;this.gridApi&&(this.gridApi.forEachNode(function(t,n){var r,o=null===(r=t.data)||void 0===r?void 0:r[x];null===o||void 0===o||""===o||C.test(String(o))||e.invalidWeightNodes.set(String(t.id),n+1)}),this.updateWeightGate())}},{key:"updateWeightGate",value:function(){var e=this.invalidWeightNodes.size>0;if(this.hasWeightWarningTarget){if(!e)return this.weightWarningTarget.textContent="",void this.weightWarningTarget.classList.add("hide");var t=Array.from(this.invalidWeightNodes.values()).sort(function(e,t){return e-t}),n=1===t.length?"row":"rows";this.weightWarningTarget.textContent="Fractional weights must be formatted with decimals. Invalid values found on ".concat(n," ").concat(t.join(", "),"."),this.weightWarningTarget.classList.remove("hide")}}},{key:"processClipboard",value:function(e){var t,n;if(!this.gridApi)return e.data;var r=this.pasteTargetFields();if(0===r.length)return[];var o=this.trimmedClipboardRows(e.data,r.length),i=null!==(t=null===(n=this.gridApi.getFocusedCell())||void 0===n?void 0:n.rowIndex)&&void 0!==t?t:0,a=this.rowCeiling(),u=Math.max(0,a-i);if(o.length>u&&(this.showValidateStatusMessage(this.pasteTruncatedMessage(o.length,u),!0),o.length=u),0===o.length)return[];var c=this.currentRowCount(),s=this.snapshotCells(o,i,r);return this.growToFit(i+o.length),this.writeClipboardRows(o,i,r),this.pasteUndoStack.push({overwritten:s,added:this.nodesFrom(c)}),[]}},{key:"pasteTargetFields",value:function(){var e,t=this.buildColumnDefs().filter(function(e){return e.field&&e.field!==A&&e.editable}).map(function(e){return e.field}),n=null===(e=this.gridApi)||void 0===e||null===(e=e.getFocusedCell())||void 0===e||null===(e=e.column)||void 0===e?void 0:e.getColId(),r=n?t.indexOf(n):0;return r>0?t.slice(r):t}},{key:"trimmedClipboardRows",value:function(e,t){for(var n=e.map(function(e){return e.slice(0,t)});n.length>0&&n[n.length-1].every(function(e){return""===(null!==e&&void 0!==e?e:"").trim()});)n.pop();return n}},{key:"growToFit",value:function(e){var t,n=this,r=e-this.currentRowCount();r<=0||null===(t=this.gridApi)||void 0===t||t.applyTransaction({add:Array.from({length:r},function(){return n.blankRow()})})}},{key:"snapshotCells",value:function(e,t,n){var r=this.allNodes(),o=[];return e.forEach(function(e,i){var a=r[t+i];a&&e.forEach(function(e,t){var r,i,u=n[t];u&&o.push({node:a,field:u,value:null!==(r=null===(i=a.data)||void 0===i?void 0:i[u])&&void 0!==r?r:null})})}),o}},{key:"nodesFrom",value:function(e){return this.allNodes().slice(e)}},{key:"allNodes",value:function(){var e,t=[];return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){return t.push(e)}),t}},{key:"interceptUndo",value:function(e){var t,n;!e.ctrlKey&&!e.metaKey||e.shiftKey||"z"!==e.key.toLowerCase()||0!==this.pasteUndoStack.length&&((null!==(t=null===(n=this.gridApi)||void 0===n?void 0:n.getCurrentUndoSize())&&void 0!==t?t:0)>0||(e.preventDefault(),e.stopPropagation(),this.undoLastPaste()))}},{key:"undoLastPaste",value:(d=p(l().m(function e(){var t,n,r,o,i,a,u,c=this;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=this.pasteUndoStack.pop()){e.n=1;break}return e.a(2);
2case 1:if(n.overwritten.forEach(function(e){var t=e.node,n=e.field,r=e.value;return t.setDataValue(n,r)}),r=n.added.map(function(e){var t;return Number(null===(t=e.data)||void 0===t?void 0:t.id)}).filter(function(e){return Number.isInteger(e)&&e>0}),null===(t=this.editQueue)||void 0===t||t.flush(),!(r.length>0&&this.hasBatchDestroyUrlValue)){e.n=6;break}return o=!1,i=0,a={},e.p=2,e.n=3,E(this.batchDestroyUrlValue,"DELETE",{ids:r});case 3:u=e.v,o=u.ok,i=u.status,a=u.json,e.n=5;break;case 4:return e.p=4,e.v,this.showValidateStatusMessage("Could not reach the server. The paste was not undone.",!0),e.a(2);case 5:if(o){e.n=6;break}return this.showValidateStatusMessage(this.deleteErrorMessage(i,a),!0),e.a(2);case 6:n.added.forEach(function(e){return c.removeNode(e)}),this.clearStaleValidationBanner(),this.showValidateStatusMessage("Paste undone. The voter list has changed. Please validate again.",!1);case 7:return e.a(2)}},e,this,[[2,4]])})),function(){return d.apply(this,arguments)})},{key:"writeClipboardRows",value:function(e,t,n){var r=this.allNodes();e.forEach(function(e,o){var i=r[t+o];i&&e.forEach(function(e,t){var r=n[t];r&&i.setDataValue(r,""===e?null:e)})})}},{key:"rowCeiling",value:function(){return this.maxRowsForTestBallotValue>0?this.maxRowsForTestBallotValue:this.maxRowsValue>0?this.maxRowsValue:Number.MAX_SAFE_INTEGER}},{key:"pasteTruncatedMessage",value:function(e,t){return this.maxRowsForTestBallotValue>0?"Pasted ".concat(e," rows but this is a test election, which is limited to ")+"".concat(this.maxRowsForTestBallotValue," voters \u2014 only the first ").concat(t," were added."):"Pasted ".concat(e," rows but manual entry is limited to ").concat(this.maxRowsValue," voters \u2014 ")+"only the first ".concat(t," were added. Import the full list as a CSV file instead.")}},{key:"blankRow",value:function(){var e={};return this.currentColumnDefs.forEach(function(t){t.field&&"errors"!==t.field&&(e[t.field]=null)}),e}},{key:"anyRowHasErrors",value:function(e){return e.some(function(e){var t=e.error_fields,n=e.errors;return Array.isArray(t)&&t.length>0||Boolean(n&&n.length>0)})}},{key:"topUpBlankRows",value:function(){var e=this;if(this.gridApi&&this.isEditable()){var t,n=this.currentRowCount();t=this.maxRowsForTestBallotValue>0?this.maxRowsForTestBallotValue:0===n?10:n-this.trailingBlankRowCount()+5;var r=this.gridApi.paginationGetPageSize()||20;t>r&&(t=Math.ceil(t/r)*r);var o=Math.min(t,this.rowCeiling())-n;o<=0||this.gridApi.applyTransaction({add:Array.from({length:o},function(){return e.blankRow()})})}}},{key:"trailingBlankRowCount",value:function(){var e,t=[];null===(e=this.gridApi)||void 0===e||e.forEachNode(function(e){return t.push(e)});for(var n=0,r=t.length-1;r>=0&&this.isBlankRowData(t[r].data);r-=1)n+=1;return n}},{key:"isBlankRowData",value:function(e){return!!e&&this.currentColumnDefs.every(function(t){if(!t.field||"errors"===t.field)return!0;var n=e[t.field];return null===n||void 0===n||""===String(n).trim()})}},{key:"currentRowCount",value:function(){var e,t=0;return null===(e=this.gridApi)||void 0===e||e.forEachNode(function(){t+=1}),t}},{key:"jumpToFirstError",value:function(){if(this.gridApi){var e=null;this.gridApi.forEachNode(function(t,n){var r;if(null===e){var o=null===(r=t.data)||void 0===r?void 0:r.error_fields;o&&o.length>0&&(e=n)}}),null!==e&&this.gridApi.ensureIndexVisible(e,"middle")}}},{key:"showValidateStatus",value:function(e,t){if(e)this.showValidateStatusMessage("Valid \u2014 no errors",!1);else{var n=null!==t&&void 0!==t?t:0;this.showValidateStatusMessage("".concat(n," error").concat(1===n?"":"s"," found"),!0)}}},{key:"clearStaleValidationBanner",value:function(){["voter_list_notices","secondary_voter_list_notices"].forEach(function(e){var t=document.getElementById(e);t&&(t.innerHTML="")})}},{key:"syncGroupSelectors",value:function(e){var t,n,r,o=null===e||void 0===e?void 0:e.groups,i=null===(t=window.EB)||void 0===t?void 0:t.MultipleSelect;o&&i&&(null!==(n=o.removed)&&void 0!==n&&n.length&&i.RemoveGroups(o.question_groups.map(function(e){return s(e,1)[0]}),o.removed),null!==(r=o.added)&&void 0!==r&&r.length&&i.AddGroups(o.question_groups,o.added))}},{key:"showValidateStatusMessage",value:function(e,t){this.hasValidateStatusTarget&&(this.validateStatusTarget.textContent=e,this.validateStatusTarget.className="voter-list-editor-grid-validate-status ".concat(t?"inline_error":"inline_success"))}}],o&&m(n.prototype,o),f&&m(n,f),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,f,d,v}(o.AgGridBaseController);B.targets=[].concat(h(o.AgGridBaseController.targets),["grid","validateStatus","weightWarning","newColumnName","addColumnButton","addColumnStatus","declaredColumnChips"]),B.values=j(j({},o.AgGridBaseController.values),{},{rowData:Array,updateUrlTemplate:String,batchUpdateUrl:String,batchDestroyUrl:String,validateUrl:String,columnDefsUrl:String,customColumnsUrl:String,declaredColumns:Array,maxRowsForTestBallot:Number,maxRows:Number,readOnly:Boolean})},3944:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this,t=(0,o.T)();if(t){var n="#".concat(this.identifierTarget.id);t(n).multipleSelect({allSelected:!0,formatAllSelected:function(){return t(n).data("all-options-selector-message")},formatSelectAll:function(){return t(n).data("toggle-selector-message")},filter:t(n).data("keyword-filter"),maxHeight:"400",onClick:function(){return e.dispatchNativeChange()},onCheckAll:function(){return e.dispatchNativeChange()},onUncheckAll:function(){return e.dispatchNativeChange()}})}}},{key:"dispatchNativeChange",value:function(){this.identifierTarget.dispatchEvent(new Event("change",{bubbles:!0}))}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["identifier"]},7126:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this,t=(0,o.T)();if(t){var n="#".concat(this.identifierTarget.id);t(n).multipleSelect({allSelected:!0,formatAllSelected:function(){return t(n).data("all-options-selector-message")},formatSelectAll:function(){return t(n).data("toggle-selector-message")},filter:t(n).data("keyword-filter"),maxHeight:"400",onClick:function(){return e.dispatchNativeChange()},onCheckAll:function(){return e.dispatchNativeChange()},onUncheckAll:function(){return e.dispatchNativeChange()}})}}},{key:"dispatchNativeChange",value:function(){this.identifierTarget.dispatchEvent(new Event("change",{bubbles:!0}))}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["identifier"]},9468:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}n.r(t),n.d(t,{default:function(){return f}});var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).accessToken=null,e.tokenExpiresAt=0,e.tokenClient=null,e.gisLoaded=!1,e.pickerLoaded=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;this.loadScript("https://accounts.google.com/gsi/client",function(){e.gisLoaded=!0}),this.loadScript("https://apis.google.com/js/api.js",function(){gapi.load("picker",function(){e.pickerLoaded=!0})})}},{key:"disconnect",value:function(){this.accessToken=null,this.tokenExpiresAt=0,this.tokenClient=null}},{key:"selectMethod",value:function(e){var t,n="public_url"===e.target.value;this.publicUrlPanelTarget.hidden=!n,this.pickerPanelTarget.hidden=n,null===(t=document.getElementById("voter_list_notices"))||void 0===t||t.remove()}},{key:"open",value:function(){this.hasValidToken()?this.openPicker():this.requestToken()}},{key:"hasValidToken",value:function(){return null!==this.accessToken&&Date.now()<this.tokenExpiresAt}},{key:"requestToken",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if("undefined"===typeof google||null===(e=google)||void 0===e||null===(e=e.accounts)||void 0===e||!e.oauth2)return n<5?void setTimeout(function(){t.requestToken(n+1)},500):void console.error("[google-picker] Failed to load Google Identity Services after multiple attempts.");this.tokenClient||(this.tokenClient=google.accounts.oauth2.initTokenClient({client_id:this.clientIdValue,scope:"https://www.googleapis.com/auth/drive.file",callback:function(e){e.error?console.error("[google-picker] token error:",e.error):(t.accessToken=e.access_token,t.tokenExpiresAt=Date.now()+1e3*(e.expires_in-30),t.openPicker())}})),this.tokenClient.requestAccessToken()}},{key:"openPicker",value:function(){var e=this;if(this.pickerLoaded){var t=new google.picker.View(google.picker.ViewId.SPREADSHEETS);(new google.picker.PickerBuilder).addView(t).setOAuthToken(this.accessToken).setDeveloperKey(this.developerKeyValue).setAppId(this.appIdValue).setOrigin(window.location.origin).setCallback(function(t){return e.onPicked(t)}).setSize(800,600).build().setVisible(!0)}else setTimeout(function(){return e.openPicker()},500)}},{key:"onPicked",value:function(e){var t;if(e.action===google.picker.Action.PICKED&&null!==(t=e.docs)&&void 0!==t&&t.length){var n=e.docs[0].id;this.dispatch("file-picked",{detail:{fileId:n,accessToken:this.accessToken}}),this.callbackModeValue||this.submitToBackend(n)}}},{key:"submitUrl",value:function(e){var t;if(this.callbackModeValue){e.preventDefault();var n=e.target.querySelector('input[type="url"]'),r=null===n||void 0===n||null===(t=n.value)||void 0===t?void 0:t.trim();r&&this.dispatch("url-submitted",{detail:{url:r}})}}},{key:"submitToBackend",value:function(e){var t=document.createElement("form");t.method="post",t.action=this.uploadUrlValue,t.dataset.remote="true";var n={authenticity_token:this.csrfTokenValue,source:"picker",file_id:e,access_token:this.accessToken};Object.entries(n).forEach(function(e){var n=r(e,2),o=n[0],i=n[1],a=document.createElement("input");a.type="hidden",a.name=o,a.value=i,t.appendChild(a)}),document.body.appendChild(t),t.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0})),document.body.removeChild(t)}},{key:"loadScript",value:function(e,t){var n=document.querySelector('script[src="'.concat(e,'"]'));if(n)"true"===n.dataset.loaded?t():n.addEventListener("load",t,{once:!0});else{var r=document.createElement("script");r.src=e,r.async=!0,r.addEventListener("load",function(){r.dataset.loaded="true",t()},{once:!0}),document.head.appendChild(r)}}}],o&&i(n.prototype,o),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);f.targets=["publicUrlPanel","pickerPanel"],f.values={clientId:String,developerKey:String,appId:String,uploadUrl:String,csrfToken:String,callbackMode:Boolean}},1476:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f="voter-list-processing-busy",d="voter-list-processing-overlay--hidden",p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=u(this,t,[].concat(r))).modernOverlay=!1,e.handleClick=function(t){var n=t.target,r=n.closest(".upload_button");if(r){t.preventDefault(),e.modernOverlay?e.showUploadOverlay():NProgress.start();var i=r.closest("form");i&&Rails.fire(i,"submit")}else{var a=n.closest(".import_button");if(a){t.preventDefault(),NProgress.start();var u=a.querySelector("span");u&&(u.textContent="Importing...");var c=a.closest("form");c&&Rails.fire(c,"submit")}else{if(n.closest(".import_voter_list, .validate_voter_list"))e.modernOverlay||NProgress.start();else if(n.closest(".start_over_mapper, .start_over_voter_list"))NProgress.start();else if(n.closest("#duplicate_wizard_path")){t.preventDefault();var s=(0,o.T)();s&&s(t.target).modal({clickClose:!1})}else{var l,f=n.closest("#submit_wizard_duplication");if(f)null===(l=document.getElementById("error_div"))||void 0===l||l.classList.add("hide"),f.classList.add("disabled")}}}},e.handleChange=function(t){var n=t.target,r=n.closest('.upload-container input[type="file"]');
2if(r){if(!r.files||0===r.files.length)return;e.modernOverlay?e.showUploadOverlay():NProgress.start();var o=r.closest("form");o&&Rails.fire(o,"submit")}else{var i=n.closest(".parse_data_option");if(i){t.preventDefault();var a=i.closest("form");a&&Rails.fire(a,"submit")}}},e.handleConfirmComplete=function(e){e.target.closest(".start_over_mapper, .start_over_voter_list")&&NProgress.done()},e.handleUploadAjaxComplete=function(t){var n;null!==(n=t.target.classList)&&void 0!==n&&n.contains("upload-container")&&e.hideUploadOverlay()},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.modernOverlay="true"===this.element.dataset.modernOverlay,this.element.addEventListener("click",this.handleClick),this.element.addEventListener("change",this.handleChange),this.element.addEventListener("confirm:complete",this.handleConfirmComplete),this.modernOverlay&&this.element.addEventListener("ajax:complete",this.handleUploadAjaxComplete)}},{key:"disconnect",value:function(){this.element.removeEventListener("click",this.handleClick),this.element.removeEventListener("change",this.handleChange),this.element.removeEventListener("confirm:complete",this.handleConfirmComplete),this.element.removeEventListener("ajax:complete",this.handleUploadAjaxComplete),this.unlockPage()}},{key:"showUploadOverlay",value:function(){this.hasOverlayTarget&&this.overlayTarget.classList.remove(d),this.hasCardTarget&&this.cardTarget.focus(),document.documentElement.classList.add(f)}},{key:"hideUploadOverlay",value:function(){this.hasOverlayTarget&&this.overlayTarget.classList.add(d),this.unlockPage()}},{key:"unlockPage",value:function(){document.documentElement.classList.remove(f)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);p.targets=["overlay","card"]},332:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l="application--toolkit--ag-grid-ssrm-component--ag-grid-ssrm-component",f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),a(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"submit",value:function(){var e=this.gridElement();e?this.submitToGrid(e):Rails.fire(this.formTarget,"submit")}},{key:"interceptSubmit",value:function(e){var t=this.gridElement();t&&(e.preventDefault(),e.stopImmediatePropagation(),this.submitToGrid(t))}},{key:"gridElement",value:function(){return this.element.querySelector('[data-controller~="'.concat(l,'"]'))}},{key:"submitToGrid",value:function(e){var t=this.application.getControllerForElementAndIdentifier(e,l);if(t){var n=new FormData(this.formTarget);t.searchTextValue=(n.get("keyword")||"").toString(),t.setExternalFilters({notice_types:n.getAll("filters[notice_types][]"),groups:n.getAll("filters[groups][]"),errors:n.getAll("filters[errors][]")})}}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);f.targets=["form"]},7108:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.updatePreview()}},{key:"updatePreview",value:function(){var e;if(this.hasPreviewTarget){var t=(null===(e=this.inputTarget)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.trim())||"";if(0===t.length)return this.previewTarget.textContent="",void this.previewTarget.classList.add("hidden");this.previewTarget.classList.remove("hidden");var n=this.labelTextValue||this.prefixValue||"";n=n.replace(/label/i,"").trim(),this.previewTarget.textContent="PREVIEW: ".concat(n," - ").concat(t).replace(/ - $/,"")}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["input","preview"],s.values={prefix:String,labelText:String}},920:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this.componentTarget.getAttribute("data-table-controller");document.querySelectorAll(".voter_list_pagination_component a").forEach(function(t){t.setAttribute("data-remote",!0),t.setAttribute("data-type","html"),t.setAttribute("data-action","ajax:success->".concat(e,"#refresh"))})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["component"]},8234:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var r=n(5396),o=n(2224);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function f(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var d=0;function p(e){return"__private_"+d+++"_"+e}var h=p("syncLabelCallback"),v=p("prefix"),y=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=u(this,t,[].concat(r)),Object.defineProperty(e,v,{value:b}),Object.defineProperty(e,h,{value:m}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=f(this,h)[h]();e(),this.inputTarget.addEventListener("input",e)}}])&&i(n.prototype,r),o&&i(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);function m(){var e=this;return function(){e.labelTarget.innerText=(0,o.joinUnlessMissingOrSame)(f(e,v)[v](),e.inputTarget.value)}}function b(){return this.data.get("prefix")}y.targets=["input","label"]},2752:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return E}});var r=n(8179),o=n(4546),i=n(737),a=n(6149),u=n(7343),c=n(7323);function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return l(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(l(t={},r,function(){return this}),t),p=f.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,r,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,t,n,r){function i(t,n){l(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},l(e,t,n,r)}function f(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?h(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function b(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function g(e,t,n){return t=T(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,w()?Reflect.construct(t,n||[],T(e).constructor):t.apply(e,n))}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function _(e,t,n,r){var o=O(T(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}function O(){return O="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=T(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},O.apply(null,arguments)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},k(e,t)}var j="voter-list:row-added";function S(e,t){return fetch(e,{method:"DELETE",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":(0,u.GQ)()},credentials:"same-origin",body:JSON.stringify(t)}).then(function(e){return e.text().then(function(t){var n={};if(t)try{var r=JSON.parse(t);null!==r&&"object"===typeof r&&(n=r)}catch(o){}return{ok:e.ok,status:e.status,json:n}})})}var P=["export","paste"],E=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return(e=g(this,t,[].concat(o))).editQueue=void 0,e.searchTerm="",e.currentColumnDefs=[],e.settingsChangeHandler=null,e.onRowAdded=function(){e.gridApi&&(e.editQueue.flush(),e.hasSearchInputTarget&&(e.searchInputTarget.value=""),e.searchTerm="",e.gridApi.setFilterModel(null),e.gridApi.applyColumnState({defaultState:{sort:null}}),e.gridApi.addEventListener("modelUpdated",e.goToLastPageOnce),e.gridApi.refreshServerSide({purge:!0}))},e.goToLastPageOnce=function(){var t,n;null===(t=e.gridApi)||void 0===t||t.removeEventListener("modelUpdated",e.goToLastPageOnce),null===(n=e.gridApi)||void 0===n||n.paginationGoToLastPage()},e.refreshSearchDebounced=(n=null,function(){null!==n&&clearTimeout(n),n=setTimeout(function(){var t;n=null,e.editQueue.flush(),null===(t=e.gridApi)||void 0===t||t.refreshServerSide({purge:!0})},375)}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;if(_(t,"connect",this,3)([]),this.hasGridTarget){this.currentColumnDefs=this.columnDefsValue,this.editQueue=new u.ug(this.updateUrlTemplateValue,this.batchUpdateUrlValue,{onPersisted:function(t){e.clearStaleValidationBanner(),e.showStatusMessage(t,!1)},onRemoveNode:function(t){var n;return null===(n=e.gridApi)||void 0===n?void 0:n.applyTransaction({remove:[t.data]})},onError:function(t){return e.showStatusMessage(t,!0)}},"[PostSaveGridComponent]");var n=new c.M(this.gridDataUrlValue,function(){return e.searchTerm},function(){}),o=v(v({theme:i.zA,rowModelType:"serverSide",serverSideDatasource:n,cacheBlockSize:this.pageSizeValue,columnDefs:this.buildColumnDefs(),pagination:!0,paginationPageSize:this.pageSizeValue,domLayout:"autoHeight",rowNumbers:{contextMenuItems:function(t){return e.buildContextMenuItems(t,{gutter:!0})}},getRowId:function(e){var t,n;return String(null!==(t=null===(n=e.data)||void 0===n?void 0:n.id)&&void 0!==t?t:"")},stopEditingWhenCellsLoseFocus:!0,defaultColDef:{resizable:!0,sortable:!0,filter:!0}},this.readOnlyValue?{}:{rowSelection:{mode:"multiRow",checkboxes:!1,headerCheckbox:!1,enableClickSelection:!0}
2}),{},{getContextMenuItems:function(t){return e.buildContextMenuItems(t)},onCellValueChanged:function(t){return e.queueChange(t)},onSortChanged:function(){return e.editQueue.flush()},onFilterChanged:function(){return e.editQueue.flush()}});this.gridApi=(0,r.Dvw)(this.gridTarget,o),this.autoSizeNonFlexColumns(),window.addEventListener(j,this.onRowAdded),this.settingsChangeHandler=function(t){var n,r=t.target;null!==r&&void 0!==r&&null!==(n=r.closest)&&void 0!==n&&n.call(r,"form.voter_list_election_form")&&e.refreshColumnDefs()},document.addEventListener("ajax:complete",this.settingsChangeHandler)}}},{key:"disconnect",value:function(){var e;window.removeEventListener(j,this.onRowAdded),this.settingsChangeHandler&&(document.removeEventListener("ajax:complete",this.settingsChangeHandler),this.settingsChangeHandler=null),null===(e=this.gridApi)||void 0===e||e.removeEventListener("modelUpdated",this.goToLastPageOnce),_(t,"disconnect",this,3)([])}},{key:"buildContextMenuItems",value:function(e){var t,n=this,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).gutter,o=void 0!==r&&r?[]:(null!==(t=e.defaultItems)&&void 0!==t?t:[]).filter(function(e){return!P.includes(e)});if(this.readOnlyValue||!this.hasBatchDestroyUrlValue)return o;var i=this.targetedRowIds(e.node);if(0===i.length)return o;var a={name:this.deleteLabel(i.length),icon:'<i class="fas fa-trash" aria-hidden="true"></i>',action:function(){n.deleteRows(i)}};return o.length>0?[].concat(d(o),["separator",a]):[a]}},{key:"targetedRowIds",value:function(e){var t,n,r=null!==(t=null===(n=this.gridApi)||void 0===n?void 0:n.getSelectedNodes())&&void 0!==t?t:[];return(r.length>0&&(null===e||e.isSelected())?r:e?[e]:[]).map(function(e){var t;return Number(null===(t=e.data)||void 0===t?void 0:t.id)}).filter(function(e){return Number.isInteger(e)&&e>0})}},{key:"deleteLabel",value:function(e){return 1===e?"Delete voter":"Delete ".concat(e," voters")}},{key:"deleteRows",value:(p=s().m(function e(t){var n,r,o,i,a,u,c;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.editQueue.flush(),o=!1,i=0,a={},e.p=1,e.n=2,S(this.batchDestroyUrlValue,{ids:t});case 2:u=e.v,o=u.ok,i=u.status,a=u.json,e.n=4;break;case 3:return e.p=3,e.v,this.showStatusMessage("Could not reach the server. No voters were removed.",!0),e.a(2);case 4:if(o){e.n=5;break}return this.showStatusMessage(this.deleteErrorMessage(i,a),!0),e.a(2);case 5:c=Array.isArray(a.deleted_ids)?a.deleted_ids.length:t.length,this.clearStaleValidationBanner(),this.showStatusMessage("".concat(1===c?"1 voter":"".concat(c," voters")," removed. The voter list has changed. Please validate again."),!1),null===(n=this.gridApi)||void 0===n||n.deselectAll(),this.editQueue.flush(),null===(r=this.gridApi)||void 0===r||r.refreshServerSide({purge:!0});case 6:return e.a(2)}},e,this,[[1,3]])}),h=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=p.apply(e,t);function i(e){f(o,n,r,i,a,"next",e)}function a(e){f(o,n,r,i,a,"throw",e)}i(void 0)})},function(e){return h.apply(this,arguments)})},{key:"deleteErrorMessage",value:function(e,t){return void 0!==t.errors?(0,u.PE)(t):403===e?"You do not have permission to remove voters from this list.":"Removing the selected voter(s) failed (server responded ".concat(e,"). Please reload the page.")}},{key:"onSearchChanged",value:function(){this.gridApi&&this.hasSearchInputTarget&&(this.searchTerm=this.searchInputTarget.value,this.refreshSearchDebounced())}},{key:"switchToBasic",value:function(){}},{key:"switchToAdvanced",value:function(){}},{key:"queueChange",value:function(e){if(!this.editQueue.suppressed){var t=e.colDef.field;t&&this.editQueue.queueChange(e.node,t,e.newValue,e.oldValue)}}},{key:"buildColumnDefs",value:function(){var e=this,t=!this.readOnlyValue,n=this.currentColumnDefs.map(function(n){var r=t&&Boolean(n.editable);return v(v({},n),{},{editable:r,cellClass:r?e.withEditableCellClass(n.cellClass):n.cellClass})});return(0,a.g)(this.applyFilterValueCallbacks(n))}},{key:"refreshColumnDefs",value:function(){var e=this;return this.gridApi&&this.columnDefsUrlValue?(this.editQueue.flush(),fetch(this.columnDefsUrlValue,{headers:{Accept:"application/json"},credentials:"same-origin"}).then(function(e){return e.json()}).then(function(t){var n,r,o=Array.isArray(t.column_defs)?t.column_defs:[];return 0!==o.length&&(e.currentColumnDefs=o,null===(n=e.gridApi)||void 0===n||n.setGridOption("c
2olumnDefs",e.buildColumnDefs()),null===(r=e.gridApi)||void 0===r||r.refreshServerSide({purge:!0}),!0)}).catch(function(e){return console.error("[PostSaveGridComponent] column_defs refresh error:",e),!1})):Promise.resolve(!1)}},{key:"withEditableCellClass",value:function(e){var t=Array.isArray(e)?e:"string"===typeof e?[e]:[];return[].concat(d(t),["voter-list-editable-validation-grid-cell--editable"])}},{key:"applyFilterValueCallbacks",value:function(e){var t=this;return this.hasFilterValuesUrlValue&&this.filterValuesUrlValue?e.map(function(e){var n,r,o,i;if("agSetColumnFilter"!==e.filter)return e;if(null!==(n=e.filterParams)&&void 0!==n&&n.values)return e;var a=String(null!==(r=null!==(o=e.field)&&void 0!==o?o:e.colId)&&void 0!==r?r:"");return v(v({},e),{},{filterParams:v(v({},null!==(i=e.filterParams)&&void 0!==i?i:{}),{},{values:function(e){fetch("".concat(t.filterValuesUrlValue,"?column=").concat(encodeURIComponent(a)),{credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(e){return e.ok?e.json():{values:[]}}).then(function(t){var n;return e.success(null!==(n=t.values)&&void 0!==n?n:[])}).catch(function(){return e.success([])})}})})}):e}},{key:"clearStaleValidationBanner",value:function(){["voter_list_notices","secondary_voter_list_notices"].forEach(function(e){var t=document.getElementById(e);t&&(t.innerHTML="")})}},{key:"showStatusMessage",value:function(e,t){this.hasStatusMessageTarget&&(this.statusMessageTarget.textContent=e,this.statusMessageTarget.className="voter-list-editable-validation-grid-status ".concat(t?"inline_error":"inline_success"))}}],o&&m(n.prototype,o),l&&m(n,l),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,l,p,h}(o.AgGridBaseController);E.targets=[].concat(d(o.AgGridBaseController.targets),["grid","statusMessage","searchInput"]),E.values=v(v({},o.AgGridBaseController.values),{},{gridDataUrl:String,filterValuesUrl:String,columnDefsUrl:String,updateUrlTemplate:String,batchUpdateUrl:String,batchDestroyUrl:String,pageSize:{type:Number,default:20},readOnly:Boolean})},5898:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return g}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(){return window.NProgress},d={importation:"Importing your voter list",validation:"Validating your voter list",copy_voters:"Copying voters"},p={importation:["stageImporting","stageValidating"],validation:["stageValidating"],copy_voters:["stageCopying"]},h=["voter-list-processing-overlay__stage--pending","voter-list-processing-overlay__stage--active","voter-list-processing-overlay__stage--done"],v="voter-list-processing-busy",y=[500,1e3,2e3,4e3,8e3],m="voter_list_error_description",b={status:"ElectionBuddy couldn't check on your voter list \u2014 the connection was interrupted. The import may still have finished. Please reload this page to see its current status.",completion:"Your voter list finished processing, but ElectionBuddy couldn't refresh this page. Please reload the page to see the result."},g=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.torndown=!1,this.released=!1,this.pendingTimer=null,this.retries={status:{attempts:0,since:null},completion:{attempts:0,since:null}};var e=this.inputTarget.dataset.electionId;if(null!==e&&""!==e){var t;if(this.modernOverlay="true"===this.inputTarget.dataset.modernOverlay,this.modernOverlay?(document.documentElement.classList.add(v),this.hasCardTarget&&this.cardTarget.focus()):null===(t=f())||void 0===t||t.start(),"true"==this.inputTarget.dataset.scrollTopOption){var n=(0,o.T)();n&&n("html, body").animate({scrollTop:n("#import_options_title").offset().top},"slow")}this.scheduleVoterListProcessingStatusCheck(e)}}},{key:"disconnect",value:function(){this.torndown=!0,this.clearPendingTimer(),document.documentElement.classList.remove(v)}},{key:"scheduleVoterListProcessingStatusCheck",value:function(e){var t=this;if(!this.torndown&&!this.released){var n=(0,o.T)();n&&n.ajax({url:"voter_list_import_status/".concat(e),timeout:15e3}).done(function(r){if(!t.torndown&&!t.released)if("object"===typeof r&&null!==r){t.resetRetries("status");var o=r&&r.done||!1,i=r&&r.action||"";t.modernOverlay&&t.renderModernStatus(r,i),o?t.requestVoterListImportRefresh():(t.modernOverlay||("validation"===i?n("#voter_list_processing_message").text("Validating voters."):"importation"===i?n("#voter_list_processing_message").text("Importing and validating voters."):"copy_voters"===i&&n("#voter_list_processing_message").text("Copying voters.")),t.pendingTimer=setTimeout(function(){t.scheduleVoterListProcessingStatusCheck(e)},500))}else t.retryOrRelease("status",function(){return t.scheduleVoterListProcessingStatusCheck(e)})}).fail(function(){t.retryOrRelease("status",function(){return t.scheduleVoterListProcessingStatusCheck(e)})})}}},{key:"requestVoterListImportRefresh",value:function(){var e=this;if(!this.torndown&&!this.released){var t=(0,o.T)();t&&t.ajax({url:"voter_list_import",timeout:15e3}).fail(function(t,n){"parsererror"!==n?e.retryOrRelease("completion",function(){return e.requestVoterListImportRefresh()}):e.releaseAfterFailure("completion")})}}},{key:"retryOrRelease",value:function(e,t){if(!this.torndown&&!this.released){var n=this.retries[e];null===n.since&&(n.since=Date.now());var r=Date.now()-n.since>=3e4;if(n.attempts>=5||r)this.releaseAfterFailure(e);else{var o=y[Math.min(n.attempts,y.length-1)];n.attempts+=1,this.pendingTimer=setTimeout(t,o)}}}},{key:"resetRetries",value:function(e){this.retries[e]={attempts:0,since:null}}},{key:"releaseAfterFailure",value:function(e){this.released=!0,this.clearPendingTimer();
2try{this.showFailureMessage(b[e])}finally{try{this.dismissOverlay()}finally{this.unlockPage()}}}},{key:"dismissOverlay",value:function(){this.hasOverlayTarget&&this.overlayTarget.classList.add("voter-list-processing-overlay--hidden"),this.element.remove()}},{key:"unlockPage",value:function(){var e;document.documentElement.classList.remove(v),this.modernOverlay||null===(e=f())||void 0===e||e.done()}},{key:"showFailureMessage",value:function(e){var t,n=this.element.parentNode;if(n&&e){null===(t=document.getElementById(m))||void 0===t||t.remove();var r=document.createElement("span");r.className="inline_error",r.id=m,r.setAttribute("role","alert"),r.textContent=e,n.appendChild(r)}}},{key:"clearPendingTimer",value:function(){this.pendingTimer&&(clearTimeout(this.pendingTimer),this.pendingTimer=null)}},{key:"renderModernStatus",value:function(e,t){this.hasTitleTarget&&d[t]&&(this.titleTarget.textContent=d[t]);var n=e&&e.stage;this.updateStages(t,n),this.updateProgress(e&&e.progress,n)}},{key:"updateStages",value:function(e,t){var n=p[e]||[];if(this.hasStageImportingTarget&&this.applyStageState(this.stageImportingTarget,n.includes("stageImporting"),"validating"===t?"done":"active"),this.hasStageValidatingTarget){var r="importation"===e?"validating"===t?"active":"pending":"active";this.applyStageState(this.stageValidatingTarget,n.includes("stageValidating"),r)}this.hasStageCopyingTarget&&this.applyStageState(this.stageCopyingTarget,n.includes("stageCopying"),"active")}},{key:"applyStageState",value:function(e,t,n){var r;e.classList.toggle("voter-list-processing-overlay__stage--hidden",!t),t&&((r=e.classList).remove.apply(r,h),e.classList.add("voter-list-processing-overlay__stage--".concat(n)))}},{key:"updateProgress",value:function(e,t){if(this.hasProgressTarget)if("validating"!==t&&e&&"number"===typeof e.processed&&e.total>0){var n=e.processed,r=e.total,o=Math.min(100,Math.round(n/r*100));this.progressTarget.classList.add("voter-list-processing-overlay__progress--determinate"),this.progressTarget.classList.remove("voter-list-processing-overlay__progress--indeterminate"),this.hasProgressFillTarget&&(this.progressFillTarget.style.width="".concat(o,"%"),this.progressFillTarget.setAttribute("role","progressbar"),this.progressFillTarget.setAttribute("aria-valuenow",String(o)),this.progressFillTarget.setAttribute("aria-valuemin","0"),this.progressFillTarget.setAttribute("aria-valuemax","100")),this.hasProgressLabelTarget&&(this.progressLabelTarget.textContent="".concat(o,"% \u2014 ").concat(n.toLocaleString()," of ").concat(r.toLocaleString()," rows"))}else this.progressTarget.classList.add("voter-list-processing-overlay__progress--indeterminate"),this.progressTarget.classList.remove("voter-list-processing-overlay__progress--determinate"),this.hasProgressFillTarget&&(this.progressFillTarget.style.width="",this.progressFillTarget.removeAttribute("role"),this.progressFillTarget.removeAttribute("aria-valuenow"),this.progressFillTarget.removeAttribute("aria-valuemin"),this.progressFillTarget.removeAttribute("aria-valuemax")),this.hasProgressLabelTarget&&(this.progressLabelTarget.textContent="")}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);g.targets=["input","title","card","overlay","stageImporting","stageValidating","stageCopying","progress","progressFill","progressLabel"]},9386:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"enableCustomHelpTextInput",value:function(){this.customHelpTextTarget.classList.remove("hide")}},{key:"disableCustomHelpTextInput",value:function(){this.customHelpTextTarget.querySelector(".rich_text_editor_component_container .ql-editor").innerHTML="",this.customHelpTextTarget.classList.add("hide")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["customHelpText"]},126:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(6923);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"refresh",value:function(e){var t=i(e.detail,3),n=(t[0],t[1],t[2]),r=document.querySelector(".voter_list_table_component");r&&(r.innerHTML=n.response)}},{key:"update",value:function(e){EB.Elections.VoterListController.disableAdminProceedToReview("validate_voter_list_message");var t=e.target.getAttribute("data-voter-attribute-value"),n=e.target.innerText;if(t!=n){var r=JSON.parse(e.target.getAttribute("data-voter-params"));r[e.target.getAttribute("data-voter-attribute-name")]=n;var i=r.id,a=(0,o.T)();a&&a.ajax({url:"voter_information_lines/".concat(i),type:"PATCH",dataType:"SCRIPT",data:r})}else e.preventDefault()}}])&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},4e3:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e;null===(e=window.EB)||void 0===e||null===(e=e.Elections)||void 0===e||null===(e=e.VoterStatus)||void 0===e||e.reloadPaginatedInvitations()}},{key:"closeModal",value:function(){var e;null===(e=window.EB)||void 0===e||null===(e=e.TurboModal)||void 0===e||e.hideModal()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},2709:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.proxyVoteToMemberSelectorComponent=document.querySelector(".ballots-proxy-voter-component"),this.proxyToMemberSelected()&&this.enableProxyVoteToMember(),this.proxyToMemberWithoutAcceptanceSelected()&&this.enableProxyVoteToMemberWithoutAcceptance(),this.proxyToAdminSelected()&&this.enableProxyVoteToAdmin(),this.confirmSubmit(),this.reloadLocationAfterSubmit()}},{key:"enableProxyVoteToMember",value:function(){this.enableProxyVoteToMemberSelector(),this.defineSkipAcceptanceValue(!1)}},{key:"enableProxyVoteToMemberWithoutAcceptance",value:function(){this.enableProxyVoteToMemberSelector(),this.defineSkipAcceptanceValue(!0)}},{key:"enableProxyVoteToAdmin",value:function(){this.disableProxyVoteToMemberSelector(),this.defineSkipAcceptanceValue(!1)}},{key:"disableProxyVoteToMemberSelector",value:function(){this.proxyVoteToMemberSelectorComponent.classList.add("hide")}},{key:"enableProxyVoteToMemberSelector",value:function(){this.proxyVoteToMemberSelectorComponent.classList.remove("hide")}},{key:"reloadLocationAfterSubmit",value:function(){this.element.addEventListener("turbo:submit-end",function(e){e.detail.success&&location.reload()})}},{key:"confirmSubmit",value:function(){var e=document.querySelector("form .submit-button");null===e||void 0===e||e.addEventListener("click",function(e){confirm("Are you sure you want to transfer the voting rights?")||e.preventDefault()})}}
2,{key:"defineSkipAcceptanceValue",value:function(e){document.getElementById("skip_acceptance").value=String(e)}},{key:"proxyToMemberSelected",value:function(){document.querySelector("#vote_mode_proxy_vote_to_member")&&this.proxyVoteToMemberRadioButtonTarget.checked}},{key:"proxyToMemberWithoutAcceptanceSelected",value:function(){document.querySelector("#vote_mode_proxy_vote_to_member_without_acceptance")&&this.proxyVoteToMemberWithoutAcceptanceRadioButtonTarget.checked}},{key:"proxyToAdminSelected",value:function(){document.querySelector("#vote_mode_proxy_vote_to_admin")&&this.proxyVoteToAdminRadioButtonTarget.checked}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["proxyVoteToMemberRadioButton","proxyVoteToAdminRadioButton","proxyVoteToMemberWithoutAcceptanceRadioButton"]},5801:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.element.addEventListener("turbo:submit-end",function(t){t.detail.success&&e.redirectToReview(t)})}},{key:"redirectToReview",value:function(e){var t=window.location.href,n=this.acceptedRadioButtonTarget.checked;Turbo.visit(t.replace("/edit","")+"?accepted=".concat(n),{action:"replace"}),history.pushState(null,null,t)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["acceptedRadioButton"]},4204:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){}},{key:"handleKeyBlur",value:function(e){this.submitForm()}},{key:"submitForm",value:function(){this.hasFormTarget&&""!==this.keyFieldTarget.value.trim()&&this.formTarget.requestSubmit()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["form","keyField"]},7015:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"save",value:function(){var e=this.element.querySelector("form");e&&e.requestSubmit()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},6869:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var r=n(5396),o=n(8051);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function u(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return a(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(a(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,a(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,a(p,"constructor",f),a(f,"constructor",l),l.displayName="GeneratorFunction",a(f,o,"GeneratorFunction"),a(p),a(p,o,"Generator"),a(p,r,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(i=function(){return{w:u,m:h}})()}function a(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}a=function(e,t,n,r){function i(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},a(e,t,n,r)}function u(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,c,"next",e)}function c(e){u(i,r,o,a,c,"throw",e)}a(void 0)})}}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function f(e,t,n){return t=p(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}
2function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}var v="votes:dashboard:add-to-vote-box",y=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=f(this,t,[].concat(r))).openHandler=null,e.keydownHandler=null,e.overlayClickHandler=null,e.gridReadyHandler=null,e.gridApi=null,e.electionIds=[],e.page=1,e.hasNext=!1,e.selectedBoxId=null,e.submitting=!1,e.search="",e.searchTimer=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.openHandler=function(t){var n,r,o=t.detail;e.open(null!==(n=null===o||void 0===o?void 0:o.rows)&&void 0!==n?n:[],null!==(r=null===o||void 0===o?void 0:o.ids)&&void 0!==r?r:[])},document.addEventListener(v,this.openHandler),this.gridReadyHandler=function(t){var n,r=t.detail;e.gridApi=null!==(n=null===r||void 0===r?void 0:r.gridApi)&&void 0!==n?n:null},document.addEventListener("votes:dashboard:grid-ready",this.gridReadyHandler),document.dispatchEvent(new CustomEvent("votes:dashboard:request-grid-api")),this.keydownHandler=function(t){"Escape"!==t.key||e.overlayTarget.hidden||e.close()},document.addEventListener("keydown",this.keydownHandler),this.overlayClickHandler=function(t){t.target===e.overlayTarget&&e.close()},this.overlayTarget.addEventListener("click",this.overlayClickHandler)}},{key:"disconnect",value:function(){this.openHandler&&(document.removeEventListener(v,this.openHandler),this.openHandler=null),this.gridReadyHandler&&(document.removeEventListener("votes:dashboard:grid-ready",this.gridReadyHandler),this.gridReadyHandler=null),this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.overlayClickHandler&&(this.overlayTarget.removeEventListener("click",this.overlayClickHandler),this.overlayClickHandler=null)}},{key:"open",value:function(e,t){this.electionIds=t.map(function(e){return String(e)}),this.selectedBoxId=null,this.page=1,this.submitting=!1,this.submitButtonTarget.disabled=!0,this.listTarget.innerHTML="",this.hideMessage(),this.paginationTarget.hidden=!0,this.clearSearch(),this.searchTarget.hidden=!0,this.subtitleTarget.textContent=this.describeSelection(e),this.overlayTarget.hidden=!1,this.searchTarget.hidden=!1,this.searchInputTarget.focus(),this.loadPage(1)}},{key:"close",value:function(){var e;this.overlayTarget.hidden=!0,this.listTarget.innerHTML="",this.selectedBoxId=null,this.submitButtonTarget.disabled=!0,this.clearSearch(),null===(e=this.gridApi)||void 0===e||e.deselectAll()}},{key:"onSearchInput",value:function(){var e=this;null!==this.searchTimer&&clearTimeout(this.searchTimer),this.searchTimer=setTimeout(function(){e.searchTimer=null;var t=e.searchInputTarget.value.trim();t!==e.search&&(e.search=t,e.loadPage(1))},375)}},{key:"clearSearch",value:function(){null!==this.searchTimer&&(clearTimeout(this.searchTimer),this.searchTimer=null),this.search="",this.searchInputTarget.value=""}},{key:"prevPage",value:function(){this.page<=1||this.loadPage(this.page-1)}},{key:"nextPage",value:function(){this.hasNext&&this.loadPage(this.page+1)}},{key:"describeSelection",value:function(e){var t,n=this.electionIds.length;return 1===n?null!==(t=e[0])&&void 0!==t&&t.name?String(e[0].name):"1 election selected":"".concat(n," elections selected")}},{key:"loadPage",value:(l=c(i().m(function e(t){var n,r,o,a;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return this.renderLoading(),e.p=1,e.n=2,fetch(this.listUrl(t),{headers:{Accept:"application/json"},credentials:"same-origin"});case 2:if((o=e.v).ok){e.n=3;break}throw new Error("Could not load vote boxes.");case 3:return e.n=4,o.json();case 4:a=e.v,this.page=null!==(n=a.page)&&void 0!==n?n:t,this.hasNext=Boolean(a.has_next),this.renderList(null!==(r=a.vote_boxes)&&void 0!==r?r:[]),e.n=6;break;case 5:e.p=5,e.v,this.listTarget.innerHTML="",this.showMessage("Could not load vote boxes. Close this and try again.",!0);case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return l.apply(this,arguments)})},{key:"listUrl",value:function(e){var t=new URLSearchParams({page:String(e),active_only:"true"});return""!==this.search&&t.set("search",this.search),this.currentVoteBoxIdValue>0&&t.set("exclude_vote_box_id",String(this.currentVoteBoxIdValue)),"".concat(this.voteBoxesUrlV
2alue,"?").concat(t.toString())}},{key:"renderLoading",value:function(){this.hideMessage(),this.listTarget.innerHTML="";var e=document.createElement("p");e.className=this.bem("loading"),e.textContent="Loading vote boxes\u2026",this.listTarget.appendChild(e)}},{key:"renderList",value:function(e){var t=this;if(this.listTarget.innerHTML="",this.selectedBoxId=null,this.submitButtonTarget.disabled=!0,0!==e.length)this.searchTarget.hidden=!1,this.hideMessage(),e.forEach(function(e){return t.listTarget.appendChild(t.buildRow(e))}),this.renderPagination();else{this.paginationTarget.hidden=!0,this.searchTarget.hidden=""===this.search;var n=this.emptyState();this.showMessage(n.message,!1,n.createUrl)}}},{key:"isMove",get:function(){return this.currentVoteBoxIdValue>0}},{key:"emptyState",value:function(){var e=this.isMove?"other active vote box":"active vote box";return""!==this.search?{message:"No ".concat(e," matches \u201c").concat(this.search,"\u201d.")}:this.page>1?{message:"No more vote boxes on this page."}:this.newVoteBoxUrlValue?{message:"No ".concat(e," available."),createUrl:this.newVoteBoxUrlValue}:{message:"No ".concat(e," available.")}}},{key:"buildRow",value:function(e){var t=this,n=document.createElement("label");n.className=this.bem("row");var r=document.createElement("input");r.type="radio",r.name="vote_box_id",r.value=String(e.id),r.className=this.bem("row-radio"),r.addEventListener("change",function(){return t.selectBox(e.id,n)});var o=document.createElement("span");o.className=this.bem("row-title"),o.textContent=e.title;var i=document.createElement("span");return i.className=this.bem("row-id"),i.textContent="ID ".concat(e.id),n.appendChild(r),n.appendChild(o),n.appendChild(i),n}},{key:"countLabel",value:function(e){return 1===e?"1 election":"".concat(e," elections")}},{key:"selectBox",value:function(e,t){this.selectedBoxId=e,this.submitButtonTarget.disabled=!1;var n="".concat(this.bem("row"),"--selected");this.listTarget.querySelectorAll(".".concat(this.bem("row"))).forEach(function(e){return e.classList.remove(n)}),t.classList.add(n)}},{key:"renderPagination",value:function(){var e=this.page>1||this.hasNext;this.paginationTarget.hidden=!e,e&&(this.prevButtonTarget.disabled=this.page<=1,this.nextButtonTarget.disabled=!this.hasNext,this.pageLabelTarget.textContent="Page ".concat(this.page))}},{key:"submit",value:(u=c(i().m(function e(){var t,n,r,a,u,c,s;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null!==this.selectedBoxId&&!this.submitting&&0!==this.electionIds.length){e.n=1;break}return e.a(2);case 1:return this.submitting=!0,this.submitButtonTarget.disabled=!0,this.hideMessage(),t=this.selectedBoxId,n=this.electionIds.length,e.p=2,e.n=3,fetch("".concat(this.voteBoxesUrlValue,"/").concat(t,"/elections"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":this.csrfToken()},credentials:"same-origin",body:JSON.stringify({election_ids:this.electionIds})});case 3:if((r=e.v).ok){e.n=5;break}return e.n=4,r.json().catch(function(){return{}});case 4:throw u=e.v,c=this.isMove?"Could not move to this vote box. It must be an active vote box.":"Could not add to this vote box. It must be an active vote box.",new Error((null===(a=u.errors)||void 0===a?void 0:a.join(", "))||c);case 5:if(this.close(),document.dispatchEvent(new CustomEvent("votes:dashboard:vote-boxes-changed")),this.gridApi){e.n=6;break}return window.location.reload(),e.a(2);case 6:(0,o.P)("".concat(this.countLabel(n)," ").concat(this.isMove?"moved":"added"," to the vote box."),"success"),this.gridApi.refreshServerSide({purge:!0}),e.n=8;break;case 7:e.p=7,s=e.v,this.showMessage(s.message,!0),this.submitButtonTarget.disabled=!1;case 8:return e.p=8,this.submitting=!1,e.f(8);case 9:return e.a(2)}},e,this,[[2,7,8,9]])})),function(){return u.apply(this,arguments)})},{key:"showMessage",value:function(e,t,n){if(this.messageTarget.textContent=e,this.messageTarget.classList.toggle("".concat(this.bem("message"),"--empty"),!t),this.messageTarget.hidden=!1,n){var r=document.createElement("a");r.className=this.bem("message-link"),r.href=n,r.textContent="New Vote Box",this.messageTarget.appendChild(document.createTextNode(" ")),this.messageTarget.appendChild(r)}}},{key:"hideMessage",value:function(){this.messageTarget.hidden=!0,this.messageTarget.textContent=""}},{key:"bem",value:function(e){return"votes--dashboard--add-to-vote-box-modal-component__".concat(e)}},{key:"csrfToken",value:function(){var e,t;return null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:""}}],r&&s(n.prototype,r),a&&s(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,u,l}(r.xI);y.targets=["overlay","subtitle","message","search","searchInput","list","pagination","prevButton","
2nextButton","pageLabel","submitButton"],y.values={voteBoxesUrl:String,currentVoteBoxId:Number,actionLabel:String,newVoteBoxUrl:String}},7143:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return N}});var r=n(6609),o=n(5260);function i(e){return function(e){if(Array.isArray(e))return _(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||w(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return l(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(l(t={},r,function(){return this}),t),p=f.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,r,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,t,n,r){function i(t,n){l(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},l(e,t,n,r)}function f(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){f(i,r,o,a,u,"next",e)}function u(e){f(i,r,o,a,u,"throw",e)}a(void 0)})}}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function v(e,t,n){return t=m(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,y()?Reflect.construct(t,n||[],m(e).constructor):t.apply(e,n))}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;
2!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||w(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){if(e){if("string"==typeof e)return _(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var O=["January","February","March","April","May","June","July","August","September","October","November","December"],T=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],k={Setup:"--cal-st-setup",Payment:"--cal-st-payment",Ready:"--cal-st-ready",Running:"--cal-st-running",Ended:"--cal-st-ended"},j=["Setup","Payment","Ready","Running","Ended"],S=["Setup","Payment","Ended"],P="--cal-st-setup",E={election:"ElectionVote",motion:"MeetingVote",announcement:"Announcement"},C="application--toolkit--ag-grid-ssrm-component--ag-grid-ssrm-component",x="ag-grid-view-toggle__btn--active",A=864e5,R="view",L="calendar",I=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},B=function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()},D=function(e){var t=g(e.split("-").map(Number),3),n=t[0],r=t[1],o=t[2];return new Date(n,r-1,o)},M=function(e){return"".concat(O[e.getMonth()].slice(0,3)," ").concat(e.getDate(),", ").concat(e.getFullYear())},F=function(e,t){return B(e,t)?M(e):e.getFullYear()===t.getFullYear()?"".concat((n=e,"".concat(O[n.getMonth()].slice(0,3)," ").concat(n.getDate()))," \u2013 ").concat(M(t)):"".concat(M(e)," \u2013 ").concat(M(t));var n},N=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=v(this,t,[].concat(r))).loadFailed=!1,e.cursor=new Date,e.today=new Date,e.calendarToggleButtons=[],e.gridToggleButtons=[],e.mobileToggleButtons=[],e.panelToggleButtons=[],e.boundToggleCalendar=function(){return e.toggleCalendar()},e.boundSelectBasic=function(){return e.selectGridView("basic")},e.boundSelectAdvanced=function(){return e.selectGridView("advanced")},e.boundSelectGridFromMobile=function(t){return e.selectGridViewFromMobile(t)},e.boundToggleVoteBoxesPanel=function(){return e.toggleVoteBoxesPanel()},e.gridApi=null,e.gridReadyHandler=function(t){var n,r;return e.attachGridApi(null!==(n=null===(r=t.detail)||void 0===r?void 0:r.gridApi)&&void 0!==n?n:null)},e.boundFilterChanged=function(){e.monthCache.clear(),"calendar"===e.activeView&&e.renderMonth()},e.voteBoxesPanelOn=!1,e.panelSuppressed=!1,e.panelSuppressionHandler=function(){return e.syncPanelSuppression()},e.popstateHandler=function(){"calendar"!==e.viewFromUrl()?"calendar"===e.activeView&&e.selectGridView(e.lastGridView):"calendar"!==e.activeView&&e.showCalendar()},e.activeView="basic",e.lastGridView="basic",e.loadedEvents=[],e.monthCache=new Map,e.loadingMonth=!1,e.hiddenStatuses=new Set(S),e.maxSlots=4,e.legendButtons=[],e.menuOpen=!1,e.menuQuery=null,e.headMode=null,e.headObserver=null,e.headWidth=-1,e.fitFrame=null,e.menuQueryHandler=function(){return e.scheduleHeadFit()},e.menuDismissHandler=function(t){e.menuWrapTarget.contains(t.target)||e.closeMenu()},e.menuKeydownHandler=function(t){"Escape"===t.key&&(e.closeMenu(),e.menuButtonTarget.focus())},e.monthPickerOpen=!1,e.pickerYear=(new Date).getFullYear(),e.monthPickerDismissHandler=function(t){var n=e.monthPickerTarget.parentElement;null!==n&&void 0!==n&&n.contains(t.target)||e.closeMonthPicker()},e.monthPickerKeydownHandler=function(t){"Escape"===t.key&&(e.closeMonthPicker(),e.monthTitleTarget.focus())},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e,t=this;this.today=new Date,this.cursor=new Date(this.today.getFullYear(),this.today.getMonth(),1);var n="calendar"===this.viewFromUrl();this.buildWeekdayHeader(),this.buildLegend(),this.slotSelectTarget.value=String(this.maxSlots),this.menuQuery=window.matchMedia("(max-width: 639px)"),this.menuQuery.addEventListener("change",this.menuQueryHandler),this.headObserver=new ResizeObserver(function(){return t.handleHeadResize()}),this.headObserver.observe(this.headTarget),this.syncHeadFit(),this.wireExter
2nalToggles(),this.adoptInitialGridView(),document.addEventListener("votes:dashboard:grid-ready",this.gridReadyHandler),document.dispatchEvent(new CustomEvent("votes:dashboard:request-grid-api")),this.syncSegmentState(),this.panelSuppressed=this.readPanelSuppressed(),this.applyPanelVisibility(),window.addEventListener("resize",this.panelSuppressionHandler),window.addEventListener("popstate",this.popstateHandler),n?this.showCalendar():(null===(e=this.gridWrapper())||void 0===e||e.classList.remove("root-ag-dashboard-grid--calendar-active"),this.panelTarget.hidden=!0,this.renderMonth())}},{key:"disconnect",value:function(){var e,t,n=this;this.calendarToggleButtons.forEach(function(e){return e.removeEventListener("click",n.boundToggleCalendar)});var r=g(this.gridToggleButtons,2),o=r[0],i=r[1];null===o||void 0===o||o.removeEventListener("click",this.boundSelectBasic),null===i||void 0===i||i.removeEventListener("click",this.boundSelectAdvanced),this.mobileToggleButtons.forEach(function(e){return e.removeEventListener("click",n.boundSelectGridFromMobile)}),this.panelToggleButtons.forEach(function(e){return e.removeEventListener("click",n.boundToggleVoteBoxesPanel)}),document.removeEventListener("votes:dashboard:grid-ready",this.gridReadyHandler),window.removeEventListener("resize",this.panelSuppressionHandler),window.removeEventListener("popstate",this.popstateHandler),null===(e=this.menuQuery)||void 0===e||e.removeEventListener("change",this.menuQueryHandler),null===(t=this.headObserver)||void 0===t||t.disconnect(),null!==this.fitFrame&&cancelAnimationFrame(this.fitFrame),this.closeMenu(),this.closeMonthPicker(),this.attachGridApi(null)}},{key:"attachGridApi",value:function(e){var t,n;this.gridApi!==e&&(null===(t=this.gridApi)||void 0===t||t.removeEventListener("filterChanged",this.boundFilterChanged),this.gridApi=e,null===(n=this.gridApi)||void 0===n||n.addEventListener("filterChanged",this.boundFilterChanged),e&&"calendar"===this.activeView&&this.syncGridChrome())}},{key:"wireExternalToggles",value:function(){var e=this;this.calendarToggleButtons=Array.from(document.querySelectorAll(".js-root-ag-calendar-toggle")),this.gridToggleButtons=Array.from(document.querySelectorAll(".ag-grid-view-toggle__btn")),this.mobileToggleButtons=Array.from(document.querySelectorAll(".ag-grid-view-toggle-mobile")),this.calendarToggleButtons.forEach(function(t){return t.addEventListener("click",e.boundToggleCalendar)});var t=g(this.gridToggleButtons,2),n=t[0],r=t[1];null===n||void 0===n||n.addEventListener("click",this.boundSelectBasic),null===r||void 0===r||r.addEventListener("click",this.boundSelectAdvanced),this.mobileToggleButtons.forEach(function(t){return t.addEventListener("click",e.boundSelectGridFromMobile)}),this.panelToggleButtons=Array.from(document.querySelectorAll(".js-root-ag-votebox-panel-toggle")),this.panelToggleButtons.forEach(function(t){return t.addEventListener("click",e.boundToggleVoteBoxesPanel)})}},{key:"adoptInitialGridView",value:function(){var e=g(this.gridToggleButtons,2)[1];null!==e&&void 0!==e&&e.classList.contains(x)&&(this.activeView="advanced",this.lastGridView="advanced")}},{key:"toggleCalendar",value:function(){"calendar"!==this.activeView?this.showCalendar():this.selectGridView(this.lastGridView)}},{key:"showCalendar",value:function(){var e;this.activeView="calendar",null===(e=this.gridWrapper())||void 0===e||e.classList.add("root-ag-dashboard-grid--calendar-active"),this.panelTarget.hidden=!1,this.renderMonth(),this.syncSegmentState(),this.applyPanelVisibility(),this.syncGridChrome(),this.syncViewParam()}},{key:"showGrid",value:function(){this.selectGridView(this.lastGridView)}},{key:"selectGridView",value:function(e){var t;this.activeView=e,this.lastGridView=e,null===(t=this.gridWrapper())||void 0===t||t.classList.remove("root-ag-dashboard-grid--calendar-active"),this.panelTarget.hidden=!0,this.closeDetail(),this.syncSegmentState(),this.applyPanelVisibility(),this.applyMasterDetailMode(e),this.syncGridChrome(),this.syncViewParam()}},{key:"applyMasterDetailMode",value:function(e){var t=this.ssrmGrid();t&&("basic"===e?t.switchToBasic():t.switchToAdvanced())}},{key:"syncGridChrome",value:function(){var e;null===(e=this.gridChrome())||void 0===e||e.setGridChromeHidden("calendar"===this.activeView)}},{key:"gridChrome",value:function(){for(var e=0,t=[C,"application--toolkit--ag-grid-component--ag-grid-component"];e<t.length;e++){var n,r=t[e],o=null===(n=this.gridWrapper())||void 0===n?void 0:n.querySelector('[data-controller~="'.concat(r,'"]'));if(o){var i=this.application.getControllerForElementAndIdentifier(o,r);if(i)return i}}return null}},{key:"ssrmGrid",value:function(){var e,t=null===(e=this.gridWrapper())||void 0===e?void 0:e.querySelector('[data-controller~="'.concat(C,'"]'));return t?this.application.getControllerForElementAndIdentifier(t,C):null}},{key:"applyPanelVisibility",value:function(){var e;("advanced"!==this.activeView||this.panelSuppressed)&&(this.voteBoxesPanelOn=!1);var t="advanced"===this.activeView&&this.voteBoxesPanelOn,n=this.voteBoxesPanelElement();n&&(n.hidden=!t),this.syncPanelToggleButtons(),null===(e=this.ssrmGrid())||void 0===e||e.setVoteBoxesHidden(t),this.resizeGrid()}},{key:"syncPanelSuppression",value:function(){var e=this.readPanelSuppressed();e!==this.panelSuppressed&&(this.panelSuppressed=e,this.applyPanelVisibility())}},{key:"readPanelSuppressed",value:function(){var e=this.dashboardLayoutElement();return!!e&&"1"===getComputedStyle(e).getPropertyValue("--vote-boxes-panel-suppressed").trim()}},{key:"dashboardLayoutElement",value:function(){return this.element.closest(".root-ag-dashboard-layout")}},{key:"voteBoxesPanelElement",value:function(){var e,t;return null!==(e=null===(t=this.dashboardLayoutElement())||void 0===t?void 0:t.querySelector(".votes--dashboard--vote-boxes-panel-component"))&&void 0!==e?e:null}},{key:"toggleVoteBoxesPanel",value:function(){"advanced"!==this.activeView||this.panelSuppressed||(this.voteBoxesPanelOn=!this.voteBoxesPanelOn,this.applyPanelVisibility())}},{key:"syncPanelToggleButtons",value:function(){var e=this,t="advanced"===this.activeView;this.panelToggleButtons.forEach(function(n){n.hidden=!t||e.panelSuppressed,n.setAttribute("aria-pressed",e.voteBoxesPanelOn?"true":"false")})}},{key:"resizeGrid",value:function(){var e;null===(e=this.ssrmGrid())||void 0===e||e.resizeGrid()}},{key:"selectGridViewFromMobile",value:function(e){var t,n="Advanced"===(null===(t=e.currentTarget.textContent)||void 0===t?void 0:t.trim())?"advanced":"basic";this.selectGridView(n)}},{key:"syncSegmentState",value:function(){var e=this;this.calendarToggleButtons.forEach(function(t){return t.setAttribute("aria-pressed","calendar"===e.activeView?"true":"false")}),this.gridToggleButtons.forEach(function(t,n){var r=0===n?"basic":"advanced";t.classList.toggle(x,e.activeView===r)})}},{key:"gridWrapper",value:function(){return this.element.closest(".root-ag-dashboard-grid")}},{key:"prevMonth",value:function(){this.cursor=new Date(this.cursor.getFullYear(),this.cursor.getMonth()-1,1),this.renderMonth()}},{key:"nextMonth",value:function(){this.cursor=new Date(this.cursor.getFullYear(),this.cursor.getMonth()+1,
21),this.renderMonth()}},{key:"goToToday",value:function(){this.cursor=new Date(this.today.getFullYear(),this.today.getMonth(),1),this.closeMenu(),this.closeMonthPicker(),this.renderMonth()}},{key:"toggleMonthPicker",value:function(){this.monthPickerOpen?this.closeMonthPicker():this.openMonthPicker()}},{key:"pickerPrevYear",value:function(){this.pickerYear-=1,this.paintMonthPicker()}},{key:"pickerNextYear",value:function(){this.pickerYear+=1,this.paintMonthPicker()}},{key:"openMonthPicker",value:function(){this.monthPickerOpen||(this.closeMenu(),this.monthPickerOpen=!0,this.pickerYear=this.cursor.getFullYear(),this.paintMonthPicker(),this.monthPickerTarget.hidden=!1,this.monthTitleTarget.setAttribute("aria-expanded","true"),document.addEventListener("pointerdown",this.monthPickerDismissHandler,!0),document.addEventListener("keydown",this.monthPickerKeydownHandler))}},{key:"closeMonthPicker",value:function(){this.monthPickerOpen&&(this.monthPickerOpen=!1,this.monthPickerTarget.hidden=!0,this.monthTitleTarget.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",this.monthPickerDismissHandler,!0),document.removeEventListener("keydown",this.monthPickerKeydownHandler))}},{key:"paintMonthPicker",value:function(){var e=this;this.pickerYearTarget.textContent=String(this.pickerYear),this.pickerGridTarget.innerHTML="",O.forEach(function(t,n){var r=document.createElement("button");r.type="button",r.className=e.b("month-picker-btn"),r.textContent=t.slice(0,3),r.title="".concat(t," ").concat(e.pickerYear),e.pickerYear===e.today.getFullYear()&&n===e.today.getMonth()&&r.classList.add(e.b("month-picker-btn--today")),e.pickerYear===e.cursor.getFullYear()&&n===e.cursor.getMonth()&&(r.classList.add(e.b("month-picker-btn--on")),r.setAttribute("aria-current","true")),r.addEventListener("click",function(){return e.pickMonth(n)}),e.pickerGridTarget.appendChild(r)})}},{key:"pickMonth",value:function(e){this.cursor=new Date(this.pickerYear,e,1),this.closeMonthPicker(),this.monthTitleTarget.focus(),this.renderMonth()}},{key:"toggleMenu",value:function(){this.menuOpen?this.closeMenu():this.openMenu()}},{key:"openMenu",value:function(){this.menuOpen||(this.menuOpen=!0,this.menuTarget.hidden=!1,this.menuButtonTarget.setAttribute("aria-expanded","true"),document.addEventListener("pointerdown",this.menuDismissHandler,!0),document.addEventListener("keydown",this.menuKeydownHandler))}},{key:"closeMenu",value:function(){var e;this.menuOpen&&(this.menuOpen=!1,this.hasMenuTarget&&(this.menuTarget.hidden=!0),null===(e=this.menuButtonTarget)||void 0===e||e.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",this.menuDismissHandler,!0),document.removeEventListener("keydown",this.menuKeydownHandler))}},{key:"handleHeadResize",value:function(){var e=this.headTarget.clientWidth;e!==this.headWidth&&(this.headWidth=e,this.scheduleHeadFit())}},{key:"scheduleHeadFit",value:function(){var e=this;null!==this.fitFrame&&cancelAnimationFrame(this.fitFrame),this.fitFrame=requestAnimationFrame(function(){e.fitFrame=null,e.syncHeadFit()})}},{key:"syncHeadFit",value:function(){var e;null!==(e=this.menuQuery)&&void 0!==e&&e.matches?this.applyHeadMode("mobile"):(this.applyHeadMode("wide"),this.headRowCount()<=1||(this.applyHeadMode("tight"),this.headRowCount()<=1||this.applyHeadMode("compact")))}},{key:"applyHeadMode",value:function(e){if(e!==this.headMode){this.headMode=e,this.closeMonthPicker();var t="compact"===e||"mobile"===e;if(t||this.closeMenu(),this.headTarget.classList.toggle(this.b("head--tight"),"tight"===e||"compact"===e),this.headTarget.classList.toggle(this.b("head--menu"),t),"mobile"===e?this.menuTodaySlotTarget.append(this.todayBtnTarget):this.headLeftTarget.append(this.todayBtnTarget),t)return this.menuSlotsSlotTarget.append(this.slotsTarget),void this.menuLegendSlotTarget.append(this.legendTarget);this.headTarget.insertBefore(this.slotsTarget,this.menuWrapTarget),this.headTarget.insertBefore(this.legendTarget,this.menuWrapTarget)}}},{key:"headRowCount",value:function(){var e=Array.from(this.headTarget.children).filter(function(e){return null!==e.offsetParent});return(0,o.c)(e)}},{key:"closeDetail",value:function(){this.detailTarget.removeAttribute("open")}},{key:"backdropClick",value:function(e){e.target===this.detailTarget&&this.closeDetail()}},{key:"openDayAgenda",value:function(e,t){var n=this;this.dayAgendaTitleTarget.textContent=M(e),this.dayAgendaListTarget.innerHTML="",t.forEach(function(e){n.dayAgendaListTarget.appendChild(n.buildAgendaRow(e))}),this.dayAgendaTarget.setAttribute("open","")}},{key:"closeDayAgenda",value:function(){this.dayAgendaTarget.removeAttribute("open")}}
2,{key:"dayAgendaBackdropClick",value:function(e){e.target===this.dayAgendaTarget&&this.closeDayAgenda()}},{key:"buildAgendaRow",value:function(e){var t,n=this,r=document.createElement("button");r.type="button",r.className=this.b("agenda-row"),r.style.setProperty("--cal-c","var(".concat(null!==(t=k[e.status])&&void 0!==t?t:P,")"));var o=document.createElement("span");o.className=this.b("agenda-dot");var i=document.createElement("span");i.className=this.b("agenda-name"),i.textContent=e.name;var a=document.createElement("span");a.className=this.b("agenda-arrow"),a.textContent="\u203a",r.append(o,i,this.buildIdTag(e));var u=this.buildOrgTag(e);u&&r.appendChild(u);var c=this.buildBoxIcon(e);return c&&r.appendChild(c),r.appendChild(a),r.addEventListener("click",function(){n.closeDayAgenda(),n.openDetail(e)}),r}},{key:"planExpiryDate",value:function(){return this.planExpiryValue?I(D(this.planExpiryValue)):null}},{key:"isPlanExpiry",value:function(e){var t=this.planExpiryDate();return null!==t&&B(e,t)}},{key:"loadEvents",value:(f=d(s().m(function e(t,n){var r,o,i=this;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.loadFailed=!1,this.dataUrlValue){e.n=1;break}return e.a(2,[]);case 1:return e.p=1,e.n=2,this.fetchGridDataRows(t,n);case 2:return r=e.v,e.a(2,r.filter(function(e){return!!e.start_on}).map(function(e){return i.mapRowToEvent(e)}));case 3:return e.p=3,o=e.v,this.loadFailed=!0,console.error("[CalendarComponent] loadEvents fetch failed:",o),e.a(2,[])}},e,this,[[1,3]])})),function(e,t){return f.apply(this,arguments)})},{key:"fetchGridDataRows",value:(l=d(s().m(function e(t,n){var r,o,i,a,c;return s().w(function(e){for(;;)switch(e.n){case 0:return i=null!==(r=null===(o=document.querySelector('meta[name="csrf-token"]'))||void 0===o?void 0:o.content)&&void 0!==r?r:"",e.n=1,fetch(this.dataUrlValue,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":i},credentials:"same-origin",body:JSON.stringify(u(u({startRow:0,endRow:300},this.showVoteBoxValue?{excludeVoteBoxes:!0,includeBoxedElections:!0}:{}),{},{sortModel:[{colId:"period",sort:"asc"}],filterModel:this.calendarFilterModel(t,n)}))});case 1:if((a=e.v).ok){e.n=2;break}throw new Error("calendar grid_data fetch failed: ".concat(a.status));case 2:return e.n=3,a.json();case 3:return c=e.v,e.a(2,Array.isArray(c.rows)?c.rows:[])}},e,this)})),function(e,t){return l.apply(this,arguments)})},{key:"calendarFilterModel",value:function(e,t){var n,r,o=u({},null!==(n=null===(r=this.gridApi)||void 0===r?void 0:r.getFilterModel())&&void 0!==n?n:{});delete o.period,delete o.start_date,delete o.end_date;var i=o.status;return o.status=u(u({},i&&"object"===typeof i?i:{}),{},{filterType:"statusTest",test:"Not test"}),u(u({},o),{},{start_date:{filterType:"date",type:"lessThanOrEqual",dateFrom:t},end_date:{filterType:"date",type:"greaterThanOrEqual",dateFrom:e,includeNull:!0}})}},{key:"mapRowToEvent",value:function(e){var t,n,r,o,i;return{id:Number(e.id),name:e.name,type_of:e.type_of,status:null!==(t=e.status_label)&&void 0!==t?t:"",start_date:e.start_on,end_date:null!==(n=e.end_on)&&void 0!==n?n:e.start_on,turnout:this.extractTurnout(e.schedule_summary_html),vote_box_title:this.showVoteBoxValue&&null!==(r=e.vote_box_title)&&void 0!==r?r:null,vote_box_url:this.linkVoteBoxValue&&null!==(o=e.vote_box_url)&&void 0!==o?o:null,organization_name:this.showOrganizationValue&&null!==(i=e.organization_name)&&void 0!==i?i:null}}},{key:"extractTurnout",value:function(e){var t;if(!e)return"\u2014";var n=document.createElement("div");return n.innerHTML=e,n.querySelectorAll("div, p, li, br").forEach(function(e){var t;null===(t=e.parentNode)||void 0===t||t.insertBefore(document.createTextNode(" "),e)}),(null!==(t=n.textContent)&&void 0!==t?t:"").replace(/\s+/g," ").trim()||"\u2014"}},{key:"renderMonth",value:(c=d(s().m(function e(){var t,n,r,o;return s().w(function(e){for(;;)switch(e.n){case 0:if(t=this.monthKey(this.cursor),!(n=this.monthCache.get(t))){e.n=1;break}return this.loadedEvents=n,this.loadingMonth=!1,this.paintMonth(),e.a(2);case 1:return this.loadedEvents=[],this.loadingMonth=!0,this.paintMonth(),r=this.weeksFor(this.cursor.getFullYear(),this.cursor.getMonth()),e.n=2,this.loadEvents(this.toISO(r[0][0]),this.toISO(r[r.length-1][6]));case 2:if(o=e.v,this.monthKey(this.cursor)===t){e.n=3;break}return e.a(2);case 3:this.loadFailed||this.monthCache.set(t,o),this.loadedEvents=o,this.loadingMonth=!1,this.paintMonth();case 4:return e.a(2)}},e,this)})),function(){return c.apply(this,arguments)})},{key:"monthKey",value:function(e){return"".concat(e.getFullYear(),"-").concat(e.getMonth())}},{key:"paintMonth",value:function(){var e=this,t=this.cursor.getFullYear(),n=this.cursor.getMonth(),r=this.weeksFor(t,n),o=this.visibleEvents(),i=new Date(t,n,1),a=new Date(t,n+1,0);this.monthTitleTarget.innerHTML='<span class="'.concat(this.b("month-title-text"),'">').concat(O[n]," ")+'<span class="'.concat(this.b("year"),'">').concat(t,"</span></span>"),this.scheduleHeadFit();var u=this.assignLanes(o,r[0][0],r[r.length-1][6]);this.gridTarget.innerHTML="",r.forEach(function(t){e.gridTarget.appendChild(e.buildWeekRow(t,n,o,u))}),this.renderFooter(o,i,a)}},{key:"buildIdTag",value:function(e){var t=document.createElement("span");return t.className=this.b("evt-id"),t.textContent=String(e.id),t}},{key:"buildOrgTag",value:function(e){if(!e.organization_name)return null;var t=document.createElement("span");return t.className=this.b("evt-org"),t.textContent=e.organization_name,t.title=e.organization_name,t}},{key:"buildMoreWord",value:function(){var e=document.createElement("span");return e.className=this.b("more-word"),e.textContent="more",e}},{key:"visibleEvents",value:function(){var e=this;return 0===this.hiddenStatuses.size?this.loadedEvents:this.loadedEvents.filter(function(t){return!e.hiddenStatuses.has(t.status)})}},{key:"toISO",value:function(e){var t=function(e){return String(e).padStart(2,"0")};return"".concat(e.getFullYear(),"-").concat(t(e.getMonth()+1),"-").concat(t(e.getDate()))}},{key:"weeksFor",value:function(e,t){for(var n=new Date(e,t,1),r
2=[],o=new Date(e,t,1-n.getDay()),i=0;i<6;i+=1){for(var a=[],u=0;u<7;u+=1)a.push(new Date(o)),o=new Date(o.getTime()+A);r.push(a)}return r}},{key:"assignLanes",value:function(e,t,n){var r=I(t).getTime(),o=I(n).getTime(),a=function(e){var t=Math.max(I(D(e.start_date)).getTime(),r);return Math.min(I(D(e.end_date)).getTime(),o)-t},u=i(e).sort(function(e,t){return a(e)-a(t)||D(e.start_date).getTime()-D(t.start_date).getTime()||D(e.end_date).getTime()-D(t.end_date).getTime()||e.name.localeCompare(t.name)}),c=[],s=new Map;return u.forEach(function(e){var t=I(D(e.start_date)).getTime(),n=I(D(e.end_date)).getTime(),r=c.findIndex(function(e){return t>e});-1===r?(r=c.length,c.push(n)):c[r]=n,s.set(e.id,r)}),s}},{key:"layoutWeek",value:function(e,t,n){var r=I(e[0]),o=I(e[6]),i=[];return t.forEach(function(e){var t,a=I(D(e.start_date)),u=I(D(e.end_date));if(!(u<r||a>o)){var c=a<r?r:a,s=u>o?o:u;i.push({event:e,col:Math.round((c.getTime()-r.getTime())/A)+1,colEnd:Math.round((s.getTime()-r.getTime())/A)+2,lane:null!==(t=n.get(e.id))&&void 0!==t?t:0,row:0,contL:a<r,contR:u>o})}}),i.sort(function(e,t){return e.lane-t.lane||e.col-t.col})}},{key:"buildWeekRow",value:function(e,t,n,r){var o=this,i=this.layoutWeek(e,n,r),a=[],u=[],c=new Map;i.forEach(function(e){var t=c.get(e.lane);if(void 0===t){if(c.size>=o.maxSlots)return void u.push(e);t=c.size,c.set(e.lane,t)}e.row=t,a.push(e)});var s=c.size,l=s+(u.length?1:0),f=document.createElement("div");if(f.className=this.b("week"),f.style.gridTemplateRows="auto repeat(".concat(Math.max(l,1),", 2.6rem)"),e.forEach(function(e){var n=document.createElement("div"),r=e.getMonth()===t,i=[o.b("day")];if(r||i.push(o.b("day--dim")),B(e,o.today)&&i.push(o.b("day--today")),n.className=i.join(" "),n.innerHTML='<div class="'.concat(o.b("daynum"),'">').concat(e.getDate(),"</div>"),r&&o.isPlanExpiry(e)){var a=document.createElement("span");a.className=o.b("plan-flag"),a.textContent="Plan ends",a.title="Plan ends ".concat(M(e)),n.appendChild(a)}f.appendChild(n)}),a.forEach(function(e){f.appendChild(o.buildEventBar(e))}),u.length){var d=new Map,p=new Map;u.forEach(function(e){for(var t=!e.contR,n=e.col;n<e.colEnd;n+=1){var r,o;d.set(n,(null!==(r=d.get(n))&&void 0!==r?r:0)+1),t&&n===e.colEnd-1&&p.set(n,(null!==(o=p.get(n))&&void 0!==o?o:0)+1)}}),d.forEach(function(t,r){var i;f.appendChild(o.buildMorePill(r,s+2,t,null!==(i=p.get(r))&&void 0!==i?i:0,e[r-1],n))})}return f}},{key:"buildMorePill",value:function(e,t,n,r,o,i){var a=this,u=this.eventsOnDay(o,i),c=document.createElement("button");return c.type="button",c.className=this.b("more"),c.style.gridColumn="".concat(e," / ").concat(e+1),c.style.gridRow="".concat(t),c.replaceChildren("+".concat(n),this.buildMoreWord()),c.setAttribute("aria-label","+".concat(n," more")),r>0&&c.classList.add(this.b("more--ending")),c.title=r>0?"".concat(u.length," elections on ").concat(M(o)," \u2014 ").concat(r," ending"):"".concat(u.length," elections on ").concat(M(o)),c.addEventListener("click",function(){return a.openDayAgenda(o,u)}),c}},{key:"eventsOnDay",value:function(e,t){var n=I(e);return t.filter(function(e){var t=I(D(e.start_date)),r=I(D(e.end_date));return t<=n&&n<=r}).sort(function(e,t){return D(e.start_date).getTime()-D(t.start_date).getTime()||j.indexOf(e.status)-j.indexOf(t.status)||e.name.localeCompare(t.name)})}},{key:"buildEventBar",value:function(e){var t,n=this,r=e.event,o=document.createElement("button");o.type="button";var i=[this.b("evt")];e.contL&&i.push(this.b("evt--cont-l")),e.contR&&i.push(this.b("evt--cont-r")),o.className=i.join(" "),o.style.setProperty("--cal-c","var(".concat(null!==(t=k[r.status])&&void 0!==t?t:P,")")),o.style.gridColumn="".concat(e.col," / ").concat(e.colEnd),o.style.gridRow="".concat(e.row+2);var a=F(D(r.start_date),D(r.end_date));o.title=["".concat(r.name," (").concat(r.id,")"),r.organization_name,a,r.vote_box_title?"Vote Box: ".concat(r.vote_box_title):null].filter(function(e){return!!e}).join(" \u2014 ");var u=document.createElement("span");u.className=this.b("evt-tag");var c=document.createElement("span");c.className=this.b("evt-name"),c.textContent=r.name,o.append(u,c),o.appendChild(this.buildIdTag(r));var s=this.buildOrgTag(r);s&&o.appendChild(s);var l=this.buildBoxIcon(r);if(l&&o.appendChild(l),e.contR){var f=document.createElement("span");f.className=this.b("evt-arrow"),f.textContent="\u203a",o.appendChild(f)}return o.addEventListener("click",function(){return n.openDetail(r)}),o}},{key:"renderFooter",value:function(e,t,n){var r=e.filter(function(e){var r=D(e.start_date);return!(D(e.end_date)<t||r>n)}).length;if(this.loadFailed)return this.scheduledCountTarget.textContent="",void(this.unscheduledNoteTarget.textContent="Could not load your elections. Refresh to try again.");var o=this.planExpiryDate(),i=o?"Plan ends ".concat(M(o)," \xb7 "):"";if(this.scheduledCountTarget.textContent=this.loadingMonth?"".concat(i,"Loading\u2026"):"".concat(i).c
2oncat(r," scheduled this month"),this.unscheduledCountValue<=0)this.unscheduledNoteTarget.textContent="";else{var a=1===this.unscheduledCountValue?"":"s";this.unscheduledNoteTarget.innerHTML="<b>".concat(this.unscheduledCountValue,"</b> unscheduled election").concat(a," ")+'have no dates \u2014 <a class="'+this.b("link")+'" href="#">see them in the grid</a>.'}}},{key:"viewFromUrl",value:function(){return new URLSearchParams(window.location.search).get(R)===L?"calendar":"grid"}},{key:"syncViewParam",value:function(){var e="calendar"===this.activeView?"calendar":"grid";if(this.viewFromUrl()!==e){var t=new URL(window.location.href);"calendar"===e?t.searchParams.set(R,L):t.searchParams.delete(R),window.history.pushState({},"",t)}}},{key:"buildWeekdayHeader",value:function(){this.weekdaysTarget.innerHTML=T.map(function(e){return"<div>".concat(e,"</div>")}).join("")}},{key:"buildLegend",value:function(){var e,t=this;(e=this.legendTarget).replaceChildren.apply(e,i(j.map(function(e){return t.buildLegendButton(e)}))),this.legendButtons=Array.from(this.legendTarget.querySelectorAll(".".concat(this.b("legend-btn")))),this.syncLegend()}},{key:"buildLegendButton",value:function(e){var t=this,n=document.createElement("button");n.type="button",n.className=this.b("legend-btn"),n.dataset.status=e,n.style.setProperty("--cal-dot","var(".concat(k[e],")"));var r=document.createElement("i");return r.className=this.b("dot"),n.append(r,document.createTextNode(e)),n.addEventListener("click",function(){return t.toggleStatus(e)}),n}},{key:"changeSlots",value:function(e){var t=Number.parseInt(e.target.value,10);!Number.isInteger(t)||t<1||(this.maxSlots=t,this.closeMenu(),this.paintMonth())}},{key:"toggleStatus",value:function(e){this.hiddenStatuses.has(e)?this.hiddenStatuses.delete(e):this.hiddenStatuses.add(e),this.syncLegend(),this.paintMonth()}},{key:"syncLegend",value:function(){var e=this;this.legendButtons.forEach(function(t){var n,r=e.hiddenStatuses.has(null!==(n=t.dataset.status)&&void 0!==n?n:"");t.classList.toggle(e.b("legend-btn--off"),r),t.setAttribute("aria-pressed",r?"false":"true"),t.title=r?"Show ".concat(t.dataset.status," votes"):"Hide ".concat(t.dataset.status," votes")})}},{key:"openDetail",value:function(e){var t;this.renderDetailName(e),this.renderDetailType(e),this.detailStatusTarget.textContent=e.status,this.detailStatusTarget.style.background="var(".concat(null!==(t=k[e.status])&&void 0!==t?t:P,")"),this.detailDatesTarget.textContent=F(D(e.start_date),D(e.end_date)),this.detailTurnoutTarget.textContent=e.turnout,this.detailOpenLinkTarget.href="/elections/".concat(e.id,"/edit"),this.detailTarget.setAttribute("open","")}},{key:"renderDetailName",value:function(e){var t,n=document.createTextNode(e.name),r=this.buildBoxChip(e);(t=this.detailNameTarget).replaceChildren.apply(t,i(r?[n,r]:[n]))}},{key:"buildBoxIcon",value:function(e){if(!e.vote_box_title)return null;var t=document.createElement("i");return t.className="fas fa-archive ".concat(this.b("box-icon")),t.setAttribute("aria-hidden","true"),t}},{key:"buildBoxChip",value:function(e){if(!e.vote_box_title)return null;var t=document.createElement(e.vote_box_url?"a":"span");t.className=this.b("box-chip"),e.vote_box_url&&(t.href=e.vote_box_url);var n=document.createElement("i");n.className="fas fa-archive",n.setAttribute("aria-hidden","true");var r=document.createElement("span");return r.className=this.b("box-chip-title"),r.textContent=e.vote_box_title,t.append(n,r),t.title=e.vote_box_url?"Open Vote Box: ".concat(e.vote_box_title):"Vote Box: ".concat(e.vote_box_title),t}},{key:"renderDetailType",value:function(e){var t,n,r=document.createElement("span");r.className=this.b("card-type-label"),r.textContent=null!==(t=E[e.type_of])&&void 0!==t?t:e.type_of;var o=document.createElement("span");o.className=this.b("card-id"),o.textContent=String(e.id);var i=[r,document.createTextNode(" "),o];if(e.organization_name){var a=document.createElement("span");a.className=this.b("card-org"),a.textContent=e.organization_name,i.push(document.createTextNode(" "),a)}(n=this.detailTypeTarget).replaceChildren.apply(n,i)}},{key:"b",value:function(e){return"".concat("votes--dashboard--calendar-component","__").concat(e)}}],r&&p(n.prototype,r),a&&p(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,c,l,f}(r.BaseController);N.targets=["panel","head","headLeft","monthTitle","monthPicker","pickerYear","pickerGrid","todayBtn","slots","menuWrap","menuButton","menu","menuTodaySlot","menuSlotsSlot","menuLegendSlot","weekdays","grid","legend","slotSelect","scheduledCount","unscheduledNote","detail","detailName","detailType","detailStatus","detailDates","detailTurnout","detailOpenLink","dayAgenda","dayAgendaTitle","dayAgendaList"],N.values={unscheduledCount:Number,planExpiry:String,dataUrl:String,showVoteBox:Boolean,linkVoteBox:Boolean,showOrganization:Boolean}},9947:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}
2function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=36e5,f=864e5,d="votes--dashboard--next-event-component",p="".concat(d,"__countdown--danger"),h="".concat(d,"--danger"),v=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).intervalId=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this;this.tick(),this.intervalId=window.setInterval(function(){return e.tick()},3e4)}},{key:"disconnect",value:function(){null!==this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.closeDialog()}},{key:"openDialog",value:function(){this.tick(),this.dialogTarget.setAttribute("open","open"),this.chipTarget.setAttribute("aria-pressed","true")}},{key:"closeDialog",value:function(){this.dialogTarget.removeAttribute("open"),this.chipTarget.setAttribute("aria-pressed","false")}},{key:"backdropClick",value:function(e){e.target===this.dialogTarget&&this.closeDialog()}},{key:"tick",value:function(){var e=this,t=this.itemTargets.filter(function(t){return e.render(t)});this.renderChip(t.length),this.setHidden(this.listTarget,0===t.length),this.setHidden(this.emptyTarget,t.length>0),this.hasOverflowTarget&&this.setHidden(this.overflowTarget,0===t.length),0===t.length&&null!==this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null)}},{key:"renderChip",value:function(e){var t=this.chipTarget.querySelector(".toolkit-button-component__toolbar-chip-label");t&&(t.textContent="Upcoming (".concat(e,")"));var n=this.countdownTargets.some(function(e){return e.classList.contains(p)});this.element.classList.toggle(h,n)}},{key:"render",value:function(e){var t,n=Date.parse(null!==(t=e.getAttribute("data-".concat(this.identifier,"-at-param")))&&void 0!==t?t:"");if(Number.isNaN(n))return this.setHidden(e,!0),!1;var r=n-Date.now();if(r<=0||r>6048e5)return this.setHidden(e,!0),!1;var o=e.querySelector("[data-".concat(this.identifier,'-target="countdown"]'));return o&&(o.textContent="".concat(this.verb(e)," in ").concat(this.formatDuration(r)),o.classList.toggle(p,r<l)),!0}},{key:"setHidden",value:function(e,t){t?e.setAttribute("hidden","hidden"):e.removeAttribute("hidden")}},{key:"verb",value:function(e){return"ends"===e.getAttribute("data-".concat(this.identifier,"-kind-param"))?"ends":"starts"}},{key:"formatDuration",value:function(e){if(e>=f){var t=Math.floor(e/f),n=Math.floor(e%f/l);return n>0?"".concat(t,"d ").concat(n,"h"):"".concat(t,"d")}var r=Math.max(1,Math.floor(e/6e4)),o=Math.floor(r/60),i=r%60;return o<=0?"".concat(i,"m"):"".concat(o,"h ").concat(i,"m")}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);v.targets=["item","countdown","overflow","chip","dialog","list","empty"]},6467:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"answerInputChange",value:function(e){var t=document.querySelector(".warning-message"),n=this.answerText(),r=this.questionText(),o=document.querySelector("#remove-choice-button");t&&(0===n.length?(t.innerHTML="",o.disabled=!0):(t.innerHTML="\n          <span>\n            <strong>".concat(n,"</strong> will be <strong>removed</strong> as a choice from <strong>").concat(r,"</strong>.\n            <br> This removal is final and cannot be undone.\n          </span>"),o.disabled=!1))}},{key:"questionText",value:function(){return this.answerSelectTarget.dataset.questionText||""}},{key:"answerText",value:function(){var e=this.answerSelectTarget.selectedIndex;return 0===e?"":this.answerSelectTarget.options[e].textContent||""}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["answerSelect"]},1713:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(9403);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"searchAnswers",value:function(e){var t=window.location.href,n=this.questionSelectTarget.value,r=this.questionSelectTarget.dataset.voteId,i="/votes/".concat(r,"/choice/search_answers?question_id=").concat(n);o.V.visit(i),history.pushState(null,null,t)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["questionSelect"]},2321:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=document.querySelector(".turbo-modal-component__close-modal");console.log("fechei"),e&&e.addEventListener("click",function(){window.location.reload()})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},8733:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return p},default:function(){return h}});var r=n(6609),o=n(6846),i=n(2797),a=n(2531);function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=(0,o.mapValues)({CHECK_ALL:"check_all",UNCHECK_ALL:"uncheck_all",GET_MULTI_ACTIONS:"get_multi_actions",CHECKBOX_TOOGLE:"checkbox_toogle"},function(e){return"".concat("votes--result-list-component",":").concat(e)}),h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.addListeners()}},{key:"voteItemCheckAll",value:function(e){e.target.checked?this.handleCheck():this.handleUncheck()}},{key:"handleCheck",value:function(){this.emitCheckAll(),this.emitGetMultiActions()}},{key:"handleUncheck",value:function(){this.emitUncheckAll()}},{key:"handleExternalCheck",value:function(){this.allElectionsSelected()&&this.updateCheckboxValue(!0)}},{key:"handleExternalUncheck",value:function(){this.allElectionsSelected()||this.updateCheckboxValue(!1),this.anyElectionSelected()&&this.emitGetMultiActions()}},{key:"allElectionsSelected",value:function(){return(0,i.findVoteItemElements)().every(function(e){return e.checked})}},{key:"anyElectionSelected",value:function(){return(0,i.findVoteItemElements)().some(function(e){return e.checked})}},{key:"updateCheckboxValue",value:function(e){this.checkboxInputTarget.checked=e,this.emitCheckboxToogle(e)}},{key:"updateCheckboxDisabledStatus",value:function(e){this.checkboxInputTarget.disabled=e}},{key:"addListeners",value:function(){var e=this;document.addEventListener(i.EVENTS.CHECK,function(){e.handleExternalCheck()}),document.addEventListener(i.EVENTS.UNCHECK,function(){e.handleExternalUncheck()}),document.addEventListener(i.EVENTS.DISABLED_STATUS,function(t){e.updateCheckboxDisabledStatus(t.detail.value)}),document.addEventListener(a.EVENTS.CHECK_ALL,function(){e.handleCheck()}),document.addEventListener(a.EVENTS.UNCHECK_ALL,function(){e.handleUncheck()})}},{key:"emitCheckAll",value:function(){this.dispatch(p.CHECK_ALL,{prefix:null})}},{key:"emitUncheckAll",value:function(){this.dispatch(p.UNCHECK_ALL,{prefix:null})}},{key:"emitGetMultiActions",value:function(){this.dispatch(p.GET_MULTI_ACTIONS,{prefix:null})}},{key:"emitCheckboxToogle",value:function(e){this.dispatch(p.CHECKBOX_TOOGLE,{prefix:null,detail:{value:e}})}}])&&u(n.prototype,r),o&&u(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.BaseController);h.targets=["checkboxInput"]},2531:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return h},default:function(){return v}});var r=n(6609),o=n(6846),i=n(6923),a=n(8733),u=n(2797);function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}
2function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var h=(0,o.mapValues)({CHECK_ALL:"check_all",UNCHECK_ALL:"uncheck_all"},function(e){return"".concat("votes--dashboard--select-filters-component",":").concat(e)}),v=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.initializeCustomSelect(),this.addListeners()}},{key:"enableSubmit",value:function(e){e.target.value.length>0&&(this.buttonTarget.disabled=!1)}},{key:"submit",value:function(){this.buttonTarget.disabled=!1,this.buttonTarget.click()}},{key:"initializeCustomSelect",value:function(){var e=this;if(this.isCustomSelectRendered()){var t=(0,i.T)();t&&t(this.organizationsSelectTarget).select2().on("change",function(t){return e.filterOrganization(t)})}}},{key:"filterOrganization",value:function(e){var t=e.target.value,n=t.match(/organization_(\d+)/),r=t.match(/user_(\d+)/);this.organizationsInputTarget.value=this.extractItem(n),this.usersInputTarget.value=this.extractItem(r),this.submit()}},{key:"isCustomSelectRendered",value:function(){var e=(0,i.T)();return!!e&&0!==e("#organizations_select").length}},{key:"extractItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e?e.at(t):""}},{key:"voteItemCheckAll",value:function(e){e.target.checked?this.emitCheckAll():this.emitUncheckAll()}},{key:"updateCheckboxDisabledStatus",value:function(e){this.checkboxInputTarget.disabled=e}},{key:"handleExternalToogle",value:function(e){var t=e.detail.value;this.checkboxInputTarget.checked=t}},{key:"emitCheckAll",value:function(){this.dispatch(h.CHECK_ALL,{prefix:null})}},{key:"emitUncheckAll",value:function(){this.dispatch(h.UNCHECK_ALL,{prefix:null})}},{key:"addListeners",value:function(){var e=this;document.addEventListener(a.EVENTS.CHECKBOX_TOOGLE,function(t){e.handleExternalToogle(t)}),document.addEventListener(u.EVENTS.DISABLED_STATUS,function(t){e.updateCheckboxDisabledStatus(t.detail.value)})}}],r&&c(n.prototype,r),o&&c(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.BaseController);v.targets=["button","checkboxInput","organizationsInput","usersInput","organizationsSelect"]},3637:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return b}});var r=n(5396),o=n(8051);function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return c(l,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,c(p,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(p),c(p,o,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:h}})()}function c(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,n,r){function i(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},c(e,t,n,r)}function s(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){s(i,r,o,a,u,"next",e)}function u(e){s(i,r,o,a,u,"throw",e)}a(void 0)})}}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function d(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function p(e,t,n){return t=v(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,h()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}var m="votes--dashboard--vote-boxes-panel-component",b=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=p(this,t,[].concat(r))).boxRows=new Map,e.rowElements=new Map,e.dropZoneParams=new Map,e.registeredBoxIds=new Set,e.gridApi=null,e.gridReadyHandler=null,e.voteBoxesChangedHandler=null,e.listPage=1,e.listHasNext=!1,e.lastListRowCount=0,e.createConfig=null,e.creating=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.readOnlyValue||(this.gridReadyHandler=function(t){var n,r=t.detail;e.gridApi=null!==(n=null===r||void 0===r?void 0:r.gridApi)&&void 0!==n?n:null,e.registerPendingDropZones()},document.addEventListener("votes:dashboard:grid-ready",this.gridReadyHandler),document.dispatchEvent(new CustomEvent("votes:dashboard:request-grid-api"))),this.voteBoxesChangedHandler=function(){e.loadListPage(e.listPage)},document.addEventListener("votes:dashboard:vote-boxes-changed",this.voteBoxesChangedH
2andler),this.loadListPage(1)}},{key:"disconnect",value:function(){this.gridReadyHandler&&(document.removeEventListener("votes:dashboard:grid-ready",this.gridReadyHandler),this.gridReadyHandler=null),this.voteBoxesChangedHandler&&(document.removeEventListener("votes:dashboard:vote-boxes-changed",this.voteBoxesChangedHandler),this.voteBoxesChangedHandler=null),this.teardownDropZones()}},{key:"loadListPage",value:(s=l(u().m(function e(t){var n,r,o,i;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("".concat(this.voteBoxesUrlValue,"?page=").concat(t),{headers:{Accept:"application/json"},credentials:"same-origin"});case 1:if((o=e.v).ok){e.n=2;break}return e.a(2);case 2:return e.n=3,o.json();case 3:i=e.v,this.listPage=null!==(n=i.page)&&void 0!==n?n:t,this.listHasNext=Boolean(i.has_next),void 0!==i.create&&(this.createConfig=i.create),this.renderListPage(null!==(r=i.vote_boxes)&&void 0!==r?r:[]),this.renderCreateAffordances(),e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},e,this,[[0,4]])})),function(e){return s.apply(this,arguments)})},{key:"prevPage",value:function(){this.listPage<=1||this.loadListPage(this.listPage-1)}},{key:"nextPage",value:function(){this.listHasNext&&this.loadListPage(this.listPage+1)}},{key:"renderListPage",value:function(e){var t=this;this.lastListRowCount=e.length,this.teardownDropZones(),this.rowElements.clear(),this.boxRows.clear(),this.listTarget.innerHTML="",e.forEach(function(e){t.boxRows.set(e.id,{id:e.id,title:e.title,elections_count:e.elections_count,organization:e.organization,expanded:!1,loadState:"idle",elections:[]});var n=t.buildRow(e.id);t.rowElements.set(e.id,n),t.listTarget.appendChild(n),t.registerDropZone(e.id)}),this.updateListFooter(),this.updateEmptyState()}},{key:"buildRow",value:function(e){var t=this,n=this.boxRows.get(e);if(!n)throw new Error("Unknown vote box id: ".concat(e));var r=document.createElement("div");r.className="".concat(m,"__row"),r.dataset.boxId=String(e);var o=document.createElement("div");o.className="".concat(m,"__row-main");var i=document.createElement("button");i.type="button",i.className="".concat(m,"__row-toggle"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Toggle elections"),i.addEventListener("click",function(){return t.toggleExpand(e)}),o.appendChild(i);var a=document.createElement("div");if(a.className="".concat(m,"__row-content"),this.linkOutValue){var u=document.createElement("a");u.className="".concat(m,"__row-title-link"),u.href=this.dashboardUrlValue.replace("{id}",String(e)),u.textContent=n.title,a.appendChild(u)}else{var c=document.createElement("span");c.className="".concat(m,"__row-title"),c.textContent=n.title,a.appendChild(c)}var s=document.createElement("span");s.className="".concat(m,"__row-meta"),s.textContent="".concat(this.countLabel(n.elections_count)," \xb7 ").concat(n.organization.name),a.appendChild(s),o.appendChild(a),r.appendChild(o);var l=document.createElement("div");return l.className="".concat(m,"__row-detail"),l.hidden=!0,r.appendChild(l),r}},{key:"updateListFooter",value:function(){this.listPrevButtonTarget.disabled=this.listPage<=1,this.listNextButtonTarget.disabled=!this.listHasNext,this.listPageLabelTarget.textContent="Page ".concat(this.listPage)}},{key:"toggleExpand",value:function(e){var t=this.boxRows.get(e);t&&(t.expanded=!t.expanded,this.updateRowElement(e),t.expanded&&"idle"===t.loadState&&this.loadBoxElections(e))}},{key:"loadBoxElections",value:(c=l(u().m(function e(t){var n,r,o,i,a,c;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=this.boxRows.get(t)){e.n=1;break}return e.a(2);case 1:return n.loadState="loading",this.updateRowElement(t),r=this.detailUrlValue.replace("{vote_box_id}",String(t)),e.p=2,e.n=3,fetch(r,{headers:{Accept:"application/json"},credentials:"same-origin"});case 3:if(!(i=e.v).ok){e.n=5;break}return e.n=4,i.json();case 4:c=e.v,e.n=6;break;case 5:c={rows:[]};case 6:a=c,n.elections=(null!==(o=a.rows)&&void 0!==o?o:[]).map(function(e){return{id:e.id,name:e.name}}),n.loadState="loaded",e.n=8;break;case 7:e.p=7,e.v,n.loadState="error",n.elections=[];case 8:this.updateRowElement(t);case 9:return e.a(2)}},e,this,[[2,7]])})),function(e){return c.apply(this,arguments)})},{key:"updateRowElement",value:function(e){var t=this.boxRows.get(e),n=this.rowElements.get(e);if(t&&n){var r=n.querySelector(".".concat(m,"__row-toggle"));null===r||void 0===r||r.setAttribute("aria-expanded",String(t.expanded));var o=n.querySelector(".".concat(m,"__row-meta"));o&&(o.textContent="".concat(this.countLabel(t.elections_count)," \xb7 ").concat(t.organization.name));var i=n.querySelector(".".concat(m,"__row-detail"));i&&(i.hidden=!t.expanded,this.renderRowDetail(i,t))}}},{key:"renderRowDetail",value:function(e,t){var n=this;if(e.innerHTML="",t.expanded){if("loading"===t.loadState){var r=document.createElement("p");return r.className="".concat(m,"__election-loading"),r.textContent="Loading elections\u2026",void e.appendChild(r)}if(0===t.elections.length){var o=document.createElement("p");return o.className="".concat(m,"__election-empty"),o.textContent="No elections in this box.",void e.appendChild(o)}t.elections.forEach(function(r){var o=document.createElement("div");o.className="".concat(m,"__election-row");var i=document.createElement("span");if(i.className="".concat(m,"__election-name"),i.textContent=r.name,o.appendChild(i),!n.readOnlyValue){var a=document.createElement("button");a.type="button",a.className="".concat(m,"__detach-button"),a.textContent="Remove",a.addEventListener("click",function(){return n.detach(t.id,r.id)}),o.appendChild(a)}e.appendChild(o)})}}},{key:"countLabel",value:function(e){return"".concat(e," election").concat(1===e?"":"s")}},{key:"updateEmptyState",value:function(){var e,t=1===this.listPage&&0===this.lastListRowCount;this.emptyTarget.hidden=!t,this.hasEmptyCtaTarget&&(this.emptyCtaTarget.hidden=!t||!(null!==(e=this.createConfig)&&void 0!==e&&e.enabled))}},{key:"renderCreateAffordances",value:function(){var e,t=this;if(!this.readOnlyValue&&this.allowCreateValue&&this.hasHeaderActionsTarget){if(this.headerActionsTarget.innerHTML="",null===(e=this.createConfig)||void 0===e||!e.enabled)return this.emptyCtaTarget.innerHTML="",void this.updateEmptyState();var n=document.createElement("button");n.type="button",n.className="".concat(m,"__new-button"),n.textContent="+ New",n.addEventListener("click",function(){return t.handleNewClick()}),this.headerActionsTarget.appendChild(n),this.emptyCtaTarget.innerHTML="";var r=document.createElement("button");r.type="button",r.className="".concat(m,"__empty-cta-button"),r.textContent="+ Create a vote box",r.addEventListener("click",function(){return t.handleNewClick()}),this.emptyCtaTarget.appendChild(r),this.updateEmptyState()}}},{key:"handleNewClick",value:function(){this.createConfig&&(this.createConfig.inline_supported?this.showCreateForm():window.location.href=this.newVoteBoxUrlValue)}},{key:"showCreateForm",value:function(){var e=this;if(this.createConfig){this.createFormTarget.innerHTML="",this.createFormTarget.hidden=!1;var t=document.createElement("form");t.className="".concat(m,"__create-form");var n=document.createElement("label");n.textContent="Vote Box name";var r=document.createElement("input");r.type="text",r.className="".concat(m,"__create-form-title"),r.maxLength=60,n.appendChild(r),t.appendChild(n);var o=this.createConfig.organizations,i=null;if(o.length>1){var a=document.createElement("label");a.textContent="Organization",(i=document.createElement("select")).className="".concat(m,"__create-form-org"),o.forEach(function(e){var t,n=document.createElement("option");n.value=String(e.id),n.textContent=e.name,null===(t=i)||void 0===t||t.appendChild(n)}),a.appendChild(i),t.appendChild(a)}var u=document.createElement("div");u.className="".concat(m,"__create-form-actions");var c=document.createElement("button");c.type="submit",c.className="".concat(m,"__create-form-submit"),c.textContent="Create",u.appendChild(c);var s=document.createElement("button");s.type="button",s.className="".concat(m,"__create-form-cancel"),s.textContent="Cancel",s.addEventListener("click",function(){return e.hideCreateForm()}),u.appendChild(s),t.appendChild(u),t.addEventListener("submit",function(t){var n;t.preventDefault();var a=r.value.trim(),u=i?Number(i.value):null===(n=o[0])||void 0===n?void 0:n.id;a&&u&&e.submitCreate(a,u,c)}),this.createFormTarget.appendChild(t)}}},{key:"hideCreateForm",value:function(){this.createFormTarget.hidden=!0,this.createFormTarget.innerHTML=""}},{key:"submitCreate",value:function(e,t,n){var r=this;this.creating||(this.creating=!0,n.disabled=!0,fetch(this.voteBoxesUrlV
2alue,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":this.csrfToken()},credentials:"same-origin",body:JSON.stringify({vote_box:{title:e,organization_id:t}})}).then(function(){var e=l(u().m(function e(t){var n,o;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error((null===(o=n.errors)||void 0===o?void 0:o.join(", "))||"Could not create vote box.");case 2:r.hideCreateForm(),r.loadListPage(r.listPage);case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(e){r.showToast(e.message||"Could not create vote box.","danger")}).finally(function(){r.creating=!1,n.disabled=!1}))}},{key:"registerPendingDropZones",value:function(){var e=this;this.rowElements.forEach(function(t,n){return e.registerDropZone(n)})}},{key:"registerDropZone",value:function(e){var t=this;if(!this.readOnlyValue&&this.gridApi&&!this.registeredBoxIds.has(e)){var n=this.rowElements.get(e);if(n){var r={getContainer:function(){return n},onDragEnter:function(){return n.classList.add("".concat(m,"__row--drag-over"))},onDragLeave:function(){return n.classList.remove("".concat(m,"__row--drag-over"))},onDragStop:function(n){return t.handleDrop(e,n)}};this.gridApi.addRowDropZone(r),this.dropZoneParams.set(e,r),this.registeredBoxIds.add(e)}}}},{key:"teardownDropZones",value:function(){var e=this;this.gridApi&&this.dropZoneParams.forEach(function(t){var n;return null===(n=e.gridApi)||void 0===n?void 0:n.removeRowDropZone(t)}),this.dropZoneParams.clear(),this.registeredBoxIds.clear()}},{key:"handleDrop",value:function(e,t){var n,r,o=this;null===(n=this.rowElements.get(e))||void 0===n||n.classList.remove("".concat(m,"__row--drag-over"));var a=this.boxRows.get(e);if(a){var c=(null!==(r=t.nodes)&&void 0!==r?r:[]).map(function(e){return e.data}).filter(function(e){return void 0!==(null===e||void 0===e?void 0:e.id)&&null!==(null===e||void 0===e?void 0:e.id)});if(0!==c.length){var s=c.map(function(e){return String(e.id)}),f="loaded"===a.loadState?new Set(a.elections.map(function(e){return String(e.id)})):new Set,d=c.filter(function(e){return!f.has(String(e.id))}).map(function(e){var t;return{id:e.id,name:String(null!==(t=e.name)&&void 0!==t?t:"")}});if(0!==d.length){var p=a.elections,h=a.elections_count;"loaded"===a.loadState&&(a.elections=[].concat(i(a.elections),i(d))),a.elections_count=a.elections_count+d.length,this.updateRowElement(e),fetch("".concat(this.voteBoxesUrlValue,"/").concat(e,"/elections"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-Token":this.csrfToken()},credentials:"same-origin",body:JSON.stringify({election_ids:s})}).then(function(){var e=l(u().m(function e(t){var n,r;return u().w(function(e){for(;;)switch(e.n){case 0:if(!t.ok){e.n=1;break}return e.a(2);case 1:return e.n=2,t.json().catch(function(){return{}});case 2:throw r=e.v,new Error((null===(n=r.errors)||void 0===n?void 0:n.join(", "))||"Could not attach election. It must be an active vote box.");case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){a.elections=p,a.elections_count=h,o.updateRowElement(e),o.showToast(t.message||"Could not attach election.","danger")})}}}}},{key:"detach",value:function(e,t){var n=this,r=this.boxRows.get(e);if(r){var o=r.elections.findIndex(function(e){return String(e.id)===String(t)});if(-1!==o){var i=r.elections,a=r.elections_count;r.elections=r.elections.filter(function(e,t){return t!==o}),r.elections_count=Math.max(0,r.elections_count-1),this.updateRowElement(e),fetch("".concat(this.voteBoxesUrlValue,"/").concat(e,"/elections/").concat(t),{method:"DELETE",headers:{Accept:"application/json","X-CSRF-Token":this.csrfToken()},credentials:"same-origin"}).then(function(){var e=l(u().m(function e(t){var n,r;return u().w(function(e){for(;;)switch(e.n){case 0:if(!t.ok){e.n=1;break}return e.a(2);case 1:return e.n=2,t.json().catch(function(){return{}});case 2:throw r=e.v,new Error((null===(n=r.errors)||void 0===n?void 0:n.join(", "))||"Could not detach election.");case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){r.elections=i,r.elections_count=a,n.updateRowElement(e),n.showToast(t.message||"Could not detach election.","danger")})}}}},{key:"csrfToken",value:function(){var e,t;return null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:""}},{key:"showToast",value:function(e,t){(0,o.P)(e,t)}}],r&&f(n.prototype,r),a&&f(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,c,s}(r.xI);b.targets=["list","empty","headerActions","emptyCta","createForm","listFooter","listPrevButton","listNextButton","listPageLabel"],b.values={voteBoxesUrl:String,newVoteBoxUrl:String,readOnly:{type:Boolean,default:!1},allowCreate:{type:Boolean,default:!0},linkOut:{type:Boolean,default:!0},dashboardUrl:String,detailUrl:String}},2797:function(e,t,n){"use strict";n.r(t),n.d(t,{EVENTS:function(){return b},default:function(){return w},findVoteItemElements:function(){return g}});var r=n(6609),o=n(9403),i=n(6846),a=n(2798),u=n(8733);function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return s(l,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,c=e,d.n=n,a}};function p(n,r){for(u=n,c=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(d.n=-1),p(u,c)):d.n=c:d.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=d.n<0)?c:n.call(r,d))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function u(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),p=f.prototype=u.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,s(p,"constructor",f),s(f,"constructor",l),l.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(p),s(p,o,"Generator"),s(p,r,function(){return this}),s(p,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m:h}})()}function s(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,t,n,r){function i(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},s(e,t,n,r)}function l(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){l(i,r,o,a,u,"next",e)}function u(e){l(i,r,o,a,u,"throw",e)}a(void 0)})}}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n){return t=y(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var b=(0,i.mapValues)({CLOSE_ALL:"close_all",CHECK:"check",UNCHECK:"uncheck",DISABLED_STATUS:"disabled_status"},function(e){return"".concat("votes--dashboard--vote-item-component",":").concat(e)}),g=function(){var e=document.querySelectorAll("[id^=vote_item_check_]");return Array.from(e)},w=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){this.addListeners()}},{key:"toggleActions",value:(p=f(c().m(function e(t){return c().w(function(e){for(;;)switch(e.n){case 0:if(this.emitCloseEvent(),!t.target.checked){e.n=2;break}return this.emitCheck(),e.n=1,this.handleShow();case 1:e.n=3;break;case 2:this.closeMenu(),this.emitUncheck();case 3:return e.a(2)}},e,this)})),function(e){return p.apply(this,arguments)})},{key:"handleShow",value:(l=f(c().m(function e(){var t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.emitDisabledStatus(!0),this.showLoading(),e.n=1,this.getActions();case 1:this.showMenu(),e.n=3;break;case 2:e.p=2,t=e.v,console.error(t),alert("An error occurred");case 3:return e.p=3,this.hideLoading(),this.emitDisabledStatus(!1),e.f(3);case 4:return e.a(2)}},e,this,[[0,2,3,4]])})),function(){return l.apply(this,arguments)})},{key:"handleListMultiActions",value:function(){this.isFirstElement()&&
2(this.emitCloseEvent(),this.closeMenu(),this.handleShow())}},{key:"isFirstElement",value:function(){var e,t=null===(e=g().filter(function(e){return e.checked})[0])||void 0===e?void 0:e.id;return this.checkboxInputTarget.id===t}},{key:"updateCheckboxValue",value:function(e){this.checkboxInputTarget.checked=e}},{key:"updateCheckboxDisabledStatus",value:function(e){this.checkboxInputTarget.disabled=e}},{key:"showLoading",value:function(){this.loadingActionsMenuTarget.classList.add("visible")}},{key:"hideLoading",value:function(){this.loadingActionsMenuTarget.classList.remove("visible")}},{key:"showMenu",value:function(){this.actionsMenuTarget.classList.add("visible")}},{key:"closeMenu",value:function(){this.actionsMenuTarget.classList.remove("visible")}},{key:"voteItemIds",value:function(){return g().filter(function(e){return e.checked}).map(function(e){return e.value})}},{key:"getActions",value:(s=f(c().m(function e(){var t,n;return c().w(function(e){for(;;)switch(e.n){case 0:return t={vote_item_ids:this.voteItemIds(),turbo_stream_id:this.turboStreamIdValue},e.n=1,(0,a.v)(this.actionsUrlValue,t);case 1:n=e.v,o.V.renderStreamMessage(n);case 2:return e.a(2)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"skipClose",value:function(e){return e.detail.skipElementId===this.element.id}},{key:"addListeners",value:function(){var e=this;document.addEventListener(b.CLOSE_ALL,function(t){e.skipClose(t)||e.closeMenu()}),document.addEventListener(b.DISABLED_STATUS,function(t){e.updateCheckboxDisabledStatus(t.detail.value)}),document.addEventListener(u.EVENTS.CHECK_ALL,function(){e.updateCheckboxValue(!0)}),document.addEventListener(u.EVENTS.UNCHECK_ALL,function(){e.updateCheckboxValue(!1),e.closeMenu()}),document.addEventListener(u.EVENTS.GET_MULTI_ACTIONS,function(){e.handleListMultiActions()})}},{key:"emitCloseEvent",value:function(){this.dispatch(b.CLOSE_ALL,{prefix:null,detail:{skipElementId:this.element.id}})}},{key:"emitCheck",value:function(){this.dispatch(b.CHECK,{prefix:null})}},{key:"emitUncheck",value:function(){this.dispatch(b.UNCHECK,{prefix:null})}},{key:"emitDisabledStatus",value:function(e){this.dispatch(b.DISABLED_STATUS,{prefix:null,detail:{value:e}})}}],r&&d(n.prototype,r),i&&d(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,s,l,p}(r.BaseController);w.targets=["actionsMenu","loadingActionsMenu","checkboxInput"],w.values={actionsUrl:String,turboStreamId:String}},1030:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"letter",value:function(){this.performUncheckAction("smsCheckbox"),this.performUncheckAction("emailCheckbox"),this.performUncheckAction("postc
2ardCheckbox"),this.reloadData("letter")}},{key:"postcard",value:function(){this.performUncheckAction("smsCheckbox"),this.performUncheckAction("emailCheckbox"),this.performUncheckAction("letterCheckbox"),this.reloadData("postcard")}},{key:"email",value:function(){this.performUncheckAction("smsCheckbox"),this.performUncheckAction("postcardCheckbox"),this.performUncheckAction("letterCheckbox"),this.reloadData("email")}},{key:"sms",value:function(){this.performUncheckAction("emailCheckbox"),this.performUncheckAction("postcardCheckbox"),this.performUncheckAction("letterCheckbox"),this.reloadData("sms")}},{key:"reloadData",value:function(e){var t=window.location.href,n=this.urlToReloadData(e);Turbo.visit(n,{action:"replace"}),history.pushState(null,null,t)}},{key:"performUncheckAction",value:function(e){this["has".concat(e,"Target")]&&this.uncheck(this["".concat(e,"Target")])}},{key:"uncheck",value:function(e){e&&(e.checked=!1)}},{key:"urlToReloadData",value:function(e){var t=this.formElementTarget.getAttribute("data-vote-id"),n=JSON.parse(this.formElementTarget.getAttribute("data-invitation-ids")),r="/votes/".concat(t,"/notices/on_demand"),o=new URLSearchParams;return n.forEach(function(e){o.append("invitation_ids[]",e)}),o.append("notice_type_identifier[".concat(e,"]"),"true"),"".concat(r,"?").concat(o.toString())}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["smsCheckbox","emailCheckbox","letterCheckbox","postcardCheckbox","formElement"]},9957:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).reloadTimeout=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.reloadCharts(),this.applyPatternsIfNeeded(),this.element.addEventListener("turbo:frame-load",this.handleTurboLoad.bind(this)),this.element.addEventListener("turbo:before-stream-render",this.handleTurboStream.bind(this))}},{key:"disconnect",value:function(){this.reloadTimeout&&clearTimeout(this.reloadTimeout),this.element.removeEventListener("turbo:frame-load",this.handleTurboLoad.bind(this)),this.element.removeEventListener("turbo:before-stream-render",this.handleTurboStream.bind(this))}},{key:"handleTurboLoad",value:function(){this.scheduleReload()}},{key:"handleTurboStream",value:function(){this.scheduleReload()}},{key:"scheduleReload",value:function(){var e=this;this.reloadTimeout&&clearTimeout(this.reloadTimeout),this.reloadTimeout=window.setTimeout(function(){e.reloadCharts(),e.applyPatternsIfNeeded()},200)}},{key:"applyPatternsIfNeeded",value:function(){var e=this;"true"===this.element.getAttribute("data-chart-patterns")&&requestAnimationFrame(function(){setTimeout(function(){var t,n=null===(t=e.element.querySelector('[id$="--australian-stv-kick-chart"]'))||void 0===t?void 0:t.id;n&&window.ChartPatterns&&window.ChartPatterns.applyPatternsToChart(n)},100)})}},{key:"reloadCharts",value:function(){var e=this;"undefined"!==typeof window.Chartkick&&window.Chartkick&&requestAnimationFrame(function(){e.element.querySelectorAll("script").forEach(function(e){var t=e.textContent||e.innerHTML;if(t&&(t.includes("new Chartkick")||t.includes("Chartkick.")))try{var n,r=document.createElement("script");r.textContent=t,null===(n=e.parentNode)||void 0===n||n.replaceChild(r,e)}catch(o){console.error("Failed to reload chart script:",o)}})})}},{key:"reload",value:function(){this.reloadCharts(),this.applyPatternsIfNeeded()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI)},2454:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).reloadTimeout=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.reloadCharts(),this.applyPatternsIfNeeded(),this.element.addEventListener("turbo:frame-load",this.handleTurboLoad.bind(this)),this.element.addEventListener("turbo:before-stream-render",this.handleTurboStream.bind(this))}},{key:"disconnect",value:function(){this.reloadTimeout&&clearTimeout(this.reloadTimeout),this.element.removeEventListener("turbo:frame-load",this.handleTurboLoad.bind(this)),this.element.removeEventListener("turbo:before-stream-render",this.handleTurboStream.bind(this))}},{key:"handleTurboLoad",value:function(){this.scheduleReload()}},{key:"handleTurboStream",value:function(){this.scheduleReload()}},{key:"scheduleReload",value:function(){var e=this;this.reloadTimeout&&clearTimeout(this.reloadTimeout),this.reloadTimeout=window.setTimeout(function(){e.reloadCharts(),e.applyPatternsIfNeeded()},200)}},{key:"applyPatternsIfNeeded",value:function(){var e=this;"true"===this.element.getAttribute("data-chart-patterns")&&requestAnimationFrame(function(){setTimeout(function(){var t,n=null===(t=e.element.querySelector('[id$="--borda-kick-chart"]'))||void 0===t?void 0:t.id;n&&window.ChartPatterns&&window.ChartPatterns.applyPatternsToChart(n)},100)})}},{key:"reloadCharts",value:function(){var e=this;"undefined"!==typeof window.Chartkick&&window.Chartkick&&requestAnimationFrame(function(){e.element.querySelectorAll("script").forEach(function(e){var t=e.textContent||e.innerHTML;if(t&&(t.includes("new Chartkick")||t.includes("Chartkick.")))try{var n,r=document.createElement("script");r.textContent=t,null===(n=e.parentNode)||void 0===n||n.replaceChild(r,e)}catch(o){console.error("Failed to reload chart script:",o)}})})}},{key:"reload",value:function(){this.reloadCharts(),this.applyPatternsIfNeeded()}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},8929:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).selectionContainer=void 0,e.searchInput=void 0,e.boundHandleKeydown=function(t){return e.handleKeydown(t)},e.isRemovingSelection=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){var e=this,t=(0,o.T)();t&&(t(this.multiLanguageSelectTarget).select2({placeholder:"Select languages..."}).on("change",function(){return e.updateSelectedLanguagesText()}).on("select2:select",function(t){return e.handleLanguageSelection(t)}).on("select2:unselect",function(t){return e.handleLanguageUnselection(t)}).on("select2:open",function(){return e.handleSelect2Open()}).on("select2:close",function(){return e.detachSearchInputListener()}),this.attachSelectionContainerListener(),this.updateSelectedLanguagesText())}},{key:"disconnect",value:function(){this.detachSearchInputListener(),this.detachSelectionContainerListener()}},{key:"toggleMultiLanguageOptions",value:function(){var e=this;if(this.multiLanguageAdvancedRadioTarget.checked){this.multiLanguageOptionsTarget.classList.remove("hide");var t=(0,o.T)();if(!t)return;t(this.multiLanguageSelectTarget).select2("destroy").select2({placeholder:"Select languages..."}).on("change",function(){return e.updateSelectedLanguagesText()}).on("select2:select",function(t){return e.handleLanguageSelection(t)}).on("select2:unselect",function(t){return e.handleLanguageUnselection(t)}).on("select2:open",function(){return e.handleSelect2Open()}).on("select2:close",function(){return e.detachSearchInputListener()}),this.attachSelectionContainerListener(),this.updateSelectedLanguagesText()}else this.multiLanguageOptionsTarget.classList.add("hide"),this.selectedLanguagesTextTarget.classList.add("hide")}},{key:"handleLanguageSelection",value:function(e){var t=e.params.data.id;this.addHiddenField(t),this.updateSelectedLanguagesText()}},{key:"handleLanguageUnselection",value:function(e){var t=this;this.isRemovingSelection=!0;var n=e.params.data.id;this.removeHiddenField(n),this.updateSelectedLanguagesText(),setTimeout(function(){var e=(0,o.T)();e&&e(t.multiLanguageSelectTarget).select2("close"),t.isRemovingSelection=!1},10)}},{key:"addHiddenField",value:function(e){if(!document.querySelector('input[name="election[vote_settings_attributes][supported_languages][]"][value="'.concat(e,'"]'))){var t,n=document.createElement("input");n.type="hidden",n.name="election[vote_settings_attributes][supported_languages][]",n.value=e,null===(t=this.multiLanguageSelectTarget.parentNode)||void 0===t||t.appendChild(n)}}},{key:"removeHiddenField",value:function(e){var t=document.querySelector('input[name="election[vote_settings_attributes][supported_languages][]"][value="'.concat(e,'"]'));t&&t.remove()}},{key:"updateSelectedLanguagesText",value:function(){var e=(0,o.T)();if(e){var t=e(this.multiLanguageSelectTarget).select2("data"),n=[];Array.isArray(t)&&(n=t.map(function(e){return e.text})),n.length>0?(this.selectedLanguagesTextTarget.innerHTML="<strong>Selected Languages:</strong> ".concat(n.join(", ")),this.selectedLanguagesTextTarget.classList.remove("hide")):(this.selectedLanguagesTextTarget.innerHTML="",this.selectedLanguagesTextTarget.classList.add("hide"))}}},{key:"attachSelectionContainerListener",value:function(){var e,t=null===(e=this.multiLanguageSelectTarget.nextElementSibling)||void 0===e?void 0:e.querySelector(".select2-selection");t&&t!==this.selectionContainer&&(this.detachSelectionContainerListener(),this.selectionContainer=t,this.selectionContainer.addEventListener("keydown",this.boundHandleKeydown,!0))}},{key:"detachSelectionContainerListener",value:function(){this.selectionContainer&&(this.selectionContainer.removeEventListener("keydown",this.boundHandleKeydown,!0),this.selectionContainer=void 0)}},{key:"handleSelect2Open",value:function(){this.isRemovingSelection||this.attachSearchInputListener()}},{key:"attachSearchInputListener",value:function(){var e=document.querySelector(".select2-container--default .select2-search__field");e&&(this.searchInput=e,this.searchInput.addEventListener("keydown",this.boundHandleKeydown,!0))}},{key:"detachSearchInputListener",value:function(){this.searchInput&&(this.searchInput.removeEventListener("keydown",this.boundHandleKeydown,!0),this.searchInput=void 0)}},{key:"handleKeydown",value:function(e){var t,n;if("Backspace"===e.key){var r=e.target,i=r.classList.contains("select2-search__field")?r.value:null!==(t=null===(n=this.searchInput)||void 0===n?void 0:n.value)&&void 0!==t?t:"";if(i&&i.length>0)return e.stopPropagation(),void e.stopImmediatePropagation();var a=(0,o.T)();if(a){var u=a(this.multiLanguageSelectTarget).select2("data")||[];if(u.length>0){var c,s=u[u.length-1],l=null===(c=this.multiLanguageSelectTarget.nextElementSibling)||void 0===c?void 0:c.closest(".select2-container"),f=null===l||void 0===l?void 0:l.querySelector('.select2-selection__choice[title="'.concat(CSS.escape(s.text),'"] .select2-selection__choice__remove'));f&&(f.click(),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}}}}}],r&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["multiLanguageAdvancedRadio","multiLanguageSelect","multiLanguageOptions","selectedLanguagesText"]},3561:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=(0,o.T)();e&&e(this.languageSelectTarget).select2()}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["languageSelect"]},1984:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.appendVerticalList(),this.defineContainerDirection()}},{key:"openMenu",value:function(){this.showMenu()}},{key:"showMenu",value:function(){this.isMobileScreen()&&this.verticalListTarget.classList.toggle("visible")}},{key:"appendVerticalList",value:function(){document.querySelector("#item-container.active").appendChild(this.verticalListTarget)}},{key:"defineContainerDirection",value:function(){this.hasHeadContainerTarget&&(this.isMobileScreen()&&this.exceedsWindowWidth()?this.headContainerTarget.style.flexDirection="column-reverse":this.headContainerTarget.style.flexDirection="row")}},{key:"exceedsWindowWidth",value:function(){var e=this.titleContainerTarget.getBoundingClientRect();return e.left+e.width>window.innerWidth}},{key:"isMobileScreen",value:function(){return window.innerWidth<640}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["verticalList","headContainer","titleContainer"]},4068:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["allowAbstainCheckbox","allowCommentsCheckbox"]},9602:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.element.addEventListener("quill:content-changed",this.handleQuillChange.bind(this))}},{key:"toggleEditVoterInstructions",value:function(){this.editorTarget.classList.toggle("hide");var e=this.editorTarget.querySelector(".ql-editor");e&&(e.innerHTML="")}},{key:"handleQuillChange",value:function(e){e.detail.isEmpty?(this.replaceVoterInstructionsCheckboxTarget.checked&&this.replaceVoterInstructionsCheckboxTarget.click(),this.replaceVoterInstructionsCheckboxTarget.disabled=!0):this.replaceVoterInstructionsCheckboxTarget.disabled=!1}},{key:"disconnect",value:function(){this.element.removeEventListener("quill:content-changed",this.handleQuillChange.bind(this))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["editor","replaceVoterInstructionsCheckbox"]},2539:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(9403);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).previousUrl=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"toggleAnswerContainer",value:function(e){var t=e.currentTarget,n=t.dataset.answerId;if(n){var r=document.querySelector("#answer-".concat(n,"-container")),i=t.querySelector(".toggle-icon");if(r&&i)if(r.classList.contains("hidden")){r.classList.remove("hidden"),i.innerHTML='<i class="fas fa-chevron-up"></i>',this.previousUrl=window.location.href;var a="/votes/translations/".concat(this.voteIdValue,"/questions/").concat(this.questionIdValue,"/answers/").concat(n,"/edit?language_filters=").concat(this.languageFiltersValue.join(","));o.V.visit(a,{frame:"answer-".concat(n,"-container"),action:"replace"}),window.history.pushState({},"",this.previousUrl)}else r.classList.add("hidden"),i.innerHTML='<i class="fas fa-chevron-down"></i>'}}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.values={voteId:String,questionId:String,languageFilters:Array}},1589:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).previousUrl=null,e.currentOffset=0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"showLoading",value:function(){this.loadingTarget.style.display="block";var e=this.listTarget.querySelectorAll("[data-question-id]");this.currentOffset=e.length}},{key:"hideLoading",value:function(){this.loadingTarget.style.display="none"}},{key:"handleLoadMore",value:function(e){var t=this;this.previousUrl=window.location.href,requestAnimationFrame(function(){window.history.pushState({},"",t.previousUrl)})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["list","loading","loadMoreButton"],s.values={voteId:String}},4447:function(e,t,n){"use strict";function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,o(p,"constructor",f),o(f,"constructor",l),l.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(p),o(p,a,"Generator"),o(p,i,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:h}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}n.r(t),n.d(t,{default:function(){return d}});var d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"triggerTranslation",value:(s=r().m(function e(t){var n,o,i,a,u,c,s,l,f;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return t.preventDefault(),(n=t.currentTarget).disabled=!0,e.p=1,(i=document.querySelector(".infrastru
2cture--ai-loading-overlay-component"))?(a=this.application.getControllerForElementAndIdentifier(i,"infrastructure--ai-loading-overlay-component--ai-loading-overlay-component"))&&"function"===typeof a.show?(console.log("Showing overlay"),a.show()):console.error("Overlay controller not found or show method missing"):console.warn("Overlay element .infrastructure--ai-loading-overlay-component not found in DOM. Ensure it is rendered in the layout."),u=null===(o=document.querySelector('meta[name="csrf-token"]'))||void 0===o?void 0:o.getAttribute("content"),console.log("Sending translation request to:",this.urlValue),e.n=2,fetch(this.urlValue,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":u||""},body:JSON.stringify({target_languages:this.targetLanguagesValue})});case 2:if(c=e.v,console.log("Response status:",c.status),c.ok){e.n=3;break}throw new Error("Translation request failed");case 3:console.log("Translation request successful, waiting for ActionCable broadcast"),e.n=5;break;case 4:e.p=4,f=e.v,console.error("Translation error:",f),n.disabled=!1,(s=document.querySelector(".infrastructure--ai-loading-overlay-component"))&&(l=this.application.getControllerForElementAndIdentifier(s,"infrastructure--ai-loading-overlay-component--ai-loading-overlay-component"))&&"function"===typeof l.hide&&l.hide(),alert("Failed to start translation. Please try again.");case 5:return e.a(2)}},e,this,[[1,4]])}),l=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function a(e){i(o,n,r,a,u,"next",e)}function u(e){i(o,n,r,a,u,"throw",e)}a(void 0)})},function(e){return l.apply(this,arguments)})}],o&&a(n.prototype,o),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,u,s,l}(n(5396).xI);d.values={url:String,targetLanguages:Array}},5202:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggle",value:function(){this.containerTarget.classList.contains("hidden")?(this.containerTarget.classList.remove("hidden"),this.toggleIconTarget.innerHTML='<i class="fas fa-chevron-up"></i>'):(this.containerTarget.classList.add("hidden"),this.toggleIconTarget.innerHTML='<i class="fas fa-chevron-down"></i>')}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["container","toggleIcon"]},4703:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return h}});var r=n(5396),o=n(6846);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function u(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return a(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");
2if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(a(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,a(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,a(p,"constructor",f),a(f,"constructor",l),l.displayName="GeneratorFunction",a(f,o,"GeneratorFunction"),a(p),a(p,o,"Generator"),a(p,r,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(i=function(){return{w:u,m:h}})()}function a(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}a=function(e,t,n,r){function i(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},a(e,t,n,r)}function u(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var h=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=l(this,t,[].concat(r))).debouncedSubmit=null,e.lastChangedInput=null,e.changeHandler=void 0,e.debouncedQuillChange=null,e.autoSubmitTimer=null,e.isFocused=!1,e.AUTO_SUBMIT_INTERVAL=1e4,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.debouncedSubmit=(0,o.debounce)(this.submit.bind(this),500),this.debouncedQuillChange=(0,o.debounce)(this.handleQuillChangeDebounced.bind(this),1e3),this.setupEventListeners()}},{key:"disconnect",value:function(){this.debouncedSubmit&&this.debouncedSubmit.cancel(),this.debouncedQuillChange&&this.debouncedQuillChange.cancel(),this.stopAutoSubmitTimer(),this.cleanupEventListeners()}},{key:"setupEventListeners",value:function(){this.changeHandler=this.handleChange.bind(this),this.element.addEventListener("quill:content-changed",this.handleQuillChange.bind(this)),this.element.addEventListener("focusin",this.handleFocusIn.bind(this)),this.element.addEventListener("focusout",this.handleFocusOut.bind(this)),this.element.addEventListener("paste",this.handlePaste.bind(this))}},{key:"cleanupEventListeners",value:function(){this.element.removeEventListener("quill:content-changed",this.handleQuillChange.bind(this)),this.element.removeEventListener("focusin",this.handleFocusIn.bind(this)),this.element.removeEventListener("focusout",this.handleFocusOut.bind(this)),this.element.removeEventListener("paste",this.handlePaste.bind(this))}},{key:"handleChange",value:function(e){e.target.matches("input, textarea, [contenteditable], .editor-content, .rich-text-editor")&&this.inputChanged(e)}},{key:"handleQuillChange",value:function(e){this.debouncedQuillChange&&this.debouncedQuillChange(e)}},{key:"handleFocusIn",value:function(e){var t=e.target;if(t.matches("input, textarea, [contenteditable], .editor-content, .rich-text-editor, .ql-editor")){if("INPUT"===t.tagName||"TEXTAREA"===t.tagName)this.lastChangedInput=t;else if(t.classList.contains("ql-editor")){var n=t.closest('[data-controller*="input"]');if(n){var r=n.querySelector('input[type="hidden"]');r&&(this.lastChangedInput=r)}}this.startAutoSubmit()}}},{key:"handleFocusOut",value:function(e){var t=this;e.target.matches("input, textarea, [contenteditable], .editor-content, .rich-text-editor, .ql-editor")&&setTimeout(function(){t.stopAutoSubmit()},1e3)}},{key:"handlePaste",value:function(e){var t=this;console.log("handlePaste");var n=e.target;n.matches("input, textarea, [contenteditable], .editor-content, .rich-text-editor, .ql-editor")&&setTimeout(function(){if("INPUT"===n.tagName||"TEXTAREA"===n.tagName)t.lastChangedInput=n;else if(n.classList.contains("ql-editor")){var e=n.closest('[data-controller*="input"]');if(e){var r=e.querySelector('input[type="hidden"]');r&&(t.lastChangedInput=r)}}t.submit()},50)}},{key:"handleQuillChangeDebounced",value:function(e){this.inputChangedQuill(e)}},{key:"inputChanged",value:function(e){var t=e.target;this.lastChangedInput=t,this.debouncedSubmit&&this.debouncedSubmit()}},{key:"inputChangedQuill",value:function(e){var t=e.target.querySelector('input[type="hidden"]');t&&(this.lastChangedInput=t,this.debouncedSubmit&&this.debouncedSubmit())}},{key:"startAutoSubmit",value:function(){this.isFocused=!0,this.startAutoSubmitTimer()}},{key:"stopAutoSubmit",value:function(){this.isFocused=!1,this.stopAutoSubmitTimer()}},{key:"startAutoSubmitTimer",value:function(){var e=this;this.stopAutoSubmitTimer(),this.autoSubmitTimer=window.setTimeout(function(){e.isFocused&&e.lastChangedInput&&(e.submit(),e.isFocused&&e.startAutoSubmitTimer())},this.AUTO_SUBMIT_INTERVAL)}},{key:"stopAutoSubmitTimer",value:function(){this.autoSubmitTimer&&(clearTimeout(this.autoSubmitTimer),this.autoSubmitTimer=null)}},{key:"submit",value:(s=i().m(function e(){var t,n,r,o,a,u,c,s,l,f,d,p,h,v;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.lastChangedInput){e.n=1;break}return e.a(2);case 1:return n=new FormData,(r=null===(t=this.element.closest(".field-container"))||void 0===t?void 0:t.dataset.format)&&n.append("notice_format",r),n.append(this.lastChangedInput.name,this.lastChangedInput.value),n.append("frame_id",this.frameIdValue),o=this.submitUrlValue,e.p=2,e.n=3,fetch(o,{method:"PATCH",body:n,headers:{Accept:"text/vnd.turbo-stream.html","X-CSRF-Token":this.getCsrfToken()}});case 3:return a=e.v,e.n=4,a.text();case 4:(u=e.v).includes("<turbo-stream")&&(c=new DOMParser,s=c.parseFromString(u,"text/html"),(l=s.querySelector("turbo-stream"))&&(f=l.getAttribute("action"),d=l.getAttribute("target"),p=l.querySelector("template"),d&&p&&(h=document.getElementById(d))&&("update"===f?h.innerHTML=p.innerHTML:"append"===f?h.insertAdjacentHTML("beforeend",p.innerHTML):"replace"===f&&(h.outerHTML=p.innerHTML)))),e.n=6;break;case 5:e.p=5,v=e.v,console.error("Fetch error:",v);case 6:return e.a(2)}},e,this,[[2,5]])}),f=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function i(e){u(o,n,r,i,a,"next",e)}function a(e){u(o,n,r,i,a,"throw",e)}i(void 0)})},function(){return f.apply(this,arguments)})},{key:"getCsrfToken",value:function(){var e=document.querySelector('meta[name="csrf-token"]');return e?e.content:""}}],r&&c(n.prototype,r),a&&c(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,s,f}(r.xI);h.targets=["input","frame"],h.values={submitUrl:String,frameId:String}},9237:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).selectionContainer=void 0,e.searchInput=void 0,e.boundHandleKeydown=function(t){return e.handleKeydown(t)},e.isRemovingSelection=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.element.addEventListener("turbo:submit-end",function(e){e.detail.success&&window.location.reload()});var t=(0,o.T)();t&&(t(this.multiLanguageSelectTarget).select2({placeholder:"Select languages..."}).on("change",function(){return e.updateSelectedLanguagesText()}).on("select2:select",function(t){return e.handleLanguageSelection(t)}).on("select2:unselect",function(t){return e.handleLanguageUnselection(t)}).on("select2:open",function(){return e.handleSelect2Open()}).on("select2:close",function(){return e.detachSearchInputListener()}),this.attachSelectionContainerListener(),this.updateSelectedLanguagesText())}},{key:"disconnect",value:function(){this.detachSearchInputListener(),this.detachSelectionContainerListener()}},{key:"handleLanguageSelection",value:function(e){var t=e.params.data.id;this.addHiddenField(t),this.updateSelectedLanguagesText()}},{key:"handleLanguageUnselection",value:function(e){var t=e.params.data.id;this.removeHiddenField(t),this.updateSelectedLanguagesText()}},{key:"attachSelectionContainerListener",value:function(){var e,t=null===(e=this.multiLanguageSelectTarget.nextElementSibling)||void 0===e?void 0:e.querySelector(".select2-selection");t&&t!==this.selectionContainer&&(this.detachSelectionContainerListener(),this.selectionContainer=t,this.selectionContainer.addEventListener("keydown",this.boundHandleKeydown,!0))}},{key:"detachSelectionContainerListener",value:function(){this.selectionContainer&&(this.selectionContainer.removeEventListener("keydown",this.boundHandleKeydown,!0),this.selectionContainer=void 0)}},{key:"handleSelect2Open",value:function(){this.isRemovingSelection||this.attachSearchInputListener()}},{key:"attachSearchInputListener",value:function(){var e=document.querySelector(".select2-container--default .select2-search__field");e&&(this.searchInput=e,this.searchInput.addEventListener("keydown",this.boundHandleKeydown,!0))}},{key:"detachSearchInputListener",value:function(){this.searchInput&&(this.searchInput.removeEventListener("keydown",this.boundHandleKeydown,!0),this.searchInput=void 0)}},{key:"handleKeydown",value:function(e){var t,n;if("Backspace"===e.key){var r=e.target,i=r.classList.contains("select2-search__field")?r.value:null!==(t=null===(n=this.searchInput)||void 0===n?void 0:n.value)&&void 0!==t?t:"";if(i&&i.length>0)return e.stopPropagation(),void e.stopImmediatePropagation();var a=(0,o.T)();if(a){var u=a(this.multiLanguageSelectTarget).select2("data")||[];if(u.length>0){var c,s=u[u.length-1],l=null===(c=this.multiLanguageSelectTarget.nextElementSibling)||void 0===c?void 0:c.closest(".select2-container"),f=null===l||void 0===l?void 0:l.querySelector('.select2-selection__choice[title="'.concat(CSS.escape(s.text),'"] .select2-selection__choice__remove'));f&&(f.click(),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}}}}},{key:"addHiddenField",value:function(e){if(!document.querySelector('input[name="vote_settings[supported_languages][]"][value="'.concat(e,'"]'))){var t,n=document.createElement("input");n.type="hidden",n.name="vote_settings[supported_languages][]",n.value=e,null===(t=this.multiLanguageSelectTarget.parentNode)||void 0===t||t.appendChild(n)}}},{key:"removeHiddenField",value:function(e){var t=document.querySelector('input[name="vote_settings[supported_languages][]"][value="'.concat(e,'"]'));t&&t.remove()}},{key:"updateSelectedLanguagesText",value:function(){var e=(0,o.T)();if(e){var t=e(this.multiLanguageSelectTarget).select2("data"),n=[];Array.isArray(t)&&(n=t.map(function(e){return e.text})),n.length>0?(this.selectedLanguagesTextTarget.innerHTML="<strong>Selected Languages:</strong> ".concat(n.join(", ")),this.selectedLanguagesTextTarget.classList.remove("hide")):(this.selectedLanguagesTextTarget.innerHTML="",this.selectedLanguagesTextTarget.classList.add("hide"))}}},{key:"updateAvailableOptions",value:function(){var e=(0,o.T)();if(e){var t=e(this.multiLanguageSelectTarget).select2("data"),n=t?t.map(function(e){return e.id}):[];e(this.multiLanguageSelectTarget).find("option").each(function(t,r){var o=e(r).val();n.includes(o)?e(r).prop("disabled",!0):e(r).prop("disabled",!1)}),e(this.multiLanguageSelectTarget).trigger("change.select2")}}}],r&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["multiLanguageSelect","selectedLanguagesText"]},215:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396),o=n(9403),i=n(6923);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=c(this,t,[].concat(r))).previousUrl=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=this,t=(0,i.T)();t&&t(this.selectLanguagesTarget).select2({placeholder:"Filter language",value:null}).on("change",function(t){return e.filterLanguages(t)})}},{key:"filterLanguages",value:function(e){var t=(0,i.T)();if(t){var n=t(this.selectLanguagesTarget).val()||[];this.previousUrl=window.location.href;var r=new URL("/votes/translations/".concat(this.voteIdValue,"/filter"),window.location.origin);n.forEach(function(e){r.searchParams.append("language_filters[]",e)}),o.V.visit(r.toString(),{action:"replace",frame:"translations-form-container"}),window.history.pushState({},"",this.previousUrl)}}}])&&a(n.prototype,r),u&&a(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u}(r.xI);d.targets=["selectLanguages"],d.values={voteId:String}},7025:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(9403);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).previousUrl=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"toggleQuestionContainer",value:function(e){var t=e.currentTarget,n=t.dataset.questionId;if(n){var r=document.querySelector("#question-".concat(n,"-container")),i=t.querySelector(".toggle-icon");if(r&&i)if(r.classList.contains("hidden")){r.classList.remove("hidden"),i.innerHTML='<i class="fas fa-chevron-up"></i>',this.previousUrl=window.location.href;var a="/votes/translations/".concat(this.voteIdValue,"/questions/").concat(n,"/edit?language_filters=").concat(this.languageFiltersValue.join(","));o.V.visit(a,{frame:"question-".concat(n,"-container"),action:"replace"}),window.history.pushState({},"",this.previousUrl)}else r.classList.add("hidden"),i.innerHTML='<i class="fas fa-chevron-down"></i>'}}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.values={voteId:String,languageFilters:Array}},4259:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).previousUrl=null,e.currentOffset=0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this.listTarget.querySelectorAll("[data-question-id]");this.currentOffset=e.length}},{key:"showLoading",value:function(){this.loadingTarget.style.display="block"}},{key:"hideLoading",value:function(){this.loadingTarget.style.display="none"}},{key:"handleLoadMore",value:function(e){var t=this;this.previousUrl=window.location.href,requestAnimationFrame(function(){window.history.pushState({},"",t.previousUrl)})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["list","loading","loadMoreButton"],s.values={voteId:String}},3707:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"toggle",value:function(){this.containerTarget.classList.contains("hidden")?(this.containerTarget.classList.remove("hidden"),this.toggleIconTarget.innerHTML='<i class="fas fa-chevron-up"></i>'):(this.containerTarget.classList.add("hidden"),this.toggleIconTarget.innerHTML='<i class="fas fa-chevron-down"></i>')}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["container","toggleIcon"]},7832:function(e,t,n){"use strict";var r=n(5988);t.A=(0,r.createConsumer)()},8205:function(e,t,n){"use strict";n.r(t);var r=n(7832),o=n(9639);window.__ebDownloadFilePendingRequestIds=window.__ebDownloadFilePendingRequestIds||new Set;function i(){var e=crypto.randomUUID();return function(e){var t=window.__ebDownloadFilePendingRequestIds;for(t.add(e);t.size>50;)t.delete(t.values().next().value)}(e),e}function a(e){var t=new URL(e,window.location.origin);return t.searchParams.set("request_id",i()),t.toString()}if(!window.__ebDownloadFileChannelSubscribed){window.__ebDownloadFileChannelSubscribed=!0,r.A.subscriptions.create("DownloadFileChannel",{connected:function(){(0,o.log)("connected to DownloadFileChannel")},disconnected:function(){(0,o.log)("disconnected from DownloadFileChannel")},received:function(e){(0,o.log)("message received from DownloadFileChannel",e);var t=e.url;if(t){if(e.request_id){var n=window.__ebDownloadFilePendingRequestIds;if(!n.has(e.request_id))return;n.delete(e.request_id)}navigator.userAgent.toLowerCase().indexOf("firefox")>-1?window.open(t,"_blank"):window.location.href=t}}});var u=/\/reports\/results\/summaries(\.\w+)?$/;document.addEventListener("ajax:before",function(e){var t=e.target;t instanceof HTMLAnchorElement&&u.test(t.pathname)&&(t.href=a(t.href))});var c=/\/voter_list\/download(\/|$)/;document.addEventListener("click",function(e){var t=e.target instanceof Element?e.target.closest("a[data-method]"):null;t&&c.test(new URL(t.href,window.location.origin).pathname)&&(t.href=a(t.href))},!0);var s=/\/accounts\/billings\/transaction_reports\//;document.addEventListener("turbo:before-fetch-request",function(e){s.test(e.detail.url.pathname)&&e.detail.url.searchParams.set("request_id",i())})}},4796:function(e,t,n){"use strict";n.r(t);var r=n(7832),o=n(9639);r.A.subscriptions.create("FlashMessageChannel",{connected:function(){(0,o.log)("connected to FlashMessageChannel")},disconnected:function(){(0,o.log)("disconnected from FlashMessageChannel")},received:function(e){(0,o.log)("message received from FlashMessageChannel",e);var t=document.querySelector(".".concat(e.page));if(t){var n=document.createElement("div");n.classList.add("flash","flash_".concat(e.type)),n.innerHTML=e.message,t.insertBefore(n,t.firstChild)}}})},7434:function(e,t,n){var r=n(3760);
2r.keys().forEach(r)},4948:function(e,t,n){"use strict";n.r(t);var r=n(7832),o=n(9639),i=window.NProgress;r.A.subscriptions.create("LoadingIndicatorChannel",{connected:function(){(0,o.log)("connected to LoadingIndicatorChannel")},disconnected:function(){(0,o.log)("connected to LoadingIndicatorChannel")},received:function(e){(0,o.log)("message received from LoadingIndicatorChannel",e),i?"start"===e.status?i.start():i.done():(0,o.log)("NProgress not available, skipping loading indicator")}})},8332:function(e,t,n){"use strict";n.r(t);var r=n(7832),o=n(9639);r.A.subscriptions.create("Notifications::OrganizationChannel",{connected:function(){(0,o.log)("connected to Notifications::OrganizationChannel")},disconnected:function(){(0,o.log)("disconnected from Notifications::OrganizationChannel")},received:function(e){(0,o.log)("message received from Notifications::OrganizationChannel",e),document.getElementById("notification-container").innerHTML=e.html}})},2264:function(e,t,n){"use strict";n.r(t);var r=n(9639);n(7832).A.subscriptions.create("Notifications::UserChannel",{connected:function(){(0,r.log)("connected to Notifications::UserChannel")},disconnected:function(){(0,r.log)("disconnected from Notifications::UserChannel")},received:function(e){(0,r.log)("message received from Notifications::UserChannel",e);var t=document.getElementById("notification-container");t?t.innerHTML=e.html:(0,r.log)("notification-container not found")}})},8157:function(e,t,n){var r;(r=n(7768)).keys().forEach(r)},975:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return h}});var r=n(5396);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,o,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return i(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,i(p,"constructor",f),i(f,"constructor",l),l.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}
2function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p="application--toolkit--ag-grid-component--ag-grid-component",h=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=s(this,t,[].concat(r))).outsideExportClickListener=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=this;this.outsideExportClickListener=function(t){if(e.hasExportDropdownTarget&&!e.exportDropdownTarget.hidden){var n=t.target;e.hasExportToggleTarget&&e.exportToggleTarget.contains(n)||e.exportDropdownTarget.contains(n)||e.closeExportDropdown()}},document.addEventListener("click",this.outsideExportClickListener)}},{key:"disconnect",value:function(){this.outsideExportClickListener&&document.removeEventListener("click",this.outsideExportClickListener)}},{key:"toggleExportDropdown",value:function(){this.hasExportDropdownTarget&&(this.exportDropdownTarget.hidden?(this.exportDropdownTarget.hidden=!1,this.hasExportToggleTarget&&this.exportToggleTarget.setAttribute("aria-pressed","true")):this.closeExportDropdown())}},{key:"closeExportDropdown",value:function(){this.hasExportDropdownTarget&&(this.exportDropdownTarget.hidden=!0,this.hasExportToggleTarget&&this.exportToggleTarget.setAttribute("aria-pressed","false"))}},{key:"switchQuestion",value:function(){var e=this.agGrid();e&&this.hasQuestionSelectorTarget&&this.questionDataUrlValue&&e.fetchQuestionData(this.buildQuestionDataUrl(),this.questionSelectorTarget.value)}},{key:"exportCsv",value:function(){var e;null===(e=this.agGrid())||void 0===e||e.exportCsv(this.currentQuestionName())}},{key:"exportXlsx",value:function(){var e;null===(e=this.agGrid())||void 0===e||e.exportExcel(this.currentQuestionName())}},{key:"exportVoteByVote",value:function(e){e.preventDefault(),this.confirmAndExportAll("CSV",this.exportVoteByVoteUrlValue,"This will export the vote-by-vote breakdown for all questions in a CSV file. Large exports may take a few minutes and will be delivered to your Report Center.")}},{key:"exportAllCsv",value:function(e){e.preventDefault(),this.confirmAndExportAll("CSV",this.exportAllCsvUrlValue,"This will export all vote-by-vote ballots in a CSV file. Large exports may take a few minutes and will be delivered to your Report Center.")}},{key:"exportAllPdf",value:function(e){e.preventDefault(),this.confirmAndExportAll("PDF",this.exportAllPdfUrlValue,"This will export all vote-by-vote ballots in a PDF file. Large exports may take a few minutes and will be delivered to your Report Center.")}},{key:"confirmAndExportAll",value:(c=o().m(function e(t,n,r){var i;return o().w(function(e){for(;;)switch(e.n){case 0:if((i=this.agGrid())&&n){e.n=1;break}return e.a(2);case 1:return e.n=2,i.confirmAndPost(n,{title:"Export All Results",message:r,confirmLabel:"Export All"});case 2:return e.a(2)}},e,this)}),l=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=c.apply(e,t);function i(e){a(o,n,r,i,u,"next",e)}function u(e){a(o,n,r,i,u,"throw",e)}i(void 0)})},function(e,t,n){return l.apply(this,arguments)})},{key:"openConfirmModal",value:function(){if(this.hasConfirmModalTarget){this.confirmModalTarget.removeAttribute("hidden"),document.body.style.overflow="hidden";var e=this.confirmModalTarget.querySelector('[data-action*="closeConfirmModal"]');e&&setTimeout(function(){return e.focus()},50)}}},{key:"closeConfirmModal",value:function(){this.hasConfirmModalTarget&&(this.confirmModalTarget.setAttribute("hidden",""),document.body.style.overflow="")}},{key:"backdropClickModal",value:function(e){e.target===this.confirmModalTarget&&this.closeConfirmModal()}},{key:"confirmToggleWeighting",value:function(){var e,t;if(this.closeConfirmModal(),this.obfuscationUrlValue){var n=null!==(e=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"";fetch(this.obfuscationUrlValue,{method:"POST",headers:{"X-CSRF-Token":n,"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then(function(e){e.ok&&window.location.reload()}).catch(function(e){console.error("[VoteByVotesController] disable obfuscation error:",e)})}}},{key:"agGrid",value:function(){var e=this.element.querySelector('[data-controller~="'.concat(p,'"]'));return e?this.application.getControllerForElementAndIdentifier(e,p):null}},{key:"buildQuestionDataUrl",value:function(){var e=new URLSearchParams;return this.hasQuestionSelectorTarget&&e.set("question_id",this.questionSelectorTarget.value),"".concat(this.questionDataUrlValue,"?").concat(e.toString())}},{key:"currentQuestionName",value:function(){var e,t;if(this.hasQuestionSelectorTarget){var n=this.questionSelectorTarget.selectedOptions[0];if(n)return(null!==(e=null!==(t=n.dataset.fullLabel)&&void 0!==t?t:n.textContent)&&void 0!==e?e:"").trim()||void 0}}}],r&&u(n.prototype,r),i&&u(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,c,l}(r.xI);h.targets=["questionSelector","confirmModal","exportToggle","exportDropdown"],h.values={questionDataUrl:String,obfuscationUrl:String,exportVoteByVoteUrl:String,exportAllCsvUrl:String,exportAllPdfUrl:String}},5530:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(5396),o=n(7832),i=n(6923);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}
2function c(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function d(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var p=0;function h(e){return"__private_"+p+++"_"+e}var v=h("createSubscription"),y=h("buildHandsontable"),m=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=c(this,t,[].concat(r)),Object.defineProperty(e,y,{value:g}),Object.defineProperty(e,v,{value:b}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){var e=(0,i.T)();if(console.log("[AppendVotersLegacyController] connect() fired",{jquery:"undefined"!==typeof e,handsontable:"undefined"!==typeof Handsontable,container:document.getElementById("hands_on_table")}),e){this.channel=d(this,v)[v]();try{this.handsOnTable=d(this,y)[y]()}catch(n){console.error("[AppendVotersLegacyController] HOT init failed",n)}}}},{key:"validate",value:function(e){e.preventDefault();var t=(0,i.T)();t&&t.ajax("validate",{type:"POST",dataType:"json",data:{headers:this.handsOnTable.getSchema(),rows:this.handsOnTable.getData()}})}},{key:"_cableConnected",value:function(){}},{key:"_cableDisconnected",value:function(){}},{key:"_cableReceived",value:function(e){if("validation"==e.type){var t=(0,i.T)();if(!t)return;var n=t("#validate");"started"==e.status?n.html('<i class="fas fa-check"></i>Validating rows, please wait...'):"done"==e.status&&(t("#voter_list_notices").empty(),n.html('<i class="fas fa-check"></i>Validate list'),e.valid?(t("#download_errors_list").addClass("hide"),t("#create").removeClass("hide"),t("#voter_list_notices").html("<span class='inline_success'>Everything looks good!</span>")):(t("#download_errors_list").removeClass("hide"),t("#create").addClass("hide"),t("#voter_list_notices").html("<span class='inline_error'>There are errors in your list that must be fixed before continuing. Select Download List to view the error and explanation in a spreadsheet. Then, fix the error, and verify by selecting Validate list again.</span>")))}else(e.status="done")&&(window.location.pathname=e.redirect_path)}}],r&&a(n.prototype,r),o&&a(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);function b(){return o.A.subscriptions.create({channel:"AppendVotersChannel",user_id:this.data.get("user-id")},{connected:this._cableConnected.bind(this),disconnected:this._cableDisconnected.bind(this),received:this._cableReceived.bind(this)})}function g(){var e=(0,i.T)();if(e){var t=JSON.parse(this.attributesTarget.getAttribute("data-columns")),n=Number(this.attributesTarget.getAttribute("data-remaining-extra-keys")),r={columns:t,colHeaders:JSON.parse(this.attributesTarget.getAttribute("data-columns-headers")),rowHeaders:JSON.parse(this.attributesTarget.getAttribute("data-row-headers")),minSpareRows:n,maxRows:n,dataSchema:t.reduce(function(e,t){return e[t.data]=null,e},{}),autoWrapRow:!0,autoWrapCol:!0,stretchH:"all",pasteMode:"overwrite",preventOverflow:"horizontal",contextMenu:!1};return new Handsontable(e("#hands_on_table")[0],r)}}m.targets=["attributes"]},6834:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){var e=(0,o.T)();if(e){var t=document.getElementById("questions"),n=document.getElementById("add_question_button");this.addQuestionButtonJqueryObject=e(n),n.addEventListener("click",this.openAddQuestionModal.bind(this)),t.children.length>0||this.openAddQuestionModal()}else console.error("[AutoAddQuestionController] jQuery not available")}},{key:"openAddQuestionModal",value:function(e){e&&e.preventDefault(),this.addQuestionButtonJqueryObject.modal({clickClose:!1})}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},2326:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.applyErrorState(),this.fetchLocation()}},{key:"applyErrorState",value:function(){var e=(0,o.T)();if(e){var t=this.inputTarget;(e(t).hasClass("with_errors")||e(t).siblings().hasClass("with_errors"))&&e(t).parent().children().addClass("with_errors")}}},{key:"fallbackEnableSubmit",value:function(){this.disableTarget.disabled=!1}},{key:"fetchLocation",value:function(){var e=new google.maps.places.Autocomplete(this.inputTarget,{types:["(cities)"]}),t=this;google.maps.event.addDomListener(this.inputTarget,"keydown",function(e){13===e.keyCode&&e.preventDefault()}),google.maps.event.addListener(e,"place_changed",function(n){t.disableTarget.disabled=!0,setTimeout(function(){t.fallbackEnableSubmit()}.bind(t),2e3);var r=e.getPlace(),o={address_components:r.address_components,formatted_address:r.formatted_address,lat:r.geometry.location.lat().toFixed(2),lng:r.geometry.location.lng().toFixed(2),utc_offset:r.utc_offset_minutes};t.outputTarget.value=JSON.stringify(o),t.disableTarget.disabled=!1})}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.targets=["input","output","disable"]},7060:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return(t=l(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function f(e,t,n){return t=p(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}
2function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}n.r(t),n.d(t,{default:function(){return v}});var v=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),f(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.handlePaginationClick=this.handlePaginationClick.bind(this),this.outputTarget.addEventListener("click",this.handlePaginationClick)}},{key:"disconnect",value:function(){this.outputTarget.removeEventListener("click",this.handlePaginationClick)}},{key:"submit",value:function(e){e.preventDefault();var t,n=e.target,r=new URL(n.action),o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}(new FormData(n).entries());try{for(o.s();!(t=o.n()).done;){var i=a(t.value,2),c=i[0],s=i[1];s&&r.searchParams.set(c,s)}}catch(l){o.e(l)}finally{o.f()}this.fetchAndReplace(r.toString())}},{key:"handlePaginationClick",value:function(e){var t=e.target.closest(".pagy-nav a");t&&(e.preventDefault(),this.fetchAndReplace(t.href))}},{key:"fetchAndReplace",value:function(e){var t,n=this;this.outputTarget.style.opacity="0.5";var r=null===(t=document.querySelector('meta[name="csrf-token"]'))||void 0===t?void 0:t.content;fetch(e,{headers:o({Accept:"text/html","X-Requested-With":"XMLHttpRequest"},r&&{"X-CSRF-Token":r}),credentials:"same-origin"}).then(function(e){if(!e.ok)throw new Error("Filter request failed: ".concat(e.status));return e.text()}).then(function(e){n.outputTarget.innerHTML=e,n.outputTarget.style.opacity="1"}).catch(function(e){console.error("[BillingFilter]",e),n.outputTarget.style.opacity="1"})}}],r&&s(n.prototype,r),i&&s(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(n(5396).xI);v.targets=["output"]},3609:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"initialize",value:function(){this.element.addEventListener("input",this.checkCorrectNumberOfChars.bind(this)),this.maxLength=this.element.maxLength,this.helpTextShown=!1,this.helpTextElement=this.element.parentElement.querySelector(".help_text")||this.makeHelpTextElement()}},{key:"makeHelpTextElement",value:function(){var e=document.createElement("span");return e.classList.add("help_text"),this.element.after(e),e}},{key:"checkCorrectNumberOfChars",value:function(e){e.target.value.length>=this.maxLength?(this.element.classList.add("max-length-reached"),this.helpTextShown||this.showCharacterLimitHelpText()):this.element.classList.remove("max-length-reached")}},{key:"showCharacterLimitHelpText",value:function(){this.helpTextShown=!0,this.helpTextElement.innerHTML="Maximum length ".concat(this.maxLength," characters.<br /> ").concat(this.helpTextElement.textContent," ")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI)},4690:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return _}});var r=n(5396),o=n(593),i=n(3455),a=n.n(i);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n){return t=y(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}o.t1.register(o.Bs,o.E8,o.A6,o.P$,o.PP,o.kc,o.pr,o.dN,o.s$,o.hE);var b="556270 4ecec4 c7f464 ff6b6b c44d58 ff8002 ff5c44 ff3f6f e63b95 b94ab2 7b58c2 0060c0".split(" ").map(function(e){return"#".concat(e)}),g=["line-vertical","zigzag","zigzag-vertical","diagonal","diagonal-right-left","line","dot","plus","cross","square","dash","cross-dash","weave","triangle","triangle-inverted","diamond","box","diamond-box","dot-dash","disc","ring"].reduce(function(e,t,n){var r=b[n%b.length];return e.push(a().draw(t,r)),e},[]),w={y:{beginAtZero:!0,ticks:{stepSize:1}}},_=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,i=[{key:"generateLegendOptions",value:function(e,t){var n;return{display:"bar"!==e&&!t.displays_average_scores,labels:{font:{size:16},padding:(null===(n=t.labels)||void 0===n?void 0:n.length)>8?15:10}}}},{key:"truncateLabel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:43,n=String(e||"");return n.length<=t?n:"".concat(n.slice(0,t),"...")}},{key:"wrapLabel",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:65,r=String(e||"");if(r.length<=n)return r;var o=[],i="";
2return r.split(/\s+/).forEach(function(e){t.splitLongWord(e,n).forEach(function(e){i?"".concat(i," ").concat(e).length<=n?i="".concat(i," ").concat(e):(o.push(i),i=e):i=e})}),i&&o.push(i),o}},{key:"splitLongWord",value:function(e,t){if(e.length<=t)return[e];for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}},{key:"previewLabels",value:function(e){var t=this;return(e.labels||[]).map(function(e){return t.truncateLabel(e)})}},{key:"fullLabels",value:function(e){var t=this;return(e.labels||[]).map(function(e){return t.wrapLabel(e)})}},{key:"horizontalBarHeight",value:function(e){if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))return 350;var t=this.fullLabels(e),n=18*Math.max.apply(Math,l(t.map(function(e){return Array.isArray(e)?e.length:1})).concat([1]))+14;return Math.max(350,90+t.length*n)}},{key:"generateHorizontalBarScaleOptions",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t?this.fullLabels(e):this.previewLabels(e),r={callback:function(e){return n[e]||e}},o={ticks:r};return t&&(r.font={size:14},o.afterFit=function(e){var t=.5*e.chart.width;e.width=Math.min(Math.max(e.width,360),t)}),{y:o}}},{key:"generateChartOptions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r={responsive:!0,maintainAspectRatio:!1,plugins:{legend:this.generateLegendOptions(e,t)}};return t.scored&&(1===t.datasets.length&&(r.legend={display:!1}),r.scales={xAxes:[{stacked:!0}],yAxes:[{stacked:!0}]}),"horizontalBar"===e&&(r.indexAxis="y",r.scales=c(c({},r.scales),this.generateHorizontalBarScaleOptions(t,n))),t.displays_average_scores&&(r.plugins=r.plugins||{},r.plugins.title={text:window.I18n&&window.I18n.exists&&window.I18n.exists("pages.vote.results.question.average_score")?window.I18n.t("pages.vote.results.question.average_score"):"Average Score",display:!0}),r}}],(r=[{key:"initialize",value:function(){o.t1.defaults.font.family="Lato",o.t1.defaults.font.size=20}},{key:"connect",value:function(){window.EB.charts=window.EB.charts||[],window.EB.charts.push(this),this.chartNode=this.canvasTargets[0],this.chartData=JSON.parse(this.chartNode.dataset.chartData);var e=this.chartData;if(this.chartType=this.chartNode.dataset.chartType,this.showFullHorizontalBarLabels=!1,!["bar","pie","horizontalBar"].includes(this.chartType))throw new Error("Unexpected chart type: "+this.chartType);var t=this.constructor.generateChartOptions(this.chartType,e,this.showFullHorizontalBarLabels);this.setHorizontalBarHeight(),this.updateFullLabelsButton(),this.chartArgs={type:"pie"!=this.chartType?"bar":"pie",data:e,options:t},this.setBackground("true"===this.chartNode.dataset.chartPatterns),this.setScale(),this.chart=new o.t1(this.chartNode,this.chartArgs)}},{key:"setBackground",value:function(e){var t=e?g:[].concat(l(b),l(g));if(this.chartData.is_scored_survey)this.chartData.datasets.forEach(function(e){var n=e.data.map(function(){return t[(e.score-1)%t.length]});e.backgroundColor=n});else{var n=this.chartData.datasets[0].data.map(function(e,n){return t[n%t.length]});this.chartData.datasets.forEach(function(e){e.backgroundColor=n})}}},{key:"setScale",value:function(){"horizontalBar"!==this.chartType&&(this.chartArgs.options.scales="bar"===this.chartType?w:{})}},{key:"setHorizontalBarHeight",value:function(){"horizontalBar"===this.chartType&&(this.chartNode.parentElement.style.height="".concat(this.constructor.horizontalBarHeight(this.chartData,this.showFullHorizontalBarLabels),"px"))}},{key:"toggleFullLabels",value:function(e){e.preventDefault(),"horizontalBar"===this.chartType&&(this.show
2FullHorizontalBarLabels=!this.showFullHorizontalBarLabels,this.chartArgs.options=this.constructor.generateChartOptions(this.chartType,this.chartData,this.showFullHorizontalBarLabels),this.chart.options=this.chartArgs.options,this.setHorizontalBarHeight(),this.updateFullLabelsButton(),this.chart.update())}},{key:"updateFullLabelsButton",value:function(){if(this.hasFullLabelsButtonTarget){var e=this.fullLabelsButtonTarget;e.textContent=this.showFullHorizontalBarLabels?e.dataset.hideLabel:e.dataset.showLabel,e.setAttribute("aria-pressed",this.showFullHorizontalBarLabels.toString())}}},{key:"redraw",value:function(e){this.chart.reset(),e.type&&"horizontalBar"!==this.chartArgs.type&&(this.chartType=e.type,this.chartArgs.type=e.type,this.setScale()),"boolean"==typeof e.patterns&&this.setBackground(e.patterns),this.chart.update(this.chartArgs),this.chart.render()}}])&&d(n.prototype,r),i&&d(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);_.targets=["canvas","fullLabelsButton"]},9367:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.hasParentTarget&&this.hasChildTarget&&this.updateChildState()}},{key:"toggleChild",value:function(){this.updateChildState()}},{key:"updateChildState",value:function(){if(this.hasParentTarget&&this.hasChildTarget){var e=this.parentTarget.checked;this.childTarget.disabled=!e,e||(this.childTarget.checked=!1),this.hasHelpTextTarget&&(this.helpTextTarget.style.display=e?"none":"block")}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["parent","child","helpText"]},2666:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"copy",value:function(){var e=this;navigator.clipboard.writeText(this.textValue).then(function(){var t=e.element.querySelector("button");if(t){var n=t.textContent;t.textContent="Copied!",setTimeout(function(){t.textContent=n},2e3)}})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={text:String}},3865:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return h}});var r=n(5396),o=n(5404);function i(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function u(n,r,o,i){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return a(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(a(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,a(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,a(p,"constructor",f),a(f,"constructor",l),l.displayName="GeneratorFunction",a(f,o,"GeneratorFunction"),a(p),a(p,o,"Generator"),a(p,r,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(i=function(){return{w:u,m:h}})()}function a(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}a=function(e,t,n,r){function i(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},a(e,t,n,r)}function u(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}
2function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,r=[{key:"connect",value:function(){this.confirmed=!1}},{key:"confirm",value:(s=i().m(function e(t){return i().w(function(e){for(;;)switch(e.n){case 0:if(!this.confirmed){e.n=1;break}return e.a(2);case 1:return t.preventDefault(),e.n=2,(0,o.j)({title:this.hasTitleValue?this.titleValue:void 0,danger:this.messageValue,confirmLabel:this.hasConfirmLabelValue?this.confirmLabelValue:void 0});case 2:if(e.v){e.n=3;break}return e.a(2);case 3:this.confirmed=!0,this.element.requestSubmit();case 4:return e.a(2)}},e,this)}),f=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function i(e){u(o,n,r,i,a,"next",e)}function a(e){u(o,n,r,i,a,"throw",e)}i(void 0)})},function(e){return f.apply(this,arguments)})}],r&&c(n.prototype,r),a&&c(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,s,f}(r.xI);h.values={message:String,title:String,confirmLabel:String}},1211:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"copy",value:function(e){this.copyToClipboard(this.element.dataset.textToCopy.trim()),clearTimeout(this.timeout),this.timeout=setTimeout(this._setInnerHTMLFunc(this.element,this.element.innerHTML),1e3);var t=this.element.dataset.copiedAlternate?this.htmlDecode(this.element.dataset.copiedAlternate):"Copied!";this.element.innerHTML=t}},{key:"htmlDecode",value:function(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}},{key:"copyToClipboard",value:function(e){if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(e);else{var t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("Copy"),t.remove()}}},{key:"_setInnerHTMLFunc",value:function(e,t){return function(){e.innerHTML=t}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI)},1474:function(e,t,n){"use strict";function r(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,o,a){var u=r&&r.prototype instanceof s?r:s,l=Object.create(u.prototype);return i(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,d.n=n,c}};function p(n,r){for(a=n,u=r,t=0;!f&&s&&!o&&t<l.length;t++){var o,i=l[t],p=d.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),a=l,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(d.n=-1),p(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),p=f.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=f,i(p,"constructor",f),i(f,"constructor",l),l.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){a(i,r,o,u,c,"next",e)}function c(e){a(i,r,o,u,c,"throw",e)}u(void 0)})}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}n.r(t),n.d(t,{default:function(){return h}});var h=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,i=[{key:"copyUrl",value:(f=u(o().m(function e(t){var n,r,i,a;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.currentTarget,i=null!==(n=r.dataset.url)&&void 0!==n?n:"",e.p=1,e.n=2,navigator.clipboard.writeText(i);case 2:e.n=4;break;case 3:e.p=3,e.v,(a=document.createElement("textarea")).value=i,document.body.appendChild(a),a.select(),document.execCommand("copy"),a.remove();case 4:this.flashCopied(r);case 5:return e.a(2)}},e,this,[[1,3]])}
2)),function(e){return f.apply(this,arguments)})},{key:"copyQr",value:(s=u(o().m(function e(t){var n,i,a,u,c,s;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.currentTarget,i=n.closest("[data-elections--voting-links-modal-panel]"),a=null===i||void 0===i?void 0:i.querySelector("img")){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,fetch(a.src);case 2:return u=e.v,e.n=3,u.blob();case 3:return c=e.v,e.n=4,navigator.clipboard.write([new ClipboardItem(r({},c.type,Promise.resolve(c)))]);case 4:this.flashCopied(n),e.n=6;break;case 5:e.p=5,s=e.v,console.error("QR copy failed",s);case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return s.apply(this,arguments)})},{key:"flashCopied",value:function(e){var t,n=null!==(t=e.textContent)&&void 0!==t?t:"";e.textContent="Copied!",setTimeout(function(){e.textContent=n},1e3)}}],i&&c(n.prototype,i),a&&c(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,i,a,s,f}(n(5396).xI)},2932:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.handleModalClick=this.handleModalClick.bind(this),document.addEventListener("click",this.handleModalClick,!0)}},{key:"disconnect",value:function(){document.removeEventListener("click",this.handleModalClick,!0)}},{key:"handleModalClick",value:function(e){var t=e.target.closest('a[rel~="iframe:open"]');if(t){e.preventDefault(),e.stopImmediatePropagation();var r=t.getAttribute("href"),i=document.createElement("div");i.className="modal";var a=document.createElement("iframe");a.src=r,a.style.display="none",a.style.border="none";var u=document.createElement("div");u.innerHTML='\n      <div class="modal-loading-wrapper">\n        <div class="modal-spinner show">\n          <div class="rect1"></div>\n          <div class="rect2"></div>\n          <div class="rect3"></div>\n          <div class="rect4"></div>\n        </div>\n      </div>\n    ',i.appendChild(u.firstElementChild),i.appendChild(a),document.body.appendChild(i);var c=(0,o.T)();c&&c.fn.modal&&c(i).modal(),a.addEventListener("load",function(){if(i.isConnected){var e=i.querySelector(".modal-loading-wrapper");e&&e.remove(),a.style.display="block";try{var t=a.contentWindow.document.body.scrollHeight+10;a.height=t+"px"}catch(n){a.height="600px"}}})}}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},2727:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,o=[{key:"connect",value:function(){var e=this;this.clearError(),this.setFilenameColumnWidth(),window.addEventListener("resize",this._handleResize=function(){e.setFilenameColumnWidth()})}},{key:"disconnect",value:function(){this._handleResize&&window.removeEventListener("resize",this._handleResize)}},{key:"deleteExisting",value:function(e){var t=e.currentTarget.closest('[data-organization--meeting-vote-attachments-target="item"]');if(t){var n=t.querySelector('[data-organization--meeting-vote-attachments-target="destroyField"]');n&&(n.value="1"),t.classList.add("is-marked-for-deletion"),t.setAttribute("aria-hidden","true"),this.setFilenameColumnWidth()}}},{key:"validateFile",value:function(e){var t=this,n=e.currentTarget;if(!n.files||0===n.files.length)return this.clearError(),this.setFilenameColumnWidth(),void this._toggleSave(!1);var r=n.files[0];if((this.element.getAttribute("data-allowed-types")||"").split(",").map(function(e){return e.trim()}
2).filter(Boolean).includes(r.type)){if(this.clearError(),this.hasDisplayNameTarget){if(!this.displayNameTarget.value||""===this.displayNameTarget.value.trim()){var o=r.name.replace(/\.[^.]+$/,"");this.displayNameTarget.value=o}requestAnimationFrame(function(){t.displayNameTarget.focus(),t.displayNameTarget.select()})}this.setFilenameColumnWidth(),this._toggleSave(!0)}else this.showError("File format not supported"),n.value="",this.setFilenameColumnWidth(),this._toggleSave(!1)}},{key:"saveFile",value:function(){var e=this.element.closest("form");e&&(e.requestSubmit?e.requestSubmit():e.submit(),this.hasSaveButtonTarget&&(this.saveButtonTarget.disabled=!0))}},{key:"_toggleSave",value:function(e){this.hasUploadLabelTarget&&this.uploadLabelTarget.classList.toggle("is-hidden",e),this.hasSaveButtonTarget&&(this.saveButtonTarget.classList.toggle("is-hidden",!e),e||(this.saveButtonTarget.disabled=!1))}},{key:"setFilenameColumnWidth",value:function(){if(this.hasItemTarget){var e=this.itemTargets.filter(function(e){return!e.classList.contains("is-marked-for-deletion")});e.forEach(function(e){var t=e.querySelector(".list-filename");t&&(t.style.width="auto")});var t=0;if(e.forEach(function(e){var n=e.querySelector(".list-filename");if(n){var r=n.offsetWidth;r>t&&(t=r)}}),0!==t){var n=t;e.forEach(function(e){var t=e.querySelector(".list-filename");t&&(t.style.width=n+"px")})}}}},{key:"showError",value:function(e){this.hasErrorTarget&&(this.errorTarget.textContent=e,this.errorTarget.classList.remove("is-hidden"))}},{key:"clearError",value:function(){this.hasErrorTarget&&(this.errorTarget.textContent="",this.errorTarget.classList.add("is-hidden"))}}],o&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["destroyField","item","fileInput","error","displayName","uploadLabel","saveButton"]},6821:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.disable()}},{key:"validate",value:function(){if(this.hasInputTarget&&this.hasSubmitTarget){var e="DELETE"===this.inputTarget.value;this.submitTarget.disabled=!e}}},{key:"disable",value:function(){this.hasSubmitTarget&&(this.submitTarget.disabled=!0)}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["input","submit"]},9084:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"trigger",value:function(e){var t=e.target.closest("form");t&&t.requestSubmit()}},{key:"sanitizeTypedValue",value:function(e){var t=e.target;t&&(t.value=t.value.replace(/[^0-9]/g,""),t.classList.contains("percent-value")&&parseInt(t.value,10)>100&&(t.value="100"))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},6920:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(3430);function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e,t,n){return t=f(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),s(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){this.element.dataset.disableReorder||(this.count=0,this.selectedIds=[],this.rowObjects={},this.rowOrder=[],this.reorderModeOn=!1,this.element.parentNode.style.position="relative",this.tableBody=this.element.querySelector("tbody"),this.element.classList.add("reoderable_table_controller"),this.cloneTable(),this.createPlaceHolderElement(),this.indexRows(),this.setupStartReorderModeButton(),this.setupEndReorderModeButton(),this.createMultipleRowsAreSelectableMessage())}},{key:"setupStartReorderModeButton",value:function(){this.startReorderButtonTarget.addEventListener("click",this.startReorderMode.bind(this)),this.startReorderButtonTarget.classList.remove("hide"),this.startReorderButtonIcon=this.startReorderButtonTarget.querySelector("i"),this.startReorderButtonText=this.startReorderButtonTarget.querySelector("span")}},{key:"setupEndReorderModeButton",value:function(){this.endReorderButtonTarget.addEventListener("click",this.handleSaveChangesButtonClick.bind(this)),this.endReorderButtonTarget.classList.add("hide"),this.endReorderButtonIcon=this.endReorderButtonTarget.querySelector("i"),this.endReorderButtonText=this.endReorderButtonTarget.querySelector("span")}},{key:"createMultipleRowsAreSelectableMessage",value:function(){this.multipleRowsAreSelectableMessage=document.createElement("span"),this.multipleRowsAreSelectableMessage.classList.add("multiple-Selectable-Message"),this.multipleRowsAreSelectableMessage.textContent="Select 1 or more votes then reorder",this.startReorderButtonTarget.parentNode.insertBefore(this.multipleRowsAreSelectableMessage,this.startReorderButtonTarget)}},{key:"createPlaceHolderElement",value:function(){this.placeHolderElement=this.tableBody.querySelectorAll("tr")[0].cloneNode(!0),this.placeHolderElement.classList.add("dragging-placeholder")}},{key:"createRowObject",value:function(e,t){var n={},r=e.dataset.voteId;this.rowOrder.push(r),n.id=r,n.position=t,n.originalElement=e,n.cloneElement=this.draggingTable.querySelector('tr[data-vote-id="'.concat(r,'"]')),n.cloneElement.remove(),this.rowObjects[r]=n}},{key:"indexRows",value:function(){var e=this;this.allRows=this.tableBody.querySelectorAll("tr"),this.allRows.forEach(this.createRowObject.bind(this));var t=Object.entries(this.rowObjects).map(function(e){return e[1]});t.forEach(function(t){return e.addRowEventListeners(t)}),this.originalRowsOrder=t.map(function(e){return e.id}),this.latestRowsOrder=i(this.originalRowsOrder),document.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.element.addEventListener("mousemove",this.positionDraggingTable.bind(this)),this.allRowsCheckboxes=this.element.querySelectorAll('input[type="checkbox"]'),this.allHandleButtons=[],this.allRowsCheckboxes.forEac
2h(function(t){var n=document.createElement("button"),r=document.createElement("i");n.classList="btn btn--dark-blue btn--with-icon btn--only-icon btn--small hide",r.classList="fas fa-sort reorderable-table-handle-icons",n.appendChild(r),e.allHandleButtons.push(n),t.parentElement.appendChild(n)})}},{key:"addRowEventListeners",value:function(e){var t=e.originalElement;t.addEventListener("click",this.handleRowClick.bind(this)),t.querySelector("td:first-of-type").addEventListener("mousedown",this.handleDragStart.bind(this)),t.addEventListener("mousemove",this.handleDrag.bind(this)),t.addEventListener("mouseup",this.handleDragEnd.bind(this))}},{key:"cloneTable",value:function(){this.rectDimensions=this.element.getBoundingClientRect(),this.tableWidth=parseInt(window.getComputedStyle(this.element).width,10),this.list=document.createElement("div"),this.list.style.left="".concat(this.rectDimensions.left,"px"),this.list.style.top="".concat(this.rectDimensions.top,"px"),this.list.classList.add("dragging-list"),this.element.parentNode.insertBefore(this.list,this.element),this.draggingTable=this.tableBody.cloneNode(!0),this.draggingTable.classList.add("hide"),this.draggingTable.querySelectorAll("[id]").forEach(function(e){e.id="".concat(e.id,"_cloned")});var e=this.tableBody.querySelectorAll("tr:first-of-type td");this.draggingTable.querySelectorAll("tr").forEach(function(t){t.querySelectorAll("td").forEach(function(t,n){t.style.width="".concat(e[n].clientWidth,"px")})}),this.list.appendChild(this.draggingTable)}},{key:"handleRowClick",value:function(e){var t=e.target;if(this.reorderModeOn){var n=t.closest("tr").dataset.voteId,r=this.rowObjects[n];this.selectedIds.includes(n)?this.unselectRow(r):this.selectRow(r)}}},{key:"selectRow",value:function(e){this.selectedIds.includes(e.id)||(this.selectedIds.push(e.id),e.selected=!0,e.originalElement.classList.add("selected-for-reorder"),this.draggingTable.appendChild(e.cloneElement))}},{key:"unselectRow",value:function(e){e.selected=!1,e.originalElement.classList.remove("selected-for-reorder"),e.cloneElement.remove()}},{key:"handleDragStart",value:function(e){var t=e.target;if(this.reorderModeOn){this.dragInProgress=!0,this.draggingTable.classList.remove("hide");var n=t.closest("tr");n.classList.add("selected-for-reorder"),this.element.classList.add("dragInProgress"),this.draggingRowIndex=[].slice.call(this.element.querySelectorAll("tr")).indexOf(n)}}},{key:"handleDrag",value:function(e){var t=this,n=e.target,r=e.clientY;if(this.reorderModeOn&&this.dragInProgress){var o=n.closest("tr");if(o){var i=o.dataset.voteId,a=this.rowObjects[i];0==this.selectedIds.length&&this.selectRow(this.rowObjects[i]);var u=n.getBoundingClientRect(),c=u.top,s=u.height/3;r-c<s?this.placeHolderIdealPosition="before":2*s&&(this.placeHolderIdealPosition="after"),a.hasPlaceholder&&this.placeHolderCurrentPosition===this.placeHolderIdealPosition||this.insertPlaceHolder(i),this.selectedIds.forEach(function(e){return t.rowObjects[e].originalElement.classList.add("being-dragged")})}}}},{key:"positionDraggingTable",value:function(e){var t=e.clientY,n=e.clientX;if(this.reorderModeOn&&this.dragInProgress){this.list.classList.remove("hide");var r=t-this.rectDimensions.top+window.pageYOffset,o=n-this.rectDimensions.left;this.list.style.left="".concat(o,"px"),this.list.style.top="".concat(r,"px")}}},{key:"insertPlaceHolder",value:function(e){var t=this.rowObjects[e].originalElement;"before"==this.placeHolderIdealPosition&&t.parentElement.insertBefore(this.placeHolderElement,t),"after"==this.placeHolderIdealPosition&&(this.isLastRowId(e)?this.tableBody.appendChild(this.placeHolderElement):t.parentElement.insertBefore(this.placeHolderElement,t.nextElementSibling)),this.placeHolderCurrentPosition=this.placeHolderIdealPosition,this.rowWithPlaceHolder=e}},{key:"isLastRowId",value:function(e){this.rowOrder[this.rowOrder.length-1]}},{key:"handleDragEnd",value:function(){var e=this;this.reorderModeOn&&this.dragInProgress&&(this.draggingTable.classList.add("hide"),this.element.classList.remove("dragInProgress"),this.selectedIds.forEach(function(t){return e.rowObjects[t].originalElement.classList.remove("being-dragged")}),this.dragInProgress=!1,0!=this.selectedIds.length&&(this.selectedIds.forEach(function(t){var n=e.rowObjects[t];e.placeHolderElement.parentElement.insertBefore(n.originalElement,e.placeHolderElement),e.unselectRow(n)}),this.placeHolderElement.remove(),this.selectedIds=[],this.latestRowsOrder=Array.from(this.tableBody.querySelectorAll("tr")).map(function(e){return e.dataset.voteId})))}},{key:"toggleReorderMode",value:function(){this.reorderModeOn?this.handleSaveChangesButtonClick():this.startReorderMode()}},{key:"startReorderMode",value:function(){this.reorderModeOn=!0,this.element.classList.add("in-reorder-mode"),this.changeToggleButtonsVisiblity(),this.allRowsCheckboxes.forEac
2h(function(e){e.labels.forEach(function(e){return e.classList.add("hide")})}),this.allHandleButtons.forEach(function(e){e.classList.remove("hide")})}},{key:"handleSaveChangesButtonClick",value:function(){var e=this;if(this.element.classList.remove("in-reorder-mode"),this.allRowsCheckboxes.forEach(function(e){e.labels.forEach(function(e){return e.classList.remove("hide")})}),this.allHandleButtons.forEach(function(e){e.classList.add("hide")}),this.selectedIds.forEach(function(t){e.rowObjects[t].originalElement.classList.remove("selected-for-reorder")}),0==this.orderHasChanged())return this.endReorderMode(),void(this.selectedIds=[]);this.showUpdateInProgress(),o.A.get(this.element.dataset.updatePath,{params:{votes_in_order:this.latestRowsOrder,offset:parseInt(this.element.dataset.offset,10)},headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').getAttribute("content")}}).then(function(t){e.originalRowsOrder=e.latestRowsOrder,e.showUpdateSuccess(),e.endReorderMode()}).catch(function(t){e.showUpdateFailure()})}},{key:"endReorderMode",value:function(){this.reorderModeOn=!1,this.changeToggleButtonsVisiblity()}},{key:"changeToggleButtonsVisiblity",value:function(){this.reorderModeOn?(this.startReorderButtonTarget.classList.add("hide"),this.endReorderButtonTarget.classList.remove("hide")):(this.startReorderButtonTarget.classList.remove("hide"),this.endReorderButtonTarget.classList.add("hide"))}},{key:"showUpdateInProgress",value:function(){this.endReorderButtonText.textContent="Saving Changes",this.endReorderButtonIcon.classList.remove("fa-exclamation-circle","fa-bars"),this.endReorderButtonIcon.classList.add("fa-spinner")}},{key:"showUpdateSuccess",value:function(){this.startReorderButtonIcon.classList.add("fa-check"),this.startReorderButtonIcon.classList.remove("fa-sort"),setTimeout(this.clearUpdateSuccessOrFailureMessage.bind(this),2e3)}},{key:"showUpdateFailure",value:function(){this.endReorderButtonIcon.classList.add("fa-exclamation-circle"),this.endReorderButtonIcon.classList.remove("fa-bars","fa-spinner"),this.endReorderButtonText.textContent="Update failed, try again",setTimeout(this.clearUpdateSuccessOrFailureMessage.bind(this),4e3)}},{key:"clearUpdateSuccessOrFailureMessage",value:function(){this.endReorderButtonIcon.classList.remove("fa-exclamation-circle","fa-spinner"),this.endReorderButtonIcon.classList.add("fa-bars"),this.endReorderButtonText.textContent="Save Order",this.startReorderButtonIcon.classList.remove("fa-check"),this.startReorderButtonIcon.classList.add("fa-sort"),this.startReorderButtonText.textContent="Reorder Votes"}},{key:"orderHasChanged",value:function(){var e=this.latestRowsOrder;return this.originalRowsOrder.length!==e.length||this.originalRowsOrder.reduce(function(t,n,r){return 1==t||!(n==e[r])},!1)}}])&&u(n.prototype,r),a&&u(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);p.targets=["startReorderButton","endReorderButton"]},9726:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}
2function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).observer=void 0,e.timer=void 0,e.onFrameLoad=function(){return e.frameLoaded()},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.element.addEventListener("turbo:frame-load",this.onFrameLoad),this.observer=new IntersectionObserver(this.onIntersect.bind(this),{rootMargin:"".concat(this.marginValue," 0px")}),this.observer.observe(this.element)}},{key:"disconnect",value:function(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.element.removeEventListener("turbo:frame-load",this.onFrameLoad),this.timer&&clearTimeout(this.timer)}},{key:"retry",value:function(){var e;null===(e=this.errorElement())||void 0===e||e.remove(),this.revealSkeleton(),delete this.element.dataset.lazyLoadFailures,this.load()}},{key:"onIntersect",value:function(e){var t;e.some(function(e){return e.isIntersecting})&&(null===(t=this.observer)||void 0===t||t.disconnect(),this.load())}},{key:"load",value:function(){var e=this;this.element.src?this.element.reload():this.element.src=this.srcValue,this.timer=setTimeout(function(){return e.fail(0)},this.backoffDelay())}},{key:"frameLoaded",value:function(){if(this.timer&&clearTimeout(this.timer),this.loadedEmpty())return this.fail(this.backoffDelay());delete this.element.dataset.lazyLoadFailures}},{key:"fail",value:function(e){var t=this,n=this.failures()+1;if(this.element.dataset.lazyLoadFailures=String(n),n>=this.maxFailuresValue)return this.renderError();this.timer=setTimeout(function(){return t.load()},e)}},{key:"backoffDelay",value:function(){return this.timeoutValue*Math.pow(this.backoffValue,this.failures())}},{key:"loadedEmpty",value:function(){return Array.from(this.element.children).every(function(e){return"true"===e.dataset.resultsFrameError})}},{key:"renderError",value:function(){if(!this.errorElement()){Array.from(this.element.children).forEach(function(e){e.hidden=!0});var e=document.createElement("div");e.className="results-processing-banner",e.setAttribute("role","alert"),e.dataset.resultsFrameError="true";var t=document.createElement("p");t.textContent=f("js.results.frame_error.message","These results could not be loaded. Check your connection and try again.");var n=document.createElement("button");n.type="button",n.className="btn btn--blue-stroke btn--small",n.dataset.action="".concat(this.identifier,"#retry"),n.textContent=f("js.results.frame_error.retry","Try again"),e.append(t,n),this.element.append(e)}}},{key:"revealSkeleton",value:function(){Array.from(this.element.children).forEach(function(e){e.hidden=!1})}},{key:"errorElement",value:function(){return this.element.querySelector("[data-results-frame-error]")}},{key:"failures",value:function(){return Number(this.element.dataset.lazyLoadFailures||0)}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);function f(e,t){var n,r=window.I18n;return null!==r&&void 0!==r&&null!==(n=r.exists)&&void 0!==n&&n.call(r,e)?r.t(e):t}l.values={src:String,margin:{type:String,default:"100%"},timeout:{type:Number,default:2e4},backoff:{type:Number,default:1.4},maxFailures:{type:Number,default:5}}},4885:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}
2function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=a(this,t,[].concat(r))).timer=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this.frame();e&&e.src&&(e.dataset.warmPollFailures="0",this.schedule(e))}},{key:"disconnect",value:function(){this.timer&&clearTimeout(this.timer)}},{key:"schedule",value:function(e){var t=this;if(Number(e.dataset.warmPollFailures||0)>=this.maxFailuresValue)this.renderError();else{var n=Number(e.dataset.warmPollAttempt||0),r=n>=this.maxAttemptsValue?this.slowIntervalValue:this.intervalValue*Math.pow(this.backoffValue,n);this.timer=setTimeout(function(){return t.reload(e,n)},r)}}},{key:"reload",value:function(e,t){e.dataset.warmPollAttempt=String(t+1),e.dataset.warmPollFailures=String(Number(e.dataset.warmPollFailures||0)+1),e.reload(),this.schedule(e)}},{key:"retry",value:function(){var e,t=this.frame();t&&(null===(e=this.errorElement())||void 0===e||e.remove(),this.hasPendingTarget&&(this.pendingTarget.hidden=!1),this.element.dataset.resultsPending="true",t.dataset.warmPollAttempt="0",t.dataset.warmPollFailures="0",t.reload(),this.schedule(t))}},{key:"renderError",value:function(){if(!this.errorElement()){this.hasPendingTarget&&(this.pendingTarget.hidden=!0),delete this.element.dataset.resultsPending;var e=document.createElement("div");e.className="results-processing-banner",e.setAttribute("role","alert"),e.dataset.resultsFrameError="true";var t=document.createElement("p");t.textContent=f("js.results.frame_error.message","These results could not be loaded. Check your connection and try again.");var n=document.createElement("button");n.type="button",n.className="btn btn--blue-stroke btn--small",n.dataset.action="".concat(this.identifier,"#retry"),n.textContent=f("js.results.frame_error.retry","Try again"),e.append(t,n),this.element.append(e)}}},{key:"errorElement",value:function(){return this.element.querySelector("[data-results-frame-error]")}},{key:"frame",value:function(){return this.element.closest("turbo-frame")}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);function f(e,t){var n,r=window.I18n;return null!==r&&void 0!==r&&null!==(n=r.exists)&&void 0!==n&&n.call(r,e)?r.t(e):t}l.values={interval:{type:Number,default:3e3},backoff:{type:Number,default:1.4},maxAttempts:{type:Number,default:8},slowInterval:{type:Number,default:3e4},maxFailures:{type:Number,default:8}},l.targets=["pending"]},6745:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).timer=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this.frame();e&&e.src&&this.schedule(e)}},{key:"disconnect",value:function(){this.timer&&clearTimeout(this.timer)}},{key:"schedule",value:function(e){var t=this,n=this.intervalValue*(.9+.2*Math.random());this.timer=setTimeout(function(){t.weightSwitchOff()||e.reload(),t.schedule(e)},n)}},{key:"weightSwitchOff",value:function(){return!!this.element.querySelector('[data-weight-switch-checked="false"]')}},{key:"frame",value:function(){return this.element.closest("turbo-frame")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={interval:{type:Number,default:6e4}}},978:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).onFrameLoad=function(t){return e.frameLoaded(t)},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){document.addEventListener("turbo:frame-load",this.onFrameLoad)}},{key:"disconnect",value:function(){document.removeEventListener("turbo:frame-load",this.onFrameLoad)}},{key:"frameLoaded",value:function(e){var t=this.frame();if(t&&t.src){var n=e.target;if(n&&n!==t&&n.querySelector("[data-results-ready]")){var r=Date.now();r-Number(t.dataset.overviewSyncedAt||0)<this.minIntervalValue||(t.dataset.overviewSyncedAt=String(r),t.reload())}}}},{key:"frame",value:function(){return this.element.closest("turbo-frame")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={minInterval:{type:Number,default:1e4}}},3045:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).timer=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){var e=this;this.timer=setInterval(function(){return e.checkPending()},this.intervalValue)}},{key:"disconnect",value:function(){this.timer&&clearInterval(this.timer)}},{key:"checkPending",value:function(){document.querySelector("[data-results-ready]")&&(document.querySelector("[data-results-pending]")||(this.timer&&clearInterval(this.timer),this.element.hidden=!0))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.values={interval:{type:Number,default:2e3}}},182:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.syncVoterOptions()}},{key:"syncVoterOptions",value:function(){var e=this.adminRadioTargets.find(function(e){return e.checked}),t=!e||"after"===e.value;this.voterBeforeOptionTarget.disabled=t,t&&this.voterBeforeOptionTarget.checked&&(this.voterBeforeOptionTarget.checked=!1,this.hasVoterAfterOptionTarget&&(this.voterAfterOptionTarget.checked=!0))}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["adminRadio","voterBeforeOption","voterAfterOption"]},2037:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=(0,o.T)();e&&e("body").css("overflow","auto !important")}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},1511:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return b}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function l(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var f=0;function d(e){return"__private_"+f+++"_"+e}var p=d("keyFormatSpec"),h=d("focusAccessKeyInput"),v=d("syncCallback"),y=d("keyIsInAnUnexpectedFormat"),m=d("parseKeyFormatSpec"),b=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=a(this,t,[].concat(r)),Object.defineProperty(e,m,{value:O}),Object.defineProperty(e,y,{value:_}),Object.defineProperty(e,v,{value:w}),Object.defineProperty(e,h,{value:g}),Object.defineProperty(e,p,{writable:!0,value:void 0}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){l(this,p)[p]=l(this,m)[m](),this.accessKeyInputTarget.addEventListener("input",l(this,v)[v]()),l(this,h)[h]()}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI);function g(){var e=this;setTimeout(function(){e.hasAccessKeyInputTarget&&e.accessKeyInputTarget.focus()},10)}function w(){var e=this;return function(){e.submitTarget.disabled=l(e,y)[y]()}}function _(){if(!l(this,p)[p])return!1;var e=l(this,p)[p].chunkSize*l(this,p)[p].chunkCount;return this.accessKeyInputTarget.value.replaceAll(l(this,p)[p].separator,"").length!==e}function O(){var e={separator:this.data.get("access-key-separator"),chunkSize:parseInt(this.data.get("access-key-chunk-size"),10),chunkCount:parseInt(this.data.get("access-key-chunk-count"),10)};return"string"!==typeof e.separator||isNaN(e.chunkSize)||isNaN(e.chunkCount)?null:e}b.targets=["accessKeyInput","submit"]},1240:function(e,t,n){"use strict";n.r(t);var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f,d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"initialize",value:function(){t.doCheck()}}])&&i(n.prototype,r),o&&i(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(r.xI);d.doCheck=(f=!1,function(){f||(f=!0,setTimeout(function(){if(!window.Stripe){var e=(0,o.T)();e&&e("<div class='modal'><p>Unable to connect to the payment server. Please reload the page and try again.</p><div class='actions'><a class='btn btn--orange' onClick='window.location.reload()'>Reload</a></div></div>").appendTo("body").modal()}},1e4))}),t.default=d},8851:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=window.NProgress,d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.syncSwitch()}},{key:"load",value:function(e){var t=this,n=(0,o.T)();n?n.get(this.data.get("url"),{survey:e},function(n){t.element.innerHTML=n,t.checked=e,t.syncSwitch(),f.done()}):console.error("[SurveySwitchController] jQuery not available")}},{key:"toggle",value:function(e){f.start(),this.load(e.target.checked)}},{key:"checked",get:function(){return"true"===this.data.get("checked")},set:function(e){this.data.set("checked",e?"true":"false"),this.syncSwitch()}},{key:"syncSwitch",value:function(){this.switchTarget.checked=this.checked}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);d.targets=["switch"]},5334:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.update()}},{key:"update",value:function(){var e=this.inputTarget.value;this.outputTarget.textContent=e,this.previewTarget.classList.toggle("hide",""===e.trim())}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["input","output","preview"]},7622:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396),o=n(9403);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=u(this,t,[].concat(r))).scrollToResults=function(){requestAnimationFrame(function(){setTimeout(function(){var e=document.getElementById("importation-results");e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100)})},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this;this.urlValue&&setTimeout(function(){e.navigateToResults()},this.delayValue)}},{key:"navigateToResults",value:function(){document.addEventListener("turbo:load",this.scrollToResults,{once:!0}),o.V.visit(this.urlValue)}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);f.values={url:String,delay:{type:Number,default:1500}}},5506:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"handleSubmit",value:function(){this.submitButtonTarget.disabled=!0,this.submitButtonTarget.innerHTML='<i class="fa fa-spinner fa-spin"></i> Uploading\u2026',this.hasStatusTextTarget&&(this.statusTextTarget.hidden=!1);var e=this.element.querySelector(".voter-list__ai-importer__content");e&&(e.style.transition="opacity 0.4s ease, transform 0.4s ease",e.style.opacity="0",e.style.transform="scale(0.97)")}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["submitButton","statusText"]},3827:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}
2function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).observer=null,e.currentHeight=0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.currentHeight=this.element.clientHeight,this.observeFrameChanges()}},{key:"disconnect",value:function(){var e;null===(e=this.observer)||void 0===e||e.disconnect()}},{key:"observeFrameChanges",value:function(){var e=this;this.observer=new MutationObserver(function(){e.animateHeightTransition()}),this.observer.observe(this.element,{childList:!0,subtree:!0,attributes:!1})}},{key:"animateHeightTransition",value:function(){var e=this.element,t=this.currentHeight,n=e.scrollHeight;t>0&&Math.abs(n-t)>20&&(e.style.height="".concat(t,"px"),e.style.overflow="hidden",e.style.transition="height 0.5s ease",requestAnimationFrame(function(){e.style.height="".concat(n,"px");var t=function(){e.style.height="",e.style.overflow="",e.style.transition="",e.removeEventListener("transitionend",t)};e.addEventListener("transitionend",t,{once:!0}),setTimeout(t,600)})),this.currentHeight=n}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI)},8727:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"filter",value:function(e){var t=e.currentTarget,n=t.dataset.voterListAiWarningsFilterTypeParam;this.filtersTarget.querySelectorAll("button").forEach(function(e){e.classList.remove("voter-list__ai-warnings__filter-btn--active")}),t.classList.add("voter-list__ai-warnings__filter-btn--active"),this.listTarget.querySelectorAll(".voter-list__ai-warnings__item").forEach(function(e){"all"===n||e.dataset.warningType===n?e.style.display="":e.style.display="none"})}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}
2(n(5396).xI);s.targets=["filters","list"]},8591:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(5396);function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function f(e,t,n){return t=p(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}var v=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),f(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){var e=this.element.querySelector("#choice-group-errors");e&&e.scrollIntoView({behavior:"smooth",block:"start"}),this.toggleMinMax(),this.toggleScoreSelects(),this.checkConstraints()}},{key:"toggleMinMax",value:function(){if(this.hasMinMaxFieldsTarget){var e=this.element.querySelector('input[name="choice_group[display_on_ballot]"]:checked');if(e){var t="true"===e.value;this.minMaxFieldsTarget.style.display=t?"none":""}}}},{key:"toggleScoreSelects",value:function(){var e=this.element.querySelector('input[name="choice_group[display_on_ballot]"]:checked');if(e){var t,n="true"===e.value,r=a(this.scoreConfigTargets);try{for(r.s();!(t=r.n()).done;)t.value.style.display=n?"":"none"}catch(u){r.e(u)}finally{r.f()}var o,i=a(this.scoreSelectTargets);try{for(i.s();!(o=i.n()).done;)o.value.disabled=!n}catch(u){i.e(u)}finally{i.f()}}}},{key:"checkConstraints",value:function(){var e=this.analyzeConstraints();this.renderWarnings(e)}},{key:"renderWarnings",value:function(e){var t=this;if(0!==e.perQuestion.size||0!==e.aggregate.length){this.clearWarnings();var n,r=a(e.perQuestion.entries());try{var u,c=function(){var e=n.value,r=(u=i(e,2))[0],o=u[1],a=t.questionGroupTargets.find(function(e){return e.dataset.questionId===r});if(!a)return 0;var c=a.querySelector(".votes--choice-groups--form-component__question-warning");if(!c)return 0;c.classList.remove("votes--choice-groups--form-component__question-warning--hidden"),"blocking"===o[0].severity&&c.classList.add("votes--choice-groups--form-component__question-warning--blocking"),c.innerHTML='<i class="fas fa-exclamation-triangle"></i>'.concat(o.map(function(e){return e.message}).join("<br>"))};for(r.s();!(n=r.n()).done;)c()}catch(f){r.e(f)}finally{r.f()}if(e.aggregate.length>0){this.aggregateBannerTarget.classList.remove("votes--choice-groups--form-component__aggregate-banner--hidden"),this.aggregateBannerTarget.classList.remove("votes--choice-groups--form-component__aggregate-banner--warning"),this.aggregateBannerTarget.classList.remove("votes--choice-groups--form-component__aggregate-banner--blocking");var s="blocking"===e.aggregateSeverity?"votes--choice-groups--form-component__aggregate-banner--blocking":"votes--choice-groups--form-component__aggregate-banner--warning";this.aggregateBannerTarget.classList.add(s),this.aggregateBannerTarget.innerHTML='\n        <i class="fas fa-exclamation-circle"></i><span>'.concat(e.aggregate.join("<br>"),"</span>\n      ")}var l=o(e.perQuestion.values()).some(function(e){return e.some(function(e){return"blocking"===e.severity})})||"blocking"===e.aggregateSeverity;this.updateSubmitButtons(l)}else this.clearWarnings()}},{key:"clearWarnings",value:function(){var e,t=a(this.questionGroupTargets);try{for(t.s();!(e=t.n()).done;){var n=e.value.querySelector(".votes--choice-groups--form-component__question-warning");n&&(n.classList.add("votes--choice-groups--form-component__question-warning--hidden"),n.innerHTML="")}}catch(r){t.e(r)}finally{t.f()}this.aggregateBannerTarget.classList.add("votes--choice-groups--form-component__aggregate-banner--hidden"),this.aggregateBannerTarget.classList.remove("votes--choice-groups--form-component__aggregate-banner--warning"),this.aggregateBannerTarget.classList.remove("votes--choice-groups--form-component__aggregate-banner--blocking"),this.aggregateBannerTarget.innerHTML="",this.updateSubmitButtons(!1)}},{key:"analyzeConstraints",value:function(){var e,t={perQuestion:new Map,aggregate:[],aggregateSeverity:null},n=0,r=this.element.querySelector('input[name="choice_group[display_on_ballot]"]:checked'),o="true"===(null===r||void 0===r?void 0:r.value),i=o?0:parseInt(this.minRequiredFieldTarget.value,10)||0,u=o?0:parseInt(this.maxAllowedFieldTarget.value,10)||1,c=a(this.questionGroupTargets);try{var s=function(){var r,i,a=e.value,c=null!==(r=a.dataset.questionId)&&void 0!==r?r:"",s=parseInt(null!==(i=a.dataset.answerMaximum)&&void 0!==i?i:"0",10),l=a.querySelectorAll('[data-votes--choice-groups--form-component-target="candidateCheckbox"]:checked').length,f=Math.min(l,s);n+=f;var d=null!==a.querySelector('[data-votes--choice-groups--form-component-target="scoreConfig"]');
2if(o&&l>s&&(d||s<2)){var p,h=null!==(p=t.perQuestion.get(c))&&void 0!==p?p:[];h.push({severity:"blocking",message:"".concat(l," choices assigned \u2014 question maximum is ").concat(s)}),t.perQuestion.set(c,h)}if(o&&d&&"true"===a.dataset.uniqueScoresRequired){var v=Array.from(a.querySelectorAll('[data-votes--choice-groups--form-component-target="scoreSelect"]')).map(function(e){return e.value}).filter(function(e){return""!==e&&"not_applicable"!==e});if(v.some(function(e,t){return v.indexOf(e)!==t})){var y,m=null!==(y=t.perQuestion.get(c))&&void 0!==y?y:[];m.push({severity:"blocking",message:"Two or more choices are assigned the same score \u2014 scores must be unique for this question"}),t.perQuestion.set(c,m)}}if(!o){var b,g=parseInt(null!==(b=a.dataset.answerMinimum)&&void 0!==b?b:"0",10)||0;if(g>0){var w=a.querySelectorAll('[data-votes--choice-groups--form-component-target="candidateCheckbox"]').length-l;if(u+w<g){var _,O=null!==(_=t.perQuestion.get(c))&&void 0!==_?_:[];O.push({severity:"blocking",message:"Ballot minimum ".concat(g," \u2014 group maximum ").concat(u)}),t.perQuestion.set(c,O)}}}};for(c.s();!(e=c.n()).done;)s()}catch(l){c.e(l)}finally{c.f()}return n<i&&(t.aggregate.push("Choices selected ".concat(n," \u2014 group minimum is ").concat(i)),t.aggregateSeverity="blocking"),t}},{key:"updateSubmitButtons",value:function(e){var t,n=a(this.submitButtonTargets);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.disabled=e,r.classList.toggle("votes--choice-groups--form-component__submit--disabled",e)}}catch(o){n.e(o)}finally{n.f()}}}])&&s(n.prototype,r),u&&s(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u}(r.xI);v.targets=["minMaxFields","questionGroup","candidateCheckbox","minRequiredField","maxAllowedField","aggregateBanner","submitButton","scoreConfig","scoreSelect"]},8476:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}n.r(t),n.d(t,{default:function(){return s}});var s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=i(this,t,[].concat(r))).boundHandleStreamRender=null,e.boundHandleUnsavedChangesSaving=null,e.boundHandleTurboSubmitEnd=null,e.pendingEditUrl=null,e.pendingIsTurboStream=!1,e.pendingFormElement=null,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(t,e),n=t,(o=[{key:"connect",value:function(){this.boundHandleStreamRender=this.handleStreamRender.bind(this),document.addEventListener("turbo:before-stream-render",this.boundHandleStreamRender),this.boundHandleUnsavedChangesSaving=this.handleUnsavedChangesSaving.bind(this),document.addEventListener("unsaved-changes:saving",this.boundHandleUnsavedChangesSaving),this.boundHandleTurboSubmitEnd=this.handleTurboSubmitEnd.bind(this),document.addEventListener("turbo:submit-end",this.boundHandleTurboSubmitEnd),this.updateVisibility()}},{key:"disconnect",value:function(){this.boundHandleStreamRender&&(document.removeEventListener("turbo:before-stream-render",this.boundHandleStreamRender),this.boundHandleStreamRender=null),this.boundHandleUnsavedChangesSaving&&(document.removeEventListener("unsaved-changes:saving",this.boundHandleUnsavedChangesSaving),this.boundHandleUnsavedChangesSaving=null),this.boundHandleTurboSubmitEnd&&(document.removeEventListener("turbo:submit-end",this.boundHandleTurboSubmitEnd),this.boundHandleTurboSubmitEnd=null)}},{key:"handleStreamRender",value:function(e){var t=this,n=e.target;n&&n.getAttribute&&"choice-group-form"===n.getAttribute("target")&&document.dispatchEvent(new CustomEvent("choice-group-form:replacing",{bubbles:!0})),setTimeout(function(){return t.updateVisibility()},0)}},{key:"updateVisibility",value:function(){if(this.hasFormSectionTarget){var e="true"===this.formSectionTarget.dataset.editing,t="true"===this.formSectionTarget.dataset.autoExpand;
2(e||t)&&this.showForm()}}},{key:"showForm",value:function(){this.hasCreateButtonTarget&&this.createButtonTarget.classList.add("hidden"),this.hasFormSectionTarget&&this.formSectionTarget.classList.remove("hidden")}},{key:"hideForm",value:function(){this.hasFormSectionTarget&&"true"===this.formSectionTarget.dataset.autoExpand?this.hasFormSectionTarget&&(this.formSectionTarget.dataset.editing="false"):(this.hasCreateButtonTarget&&this.createButtonTarget.classList.remove("hidden"),this.hasFormSectionTarget&&(this.formSectionTarget.classList.add("hidden"),this.formSectionTarget.dataset.editing="false"))}},{key:"backToBallotDesign",value:function(e){e.preventDefault();var t=this.ballotDesignUrlValue;this.hasFormSectionTarget&&!this.formSectionTarget.classList.contains("hidden")?document.dispatchEvent(new CustomEvent("unsaved-changes:navigate",{detail:{url:t},bubbles:!0})):"undefined"!==typeof window.Turbo&&window.Turbo.visit?window.Turbo.visit(t):window.location.href=t}},{key:"selectItem",value:function(e){var t=e.currentTarget.dataset.editUrl;t&&(e.preventDefault(),document.dispatchEvent(new CustomEvent("unsaved-changes:navigate",{detail:{url:t,turboStream:!0},bubbles:!0})))}},{key:"handleUnsavedChangesSaving",value:function(e){var t=e.detail;null!==t&&void 0!==t&&t.turboStream&&null!==t&&void 0!==t&&t.url&&(this.pendingEditUrl=t.url,this.pendingIsTurboStream=!0,this.pendingFormElement=this.hasFormSectionTarget?this.formSectionTarget.querySelector("form"):null)}},{key:"handleTurboSubmitEnd",value:function(e){var t,n;if(this.pendingEditUrl&&this.pendingIsTurboStream){var r=e;if(!this.pendingFormElement||(null===(t=r.detail)||void 0===t||null===(t=t.formSubmission)||void 0===t?void 0:t.formElement)===this.pendingFormElement){var o=this.pendingEditUrl;this.pendingEditUrl=null,this.pendingIsTurboStream=!1,this.pendingFormElement=null,null!==(n=r.detail)&&void 0!==n&&n.success&&fetch(o,{method:"GET",headers:{Accept:"text/vnd.turbo-stream.html, text/html, application/xhtml+xml"},credentials:"same-origin"}).then(function(e){return e.text()}).then(function(e){var t;return null===(t=window.Turbo)||void 0===t?void 0:t.renderStreamMessage(e)}).catch(function(e){return console.error("Failed to fetch turbo stream after save:",e)})}}}},{key:"cancel",value:function(e){var t,n;if(e.preventDefault(),this.hideForm(),this.hasCancelUrlValue){var r=null!==(t=null===(n=document.querySelector('meta[name="csrf-token"]'))||void 0===n?void 0:n.content)&&void 0!==t?t:"";fetch(this.cancelUrlValue,{method:"POST",headers:{Accept:"text/vnd.turbo-stream.html","X-CSRF-Token":r}}).then(function(e){return e.text()}).then(function(e){var t;return null===(t=window.Turbo)||void 0===t?void 0:t.renderStreamMessage(e)}).catch(function(){})}}}])&&r(n.prototype,o),a&&r(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,a}(n(5396).xI);s.targets=["createButton","formSection"],s.values={cancelUrl:String,ballotDesignUrl:String}},5397:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=window.NProgress,d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){this.syncSwitch()}},{key:"load",value:function(e){var t=this,n=(0,o.T)();n?n.get(this.data.get("url"),{weight:e}).done(function(n){t.element.innerHTML=n,t.checked=e,t.syncSwitch(),f.done()}).fail(function(e,t,n){console.error("Request failed:",t,n),alert("An error occurred while processing your request. Please try again."),f.done()}):console.error("[WeightSwitchController] jQuery not available")}},{key:"toggle",value:function(e){f.start(),this.load(e.target.checked)}},{key:"checked",get:function(){return"true"===this.data.get("checked")},set:function(e){this.data.set("checked",e?"true":"false"),this.syncSwitch()}},{key:"syncSwitch",value:function(){this.switchTarget.checked=this.checked}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI);d.targets=["switch"]},8784:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return f}});var r=n(5396);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var l=window.EB,f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),a(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){if(l&&l.Elections){var e=l.Elections;e.Results.pageRequiresDragAndDropFeature(document.body)&&e.Results.initWriteInDrag(this.element)}else console.error("[WriteInDragController] EB not available")}}])&&o(n.prototype,r),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(r.xI)},1025:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var r=n(5396),o=n(6923);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e,t,n){return t=s(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}
2function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=window.EB,d=window.NProgress,p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),n=t,(r=[{key:"connect",value:function(){if(f&&f.Elections){var e=(0,o.T)();if(e&&"function"===typeof e.fn.droppable){var t=f.Elections;t.Results.pageRequiresDragAndDropFeature(document.body)&&t.Results.initWriteInDrop(this.element)}}else console.error("[WriteInDropController] EB not available")}},{key:"startSpinner",value:function(){d&&d.start()}},{key:"stopSpinner",value:function(){d.done()}}])&&i(n.prototype,r),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a}(r.xI)},1450:function(e,t,n){"use strict";n(7434);var r=n(5396),o=n(2772),i=n(9259),a=n(4559),u=/\b[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}\b/g,c=/\/[A-Z0-9]{12}(?=\/|$)/g,s=/\/(invitation_link|invitations|proxy_intentions|organizations)\/[^/?#]+/g,l=function(e){return e.split(/[?#]/)[0].replace(s,"/$1/[redacted]").replace(c,"/[redacted]").replace(u,"[redacted]")},f=function(e){return e.replace(u,"[redacted]")};function d(e){var t,n,r;(e.view.url&&(e.view.url=l(e.view.url)),e.view.referrer&&(e.view.referrer=l(e.view.referrer)),"view"===e.type&&null!==(t=e.view.performance)&&void 0!==t&&null!==(t=t.lcp)&&void 0!==t&&t.resource_url&&(e.view.performance.lcp.resource_url=l(e.view.performance.lcp.resource_url)),"resource"===e.type&&e.resource.url&&(e.resource.url=l(e.resource.url)),"error"===e.type)&&(null!==(n=e.error.resource)&&void 0!==n&&n.url&&(e.error.resource.url=l(e.error.resource.url)),e.error.message&&(e.error.message=f(e.error.message)),e.error.stack&&(e.error.stack=f(e.error.stack)));"long_task"===e.type&&(null===(r=e.long_task.scripts)||void 0===r||r.forEach(function(e){e.source_url&&(e.source_url=l(e.source_url))}));return!0}var p=n(3608),h=n(8867),v=n.n(h),y=(n(8157),n(132)),m=(n(9403),n(6380),n(3455)),b=n.n(m),g="556270 4ecec4 c7f464 ff6b6b c44d58 ff8002 ff5c44 ff3f6f e63b95 b94ab2 7b58c2 0060c0".split(" ").map(function(e){return"#".concat(e)}),w=["line-vertical","zigzag","zigzag-vertical","diagonal","diagonal-right-left","line","dot","plus","cross","square","dash","cross-dash"];function _(e){for(var t=[],n=0;n<e;n++){var r=w[n%w.length],o=g[n%g.length];t.push(b().draw(r,o))}return t}"undefined"!==typeof window&&(window.ChartPatterns={generatePatternColors:_,applyPatternsToChart:function(e){var t;if("undefined"===typeof window.Chartkick||!window.Chartkick)return!1;var n=window.Chartkick.charts[e];if(!n)return!1;var r=n.chart||n.__chart;if(!r)return!1;var o=(null===(t=r.data)||void 0===t||null===(t=t.datasets)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t.data)||void 0===t?void 0:t.length)||0;if(0===o)return!1;var i=_(o);return r.data.datasets.forEach(function(e){e.backgroundColor=i}),r.update(),!0}});n(7571);var O,T=n(7749);function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,B(r.key),r)}}function j(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t,n){return t=C(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,E()?Reflect.construct(t,n||[],C(e).constructor):t.apply(e,n))}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}
2function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function x(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function I(e,t,n){return(t=B(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(O=function(){var e=document.querySelector('meta[name="datadog-rum-config"]');if(null===e||void 0===e||!e.content)return null;try{return JSON.parse(e.content)}catch(t){return null}}())&&(a.L2.init({applicationId:O.applicationId,clientToken:O.clientToken,site:O.site,service:O.service,env:O.env,version:O.version,sessionSampleRate:100,sessionReplaySampleRate:O.sessionReplaySampleRate,defaultPrivacyLevel:O.defaultPrivacyLevel,trackUserInteractions:!0,enablePrivacyForActionName:O.enablePrivacyForActionName,allowedTracingUrls:[{match:window.location.origin,propagatorTypes:["tracecontext","datadog"]}],traceSampleRate:20,beforeSend:d}),O.impersonating?a.L2.setGlobalContextProperty("impersonating",!0):O.adminId&&a.L2.setUser({id:String(O.adminId)}));var D=L(L({},r.jZ),{},{keyMappings:L(L({},r.jZ.keyMappings),{},{delete:"Delete",numpadMinus:"-"})}),M=r.lg.start(document.documentElement,D),F=function(){var e=n(3424),t=n(6742);M.load((0,o.Ux)(e).concat((0,o.Ux)(t)))},N=function(){return"undefined"!==typeof window.jQuery&&"undefined"!==typeof window.EB},V=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!N())return e>=50?(console.error("[Stimulus] jQuery/EB globals never became available after 5s; loading controllers anyway."),void F()):void setTimeout(function(){return V(e+1)},100);F()};(N()?F():document.addEventListener("DOMContentLoaded",function(){V()}),M.debug=!1,p.A.set("timezone",v().determine().name(),{path:"/",secure:"https:"===window.location.protocol,expires:365,SameSite:"strict"}),window.I18n=y.A,Turbo.session.drive=!1,document.addEventListener("turbo:before-stream-render",function(e){console.log("[Turbo] Stream render:",e.detail)}),"undefined"!==typeof Turbo.StreamActions)&&(console.log("[Turbo] StreamActions available"),new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"TURBO-CABLE-STREAM-SOURCE"===e.tagName&&(console.log("[Turbo] Stream source added:",e),console.log("[Turbo] Channel:",e.getAttribute("channel")),console.log("[Turbo] Signed stream name:",e.getAttribute("signed-stream-name")))})})}).observe(document.documentElement,{childList:!0,subtree:!0}));window.Quill=T.Ay;var H=function(e){function t(){return S(this,t),P(this,t,arguments)}return x(t,e),j(t)}(T.Ay.import("blots/block/embed"));H.blotName="divider",H.tagName="hr",T.Ay.register(H);var q=function(e){function t(){return S(this,t),P(this,t,arguments)}return x(t,e),j(t,[{key:"length",value:function(){return 1}},{key:"value",value:function(){return!0}}],[{key:"value",value:function(){return!0}}])}(T.Ay.import("blots/embed"));q.blotName="break",q.tagName="br",T.Ay.register(q),(0,i.logTurboEvents)()},5260:function(e,t,n){"use strict";n.d(t,{c:function(){return o}});var r=4;function o(e){var t=e.map(function(e){var t=e.getBoundingClientRect();return t.top+t.height/2}).sort(function(e,t){return e-t}),n=0,o=null;return t.forEach(function(e){(null===o||Math.abs(e-o)>r)&&(n+=1),o=e}),n}},6923:function(e,t,n){"use strict";n.d(t,{T:function(){return o}});var r=!1;function o(){var e=window,t=e.jQuery||e.$;return t||r||(r=!0,console.warn("[jquery] window.jQuery unavailable; jQuery-dependent UI enhancements disabled on this page.")),t}},9639:function(e){e.exports={log:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#a2dbff";console.groupCollapsed("%c".concat(e),"color: ".concat(n,"; font-weight: bold;")),t&&console.log("details:",t),console.groupEnd()}}},2224:function(e){e.exports={joinUnlessMissingOrSame:function(e,t){return e&&t?e!==t?"".concat(e," - ").concat(t):e:e||t||""}}},9259:function(e){e.exports={logTurboEvents:function(){["turbo:before-visit","turbo:visit","turbo:before-cache","turbo:before-render","turbo:render","turbo:load","turbo:before-fetch-request","turbo:before-fetch-response","turbo:fetch-request-error","turbo:submit-start","turbo:submit-end","turbo:frame-missing","turbo:frame-fetch-request","turbo:frame-load","turbo:frame-render","turbo:before-stream-render","turbo:before-stream-element-append","turbo:before-stream-element-prepend","turbo:before-stream-element-remove","turbo:before-stream-element-replace","turbo:before-stream-element-update"].forEach(function(e){document.addEventListener(e,function(t){var n,r,o;console.groupCollapsed("%c@".concat(e),"color: ".concat("#d6e016","; font-weight: bold;")),console.log("action:",null===(n=t.target)||void 0===n?void 0:n.action),console.log("target:",null===(r=t.target)||void 0===r?void 0:r.target),console.log("method:",null===(o=t.target)||void 0===o?void 0:o.method),console.groupEnd()})})}}},7768:function(e){function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=function(){return[]},t.resolve=t,t.id=7768,e.exports=t},6742:function(e,t,n){var r={"./accounts/billings/index/transaction_component/transaction_component_controller.ts":1121,"./accounts/customer_io_logout_controller.ts":2612,"./accounts/organizations/assign_component/assign_component_controller.ts":7956,"./admin/ai/model_management_c
2omponent/model_management_component_controller.ts":9995,"./admin/ai/overview_page_component/overview_page_component_controller.ts":8995,"./admin/apis_dashboards/ag_grid_provision_component/ag_grid_provision_component_controller.ts":4183,"./admin/apis_dashboards/apis_dashboards_component/api_dashboard_controller.ts":9785,"./admin/elections/ai_voter_list_grid_component/ai_voter_list_grid_component_controller.ts":1843,"./admin/elections/election_state_editor_component/election_state_editor_component_controller.ts":8523,"./admin/elections/questions/answers/image_upload_component/image_upload_component_controller.ts":6121,"./admin/elections/questions/answers/pdf_upload_component/pdf_upload_component_controller.ts":495,"./admin/elections/result_header_component/result_header_component_controller.ts":3107,"./admin/elections/results_toolbar_component/results_toolbar_component_controller.ts":7711,"./admin/postal_batches/postal_batch_form_component/postal_batch_form_component_controller.ts":8425,"./admin/regions/global_dashboard/smart_search_component/smart_search_component_controller.ts":3269,"./admin/regions/region_switcher_component/region_switcher_component_controller.ts":2460,"./admin/users/edit_administrator_modal_component/edit_administrator_modal_component_controller.ts":6997,"./admin/vote_boxes/select/organizations_component/organizations_component_controller.js":2952,"./admin/vote_boxes/select/organizations_component/organizations_component_controller.ts":5366,"./admin/votes/meetings/edit_page_component/edit_page_component_controller.ts":5889,"./append_voters/new_component/new_component_controller.ts":773,"./append_voters/review_grid_component/review_grid_component_controller.ts":1833,"./append_voters/voters_grid_component/voters_grid_component_controller.ts":9849,"./application/language_select_component/language_select_component_controller.ts":9437,"./application/toolkit/ag_grid_base_component/ag_grid_base_controller.ts":4546,"./application/toolkit/ag_grid_component/ag_grid_component_controller.ts":8513,"./application/toolkit/ag_grid_editable_component/ag_grid_editable_component_controller.ts":8640,"./application/toolkit/ag_grid_growable_component/ag_grid_growable_component_controller.ts":98,"./application/toolkit/ag_grid_shared/toolbar_fit_controller.ts":1032,"./application/toolkit/ag_grid_ssrm_component/ag_grid_ssrm_component_controller.ts":232,"./application/toolkit/chart_component/chart_component_controller.ts":792,"./application/toolkit/confirm_delete_modal_component/confirm_delete_modal_component_controller.ts":112,"./application/toolkit/date_picker_component/date_picker_component_controller.ts":5682,"./application/toolkit/drop_zone_component/drop_zone_component_controller.ts":3286,"./application/toolkit/image_drop_zone_component/image_drop_zone_component_controller.ts":770,"./application/toolkit/multiple_select_component/multiple_select_component_controller.ts":3070,"./application/toolkit/toast_component/toast_component_controller.ts":1954,"./application/toolkit/toast_viewport_component/toast_viewport_component_controller.ts":4872,"./application/toolkit/tooltip_component/tooltip_component_controller.ts":9314,"./application/toolkit/unsaved_changes_modal_component/unsaved_changes_modal_component_controller.ts":7826,"./ballot_design/wizard/prior_question_results_component/prior_question_results_component_controller.ts":6344,"./ballot_design/wizard/prior_question_search_component/prior_question_search_component_controller.ts":5906,"./ballot_design/wizard/question_details_component/question_details_component_controller.ts":3426,"./ballot_design/wizard/question_type_component/question_type_component_controller.ts":9250,"./ballots/choice_group_instructions_component/choice_group_instructions_component_controller.ts":1502,"./ballots/form_component/form_component_controller.ts":8303,"./ballots/header_component/header_component_controller.ts":2034,"./ballots/joined_customized_label_component/joined_customized_label_component_controller.js":8456,"./ballots/key_overlay_component/key_overlay_component_controller.ts":2402,"./ballots/language_select_component/language_select_component_controller.ts":786,"./ballots/min_max_count_component/min_max_count_component_controller.js":8460,"./ballots/preview/banner_
2component/banner_component_controller.ts":8857,"./ballots/question_component/question_component_controller.ts":9600,"./ballots/question_row/question_row_controller.ts":6234,"./ballots/question_types/plurality_component/plurality_component_controller.ts":4135,"./ballots/question_types/plurality_split_weight_component/plurality_split_weight_component_controller.ts":5141,"./ballots/select_proxy_voter_component/select_proxy_voter_component_controller.ts":5968,"./ballots/slates_component/slates_component_controller.ts":7916,"./ballots/verify/page_component/page_component_controller.ts":4058,"./ballots/write_in/input_component/input_component_controller.ts":5276,"./ballots/write_in_answers_from_candidate_list_component/write_in_answers_from_candidate_list_component_controller.js":2732,"./base_controller.ts":6609,"./billing_accounts/billing_account_form_component/billing_account_form_component_controller.ts":7943,"./billing_accounts/extra_credits/input_component/input_component_controller.ts":4097,"./billing_accounts/show_more_component/show_more_component_controller.ts":4477,"./discount_coupon/success_modal_component/success_modal_component_controller.ts":9157,"./discount_coupon/survey_modal_component/survey_modal_component_controller.ts":9543,"./download_multiple_elections_reports_modal_component/download_multiple_elections_reports_modal_component_controller.js":7212,"./election/add_to_vote_box_component/add_to_vote_box_component_controller.ts":616,"./election/ballot_design/customize_button_color_component/customize_button_color_component_controller.js":3922,"./election/ballot_design/proxy_vote_component/proxy_vote_component_controller.ts":466,"./election/ballot_design/question/answer_component/answer_component_controller.ts":7199,"./election/ballot_design/question/header_component/header_component_controller.ts":4197,"./election/ballot_design/slates_toggle_component/slates_toggle_component_controller.ts":3818,"./election/copy_voter_list/page_component/page_component_controller.ts":5778,"./election/countdown_timer_component/countdown_timer_component_controller.ts":4492,"./election/details/organization_selection_component/organization_selection_component_controller.ts":253,"./election/details/vote_box_selection_component/vote_box_selection_component_controller.ts":5595,"./election/details/voting_time_form_component/voting_time_form_component_controller.ts":333,"./election/duplicate_modal_component/duplicate_modal_component_controller.js":2298,"./election/language_select_component/language_select_component_controller.js":9490,"./election/multi_vote_quorum_winners_settings_component/multi_vote_quorum_winners_settings_component_controller.ts":444,"./election/multiple_duplicate_component/multiple_duplicate_component_controller.ts":6162,"./election/result/tab_group_component/tab_group_component_controller.js":3446,"./election/result/voting_results_component/voting_results_component_controller.js":6748,"./elections/invitations/print_modal_component/print_modal_component_controller.js":5884,"./elections/question_results_details_component/question_results_details_component_controller.ts":8465,"./elections/toggle_vote_obfuscation_component/toggle_vote_obfuscation_component_controller.js":2829,"./infrastructure/ai_loading_overlay_component/ai_loading_overlay_component_controller.ts":8278,"./insecure_enter_key_component/insecure_enter_key_component_controller.js":6904,"./kiosk/kiosk_mode_qr_code_component/kiosk_mode_qr_code_component_controller.ts":2338,"./kiosk_mode_modal_component/kiosk_mode_modal_component_controller.js":5616,"./layouts/header/header_component/header_component_controller.ts":9610,"./layouts/header/sticky_top_bar_component/sticky_top_bar_component_controller.ts":7786,"./meeting_integrations/in_app/zoom/context_handler_component/context_handler_component_controller.ts":2694,"./meeting_integrations/in_app/zoom/host_integration_component/host_integration_component_controller.ts":858,"./meeting_integrations/in_app/zoom/integration_component/integration_component_controller.ts":9422,"./meeting_integrations/meeting_links/google/link_component/link_component_controller.ts":9917,"./meetings_manager/motion_elections_component/motion_elections_component_controller.ts":9355,"./meetings_manager/motion_elections_component/motion_elections_filter_controller.ts":2004,"./news_feed_component/news_feed_component_controller.ts":8506,"./notice_editor_component/notice_editor_component_controller.js":8256,"./notifications/modal/page_component/page_component_controller.ts":2065,"./notifications/modal/results/form_component/form_component_controller.ts":6084,"./notifications/modal/results/index_component/index_component_controller.ts":6966,"./notifications/notification_groups/select_component/select_component_controller.js":3194,"./notifications/reminders/form_component/form_component_controller.ts":9173,"./notifications/reminders/use_existing_dropdown_component/use_existing_dropdown_component_controller.js":105,"./notifications_center/flash_component/flash_component_controller.ts":5653,"./organization/SSO/saml/provider_form_component/saml_logo_preview_controller.ts":5486,"./organization/integrations/voter_list/sso/sign_in_page_link_component/sign_in_page_link_component_controller.ts":2584,"./organization/logo/legacy_uploader_component/legacy_uploader_component_controller.ts":3770,"./organization/meeting_vote_polling_field_component/meeting_vote_polling_field_component_controller.js":4234,"./organization/members_table/transfer_ownership_modal_component/transfer_ownership_modal_component_controller.ts":9757,"./organization/settings_page_component/settings_page_component_controller.js":7642,"./organization/settings_page_component/settings_page_nav_controller.ts":8590,"./organization/settings_pages/iframe_settings_component/iframe_settings_component_controller.ts":1269,"./organization/settings_pages/integrations_component/integrations_component_controller.js":6903,"./organization/sso/key/input_component/input_component_controller.ts":4276,"./organization/sso/saml/provider_form_component/saml_attribute_editor_controller.ts":5874,"./organization/sso/saml/provider_form_component/saml_metadata_import_controller.ts":7451,"./organization/url_editor_component/url_editor_component_controller.ts":2024,"./organizations/new_modal_component/new_modal_component_controller.ts":1351,"./organizations/results/back_button_component/back_button_component_controller.ts":2012,"./organizations/results/box_filtering_component/box_filtering_component_controller.ts":7904,"./otc/available_page_component/available_page_component_controller.ts":2731,"./payments/credit_card_form_component/credit_card_form_component_controller.ts":4620,"./payments/invoice_component/invoice_component_controller.ts":4364,"./payments/page_component/page_component_controller.ts":2076,"./payments/purchase_reminders_component/description_component/description_component_controller.ts":4138,"./payments/stripe/address_component_controller.ts":1141,"./payments/stripe/billing_details_component_controller.ts":83,"./payments/stripe/card_component_controller.ts":2486,"./payments/stripe/customer/setup_component_controller.ts":6409,"./payments/stripe/template_component_controller.ts":3613,"./payments/stripe/transaction_component_controller.ts":5173,"./questions/answers/profile_modal_component/profile_modal_component_controller.ts":536,"./questions/nomination/capture_nomination_component/capture_nomination_component_controller.ts":6489,"./questions/scored/scoring_options_modal_component/scoring_options_modal_component_controller.ts":1945,"./questions/write_in_settings_component/write_in_settings_component_controller.js":958,"./questions/write_in_settings_modal_component/write_in_settings_modal_component_controller.js":3186,"./reminders/purchase/quantity_select_component/quantity_select_component_controller.ts":5292,"./reminders/purchase/summary_component/summary_component_controller.ts":5904,"./reminders/purchase_page_component/purchase_page_component_controller.ts":7806,"./results/buttons_component/buttons_component_controller.ts":2357,"./results/buttons_component/settings_buttons_component/settings_buttons_component_controller.ts":6491,"./results/grouped_results/export_results_component/export_results_component_controller.ts":7213,"./results/options_component/options_component_controller.ts":7933,"./results/voter_results_access_component/voter_results_access_component_controller.ts":6519,"./results_summary/reports_navigation_component/reports_navigation_component_controller.ts":3262,"./shared/copy_qr_code_button_component/copy_qr_code_button_controller.ts":3154,"./shared/dropdown_component/dropdown_component_controller.ts":6474,"./shared/inputs/numeric_stepper/numeric_stepper_controller.ts":570,"./shared/membership_tier_component/membership_tier_component_controller.ts":550,"./shared/multiple_select_component/multiple_select_component_controller.ts":4054,"./shared/org_categorization_wrapper_component/org_categorization_wrapper_component_controller.ts":56,"./shared/organization_types_component/organization_types_component_controller.ts":9570,"./shared/pagination_component/pagination_component_controller.ts":8772,"./shared/relationship_with_org_component/relationship_with_org_component_controller.ts":6950,"./shared/rich_text_editor_component/rich_text_editor_component_controller.ts":203,"./shared/searchable_dropdown_component/searchable_dropdown_component_controller.ts":6770,"./shared/toggle_panel_component/toggle_panel_component_controller.ts":8866,"./template_with_election_variables_editor_component/template_with_election_variables_editor_component_controller.ts":6334,"./turbo_modal_component/turbo_modal_component_controller.ts":1118,"./user/invitation/signup_form_component/signup_form_component_controller.js":6512,"./user/one_time_password/registration_form_component/registration_form_component_controller.ts":3677,"./users/invite_to_organization_form_component/invite_to_organization_form_component_controller.js":2461,"./users/organizations/batch/invitation_modal_component/invitation_modal_component_controller.ts":6943,"./vote/notices/options/letter/notice_options_component/notice_options_component_controller.ts":8711,"./vote/notices/options/postcard/notice_options_component/notice_options_component_controller.ts":6883,"./vote/notices/options/printed/notice_options_component/notice_options_component_controller.ts":1243,"./vote/notices/options/select_component/select_component_controller.ts":9978,"./vote/notices/options/whatsapp/notice_options_component/notice_options_component_controller.ts":4105,"./vote/notices/postal/return_envelope/address_input_component/address_input_component_controller.ts":4883,"./vote/notices/postal/return_envelope/double_envelope_input_component/double_envelope_input_component_controller.ts":2923,"./vote/notices/postal/return_envelope/options_component/options_component_controller.ts":2723,"./vote/notices/send_time_component/send_time_component_controller.ts":4863,"./vote/paper_ballot/find_component/find_component_controller.ts":9383,"./vote/review/details_component/details_component_controller.ts":7996,"./vote/voters/settings/multifactor_authentication_component/multifactor_authentication_component_controller.ts":255,"./vote/voters/settings/single_sign_on_integration_component/single_sign_on_integration_component_controller.ts":6035,"./vote/voters/settings/weighted_component/weighted_component_controller.ts":1707,"./vote_box/create_form_component/create_form_component_controller.ts":4591,"./vote_boxes/dashboard_component/dashboard_component_controller.ts":9195,"./vote_boxes/rename_vote_box_component/rename_vote_box_component_controller.ts":7923,"./vote_boxes/search_box_component/search_box_component_controller.ts":8545,"./voter_list/column_mapping_grid_component/column_mapping_grid_component_controller.ts":9152,"./voter_list/consent_terms_form_component/consent_terms_form_component_controller.js":5162,"./voter_list/editor_grid_component/editor_grid_component_controller.ts":4064,"./voter_list/filter_component/filter_component_controller.js":3944,"./voter_list/filters/base_component/base_component_controller.js":7126,"./voter_list/google_sheets_importer_component/google_sheets_importer_component_controller.ts":9468,"./voter_list/import_method_selector_component/import_method_selector_component_controller.ts":1476,"./voter_list/importation_overview_component/importation_overview_component_controller.js":332,"./voter_list/joined_label_editor_component/joined_label_editor_component_controller.ts":7108,"./voter_list/pagination_component/pagination_component_controller.js":920,"./voter_list/password_editor_component/password_editor_component_controller.js":8234,"./voter_list/post_save_grid_component/post_save_grid_component_controller.ts":2752,"./voter_list/processing_voters_component/processing_voters_component_controller.js":5898,"./voter_list/sign_in_help_text_form_component/sign_in_help_text_form_component_controller.ts":9386,"./voter_list/table_component/table_component_controller.js":126,"./voters/proxies/admin_proxy_intentions/dismissed_modal_component/dismissed_modal_component_controller.ts":4e3,"./voters/proxy/admin_proxy_intention_component/admin_proxy_intention_component_controller.ts":2709,"./voters/proxy/agreement_edit_component/agreement_edit_component_controller.ts":5801,"./votes/attributes/key_component/key_component_controller.ts":4204,"./votes/choice_groups/group_prompt_component/group_prompt_component_controller.ts":7015,"./votes/dashboard/add_to_vote_box_modal_component/add_to_vote_box_modal_component_controller.ts":6869,"./votes/dashboard/calendar_component/calendar_component_controller.ts":7143,"./votes/dashboard/next_event_component/next_event_component_controller.ts":9947,"./votes/dashboard/remove_choices/answers_select_component/answers_select_component_controller.ts":6467,"./votes/dashboard/remove_choices/modal_component/modal_component_controller.ts":1713,"./votes/dashboard/remove_choices/success_modal_component/success_modal_component_controller.ts":2321,"./votes/dashboard/result_list_component/result_list_component_controller.ts":8733,"./votes/dashboard/select_filters_component/select_filters_component_controller.ts":2531,"./votes/dashboard/vote_boxes_panel_component/vote_boxes_panel_component_controller.ts":3637,"./votes/dashboard/vote_item_component/vote_item_component_controller.ts":2797,"./votes/notices/on_demand_modal_component/on_demand_modal_component_controller.ts":1030,"./votes/results/preferential/australian_stv/chart_component/chart_component_controller.ts":9957,"./votes/results/preferential/borda_count/chart_component/chart_component_controller.ts":2454,"./votes/setup/details/multi_language_select_component/multi_language_select_component_controller.ts":8929,"./votes/setup/details/primary_language_select_component/primary_language_select_component_controller.ts":3561,"./votes/setup/progress/progress_component/progress_component_controller.ts":1984,"./votes/setup/questions/settings_component/settings_component_controller.ts":4068,"./votes/setup/questions/voter_instructions_component/voter_instructions_component_controller.ts":9602,"./votes/translations/answers/item_component/item_component_controller.ts":2539,"./votes/translations/answers/list_component/list_component_controller.ts":1589,"./votes/translations/auto_translate_button_component/auto_translate_button_component_controller.ts":4447,"./votes/translations/choice_groups/item_component/item_component_controller.ts":5202,"./votes/translations/input_component/input_component_controller.ts":4703,"./votes/translations/languages/edit_component/edit_component_controller.ts":9237,"./votes/translations/page_component/page_component_controller.ts":215,"./votes/translations/questions/item_component/item_component_controller.ts":7025,"./votes/translations/questions/list_component/list_component_controller.ts":4259,"./votes/translations/score_options/item_component/item_component_controller.ts":3707,"accounts/billings/index/transaction_component/transaction_component_controller.ts":1121,"accounts/customer_io_logout_controller.ts":2612,"accounts/organizations/assign_component/assign_component_controller.ts":7956,"admin/ai/model_management_c
2omponent/model_management_component_controller.ts":9995,"admin/ai/overview_page_component/overview_page_component_controller.ts":8995,"admin/apis_dashboards/ag_grid_provision_component/ag_grid_provision_component_controller.ts":4183,"admin/apis_dashboards/apis_dashboards_component/api_dashboard_controller.ts":9785,"admin/elections/ai_voter_list_grid_component/ai_voter_list_grid_component_controller.ts":1843,"admin/elections/election_state_editor_component/election_state_editor_component_controller.ts":8523,"admin/elections/questions/answers/image_upload_component/image_upload_component_controller.ts":6121,"admin/elections/questions/answers/pdf_upload_component/pdf_upload_component_controller.ts":495,"admin/elections/result_header_component/result_header_component_controller.ts":3107,"admin/elections/results_toolbar_component/results_toolbar_component_controller.ts":7711,"admin/postal_batches/postal_batch_form_component/postal_batch_form_component_controller.ts":8425,"admin/regions/global_dashboard/smart_search_component/smart_search_component_controller.ts":3269,"admin/regions/region_switcher_component/region_switcher_component_controller.ts":2460,"admin/users/edit_administrator_modal_component/edit_administrator_modal_component_controller.ts":6997,"admin/vote_boxes/select/organizations_component/organizations_component_controller.js":2952,"admin/vote_boxes/select/organizations_component/organizations_component_controller.ts":5366,"admin/votes/meetings/edit_page_component/edit_page_component_controller.ts":5889,"append_voters/new_component/new_component_controller.ts":773,"append_voters/review_grid_component/review_grid_component_controller.ts":1833,"append_voters/voters_grid_component/voters_grid_component_controller.ts":9849,"application/language_select_component/language_select_component_controller.ts":9437,"application/toolkit/ag_grid_base_component/ag_grid_base_controller.ts":4546,"application/toolkit/ag_grid_component/ag_grid_component_controller.ts":8513,"application/toolkit/ag_grid_editable_component/ag_grid_editable_component_controller.ts":8640,"application/toolkit/ag_grid_growable_component/ag_grid_growable_component_controller.ts":98,"application/toolkit/ag_grid_shared/toolbar_fit_controller.ts":1032,"application/toolkit/ag_grid_ssrm_component/ag_grid_ssrm_component_controller.ts":232,"application/toolkit/chart_component/chart_component_controller.ts":792,"application/toolkit/confirm_delete_modal_component/confirm_delete_modal_component_controller.ts":112,"application/toolkit/date_picker_component/date_picker_component_controller.ts":5682,"application/toolkit/drop_zone_component/drop_zone_component_controller.ts":3286,"application/toolkit/image_drop_zone_component/image_drop_zone_component_controller.ts":770,"application/toolkit/multiple_select_component/multiple_select_component_controller.ts":3070,"application/toolkit/toast_component/toast_component_controller.ts":1954,"application/toolkit/toast_viewport_component/toast_viewport_component_controller.ts":4872,"application/toolkit/tooltip_component/tooltip_component_controller.ts":9314,"application/toolkit/unsaved_changes_modal_component/unsaved_changes_modal_component_controller.ts":7826,"ballot_design/wizard/prior_question_results_component/prior_question_results_component_controller.ts":6344,"ballot_design/wizard/prior_question_search_component/prior_question_search_component_controller.ts":5906,"ballot_design/wizard/question_details_component/question_details_component_controller.ts":3426,"ballot_design/wizard/question_type_component/question_type_component_controller.ts":9250,"ballots/choice_group_instructions_component/choice_group_instructions_component_controller.ts":1502,"ballots/form_component/form_component_controller.ts":8303,"ballots/header_component/header_component_controller.ts":2034,"ballots/joined_customized_label_component/joined_customized_label_component_controller.js":8456,"ballots/key_overlay_component/key_overlay_component_controller.ts":2402,"ballots/language_select_component/language_select_component_controller.ts":786,"ballots/min_max_count_component/min_max_count_component_controller.js":8460,"ballots/preview/banner_
2component/banner_component_controller.ts":8857,"ballots/question_component/question_component_controller.ts":9600,"ballots/question_row/question_row_controller.ts":6234,"ballots/question_types/plurality_component/plurality_component_controller.ts":4135,"ballots/question_types/plurality_split_weight_component/plurality_split_weight_component_controller.ts":5141,"ballots/select_proxy_voter_component/select_proxy_voter_component_controller.ts":5968,"ballots/slates_component/slates_component_controller.ts":7916,"ballots/verify/page_component/page_component_controller.ts":4058,"ballots/write_in/input_component/input_component_controller.ts":5276,"ballots/write_in_answers_from_candidate_list_component/write_in_answers_from_candidate_list_component_controller.js":2732,"base_controller.ts":6609,"billing_accounts/billing_account_form_component/billing_account_form_component_controller.ts":7943,"billing_accounts/extra_credits/input_component/input_component_controller.ts":4097,"billing_accounts/show_more_component/show_more_component_controller.ts":4477,"discount_coupon/success_modal_component/success_modal_component_controller.ts":9157,"discount_coupon/survey_modal_component/survey_modal_component_controller.ts":9543,"download_multiple_elections_reports_modal_component/download_multiple_elections_reports_modal_component_controller.js":7212,"election/add_to_vote_box_component/add_to_vote_box_component_controller.ts":616,"election/ballot_design/customize_button_color_component/customize_button_color_component_controller.js":3922,"election/ballot_design/proxy_vote_component/proxy_vote_component_controller.ts":466,"election/ballot_design/question/answer_component/answer_component_controller.ts":7199,"election/ballot_design/question/header_component/header_component_controller.ts":4197,"election/ballot_design/slates_toggle_component/slates_toggle_component_controller.ts":3818,"election/copy_voter_list/page_component/page_component_controller.ts":5778,"election/countdown_timer_component/countdown_timer_component_controller.ts":4492,"election/details/organization_selection_component/organization_selection_component_controller.ts":253,"election/details/vote_box_selection_component/vote_box_selection_component_controller.ts":5595,"election/details/voting_time_form_component/voting_time_form_component_controller.ts":333,"election/duplicate_modal_component/duplicate_modal_component_controller.js":2298,"election/language_select_component/language_select_component_controller.js":9490,"election/multi_vote_quorum_winners_settings_component/multi_vote_quorum_winners_settings_component_controller.ts":444,"election/multiple_duplicate_component/multiple_duplicate_component_controller.ts":6162,"election/result/tab_group_component/tab_group_component_controller.js":3446,"election/result/voting_results_component/voting_results_component_controller.js":6748,"elections/invitations/print_modal_component/print_modal_component_controller.js":5884,"elections/question_results_details_component/question_results_details_component_controller.ts":8465,"elections/toggle_vote_obfuscation_component/toggle_vote_obfuscation_component_controller.js":2829,"infrastructure/ai_loading_overlay_component/ai_loading_overlay_component_controller.ts":8278,"insecure_enter_key_component/insecure_enter_key_component_controller.js":6904,"kiosk/kiosk_mode_qr_code_component/kiosk_mode_qr_code_component_controller.ts":2338,"kiosk_mode_modal_component/kiosk_mode_modal_component_controller.js":5616,"layouts/header/header_component/header_component_controller.ts":9610,"layouts/header/sticky_top_bar_component/sticky_top_bar_component_controller.ts":7786,"meeting_integrations/in_app/zoom/context_handler_component/context_handler_component_controller.ts":2694,"meeting_integrations/in_app/zoom/host_integration_component/host_integration_component_controller.ts":858,"meeting_integrations/in_app/zoom/integration_component/integration_component_controller.ts":9422,"meeting_integrations/meeting_links/google/link_component/link_component_controller.ts":9917,"meetings_manager/motion_elections_component/motion_elections_component_controller.ts":9355,"meetings_manager/motion_elections_component/motion_elections_filter_controller.ts":2004,"news_feed_component/news_feed_component_controller.ts":8506,"notice_editor_component/notice_editor_component_controller.js":8256,"notifications/modal/page_component/page_component_controller.ts":2065,"notifications/modal/results/form_component/form_component_controller.ts":6084,"notifications/modal/results/index_component/index_component_controller.ts":6966,"notifications/notification_groups/select_component/select_component_controller.js":3194,"notifications/reminders/form_component/form_component_controller.ts":9173,"notifications/reminders/use_existing_dropdown_component/use_existing_dropdown_component_controller.js":105,"notifications_center/flash_component/flash_component_controller.ts":5653,"organization/SSO/saml/provider_form_component/saml_logo_preview_controller.ts":5486,"organization/integrations/voter_list/sso/sign_in_page_link_component/sign_in_page_link_component_controller.ts":2584,"organization/logo/legacy_uploader_component/legacy_uploader_component_controller.ts":3770,"organization/meeting_vote_polling_field_component/meeting_vote_polling_field_component_controller.js":4234,"organization/members_table/transfer_ownership_modal_component/transfer_ownership_modal_component_controller.ts":9757,"organization/settings_page_component/settings_page_component_controller.js":7642,"organization/settings_page_component/settings_page_nav_controller.ts":8590,"organization/settings_pages/iframe_settings_component/iframe_settings_component_controller.ts":1269,"organization/settings_pages/integrations_component/integrations_component_controller.js":6903,"organization/sso/key/input_component/input_component_controller.ts":4276,"organization/sso/saml/provider_form_component/saml_attribute_editor_controller.ts":5874,"organization/sso/saml/provider_form_component/saml_metadata_import_controller.ts":7451,"organization/url_editor_component/url_editor_component_controller.ts":2024,"organizations/new_modal_component/new_modal_component_controller.ts":1351,"organizations/results/back_button_component/back_button_component_controller.ts":2012,"organizations/results/box_filtering_component/box_filtering_component_controller.ts":7904,"otc/available_page_component/available_page_component_controller.ts":2731,"payments/credit_card_form_component/credit_card_form_component_controller.ts":4620,"payments/invoice_component/invoice_component_controller.ts":4364,"payments/page_component/page_component_controller.ts":2076,"payments/purchase_reminders_component/description_component/description_component_controller.ts":4138,"payments/stripe/address_component_controller.ts":1141,"payments/stripe/billing_details_component_controller.ts":83,"payments/stripe/card_component_controller.ts":2486,"payments/stripe/customer/setup_component_controller.ts":6409,"payments/stripe/template_component_controller.ts":3613,"payments/stripe/transaction_component_controller.ts":5173,"questions/answers/profile_modal_component/profile_modal_component_controller.ts":536,"questions/nomination/capture_nomination_component/capture_nomination_component_controller.ts":6489,"questions/scored/scoring_options_modal_component/scoring_options_modal_component_controller.ts":1945,"questions/write_in_settings_component/write_in_settings_component_controller.js":958,"questions/write_in_settings_modal_component/write_in_settings_modal_component_controller.js":3186,"reminders/purchase/quantity_select_component/quantity_select_component_controller.ts":5292,"reminders/purchase/summary_component/summary_component_controller.ts":5904,"reminders/purchase_page_component/purchase_page_component_controller.ts":7806,"results/buttons_component/buttons_component_controller.ts":2357,"results/buttons_component/settings_buttons_component/settings_buttons_component_controller.ts":6491,"results/grouped_results/export_results_component/export_results_component_controller.ts":7213,"results/options_component/options_component_controller.ts":7933,"results/voter_results_access_component/voter_results_access_component_controller.ts":6519,"results_summary/reports_navigation_component/reports_navigation_component_controller.ts":3262,"shared/copy_qr_code_button_component/copy_qr_code_button_controller.ts":3154,"shared/dropdown_component/dropdown_component_controller.ts":6474,"shared/inputs/numeric_stepper/numeric_stepper_controller.ts":570,"shared/membership_tier_component/membership_tier_component_controller.ts":550,"shared/multiple_select_component/multiple_select_component_controller.ts":4054,"shared/org_categorization_wrapper_component/org_categorization_wrapper_component_controller.ts":56,"shared/organization_types_component/organization_types_component_controller.ts":9570,"shared/pagination_component/pagination_component_controller.ts":8772,"shared/relationship_with_org_component/relationship_with_org_component_controller.ts":6950,"shared/rich_text_editor_component/rich_text_editor_component_controller.ts":203,"shared/searchable_dropdown_component/searchable_dropdown_component_controller.ts":6770,"shared/toggle_panel_component/toggle_panel_component_controller.ts":8866,"template_with_election_variables_editor_component/template_with_election_variables_editor_component_controller.ts":6334,"turbo_modal_component/turbo_modal_component_controller.ts":1118,"user/invitation/signup_form_component/signup_form_component_controller.js":6512,"user/one_time_password/registration_form_component/registration_form_component_controller.ts":3677,"users/invite_to_organization_form_component/invite_to_organization_form_component_controller.js":2461,"users/organizations/batch/invitation_modal_component/invitation_modal_component_controller.ts":6943,"vote/notices/options/letter/notice_options_component/notice_options_component_controller.ts":8711,"vote/notices/options/postcard/notice_options_component/notice_options_component_controller.ts":6883,"vote/notices/options/printed/notice_options_component/notice_options_component_controller.ts":1243,"vote/notices/options/select_component/select_component_controller.ts":9978,"vote/notices/options/whatsapp/notice_options_component/notice_options_component_controller.ts":4105,"vote/notices/postal/return_envelope/address_input_component/address_input_component_controller.ts":4883,"vote/notices/postal/return_envelope/double_envelope_input_component/double_envelope_input_component_controller.ts":2923,"vote/notices/postal/return_envelope/options_component/options_component_controller.ts":2723,"vote/notices/send_time_component/send_time_component_controller.ts":4863,"vote/paper_ballot/find_component/find_component_controller.ts":9383,"vote/review/details_component/details_component_controller.ts":7996,"vote/voters/settings/multifactor_authentication_component/multifactor_authentication_component_controller.ts":255,"vote/voters/settings/single_sign_on_integration_component/single_sign_on_integration_component_controller.ts":6035,"vote/voters/settings/weighted_component/weighted_component_controller.ts":1707,"vote_box/create_form_component/create_form_component_controller.ts":4591,"vote_boxes/dashboard_component/dashboard_component_controller.ts":9195,"vote_boxes/rename_vote_box_component/rename_vote_box_component_controller.ts":7923,"vote_boxes/search_box_component/search_box_component_controller.ts":8545,"voter_list/column_mapping_grid_component/column_mapping_grid_component_controller.ts":9152,"voter_list/consent_terms_form_component/consent_terms_form_component_controller.js":5162,"voter_list/editor_grid_component/editor_grid_component_controller.ts":4064,"voter_list/filter_component/filter_component_controller.js":3944,"voter_list/filters/base_component/base_component_controller.js":7126,"voter_list/google_sheets_importer_component/google_sheets_importer_component_controller.ts":9468,"voter_list/import_method_selector_component/import_method_selector_component_controller.ts":1476,"voter_list/importation_overview_component/importation_overview_component_controller.js":332,"voter_list/joined_label_editor_component/joined_label_editor_component_controller.ts":7108,"voter_list/pagination_component/pagination_component_controller.js":920,"voter_list/password_editor_component/password_editor_component_controller.js":8234,"voter_list/post_save_grid_component/post_save_grid_component_controller.ts":2752,"voter_list/processing_voters_component/processing_voters_component_controller.js":5898,"voter_list/sign_in_help_text_form_component/sign_in_help_text_form_component_controller.ts":9386,"voter_list/table_component/table_component_controller.js":126,"voters/proxies/admin_proxy_intentions/dismissed_modal_component/dismissed_modal_component_controller.ts":4e3,"voters/proxy/admin_proxy_intention_component/admin_proxy_intention_component_controller.ts":2709,"voters/proxy/agreement_edit_component/agreement_edit_component_controller.ts":5801,"votes/attributes/key_component/key_component_controller.ts":4204,"votes/choice_groups/group_prompt_component/group_prompt_component_controller.ts":7015,"votes/dashboard/add_to_vote_box_modal_component/add_to_vote_box_modal_component_controller.ts":6869,"votes/dashboard/calendar_component/calendar_component_controller.ts":7143,"votes/dashboard/next_event_component/next_event_component_controller.ts":9947,"votes/dashboard/remove_choices/answers_select_component/answers_select_component_controller.ts":6467,"votes/dashboard/remove_choices/modal_component/modal_component_controller.ts":1713,"votes/dashboard/remove_choices/success_modal_component/success_modal_component_controller.ts":2321,"votes/dashboard/result_list_component/result_list_component_controller.ts":8733,"votes/dashboard/select_filters_component/select_filters_component_controller.ts":2531,"votes/dashboard/vote_boxes_panel_component/vote_boxes_panel_component_controller.ts":3637,"votes/dashboard/vote_item_component/vote_item_component_controller.ts":2797,"votes/notices/on_demand_modal_component/on_demand_modal_component_controller.ts":1030,"votes/results/preferential/australian_stv/chart_component/chart_component_controller.ts":9957,"votes/results/preferential/borda_count/chart_component/chart_component_controller.ts":2454,"votes/setup/details/multi_language_select_component/multi_language_select_component_controller.ts":8929,"votes/setup/details/primary_language_select_component/primary_language_select_component_controller.ts":3561,"votes/setup/progress/progress_component/progress_component_controller.ts":1984,"votes/setup/questions/settings_component/settings_component_controller.ts":4068,"votes/setup/questions/voter_instructions_component/voter_instructions_component_controller.ts":9602,"votes/translations/answers/item_component/item_component_controller.ts":2539,"votes/translations/answers/list_component/list_component_controller.ts":1589,"votes/translations/auto_translate_button_component/auto_translate_button_component_controller.ts":4447,"votes/translations/choice_groups/item_component/item_component_controller.ts":5202,"votes/translations/input_component/input_component_controller.ts":4703,"votes/translations/languages/edit_component/edit_component_controller.ts":9237,"votes/translations/page_component/page_component_controller.ts":215,"votes/translations/questions/item_component/item_component_controller.ts":7025,"votes/translations/questions/list_component/list_component_controller.ts":4259,"votes/translations/score_options/item_component/item_component_controller.ts":3707};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=6742},3760:function(e,t,n){var r={"./download_file_channel.js":8205,"./flash_message_channel.js":4796,"./loading_indicator_channel.js":4948,"./organization_notifications_channel.js":8332,"./user_notifications_channel.js":2264,"channels/download_file_channel.js":8205,"channels/flash_message_channel.js":4796,"channels/loading_indicator_channel.js":4948,"channels/organization_notifications_channel.js":8332,"channels/user_notifications_channel.js":2264};function o(e){var t=i(e);return n(t)}fu
2nction i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=3760},3424:function(e,t,n){var r={"./admin/elections/vote_by_votes_controller.ts":975,"./append_voters_legacy_controller.js":5530,"./auto_add_question_controller.js":6834,"./autocomplete_controller.js":2326,"./billing_filter_controller.js":7060,"./character_limited_input_controller.js":3609,"./chart_controller.js":4690,"./checkbox_dependency_controller.js":9367,"./clipboard_controller.ts":2666,"./confirm_submit_controller.js":3865,"./copy_to_os_clipboard_controller.js":1211,"./elections/voting_links_modal_controller.ts":1474,"./modal_loading_controller.js":2932,"./organization/meeting_vote_attachments_controller.js":2727,"./organization_delete_confirmation_controller.js":6821,"./quorum_and_winners_controller.ts":9084,"./reoderable_table_controller.js":6920,"./results_frame_loader_controller.ts":9726,"./results_frame_poller_controller.ts":4885,"./results_frame_refresher_controller.ts":6745,"./results_overview_sync_controller.ts":978,"./results_processing_banner_controller.ts":3045,"./results_viewing_controller.ts":182,"./scroll_controller.js":2037,"./secure_enter_access_key_controller.js":1511,"./stripe_check_controller.js":1240,"./survey_switch_controller.js":8851,"./text_preview_controller.js":5334,"./voter_list/ai_importer_redirect_controller.ts":7622,"./voter_list/ai_importer_submit_controller.ts":5506,"./voter_list/ai_importer_transition_controller.ts":3827,"./voter_list/ai_warnings_filter_controller.ts":8727,"./votes/choice_groups/form_component_controller.ts":8591,"./votes/choice_groups/management_controller.ts":8476,"./weight_switch_controller.js":5397,"./write_in_drag_controller.js":8784,"./write_in_drop_controller.js":1025,"controllers/admin/elections/vote_by_votes_controller.ts":975,"controllers/append_voters_legacy_controller.js":5530,"controllers/auto_add_question_controller.js":6834,"controllers/autocomplete_controller.js":2326,"controllers/billing_filter_controller.js":7060,"controllers/character_limited_input_controller.js":3609,"controllers/chart_controller.js":4690,"controllers/checkbox_dependency_controller.js":9367,"controllers/clipboard_controller.ts":2666,"controllers/confirm_submit_controller.js":3865,"controllers/copy_to_os_clipboard_controller.js":1211,"controllers/elections/voting_links_modal_controller.ts":1474,"controllers/modal_loading_controller.js":2932,"controllers/organization/meeting_vote_attachments_controller.js":2727,"controllers/organization_delete_confirmation_controller.js":6821,"controllers/quorum_and_winners_controller.ts":9084,"controllers/reoderable_table_controller.js":6920,"controllers/results_frame_loader_controller.ts":9726,"controllers/results_frame_poller_controller.ts":4885,"controllers/results_frame_refresher_controller.ts":6745,"controllers/results_overview_sync_controller.ts":978,"controllers/results_processing_banner_controller.ts":3045,"controllers/results_viewing_controller.ts":182,"controllers/scroll_controller.js":2037,"controllers/secure_enter_access_key_controller.js":1511,"controllers/stripe_check_controller.js":1240,"controllers/survey_switch_controller.js":8851,"controllers/text_preview_controller.js":5334,"controllers/voter_list/ai_importer_redirect_controller.ts":7622,"controllers/voter_list/ai_importer_submit_controller.ts":5506,"controllers/voter_list/ai_importer_transition_controller.ts":3827,"controllers/voter_list/ai_warnings_filter_controller.ts":8727,"controllers/votes/choice_groups/form_component_controller.ts":8591,"controllers/votes/choice_groups/management_controller.ts":8476,"controllers/weight_switch_controller.js":5397,"controllers/write_in_drag_controller.js":8784,"controllers/write_in_drop_controller.js":1025};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=3424},1786:function(){}},function(e){e.O(0,[165],function(){return t=1450,e(e.s=t);var t});e.O()}]);
3//# sourceMappingURL=application-b73082404d9f6af6e35a.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.