UNPKG

ngx-bootstrap

Version:
10 lines 7.3 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-bootstrap/utils",["exports","@angular/core"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["ngx-bootstrap"]=t["ngx-bootstrap"]||{},t["ngx-bootstrap"].utils={}),t.ng.core)}(this,(function(t,e){"use strict";var n=function(){function t(t,e){this.open=t,this.close=e||t}return t.prototype.isManual=function(){return"manual"===this.open||"manual"===this.close},t}(),r={hover:["mouseover","mouseout"],focus:["focusin","focusout"]};function i(t,e){void 0===e&&(e=r);var i=(t||"").trim();if(0===i.length)return[];var o=i.split(/\s+/).map((function(t){return t.split(":")})).map((function(t){var r=e[t[0]]||t;return new n(r[0],r[1])})),s=o.filter((function(t){return t.isManual()}));if(s.length>1)throw new Error("Triggers parse error: only one manual trigger is allowed");if(1===s.length&&o.length>1)throw new Error("Triggers parse error: manual trigger can't be mixed with other triggers");return o} /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var o,s="undefined"!=typeof window&&window||{},u=s.document;s.location,s.gc,s.performance&&s.performance,s.Event,s.MouseEvent,s.KeyboardEvent,s.EventTarget,s.History,s.Location,s.EventListener;var a=function(){function t(){this.length=0,this.asArray=[]}return t.prototype.get=function(t){if(!(0===this.length||t<0||t>=this.length)){for(var e=this.head,n=0;n<t;n++)e=null==e?void 0:e.next;return null==e?void 0:e.value}},t.prototype.add=function(t,e){if(void 0===e&&(e=this.length),e<0||e>this.length)throw new Error("Position is out of the list");var n={value:t,next:void 0,previous:void 0};if(0===this.length)this.head=n,this.tail=n,this.current=n;else if(0===e&&this.head)n.next=this.head,this.head.previous=n,this.head=n;else if(e===this.length&&this.tail)this.tail.next=n,n.previous=this.tail,this.tail=n;else{var r=this.getNode(e-1),i=null==r?void 0:r.next;r&&i&&(r.next=n,i.previous=n,n.previous=r,n.next=i)}this.length++,this.createInternalArrayRepresentation()},t.prototype.remove=function(t){var e;if(void 0===t&&(t=0),0===this.length||t<0||t>=this.length)throw new Error("Position is out of the list");if(0===t&&this.head)this.head=this.head.next,this.head?this.head.previous=void 0:this.tail=void 0;else if(t===this.length-1&&(null===(e=this.tail)||void 0===e?void 0:e.previous))this.tail=this.tail.previous,this.tail.next=void 0;else{var n=this.getNode(t);(null==n?void 0:n.next)&&n.previous&&(n.next.previous=n.previous,n.previous.next=n.next)}this.length--,this.createInternalArrayRepresentation()},t.prototype.set=function(t,e){if(0===this.length||t<0||t>=this.length)throw new Error("Position is out of the list");var n=this.getNode(t);n&&(n.value=e,this.createInternalArrayRepresentation())},t.prototype.toArray=function(){return this.asArray},t.prototype.findAll=function(t){var e=this.head,n=[];if(!e)return n;for(var r=0;r<this.length;r++){if(!e)return n;t(e.value,r)&&n.push({index:r,value:e.value}),e=e.next}return n},t.prototype.push=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.forEach((function(e){t.add(e)})),this.length},t.prototype.pop=function(){if(0!==this.length){var t=this.tail;return this.remove(this.length-1),null==t?void 0:t.value}},t.prototype.unshift=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.reverse(),e.forEach((function(e){t.add(e,0)})),this.length},t.prototype.shift=function(){var t;if(0!==this.length){var e=null===(t=this.head)||void 0===t?void 0:t.value;return this.remove(),e}},t.prototype.forEach=function(t){for(var e=this.head,n=0;n<this.length;n++){if(!e)return;t(e.value,n),e=e.next}},t.prototype.indexOf=function(t){for(var e=this.head,n=-1,r=0;r<this.length;r++){if(!e)return n;if(e.value===t){n=r;break}e=e.next}return n},t.prototype.some=function(t){for(var e=this.head,n=!1;e&&!n;){if(t(e.value)){n=!0;break}e=e.next}return n},t.prototype.every=function(t){for(var e=this.head,n=!0;e&&n;)t(e.value)||(n=!1),e=e.next;return n},t.prototype.toString=function(){return"[Linked List]"},t.prototype.find=function(t){for(var e=this.head,n=0;n<this.length;n++){if(!e)return;if(t(e.value,n))return e.value;e=e.next}},t.prototype.findIndex=function(t){for(var e=this.head,n=0;n<this.length;n++){if(!e)return-1;if(t(e.value,n))return n;e=e.next}return-1},t.prototype.getNode=function(t){if(0===this.length||t<0||t>=this.length)throw new Error("Position is out of the list");for(var e=this.head,n=0;n<t;n++)e=null==e?void 0:e.next;return e},t.prototype.createInternalArrayRepresentation=function(){for(var t=[],e=this.head;e;)t.push(e.value),e=e.next;this.asArray=t},t}();var h=function(){function t(){}return t.reflow=function(t){t.offsetHeight},t.getStyles=function(t){var e=t.ownerDocument.defaultView;return e&&e.opener||(e=s),e.getComputedStyle(t)},t}(),l={},f="undefined"==typeof console||!("warn"in console);t.LinkedList=a,t.OnChange=function(){var t="Change";return function(e,n){var r=" __"+n+"Value";Object.defineProperty(e,n,{get:function(){return this[r]},set:function(e){var i=this[r];this[r]=e,i!==e&&this[n+t]&&this[n+t].emit(e)}})}},t.Trigger=n,t.Utils=h,t.document=u,t.isBs3=function(){return void 0===s||(void 0===s.__theme?o?"bs3"===o:"bs3"===(o=function(){if("undefined"==typeof document)return"bs4";var t=document.createElement("span");t.innerText="testing bs version",document.body.appendChild(t),t.classList.add("d-none");var e=t.getBoundingClientRect();return document.body.removeChild(t),e&&0===e.top?"bs4":"bs3"}()):"bs4"!==s.__theme)},t.listenToTriggers=function(t,e,n,r,o,s){var u=i(n),a=[];return 1===u.length&&u[0].isManual()?Function.prototype:(u.forEach((function(n){n.open!==n.close?(a.push(t.listen(e,n.open,r)),n.close&&a.push(t.listen(e,n.close,o))):a.push(t.listen(e,n.open,s))})),function(){a.forEach((function(t){return t()}))})},t.listenToTriggersV2=function(t,e){var n=i(e.triggers),r=e.target;if(1===n.length&&n[0].isManual())return Function.prototype;var o=[],s=[],u=function(){s.forEach((function(t){return o.push(t())})),s.length=0};return n.forEach((function(n){var i=n.open===n.close,a=i?e.toggle:e.show;if(!i&&n.close&&e.hide){var h=t.listen(r,n.close,e.hide);s.push((function(){return h}))}a&&o.push(t.listen(r,n.open,(function(){return a(u)})))})),function(){o.forEach((function(t){return t()}))}},t.parseTriggers=i,t.registerEscClick=function(t,e){return e.outsideEsc?t.listen("document","keyup.esc",(function(t){e.target&&e.target.contains(t.target)||e.targets&&e.targets.some((function(e){return e.contains(t.target)}))||e.hide&&e.hide()})):Function.prototype},t.registerOutsideClick=function(t,e){return e.outsideClick?t.listen("document","click",(function(t){e.target&&e.target.contains(t.target)||e.targets&&e.targets.some((function(e){return e.contains(t.target)}))||e.hide&&e.hide()})):Function.prototype},t.setTheme=function(t){o=t},t.warnOnce=function(t){!e.isDevMode()||f||t in l||(l[t]=!0,console.warn(t))},t.window=s,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ngx-bootstrap-utils.umd.min.js.map