{ "version": 3, "sources": ["../../../node_modules/@honeybadger-io/core/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js", "../../../node_modules/@honeybadger-io/core/build/src/util.js", "../../../node_modules/@honeybadger-io/core/build/src/store.js", "../../../node_modules/@honeybadger-io/core/node_modules/json-nd/dist/module/index.js", "../../../node_modules/@honeybadger-io/core/build/src/defaults.js", "../../../node_modules/@honeybadger-io/core/build/src/throttled_events_logger.js", "../../../node_modules/@honeybadger-io/core/build/src/client.js", "../../../node_modules/@honeybadger-io/core/build/src/types.js", "../../../node_modules/@honeybadger-io/core/build/src/index.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/util.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/onerror.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/onunhandledrejection.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/breadcrumbs.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/events.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/timers.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/event_listeners.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/transport.js", "../../../node_modules/@honeybadger-io/js/build/src/browser.js", "../../../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js", "../../../node_modules/@rails/actioncable/src/adapters.js", "../../../node_modules/@rails/actioncable/src/logger.js", "../../../node_modules/@rails/actioncable/src/connection_monitor.js", "../../../node_modules/@rails/actioncable/src/internal.js", "../../../node_modules/@rails/actioncable/src/connection.js", "../../../node_modules/@rails/actioncable/src/subscription.js", "../../../node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../../node_modules/@rails/actioncable/src/subscriptions.js", "../../../node_modules/@rails/actioncable/src/consumer.js", "../../../node_modules/@rails/actioncable/src/index.js", "../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../../vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/shared_ui/demo/controller.js", "../../../vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/shared_ui/demo_unwrapped/controller.js", "import-glob:/tmp/build_055c2b3e/vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/**/controller.js", "import-glob:/tmp/build_055c2b3e/app/frontend/components/**/controller.js", "../../frontend/javascript/controllers/administrative_info_step_controller.js", "../../frontend/javascript/controllers/archive_modal_controller.js", "../../frontend/javascript/controllers/candidate_profile_note_controller.js", "../../frontend/javascript/controllers/candidate_profile_note_new_controller.js", "../../frontend/javascript/controllers/candidate_profile_score_controller.js", "../../frontend/javascript/controllers/candidate_profile_step_controller.js", "../../frontend/javascript/controllers/click_to_copy_button_controller.js", "../../frontend/javascript/controllers/clickable_dashboard_table_row_controller.js", "../../frontend/javascript/controllers/essays_step_controller.js", "../../frontend/javascript/controllers/hidden_field_controller.js", "../../frontend/javascript/controllers/kebab_dropdown_controller.js", "../../frontend/javascript/controllers/matching_preference_step/deferred_year_placement_controller.js", "../../frontend/javascript/controllers/matching_preference_step/immediate_placement_controller.js", "../../../node_modules/sortablejs/modular/sortable.complete.esm.js", "../../frontend/javascript/controllers/matching_preference_step/mba_placement_controller.js", "../../frontend/javascript/controllers/opening_candidates_state_filter_controller.js", "../../frontend/javascript/controllers/read_more_controller.js", "../../frontend/javascript/controllers/review_candidates_controller.js", "../../frontend/javascript/controllers/search_form_controller.js", "../../frontend/javascript/controllers/submission_log_controller.js", "../../frontend/javascript/controllers/submission_view_controller.js", "../../frontend/javascript/controllers/turbo_modal_controller.js", "../../frontend/javascript/controllers/type_to_confirm_controller.js", "import-glob:/tmp/build_055c2b3e/app/frontend/javascript/controllers/**/*_controller.js", "import-glob:/tmp/build_055c2b3e/health_insurance/app/frontend/components/**/controller.js", "import-glob:/tmp/build_055c2b3e/health_insurance/app/frontend/javascript/controllers/**/*_controller.js", "../../frontend/javascript/includes/form_polyfill.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.IFDWM6P4.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.DL5222VR.js", "../../../node_modules/@lit/reactive-element/src/css-tag.ts", "../../../node_modules/@lit/reactive-element/src/reactive-element.ts", "../../../node_modules/lit-html/src/lit-html.ts", "../../../node_modules/lit-element/src/lit-element.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.BWVSW6TI.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.2QENN3UW.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GI7VDIWX.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.7PFTIGIY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.NYIIDP5N.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3Y6SB6QS.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.P7ZG6EMR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GWB677OL.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.FN2JAFC4.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QLXRCYS4.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.2FB5TK5H.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.B6TFD6BC.js", "../../../node_modules/@lit/reactive-element/src/decorators/property.ts", "../../../node_modules/@lit/reactive-element/src/decorators/state.ts", "../../../node_modules/@lit/reactive-element/src/decorators/event-options.ts", "../../../node_modules/@lit/reactive-element/src/decorators/base.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query.ts", "../../../node_modules/@lit/reactive-element/src/decorators/query-async.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.G3CRXWA7.js", "../../../node_modules/lit-html/src/directive-helpers.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.LH6XHGP3.js", "../../../node_modules/lit-html/src/directive.ts", "../../../node_modules/lit-html/src/directives/class-map.ts", "../../../node_modules/lit-html/src/directives/if-defined.ts", "../../../node_modules/lit-html/src/directives/live.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.Y6LYO22P.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.FTPRKEVO.js", "../../../node_modules/@shoelace-style/localize/dist/index.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.MAS2SHYD.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.WLV3FVBR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.NW6O4U5L.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.DHU6MIVB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.LHI6QEL2.js", "../../../node_modules/lit-html/src/directives/when.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.FWMBOJPE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.AB5G7M5M.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.TWS2FELI.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.HF7GESMZ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5NCDYYMI.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.KPAHWOC2.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YKKSQ2FG.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.MU3LYNZE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YUEWYDYG.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.JXE6F466.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.CYZCHJRL.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.WPBQYYZI.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.HEVWVJOK.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.C3GRIIDY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.MIBFGBOF.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.TILOZ42H.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3KSWVBQ5.js", "../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs", "../../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs", "../../../node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.mjs", "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs", "../../../node_modules/composed-offset-position/dist/composed-offset-position.browser.min.mjs", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ID5CVIH6.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.B4BZKR24.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.REAHJ2OM.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5FVTGOOE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.H5QVAIPA.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.RK73WSZS.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.6I2T3DLI.js", "../../../node_modules/lit-html/src/static.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.4JGTH3ZX.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.C5I65EDT.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.WTE7FOFQ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.BQSEJD7X.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.MLC6WRFV.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.RMOMG2CV.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ZFKLGLW5.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.Z6SEMMSU.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.BNR7Z3LV.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.UAYXD3AN.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ESELY2US.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.W6S4QIGT.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5CLSEBFG.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.O4N3BANP.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.OYGMGIB5.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.PJ2ERY3I.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YUXDGYNH.js", "../../../node_modules/lit-html/src/directives/unsafe-html.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.S736CJUV.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.MB4OUFSS.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.HTQNKB5E.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.2RHE6D7Z.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.4G7BAEUC.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GKTX645Y.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.7TRB5GG6.js", "../../../node_modules/lit-html/src/directives/style-map.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QHFG3MY7.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3ORM4IUW.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.VMQBFP2W.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.TKYPOV7P.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5VKIB4HA.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.WX76DPZA.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.SNI4F26X.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.OZRYCUIL.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.G3KSXKMR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.TDA3CAZX.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YUC2R6IX.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.UB5Y5ZSR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.2OUC42YY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.HDUOVLMT.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.7R6QANJA.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.BWRG35MZ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5D6IT2SR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.B3NWY7L4.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3LZWPGEZ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.2IHMH66B.js", "../../../node_modules/qr-creator/dist/src/qr-creator.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.X2O4XFBZ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.6NUBNAHE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.F7D7UTMJ.js", "../../../node_modules/@shoelace-style/animations/dist/index.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/bounce.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/flash.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/headShake.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/heartBeat.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/jello.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/pulse.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/rubberBand.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/shake.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/shakeX.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/shakeY.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/swing.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/tada.js", "../../../node_modules/@shoelace-style/animations/dist/attention_seekers/wobble.js", "../../../node_modules/@shoelace-style/animations/dist/back_entrances/backInDown.js", "../../../node_modules/@shoelace-style/animations/dist/back_entrances/backInLeft.js", "../../../node_modules/@shoelace-style/animations/dist/back_entrances/backInRight.js", "../../../node_modules/@shoelace-style/animations/dist/back_entrances/backInUp.js", "../../../node_modules/@shoelace-style/animations/dist/back_exits/backOutDown.js", "../../../node_modules/@shoelace-style/animations/dist/back_exits/backOutLeft.js", "../../../node_modules/@shoelace-style/animations/dist/back_exits/backOutRight.js", "../../../node_modules/@shoelace-style/animations/dist/back_exits/backOutUp.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_entrances/bounceIn.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_entrances/bounceInDown.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_entrances/bounceInLeft.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_entrances/bounceInRight.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_entrances/bounceInUp.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_exits/bounceOut.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_exits/bounceOutDown.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_exits/bounceOutLeft.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_exits/bounceOutRight.js", "../../../node_modules/@shoelace-style/animations/dist/bouncing_exits/bounceOutUp.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeIn.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInBottomLeft.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInBottomRight.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInDown.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInDownBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInLeft.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInLeftBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInRight.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInRightBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInTopLeft.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInTopRight.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInUp.js", "../../../node_modules/@shoelace-style/animations/dist/fading_entrances/fadeInUpBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOut.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutBottomLeft.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutBottomRight.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutDown.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutDownBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutLeft.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutLeftBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutRight.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutRightBig.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutTopLeft.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutTopRight.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutUp.js", "../../../node_modules/@shoelace-style/animations/dist/fading_exits/fadeOutUpBig.js", "../../../node_modules/@shoelace-style/animations/dist/flippers/flip.js", "../../../node_modules/@shoelace-style/animations/dist/flippers/flipInX.js", "../../../node_modules/@shoelace-style/animations/dist/flippers/flipInY.js", "../../../node_modules/@shoelace-style/animations/dist/flippers/flipOutX.js", "../../../node_modules/@shoelace-style/animations/dist/flippers/flipOutY.js", "../../../node_modules/@shoelace-style/animations/dist/lightspeed/lightSpeedInLeft.js", "../../../node_modules/@shoelace-style/animations/dist/lightspeed/lightSpeedInRight.js", "../../../node_modules/@shoelace-style/animations/dist/lightspeed/lightSpeedOutLeft.js", "../../../node_modules/@shoelace-style/animations/dist/lightspeed/lightSpeedOutRight.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_entrances/rotateIn.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_entrances/rotateInDownLeft.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_entrances/rotateInDownRight.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_entrances/rotateInUpLeft.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_entrances/rotateInUpRight.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_exits/rotateOut.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_exits/rotateOutDownLeft.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_exits/rotateOutDownRight.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_exits/rotateOutUpLeft.js", "../../../node_modules/@shoelace-style/animations/dist/rotating_exits/rotateOutUpRight.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_entrances/slideInDown.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_entrances/slideInLeft.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_entrances/slideInRight.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_entrances/slideInUp.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_exits/slideOutDown.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_exits/slideOutLeft.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_exits/slideOutRight.js", "../../../node_modules/@shoelace-style/animations/dist/sliding_exits/slideOutUp.js", "../../../node_modules/@shoelace-style/animations/dist/specials/hinge.js", "../../../node_modules/@shoelace-style/animations/dist/specials/jackInTheBox.js", "../../../node_modules/@shoelace-style/animations/dist/specials/rollIn.js", "../../../node_modules/@shoelace-style/animations/dist/specials/rollOut.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_entrances/zoomIn.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_entrances/zoomInDown.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_entrances/zoomInLeft.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_entrances/zoomInRight.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_entrances/zoomInUp.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_exits/zoomOut.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_exits/zoomOutDown.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_exits/zoomOutLeft.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_exits/zoomOutRight.js", "../../../node_modules/@shoelace-style/animations/dist/zooming_exits/zoomOutUp.js", "../../../node_modules/@shoelace-style/animations/dist/easings/easings.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.XVVDUPMB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3VAP7IY5.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.NNTERHT3.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5MCQXW5I.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.UJBVFBPQ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GXC456DW.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.U3HWIOEM.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.Y44MPQRD.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.XOSELTMG.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.NZEYV5US.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ZILVVZCE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.2W6X55FG.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ELWTSBKS.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.T6ZTLJ5Q.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.TSF6TCNR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.F2YMP7DQ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.J3ECUPFC.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.AQGIXORR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.VFFZIT5D.js", "../../../node_modules/lit-html/src/async-directive.ts", "../../../node_modules/lit-html/src/directives/ref.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GZKJ6PRL.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.557KF27K.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GKDTX7W6.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QPEK4MCY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.MO6WY3WQ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.PAQJQZBZ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.RCGFCKTU.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.KH4FCRQA.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.4VWKE6GB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QKLDALCP.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YSTTKTFJ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GN52LH7H.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.VVA35HTY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.JKX7KM35.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ILKIHMPF.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.FY7IKLNL.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.XNEONNEJ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.VBGD7BLD.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YZQ7XRT2.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QH6ALEL2.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YQNKP3Q2.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.26H5QS3I.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.LXDTFLWU.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ODFLWOL6.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QQ5G63QY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GOEV4JIG.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5W46KFXD.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.IB34ADPF.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.A5WFJGOY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.BJTQT2SX.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5BG7TIEZ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.XMDANX4H.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.I2ETTTKB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.B4SUN5CU.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.SFN526BP.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ELP2RQHD.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.M3CFWLRL.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.SUSCR7CI.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GQB3TAI4.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.HIKFKMSR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3BUYOWA7.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.6NVJRHI6.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.C525NMI5.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.WSSNCNLM.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.65EVIOZE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.YUZ3WNCY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.S5IINCEW.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.AEGFFDM7.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.VVMATD7B.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.NQ44LUGM.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.DR55IIJP.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.IYP7UD7U.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.4MVAYPUS.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.O6CEROC7.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.EF6A5QZD.js", "../../../node_modules/@ctrl/tinycolor/dist/module/util.js", "../../../node_modules/@ctrl/tinycolor/dist/module/conversion.js", "../../../node_modules/@ctrl/tinycolor/dist/module/css-color-names.js", "../../../node_modules/@ctrl/tinycolor/dist/module/format-input.js", "../../../node_modules/@ctrl/tinycolor/dist/module/index.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ADAM4LYE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.PXPS5DDB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.GYWFQ7LW.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.7F2AYSXO.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.JXHPMATR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.F4VGSDIW.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.BMOWACWC.js", "../../../node_modules/lit-html/src/directives/map.ts", "../../../node_modules/lit-html/src/directives/range.ts", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.FIOT3PPQ.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.FO4CERO3.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QMNTHEY6.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.IPC2RXFS.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3JACUH5X.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.XATQCPIE.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.QA7SM3IR.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.K35GSB4N.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.CYW6LVPA.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.U3CJOLF6.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.HNZRMQWM.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.3O7K4H2K.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ASVEH3KB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.M3A4TKTU.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.AXBOHSD3.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.KT4W6UBC.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.P4NYDBZP.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.J6U36JK4.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.ZB4QJ3NB.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.7S3N4RNY.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.TDFT4NO2.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.D7PTKVQX.js", "../../../node_modules/@teamshares/shoelace/dist/chunks/chunk.5SDGWMUO.js", "../../../node_modules/@teamshares/design-system/rails-js/index.js", "../../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../../node_modules/@teamshares/design-system/rails-js/includes/ts_wrapper.js", "../../../node_modules/@teamshares/design-system/rails-js/controllers/index.js", "../../../node_modules/@teamshares/design-system/rails-js/controllers/toggle_controller.js", "../../../node_modules/@teamshares/design-system/rails-js/controllers/launcher_controller.js", "../../frontend/javascript/application.js"], "sourcesContent": ["var UNKNOWN_FUNCTION = '';\n/**\n * This parses the different stack traces and puts them into one format\n * This borrows heavily from TraceKit (https://github.com/csnover/TraceKit)\n */\n\nfunction parse(stackString) {\n var lines = stackString.split('\\n');\n return lines.reduce(function (stack, line) {\n var parseResult = parseChrome(line) || parseWinjs(line) || parseGecko(line) || parseNode(line) || parseJSC(line);\n\n if (parseResult) {\n stack.push(parseResult);\n }\n\n return stack;\n }, []);\n}\nvar chromeRe = /^\\s*at (.*?) ?\\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\\/|[a-z]:\\\\|\\\\\\\\).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nvar chromeEvalRe = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\nfunction parseChrome(line) {\n var parts = chromeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n\n var submatch = chromeEvalRe.exec(parts[2]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n\n parts[3] = submatch[2]; // line\n\n parts[4] = submatch[3]; // column\n }\n\n return {\n file: !isNative ? parts[2] : null,\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: isNative ? [parts[2]] : [],\n lineNumber: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar winjsRe = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseWinjs(line) {\n var parts = winjsRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar geckoRe = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nvar geckoEvalRe = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nfunction parseGecko(line) {\n var parts = geckoRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n var submatch = geckoEvalRe.exec(parts[3]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = null; // no column when eval\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: parts[2] ? parts[2].split(',') : [],\n lineNumber: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar javaScriptCoreRe = /^\\s*(?:([^@]*)(?:\\((.*?)\\))?@)?(\\S.*?):(\\d+)(?::(\\d+))?\\s*$/i;\n\nfunction parseJSC(line) {\n var parts = javaScriptCoreRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[4],\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar nodeRe = /^\\s*at (?:((?:\\[object object\\])?[^\\\\/]+(?: \\[as \\S+\\])?) )?\\(?(.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseNode(line) {\n var parts = nodeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nexport { parse };\n", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isBrowserConfig = exports.clone = exports.formatCGIData = exports.filterUrl = exports.filter = exports.generateStackTrace = exports.endpoint = exports.instrumentConsole = exports.instrument = exports.isErrorObject = exports.makeNotice = exports.logger = exports.sanitize = exports.shallowClone = exports.runAfterNotifyHandlers = exports.runBeforeNotifyHandlers = exports.getSourceForBacktrace = exports.getCauses = exports.calculateBacktraceShift = exports.DEFAULT_BACKTRACE_SHIFT = exports.makeBacktrace = exports.objectIsExtensible = exports.objectIsEmpty = exports.mergeNotice = exports.merge = void 0;\n/* eslint-disable prefer-rest-params */\nvar stackTraceParser = __importStar(require(\"stacktrace-parser\"));\nfunction merge(obj1, obj2) {\n var result = {};\n for (var k in obj1) {\n result[k] = obj1[k];\n }\n for (var k in obj2) {\n result[k] = obj2[k];\n }\n return result;\n}\nexports.merge = merge;\nfunction mergeNotice(notice1, notice2) {\n var result = merge(notice1, notice2);\n if (notice1.context && notice2.context) {\n result.context = merge(notice1.context, notice2.context);\n }\n return result;\n}\nexports.mergeNotice = mergeNotice;\nfunction objectIsEmpty(obj) {\n for (var k in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, k)) {\n return false;\n }\n }\n return true;\n}\nexports.objectIsEmpty = objectIsEmpty;\nfunction objectIsExtensible(obj) {\n if (typeof Object.isExtensible !== 'function') {\n return true;\n }\n return Object.isExtensible(obj);\n}\nexports.objectIsExtensible = objectIsExtensible;\nfunction makeBacktrace(stack, filterHbSourceCode, logger) {\n if (filterHbSourceCode === void 0) { filterHbSourceCode = false; }\n if (logger === void 0) { logger = console; }\n if (!stack) {\n return [];\n }\n try {\n var backtrace = stackTraceParser\n .parse(stack)\n .map(function (line) {\n return {\n file: line.file,\n method: line.methodName,\n number: line.lineNumber,\n column: line.column\n };\n });\n if (filterHbSourceCode) {\n backtrace.splice(0, calculateBacktraceShift(backtrace));\n }\n return backtrace;\n }\n catch (err) {\n logger.debug(err);\n return [];\n }\n}\nexports.makeBacktrace = makeBacktrace;\nfunction isFrameFromHbSourceCode(frame) {\n var hasHbFile = false;\n var hasHbMethod = false;\n if (frame.file) {\n hasHbFile = frame.file.toLowerCase().indexOf('@honeybadger-io') > -1;\n }\n if (frame.method) {\n hasHbMethod = frame.method.toLowerCase().indexOf('@honeybadger-io') > -1;\n }\n return hasHbFile || hasHbMethod;\n}\nexports.DEFAULT_BACKTRACE_SHIFT = 3;\n/**\n * If {@link generateStackTrace} is used, we want to exclude frames that come from\n * Honeybadger's source code.\n *\n * Logic:\n * - For each frame, increment the shift if source code is from Honeybadger\n * - If a frame from an file is encountered increment the shift ONLY if between Honeybadger source code\n * (i.e. previous and next frames are from Honeybadger)\n * - Exit when frame encountered is not from Honeybadger source code\n *\n * Note: this will not always work, especially in browser versions where code\n * is minified, uglified and bundled.\n * For those cases we default to 3:\n * - generateStackTrace\n * - makeNotice\n * - notify\n */\nfunction calculateBacktraceShift(backtrace) {\n var shift = 0;\n for (var i = 0; i < backtrace.length; i++) {\n var frame = backtrace[i];\n if (isFrameFromHbSourceCode(frame)) {\n shift++;\n continue;\n }\n if (!frame.file || frame.file === '') {\n var nextFrame = backtrace[i + 1];\n if (nextFrame && isFrameFromHbSourceCode(nextFrame)) {\n shift++;\n continue;\n }\n }\n break;\n }\n return shift || exports.DEFAULT_BACKTRACE_SHIFT;\n}\nexports.calculateBacktraceShift = calculateBacktraceShift;\nfunction getCauses(notice, logger) {\n if (notice.cause) {\n var causes = [];\n var cause = notice;\n // @ts-ignore this throws an error if tsconfig.json has strict: true\n while (causes.length < 3 && (cause = cause.cause)) {\n causes.push({\n class: cause.name,\n message: cause.message,\n backtrace: typeof cause.stack == 'string' ? makeBacktrace(cause.stack, false, logger) : null\n });\n }\n return causes;\n }\n return [];\n}\nexports.getCauses = getCauses;\nfunction getSourceForBacktrace(backtrace, getSourceFileHandler) {\n return __awaiter(this, void 0, void 0, function () {\n var result, index, trace, fileContent;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n result = [];\n if (!getSourceFileHandler || !backtrace || !backtrace.length) {\n return [2 /*return*/, result];\n }\n index = 0;\n _a.label = 1;\n case 1:\n if (!backtrace.length) return [3 /*break*/, 3];\n trace = backtrace.splice(0)[index];\n return [4 /*yield*/, getSourceFileHandler(trace.file)];\n case 2:\n fileContent = _a.sent();\n result[index] = getSourceCodeSnippet(fileContent, trace.number);\n index++;\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, result];\n }\n });\n });\n}\nexports.getSourceForBacktrace = getSourceForBacktrace;\nfunction runBeforeNotifyHandlers(notice, handlers) {\n var results = [];\n var result = true;\n for (var i = 0, len = handlers.length; i < len; i++) {\n var handler = handlers[i];\n var handlerResult = handler(notice);\n if (handlerResult === false) {\n result = false;\n }\n results.push(handlerResult);\n }\n return {\n results: results,\n result: result\n };\n}\nexports.runBeforeNotifyHandlers = runBeforeNotifyHandlers;\nfunction runAfterNotifyHandlers(notice, handlers, error) {\n if (notice && notice.afterNotify) {\n notice.afterNotify(error, notice);\n }\n for (var i = 0, len = handlers.length; i < len; i++) {\n handlers[i](error, notice);\n }\n return true;\n}\nexports.runAfterNotifyHandlers = runAfterNotifyHandlers;\n// Returns a new object with properties from other object.\nfunction shallowClone(obj) {\n if (typeof (obj) !== 'object' || obj === null) {\n return {};\n }\n var result = {};\n for (var k in obj) {\n result[k] = obj[k];\n }\n return result;\n}\nexports.shallowClone = shallowClone;\nfunction sanitize(obj, maxDepth) {\n if (maxDepth === void 0) { maxDepth = 8; }\n var seenObjects = [];\n function seen(obj) {\n if (!obj || typeof (obj) !== 'object') {\n return false;\n }\n for (var i = 0; i < seenObjects.length; i++) {\n var value = seenObjects[i];\n if (value === obj) {\n return true;\n }\n }\n seenObjects.push(obj);\n return false;\n }\n function canSerialize(obj) {\n var typeOfObj = typeof obj;\n // Functions are TMI\n if (/function/.test(typeOfObj)) {\n // Let special toJSON method pass as it's used by JSON.stringify (#722)\n return obj.name === 'toJSON';\n }\n // Symbols can't convert to strings.\n if (/symbol/.test(typeOfObj)) {\n return false;\n }\n if (obj === null) {\n return false;\n }\n // No prototype, likely created with `Object.create(null)`.\n if (typeof obj === 'object' && typeof obj.hasOwnProperty === 'undefined') {\n return false;\n }\n return true;\n }\n function serialize(obj, depth) {\n if (depth === void 0) { depth = 0; }\n if (depth >= maxDepth) {\n return '[DEPTH]';\n }\n // Inspect invalid types\n if (!canSerialize(obj)) {\n return Object.prototype.toString.call(obj);\n }\n // Halt circular references\n if (seen(obj)) {\n return '[RECURSION]';\n }\n // Serialize inside arrays\n if (Array.isArray(obj)) {\n return obj.map(function (o) { return safeSerialize(o, depth + 1); });\n }\n // Serialize inside objects\n if (typeof (obj) === 'object') {\n var ret = {};\n for (var k in obj) {\n var v = obj[k];\n if (Object.prototype.hasOwnProperty.call(obj, k) && (k != null) && (v != null)) {\n ret[k] = safeSerialize(v, depth + 1);\n }\n }\n return ret;\n }\n // Return everything else untouched\n return obj;\n }\n function safeSerialize(obj, depth) {\n if (depth === void 0) { depth = 0; }\n try {\n return serialize(obj, depth);\n }\n catch (e) {\n return \"[ERROR] \".concat(e);\n }\n }\n return safeSerialize(obj);\n}\nexports.sanitize = sanitize;\nfunction logger(client) {\n var log = function (method) {\n return function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (method === 'debug') {\n if (!client.config.debug) {\n return;\n }\n // Log at default level so that you don't need to also enable verbose\n // logging in Chrome.\n method = 'log';\n }\n args.unshift('[Honeybadger]');\n (_a = client.config.logger)[method].apply(_a, args);\n };\n };\n return {\n log: log('log'),\n info: log('info'),\n debug: log('debug'),\n warn: log('warn'),\n error: log('error')\n };\n}\nexports.logger = logger;\n/**\n * Converts any object into a notice object (which at minimum has the same\n * properties as Error, but supports additional Honeybadger properties.)\n */\nfunction makeNotice(thing) {\n var notice;\n if (!thing) {\n notice = {};\n }\n else if (isErrorObject(thing)) {\n var e = thing;\n notice = merge(thing, { name: e.name, message: e.message, stack: e.stack, cause: e.cause });\n }\n else if (typeof thing === 'object') {\n notice = shallowClone(thing);\n }\n else {\n var m = String(thing);\n notice = { message: m };\n }\n return notice;\n}\nexports.makeNotice = makeNotice;\nfunction isErrorObject(thing) {\n return thing instanceof Error\n || Object.prototype.toString.call(thing) === '[object Error]'; // Important for cross-realm objects\n}\nexports.isErrorObject = isErrorObject;\n/**\n * Instrument an existing function inside an object (usually global).\n * @param {!Object} object\n * @param {!String} name\n * @param {!Function} replacement\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction instrument(object, name, replacement) {\n if (!object || !name || !replacement || !(name in object)) {\n return;\n }\n try {\n var original = object[name];\n while (original && original.__hb_original) {\n original = original.__hb_original;\n }\n object[name] = replacement(original);\n object[name].__hb_original = original;\n }\n catch (_e) {\n // Ignores errors where \"original\" is a restricted object (see #1001)\n // Uncaught Error: Permission denied to access property \"__hb_original\"\n // Also ignores:\n // Error: TypeError: Cannot set property onunhandledrejection of [object Object] which has only a getter\n // User-Agent: Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-G960F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/12.1 Chrome/79.0.3945.136 Mobile Safari/537.36\n }\n}\nexports.instrument = instrument;\nvar _consoleAlreadyInstrumented = false;\nvar listeners = [];\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction instrumentConsole(_window, handler) {\n if (!_window || !_window.console || !handler) {\n return;\n }\n listeners.push(handler);\n if (_consoleAlreadyInstrumented) {\n return;\n }\n _consoleAlreadyInstrumented = true;\n ['debug', 'info', 'warn', 'error', 'log'].forEach(function (level) {\n instrument(_window.console, level, function hbLogger(original) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n listeners.forEach(function (listener) {\n try {\n listener(level, args);\n }\n catch (_e) {\n // ignore\n // should never reach here because instrument method already wraps with try/catch block\n }\n });\n if (typeof original === 'function') {\n Function.prototype.apply.call(original, _window.console, arguments);\n }\n };\n });\n });\n}\nexports.instrumentConsole = instrumentConsole;\nfunction endpoint(base, path) {\n var endpoint = base.trim().replace(/\\/$/, '');\n path = path.trim().replace(/(^\\/|\\/$)/g, '');\n return \"\".concat(endpoint, \"/\").concat(path);\n}\nexports.endpoint = endpoint;\nfunction generateStackTrace() {\n try {\n throw new Error('');\n }\n catch (e) {\n if (e.stack) {\n return e.stack;\n }\n }\n var maxStackSize = 10;\n var stack = [];\n var curr = arguments.callee;\n while (curr && stack.length < maxStackSize) {\n if (/function(?:\\s+([\\w$]+))+\\s*\\(/.test(curr.toString())) {\n stack.push(RegExp.$1 || '');\n }\n else {\n stack.push('');\n }\n try {\n curr = curr.caller;\n }\n catch (e) {\n break;\n }\n }\n return stack.join('\\n');\n}\nexports.generateStackTrace = generateStackTrace;\nfunction filter(obj, filters) {\n if (!is('Object', obj)) {\n return;\n }\n if (!is('Array', filters)) {\n filters = [];\n }\n var seen = [];\n function filter(obj) {\n var k, newObj;\n if (is('Object', obj) || is('Array', obj)) {\n if (seen.indexOf(obj) !== -1) {\n return '[CIRCULAR DATA STRUCTURE]';\n }\n seen.push(obj);\n }\n if (is('Object', obj)) {\n newObj = {};\n for (k in obj) {\n if (filterMatch(k, filters)) {\n newObj[k] = '[FILTERED]';\n }\n else {\n newObj[k] = filter(obj[k]);\n }\n }\n return newObj;\n }\n if (is('Array', obj)) {\n return obj.map(function (v) {\n return filter(v);\n });\n }\n if (is('Function', obj)) {\n return '[FUNC]';\n }\n return obj;\n }\n return filter(obj);\n}\nexports.filter = filter;\nfunction filterMatch(key, filters) {\n for (var i = 0; i < filters.length; i++) {\n if (key.toLowerCase().indexOf(filters[i].toLowerCase()) !== -1) {\n return true;\n }\n }\n return false;\n}\nfunction is(type, obj) {\n var klass = Object.prototype.toString.call(obj).slice(8, -1);\n return obj !== undefined && obj !== null && klass === type;\n}\nfunction filterUrl(url, filters) {\n if (!filters) {\n return url;\n }\n if (typeof url !== 'string') {\n return url;\n }\n var query = url.split(/\\?/, 2)[1];\n if (!query) {\n return url;\n }\n var result = url;\n query.split(/[&]\\s?/).forEach(function (pair) {\n var _a = pair.split('=', 2), key = _a[0], value = _a[1];\n if (filterMatch(key, filters)) {\n result = result.replace(\"\".concat(key, \"=\").concat(value), \"\".concat(key, \"=[FILTERED]\"));\n }\n });\n return result;\n}\nexports.filterUrl = filterUrl;\nfunction formatCGIData(vars, prefix) {\n if (prefix === void 0) { prefix = ''; }\n var formattedVars = {};\n Object.keys(vars).forEach(function (key) {\n var formattedKey = prefix + key.replace(/\\W/g, '_').toUpperCase();\n formattedVars[formattedKey] = vars[key];\n });\n return formattedVars;\n}\nexports.formatCGIData = formatCGIData;\nfunction clone(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\nexports.clone = clone;\nfunction getSourceCodeSnippet(fileData, lineNumber, sourceRadius) {\n if (sourceRadius === void 0) { sourceRadius = 2; }\n if (!fileData) {\n return null;\n }\n var lines = fileData.split('\\n');\n // add one empty line because array index starts from 0, but error line number is counted from 1\n lines.unshift('');\n var start = lineNumber - sourceRadius;\n var end = lineNumber + sourceRadius;\n var result = {};\n for (var i = start; i <= end; i++) {\n var line = lines[i];\n if (typeof line === 'string') {\n result[i] = line;\n }\n }\n return result;\n}\nfunction isBrowserConfig(config) {\n return config.async !== undefined;\n}\nexports.isBrowserConfig = isBrowserConfig;\n//# sourceMappingURL=util.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.GlobalStore = void 0;\nvar util_1 = require(\"./util\");\nvar GlobalStore = /** @class */ (function () {\n function GlobalStore(contents, breadcrumbsLimit) {\n this.contents = contents;\n this.breadcrumbsLimit = breadcrumbsLimit;\n }\n GlobalStore.create = function (contents, breadcrumbsLimit) {\n return new GlobalStore(contents, breadcrumbsLimit);\n };\n GlobalStore.prototype.available = function () {\n return true;\n };\n GlobalStore.prototype.getContents = function (key) {\n var value = key ? this.contents[key] : this.contents;\n return JSON.parse(JSON.stringify(value));\n };\n GlobalStore.prototype.setContext = function (context) {\n this.contents.context = (0, util_1.merge)(this.contents.context, context || {});\n };\n GlobalStore.prototype.addBreadcrumb = function (breadcrumb) {\n if (this.contents.breadcrumbs.length == this.breadcrumbsLimit) {\n this.contents.breadcrumbs.shift();\n }\n this.contents.breadcrumbs.push(breadcrumb);\n };\n GlobalStore.prototype.clear = function () {\n this.contents.context = {};\n this.contents.breadcrumbs = [];\n };\n GlobalStore.prototype.run = function (callback) {\n return callback();\n };\n return GlobalStore;\n}());\nexports.GlobalStore = GlobalStore;\n//# sourceMappingURL=store.js.map", "export class NdJson {\n static parse(data) {\n const lines = data.trim().split('\\n');\n return lines.map(line => JSON.parse(line));\n }\n static stringify(data) {\n return data.map(item => JSON.stringify(item)).join('\\n');\n }\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CONFIG = void 0;\nexports.CONFIG = {\n apiKey: null,\n endpoint: 'https://api.honeybadger.io',\n environment: null,\n hostname: null,\n projectRoot: null,\n component: null,\n action: null,\n revision: null,\n reportData: null,\n breadcrumbsEnabled: true,\n eventsEnabled: false,\n maxBreadcrumbs: 40,\n maxObjectDepth: 8,\n logger: console,\n developmentEnvironments: ['dev', 'development', 'test'],\n debug: false,\n tags: null,\n enableUncaught: true,\n enableUnhandledRejection: true,\n afterUncaught: function () { return true; },\n filters: ['creditcard', 'password'],\n __plugins: [],\n};\n//# sourceMappingURL=defaults.js.map", "\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ThrottledEventsLogger = void 0;\nvar json_nd_1 = require(\"json-nd\");\nvar util_1 = require(\"./util\");\nvar defaults_1 = require(\"./defaults\");\nvar ThrottledEventsLogger = /** @class */ (function () {\n function ThrottledEventsLogger(config, transport) {\n this.config = config;\n this.transport = transport;\n this.queue = [];\n this.isProcessing = false;\n this.config = __assign(__assign({}, defaults_1.CONFIG), config);\n this.logger = this.originalLogger();\n }\n ThrottledEventsLogger.prototype.configure = function (opts) {\n for (var k in opts) {\n this.config[k] = opts[k];\n }\n };\n ThrottledEventsLogger.prototype.logEvent = function (data) {\n this.queue.push(data);\n if (!this.isProcessing) {\n this.processQueue();\n }\n };\n ThrottledEventsLogger.prototype.processQueue = function () {\n var _this = this;\n if (this.queue.length === 0 || this.isProcessing) {\n return;\n }\n this.isProcessing = true;\n var eventsData = this.queue.slice();\n this.queue = [];\n var data = json_nd_1.NdJson.stringify(eventsData);\n this.makeHttpRequest(data)\n .then(function () {\n setTimeout(function () {\n _this.isProcessing = false;\n _this.processQueue();\n }, 50);\n })\n .catch(function (error) {\n _this.logger.error('[Honeybadger] Error making HTTP request:', error);\n // Continue processing the queue even if there's an error\n setTimeout(function () {\n _this.isProcessing = false;\n _this.processQueue();\n }, 50);\n });\n };\n ThrottledEventsLogger.prototype.makeHttpRequest = function (data) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.transport\n .send({\n headers: {\n 'X-API-Key': this.config.apiKey,\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n endpoint: (0, util_1.endpoint)(this.config.endpoint, '/v1/events'),\n maxObjectDepth: this.config.maxObjectDepth,\n logger: this.logger,\n }, data)\n .then(function () {\n if (_this.config.debug) {\n _this.logger.debug('[Honeybadger] Events sent successfully');\n }\n })\n .catch(function (err) {\n _this.logger.error(\"[Honeybadger] Error sending events: \".concat(err.message));\n })];\n });\n });\n };\n /**\n * todo: improve this\n *\n * The EventsLogger overrides the console methods\n * so if we want to log something we need to use the original methods\n */\n ThrottledEventsLogger.prototype.originalLogger = function () {\n var _a, _b, _c, _d, _e;\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n log: (_a = console.log.__hb_original) !== null && _a !== void 0 ? _a : console.log,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n info: (_b = console.info.__hb_original) !== null && _b !== void 0 ? _b : console.info,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug: (_c = console.debug.__hb_original) !== null && _c !== void 0 ? _c : console.debug,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n warn: (_d = console.warn.__hb_original) !== null && _d !== void 0 ? _d : console.warn,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: (_e = console.error.__hb_original) !== null && _e !== void 0 ? _e : console.error,\n };\n };\n return ThrottledEventsLogger;\n}());\nexports.ThrottledEventsLogger = ThrottledEventsLogger;\n//# sourceMappingURL=throttled_events_logger.js.map", "\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Client = void 0;\nvar util_1 = require(\"./util\");\nvar store_1 = require(\"./store\");\nvar throttled_events_logger_1 = require(\"./throttled_events_logger\");\nvar defaults_1 = require(\"./defaults\");\n// Split at commas and spaces\nvar TAG_SEPARATOR = /,|\\s+/;\n// Checks for non-blank characters\nvar NOT_BLANK = /\\S/;\nvar Client = /** @class */ (function () {\n function Client(opts, transport) {\n if (opts === void 0) { opts = {}; }\n this.__pluginsLoaded = false;\n this.__store = null;\n this.__beforeNotifyHandlers = [];\n this.__afterNotifyHandlers = [];\n this.__notifier = {\n name: '@honeybadger-io/core',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',\n version: '__VERSION__'\n };\n this.config = __assign(__assign({}, defaults_1.CONFIG), opts);\n this.__initStore();\n this.__transport = transport;\n this.__eventsLogger = new throttled_events_logger_1.ThrottledEventsLogger(this.config, this.__transport);\n this.logger = (0, util_1.logger)(this);\n }\n Client.prototype.getVersion = function () {\n return this.__notifier.version;\n };\n Client.prototype.getNotifier = function () {\n return this.__notifier;\n };\n /**\n * CAREFUL: When adding a new notifier or updating the name of an existing notifier,\n * the Honeybadger rails project may need its mappings updated.\n * See https://github.com/honeybadger-io/honeybadger/blob/master/app/presenters/breadcrumbs_presenter.rb\n * https://github.com/honeybadger-io/honeybadger/blob/master/app/models/parser/java_script.rb\n * https://github.com/honeybadger-io/honeybadger/blob/master/app/models/language.rb\n **/\n Client.prototype.setNotifier = function (notifier) {\n this.__notifier = notifier;\n };\n Client.prototype.configure = function (opts) {\n if (opts === void 0) { opts = {}; }\n for (var k in opts) {\n this.config[k] = opts[k];\n }\n this.__eventsLogger.configure(this.config);\n this.loadPlugins();\n return this;\n };\n Client.prototype.loadPlugins = function () {\n var _this = this;\n var pluginsToLoad = this.__pluginsLoaded\n ? this.config.__plugins.filter(function (plugin) { return plugin.shouldReloadOnConfigure; })\n : this.config.__plugins;\n pluginsToLoad.forEach(function (plugin) { return plugin.load(_this); });\n this.__pluginsLoaded = true;\n };\n Client.prototype.__initStore = function () {\n this.__store = new store_1.GlobalStore({ context: {}, breadcrumbs: [] }, this.config.maxBreadcrumbs);\n };\n Client.prototype.beforeNotify = function (handler) {\n this.__beforeNotifyHandlers.push(handler);\n return this;\n };\n Client.prototype.afterNotify = function (handler) {\n this.__afterNotifyHandlers.push(handler);\n return this;\n };\n Client.prototype.setContext = function (context) {\n if (typeof context === 'object' && context != null) {\n this.__store.setContext(context);\n }\n return this;\n };\n Client.prototype.resetContext = function (context) {\n this.logger.warn('Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.');\n this.__store.clear();\n if (typeof context === 'object' && context !== null) {\n this.__store.setContext(context);\n }\n return this;\n };\n Client.prototype.clear = function () {\n this.__store.clear();\n return this;\n };\n Client.prototype.notify = function (noticeable, name, extra) {\n var _this = this;\n if (name === void 0) { name = undefined; }\n if (extra === void 0) { extra = undefined; }\n var notice = this.makeNotice(noticeable, name, extra);\n // we need to have the source file data before the beforeNotifyHandlers,\n // in case they modify them\n var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1.shallowClone)(trace); }) : null;\n var preConditionsResult = this.__runPreconditions(notice);\n if (preConditionsResult instanceof Error) {\n (0, util_1.runAfterNotifyHandlers)(notice, this.__afterNotifyHandlers, preConditionsResult);\n return false;\n }\n if (preConditionsResult instanceof Promise) {\n preConditionsResult.then(function (result) {\n if (result instanceof Error) {\n (0, util_1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, result);\n return false;\n }\n return _this.__send(notice, sourceCodeData);\n });\n return true;\n }\n this.__send(notice, sourceCodeData).catch(function (_err) { });\n return true;\n };\n /**\n * An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.\n * Implemented using the {@link afterNotify} hook.\n * Rejects if for any reason the report failed to be reported.\n * Useful in serverless environments (AWS Lambda).\n */\n Client.prototype.notifyAsync = function (noticeable, name, extra) {\n var _this = this;\n if (name === void 0) { name = undefined; }\n if (extra === void 0) { extra = undefined; }\n return new Promise(function (resolve, reject) {\n var applyAfterNotify = function (partialNotice) {\n var originalAfterNotify = partialNotice.afterNotify;\n partialNotice.afterNotify = function (err) {\n originalAfterNotify === null || originalAfterNotify === void 0 ? void 0 : originalAfterNotify.call(_this, err);\n if (err) {\n return reject(err);\n }\n resolve();\n };\n };\n // We have to respect any afterNotify hooks that come from the arguments\n var objectToOverride;\n if (noticeable.afterNotify) {\n objectToOverride = noticeable;\n }\n else if (name && name.afterNotify) {\n objectToOverride = name;\n }\n else if (extra && extra.afterNotify) {\n objectToOverride = extra;\n }\n else if (name && typeof name === 'object') {\n objectToOverride = name;\n }\n else if (extra) {\n objectToOverride = extra;\n }\n else {\n objectToOverride = name = {};\n }\n applyAfterNotify(objectToOverride);\n _this.notify(noticeable, name, extra);\n });\n };\n Client.prototype.makeNotice = function (noticeable, name, extra) {\n if (name === void 0) { name = undefined; }\n if (extra === void 0) { extra = undefined; }\n var notice = (0, util_1.makeNotice)(noticeable);\n if (name && !(typeof name === 'object')) {\n var n = String(name);\n name = { name: n };\n }\n if (name) {\n notice = (0, util_1.mergeNotice)(notice, name);\n }\n if (typeof extra === 'object' && extra !== null) {\n notice = (0, util_1.mergeNotice)(notice, extra);\n }\n if ((0, util_1.objectIsEmpty)(notice)) {\n return null;\n }\n var context = this.__store.getContents('context');\n var noticeTags = this.__constructTags(notice.tags);\n var contextTags = this.__constructTags(context['tags']);\n var configTags = this.__constructTags(this.config.tags);\n // Turning into a Set will remove duplicates\n var tags = noticeTags.concat(contextTags).concat(configTags);\n var uniqueTags = tags.filter(function (item, index) { return tags.indexOf(item) === index; });\n notice = (0, util_1.merge)(notice, {\n name: notice.name || 'Error',\n context: (0, util_1.merge)(context, notice.context),\n projectRoot: notice.projectRoot || this.config.projectRoot,\n environment: notice.environment || this.config.environment,\n component: notice.component || this.config.component,\n action: notice.action || this.config.action,\n revision: notice.revision || this.config.revision,\n tags: uniqueTags,\n });\n // If we're passed a custom backtrace array, use it\n // Otherwise we make one.\n if (!Array.isArray(notice.backtrace) || !notice.backtrace.length) {\n if (typeof notice.stack !== 'string' || !notice.stack.trim()) {\n notice.stack = (0, util_1.generateStackTrace)();\n notice.backtrace = (0, util_1.makeBacktrace)(notice.stack, true, this.logger);\n }\n else {\n notice.backtrace = (0, util_1.makeBacktrace)(notice.stack, false, this.logger);\n }\n }\n return notice;\n };\n Client.prototype.addBreadcrumb = function (message, opts) {\n if (!this.config.breadcrumbsEnabled) {\n return;\n }\n opts = opts || {};\n var metadata = (0, util_1.shallowClone)(opts.metadata);\n var category = opts.category || 'custom';\n var timestamp = new Date().toISOString();\n this.__store.addBreadcrumb({\n category: category,\n message: message,\n metadata: metadata,\n timestamp: timestamp\n });\n return this;\n };\n Client.prototype.logEvent = function (data) {\n this.__eventsLogger.logEvent(data);\n };\n Client.prototype.__getBreadcrumbs = function () {\n return this.__store.getContents('breadcrumbs').slice();\n };\n Client.prototype.__getContext = function () {\n return this.__store.getContents('context');\n };\n Client.prototype.__developmentMode = function () {\n if (this.config.reportData === true) {\n return false;\n }\n return (this.config.environment && this.config.developmentEnvironments.includes(this.config.environment));\n };\n Client.prototype.__buildPayload = function (notice) {\n var headers = (0, util_1.filter)(notice.headers, this.config.filters) || {};\n var cgiData = (0, util_1.filter)(__assign(__assign({}, notice.cgiData), (0, util_1.formatCGIData)(headers, 'HTTP_')), this.config.filters);\n return {\n notifier: this.__notifier,\n breadcrumbs: {\n enabled: !!this.config.breadcrumbsEnabled,\n trail: notice.__breadcrumbs || []\n },\n error: {\n class: notice.name,\n message: notice.message,\n backtrace: notice.backtrace,\n fingerprint: notice.fingerprint,\n tags: notice.tags,\n causes: (0, util_1.getCauses)(notice, this.logger),\n },\n request: {\n url: (0, util_1.filterUrl)(notice.url, this.config.filters),\n component: notice.component,\n action: notice.action,\n context: notice.context,\n cgi_data: cgiData,\n params: (0, util_1.filter)(notice.params, this.config.filters) || {},\n session: (0, util_1.filter)(notice.session, this.config.filters) || {}\n },\n server: {\n project_root: notice.projectRoot,\n environment_name: notice.environment,\n revision: notice.revision,\n hostname: this.config.hostname,\n time: new Date().toUTCString()\n },\n details: notice.details || {}\n };\n };\n Client.prototype.__constructTags = function (tags) {\n if (!tags) {\n return [];\n }\n return tags.toString().split(TAG_SEPARATOR).filter(function (tag) { return NOT_BLANK.test(tag); });\n };\n Client.prototype.__runPreconditions = function (notice) {\n var _this = this;\n var preConditionError = null;\n if (!notice) {\n this.logger.debug('failed to build error report');\n preConditionError = new Error('failed to build error report');\n }\n if (this.config.reportData === false) {\n this.logger.debug('skipping error report: honeybadger.js is disabled', notice);\n preConditionError = new Error('honeybadger.js is disabled');\n }\n if (this.__developmentMode()) {\n this.logger.log('honeybadger.js is in development mode; the following error report will be sent in production.', notice);\n preConditionError = new Error('honeybadger.js is in development mode');\n }\n if (!this.config.apiKey) {\n this.logger.warn('could not send error report: no API key has been configured', notice);\n preConditionError = new Error('missing API key');\n }\n var beforeNotifyResult = (0, util_1.runBeforeNotifyHandlers)(notice, this.__beforeNotifyHandlers);\n if (!preConditionError && !beforeNotifyResult.result) {\n this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);\n preConditionError = new Error('beforeNotify handlers returned false');\n }\n if (beforeNotifyResult.results.length && beforeNotifyResult.results.some(function (result) { return result instanceof Promise; })) {\n return Promise.allSettled(beforeNotifyResult.results)\n .then(function (results) {\n if (!preConditionError && (results.some(function (result) { return result.status === 'rejected' || result.value === false; }))) {\n _this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);\n preConditionError = new Error('beforeNotify handlers (async) returned false');\n }\n if (preConditionError) {\n return preConditionError;\n }\n });\n }\n return preConditionError;\n };\n Client.prototype.__send = function (notice, originalBacktrace) {\n var _this = this;\n if (this.config.breadcrumbsEnabled) {\n this.addBreadcrumb('Honeybadger Notice', {\n category: 'notice',\n metadata: {\n message: notice.message,\n name: notice.name,\n stack: notice.stack\n }\n });\n notice.__breadcrumbs = this.__store.getContents('breadcrumbs');\n }\n else {\n notice.__breadcrumbs = [];\n }\n return (0, util_1.getSourceForBacktrace)(originalBacktrace, this.__getSourceFileHandler)\n .then(function (sourcePerTrace) { return __awaiter(_this, void 0, void 0, function () {\n var payload;\n return __generator(this, function (_a) {\n sourcePerTrace.forEach(function (source, index) {\n notice.backtrace[index].source = source;\n });\n payload = this.__buildPayload(notice);\n return [2 /*return*/, this.__transport\n .send({\n headers: {\n 'X-API-Key': this.config.apiKey,\n 'Content-Type': 'application/json',\n 'Accept': 'text/json, application/json'\n },\n method: 'POST',\n endpoint: (0, util_1.endpoint)(this.config.endpoint, '/v1/notices/js'),\n maxObjectDepth: this.config.maxObjectDepth,\n logger: this.logger,\n }, payload)];\n });\n }); })\n .then(function (res) {\n if (res.statusCode !== 201) {\n (0, util_1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, new Error(\"Bad HTTP response: \".concat(res.statusCode)));\n _this.logger.warn(\"Error report failed: unknown response from server. code=\".concat(res.statusCode));\n return false;\n }\n var uuid = JSON.parse(res.body).id;\n (0, util_1.runAfterNotifyHandlers)((0, util_1.merge)(notice, {\n id: uuid\n }), _this.__afterNotifyHandlers);\n _this.logger.info(\"Error report sent \\u26A1 https://app.honeybadger.io/notice/\".concat(uuid));\n return true;\n })\n .catch(function (err) {\n _this.logger.error('Error report failed: an unknown error occurred.', \"message=\".concat(err.message));\n (0, util_1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, err);\n return false;\n });\n };\n return Client;\n}());\nexports.Client = Client;\n//# sourceMappingURL=client.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Util = exports.Types = exports.Client = void 0;\nvar client_1 = require(\"./client\");\nObject.defineProperty(exports, \"Client\", { enumerable: true, get: function () { return client_1.Client; } });\n__exportStar(require(\"./store\"), exports);\nexports.Types = __importStar(require(\"./types\"));\nexports.Util = __importStar(require(\"./util\"));\n//# sourceMappingURL=index.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.globalThisOrWindow = exports.preferCatch = exports.encodeCookie = exports.decodeCookie = exports.localURLPathname = exports.parseURL = exports.nativeFetch = exports.stringTextOfElement = exports.stringSelectorOfElement = exports.stringNameOfElement = void 0;\n/**\n * Converts an HTMLElement into a human-readable string.\n * @param {!HTMLElement} element\n * @return {string}\n */\nfunction stringNameOfElement(element) {\n if (!element || !element.tagName) {\n return '';\n }\n var name = element.tagName.toLowerCase();\n // Ignore the root element in selectors and events.\n if (name === 'html') {\n return '';\n }\n if (element.id) {\n name += \"#\".concat(element.id);\n }\n var stringClassNames = element.getAttribute('class');\n if (stringClassNames) {\n stringClassNames.split(/\\s+/).forEach(function (className) {\n name += \".\".concat(className);\n });\n }\n ['alt', 'name', 'title', 'type'].forEach(function (attrName) {\n var attr = element.getAttribute(attrName);\n if (attr) {\n name += \"[\".concat(attrName, \"=\\\"\").concat(attr, \"\\\"]\");\n }\n });\n var siblings = getSiblings(element);\n if (siblings.length > 1) {\n name += \":nth-child(\".concat(Array.prototype.indexOf.call(siblings, element) + 1, \")\");\n }\n return name;\n}\nexports.stringNameOfElement = stringNameOfElement;\nfunction stringSelectorOfElement(element) {\n var name = stringNameOfElement(element);\n if (element.parentNode && element.parentNode.tagName) {\n var parentName = stringSelectorOfElement(element.parentNode);\n if (parentName.length > 0) {\n return \"\".concat(parentName, \" > \").concat(name);\n }\n }\n return name;\n}\nexports.stringSelectorOfElement = stringSelectorOfElement;\nfunction stringTextOfElement(element) {\n var text = element.textContent || element.innerText || '';\n if (!text && (element.type === 'submit' || element.type === 'button')) {\n text = element.value;\n }\n return truncate(text.trim(), 300);\n}\nexports.stringTextOfElement = stringTextOfElement;\nfunction nativeFetch() {\n var global = globalThisOrWindow();\n if (!global.fetch) {\n return false;\n }\n if (isNative(global.fetch)) {\n return true;\n }\n if (typeof document === 'undefined') {\n return false;\n }\n // If fetch isn't native, it may be wrapped by someone else. Try to get\n // a pristine function from an iframe.\n try {\n var sandbox = document.createElement('iframe');\n sandbox.style.display = 'none';\n document.head.appendChild(sandbox);\n var result = sandbox.contentWindow.fetch && isNative(sandbox.contentWindow.fetch);\n document.head.removeChild(sandbox);\n return result;\n }\n catch (err) {\n if (console && console.warn) {\n console.warn('failed to detect native fetch via iframe: ' + err);\n }\n }\n return false;\n}\nexports.nativeFetch = nativeFetch;\nfunction isNative(func) {\n return func.toString().indexOf('native') !== -1;\n}\nfunction parseURL(url) {\n // Regexp: https://tools.ietf.org/html/rfc3986#appendix-B\n var match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/) || {};\n return {\n protocol: match[2],\n host: match[4],\n pathname: match[5]\n };\n}\nexports.parseURL = parseURL;\nfunction localURLPathname(url) {\n var parsed = parseURL(url);\n var parsedDocURL = parseURL(document.URL);\n // URL must be relative\n if (!parsed.host || !parsed.protocol) {\n return parsed.pathname;\n }\n // Same domain\n if (parsed.protocol === parsedDocURL.protocol && parsed.host === parsedDocURL.host) {\n return parsed.pathname;\n }\n // x-domain\n return \"\".concat(parsed.protocol, \"://\").concat(parsed.host).concat(parsed.pathname);\n}\nexports.localURLPathname = localURLPathname;\nfunction decodeCookie(string) {\n var result = {};\n string.split(/[;,]\\s?/).forEach(function (pair) {\n var _a = pair.split('=', 2), key = _a[0], value = _a[1];\n result[key] = value;\n });\n return result;\n}\nexports.decodeCookie = decodeCookie;\nfunction encodeCookie(object) {\n if (typeof object !== 'object') {\n return undefined;\n }\n var cookies = [];\n for (var k in object) {\n cookies.push(k + '=' + object[k]);\n }\n return cookies.join(';');\n}\nexports.encodeCookie = encodeCookie;\n// Helpers\nfunction getSiblings(element) {\n try {\n var nodes = element.parentNode.childNodes;\n var siblings_1 = [];\n Array.prototype.forEach.call(nodes, function (node) {\n if (node.tagName && node.tagName === element.tagName) {\n siblings_1.push(node);\n }\n });\n return siblings_1;\n }\n catch (e) {\n return [];\n }\n}\nfunction truncate(string, length) {\n if (string.length > length) {\n string = string.substr(0, length) + '...';\n }\n return string;\n}\n// Used to decide which error handling method to use when wrapping async\n// handlers: try/catch, or `window.onerror`. When available, `window.onerror`\n// will provide more information in modern browsers.\nexports.preferCatch = (function () {\n var preferCatch = true;\n // In case we're in an environment without access to \"window\", lets make sure theres a window.\n if (typeof window === 'undefined')\n return preferCatch;\n // IE < 10\n if (!window.atob) {\n preferCatch = false;\n }\n // Modern browsers support the full ErrorEvent API\n // See https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n if (window.ErrorEvent) {\n try {\n if ((new window.ErrorEvent('')).colno === 0) {\n preferCatch = false;\n }\n // eslint-disable-next-line no-empty\n }\n catch (_e) { }\n }\n return preferCatch;\n})();\n/** globalThis has fairly good support. But just in case, lets check its defined.\n * @see {https://caniuse.com/?search=globalThis}\n */\nfunction globalThisOrWindow() {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n return window;\n}\nexports.globalThisOrWindow = globalThisOrWindow;\n//# sourceMappingURL=util.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onError = exports.ignoreNextOnError = void 0;\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar instrument = core_1.Util.instrument, makeNotice = core_1.Util.makeNotice;\nvar ignoreOnError = 0;\nvar currentTimeout;\nfunction ignoreNextOnError() {\n ignoreOnError += 1;\n clearTimeout(currentTimeout);\n currentTimeout = setTimeout(function () {\n ignoreOnError = 0;\n });\n}\nexports.ignoreNextOnError = ignoreNextOnError;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction onError(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n load: function (client) {\n instrument(_window, 'onerror', function (original) {\n var onerror = function (msg, url, line, col, err) {\n client.logger.debug('window.onerror callback invoked', arguments);\n if (ignoreOnError > 0) {\n client.logger.debug('Ignoring window.onerror (error likely reported earlier)', arguments);\n ignoreOnError -= 1;\n return;\n }\n // See https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers/onerror#Notes\n if (line === 0 && /Script error\\.?/.test(msg)) {\n if (client.config.enableUncaught) {\n // Log only if the user wants to report uncaught errors\n client.logger.warn('Ignoring cross-domain script error: enable CORS to track these types of errors', arguments);\n }\n return;\n }\n var notice = makeNotice(err);\n if (!notice.name) {\n notice.name = 'window.onerror';\n }\n if (!notice.message) {\n notice.message = msg;\n }\n if (!notice.stack) {\n // Simulate v8 stack\n notice.stack = [notice.message, '\\n at ? (', url || 'unknown', ':', line || 0, ':', col || 0, ')'].join('');\n }\n client.addBreadcrumb((notice.name === 'window.onerror' || !notice.name) ? 'window.onerror' : \"window.onerror: \".concat(notice.name), {\n category: 'error',\n metadata: {\n name: notice.name,\n message: notice.message,\n stack: notice.stack\n }\n });\n if (client.config.enableUncaught) {\n client.notify(notice);\n }\n };\n return function (msg, url, line, col, err) {\n onerror(msg, url, line, col, err);\n if (typeof original === 'function') {\n return original.apply(_window, arguments);\n }\n return false;\n };\n });\n }\n };\n}\nexports.onError = onError;\n//# sourceMappingURL=onerror.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar instrument = core_1.Util.instrument;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction default_1(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n load: function (client) {\n if (!client.config.enableUnhandledRejection) {\n return;\n }\n instrument(_window, 'onunhandledrejection', function (original) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event\n function onunhandledrejection(promiseRejectionEvent) {\n var _a;\n client.logger.debug('window.onunhandledrejection callback invoked', arguments);\n if (!client.config.enableUnhandledRejection) {\n return;\n }\n var reason = promiseRejectionEvent.reason;\n if (reason instanceof Error) {\n // simulate v8 stack\n // const fileName = reason.fileName || 'unknown'\n // const lineNumber = reason.lineNumber || 0\n var fileName = 'unknown';\n var lineNumber = 0;\n var stackFallback = \"\".concat(reason.message, \"\\n at ? (\").concat(fileName, \":\").concat(lineNumber, \")\");\n var stack = reason.stack || stackFallback;\n var err = {\n name: reason.name,\n message: \"UnhandledPromiseRejectionWarning: \".concat(reason),\n stack: stack\n };\n client.addBreadcrumb(\"window.onunhandledrejection: \".concat(err.name), {\n category: 'error',\n metadata: err\n });\n client.notify(err);\n return;\n }\n var message = typeof reason === 'string' ? reason : ((_a = JSON.stringify(reason)) !== null && _a !== void 0 ? _a : 'Unspecified reason');\n client.notify({\n name: 'window.onunhandledrejection',\n message: \"UnhandledPromiseRejectionWarning: \".concat(message)\n });\n }\n return function (promiseRejectionEvent) {\n onunhandledrejection(promiseRejectionEvent);\n if (typeof original === 'function') {\n original.apply(this, arguments);\n }\n };\n });\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=onunhandledrejection.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar sanitize = core_1.Util.sanitize, instrument = core_1.Util.instrument, instrumentConsole = core_1.Util.instrumentConsole;\nfunction default_1(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n load: function (client) {\n function breadcrumbsEnabled(type) {\n if (client.config.breadcrumbsEnabled === true) {\n return true;\n }\n if (type) {\n return client.config.breadcrumbsEnabled[type] === true;\n }\n return client.config.breadcrumbsEnabled !== false;\n }\n // Breadcrumbs: instrument console\n (function () {\n if (!breadcrumbsEnabled('console')) {\n return;\n }\n function inspectArray(obj) {\n if (!Array.isArray(obj)) {\n return '';\n }\n return obj.map(function (value) {\n try {\n return String(value);\n }\n catch (e) {\n return '[unknown]';\n }\n }).join(' ');\n }\n instrumentConsole(_window, function (level, args) {\n var message = inspectArray(args);\n var opts = {\n category: 'log',\n metadata: {\n level: level,\n arguments: sanitize(args, 3)\n }\n };\n client.addBreadcrumb(message, opts);\n });\n })();\n // Breadcrumbs: instrument click events\n (function () {\n if (!breadcrumbsEnabled('dom')) {\n return;\n }\n if (typeof _window.addEventListener !== 'function') {\n return;\n }\n _window.addEventListener('click', function (event) {\n var message, selector, text;\n try {\n message = (0, util_1.stringNameOfElement)(event.target);\n selector = (0, util_1.stringSelectorOfElement)(event.target);\n text = (0, util_1.stringTextOfElement)(event.target);\n }\n catch (e) {\n message = 'UI Click';\n selector = '[unknown]';\n text = '[unknown]';\n }\n // There's nothing to display\n if (message.length === 0) {\n return;\n }\n client.addBreadcrumb(message, {\n category: 'ui.click',\n metadata: {\n selector: selector,\n text: text,\n event: event\n }\n });\n }, _window.location ? true : false); // In CloudFlare workers useCapture must be false. window.location is a hacky way to detect it.\n })();\n // Breadcrumbs: instrument XMLHttpRequest\n (function () {\n if (!breadcrumbsEnabled('network')) {\n return;\n }\n // Some environments may not support XMLHttpRequest.\n if (typeof XMLHttpRequest === 'undefined') {\n return;\n }\n // -- On xhr.open: capture initial metadata\n instrument(XMLHttpRequest.prototype, 'open', function (original) {\n return function () {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var xhr = this;\n var rawUrl = arguments[1];\n // in case of url being URL object (which is valid input) we need to stringify it\n var url = typeof rawUrl === 'string' ? rawUrl : String(rawUrl);\n var method = typeof arguments[0] === 'string' ? arguments[0].toUpperCase() : arguments[0];\n var message = \"\".concat(method, \" \").concat((0, util_1.localURLPathname)(url));\n this.__hb_xhr = {\n type: 'xhr',\n method: method,\n url: url,\n message: message\n };\n if (typeof original === 'function') {\n original.apply(xhr, arguments);\n }\n };\n });\n // -- On xhr.send: set up xhr.onreadystatechange to report breadcrumb\n instrument(XMLHttpRequest.prototype, 'send', function (original) {\n return function () {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var xhr = this;\n function onreadystatechangeHandler() {\n if (xhr.readyState === 4) {\n var message = void 0;\n if (xhr.__hb_xhr) {\n xhr.__hb_xhr.status_code = xhr.status;\n message = xhr.__hb_xhr.message;\n delete xhr.__hb_xhr.message;\n }\n client.addBreadcrumb(message || 'XMLHttpRequest', {\n category: 'request',\n metadata: xhr.__hb_xhr\n });\n }\n }\n if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') {\n instrument(xhr, 'onreadystatechange', function (original) {\n return function () {\n onreadystatechangeHandler();\n if (typeof original === 'function') {\n // eslint-disable-next-line prefer-rest-params\n original.apply(this, arguments);\n }\n };\n });\n }\n else {\n xhr.onreadystatechange = onreadystatechangeHandler;\n }\n if (typeof original === 'function') {\n // eslint-disable-next-line prefer-rest-params\n original.apply(xhr, arguments);\n }\n };\n });\n })();\n // Breadcrumbs: instrument fetch\n (function () {\n if (!breadcrumbsEnabled('network')) {\n return;\n }\n if (!(0, util_1.nativeFetch)()) {\n // Polyfills use XHR.\n return;\n }\n instrument(_window, 'fetch', function (original) {\n return function () {\n // eslint-disable-next-line prefer-rest-params\n var input = arguments[0];\n var method = 'GET';\n var url;\n if (typeof input === 'string') {\n url = input;\n }\n else if ('Request' in _window && input instanceof Request) {\n url = input.url;\n if (input.method) {\n method = input.method;\n }\n }\n else {\n url = String(input);\n }\n if (arguments[1] && arguments[1].method) {\n method = arguments[1].method;\n }\n if (typeof method === 'string') {\n method = method.toUpperCase();\n }\n // localURLPathname cant be constructed for CF workers due to reliance on \"document\".\n var message = \"\".concat(method, \" \").concat(typeof document === 'undefined' ? url : (0, util_1.localURLPathname)(url));\n var metadata = {\n type: 'fetch',\n method: method,\n url: url\n };\n return original\n .apply(this, arguments)\n .then(function (response) {\n metadata['status_code'] = response.status;\n client.addBreadcrumb(message, {\n category: 'request',\n metadata: metadata\n });\n return response;\n })\n .catch(function (error) {\n client.addBreadcrumb('fetch error', {\n category: 'error',\n metadata: metadata\n });\n throw error;\n });\n };\n });\n })();\n // Breadcrumbs: instrument navigation\n (function () {\n if (!breadcrumbsEnabled('navigation')) {\n return;\n }\n if (_window.location == null) {\n // Most likely in a CF worker, we should be listening to fetch requests instead.\n return;\n }\n // The last known href of the current page\n var lastHref = _window.location.href;\n function recordUrlChange(from, to) {\n lastHref = to;\n client.addBreadcrumb('Page changed', {\n category: 'navigation',\n metadata: {\n from: from,\n to: to\n }\n });\n }\n if (typeof addEventListener === 'function') {\n addEventListener('popstate', function (_event) {\n recordUrlChange(lastHref, _window.location.href);\n });\n }\n if (typeof _window.history === 'undefined') {\n return;\n }\n // https://developer.mozilla.org/en-US/docs/Web/API/History/pushState\n // https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState\n function historyWrapper(original) {\n return function () {\n var url = arguments.length > 2 ? arguments[2] : undefined;\n if (url) {\n recordUrlChange(lastHref, String(url));\n }\n return original.apply(this, arguments);\n };\n }\n instrument(_window.history, 'pushState', historyWrapper);\n instrument(_window.history, 'replaceState', historyWrapper);\n })();\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=breadcrumbs.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar instrumentConsole = core_1.Util.instrumentConsole;\nfunction default_1(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n shouldReloadOnConfigure: false,\n load: function (client) {\n function sendEventsToInsights() {\n return client.config.eventsEnabled;\n }\n if (!sendEventsToInsights()) {\n return;\n }\n instrumentConsole(_window, function (level, args) {\n if (!sendEventsToInsights()) {\n return;\n }\n // todo: send browser info\n client.logEvent({\n level: level,\n args: args\n });\n });\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=events.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar instrument = core_1.Util.instrument;\nfunction default_1(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n load: function (client) {\n // Wrap timers\n (function () {\n function instrumentTimer(wrapOpts) {\n return function (original) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout\n return function (func, delay) {\n if (typeof func === 'function') {\n var args_1 = Array.prototype.slice.call(arguments, 2);\n func = client.__wrap(func, wrapOpts);\n return original(function () {\n func.apply(void 0, args_1);\n }, delay);\n }\n else {\n return original(func, delay);\n }\n };\n };\n }\n instrument(_window, 'setTimeout', instrumentTimer({ component: 'setTimeout' }));\n instrument(_window, 'setInterval', instrumentTimer({ component: 'setInterval' }));\n })();\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=timers.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar instrument = core_1.Util.instrument;\nfunction default_1(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n load: function (client) {\n // Wrap event listeners\n // Event targets borrowed from bugsnag-js:\n // See https://github.com/bugsnag/bugsnag-js/blob/d55af916a4d3c7757f979d887f9533fe1a04cc93/src/bugsnag.js#L542\n var targets = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];\n targets.forEach(function (prop) {\n var prototype = _window[prop] && _window[prop].prototype;\n if (prototype && Object.prototype.hasOwnProperty.call(prototype, 'addEventListener')) {\n instrument(prototype, 'addEventListener', function (original) {\n var wrapOpts = { component: \"\".concat(prop, \".prototype.addEventListener\") };\n // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\n return function (type, listener, useCapture, wantsUntrusted) {\n try {\n if (listener && listener.handleEvent != null) {\n listener.handleEvent = client.__wrap(listener.handleEvent, wrapOpts);\n }\n }\n catch (e) {\n // Ignore 'Permission denied to access property \"handleEvent\"' errors.\n client.logger.error(e);\n }\n return original.call(this, type, client.__wrap(listener, wrapOpts), useCapture, wantsUntrusted);\n };\n });\n instrument(prototype, 'removeEventListener', function (original) {\n return function (type, listener, useCapture, wantsUntrusted) {\n original.call(this, type, listener, useCapture, wantsUntrusted);\n return original.call(this, type, client.__wrap(listener), useCapture, wantsUntrusted);\n };\n });\n }\n });\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=event_listeners.js.map", "\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BrowserTransport = void 0;\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"./util\");\nvar sanitize = core_1.Util.sanitize;\n/**\n * Helper function to get typesafe Object.entries()\n * https://twitter.com/mattpocockuk/status/1502264005251018754?lang=en\n */\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nvar BrowserTransport = /** @class */ (function () {\n function BrowserTransport(headers) {\n if (headers === void 0) { headers = {}; }\n this.headers = {};\n this.headers = headers;\n }\n BrowserTransport.prototype.defaultHeaders = function () {\n return this.headers;\n };\n BrowserTransport.prototype.send = function (options, payload) {\n return __awaiter(this, void 0, void 0, function () {\n var headerArray, headers, requestInit, response, body;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n headerArray = options.headers ? objectEntries(options.headers) : [];\n headers = this.defaultHeaders();\n headerArray.forEach(function (_a) {\n var key = _a[0], value = _a[1];\n if (key != null && value != null) {\n headers[String(key)] = String(value);\n }\n });\n requestInit = {\n method: options.method,\n headers: headers\n };\n // GET methods cannot have a body.\n if (options.method === 'POST' && payload) {\n requestInit.body = typeof payload === 'string' ? payload : JSON.stringify(sanitize(payload, options.maxObjectDepth));\n }\n return [4 /*yield*/, (0, util_1.globalThisOrWindow)().fetch(options.endpoint, requestInit)];\n case 1:\n response = _a.sent();\n return [4 /*yield*/, response.text()];\n case 2:\n body = _a.sent();\n return [2 /*return*/, Promise.resolve({ statusCode: response.status, body: body })];\n }\n });\n });\n };\n return BrowserTransport;\n}());\nexports.BrowserTransport = BrowserTransport;\n//# sourceMappingURL=transport.js.map", "\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Types = exports.getUserFeedbackScriptUrl = void 0;\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"./browser/util\");\nvar onerror_1 = require(\"./browser/integrations/onerror\");\nvar onunhandledrejection_1 = __importDefault(require(\"./browser/integrations/onunhandledrejection\"));\nvar breadcrumbs_1 = __importDefault(require(\"./browser/integrations/breadcrumbs\"));\nvar events_1 = __importDefault(require(\"./browser/integrations/events\"));\nvar timers_1 = __importDefault(require(\"./browser/integrations/timers\"));\nvar event_listeners_1 = __importDefault(require(\"./browser/integrations/event_listeners\"));\nvar transport_1 = require(\"./browser/transport\");\nvar merge = core_1.Util.merge, filter = core_1.Util.filter, objectIsExtensible = core_1.Util.objectIsExtensible;\nvar getProjectRoot = function () {\n var global = (0, util_1.globalThisOrWindow)();\n var projectRoot = '';\n // Cloudflare workers do not have access to location API.\n if (global.location != null) {\n projectRoot = global.location.protocol + '//' + global.location.host;\n }\n return projectRoot;\n};\nvar getUserFeedbackScriptUrl = function (version) {\n var majorMinorVersion = version.split('.').slice(0, 2).join('.');\n return \"https://js.honeybadger.io/v\".concat(majorMinorVersion, \"/honeybadger-feedback-form.js\");\n};\nexports.getUserFeedbackScriptUrl = getUserFeedbackScriptUrl;\nvar Honeybadger = /** @class */ (function (_super) {\n __extends(Honeybadger, _super);\n function Honeybadger(opts) {\n if (opts === void 0) { opts = {}; }\n var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({\n 'User-Agent': userAgent(),\n })) || this;\n /** @internal */\n _this.__errorsSent = 0;\n /** @internal */\n _this.__lastWrapErr = undefined;\n /** @internal */\n _this.__lastNoticeId = undefined;\n /** @internal */\n _this.__beforeNotifyHandlers = [\n function (notice) {\n if (_this.__exceedsMaxErrors()) {\n _this.logger.debug('Dropping notice: max errors exceeded', notice);\n return false;\n }\n if (notice && !notice.url && typeof document !== 'undefined') {\n notice.url = document.URL;\n }\n _this.__incrementErrorsCount();\n return true;\n }\n ];\n _this.__afterNotifyHandlers = [\n function (_error, notice) {\n if (notice) {\n _this.__lastNoticeId = notice.id;\n }\n }\n ];\n return _this;\n }\n Honeybadger.prototype.configure = function (opts) {\n if (opts === void 0) { opts = {}; }\n return _super.prototype.configure.call(this, opts);\n };\n Honeybadger.prototype.resetMaxErrors = function () {\n return (this.__errorsSent = 0);\n };\n Honeybadger.prototype.factory = function (opts) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var clone = new Honeybadger(opts);\n clone.setNotifier(this.getNotifier());\n return clone;\n };\n Honeybadger.prototype.checkIn = function (_id) {\n throw new Error('Honeybadger.checkIn() is not supported on the browser');\n };\n Honeybadger.prototype.showUserFeedbackForm = function (options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var global;\n return __generator(this, function (_a) {\n if (!this.config || !this.config.apiKey) {\n this.logger.debug('Client not initialized');\n return [2 /*return*/];\n }\n if (!this.__lastNoticeId) {\n this.logger.debug(\"Can't show user feedback form without a notice already reported\");\n return [2 /*return*/];\n }\n global = (0, util_1.globalThisOrWindow)();\n if (typeof global.document === 'undefined') {\n this.logger.debug('global.document is undefined. Cannot attach script');\n return [2 /*return*/];\n }\n if (this.isUserFeedbackScriptUrlAlreadyVisible()) {\n this.logger.debug('User feedback form is already visible');\n return [2 /*return*/];\n }\n global['honeybadgerUserFeedbackOptions'] = __assign(__assign({}, options), { apiKey: this.config.apiKey, endpoint: this.config.userFeedbackEndpoint, noticeId: this.__lastNoticeId });\n this.appendUserFeedbackScriptTag(global, options);\n return [2 /*return*/];\n });\n });\n };\n Honeybadger.prototype.appendUserFeedbackScriptTag = function (window, options) {\n if (options === void 0) { options = {}; }\n var script = window.document.createElement('script');\n script.setAttribute('src', this.getUserFeedbackSubmitUrl());\n script.setAttribute('async', 'true');\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n (global.document.head || global.document.body).appendChild(script);\n };\n Honeybadger.prototype.isUserFeedbackScriptUrlAlreadyVisible = function () {\n var global = (0, util_1.globalThisOrWindow)();\n var feedbackScriptUrl = this.getUserFeedbackSubmitUrl();\n for (var i = 0; i < global.document.scripts.length; i++) {\n var script = global.document.scripts[i];\n if (script.src === feedbackScriptUrl) {\n return true;\n }\n }\n return false;\n };\n Honeybadger.prototype.getUserFeedbackSubmitUrl = function () {\n return (0, exports.getUserFeedbackScriptUrl)(this.getVersion());\n };\n /** @internal */\n Honeybadger.prototype.__buildPayload = function (notice) {\n var cgiData = {\n HTTP_USER_AGENT: undefined,\n HTTP_REFERER: undefined,\n HTTP_COOKIE: undefined\n };\n if (typeof navigator !== 'undefined' && navigator.userAgent) {\n cgiData.HTTP_USER_AGENT = navigator.userAgent;\n }\n if (typeof document !== 'undefined' && document.referrer.match(/\\S/)) {\n cgiData.HTTP_REFERER = document.referrer;\n }\n var cookiesObject;\n if (typeof notice.cookies === 'string') {\n cookiesObject = (0, util_1.decodeCookie)(notice.cookies);\n }\n else {\n cookiesObject = notice.cookies;\n }\n if (cookiesObject) {\n cgiData.HTTP_COOKIE = (0, util_1.encodeCookie)(filter(cookiesObject, this.config.filters));\n }\n var payload = _super.prototype.__buildPayload.call(this, notice);\n payload.request.cgi_data = merge(cgiData, payload.request.cgi_data);\n return payload;\n };\n /**\n * wrap always returns the same function so that callbacks can be removed via\n * removeEventListener.\n * @internal\n */\n Honeybadger.prototype.__wrap = function (f, opts) {\n if (opts === void 0) { opts = {}; }\n var func = f;\n if (!opts) {\n opts = {};\n }\n try {\n if (typeof func !== 'function') {\n return func;\n }\n if (!objectIsExtensible(func)) {\n return func;\n }\n if (!func.___hb) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var client_1 = this;\n func.___hb = function () {\n if (util_1.preferCatch) {\n try {\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n catch (err) {\n if (client_1.__lastWrapErr === err) {\n throw (err);\n }\n client_1.__lastWrapErr = err;\n (0, onerror_1.ignoreNextOnError)();\n client_1.addBreadcrumb(opts.component ? \"\".concat(opts.component, \": \").concat(err.name) : err.name, {\n category: 'error',\n metadata: {\n message: err.message,\n name: err.name,\n stack: err.stack\n }\n });\n if (client_1.config.enableUncaught) {\n client_1.notify(err);\n }\n throw (err);\n }\n }\n else {\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n };\n }\n func.___hb.___hb = func.___hb;\n return func.___hb;\n }\n catch (_e) {\n return func;\n }\n };\n /** @internal */\n Honeybadger.prototype.__incrementErrorsCount = function () {\n return this.__errorsSent++;\n };\n /** @internal */\n Honeybadger.prototype.__exceedsMaxErrors = function () {\n return this.config.maxErrors && this.__errorsSent >= this.config.maxErrors;\n };\n return Honeybadger;\n}(core_1.Client));\nvar NOTIFIER = {\n name: '@honeybadger-io/js',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',\n version: '__VERSION__'\n};\nvar userAgent = function () {\n if (typeof navigator !== undefined) {\n return \"Honeybadger JS Browser Client \".concat(NOTIFIER.version, \"; \").concat(navigator.userAgent);\n }\n return \"Honeybadger JS Browser Client \".concat(NOTIFIER.version, \"; n/a; n/a\");\n};\nvar singleton = new Honeybadger({\n __plugins: [\n (0, onerror_1.onError)(),\n (0, onunhandledrejection_1.default)(),\n (0, timers_1.default)(),\n (0, event_listeners_1.default)(),\n (0, breadcrumbs_1.default)(),\n (0, events_1.default)(),\n ]\n});\nsingleton.setNotifier(NOTIFIER);\nvar core_2 = require(\"@honeybadger-io/core\");\nObject.defineProperty(exports, \"Types\", { enumerable: true, get: function () { return core_2.Types; } });\nexports.default = singleton;\n//# sourceMappingURL=browser.js.map", "/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/main/actionview/app/assets/javascripts\nReleased under the MIT license\n */;\n\n(function() {\n var context = this;\n\n (function() {\n (function() {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form:not([data-turbo=true])',\n formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n\n }).call(this);\n }).call(context);\n\n var Rails = context.Rails;\n\n (function() {\n (function() {\n var nonce;\n\n nonce = null;\n\n Rails.loadCSPNonce = function() {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n\n Rails.cspNonce = function() {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n\n }).call(this);\n (function() {\n var expando, m;\n\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\n Rails.matches = function(element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n\n expando = '_ujsData';\n\n Rails.getData = function(element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n\n Rails.setData = function(element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n return element[expando][key] = value;\n };\n\n Rails.isContentEditable = function(element) {\n var isEditable;\n isEditable = false;\n while (true) {\n if (element.isContentEditable) {\n isEditable = true;\n break;\n }\n element = element.parentElement;\n if (!element) {\n break;\n }\n }\n return isEditable;\n };\n\n Rails.$ = function(selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n\n }).call(this);\n (function() {\n var $, csrfParam, csrfToken;\n\n $ = Rails.$;\n\n csrfToken = Rails.csrfToken = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n\n csrfParam = Rails.csrfParam = function() {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n\n Rails.CSRFProtection = function(xhr) {\n var token;\n token = csrfToken();\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n\n Rails.refreshCSRFTokens = function() {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n if ((token != null) && (param != null)) {\n return $('form input[name=\"' + param + '\"]').forEach(function(input) {\n return input.value = token;\n });\n }\n };\n\n }).call(this);\n (function() {\n var CustomEvent, fire, matches, preventDefault;\n\n matches = Rails.matches;\n\n CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function(event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n CustomEvent.prototype.preventDefault = function() {\n var result;\n result = preventDefault.call(this);\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function() {\n return true;\n }\n });\n }\n return result;\n };\n }\n\n fire = Rails.fire = function(obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n\n Rails.stopEverything = function(e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n\n Rails.delegate = function(element, selector, eventType, handler) {\n return element.addEventListener(eventType, function(e) {\n var target;\n target = e.target;\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n\n }).call(this);\n (function() {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n\n Rails.ajax = function(options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function() {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {\n return false;\n }\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n\n prepareOptions = function(options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n options.accept = AcceptHeaders[options.dataType];\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n return options;\n };\n\n createXHR = function(options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n xhr.withCredentials = !!options.withCredentials;\n xhr.onreadystatechange = function() {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n return xhr;\n };\n\n processResponse = function(response, type) {\n var parser, script;\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n return response;\n };\n\n Rails.href = function(element) {\n return element.href;\n };\n\n Rails.isCrossDomain = function(url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n try {\n urlAnchor.href = url;\n return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));\n } catch (error) {\n e = error;\n return true;\n }\n };\n\n }).call(this);\n (function() {\n var matches, toArray;\n\n matches = Rails.matches;\n\n toArray = function(e) {\n return Array.prototype.slice.call(e);\n };\n\n Rails.serializeElement = function(element, additionalParam) {\n var inputs, params;\n inputs = [element];\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n params = [];\n inputs.forEach(function(input) {\n if (!input.name || input.disabled) {\n return;\n }\n if (matches(input, 'fieldset[disabled] *')) {\n return;\n }\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function(option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n if (additionalParam) {\n params.push(additionalParam);\n }\n return params.map(function(param) {\n if (param.name != null) {\n return (encodeURIComponent(param.name)) + \"=\" + (encodeURIComponent(param.value));\n } else {\n return param;\n }\n }).join('&');\n };\n\n Rails.formElements = function(form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function(el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n\n }).call(this);\n (function() {\n var allowAction, fire, stopEverything;\n\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n\n Rails.handleConfirm = function(e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n\n Rails.confirm = function(message, element) {\n return confirm(message);\n };\n\n allowAction = function(element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n if (!message) {\n return true;\n }\n answer = false;\n if (fire(element, 'confirm')) {\n try {\n answer = Rails.confirm(message, element);\n } catch (error) {}\n callback = fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n };\n\n }).call(this);\n (function() {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isContentEditable, isXhrRedirect, matches, setData, stopEverything;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements, isContentEditable = Rails.isContentEditable;\n\n Rails.handleDisabledElement = function(e) {\n var element;\n element = this;\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n\n Rails.enableElement = function(e) {\n var element;\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n element = e.target;\n } else {\n element = e;\n }\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n\n Rails.disableElement = function(e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n\n disableLinkElement = function(element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n\n enableLinkElement = function(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n\n disableFormElements = function(form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n\n disableFormElement = function(element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n\n enableFormElements = function(form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n\n enableFormElement = function(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n setData(element, 'ujs:enable-with', null);\n }\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n\n isXhrRedirect = function(event) {\n var ref, xhr;\n xhr = (ref = event.detail) != null ? ref[0] : void 0;\n return (xhr != null ? xhr.getResponseHeader(\"X-Xhr-Redirect\") : void 0) != null;\n };\n\n }).call(this);\n (function() {\n var isContentEditable, stopEverything;\n\n stopEverything = Rails.stopEverything;\n\n isContentEditable = Rails.isContentEditable;\n\n Rails.handleMethod = function(e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n if (!method) {\n return;\n }\n if (isContentEditable(this)) {\n return;\n }\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \"\";\n if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {\n formContent += \"\";\n }\n formContent += '';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n\n }).call(this);\n (function() {\n var ajax, fire, getData, isContentEditable, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,\n slice = [].slice;\n\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement, isContentEditable = Rails.isContentEditable;\n\n isRemote = function(element) {\n var value;\n value = element.getAttribute('data-remote');\n return (value != null) && value !== 'false';\n };\n\n Rails.handleRemote = function(e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n if (!isRemote(element)) {\n return true;\n }\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n if (isContentEditable(element)) {\n fire(element, 'ajax:stopped');\n return false;\n }\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function(xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: (withCredentials != null) && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n\n Rails.formSubmitButtonClick = function(e) {\n var button, form;\n button = this;\n form = button.form;\n if (!form) {\n return;\n }\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n\n Rails.preventInsignificantClick = function(e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = (e.button != null) && e.button !== 0;\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n\n }).call(this);\n (function() {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n\n if ((typeof jQuery !== \"undefined\" && jQuery !== null) && (jQuery.ajax != null)) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n\n Rails.start = function() {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n window.addEventListener('pageshow', function() {\n $(Rails.formEnableSelector).forEach(function(el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function(el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function(e) {\n return setTimeout((function() {\n return disableElement(e);\n }), 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n\n }).call(this);\n }).call(this);\n\n if (typeof module === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);\n", "export default {\n logger: self.console,\n WebSocket: self.WebSocket\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordPing() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n this.recordPing()\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\",\n \"remote\": \"remote\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return this.monitor.recordPing()\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: true})\n } else {\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: false})\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "/*\nStimulus 3.2.1\nCopyright \u00A9 2023 Basecamp, LLC\n */\nclass EventListener {\n constructor(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n connect() {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n }\n disconnect() {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }\n bindingConnected(binding) {\n this.unorderedBindings.add(binding);\n }\n bindingDisconnected(binding) {\n this.unorderedBindings.delete(binding);\n }\n handleEvent(event) {\n const extendedEvent = extendEvent(event);\n for (const binding of this.bindings) {\n if (extendedEvent.immediatePropagationStopped) {\n break;\n }\n else {\n binding.handleEvent(extendedEvent);\n }\n }\n }\n hasBindings() {\n return this.unorderedBindings.size > 0;\n }\n get bindings() {\n return Array.from(this.unorderedBindings).sort((left, right) => {\n const leftIndex = left.index, rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n }\n}\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n }\n else {\n const { stopImmediatePropagation } = event;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation.call(this);\n },\n });\n }\n}\n\nclass Dispatcher {\n constructor(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach((eventListener) => eventListener.connect());\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach((eventListener) => eventListener.disconnect());\n }\n }\n get eventListeners() {\n return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []);\n }\n bindingConnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n }\n bindingDisconnected(binding, clearEventListeners = false) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n if (clearEventListeners)\n this.clearEventListenersForBinding(binding);\n }\n handleError(error, message, detail = {}) {\n this.application.handleError(error, `Error ${message}`, detail);\n }\n clearEventListenersForBinding(binding) {\n const eventListener = this.fetchEventListenerForBinding(binding);\n if (!eventListener.hasBindings()) {\n eventListener.disconnect();\n this.removeMappedEventListenerFor(binding);\n }\n }\n removeMappedEventListenerFor(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n eventListenerMap.delete(cacheKey);\n if (eventListenerMap.size == 0)\n this.eventListenerMaps.delete(eventTarget);\n }\n fetchEventListenerForBinding(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n }\n fetchEventListener(eventTarget, eventName, eventOptions) {\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n let eventListener = eventListenerMap.get(cacheKey);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n return eventListener;\n }\n createEventListener(eventTarget, eventName, eventOptions) {\n const eventListener = new EventListener(eventTarget, eventName, eventOptions);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n }\n fetchEventListenerMapForEventTarget(eventTarget) {\n let eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n }\n cacheKey(eventName, eventOptions) {\n const parts = [eventName];\n Object.keys(eventOptions)\n .sort()\n .forEach((key) => {\n parts.push(`${eventOptions[key] ? \"\" : \"!\"}${key}`);\n });\n return parts.join(\":\");\n }\n}\n\nconst defaultActionDescriptorFilters = {\n stop({ event, value }) {\n if (value)\n event.stopPropagation();\n return true;\n },\n prevent({ event, value }) {\n if (value)\n event.preventDefault();\n return true;\n },\n self({ event, value, element }) {\n if (value) {\n return element === event.target;\n }\n else {\n return true;\n }\n },\n};\nconst descriptorPattern = /^(?:(?:([^.]+?)\\+)?(.+?)(?:\\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;\nfunction parseActionDescriptorString(descriptorString) {\n const source = descriptorString.trim();\n const matches = source.match(descriptorPattern) || [];\n let eventName = matches[2];\n let keyFilter = matches[3];\n if (keyFilter && ![\"keydown\", \"keyup\", \"keypress\"].includes(eventName)) {\n eventName += `.${keyFilter}`;\n keyFilter = \"\";\n }\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName,\n eventOptions: matches[7] ? parseEventOptions(matches[7]) : {},\n identifier: matches[5],\n methodName: matches[6],\n keyFilter: matches[1] || keyFilter,\n };\n}\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n }\n else if (eventTargetName == \"document\") {\n return document;\n }\n}\nfunction parseEventOptions(eventOptions) {\n return eventOptions\n .split(\":\")\n .reduce((options, token) => Object.assign(options, { [token.replace(/^!/, \"\")]: !/^!/.test(token) }), {});\n}\nfunction stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n }\n else if (eventTarget == document) {\n return \"document\";\n }\n}\n\nfunction camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n}\nfunction namespaceCamelize(value) {\n return camelize(value.replace(/--/g, \"-\").replace(/__/g, \"_\"));\n}\nfunction capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n}\nfunction tokenize(value) {\n return value.match(/[^\\s]+/g) || [];\n}\n\nfunction isSomething(object) {\n return object !== null && object !== undefined;\n}\nfunction hasProperty(object, property) {\n return Object.prototype.hasOwnProperty.call(object, property);\n}\n\nconst allModifiers = [\"meta\", \"ctrl\", \"alt\", \"shift\"];\nclass Action {\n constructor(element, index, descriptor, schema) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n this.keyFilter = descriptor.keyFilter || \"\";\n this.schema = schema;\n }\n static forToken(token, schema) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content), schema);\n }\n toString() {\n const eventFilter = this.keyFilter ? `.${this.keyFilter}` : \"\";\n const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : \"\";\n return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`;\n }\n shouldIgnoreKeyboardEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = this.keyFilter.split(\"+\");\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n const standardFilter = filters.filter((key) => !allModifiers.includes(key))[0];\n if (!standardFilter) {\n return false;\n }\n if (!hasProperty(this.keyMappings, standardFilter)) {\n error(`contains unknown key filter: ${this.keyFilter}`);\n }\n return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase();\n }\n shouldIgnoreMouseEvent(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filters = [this.keyFilter];\n if (this.keyFilterDissatisfied(event, filters)) {\n return true;\n }\n return false;\n }\n get params() {\n const params = {};\n const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, \"i\");\n for (const { name, value } of Array.from(this.element.attributes)) {\n const match = name.match(pattern);\n const key = match && match[1];\n if (key) {\n params[camelize(key)] = typecast(value);\n }\n }\n return params;\n }\n get eventTargetName() {\n return stringifyEventTarget(this.eventTarget);\n }\n get keyMappings() {\n return this.schema.keyMappings;\n }\n keyFilterDissatisfied(event, filters) {\n const [meta, ctrl, alt, shift] = allModifiers.map((modifier) => filters.includes(modifier));\n return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift;\n }\n}\nconst defaultEventNames = {\n a: () => \"click\",\n button: () => \"click\",\n form: () => \"submit\",\n details: () => \"toggle\",\n input: (e) => (e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\"),\n select: () => \"change\",\n textarea: () => \"input\",\n};\nfunction getDefaultEventNameForElement(element) {\n const tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\nfunction error(message) {\n throw new Error(message);\n}\nfunction typecast(value) {\n try {\n return JSON.parse(value);\n }\n catch (o_O) {\n return value;\n }\n}\n\nclass Binding {\n constructor(context, action) {\n this.context = context;\n this.action = action;\n }\n get index() {\n return this.action.index;\n }\n get eventTarget() {\n return this.action.eventTarget;\n }\n get eventOptions() {\n return this.action.eventOptions;\n }\n get identifier() {\n return this.context.identifier;\n }\n handleEvent(event) {\n const actionEvent = this.prepareActionEvent(event);\n if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) {\n this.invokeWithEvent(actionEvent);\n }\n }\n get eventName() {\n return this.action.eventName;\n }\n get method() {\n const method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(`Action \"${this.action}\" references undefined method \"${this.methodName}\"`);\n }\n applyEventModifiers(event) {\n const { element } = this.action;\n const { actionDescriptorFilters } = this.context.application;\n const { controller } = this.context;\n let passes = true;\n for (const [name, value] of Object.entries(this.eventOptions)) {\n if (name in actionDescriptorFilters) {\n const filter = actionDescriptorFilters[name];\n passes = passes && filter({ name, value, event, element, controller });\n }\n else {\n continue;\n }\n }\n return passes;\n }\n prepareActionEvent(event) {\n return Object.assign(event, { params: this.action.params });\n }\n invokeWithEvent(event) {\n const { target, currentTarget } = event;\n try {\n this.method.call(this.controller, event);\n this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName });\n }\n catch (error) {\n const { identifier, controller, element, index } = this;\n const detail = { identifier, controller, element, index, event };\n this.context.handleError(error, `invoking action \"${this.action}\"`, detail);\n }\n }\n willBeInvokedByEvent(event) {\n const eventTarget = event.target;\n if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) {\n return false;\n }\n if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) {\n return false;\n }\n if (this.element === eventTarget) {\n return true;\n }\n else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n }\n else {\n return this.scope.containsElement(this.action.element);\n }\n }\n get controller() {\n return this.context.controller;\n }\n get methodName() {\n return this.action.methodName;\n }\n get element() {\n return this.scope.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nclass ElementObserver {\n constructor(element, delegate) {\n this.mutationObserverInit = { attributes: true, childList: true, subtree: true };\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.refresh();\n }\n }\n pause(callback) {\n if (this.started) {\n this.mutationObserver.disconnect();\n this.started = false;\n }\n callback();\n if (!this.started) {\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n const matches = new Set(this.matchElementsInTree());\n for (const element of Array.from(this.elements)) {\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n for (const element of Array.from(matches)) {\n this.addElement(element);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n }\n else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n }\n processAttributeChange(element, attributeName) {\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n }\n else {\n this.removeElement(element);\n }\n }\n else if (this.matchElement(element)) {\n this.addElement(element);\n }\n }\n processRemovedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n }\n processAddedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }\n matchElement(element) {\n return this.delegate.matchElement(element);\n }\n matchElementsInTree(tree = this.element) {\n return this.delegate.matchElementsInTree(tree);\n }\n processTree(tree, processor) {\n for (const element of this.matchElementsInTree(tree)) {\n processor.call(this, element);\n }\n }\n elementFromNode(node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n }\n elementIsActive(element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n }\n else {\n return this.element.contains(element);\n }\n }\n addElement(element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n }\n removeElement(element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n }\n}\n\nclass AttributeObserver {\n constructor(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n get element() {\n return this.elementObserver.element;\n }\n get selector() {\n return `[${this.attributeName}]`;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get started() {\n return this.elementObserver.started;\n }\n matchElement(element) {\n return element.hasAttribute(this.attributeName);\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n }\n elementMatched(element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n }\n elementUnmatched(element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n }\n elementAttributeChanged(element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n }\n}\n\nfunction add(map, key, value) {\n fetch(map, key).add(value);\n}\nfunction del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nfunction fetch(map, key) {\n let values = map.get(key);\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n}\nfunction prune(map, key) {\n const values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}\n\nclass Multimap {\n constructor() {\n this.valuesByKey = new Map();\n }\n get keys() {\n return Array.from(this.valuesByKey.keys());\n }\n get values() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((values, set) => values.concat(Array.from(set)), []);\n }\n get size() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((size, set) => size + set.size, 0);\n }\n add(key, value) {\n add(this.valuesByKey, key, value);\n }\n delete(key, value) {\n del(this.valuesByKey, key, value);\n }\n has(key, value) {\n const values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n }\n hasKey(key) {\n return this.valuesByKey.has(key);\n }\n hasValue(value) {\n const sets = Array.from(this.valuesByKey.values());\n return sets.some((set) => set.has(value));\n }\n getValuesForKey(key) {\n const values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n }\n getKeysForValue(value) {\n return Array.from(this.valuesByKey)\n .filter(([_key, values]) => values.has(value))\n .map(([key, _values]) => key);\n }\n}\n\nclass IndexedMultimap extends Multimap {\n constructor() {\n super();\n this.keysByValue = new Map();\n }\n get values() {\n return Array.from(this.keysByValue.keys());\n }\n add(key, value) {\n super.add(key, value);\n add(this.keysByValue, value, key);\n }\n delete(key, value) {\n super.delete(key, value);\n del(this.keysByValue, value, key);\n }\n hasValue(value) {\n return this.keysByValue.has(value);\n }\n getKeysForValue(value) {\n const set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n }\n}\n\nclass SelectorObserver {\n constructor(element, selector, delegate, details) {\n this._selector = selector;\n this.details = details;\n this.elementObserver = new ElementObserver(element, this);\n this.delegate = delegate;\n this.matchesByElement = new Multimap();\n }\n get started() {\n return this.elementObserver.started;\n }\n get selector() {\n return this._selector;\n }\n set selector(selector) {\n this._selector = selector;\n this.refresh();\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get element() {\n return this.elementObserver.element;\n }\n matchElement(element) {\n const { selector } = this;\n if (selector) {\n const matches = element.matches(selector);\n if (this.delegate.selectorMatchElement) {\n return matches && this.delegate.selectorMatchElement(element, this.details);\n }\n return matches;\n }\n else {\n return false;\n }\n }\n matchElementsInTree(tree) {\n const { selector } = this;\n if (selector) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(selector)).filter((match) => this.matchElement(match));\n return match.concat(matches);\n }\n else {\n return [];\n }\n }\n elementMatched(element) {\n const { selector } = this;\n if (selector) {\n this.selectorMatched(element, selector);\n }\n }\n elementUnmatched(element) {\n const selectors = this.matchesByElement.getKeysForValue(element);\n for (const selector of selectors) {\n this.selectorUnmatched(element, selector);\n }\n }\n elementAttributeChanged(element, _attributeName) {\n const { selector } = this;\n if (selector) {\n const matches = this.matchElement(element);\n const matchedBefore = this.matchesByElement.has(selector, element);\n if (matches && !matchedBefore) {\n this.selectorMatched(element, selector);\n }\n else if (!matches && matchedBefore) {\n this.selectorUnmatched(element, selector);\n }\n }\n }\n selectorMatched(element, selector) {\n this.delegate.selectorMatched(element, selector, this.details);\n this.matchesByElement.add(selector, element);\n }\n selectorUnmatched(element, selector) {\n this.delegate.selectorUnmatched(element, selector, this.details);\n this.matchesByElement.delete(selector, element);\n }\n}\n\nclass StringMapObserver {\n constructor(element, delegate) {\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true });\n this.refresh();\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n for (const attributeName of this.knownAttributeNames) {\n this.refreshAttribute(attributeName, null);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n const attributeName = mutation.attributeName;\n if (attributeName) {\n this.refreshAttribute(attributeName, mutation.oldValue);\n }\n }\n refreshAttribute(attributeName, oldValue) {\n const key = this.delegate.getStringMapKeyForAttribute(attributeName);\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n const value = this.element.getAttribute(attributeName);\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key, oldValue);\n }\n if (value == null) {\n const oldValue = this.stringMap.get(attributeName);\n this.stringMap.delete(attributeName);\n if (oldValue)\n this.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n else {\n this.stringMap.set(attributeName, value);\n }\n }\n }\n stringMapKeyAdded(key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n }\n stringMapValueChanged(value, key, oldValue) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key, oldValue);\n }\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n }\n get knownAttributeNames() {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n }\n get currentAttributeNames() {\n return Array.from(this.element.attributes).map((attribute) => attribute.name);\n }\n get recordedAttributeNames() {\n return Array.from(this.stringMap.keys());\n }\n}\n\nclass TokenListObserver {\n constructor(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n get started() {\n return this.attributeObserver.started;\n }\n start() {\n this.attributeObserver.start();\n }\n pause(callback) {\n this.attributeObserver.pause(callback);\n }\n stop() {\n this.attributeObserver.stop();\n }\n refresh() {\n this.attributeObserver.refresh();\n }\n get element() {\n return this.attributeObserver.element;\n }\n get attributeName() {\n return this.attributeObserver.attributeName;\n }\n elementMatchedAttribute(element) {\n this.tokensMatched(this.readTokensForElement(element));\n }\n elementAttributeValueChanged(element) {\n const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element);\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n }\n elementUnmatchedAttribute(element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n }\n tokensMatched(tokens) {\n tokens.forEach((token) => this.tokenMatched(token));\n }\n tokensUnmatched(tokens) {\n tokens.forEach((token) => this.tokenUnmatched(token));\n }\n tokenMatched(token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n }\n tokenUnmatched(token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n }\n refreshTokensForElement(element) {\n const previousTokens = this.tokensByElement.getValuesForKey(element);\n const currentTokens = this.readTokensForElement(element);\n const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken));\n if (firstDifferingIndex == -1) {\n return [[], []];\n }\n else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n }\n readTokensForElement(element) {\n const attributeName = this.attributeName;\n const tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n }\n}\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString\n .trim()\n .split(/\\s+/)\n .filter((content) => content.length)\n .map((content, index) => ({ element, attributeName, content, index }));\n}\nfunction zip(left, right) {\n const length = Math.max(left.length, right.length);\n return Array.from({ length }, (_, index) => [left[index], right[index]]);\n}\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}\n\nclass ValueListObserver {\n constructor(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n get started() {\n return this.tokenListObserver.started;\n }\n start() {\n this.tokenListObserver.start();\n }\n stop() {\n this.tokenListObserver.stop();\n }\n refresh() {\n this.tokenListObserver.refresh();\n }\n get element() {\n return this.tokenListObserver.element;\n }\n get attributeName() {\n return this.tokenListObserver.attributeName;\n }\n tokenMatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n }\n tokenUnmatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n }\n fetchParseResultForToken(token) {\n let parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n }\n fetchValuesByTokenForElement(element) {\n let valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\n }\n parseToken(token) {\n try {\n const value = this.delegate.parseValueForToken(token);\n return { value };\n }\n catch (error) {\n return { error };\n }\n }\n}\n\nclass BindingObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n start() {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n }\n stop() {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n }\n get element() {\n return this.context.element;\n }\n get identifier() {\n return this.context.identifier;\n }\n get actionAttribute() {\n return this.schema.actionAttribute;\n }\n get schema() {\n return this.context.schema;\n }\n get bindings() {\n return Array.from(this.bindingsByAction.values());\n }\n connectAction(action) {\n const binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n }\n disconnectAction(action) {\n const binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n }\n disconnectAllActions() {\n this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true));\n this.bindingsByAction.clear();\n }\n parseValueForToken(token) {\n const action = Action.forToken(token, this.schema);\n if (action.identifier == this.identifier) {\n return action;\n }\n }\n elementMatchedValue(element, action) {\n this.connectAction(action);\n }\n elementUnmatchedValue(element, action) {\n this.disconnectAction(action);\n }\n}\n\nclass ValueObserver {\n constructor(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n }\n start() {\n this.stringMapObserver.start();\n this.invokeChangedCallbacksForDefaultValues();\n }\n stop() {\n this.stringMapObserver.stop();\n }\n get element() {\n return this.context.element;\n }\n get controller() {\n return this.context.controller;\n }\n getStringMapKeyForAttribute(attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n }\n stringMapKeyAdded(key, attributeName) {\n const descriptor = this.valueDescriptorMap[attributeName];\n if (!this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue));\n }\n }\n stringMapValueChanged(value, name, oldValue) {\n const descriptor = this.valueDescriptorNameMap[name];\n if (value === null)\n return;\n if (oldValue === null) {\n oldValue = descriptor.writer(descriptor.defaultValue);\n }\n this.invokeChangedCallback(name, value, oldValue);\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n const descriptor = this.valueDescriptorNameMap[key];\n if (this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue);\n }\n else {\n this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue);\n }\n }\n invokeChangedCallbacksForDefaultValues() {\n for (const { key, name, defaultValue, writer } of this.valueDescriptors) {\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallback(name, writer(defaultValue), undefined);\n }\n }\n }\n invokeChangedCallback(name, rawValue, rawOldValue) {\n const changedMethodName = `${name}Changed`;\n const changedMethod = this.receiver[changedMethodName];\n if (typeof changedMethod == \"function\") {\n const descriptor = this.valueDescriptorNameMap[name];\n try {\n const value = descriptor.reader(rawValue);\n let oldValue = rawOldValue;\n if (rawOldValue) {\n oldValue = descriptor.reader(rawOldValue);\n }\n changedMethod.call(this.receiver, value, oldValue);\n }\n catch (error) {\n if (error instanceof TypeError) {\n error.message = `Stimulus Value \"${this.context.identifier}.${descriptor.name}\" - ${error.message}`;\n }\n throw error;\n }\n }\n }\n get valueDescriptors() {\n const { valueDescriptorMap } = this;\n return Object.keys(valueDescriptorMap).map((key) => valueDescriptorMap[key]);\n }\n get valueDescriptorNameMap() {\n const descriptors = {};\n Object.keys(this.valueDescriptorMap).forEach((key) => {\n const descriptor = this.valueDescriptorMap[key];\n descriptors[descriptor.name] = descriptor;\n });\n return descriptors;\n }\n hasValue(attributeName) {\n const descriptor = this.valueDescriptorNameMap[attributeName];\n const hasMethodName = `has${capitalize(descriptor.name)}`;\n return this.receiver[hasMethodName];\n }\n}\n\nclass TargetObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.targetsByName = new Multimap();\n }\n start() {\n if (!this.tokenListObserver) {\n this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this);\n this.tokenListObserver.start();\n }\n }\n stop() {\n if (this.tokenListObserver) {\n this.disconnectAllTargets();\n this.tokenListObserver.stop();\n delete this.tokenListObserver;\n }\n }\n tokenMatched({ element, content: name }) {\n if (this.scope.containsElement(element)) {\n this.connectTarget(element, name);\n }\n }\n tokenUnmatched({ element, content: name }) {\n this.disconnectTarget(element, name);\n }\n connectTarget(element, name) {\n var _a;\n if (!this.targetsByName.has(name, element)) {\n this.targetsByName.add(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name));\n }\n }\n disconnectTarget(element, name) {\n var _a;\n if (this.targetsByName.has(name, element)) {\n this.targetsByName.delete(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name));\n }\n }\n disconnectAllTargets() {\n for (const name of this.targetsByName.keys) {\n for (const element of this.targetsByName.getValuesForKey(name)) {\n this.disconnectTarget(element, name);\n }\n }\n }\n get attributeName() {\n return `data-${this.context.identifier}-target`;\n }\n get element() {\n return this.context.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nfunction readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor) => {\n getOwnStaticArrayValues(constructor, propertyName).forEach((name) => values.add(name));\n return values;\n }, new Set()));\n}\nfunction readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor) => {\n pairs.push(...getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\nfunction getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n}\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : [];\n}\n\nclass OutletObserver {\n constructor(context, delegate) {\n this.started = false;\n this.context = context;\n this.delegate = delegate;\n this.outletsByName = new Multimap();\n this.outletElementsByName = new Multimap();\n this.selectorObserverMap = new Map();\n this.attributeObserverMap = new Map();\n }\n start() {\n if (!this.started) {\n this.outletDefinitions.forEach((outletName) => {\n this.setupSelectorObserverForOutlet(outletName);\n this.setupAttributeObserverForOutlet(outletName);\n });\n this.started = true;\n this.dependentContexts.forEach((context) => context.refresh());\n }\n }\n refresh() {\n this.selectorObserverMap.forEach((observer) => observer.refresh());\n this.attributeObserverMap.forEach((observer) => observer.refresh());\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.disconnectAllOutlets();\n this.stopSelectorObservers();\n this.stopAttributeObservers();\n }\n }\n stopSelectorObservers() {\n if (this.selectorObserverMap.size > 0) {\n this.selectorObserverMap.forEach((observer) => observer.stop());\n this.selectorObserverMap.clear();\n }\n }\n stopAttributeObservers() {\n if (this.attributeObserverMap.size > 0) {\n this.attributeObserverMap.forEach((observer) => observer.stop());\n this.attributeObserverMap.clear();\n }\n }\n selectorMatched(element, _selector, { outletName }) {\n const outlet = this.getOutlet(element, outletName);\n if (outlet) {\n this.connectOutlet(outlet, element, outletName);\n }\n }\n selectorUnmatched(element, _selector, { outletName }) {\n const outlet = this.getOutletFromMap(element, outletName);\n if (outlet) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n selectorMatchElement(element, { outletName }) {\n const selector = this.selector(outletName);\n const hasOutlet = this.hasOutlet(element, outletName);\n const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`);\n if (selector) {\n return hasOutlet && hasOutletController && element.matches(selector);\n }\n else {\n return false;\n }\n }\n elementMatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementAttributeValueChanged(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n elementUnmatchedAttribute(_element, attributeName) {\n const outletName = this.getOutletNameFromOutletAttributeName(attributeName);\n if (outletName) {\n this.updateSelectorObserverForOutlet(outletName);\n }\n }\n connectOutlet(outlet, element, outletName) {\n var _a;\n if (!this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.add(outletName, outlet);\n this.outletElementsByName.add(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletConnected(outlet, element, outletName));\n }\n }\n disconnectOutlet(outlet, element, outletName) {\n var _a;\n if (this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.delete(outletName, outlet);\n this.outletElementsByName.delete(outletName, element);\n (_a = this.selectorObserverMap\n .get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName));\n }\n }\n disconnectAllOutlets() {\n for (const outletName of this.outletElementsByName.keys) {\n for (const element of this.outletElementsByName.getValuesForKey(outletName)) {\n for (const outlet of this.outletsByName.getValuesForKey(outletName)) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n }\n }\n updateSelectorObserverForOutlet(outletName) {\n const observer = this.selectorObserverMap.get(outletName);\n if (observer) {\n observer.selector = this.selector(outletName);\n }\n }\n setupSelectorObserverForOutlet(outletName) {\n const selector = this.selector(outletName);\n const selectorObserver = new SelectorObserver(document.body, selector, this, { outletName });\n this.selectorObserverMap.set(outletName, selectorObserver);\n selectorObserver.start();\n }\n setupAttributeObserverForOutlet(outletName) {\n const attributeName = this.attributeNameForOutletName(outletName);\n const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this);\n this.attributeObserverMap.set(outletName, attributeObserver);\n attributeObserver.start();\n }\n selector(outletName) {\n return this.scope.outlets.getSelectorForOutletName(outletName);\n }\n attributeNameForOutletName(outletName) {\n return this.scope.schema.outletAttributeForScope(this.identifier, outletName);\n }\n getOutletNameFromOutletAttributeName(attributeName) {\n return this.outletDefinitions.find((outletName) => this.attributeNameForOutletName(outletName) === attributeName);\n }\n get outletDependencies() {\n const dependencies = new Multimap();\n this.router.modules.forEach((module) => {\n const constructor = module.definition.controllerConstructor;\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n outlets.forEach((outlet) => dependencies.add(outlet, module.identifier));\n });\n return dependencies;\n }\n get outletDefinitions() {\n return this.outletDependencies.getKeysForValue(this.identifier);\n }\n get dependentControllerIdentifiers() {\n return this.outletDependencies.getValuesForKey(this.identifier);\n }\n get dependentContexts() {\n const identifiers = this.dependentControllerIdentifiers;\n return this.router.contexts.filter((context) => identifiers.includes(context.identifier));\n }\n hasOutlet(element, outletName) {\n return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName);\n }\n getOutlet(element, outletName) {\n return this.application.getControllerForElementAndIdentifier(element, outletName);\n }\n getOutletFromMap(element, outletName) {\n return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element);\n }\n get scope() {\n return this.context.scope;\n }\n get schema() {\n return this.context.schema;\n }\n get identifier() {\n return this.context.identifier;\n }\n get application() {\n return this.context.application;\n }\n get router() {\n return this.application.router;\n }\n}\n\nclass Context {\n constructor(module, scope) {\n this.logDebugActivity = (functionName, detail = {}) => {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.logDebugActivity(this.identifier, functionName, detail);\n };\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n this.targetObserver = new TargetObserver(this, this);\n this.outletObserver = new OutletObserver(this, this);\n try {\n this.controller.initialize();\n this.logDebugActivity(\"initialize\");\n }\n catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n connect() {\n this.bindingObserver.start();\n this.valueObserver.start();\n this.targetObserver.start();\n this.outletObserver.start();\n try {\n this.controller.connect();\n this.logDebugActivity(\"connect\");\n }\n catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n }\n refresh() {\n this.outletObserver.refresh();\n }\n disconnect() {\n try {\n this.controller.disconnect();\n this.logDebugActivity(\"disconnect\");\n }\n catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.outletObserver.stop();\n this.targetObserver.stop();\n this.valueObserver.stop();\n this.bindingObserver.stop();\n }\n get application() {\n return this.module.application;\n }\n get identifier() {\n return this.module.identifier;\n }\n get schema() {\n return this.application.schema;\n }\n get dispatcher() {\n return this.application.dispatcher;\n }\n get element() {\n return this.scope.element;\n }\n get parentElement() {\n return this.element.parentElement;\n }\n handleError(error, message, detail = {}) {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.handleError(error, `Error ${message}`, detail);\n }\n targetConnected(element, name) {\n this.invokeControllerMethod(`${name}TargetConnected`, element);\n }\n targetDisconnected(element, name) {\n this.invokeControllerMethod(`${name}TargetDisconnected`, element);\n }\n outletConnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element);\n }\n outletDisconnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element);\n }\n invokeControllerMethod(methodName, ...args) {\n const controller = this.controller;\n if (typeof controller[methodName] == \"function\") {\n controller[methodName](...args);\n }\n }\n}\n\nfunction bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\nfunction shadow(constructor, properties) {\n const shadowConstructor = extend(constructor);\n const shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\nfunction getBlessedProperties(constructor) {\n const blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce((blessedProperties, blessing) => {\n const properties = blessing(constructor);\n for (const key in properties) {\n const descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n return blessedProperties;\n }, {});\n}\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce((shadowProperties, key) => {\n const descriptor = getShadowedDescriptor(prototype, properties, key);\n if (descriptor) {\n Object.assign(shadowProperties, { [key]: descriptor });\n }\n return shadowProperties;\n }, {});\n}\nfunction getShadowedDescriptor(prototype, properties, key) {\n const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n const shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n if (!shadowedByValue) {\n const descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n return descriptor;\n }\n}\nconst getOwnKeys = (() => {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)];\n }\n else {\n return Object.getOwnPropertyNames;\n }\n})();\nconst extend = (() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: { value: extended },\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function () {\n this.a.call(this);\n };\n const b = extendWithReflect(a);\n b.prototype.a = function () { };\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n }\n catch (error) {\n return (constructor) => class extended extends constructor {\n };\n }\n})();\n\nfunction blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor),\n };\n}\n\nclass Module {\n constructor(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n get identifier() {\n return this.definition.identifier;\n }\n get controllerConstructor() {\n return this.definition.controllerConstructor;\n }\n get contexts() {\n return Array.from(this.connectedContexts);\n }\n connectContextForScope(scope) {\n const context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n }\n disconnectContextForScope(scope) {\n const context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n }\n fetchContextForScope(scope) {\n let context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n }\n}\n\nclass ClassMap {\n constructor(scope) {\n this.scope = scope;\n }\n has(name) {\n return this.data.has(this.getDataKey(name));\n }\n get(name) {\n return this.getAll(name)[0];\n }\n getAll(name) {\n const tokenString = this.data.get(this.getDataKey(name)) || \"\";\n return tokenize(tokenString);\n }\n getAttributeName(name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n }\n getDataKey(name) {\n return `${name}-class`;\n }\n get data() {\n return this.scope.data;\n }\n}\n\nclass DataMap {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n }\n set(key, value) {\n const name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n }\n has(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n }\n delete(key) {\n if (this.has(key)) {\n const name = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name);\n return true;\n }\n else {\n return false;\n }\n }\n getAttributeNameForKey(key) {\n return `data-${this.identifier}-${dasherize(key)}`;\n }\n}\n\nclass Guide {\n constructor(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n warn(object, key, message) {\n let warnedKeys = this.warnedKeysByObject.get(object);\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n }\n}\n\nfunction attributeValueContainsToken(attributeName, token) {\n return `[${attributeName}~=\"${token}\"]`;\n}\n\nclass TargetSet {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(targetName) {\n return this.find(targetName) != null;\n }\n find(...targetNames) {\n return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined);\n }\n findAll(...targetNames) {\n return targetNames.reduce((targets, targetName) => [\n ...targets,\n ...this.findAllTargets(targetName),\n ...this.findAllLegacyTargets(targetName),\n ], []);\n }\n findTarget(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n }\n findAllTargets(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n }\n getSelectorForTargetName(targetName) {\n const attributeName = this.schema.targetAttributeForScope(this.identifier);\n return attributeValueContainsToken(attributeName, targetName);\n }\n findLegacyTarget(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n }\n findAllLegacyTargets(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map((element) => this.deprecate(element, targetName));\n }\n getLegacySelectorForTargetName(targetName) {\n const targetDescriptor = `${this.identifier}.${targetName}`;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n }\n deprecate(element, targetName) {\n if (element) {\n const { identifier } = this;\n const attributeName = this.schema.targetAttribute;\n const revisedAttributeName = this.schema.targetAttributeForScope(identifier);\n this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}=\"${identifier}.${targetName}\" with ${revisedAttributeName}=\"${targetName}\". ` +\n `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`);\n }\n return element;\n }\n get guide() {\n return this.scope.guide;\n }\n}\n\nclass OutletSet {\n constructor(scope, controllerElement) {\n this.scope = scope;\n this.controllerElement = controllerElement;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(outletName) {\n return this.find(outletName) != null;\n }\n find(...outletNames) {\n return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined);\n }\n findAll(...outletNames) {\n return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []);\n }\n getSelectorForOutletName(outletName) {\n const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName);\n return this.controllerElement.getAttribute(attributeName);\n }\n findOutlet(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n if (selector)\n return this.findElement(selector, outletName);\n }\n findAllOutlets(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n return selector ? this.findAllElements(selector, outletName) : [];\n }\n findElement(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter((element) => this.matchesElement(element, selector, outletName))[0];\n }\n findAllElements(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter((element) => this.matchesElement(element, selector, outletName));\n }\n matchesElement(element, selector, outletName) {\n const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || \"\";\n return element.matches(selector) && controllerAttribute.split(\" \").includes(outletName);\n }\n}\n\nclass Scope {\n constructor(schema, element, identifier, logger) {\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n this.containsElement = (element) => {\n return element.closest(this.controllerSelector) === this.element;\n };\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n this.outlets = new OutletSet(this.documentScope, element);\n }\n findElement(selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n }\n findAllElements(selector) {\n return [\n ...(this.element.matches(selector) ? [this.element] : []),\n ...this.queryElements(selector).filter(this.containsElement),\n ];\n }\n queryElements(selector) {\n return Array.from(this.element.querySelectorAll(selector));\n }\n get controllerSelector() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n }\n get isDocumentScope() {\n return this.element === document.documentElement;\n }\n get documentScope() {\n return this.isDocumentScope\n ? this\n : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger);\n }\n}\n\nclass ScopeObserver {\n constructor(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n start() {\n this.valueListObserver.start();\n }\n stop() {\n this.valueListObserver.stop();\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n parseValueForToken(token) {\n const { element, content: identifier } = token;\n return this.parseValueForElementAndIdentifier(element, identifier);\n }\n parseValueForElementAndIdentifier(element, identifier) {\n const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n let scope = scopesByIdentifier.get(identifier);\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n }\n elementMatchedValue(element, value) {\n const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n }\n elementUnmatchedValue(element, value) {\n const referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n }\n fetchScopesByIdentifierForElement(element) {\n let scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n }\n}\n\nclass Router {\n constructor(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n get element() {\n return this.application.element;\n }\n get schema() {\n return this.application.schema;\n }\n get logger() {\n return this.application.logger;\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n get modules() {\n return Array.from(this.modulesByIdentifier.values());\n }\n get contexts() {\n return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []);\n }\n start() {\n this.scopeObserver.start();\n }\n stop() {\n this.scopeObserver.stop();\n }\n loadDefinition(definition) {\n this.unloadIdentifier(definition.identifier);\n const module = new Module(this.application, definition);\n this.connectModule(module);\n const afterLoad = definition.controllerConstructor.afterLoad;\n if (afterLoad) {\n afterLoad.call(definition.controllerConstructor, definition.identifier, this.application);\n }\n }\n unloadIdentifier(identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n }\n getContextForElementAndIdentifier(element, identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find((context) => context.element == element);\n }\n }\n proposeToConnectScopeForElementAndIdentifier(element, identifier) {\n const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier);\n if (scope) {\n this.scopeObserver.elementMatchedValue(scope.element, scope);\n }\n else {\n console.error(`Couldn't find or create scope for identifier: \"${identifier}\" and element:`, element);\n }\n }\n handleError(error, message, detail) {\n this.application.handleError(error, message, detail);\n }\n createScopeForElementAndIdentifier(element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n }\n scopeConnected(scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n }\n scopeDisconnected(scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }\n connectModule(module) {\n this.modulesByIdentifier.set(module.identifier, module);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach((scope) => module.connectContextForScope(scope));\n }\n disconnectModule(module) {\n this.modulesByIdentifier.delete(module.identifier);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach((scope) => module.disconnectContextForScope(scope));\n }\n}\n\nconst defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\",\n targetAttributeForScope: (identifier) => `data-${identifier}-target`,\n outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`,\n keyMappings: Object.assign(Object.assign({ enter: \"Enter\", tab: \"Tab\", esc: \"Escape\", space: \" \", up: \"ArrowUp\", down: \"ArrowDown\", left: \"ArrowLeft\", right: \"ArrowRight\", home: \"Home\", end: \"End\", page_up: \"PageUp\", page_down: \"PageDown\" }, objectFromEntries(\"abcdefghijklmnopqrstuvwxyz\".split(\"\").map((c) => [c, c]))), objectFromEntries(\"0123456789\".split(\"\").map((n) => [n, n]))),\n};\nfunction objectFromEntries(array) {\n return array.reduce((memo, [k, v]) => (Object.assign(Object.assign({}, memo), { [k]: v })), {});\n}\n\nclass Application {\n constructor(element = document.documentElement, schema = defaultSchema) {\n this.logger = console;\n this.debug = false;\n this.logDebugActivity = (identifier, functionName, detail = {}) => {\n if (this.debug) {\n this.logFormattedMessage(identifier, functionName, detail);\n }\n };\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters);\n }\n static start(element, schema) {\n const application = new this(element, schema);\n application.start();\n return application;\n }\n async start() {\n await domReady();\n this.logDebugActivity(\"application\", \"starting\");\n this.dispatcher.start();\n this.router.start();\n this.logDebugActivity(\"application\", \"start\");\n }\n stop() {\n this.logDebugActivity(\"application\", \"stopping\");\n this.dispatcher.stop();\n this.router.stop();\n this.logDebugActivity(\"application\", \"stop\");\n }\n register(identifier, controllerConstructor) {\n this.load({ identifier, controllerConstructor });\n }\n registerActionOption(name, filter) {\n this.actionDescriptorFilters[name] = filter;\n }\n load(head, ...rest) {\n const definitions = Array.isArray(head) ? head : [head, ...rest];\n definitions.forEach((definition) => {\n if (definition.controllerConstructor.shouldLoad) {\n this.router.loadDefinition(definition);\n }\n });\n }\n unload(head, ...rest) {\n const identifiers = Array.isArray(head) ? head : [head, ...rest];\n identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier));\n }\n get controllers() {\n return this.router.contexts.map((context) => context.controller);\n }\n getControllerForElementAndIdentifier(element, identifier) {\n const context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }\n handleError(error, message, detail) {\n var _a;\n this.logger.error(`%s\\n\\n%o\\n\\n%o`, message, error, detail);\n (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, \"\", 0, 0, error);\n }\n logFormattedMessage(identifier, functionName, detail = {}) {\n detail = Object.assign({ application: this }, detail);\n this.logger.groupCollapsed(`${identifier} #${functionName}`);\n this.logger.log(\"details:\", Object.assign({}, detail));\n this.logger.groupEnd();\n }\n}\nfunction domReady() {\n return new Promise((resolve) => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => resolve());\n }\n else {\n resolve();\n }\n });\n}\n\nfunction ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\nfunction propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const { classes } = this;\n if (classes.has(key)) {\n return classes.get(key);\n }\n else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n },\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n },\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n },\n },\n };\n}\n\nfunction OutletPropertiesBlessing(constructor) {\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n return outlets.reduce((properties, outletDefinition) => {\n return Object.assign(properties, propertiesForOutletDefinition(outletDefinition));\n }, {});\n}\nfunction getOutletController(controller, element, identifier) {\n return controller.application.getControllerForElementAndIdentifier(element, identifier);\n}\nfunction getControllerAndEnsureConnectedScope(controller, element, outletName) {\n let outletController = getOutletController(controller, element, outletName);\n if (outletController)\n return outletController;\n controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName);\n outletController = getOutletController(controller, element, outletName);\n if (outletController)\n return outletController;\n}\nfunction propertiesForOutletDefinition(name) {\n const camelizedName = namespaceCamelize(name);\n return {\n [`${camelizedName}Outlet`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController)\n return outletController;\n throw new Error(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`);\n }\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n },\n },\n [`${camelizedName}Outlets`]: {\n get() {\n const outlets = this.outlets.findAll(name);\n if (outlets.length > 0) {\n return outlets\n .map((outletElement) => {\n const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name);\n if (outletController)\n return outletController;\n console.warn(`The provided outlet element is missing an outlet controller \"${name}\" instance for host controller \"${this.identifier}\"`, outletElement);\n })\n .filter((controller) => controller);\n }\n return [];\n },\n },\n [`${camelizedName}OutletElement`]: {\n get() {\n const outletElement = this.outlets.find(name);\n const selector = this.outlets.getSelectorForOutletName(name);\n if (outletElement) {\n return outletElement;\n }\n else {\n throw new Error(`Missing outlet element \"${name}\" for host controller \"${this.identifier}\". Stimulus couldn't find a matching outlet element using selector \"${selector}\".`);\n }\n },\n },\n [`${camelizedName}OutletElements`]: {\n get() {\n return this.outlets.findAll(name);\n },\n },\n [`has${capitalize(camelizedName)}Outlet`]: {\n get() {\n return this.outlets.has(name);\n },\n },\n };\n}\n\nfunction TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\nfunction propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n }\n else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n },\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n },\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n },\n },\n };\n}\n\nfunction ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, { [attributeName]: valueDescriptor });\n }, {});\n },\n },\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\nfunction propertiesForValueDefinitionPair(valueDefinitionPair, controller) {\n const definition = parseValueDefinitionPair(valueDefinitionPair, controller);\n const { key, name, reader: read, writer: write } = definition;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n }\n else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === undefined) {\n this.data.delete(key);\n }\n else {\n this.data.set(key, write(value));\n }\n },\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n },\n },\n };\n}\nfunction parseValueDefinitionPair([token, typeDefinition], controller) {\n return valueDescriptorForTokenAndTypeDefinition({\n controller,\n token,\n typeDefinition,\n });\n}\nfunction parseValueTypeConstant(constant) {\n switch (constant) {\n case Array:\n return \"array\";\n case Boolean:\n return \"boolean\";\n case Number:\n return \"number\";\n case Object:\n return \"object\";\n case String:\n return \"string\";\n }\n}\nfunction parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n }\n if (Array.isArray(defaultValue))\n return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\")\n return \"object\";\n}\nfunction parseValueTypeObject(payload) {\n const { controller, token, typeObject } = payload;\n const hasType = isSomething(typeObject.type);\n const hasDefault = isSomething(typeObject.default);\n const fullObject = hasType && hasDefault;\n const onlyType = hasType && !hasDefault;\n const onlyDefault = !hasType && hasDefault;\n const typeFromObject = parseValueTypeConstant(typeObject.type);\n const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default);\n if (onlyType)\n return typeFromObject;\n if (onlyDefault)\n return typeFromDefaultValue;\n if (typeFromObject !== typeFromDefaultValue) {\n const propertyPath = controller ? `${controller}.${token}` : token;\n throw new Error(`The specified default value for the Stimulus Value \"${propertyPath}\" must match the defined type \"${typeFromObject}\". The provided default value of \"${typeObject.default}\" is of type \"${typeFromDefaultValue}\".`);\n }\n if (fullObject)\n return typeFromObject;\n}\nfunction parseValueTypeDefinition(payload) {\n const { controller, token, typeDefinition } = payload;\n const typeObject = { controller, token, typeObject: typeDefinition };\n const typeFromObject = parseValueTypeObject(typeObject);\n const typeFromDefaultValue = parseValueTypeDefault(typeDefinition);\n const typeFromConstant = parseValueTypeConstant(typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type)\n return type;\n const propertyPath = controller ? `${controller}.${typeDefinition}` : token;\n throw new Error(`Unknown value type \"${propertyPath}\" for \"${token}\" value`);\n}\nfunction defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant)\n return defaultValuesByType[constant];\n const hasDefault = hasProperty(typeDefinition, \"default\");\n const hasType = hasProperty(typeDefinition, \"type\");\n const typeObject = typeDefinition;\n if (hasDefault)\n return typeObject.default;\n if (hasType) {\n const { type } = typeObject;\n const constantFromType = parseValueTypeConstant(type);\n if (constantFromType)\n return defaultValuesByType[constantFromType];\n }\n return typeDefinition;\n}\nfunction valueDescriptorForTokenAndTypeDefinition(payload) {\n const { token, typeDefinition } = payload;\n const key = `${dasherize(token)}-value`;\n const type = parseValueTypeDefinition(payload);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() {\n return defaultValueForDefinition(typeDefinition);\n },\n get hasCustomDefaultValue() {\n return parseValueTypeDefault(typeDefinition) !== undefined;\n },\n reader: readers[type],\n writer: writers[type] || writers.default,\n };\n}\nconst defaultValuesByType = {\n get array() {\n return [];\n },\n boolean: false,\n number: 0,\n get object() {\n return {};\n },\n string: \"\",\n};\nconst readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`expected value of type \"array\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(array)}\"`);\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || String(value).toLowerCase() == \"false\");\n },\n number(value) {\n return Number(value.replace(/_/g, \"\"));\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(object)}\"`);\n }\n return object;\n },\n string(value) {\n return value;\n },\n};\nconst writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON,\n};\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\nfunction writeString(value) {\n return `${value}`;\n}\n\nclass Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n static afterLoad(_identifier, _application) {\n return;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get outlets() {\n return this.scope.outlets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {\n }\n connect() {\n }\n disconnect() {\n }\n dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true, } = {}) {\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, { detail, bubbles, cancelable });\n target.dispatchEvent(event);\n return event;\n }\n}\nController.blessings = [\n ClassPropertiesBlessing,\n TargetPropertiesBlessing,\n ValuePropertiesBlessing,\n OutletPropertiesBlessing,\n];\nController.targets = [];\nController.outlets = [];\nController.values = {};\n\nexport { Application, AttributeObserver, Context, Controller, ElementObserver, IndexedMultimap, Multimap, SelectorObserver, StringMapObserver, TokenListObserver, ValueListObserver, add, defaultSchema, del, fetch, prune };\n", "import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n connect () {\n console.log(\"SharedUI Demo ViewComponent Connected\");\n this.element.addEventListener(\"click\", () => { alert(\"SharedUI Component was clicked!\"); });\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n connect () {\n console.log(\"SharedUI Demo Unwrapped ViewComponent Connected\");\n this.element.addEventListener(\"click\", () => { alert(\"SharedUI Component was clicked!\"); });\n }\n}\n", "\n import * as module0 from '/tmp/build_055c2b3e/vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/shared_ui/demo/controller.js';import * as module1 from '/tmp/build_055c2b3e/vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/shared_ui/demo_unwrapped/controller.js'\n\n const modules = [module0,module1];\n\n export default modules;\n export const filenames = ['/tmp/build_055c2b3e/vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/shared_ui/demo/controller.js','/tmp/build_055c2b3e/vendor/bundle/ruby/3.1.0/bundler/gems/teamshares-rails-9f652e650c39/app/frontend/components/shared_ui/demo_unwrapped/controller.js']\n ", "\n \n\n const modules = [];\n\n export default modules;\n export const filenames = []\n ", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"administrative-info-step\"\nexport default class extends Controller {\n connect () {\n this.resetAllRadioButtons();\n this.checkChoiceInputs();\n }\n\n highlightChoice (e) {\n switch (e.target.parentNode.htmlFor) {\n case \"administrative_info_compensation_accepted_false\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_compensation_accepted_true\").parentNode.parentNode);\n break;\n case \"administrative_info_compensation_accepted_true\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_compensation_accepted_false\").parentNode.parentNode);\n break;\n case \"administrative_info_business_interest_disclosure_yes\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_business_interest_disclosure_no\").parentNode.parentNode);\n break;\n case \"administrative_info_business_interest_disclosure_no\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_business_interest_disclosure_yes\").parentNode.parentNode);\n break;\n case \"administrative_info_us_work_authorization_true\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_us_work_authorization_false\").parentNode.parentNode);\n break;\n case \"administrative_info_us_work_authorization_false\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_us_work_authorization_true\").parentNode.parentNode);\n break;\n case \"administrative_info_require_employment_sponsorship_true\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_require_employment_sponsorship_false\").parentNode.parentNode);\n break;\n case \"administrative_info_require_employment_sponsorship_false\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"administrative_info_require_employment_sponsorship_true\").parentNode.parentNode);\n break;\n default:\n break;\n }\n }\n\n resetAllRadioButtons () {\n document.querySelectorAll(\".admin-info-choice\").forEach(el => {\n this.applyInactiveStateContext(el);\n });\n }\n\n checkChoiceInputs () {\n // Compensation\n const compensationTrue = document.getElementById(\"administrative_info_compensation_accepted_true\");\n const compensationFalse = document.getElementById(\"administrative_info_compensation_accepted_false\");\n\n if (compensationTrue.checked) {\n this.applyActiveStateContext(compensationTrue.parentNode.parentNode);\n this.applyInactiveStateContext(compensationFalse.parentNode.parentNode);\n }\n\n if (compensationFalse.checked) {\n this.applyActiveStateContext(compensationFalse.parentNode.parentNode);\n this.applyInactiveStateContext(compensationTrue.parentNode.parentNode);\n }\n\n // Business Interest Disclosure\n const disclosureYes = document.getElementById(\"administrative_info_business_interest_disclosure_yes\");\n const disclosureNo = document.getElementById(\"administrative_info_business_interest_disclosure_no\");\n\n if (disclosureYes.checked) {\n this.applyActiveStateContext(disclosureYes.parentNode.parentNode);\n this.applyInactiveStateContext(disclosureNo.parentNode.parentNode);\n }\n\n if (disclosureNo.checked) {\n this.applyActiveStateContext(disclosureNo.parentNode.parentNode);\n this.applyInactiveStateContext(disclosureYes.parentNode.parentNode);\n }\n\n // US Work Authorization\n const workAuthTrue = document.getElementById(\"administrative_info_us_work_authorization_true\");\n const workAuthFalse = document.getElementById(\"administrative_info_us_work_authorization_false\");\n\n if (workAuthTrue.checked) {\n this.applyActiveStateContext(workAuthTrue.parentNode.parentNode);\n this.applyInactiveStateContext(workAuthFalse.parentNode.parentNode);\n }\n\n if (workAuthFalse.checked) {\n this.applyActiveStateContext(workAuthFalse.parentNode.parentNode);\n this.applyInactiveStateContext(workAuthTrue.parentNode.parentNode);\n }\n\n // Require Employment Sponsorship\n const employmentSponsorshipTrue = document.getElementById(\"administrative_info_require_employment_sponsorship_true\");\n const employmentSponsorshipFalse = document.getElementById(\"administrative_info_require_employment_sponsorship_false\");\n\n if (employmentSponsorshipTrue.checked) {\n this.applyActiveStateContext(employmentSponsorshipTrue.parentNode.parentNode);\n this.applyInactiveStateContext(employmentSponsorshipFalse.parentNode.parentNode);\n }\n\n if (employmentSponsorshipFalse.checked) {\n this.applyActiveStateContext(employmentSponsorshipFalse.parentNode.parentNode);\n this.applyInactiveStateContext(employmentSponsorshipTrue.parentNode.parentNode);\n }\n }\n\n applyActiveStateContext (el) {\n el.classList.add(\"bg-blue-100\");\n el.classList.add(\"rounded-md\");\n el.classList.add(\"text-blue-600\");\n }\n\n applyInactiveStateContext (el) {\n el.classList.remove(\"bg-blue-100\");\n el.classList.add(\"rounded-md\");\n el.classList.remove(\"text-blue-600\");\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"archive-modal\"\nexport default class extends Controller {\n static targets = [\n \"archiveTo\",\n \"rejectWithdrawReason\",\n \"sendNotice\",\n \"onDeckFields\",\n \"onDeckReason\",\n ];\n\n hideModal () {\n this.element.parentElement.removeAttribute(\"src\"); // it might be nice to also remove the modal SRC\n this.element.remove();\n }\n\n // Hide modal on successful form submission\n // Action: \"turbo:submit-end->turbo-modal#submitEnd\"\n submitEnd (e) {\n if (e.detail.success) {\n this.hideModal();\n }\n }\n\n connect () {\n const archiveEvent = this.archiveToTarget.value;\n\n switch (archiveEvent) {\n case \"Reject\":\n this.rejectWithdrawReasonTarget.parentElement.classList.remove(\"hidden\");\n this.sendNoticeTarget.classList.remove(\"hidden\");\n document.getElementById(\"candidate_profile_submission_send_notice_true\").checked = true;\n break;\n // Decline offer does the same as withdraw so both will do what is under withdraw\n case \"Decline offer\":\n case \"Withdraw\":\n this.rejectWithdrawReasonTarget.parentElement.classList.remove(\"hidden\");\n break;\n case \"Place on deck\":\n this.onDeckFieldsTarget.classList.remove(\"hidden\");\n break;\n }\n }\n\n toggleOnDeckSendNotice () {\n if (this.onDeckReasonTarget.value === \"Position Closed\") {\n this.sendNoticeTarget.classList.remove(\"hidden\");\n document.getElementById(\"candidate_profile_submission_send_notice_true\").checked = true;\n } else {\n this.sendNoticeTarget.classList.add(\"hidden\");\n }\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"candidate-profile-note\"\nexport default class extends Controller {\n static targets = [\n \"notesInput\",\n \"form\",\n ];\n\n clearNote () {\n this.notesInputTarget.value = \"\";\n }\n\n submitNote () {\n this.formTarget.requestSubmit();\n this.clearNote();\n }\n\n openNotes () {\n const drawer = document.querySelector(\".drawer\");\n drawer.show();\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"candidate-profile-note-new\"\nexport default class extends Controller {\n connect () {\n document.querySelector(\"#notes\").scrollIntoView(false);\n\n // Increase count on notes button\n const notesButtonText = document.querySelector(\"#notesButton\").innerHTML;\n const oldCount = notesButtonText.substring(notesButtonText.lastIndexOf(\"(\") + 1, notesButtonText.lastIndexOf(\")\"));\n const newCount = parseInt(oldCount) + 1;\n document.querySelector(\"#notesButton\").innerHTML = notesButtonText.replace(oldCount, newCount);\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"candidate-profile-score\"\nexport default class extends Controller {\n static targets = [\"notesInput\", \"form\"];\n\n openEvaluation ({ params: { step } }) {\n document.getElementById(\"evaluation-title\").innerHTML = step.split(\" \").map((word) => {\n return word[0].toUpperCase() + word.substring(1);\n }).join(\" \");\n\n document.getElementById(\"evaluation_title\").value = step;\n document.getElementById(\"evaluation_feedback\").value = \"\";\n document.querySelector(\".evaluation\").show();\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"candidate-profile-step\"\nexport default class extends Controller {\n connect () {\n this.resetReadinessChoices();\n\n const timingChoices = document.querySelectorAll(\".readiness-option\");\n\n timingChoices.forEach((tc) => {\n tc.addEventListener(\"click\", (e) => {\n switch (e.target.tagName) {\n case \"DIV\":\n document.querySelectorAll(\".timingChoiceHeader\").forEach((el) => el.classList.remove(\"text-blue-600\"));\n Array(document.querySelectorAll(\".readiness-option\")).filter(el => el.target !== e.target)[0].forEach((tc) => {\n this.applyInactiveStateContext(tc);\n });\n e.target.firstChild.firstChild.checked = true;\n this.applyActiveStateContext(e.target);\n break;\n case \"INPUT\":\n this.resetReadinessChoices();\n e.target.checked = true;\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n break;\n default:\n break;\n }\n });\n });\n }\n\n resetReadinessChoices () {\n const timingChoices = document.querySelectorAll(\".readiness-option\");\n\n timingChoices.forEach((tc) => {\n this.applyInactiveStateContext(tc);\n });\n\n document.querySelectorAll(\".timingChoiceHeader\").forEach((el) => el.classList.remove(\"text-blue-600\"));\n\n this.checkReadinessInputs();\n }\n\n checkReadinessInputs () {\n const immediateTimingChoice = document.getElementById(\"candidate_profile_candidate_profile_submissions_attributes_0_placement_status_immediate\");\n if (immediateTimingChoice.checked) {\n const choiceWrapper = immediateTimingChoice.parentNode.parentNode;\n this.applyActiveStateContext(choiceWrapper);\n document.getElementById(\"immediateTimingChoiceHeader\").classList.add(\"text-blue-600\");\n }\n\n if (document.getElementById(\"candidate_profile_candidate_profile_submissions_attributes_0_placement_status_mba\") !== null) {\n const mbaTimingChoice = document.getElementById(\"candidate_profile_candidate_profile_submissions_attributes_0_placement_status_mba\");\n if (mbaTimingChoice.checked) {\n const choiceWrapper = mbaTimingChoice.parentNode.parentNode;\n this.applyActiveStateContext(choiceWrapper);\n document.getElementById(\"mbaTimingChoiceHeader\").classList.add(\"text-blue-600\");\n }\n }\n\n if (document.getElementById(\"candidate_profile_candidate_profile_submissions_attributes_0_placement_status_mba_intern\") !== null) {\n const mbaInternTimingChoice = document.getElementById(\"candidate_profile_candidate_profile_submissions_attributes_0_placement_status_mba_intern\");\n if (mbaInternTimingChoice.checked) {\n const choiceWrapper = mbaInternTimingChoice.parentNode.parentNode;\n this.applyActiveStateContext(choiceWrapper);\n document.getElementById(\"mbaInternTimingChoiceHeader\").classList.add(\"text-blue-600\");\n }\n }\n\n const deferredYearTimingChoice = document.getElementById(\"candidate_profile_candidate_profile_submissions_attributes_0_placement_status_deferred_year\");\n if (deferredYearTimingChoice.checked) {\n const choiceWrapper = deferredYearTimingChoice.parentNode.parentNode;\n this.applyActiveStateContext(choiceWrapper);\n document.getElementById(\"deferredYearTimingChoiceHeader\").classList.add(\"text-blue-600\");\n }\n }\n\n applyActiveStateContext (el) {\n el.classList.remove(\"border-gray-300\");\n el.classList.add(\"border-blue-600\");\n el.classList.add(\"bg-blue-100\");\n }\n\n applyInactiveStateContext (el) {\n el.classList.add(\"border-gray-300\");\n el.classList.remove(\"border-blue-600\");\n el.classList.remove(\"bg-blue-100\");\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\"copyButton\"];\n\n copy (e) {\n e.preventDefault();\n if (!this.hasCopyButtonTarget) return;\n const originalText = e.target.innerHTML;\n navigator.clipboard.writeText(e.target.attributes[\"data-clipboard-text\"].value);\n e.target.innerHTML = \"Copied!\";\n\n setTimeout(() => {\n e.target.innerHTML = originalText;\n }, 2000);\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"clickable-dashboard-table-row\"\nexport default class extends Controller {\n static values = { url: String };\n\n click (e) {\n if (e.target.classList.contains(\"no-click\")) {\n return;\n }\n\n this.handleClick();\n }\n\n handleClick () {\n localStorage.setItem(\"candidateIds\", null);\n window.location.href = this.urlValue;\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// NOTE: We'll keep the commented out code in in case we add/activate more essay prompts later on.\n\n// Connects to data-controller=\"essays-step\"\nexport default class extends Controller {\n static targets = [\n \"essayQuestionSubmissionAnswer0\",\n \"essayQuestionSubmissionAnswer1\",\n // \"essayQuestionSubmissionAnswer2\",\n // \"essayQuestionSubmissionAnswer3\",\n ];\n\n connect () {\n this.setCountTextToCurrentLengthOnConnect();\n }\n\n calculateEssayLength (e) {\n // First Essay Question Submission\n if (e.target.getAttribute(\"data-essays-step-target\") === \"essayQuestionSubmissionAnswer0\") {\n this.setCountTextToCurrentLengthOnInput(e, \"essay_question_submission_count_0\");\n }\n\n // Second Essay Question Submission\n if (e.target.getAttribute(\"data-essays-step-target\") === \"essayQuestionSubmissionAnswer1\") {\n this.setCountTextToCurrentLengthOnInput(e, \"essay_question_submission_count_1\");\n }\n\n // // Third Essay Question Submission\n // if (e.target.getAttribute(\"data-essays-step-target\") === \"essayQuestionSubmissionAnswer2\") {\n // this.setCountTextToCurrentLengthOnInput(e, \"essay_question_submission_count_2\");\n // }\n\n // // Fourth Essay Question Submission\n // if (e.target.getAttribute(\"data-essays-step-target\") === \"essayQuestionSubmissionAnswer3\") {\n // this.setCountTextToCurrentLengthOnInput(e, \"essay_question_submission_count_3\");\n // }\n }\n\n setCountTextToCurrentLengthOnInput (event, id) {\n const textLength = event.target.value.length;\n const countText = document.getElementById(id);\n countText.textContent = textLength;\n }\n\n setCountTextToCurrentLengthOnConnect () {\n // First Essay Question Submission\n this.calculateAndAssignTextLength(this.essayQuestionSubmissionAnswer0Target, \"essay_question_submission_count_0\");\n\n // Second Essay Question Submission\n this.calculateAndAssignTextLength(this.essayQuestionSubmissionAnswer1Target, \"essay_question_submission_count_1\");\n\n // // Third Essay Question Submission\n // this.calculateAndAssignTextLength(this.essayQuestionSubmissionAnswer2Target, \"essay_question_submission_count_2\");\n\n // // Fourth Essay Question Submission\n // this.calculateAndAssignTextLength(this.essayQuestionSubmissionAnswer3Target, \"essay_question_submission_count_3\");\n }\n\n calculateAndAssignTextLength (answerTextareaTarget, countId) {\n const answerLength = answerTextareaTarget.value.length;\n const answerCountElement = document.getElementById(countId);\n answerCountElement.textContent = answerLength;\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"hidden-field\"\nexport default class extends Controller {\n static targets = [\n \"toggleRejectWithdrawInput\",\n \"toggleCommunicationConfirmation\",\n \"toggleOnDeckInput\",\n \"triggerInput\",\n \"toggleTimingInput\",\n \"toggleStateInput\",\n \"toggleCityInput\",\n \"toggleNextStepText\",\n \"toggleTimingContainer\",\n \"nextStepText\",\n \"transitionButton\",\n ];\n\n connect () {\n this.resetFields();\n\n const ele = document.getElementsByName(\"candidate_profile_submission[aasm_state]\");\n for (let i = 0; i < ele.length; i++) {\n ele[i].checked = false;\n }\n }\n\n toggleTransitionCandidate (event) {\n this.resetFields();\n\n const selectedValue = event.target.value;\n document.getElementById(\"transitionState\").value = selectedValue;\n\n switch (selectedValue) {\n case \"Approve for onboarding\":\n this.nextStepTextTarget.innerText = \"Hired\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Begin video interview review\":\n this.nextStepTextTarget.innerText = \"Video Interview Completed\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Approve for first interview\":\n this.nextStepTextTarget.innerText = \"First Round Interview\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Approve for final interview\":\n this.nextStepTextTarget.innerText = \"Final Round Interview\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Approve for offer\":\n this.nextStepTextTarget.innerText = \"Offer Extended\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Complete onboarding\":\n this.nextStepTextTarget.innerText = \"Offer Accepted\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Approve for offer accepted\":\n this.nextStepTextTarget.innerText = \"Offer Accepted\";\n this.toggleNextStepTextTarget.classList.remove(\"hidden\");\n break;\n case \"Reject\":\n this.toggleRejectWithdrawInputTarget.parentElement.classList.remove(\"hidden\");\n this.toggleCommunicationConfirmationTarget.classList.remove(\"hidden\");\n document.getElementById(\"candidate_profile_submission_send_notice_true\").checked = true;\n break;\n case \"Decline offer\":\n case \"Withdraw\":\n this.toggleRejectWithdrawInputTarget.parentElement.classList.remove(\"hidden\");\n break;\n case \"Place on deck\":\n this.toggleOnDeckInputTarget.parentElement.classList.remove(\"hidden\");\n this.toggleTimingContainerTarget.classList.remove(\"hidden\");\n this.toggleStateInputTarget.parentElement.classList.remove(\"hidden\");\n this.toggleCityInputTarget.parentElement.classList.remove(\"hidden\");\n break;\n }\n\n this.transitionButtonTarget.classList.remove(\"hidden\");\n }\n\n toggleOnDeckCommunicationOption () {\n if (this.toggleOnDeckInputTarget.value === \"Position Closed\") {\n this.toggleCommunicationConfirmationTarget.classList.remove(\"hidden\");\n document.getElementById(\"candidate_profile_submission_send_notice_true\").checked = true;\n } else {\n this.toggleCommunicationConfirmationTarget.classList.add(\"hidden\");\n }\n }\n\n resetFields () {\n this.toggleTimingContainerTarget.classList.add(\"hidden\");\n this.toggleNextStepTextTarget.classList.add(\"hidden\");\n this.toggleRejectWithdrawInputTarget.parentElement.classList.add(\"hidden\");\n this.toggleOnDeckInputTarget.parentElement.classList.add(\"hidden\");\n this.toggleStateInputTarget.parentElement.classList.add(\"hidden\");\n this.toggleCityInputTarget.parentElement.classList.add(\"hidden\");\n this.toggleCommunicationConfirmationTarget.classList.add(\"hidden\");\n this.transitionButtonTarget.classList.add(\"hidden\");\n this.toggleTimingInputTarget.value = \"\";\n this.toggleStateInputTarget.value = \"\";\n this.toggleCityInputTarget.value = \"\";\n this.toggleOnDeckInputTarget.value = \"\";\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"kebab-dropdown\"\nexport default class extends Controller {\n static targets = [\"dropdown\"];\n\n connect () {\n const dropdownEl = document.getElementById(\"kebab-dropdown-button\");\n if (dropdownEl !== null) {\n document.addEventListener(\"click\", event => {\n const isKebabDropdownButtonClicked = dropdownEl.contains(event.target);\n\n if (!isKebabDropdownButtonClicked) {\n this.dropdownTarget.hidden = true;\n }\n });\n }\n }\n\n toggleDropdown () {\n this.dropdownTarget.hidden === true ? this.dropdownTarget.hidden = false : this.dropdownTarget.hidden = true;\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"matching-preference-step--deferred-year\"\nexport default class extends Controller {\n static targets = [\n \"preferredDeferredLocationSelection\",\n ];\n\n connect () {\n const isDesiredLocationCommutableFalseInput = document.getElementById(\"matching_preference_is_desired_location_commutable_false\");\n const isDesiredLocationCommutableTrueInput = document.getElementById(\"matching_preference_is_desired_location_commutable_true\");\n this.applyInactiveStateContext(isDesiredLocationCommutableFalseInput.parentNode.parentNode);\n this.applyInactiveStateContext(isDesiredLocationCommutableTrueInput.parentNode.parentNode);\n\n if (isDesiredLocationCommutableFalseInput.checked) {\n this.togglePreferredDeferredLocationSelection(false);\n this.applyActiveStateContext(isDesiredLocationCommutableFalseInput.parentNode.parentNode);\n document.getElementById(\"matching_preference_location_followup_city\").value = \"\";\n } else if (isDesiredLocationCommutableTrueInput.checked) {\n this.applyActiveStateContext(isDesiredLocationCommutableTrueInput.parentNode.parentNode);\n }\n }\n\n highlightChoice (e) {\n switch (e.target.id) {\n case \"matching_preference_is_desired_location_commutable_false\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"matching_preference_is_desired_location_commutable_true\").parentNode.parentNode);\n this.togglePreferredDeferredLocationSelection(false);\n break;\n case \"matching_preference_is_desired_location_commutable_true\":\n this.applyActiveStateContext(e.target.parentNode.parentNode);\n this.applyInactiveStateContext(document.getElementById(\"matching_preference_is_desired_location_commutable_false\").parentNode.parentNode);\n this.togglePreferredDeferredLocationSelection(true);\n break;\n default:\n break;\n }\n }\n\n togglePreferredDeferredLocationSelection (isCommutable) {\n if (isCommutable) {\n this.preferredDeferredLocationSelectionTarget.classList.add(\"hidden\");\n } else {\n this.preferredDeferredLocationSelectionTarget.classList.remove(\"hidden\");\n }\n document.getElementById(\"matching_preference_location_followup_city\").value = \"\";\n }\n\n applyActiveStateContext (el) {\n el.classList.add(\"bg-blue-100\");\n el.classList.add(\"text-blue-600\");\n }\n\n applyInactiveStateContext (el) {\n el.classList.remove(\"bg-blue-100\");\n el.classList.remove(\"text-blue-600\");\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"matching-preference-step--immediate-placement\"\nexport default class extends Controller {\n static targets = [\n \"hideLocationSelectionIcon\",\n \"showLocationSelectionIcon\",\n \"locationSection\",\n\n \"hideMatchNotificationSelectionIcon\",\n \"showMatchNotificationSelectionIcon\",\n \"matchNotificationSelection\",\n\n \"followUpMoveChoiceLabel\",\n \"followUpMoveChoiceCityInput\",\n \"followUpMoveChoiceStateDropdown\",\n ];\n\n static values = { region: String };\n\n connect () {\n const existingRegionValueIsInList = Array.from(document.getElementsByClassName(\"location_choice\")).map((input) => input.value).includes(this.regionValue);\n if (this.regionValue !== \"\" && existingRegionValueIsInList) {\n Array.from(document.getElementsByClassName(\"location_choice\")).filter((input) => input.value == this.regionValue)[0].checked = true // eslint-disable-line\n }\n this.showLocationSelection();\n this.hideMatchNotificationSelection();\n }\n\n triggerLocationMatch () {\n if (this.showLocationSelectionIconTarget.hidden) {\n this.hideLocationSelection();\n this.uncheckAllLocations();\n this.showMatchNotificationSelection();\n } else {\n this.showLocationSelection();\n this.hideMatchNotificationSelection();\n }\n }\n\n triggerFollowupSelection () {\n if (this.showMatchNotificationSelectionIconTarget.hidden) {\n this.showLocationSelection();\n this.hideMatchNotificationSelection();\n } else {\n this.hideLocationSelection();\n this.uncheckAllLocations();\n this.showMatchNotificationSelection();\n }\n }\n\n showLocationSelection () {\n if (this.hasShowLocationSelectionIconTarget & this.hasHideLocationSelectionIconTarget) {\n this.hideLocationSelectionIconTarget.hidden = false;\n this.showLocationSelectionIconTarget.hidden = true;\n this.locationSectionTarget.hidden = false;\n document.getElementById(\"matching_preference_location_followup_my_desired_location_matches_my_current_zipcode\").checked = false;\n document.getElementById(\"matching_preference_location_followup_i_have_plans_to_move_to_a_location_that_does_not_match_my_current_zip_code\").checked = false;\n this.setDisabledFollowUpChoicesContext();\n }\n }\n\n hideLocationSelection () {\n this.hideLocationSelectionIconTarget.hidden = true;\n this.showLocationSelectionIconTarget.hidden = false;\n this.locationSectionTarget.hidden = true;\n }\n\n showMatchNotificationSelection () {\n this.hideMatchNotificationSelectionIconTarget.hidden = false;\n this.showMatchNotificationSelectionIconTarget.hidden = true;\n this.matchNotificationSelectionTarget.hidden = false;\n }\n\n hideMatchNotificationSelection () {\n if (this.hasHideMatchNotificationSelectionIconTarget) {\n this.hideMatchNotificationSelectionIconTarget.hidden = true;\n this.showMatchNotificationSelectionIconTarget.hidden = false;\n this.matchNotificationSelectionTarget.hidden = true;\n }\n }\n\n toggleFollowUpMoveChoices (e) {\n switch (e.target.value) {\n case \"My desired location matches my current zipcode\":\n this.setDisabledFollowUpChoicesContext();\n break;\n case \"I have plans to move to a location that does not match my current zip code\":\n this.setEnabledFollowUpChoicesContext();\n break;\n }\n }\n\n setDisabledFollowUpChoicesContext () {\n this.followUpMoveChoiceLabelTarget.classList.add(\"text-gray-400\");\n this.followUpMoveChoiceCityInputTarget.disabled = true;\n this.followUpMoveChoiceCityInputTarget.value = \"\";\n this.followUpMoveChoiceStateDropdownTarget.disabled = true;\n }\n\n setEnabledFollowUpChoicesContext () {\n this.followUpMoveChoiceLabelTarget.classList.remove(\"text-gray-400\");\n this.followUpMoveChoiceCityInputTarget.disabled = false;\n this.followUpMoveChoiceStateDropdownTarget.disabled = false;\n }\n\n highlightSingleLocationInput (e) {\n this.regionValue = e.target.value;\n switch (e.target.name) {\n case \"matching_preference[new_england]\":\n this.uncheckOtherLocations(\"new_england\");\n break;\n case \"matching_preference[middle_atlantic]\":\n this.uncheckOtherLocations(\"middle_atlantic\");\n break;\n case \"matching_preference[south]\":\n this.uncheckOtherLocations(\"south\");\n break;\n case \"matching_preference[west]\":\n this.uncheckOtherLocations(\"west\");\n break;\n case \"matching_preference[midwest]\":\n this.uncheckOtherLocations(\"midwest\");\n break;\n case \"matching_preference[southwest]\":\n this.uncheckOtherLocations(\"southwest\");\n break;\n }\n }\n\n uncheckAllLocations () {\n Array.from(document.getElementsByClassName(\"location_choice\")).forEach(function (input) { input.checked = false; });\n }\n\n uncheckOtherLocations (region) {\n Array.from(document.getElementsByClassName(\"location_choice\")).filter((input) => input.name !== `matching_preference[${region}]`).forEach(function (input) { input.checked = false; });\n }\n}\n", "/**!\n * Sortable 1.15.2\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n keys.push.apply(keys, symbols);\n }\n return keys;\n}\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n return target;\n}\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof(obj);\n}\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = _objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar version = \"1.15.2\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n }\n}\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction matches( /**HTMLElement*/el, /**String*/selector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n return false;\n}\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\nfunction closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n return null;\n}\nvar R_SPACE = /\\s+/g;\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\nfunction css(el, prop, val) {\n var style = el && el.style;\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n } while (!selfOnly && (el = el.parentNode));\n }\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n return matrixFn && new matrixFn(appliedTransforms);\n}\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n return list;\n }\n return [];\n}\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n\n/**\r\n * Returns the \"bounding client rect\" of given element\r\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\r\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\r\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\r\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\r\n * @param {[HTMLElement]} container The parent the element will be placed in\r\n * @return {Object} The boundingClientRect of el, with specified adjustments\r\n */\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode;\n\n // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect();\n\n // Set relative to edges of padding box of container\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n } while (container = container.parentNode);\n }\n }\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n\n/**\r\n * Checks if a side of an element is scrolled past a side of its parents\r\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\r\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\r\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\r\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\r\n */\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n\n /* jshint boss:true */\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n return false;\n}\n\n/**\r\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\r\n * and non-draggable elements\r\n * @param {HTMLElement} el The parent element\r\n * @param {Number} childNum The index of the child\r\n * @param {Object} options Parent Sortable's options\r\n * @return {HTMLElement} The child at index childNum, or null if not found\r\n */\nfunction getChild(el, childNum, options, includeDragEl) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n currentChild++;\n }\n i++;\n }\n return null;\n}\n\n/**\r\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\r\n * @param {HTMLElement} el Parent element\r\n * @param {selector} selector Any other elements that should be ignored\r\n * @return {HTMLElement} The last child, ignoring ghostEl\r\n */\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n return last || null;\n}\n\n/**\r\n * Returns the index of an element within its parent for a selected set of\r\n * elements\r\n * @param {HTMLElement} el\r\n * @param {selector} selector\r\n * @return {number}\r\n */\nfunction index(el, selector) {\n var index = 0;\n if (!el || !el.parentNode) {\n return -1;\n }\n\n /* jshint boss:true */\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n return index;\n}\n\n/**\r\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\r\n * The value is returned in real pixels.\r\n * @param {HTMLElement} el\r\n * @return {Array} Offsets in the format of [left, top]\r\n */\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n return [offsetLeft, offsetTop];\n}\n\n/**\r\n * Returns the index of the object within the given array\r\n * @param {Array} arr Array that may or may not hold the object\r\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\r\n * @return {Number} The index of the object in the array, or -1\r\n */\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n return -1;\n}\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n } while (elem = elem.parentNode);\n return getWindowScrollingElement();\n}\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n return dst;\n}\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\nvar _throttleTimeout;\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\nfunction getChildContainingRectFromElement(container, options, ghostEl) {\n var rect = {};\n Array.from(container.children).forEach(function (child) {\n var _rect$left, _rect$top, _rect$right, _rect$bottom;\n if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;\n var childRect = getRect(child);\n rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);\n rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);\n rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);\n rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);\n });\n rect.width = rect.right - rect.left;\n rect.height = rect.bottom - rect.top;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);\n\n // If animating: compensate for current animation\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n target.toRect = toRect;\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&\n // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n }\n\n // if fromRect != toRect: animate\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n if (!time) {\n time = _this.options.animation;\n }\n _this.animate(target, animatingRect, toRect, time);\n }\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\nfunction repaint(target) {\n return target.offsetWidth;\n}\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n this.eventCanceled = false;\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return;\n // Fire global events if it exists in this sortable\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n\n // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized;\n\n // Add default options from plugin\n _extends(defaults, initialized.defaults);\n });\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return;\n\n // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);\n // Support for new CustomEvent feature\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar _excluded = [\"evt\"];\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, _excluded);\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread2({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\n ghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n\n _silent = false,\n savedInputChecked = [];\n\n/** @const */\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\n supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return;\n // false when <= IE11\n if (IE11OrLess) {\n return false;\n }\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n }(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n },\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n },\n /**\r\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\r\n * @param {Number} x X position\r\n * @param {Number} y Y position\r\n * @return {HTMLElement} Element of the first found nearest Sortable\r\n */\n _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n var threshold = sortable[expando].options.emptyInsertThreshold;\n if (!threshold || lastChild(sortable)) return;\n var rect = getRect(sortable),\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n if (insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n },\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n var group = {};\n var originalGroup = options.group;\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n },\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n },\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n };\n\n// #1184 fix - Prevent click event on fallback if dragged but item not changed position\nif (documentExists && !ChromeForAndroid) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n if (nearest) {\n // Create imitation event\n var event = {};\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n nearest[expando]._onDragOver(event);\n }\n }\n};\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n\n/**\r\n * @class Sortable\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n this.el = el; // root element\n this.options = options = _extends({}, options);\n\n // Export instance\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults);\n\n // Set default options\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n _prepareGroup(options);\n\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n // Setup drag mode\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n }\n\n // Bind events\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n sortables.push(this.el);\n\n // Restore sorting\n options.store && options.store.get && this.sort(options.store.get(this) || []);\n\n // Add animation state manager\n _extends(this, AnimationStateManager());\n}\nSortable.prototype = /** @lends Sortable.prototype */{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {\n if (!evt.cancelable) return;\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n _saveInputCheckedState(el);\n\n // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n if (dragEl) {\n return;\n }\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n }\n\n // cancel dnd if original target is content editable\n if (originalTarget.isContentEditable) {\n return;\n }\n\n // Safari ignores further event handling after mousedown\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n target = closest(target, options.draggable, el, false);\n if (target && target.animated) {\n return;\n }\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n }\n\n // Get the index of the dragged element within its parent\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable);\n\n // Check filter\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n if (filter) {\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n }\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n }\n\n // Prepare `dragstart`\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n if (Sortable.eventCanceled) {\n _this._onDrop();\n return;\n }\n // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n _this._disableDelayedDragEvents();\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n }\n\n // Bind the events: dragstart/dragend\n _this._triggerDragStart(evt, touch);\n\n // Drag start event\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n });\n\n // Chosen item\n toggleClass(dragEl, options.chosenClass, true);\n };\n\n // Disable \"draggable\"\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop);\n\n // Make dragEl draggable (must be before delay for FireFox)\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n pluginEvent('delayStart', this, {\n evt: evt\n });\n\n // Delay is impossible for native DnD in Edge or IE\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n return;\n }\n // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {\n var touch = e.touches ? e.touches[0] : e;\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n try {\n if (document.selection) {\n // Timeout neccessary for IE9\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n awaitingDragStarted = false;\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n var options = this.options;\n\n // Apply effect\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost();\n\n // Drag start event\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n _hideGhostForTarget();\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n target = parent; // store last element\n }\n /* jshint boss:true */ while (parent = parent.parentNode);\n }\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);\n\n // only set the status to dragging, when we are actually dragging\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n this._onDragStart(evt, true);\n }\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options;\n\n // Position absolutely\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl);\n\n // Set transform-origin\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {\n var _this = this;\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n if (Sortable.eventCanceled) {\n this._onDrop();\n return;\n }\n pluginEvent('setupClone', this);\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.removeAttribute(\"id\");\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n this._hideClone();\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n }\n\n // #1143: IFrame support workaround\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n _this._hideClone();\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true);\n\n // Set proper drop events\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n on(document, 'drop', _this);\n\n // #1276 fix:\n css(dragEl, 'transform', 'translateZ(0)');\n }\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver( /**Event*/evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n if (_silent) return;\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread2({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n }\n\n // Capture animation state\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n _this.captureAnimationState();\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n }\n\n // Return invocation when dragEl is inserted (or completed)\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n }\n\n // Animation\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n }\n\n // Null lastTarget if it is not inside a previously swapped element\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n }\n\n // no bubbling and not fallback\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n\n // Do not detect for empty insert if already inserted\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n }\n\n // Call when dragEl has been inserted\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n ignoreNextClick = false;\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n if (revert) {\n parentEl = rootEl; // actualization\n capture();\n this._hideClone();\n dragOverEvent('revert');\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n return completed(true);\n }\n var elLastChild = lastChild(el, options.draggable);\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // Insert to end of list\n\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n }\n\n // if there is a last element, it is the target\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n if (target) {\n targetRect = getRect(target);\n }\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n if (elLastChild && elLastChild.nextSibling) {\n // the last draggable element is not the last node\n el.insertBefore(dragEl, elLastChild.nextSibling);\n } else {\n el.appendChild(dragEl);\n }\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n // Insert to start of list\n var firstChild = getChild(el, 0, options, true);\n if (firstChild === dragEl) {\n return completed(false);\n }\n target = firstChild;\n targetRect = getRect(target);\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n capture();\n el.insertBefore(dragEl, firstChild);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n }\n // If dragEl is already beside target: Do not insert\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n }\n\n // Undo chrome's scroll adjustment (has no effect on other browsers)\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n parentEl = dragEl.parentNode; // actualization\n\n // must be done before animation\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n changed();\n return completed(true);\n }\n }\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop( /**Event*/evt) {\n var el = this.el,\n options = this.options;\n\n // Get the index of the dragged element within its parent\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode;\n\n // Get again after plugin event\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n if (Sortable.eventCanceled) {\n this._nulling();\n return;\n }\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n _cancelNextTick(this.cloneId);\n _cancelNextTick(this._dragStartId);\n\n // Unbind events\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n this._offMoveEvents();\n this._offUpEvents();\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n css(dragEl, 'transform', '');\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n _disableDraggable(dragEl);\n dragEl.style['will-change'] = '';\n\n // Remove classes\n // ghostClass is added in dragStarted\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n toggleClass(dragEl, this.options.chosenClass, false);\n\n // Drag stop event\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n // Remove event\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n });\n\n // drag from one list and drop into another\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n });\n\n // Save sorting\n this.save();\n }\n }\n }\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent( /**Event*/evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n break;\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n _globalDragOver(evt);\n }\n break;\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n /**\r\n * Serializes the item into an array of string.\r\n * @returns {String[]}\r\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n for (; i < n; i++) {\n el = children[i];\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n return order;\n },\n /**\r\n * Sorts the elements according to the array.\r\n * @param {String[]} order order of the items\r\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n /**\r\n * Save the current sorting\r\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n /**\r\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\r\n * @param {HTMLElement} el\r\n * @param {String} [selector] default: `options.draggable`\r\n * @returns {HTMLElement|null}\r\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n /**\r\n * Set/get option\r\n * @param {string} name\r\n * @param {*} [value]\r\n * @returns {*}\r\n */\n option: function option(name, value) {\n var options = this.options;\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n /**\r\n * Destroy\r\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n }\n // Remove draggable attributes\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n this._onDrop();\n this._disableDelayedDragEvents();\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n return;\n }\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return;\n\n // show clone at dragEl or original position\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\nfunction _globalDragOver( /**Event*/evt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n evt.cancelable && evt.preventDefault();\n}\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal;\n // Support for new CustomEvent feature\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n return retVal;\n}\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\nfunction _unsilent() {\n _silent = false;\n}\nfunction _ghostIsFirst(evt, vertical, sortable) {\n var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));\n var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n var spacer = 10;\n return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;\n}\nfunction _ghostIsLast(evt, vertical, sortable) {\n var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n var spacer = 10;\n return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;\n}\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n invert = invert || invertSwap;\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n return 0;\n}\n\n/**\r\n * Gets the direction dragEl must be swapped relative to target in order to make it\r\n * seem that dragEl has been \"inserted\" into that element's position\r\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\r\n * @return {Number} Direction dragEl must be swapped\r\n */\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n\n/**\r\n * Generate id\r\n * @param {HTMLElement} el\r\n * @returns {String}\r\n * @private\r\n */\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n while (i--) {\n sum += str.charCodeAt(i);\n }\n return sum.toString(36);\n}\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n}\n\n// Fixed #973:\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n}\n\n// Export utils\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild\n};\n\n/**\r\n * Get the Sortable instance of an element\r\n * @param {HTMLElement} element The element\r\n * @return {Sortable|undefined} The instance of Sortable\r\n */\nSortable.get = function (element) {\n return element[expando];\n};\n\n/**\r\n * Mount a plugin to Sortable\r\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\r\n */\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n\n/**\r\n * Create sortable instance\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n};\n\n// Export\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n forceAutoScrollFallback: false,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n };\n\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt;\n\n // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback);\n\n // Listener for pointer element change\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval();\n // Detect for pointer elem change, emulating native DnD behaviour\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn;\n\n // New scroll root, set scrollEl\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n var layersOut = 0;\n var currentParent = scrollEl;\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n }\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\nfunction Revert() {}\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n this.sortable.animateAll();\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\nfunction Remove() {}\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\n multiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\n folding = false,\n // Folding any other time\n dragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n if (!sortable.options.avoidImplicitDeselect) {\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n }\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n avoidImplicitDeselect: false,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n dataTransfer.setData('Text', data);\n }\n };\n }\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n sortable._hideClone();\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n });\n\n // Sort multi-drag elements\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n\n sortable.captureAnimationState();\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n }\n\n // Remove all auxiliary multidrag items from el, if sorting enabled\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n initialFolding = false;\n // If leaving sort:false root, or already folding - Fold to new location\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute);\n\n // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n }\n\n // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n activeSortable._showClone(sortable);\n\n // Unfold animation for clones if showing from hidden\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children;\n\n // Multi-drag selection\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n\n // Modifier activated, select from last to dragEl\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvent: evt\n });\n }\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n }\n }\n\n // Multi-drag drop\n if (dragStarted && this.isMultiDrag) {\n folding = false;\n // Do not \"unfold\" after around dragEl if reverted\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect;\n\n // Prepare unfold animation\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n }\n\n // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n multiDragIndex++;\n });\n\n // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n if (update) {\n dispatchSortableEvent('update');\n dispatchSortableEvent('sort');\n }\n }\n }\n\n // Must be done after capturing individual rects (scroll bar)\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n multiDragSortable = toSortable;\n }\n\n // Remove clones if necessary\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return;\n\n // Only deselect if selection is in this sortable\n if (multiDragSortable !== this.sortable) return;\n\n // Only deselect if target is not item in this sortable\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return;\n\n // Only deselect if left click\n if (evt && evt.button !== 0) return;\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvent: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\r\n * Selects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be selected\r\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n multiDragSortable = sortable;\n }\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n /**\r\n * Deselects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be deselected\r\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n });\n\n // multiDragElements will already be sorted if folding\n var newIndex;\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n return key;\n }\n }\n });\n}\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n\n/**\r\n * Insert multi-drag clones\r\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\r\n * @param {HTMLElement} rootEl\r\n */\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nSortable.mount(new SwapPlugin());\nSortable.mount(new MultiDragPlugin());\n\nexport default Sortable;\n", "import { Controller } from \"@hotwired/stimulus\";\nimport Sortable from \"sortablejs/modular/sortable.complete.esm.js\";\n\n// Connects to data-controller=\"matching-preference-step--mba-placement\"\nexport default class extends Controller {\n static targets = [\n \"rankSelectionList\",\n ];\n\n connect () {\n const hiddenLocationField = document.getElementById(\"matching_preference_location_rank\");\n\n // Initialize sorting functionality with options on controller connect\n Sortable.create(\n document.getElementById(\"rankSelectionList\"),\n {\n animation: 150,\n dragClass: [\"bg-gray-500\"],\n chosenClass: [\"bg-gray-500\"],\n // Below is a lifesycle callback exposed by the sortable class that fires when sorting is changed, we'll do three things here:\n // 1. We're going to grab the list\n // 2. Set our hidden field in the form to that list of the text content of each location (city and state)\n // 3. Set the localStorage variable to the list of DOM generated ID's that we use to match to each choice\n onUpdate: function (evt) {\n const generatedRankedListChildNodes = Array.from(evt.target.childNodes);\n hiddenLocationField.setAttribute(\"value\", generatedRankedListChildNodes.map((node) => node.textContent).join(\"_\"));\n localStorage.setItem(\"rankedList\", generatedRankedListChildNodes.map((node) => node.id).toString());\n },\n },\n );\n\n const isSameCandidate = window.location.pathname.split(\"/\")[2] == localStorage.getItem(\"cpsId\"); // eslint-disable-line\n\n if (!isSameCandidate) {\n localStorage.setItem(\"cpsId\", window.location.pathname.split(\"/\")[2]);\n localStorage.setItem(\"rankedList\", null);\n }\n\n // When we navigate back to the matching preference page, we want to reconstruct the rankedList within the DOM based on the choices in localStorage\n if (localStorage.getItem(\"cpsId\") == null) { // eslint-disable-line\n localStorage.setItem(\"cpsId\", window.location.pathname.split(\"/\")[2]);\n }\n\n if (localStorage.getItem(\"rankedList\") != \"\" && localStorage.getItem(\"rankedList\") !== \"null\" && isSameCandidate ) { // eslint-disable-line\n\n const parsedStoredRankedList = localStorage.getItem(\"rankedList\").split(\",\");\n const rankSelectionList = document.getElementById(\"rankSelectionList\");\n\n // Iterate over each id within the parsed localstorage variable and reconstruct the list within the DOM\n parsedStoredRankedList.forEach((val) => {\n const span = document.createElement(\"span\");\n\n // Next 3 lines are so that we can go outside of the list, target the input that has the corresponding id, and check it in the UI\n const inputChoiceId = val.replace(\"span_\", \"\");\n const inputEl = document.getElementById(inputChoiceId);\n inputEl.checked = true;\n\n // Construct the span element to add to the ranked list and add it\n span.append(\n this.generateHandleSVG(),\n document.createTextNode(inputEl.nextSibling.textContent),\n );\n span.classList.add(\"px-2\", \"py-1\", \"bg-gray-200\", \"rounded-md\", \"inline-block\", \"cursor-move\", \"flex\", \"items-center\");\n span.setAttribute(\"id\", `${val}`);\n\n rankSelectionList.appendChild(span);\n });\n\n // Once we've constructed and appended all locations to the ranked list, we refresh the value of the hidden field in the form to make sure it's up to date\n hiddenLocationField.setAttribute(\"value\", Array.from(rankSelectionList.childNodes).map((node) => node.textContent).join(\"_\"));\n }\n\n localStorage.setItem(\"cpsId\", window.location.pathname.split(\"/\")[2]);\n }\n\n placeInRankSelectionList (e) {\n const rankSelectionList = document.getElementById(\"rankSelectionList\");\n const hiddenLocationField = document.getElementById(\"matching_preference_location_rank\");\n\n // This is the list on the client side that is generated on each select/deselect\n // We'll use this variable to keep up with whats in the rankSelectionList\n let generatedRankedList = Array.from(rankSelectionList.childNodes).map((node) => node.id);\n\n // We add the chosen location to the list when its clicked and if we haven't hit the max allowed chocies yet\n if (e.target.checked) {\n // Construct the span element to be added to the list\n const span = document.createElement(\"span\");\n span.append(\n this.generateHandleSVG(),\n document.createTextNode(e.target.nextSibling.textContent),\n );\n span.classList.add(\"px-2\", \"py-1\", \"bg-gray-200\", \"rounded-md\", \"inline-block\", \"cursor-move\", \"flex\", \"items-center\");\n span.setAttribute(\"id\", `span_${e.target.id}`);\n\n // Append the generated span to the rankSelection div\n rankSelectionList.appendChild(span);\n\n // Because we add a new span to the list, we need to reset the generatedRankedList in the middle of this process to:\n // 1. Check the limit and stop the ability to add new locations after 5 choices are made\n // 2. Set the hidden location field with the most up to date list of 5 choices for form submission\n generatedRankedList = Array.from(rankSelectionList.childNodes).map((node) => node.id);\n\n if (generatedRankedList.length > 5) {\n e.target.checked = false;\n rankSelectionList.removeChild(span);\n return alert(\"Only 5 locations can be chosen!\");\n }\n\n // Add that choice to the hidden field value above the rankSelection div\n hiddenLocationField.setAttribute(\"value\", Array.from(rankSelectionList.childNodes).map((node) => node.textContent).join(\"_\"));\n localStorage.setItem(\"rankedList\", generatedRankedList.toString());\n } else if (!e.target.checked) {\n // When a choice in unchecked, we'll want to:\n // 1. Grab the element in the sorted list\n // 2. Remove that element from the list\n // 3. Get an updated list of the rank selection with the choice now removed\n // 4. and 5. Update both the localStorage variable and the hiddenfield within the form to the updated ranked list\n const spanToRemove = document.getElementById(`span_${e.target.id}`);\n rankSelectionList.removeChild(spanToRemove);\n const generatedListChildNodes = Array.from(rankSelectionList.childNodes);\n hiddenLocationField.setAttribute(\"value\", generatedListChildNodes.map((node) => node.textContent).join(\"_\"));\n localStorage.setItem(\"rankedList\", generatedListChildNodes.map((node) => node.id));\n }\n }\n\n // Here we're programmatically building the SVG that goes on the left of the location within the span that gets generated and added to the rank selection list\n generateHandleSVG () {\n const svg = document.createElement(\"sl-icon\");\n svg.setAttribute(\"name\", \"bars-3\");\n svg.classList.add(\"mr-1\");\n\n return svg;\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"opening-candidates-state-filter\"\nexport default class extends Controller {\n static targets = [\n \"currentStatus\",\n \"reviewDropdown\",\n ];\n\n allActiveStates = \"awaiting_video_interview reviewing_video_interview first_interview final_interview awaiting_offer_confirmation offer_accepted awaiting_onboarding_completion\";\n\n connect () {\n this.resetAllFilters();\n const reviewButton = document.getElementById(\"reviewButton\");\n\n if (this.currentStatusTarget.value !== null && this.currentStatusTarget.value !== \"\" && reviewButton) {\n if (this.currentStatusTarget.value === this.allActiveStates) {\n this.setActiveStateContext(\"all\");\n } else {\n this.setActiveStateContext(this.currentStatusTarget.value);\n }\n } else {\n if (reviewButton) {\n this.setActiveStateContext(\"all\");\n }\n }\n\n const dropdownEl = document.getElementById(\"reviewButtonDropdown\");\n if (dropdownEl !== null) {\n document.addEventListener(\"click\", event => {\n const isReviewDropdownButtonClicked = dropdownEl.contains(event.target);\n\n if (!isReviewDropdownButtonClicked) {\n this.reviewDropdownTarget.hidden = true;\n }\n });\n }\n }\n\n toggleReviewDropdown () {\n this.reviewDropdownTarget.hidden === true ? this.reviewDropdownTarget.hidden = false : this.reviewDropdownTarget.hidden = true;\n }\n\n resetAllFilters () {\n document.getElementById(\"query\").value = \"\";\n document.getElementById(\"awaiting_video_interview\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"reviewing_video_interview\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"first_interview\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"final_interview\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"awaiting_offer_confirmation\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"offer_accepted\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"awaiting_onboarding_completion\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"rejected on_deck withdrawn offer_declined\").classList.remove([\"border-blue-600\"]);\n document.getElementById(\"all\").classList.remove([\"border-blue-600\"]);\n if (document.getElementById(\"on_deck\")) {\n document.getElementById(\"on_deck\").classList.remove([\"border-blue-600\"]);\n }\n }\n\n setActiveStateContext (id) {\n document.getElementById(id).classList.add(\"border-blue-600\");\n localStorage.setItem(\"candidateFilter\", id);\n\n this.updateReviewButtonText();\n\n if ([\"awaiting_onboarding_completion\", \"rejected on_deck withdrawn offer_declined\", \"all\", \"on_deck\"].includes(id)) {\n document.getElementById(\"reviewButton\").classList.add(\"rounded-r-full\");\n document.getElementById(\"reviewButtonDropdown\").classList.add(\"hidden\");\n } else {\n document.getElementById(\"reviewButton\").classList.remove(\"rounded-r-full\");\n document.getElementById(\"reviewButtonDropdown\").classList.remove(\"hidden\");\n }\n }\n\n activateCard (e) {\n let idToActivate;\n switch (e.target.nodeName) {\n case \"BUTTON\":\n idToActivate = e.target.id;\n break;\n case \"SPAN\":\n idToActivate = e.target.parentNode.id;\n break;\n default:\n break;\n }\n\n this.resetAllFilters();\n\n if (document.getElementById(\"reviewButton\")) {\n this.setActiveStateContext(idToActivate);\n }\n }\n\n clearFilter () {\n this.resetAllFilters();\n }\n\n beginReview () {\n const checkedCandidates = Array.from(document.querySelectorAll(\".select_candidates:checked\"));\n const candidates = checkedCandidates.length > 0 ? checkedCandidates : Array.from(document.querySelectorAll(\".candidate-profile-row\"));\n\n localStorage.setItem(\"manualSelect\", checkedCandidates.length > 0);\n const ids = candidates.map(function (el) {\n return el.getAttribute(\"data-candidate-id\");\n });\n\n if (ids.length === 0) {\n alert(\"Please select at least one candidate to review\");\n this.clearLocalFilters();\n return;\n }\n\n localStorage.setItem(\"candidateIds\", ids);\n localStorage.setItem(\"openingId\", window.location.href.split(\"/\")[5]);\n\n if (localStorage.getItem(\"candidateFilter\") && ids.length >= 1) {\n window.location.href = `${window.location.origin}/admin/submissions/${ids[0]}`;\n }\n }\n\n bulkAdvance () {\n const ids = this.getBulkActionCandidateIds();\n\n if (ids.length === 0) {\n alert(\"Please select at least one candidate to advance\");\n this.clearLocalFilters();\n return;\n }\n\n document.getElementById(\"bulkAdvanceCandidateIds\").value = ids;\n }\n\n bulkArchive (e) {\n const ids = this.getBulkActionCandidateIds();\n\n if (ids.length === 0) {\n alert(\"Please select at least one candidate to archive\");\n this.clearLocalFilters();\n return;\n }\n\n const archiveEvent = e.target.innerText;\n\n switch (archiveEvent) {\n case \"Reject\":\n document.getElementById(\"bulkRejectCandidateIds\").value = ids;\n break;\n case \"Withdraw\":\n document.getElementById(\"bulkWithdrawCandidateIds\").value = ids;\n break;\n case \"Place on deck\":\n document.getElementById(\"bulkPlaceOnDeckCandidateIds\").value = ids;\n break;\n }\n }\n\n getBulkActionCandidateIds () {\n this.toggleReviewDropdown();\n const checkedCandidates = Array.from(document.querySelectorAll(\".select_candidates:checked\"));\n\n const ids = checkedCandidates.map(function (el) {\n return el.getAttribute(\"data-candidate-id\");\n });\n\n return ids;\n }\n\n checkAll (e) {\n const checkboxes = document.querySelectorAll(\".select_candidates\");\n const checked = e.target.checked;\n checkboxes.forEach((c) => { c.checked = checked; });\n this.updateReviewButtonText();\n }\n\n checkCandidate () {\n const checkedCandidates = document.querySelectorAll(\".select_candidates:checked\");\n const allChecked = checkedCandidates.length === document.querySelectorAll(\".select_candidates\").length;\n document.querySelector(\".selectall-checkbox\").checked = allChecked;\n this.updateReviewButtonText();\n }\n\n updateReviewButtonText () {\n const filter = localStorage.getItem(\"candidateFilter\");\n const checked = document.querySelectorAll(\".select_candidates:checked\").length;\n\n let reviewString = \"\";\n if (checked > 0) {\n reviewString = \"Review selected\";\n } else if (filter === \"all\") {\n reviewString = \"Review all\";\n } else {\n reviewString = \"Review status\";\n }\n\n document.getElementById(\"reviewButton\").innerText = reviewString;\n }\n\n clearLocalFilters () {\n localStorage.setItem(\"candidateFilter\", null);\n localStorage.setItem(\"candidateIds\", null);\n localStorage.setItem(\"openingId\", null);\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"read-more\"\nexport default class extends Controller {\n toggle (e) {\n const textId = e.target.id.replace(\"read_\", \"\");\n if (e.target.innerHTML === \"Show more\") {\n document.getElementById(\"text_\".concat(textId)).classList.remove(\"line-clamp-3\");\n e.target.innerHTML = \"Show less\";\n } else {\n document.getElementById(\"text_\".concat(textId)).classList.add(\"line-clamp-3\");\n e.target.innerHTML = \"Show more\";\n }\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"review-candidates-controller\"\nexport default class extends Controller {\n currentCandidateId;\n reviewIndex;\n\n connect () {\n if (localStorage.getItem(\"candidateIds\")) {\n const candidateIds = localStorage.getItem(\"candidateIds\").split(\",\");\n this.currentCandidateId = window.location.href.split(\"/\")[6];\n this.reviewIndex = candidateIds.indexOf(this.currentCandidateId);\n\n if (candidateIds.includes(this.currentCandidateId)) {\n document.getElementById(\"reviewNavbar\").classList.remove(\"hidden\");\n }\n\n if ((candidateIds.length - 1) <= this.reviewIndex) {\n document.getElementById(\"rightReviewLink\").classList.add(\"hidden\");\n }\n\n if ((this.reviewIndex === 0)) {\n document.getElementById(\"leftReviewLink\").classList.add(\"hidden\");\n }\n\n if (document.getElementById(\"reviewCounter\")) {\n document.getElementById(\"reviewCounter\").innerHTML = `${this.reviewIndex + 1} of ${candidateIds.length}`;\n }\n }\n\n if (localStorage.getItem(\"candidateFilter\")) {\n let humanizedFilter = localStorage.getItem(\"manualSelect\") === \"true\"\n ? this.humanizeSelection(localStorage.getItem(\"candidateIds\").split(\",\").length)\n : this.humanizeFilter(localStorage.getItem(\"candidateFilter\"));\n\n switch (humanizedFilter) {\n case \"Reviewing video interview\":\n humanizedFilter = \"Video Interview Completed\";\n break;\n case \"Awaiting offer confirmation\":\n humanizedFilter = \"Offer extended\";\n break;\n case \"Awaiting onboarding completion\":\n humanizedFilter = \"Hired\";\n break;\n case \"Rejected on deck withdrawn offer declined\":\n humanizedFilter = \"Archive\";\n break;\n default:\n break;\n }\n\n document.getElementById(\"nowViewing\").innerHTML = `Now Viewing: ${humanizedFilter}`;\n }\n }\n\n humanizeSelection (count) {\n return count === 1 ? \"1 Selected Candidate\" : `${count} Selected Candidates`;\n }\n\n humanizeFilter (filter) {\n return filter.replace(/_/g, \" \")\n .trim()\n .replace(/\\b[A-Z][a-z]+\\b/g, function (word) {\n return word.toLowerCase();\n })\n .replace(/^[a-z]/g, function (first) {\n return first.toUpperCase();\n });\n }\n\n exitReview () {\n const openingId = localStorage.getItem(\"openingId\");\n this.clearLocalFilters();\n window.location.href = `${window.location.origin}/admin/openings/${openingId}`;\n }\n\n navigateRight () {\n const candidateIds = localStorage.getItem(\"candidateIds\").split(\",\");\n window.location.href = `${window.location.origin}/admin/submissions/${candidateIds[this.reviewIndex + 1]}`;\n }\n\n navigateLeft () {\n const candidateIds = localStorage.getItem(\"candidateIds\").split(\",\");\n const index = parseInt(localStorage.getItem(\"reviewIndex\"));\n\n localStorage.setItem(\"reviewIndex\", index - 1);\n window.location.href = `${window.location.origin}/admin/submissions/${candidateIds[this.reviewIndex - 1]}`;\n }\n\n clearLocalFilters () {\n localStorage.setItem(\"candidateFilter\", null);\n localStorage.setItem(\"candidateIds\", null);\n localStorage.setItem(\"openingId\", null);\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"search-form\"\nexport default class extends Controller {\n static targets = [\"form\"];\n\n search () {\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => {\n this.formTarget.requestSubmit();\n }, 200);\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"submission-log\"\nexport default class extends Controller {\n openEvaluationDetail (e) {\n e.target.classList.add(\"hidden\");\n const dropdownID = e.target.id.replace(\"open_\", \"\");\n document.getElementById(dropdownID).classList.remove(\"hidden\");\n document.getElementById(\"close_\" + dropdownID).classList.remove(\"hidden\");\n }\n\n closeEvaluationDetail (e) {\n e.target.classList.add(\"hidden\");\n const dropdownID = e.target.id.replace(\"close_\", \"\");\n document.getElementById(dropdownID).classList.add(\"hidden\");\n document.getElementById(\"open_\" + dropdownID).classList.remove(\"hidden\");\n }\n\n closeFromInsideEvaluationDetail (e) {\n const dropdownID = e.target.id.replace(\"closeInside_\", \"\");\n document.getElementById(dropdownID).classList.add(\"hidden\");\n document.getElementById(\"open_\" + dropdownID).classList.remove(\"hidden\");\n document.getElementById(\"close_\" + dropdownID).classList.add(\"hidden\");\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"submission-view\"\nexport default class extends Controller {\n static targets = [\n \"advanceButton\",\n \"advanceOption\",\n \"revertButton\",\n \"revertOption\",\n \"rejectButton\",\n \"rejectOption\",\n \"withdrawButton\",\n \"withdrawOption\",\n \"onDeckButton\",\n \"onDeckOption\",\n \"reassignButton\",\n \"reassignOption\",\n ];\n\n static values = { state: String, previousState: String };\n\n disableFields () {\n if (this.previousStateValue === \"\" || this.previousStateValue === \"awaiting_application\") {\n this.revertButtonTarget.setAttribute(\"disabled\", \"\");\n this.revertOptionTarget.setAttribute(\"disabled\", \"\");\n }\n\n switch (this.stateValue) {\n case \"awaiting_video_interview\":\n this.revertButtonTarget.setAttribute(\"disabled\", \"\");\n this.revertOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"reviewing_video_interview\":\n break;\n case \"first_interview\":\n break;\n case \"final_interview\":\n break;\n case \"awaiting_offer_confirmation\":\n this.rejectButtonTarget.setAttribute(\"disabled\", \"\");\n this.rejectOptionTarget.setAttribute(\"disabled\", \"\");\n this.withdrawButtonTarget.setAttribute(\"disabled\", \"\");\n this.withdrawOptionTarget.setAttribute(\"disabled\", \"\");\n this.reassignButtonTarget.setAttribute(\"disabled\", \"\");\n this.reassignOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"awaiting_onboarding_completion\":\n this.advanceButtonTarget.setAttribute(\"disabled\", \"\");\n this.advanceOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"onboarding_completed\":\n this.advanceButtonTarget.setAttribute(\"disabled\", \"\");\n this.advanceOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"offer_accepted\":\n break;\n case \"on_deck\":\n this.advanceButtonTarget.setAttribute(\"disabled\", \"\");\n this.advanceOptionTarget.setAttribute(\"disabled\", \"\");\n this.onDeckButtonTarget.setAttribute(\"disabled\", \"\");\n this.onDeckOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"rejected\":\n this.advanceButtonTarget.setAttribute(\"disabled\", \"\");\n this.advanceOptionTarget.setAttribute(\"disabled\", \"\");\n this.rejectButtonTarget.setAttribute(\"disabled\", \"\");\n this.rejectOptionTarget.setAttribute(\"disabled\", \"\");\n this.withdrawButtonTarget.setAttribute(\"disabled\", \"\");\n this.withdrawOptionTarget.setAttribute(\"disabled\", \"\");\n this.onDeckButtonTarget.setAttribute(\"disabled\", \"\");\n this.onDeckOptionTarget.setAttribute(\"disabled\", \"\");\n this.reassignButtonTarget.setAttribute(\"disabled\", \"\");\n this.reassignOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"withdrawn\":\n this.advanceButtonTarget.setAttribute(\"disabled\", \"\");\n this.advanceOptionTarget.setAttribute(\"disabled\", \"\");\n this.rejectButtonTarget.setAttribute(\"disabled\", \"\");\n this.rejectOptionTarget.setAttribute(\"disabled\", \"\");\n this.withdrawButtonTarget.setAttribute(\"disabled\", \"\");\n this.withdrawOptionTarget.setAttribute(\"disabled\", \"\");\n this.onDeckButtonTarget.setAttribute(\"disabled\", \"\");\n this.onDeckOptionTarget.setAttribute(\"disabled\", \"\");\n this.reassignButtonTarget.setAttribute(\"disabled\", \"\");\n this.reassignOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n case \"offer_declined\":\n this.advanceButtonTarget.setAttribute(\"disabled\", \"\");\n this.advanceOptionTarget.setAttribute(\"disabled\", \"\");\n this.rejectButtonTarget.setAttribute(\"disabled\", \"\");\n this.rejectOptionTarget.setAttribute(\"disabled\", \"\");\n this.withdrawButtonTarget.setAttribute(\"disabled\", \"\");\n this.withdrawOptionTarget.setAttribute(\"disabled\", \"\");\n this.reassignButtonTarget.setAttribute(\"disabled\", \"\");\n this.reassignOptionTarget.setAttribute(\"disabled\", \"\");\n break;\n default:\n break;\n }\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"turbo-modal\"\nexport default class extends Controller {\n hideModal () {\n this.element.parentElement.removeAttribute(\"src\"); // it might be nice to also remove the modal SRC\n this.element.remove();\n }\n\n refreshPage () {\n location.reload();\n }\n\n // Hide modal on successful form submission\n // Action: \"turbo:submit-end->turbo-modal#submitEnd\"\n submitEnd (e) {\n if (e.detail.success) {\n this.hideModal();\n }\n }\n\n transition () {\n document.getElementsByClassName(\"candidate_profile_submission\")[0].submit();\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"type-to-confirm\"\nexport default class extends Controller {\n static targets = [\"confirmationInput\", \"confirmationValue\", \"confirmButton\"];\n\n checkConfirmationInput () {\n if (this.confirmationInputTarget.value === this.confirmationValueTarget.value) {\n this.confirmButtonTarget.disabled = false;\n } else {\n this.confirmButtonTarget.disabled = true;\n }\n }\n}\n", "\n import * as module0 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/administrative_info_step_controller.js';import * as module1 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/archive_modal_controller.js';import * as module2 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_note_controller.js';import * as module3 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_note_new_controller.js';import * as module4 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_score_controller.js';import * as module5 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_step_controller.js';import * as module6 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/click_to_copy_button_controller.js';import * as module7 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/clickable_dashboard_table_row_controller.js';import * as module8 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/essays_step_controller.js';import * as module9 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/hidden_field_controller.js';import * as module10 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/kebab_dropdown_controller.js';import * as module11 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/matching_preference_step/deferred_year_placement_controller.js';import * as module12 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/matching_preference_step/immediate_placement_controller.js';import * as module13 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/matching_preference_step/mba_placement_controller.js';import * as module14 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/opening_candidates_state_filter_controller.js';import * as module15 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/read_more_controller.js';import * as module16 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/review_candidates_controller.js';import * as module17 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/search_form_controller.js';import * as module18 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/submission_log_controller.js';import * as module19 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/submission_view_controller.js';import * as module20 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/turbo_modal_controller.js';import * as module21 from '/tmp/build_055c2b3e/app/frontend/javascript/controllers/type_to_confirm_controller.js'\n\n const modules = [module0,module1,module2,module3,module4,module5,module6,module7,module8,module9,module10,module11,module12,module13,module14,module15,module16,module17,module18,module19,module20,module21];\n\n export default modules;\n export const filenames = ['/tmp/build_055c2b3e/app/frontend/javascript/controllers/administrative_info_step_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/archive_modal_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_note_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_note_new_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_score_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/candidate_profile_step_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/click_to_copy_button_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/clickable_dashboard_table_row_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/essays_step_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/hidden_field_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/kebab_dropdown_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/matching_preference_step/deferred_year_placement_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/matching_preference_step/immediate_placement_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/matching_preference_step/mba_placement_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/opening_candidates_state_filter_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/read_more_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/review_candidates_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/search_form_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/submission_log_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/submission_view_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/turbo_modal_controller.js','/tmp/build_055c2b3e/app/frontend/javascript/controllers/type_to_confirm_controller.js']\n ", "\n \n\n const modules = [];\n\n export default modules;\n export const filenames = []\n ", "\n \n\n const modules = [];\n\n export default modules;\n export const filenames = []\n ", "(function (prototype) {\n if (typeof prototype.requestSubmit === \"function\") return;\n\n prototype.requestSubmit = function (submitter) {\n if (submitter) {\n validateSubmitter(submitter, this);\n submitter.click();\n } else {\n submitter = document.createElement(\"input\");\n submitter.type = \"submit\";\n submitter.hidden = true;\n this.appendChild(submitter);\n submitter.click();\n this.removeChild(submitter);\n }\n };\n\n function validateSubmitter (submitter, form) {\n submitter instanceof HTMLElement || raise(TypeError, \"parameter 1 is not of type 'HTMLElement'\");\n submitter.type === \"submit\" || raise(TypeError, \"The specified element is not a submit button\");\n submitter.form === form || raise(DOMException, \"The specified element is not owned by this form element\", \"NotFoundError\");\n }\n\n function raise (ErrorConstructor, message, name) {\n throw new ErrorConstructor(\"Failed to execute 'requestSubmit' on 'HTMLFormElement': \" + message + \".\", name);\n }\n})(HTMLFormElement.prototype);\n", "var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __knownSymbol = (name, symbol) => {\n return (symbol = Symbol[name]) ? symbol : Symbol.for(\"Symbol.\" + name);\n};\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nvar __decorateClass = (decorators, target, key, kind) => {\n var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;\n for (var i = decorators.length - 1, decorator; i >= 0; i--)\n if (decorator = decorators[i])\n result = (kind ? decorator(target, key, result) : decorator(result)) || result;\n if (kind && result)\n __defProp(target, key, result);\n return result;\n};\nvar __await = function(promise, isYieldStar) {\n this[0] = promise;\n this[1] = isYieldStar;\n};\nvar __yieldStar = (value) => {\n var obj = value[__knownSymbol(\"asyncIterator\")];\n var isAwait = false;\n var method;\n var it = {};\n if (obj == null) {\n obj = value[__knownSymbol(\"iterator\")]();\n method = (k) => it[k] = (x) => obj[k](x);\n } else {\n obj = obj.call(value);\n method = (k) => it[k] = (v) => {\n if (isAwait) {\n isAwait = false;\n if (k === \"throw\")\n throw v;\n return v;\n }\n isAwait = true;\n return {\n done: false,\n value: new __await(new Promise((resolve) => {\n var x = obj[k](v);\n if (!(x instanceof Object))\n throw TypeError(\"Object expected\");\n resolve(x);\n }), 1)\n };\n };\n }\n return it[__knownSymbol(\"iterator\")] = () => it, method(\"next\"), \"throw\" in obj ? method(\"throw\") : it.throw = (x) => {\n throw x;\n }, \"return\" in obj && method(\"return\"), it;\n};\n\nexport {\n __spreadValues,\n __spreadProps,\n __decorateClass,\n __yieldStar\n};\n", "import {\n __spreadProps,\n __spreadValues\n} from \"./chunk.IFDWM6P4.js\";\n\n// src/internal/form.ts\nvar formCollections = /* @__PURE__ */ new WeakMap();\nvar reportValidityOverloads = /* @__PURE__ */ new WeakMap();\nvar checkValidityOverloads = /* @__PURE__ */ new WeakMap();\nvar userInteractedControls = /* @__PURE__ */ new WeakSet();\nvar interactions = /* @__PURE__ */ new WeakMap();\nvar FormControlController = class {\n constructor(host, options) {\n this.handleFormData = (event) => {\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n const isButton = this.host.tagName.toLowerCase() === \"sl-button\";\n if (this.host.isConnected && !disabled && !isButton && typeof name === \"string\" && name.length > 0 && typeof value !== \"undefined\") {\n if (Array.isArray(value)) {\n value.forEach((val) => {\n event.formData.append(name, val.toString());\n });\n } else {\n event.formData.append(name, value.toString());\n }\n }\n };\n this.handleFormSubmit = (event) => {\n var _a;\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n if (this.form && !this.form.noValidate) {\n (_a = formCollections.get(this.form)) == null ? void 0 : _a.forEach((control) => {\n this.setUserInteracted(control, true);\n });\n }\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n this.handleFormReset = () => {\n this.options.setValue(this.host, this.options.defaultValue(this.host));\n this.setUserInteracted(this.host, false);\n interactions.set(this.host, []);\n };\n this.handleInteraction = (event) => {\n const emittedEvents = interactions.get(this.host);\n if (!emittedEvents.includes(event.type)) {\n emittedEvents.push(event.type);\n }\n if (emittedEvents.length === this.options.assumeInteractionOn.length) {\n this.setUserInteracted(this.host, true);\n }\n };\n this.checkFormValidity = () => {\n if (this.form && !this.form.noValidate) {\n const elements = this.form.querySelectorAll(\"*\");\n for (const element of elements) {\n if (typeof element.checkValidity === \"function\") {\n if (!element.checkValidity()) {\n return false;\n }\n }\n }\n }\n return true;\n };\n this.reportFormValidity = () => {\n if (this.form && !this.form.noValidate) {\n const elements = this.form.querySelectorAll(\"*\");\n for (const element of elements) {\n if (typeof element.reportValidity === \"function\") {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n return true;\n };\n (this.host = host).addController(this);\n this.options = __spreadValues({\n form: (input) => {\n const formId = input.form;\n if (formId) {\n const root = input.getRootNode();\n const form = root.getElementById(formId);\n if (form) {\n return form;\n }\n }\n return input.closest(\"form\");\n },\n name: (input) => input.name,\n value: (input) => input.value,\n defaultValue: (input) => input.defaultValue,\n disabled: (input) => {\n var _a;\n return (_a = input.disabled) != null ? _a : false;\n },\n reportValidity: (input) => typeof input.reportValidity === \"function\" ? input.reportValidity() : true,\n checkValidity: (input) => typeof input.checkValidity === \"function\" ? input.checkValidity() : true,\n setValue: (input, value) => input.value = value,\n assumeInteractionOn: [\"sl-input\"]\n }, options);\n }\n hostConnected() {\n const form = this.options.form(this.host);\n if (form) {\n this.attachForm(form);\n }\n interactions.set(this.host, []);\n this.options.assumeInteractionOn.forEach((event) => {\n this.host.addEventListener(event, this.handleInteraction);\n });\n }\n hostDisconnected() {\n this.detachForm();\n interactions.delete(this.host);\n this.options.assumeInteractionOn.forEach((event) => {\n this.host.removeEventListener(event, this.handleInteraction);\n });\n }\n hostUpdated() {\n const form = this.options.form(this.host);\n if (!form) {\n this.detachForm();\n }\n if (form && this.form !== form) {\n this.detachForm();\n this.attachForm(form);\n }\n if (this.host.hasUpdated) {\n this.setValidity(this.host.validity.valid);\n }\n }\n attachForm(form) {\n if (form) {\n this.form = form;\n if (formCollections.has(this.form)) {\n formCollections.get(this.form).add(this.host);\n } else {\n formCollections.set(this.form, /* @__PURE__ */ new Set([this.host]));\n }\n this.form.addEventListener(\"formdata\", this.handleFormData);\n this.form.addEventListener(\"submit\", this.handleFormSubmit);\n this.form.addEventListener(\"reset\", this.handleFormReset);\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n if (!checkValidityOverloads.has(this.form)) {\n checkValidityOverloads.set(this.form, this.form.checkValidity);\n this.form.checkValidity = () => this.checkFormValidity();\n }\n } else {\n this.form = void 0;\n }\n }\n detachForm() {\n if (!this.form)\n return;\n const formCollection = formCollections.get(this.form);\n if (!formCollection) {\n return;\n }\n formCollection.delete(this.host);\n if (formCollection.size <= 0) {\n this.form.removeEventListener(\"formdata\", this.handleFormData);\n this.form.removeEventListener(\"submit\", this.handleFormSubmit);\n this.form.removeEventListener(\"reset\", this.handleFormReset);\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form);\n reportValidityOverloads.delete(this.form);\n }\n if (checkValidityOverloads.has(this.form)) {\n this.form.checkValidity = checkValidityOverloads.get(this.form);\n checkValidityOverloads.delete(this.form);\n }\n this.form = void 0;\n }\n }\n setUserInteracted(el, hasInteracted) {\n if (hasInteracted) {\n userInteractedControls.add(el);\n } else {\n userInteractedControls.delete(el);\n }\n el.requestUpdate();\n }\n doAction(type, submitter) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n if (submitter) {\n button.name = submitter.name;\n button.value = submitter.value;\n [\"formaction\", \"formenctype\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach((attr) => {\n if (submitter.hasAttribute(attr)) {\n button.setAttribute(attr, submitter.getAttribute(attr));\n }\n });\n }\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n /** Returns the associated `
` element, if one exists. */\n getForm() {\n var _a;\n return (_a = this.form) != null ? _a : null;\n }\n /** Resets the form, restoring all the control to their default value */\n reset(submitter) {\n this.doAction(\"reset\", submitter);\n }\n /** Submits the form, triggering validation and form data injection. */\n submit(submitter) {\n this.doAction(\"submit\", submitter);\n }\n /**\n * Synchronously sets the form control's validity. Call this when you know the future validity but need to update\n * the host element immediately, i.e. before Lit updates the component in the next update.\n */\n setValidity(isValid) {\n const host = this.host;\n const hasInteracted = Boolean(userInteractedControls.has(host));\n const required = Boolean(host.required);\n host.toggleAttribute(\"data-required\", required);\n host.toggleAttribute(\"data-optional\", !required);\n host.toggleAttribute(\"data-invalid\", !isValid);\n host.toggleAttribute(\"data-valid\", isValid);\n host.toggleAttribute(\"data-user-invalid\", !isValid && hasInteracted);\n host.toggleAttribute(\"data-user-valid\", isValid && hasInteracted);\n }\n /**\n * Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything\n * that affects constraint validation changes so the component receives the correct validity states.\n */\n updateValidity() {\n const host = this.host;\n this.setValidity(host.validity.valid);\n }\n /**\n * Dispatches a non-bubbling, cancelable custom event of type `sl-invalid`.\n * If the `sl-invalid` event will be cancelled then the original `invalid`\n * event (which may have been passed as argument) will also be cancelled.\n * If no original `invalid` event has been passed then the `sl-invalid`\n * event will be cancelled before being dispatched.\n */\n emitInvalidEvent(originalInvalidEvent) {\n const slInvalidEvent = new CustomEvent(\"sl-invalid\", {\n bubbles: false,\n composed: false,\n cancelable: true,\n detail: {}\n });\n if (!originalInvalidEvent) {\n slInvalidEvent.preventDefault();\n }\n if (!this.host.dispatchEvent(slInvalidEvent)) {\n originalInvalidEvent == null ? void 0 : originalInvalidEvent.preventDefault();\n }\n }\n};\nvar validValidityState = Object.freeze({\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: true,\n valueMissing: false\n});\nvar valueMissingValidityState = Object.freeze(__spreadProps(__spreadValues({}, validValidityState), {\n valid: false,\n valueMissing: true\n}));\nvar customErrorValidityState = Object.freeze(__spreadProps(__spreadValues({}, validValidityState), {\n valid: false,\n customError: true\n}));\n\nexport {\n formCollections,\n FormControlController,\n validValidityState,\n valueMissingValidityState,\n customErrorValidityState\n};\n", "/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst NODE_MODE = false;\n\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets: boolean =\n global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\n\n/**\n * A CSSResult or native CSSStyleSheet.\n *\n * In browsers that support constructible CSS style sheets, CSSStyleSheet\n * object can be used for styling along side CSSResult from the `css`\n * template tag.\n */\nexport type CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nexport type CSSResultArray = Array;\n\n/**\n * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those.\n */\nexport type CSSResultGroup = CSSResultOrNative | CSSResultArray;\n\nconst constructionToken = Symbol();\n\nconst cssTagCache = new WeakMap();\n\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nexport class CSSResult {\n // This property needs to remain unminified.\n ['_$cssResult$'] = true;\n readonly cssText: string;\n private _styleSheet?: CSSStyleSheet;\n private _strings: TemplateStringsArray | undefined;\n\n private constructor(\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'\n );\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet | undefined {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(\n this.cssText\n );\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\ntype ConstructableCSSResult = CSSResult & {\n new (\n cssText: string,\n strings: TemplateStringsArray | undefined,\n safeToken: symbol\n ): CSSResult;\n};\n\nconst textFromCSSResult = (value: CSSResultGroup | number) => {\n // This property needs to remain unminified.\n if ((value as CSSResult)['_$cssResult$'] === true) {\n return (value as CSSResult).cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`\n );\n }\n};\n\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) =>\n new (CSSResult as ConstructableCSSResult)(\n typeof value === 'string' ? value : String(value),\n undefined,\n constructionToken\n );\n\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: (CSSResultGroup | number)[]\n): CSSResult => {\n const cssText =\n strings.length === 1\n ? strings[0]\n : values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]\n );\n return new (CSSResult as ConstructableCSSResult)(\n cssText,\n strings,\n constructionToken\n );\n};\n\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nexport const adoptStyles = (\n renderRoot: ShadowRoot,\n styles: Array\n) => {\n if (supportsAdoptingStyleSheets) {\n (renderRoot as ShadowRoot).adoptedStyleSheets = styles.map((s) =>\n s instanceof CSSStyleSheet ? s : s.styleSheet!\n );\n } else {\n for (const s of styles) {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = (global as any)['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = (s as CSSResult).cssText;\n renderRoot.appendChild(style);\n }\n }\n};\n\nconst cssResultFromStyleSheet = (sheet: CSSStyleSheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\n\nexport const getCompatibleStyle =\n supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s: CSSResultOrNative) => s\n : (s: CSSResultOrNative) =>\n s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\nimport {\n getCompatibleStyle,\n adoptStyles,\n CSSResultGroup,\n CSSResultOrNative,\n} from './css-tag.js';\nimport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n// In the Node build, this import will be injected by Rollup:\n// import {HTMLElement, customElements} from '@lit-labs/ssr-dom-shim';\n\nexport * from './css-tag.js';\nexport type {\n ReactiveController,\n ReactiveControllerHost,\n} from './reactive-controller.js';\n\n/**\n * Removes the `readonly` modifier from properties in the union K.\n *\n * This is a safer way to cast a value to a type with a mutable version of a\n * readonly field, than casting to an interface with the field re-declared\n * because it preserves the type of all the fields and warns on typos.\n */\ntype Mutable = Omit & {\n -readonly [P in keyof Pick]: P extends K ? T[P] : never;\n};\n\n// TODO (justinfagnani): Add `hasOwn` here when we ship ES2022\nconst {\n is,\n defineProperty,\n getOwnPropertyDescriptor,\n getOwnPropertyNames,\n getOwnPropertySymbols,\n getPrototypeOf,\n} = Object;\n\nconst NODE_MODE = false;\n\n// Lets a minifier replace globalThis references with a minified name\nconst global = globalThis;\n\nif (NODE_MODE) {\n global.customElements ??= customElements;\n}\n\nconst DEV_MODE = true;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nconst trustedTypes = (global as unknown as {trustedTypes?: {emptyScript: ''}})\n .trustedTypes;\n\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? (trustedTypes.emptyScript as unknown as '')\n : '';\n\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\n\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings: Set = (global.litIssuedWarnings ??=\n new Set());\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning(\n 'polyfill-support-missing',\n `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`\n );\n }\n}\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ReactiveUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry = Update;\n export interface Update {\n kind: 'update';\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: ReactiveUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty =

(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter {\n /**\n * Called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string | null, type?: TypeHint): Type;\n\n /**\n * Called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter =\n | ComplexAttributeConverter\n | ((value: string | null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration {\n /**\n * When set to `true`, indicates the property is internal private state. The\n * property should not be set by users. When using TypeScript, this property\n * should be marked as `private` or `protected`, and it is also a common\n * practice to use a leading `_` in the name. The property is not added to\n * `observedAttributes`.\n */\n readonly state?: boolean;\n\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean | string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n\n /**\n * Whether this property is wrapping accessors. This is set by `@property`\n * to control the initial value change and reflection logic.\n *\n * @internal\n */\n wrapped?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map;\n\ntype AttributeMap = Map;\n\n/**\n * A Map of property keys to values.\n *\n * Takes an optional type parameter T, which when specified as a non-any,\n * non-unknown type, will make the Map more strongly-typed, associating the map\n * keys with their corresponding value type on T.\n *\n * Use `PropertyValues` when overriding ReactiveElement.update() and\n * other lifecycle methods in order to get stronger type-checking on keys\n * and values.\n */\n// This type is conditional so that if the parameter T is not specified, or\n// is `any`, the type will include `Map`. Since T is not\n// given in the uses of PropertyValues in this file, all uses here fallback to\n// meaning `Map`, but if a developer uses\n// `PropertyValues` (or any other value for T) they will get a\n// strongly-typed Map type.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type PropertyValues = T extends object\n ? PropertyValueMap\n : Map;\n\n/**\n * Do not use, instead prefer {@linkcode PropertyValues}.\n */\n// This type must be exported such that JavaScript generated by the Google\n// Closure Compiler can import a type reference.\nexport interface PropertyValueMap extends Map {\n get(k: K): T[K] | undefined;\n set(key: K, value: T[K]): this;\n has(k: K): boolean;\n delete(k: K): boolean;\n}\n\nexport const defaultConverter: ComplexAttributeConverter = {\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n\n fromAttribute(value: string | null, type?: unknown) {\n let fromValue: unknown = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value!) as unknown;\n } catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean =>\n !is(value, old);\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual,\n};\n\n/**\n * A string representing one of the supported dev mode warning categories.\n */\nexport type WarningKind =\n | 'change-in-update'\n | 'migration'\n | 'async-perform-update';\n\nexport type Initializer = (element: ReactiveElement) => void;\n\n// Temporary, until google3 is on TypeScript 5.2\ndeclare global {\n interface SymbolConstructor {\n readonly metadata: unique symbol;\n }\n}\n\n// Ensure metadata is enabled. TypeScript does not polyfill\n// Symbol.metadata, so we must ensure that it exists.\n(Symbol as {metadata: symbol}).metadata ??= Symbol('metadata');\n\ndeclare global {\n // This is public global API, do not change!\n // eslint-disable-next-line no-var\n var litPropertyMetadata: WeakMap<\n object,\n Map\n >;\n}\n\n// Map from a class's metadata object to property options\n// Note that we must use nullish-coalescing assignment so that we only use one\n// map even if we load multiple version of this module.\nglobal.litPropertyMetadata ??= new WeakMap<\n object,\n Map\n>();\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclasses to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class ReactiveElement\n // In the Node build, this `extends` clause will be substituted with\n // `(globalThis.HTMLElement ?? HTMLElement)`.\n //\n // This way, we will first prefer any global `HTMLElement` polyfill that the\n // user has assigned, and then fall back to the `HTMLElement` shim which has\n // been imported (see note at the top of this file about how this import is\n // generated by Rollup). Note that the `HTMLElement` variable has been\n // shadowed by this import, so it no longer refers to the global.\n extends HTMLElement\n implements ReactiveControllerHost\n{\n // Note: these are patched in only in DEV_MODE.\n /**\n * Read or set all the enabled warning categories for this class.\n *\n * This property is only used in development builds.\n *\n * @nocollapse\n * @category dev-mode\n */\n static enabledWarnings?: WarningKind[];\n\n /**\n * Enable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Enable for all ReactiveElement subclasses\n * ReactiveElement.enableWarning?.('migration');\n *\n * // Enable for only MyElement and subclasses\n * MyElement.enableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static enableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Disable the given warning category for this class.\n *\n * This method only exists in development builds, so it should be accessed\n * with a guard like:\n *\n * ```ts\n * // Disable for all ReactiveElement subclasses\n * ReactiveElement.disableWarning?.('migration');\n *\n * // Disable for only MyElement and subclasses\n * MyElement.disableWarning?.('migration');\n * ```\n *\n * @nocollapse\n * @category dev-mode\n */\n static disableWarning?: (warningKind: WarningKind) => void;\n\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer: Initializer) {\n this.__prepare();\n (this._initializers ??= []).push(initializer);\n }\n\n static _initializers?: Initializer[];\n\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n * @nocollapse\n */\n private static __attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having been finalized, which includes creating properties\n * from `static properties`, but does *not* include all properties created\n * from decorators.\n * @nocollapse\n */\n protected static finalized: true | undefined;\n\n /**\n * Memoized list of all element properties, including any superclass\n * properties. Created lazily on user subclasses when finalizing the class.\n *\n * @nocollapse\n * @category properties\n */\n static elementProperties: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring reactive properties. When\n * a reactive property is set the element will update and render.\n *\n * By default properties are public fields, and as such, they should be\n * considered as primarily settable by element users, either via attribute or\n * the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the `state: true` option. Properties\n * marked as `state` do not reflect from the corresponding attribute\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating\n * public properties should typically not be done for non-primitive (object or\n * array) properties. In other cases when an element needs to manage state, a\n * private property set with the `state: true` option should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n * @nocollapse\n * @category properties\n */\n static properties: PropertyDeclarations;\n\n /**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\n static elementStyles: Array = [];\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the {@linkcode css} tag function, via constructible stylesheets, or\n * imported from native CSS module scripts.\n *\n * Note on Content Security Policy:\n *\n * Element styles are implemented with `