1function _assert_this_initialized(self) { 2 if (self === void 0) { 3 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4 } 5 return self; 6} 7function _class_call_check(instance, Constructor) { 8 if (!(instance instanceof Constructor)) { 9 throw new TypeError("Cannot call a class as a function"); 10 } 11} 12function _defineProperties(target, props) { 13 for(var i = 0; i < props.length; i++){ 14 var descriptor = props[i]; 15 descriptor.enumerable = descriptor.enumerable || false; 16 descriptor.configurable = true; 17 if ("value" in descriptor) descriptor.writable = true; 18 Object.defineProperty(target, descriptor.key, descriptor); 19 } 20} 21function _create_class(Constructor, protoProps, staticProps) { 22 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 23 if (staticProps) _defineProperties(Constructor, staticProps); 24 return Constructor; 25} 26function _get_prototype_of(o) { 27 _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) { 28 return o.__proto__ || Object.getPrototypeOf(o); 29 }; 30 return _get_prototype_of(o); 31} 32function _inherits(subClass, superClass) { 33 if (typeof superClass !== "function" && superClass !== null) { 34 throw new TypeError("Super expression must either be null or a function"); 35 } 36 subClass.prototype = Object.create(superClass && superClass.prototype, { 37 constructor: { 38 value: subClass, 39 writable: true, 40 configurable: true 41 } 42 }); 43 if (superClass) _set_prototype_of(subClass, superClass); 44} 45function _possible_constructor_return(self, call) { 46 if (call && (_type_of(call) === "object" || typeof call === "function")) { 47 return call; 48 } 49 return _assert_this_initialized(self); 50} 51function _set_prototype_of(o, p) { 52 _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { 53 o.__proto__ = p; 54 return o; 55 }; 56 return _set_prototype_of(o, p); 57} 58function _type_of(obj) { 59 "@swc/helpers - typeof"; 60 return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; 61} 62function _is_native_reflect_construct() { 63 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 64 if (Reflect.construct.sham) return false; 65 if (typeof Proxy === "function") return true; 66 try { 67 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); 68 return true; 69 } catch (e) { 70 return false; 71 } 72} 73function _create_super(Derived) { 74 var hasNativeReflectConstruct = _is_native_reflect_construct(); 75 return function _createSuperInternal() { 76 var Super = _get_prototype_of(Derived), result; 77 if (hasNativeReflectConstruct) { 78 var NewTarget = _get_prototype_of(this).constructor; 79 result = Reflect.construct(Super, arguments, NewTarget); 80 } else { 81 result = Super.apply(this, arguments); 82 } 83 return _possible_constructor_return(this, result); 84 }; 85} 86import { Controller } from "@hotwired/stimulus"; 87import { useClickOutside } from "stimulus-use"; 88var UserDropdownController = /*#__PURE__*/ function(Controller) { 89 "use strict"; 90 _inherits(UserDropdownController, Controller); 91 var _super = _create_super(UserDropdownController); 92 function UserDropdownController() { 93 _class_call_check(this, UserDropdownController); 94 return _super.apply(this, arguments); 95 } 96 _create_class(UserDropdownController, [ 97 { 98 key: "connect", 99 value: function connect() { 100 useClickOutside(this, { 101 dispatchEvent: false 102 }); 103 } 104 }, 105 { 106 key: "toggle", 107 value: function toggle(event) { 108 event.preventDefault(); 109 event.stopPropagation(); 110 if (this.isActive()) { 111 this.close(); 112 return; 113 } 114 this.closeOtherUserDropdowns(); 115 this.dispatch("opened"); 116 this.open(); 117 } 118 }, 119 { 120 key: "clickOutside", 121 value: function clickOutside() { 122 if (!this.isActive()) { 123 return; 124 } 125 this.close(); 126 } 127 }, 128 { 129 key: "isActive", 130 value: function isActive() { 131 return this.element.classList.contains("is-active"); 132 } 133 }, 134 { 135 key: "open", 136 value: function open() { 137 this.element.classList.add("is-active"); 138 } 139 }, 140 { 141 key: "close", 142 value: function close() { 143 this.element.classList.remove("is-active"); 144 } 145 }, 146 { 147 key: "closeOtherUserDropdowns", 148 value: function closeOtherUserDropdowns() { 149 var _this = this; 150 var _this_element_closest; 151 var root = (_this_element_closest = this.element.closest('[data-controller~="header"]')) !== null && _this_element_closest !== void 0 ? _this_element_closest : document; 152 root.querySelectorAll(".iu-user-dropdown.is-active").forEach(function(dropdown) { 153 if (dropdown !== _this.element) { 154 dropdown.classList.remove("is-active"); 155 } 156 }); 157 } 158 } 159 ]); 160 return UserDropdownController; 161}(Controller); 162export { UserDropdownController as default };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.