diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index ad5f7a841e..6d0334b804 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -2,7 +2,14 @@ name: SQLite -on: ["push", "pull_request"] +on: + push: + branches-ignore: + - l10* + + pull_request: + branches-ignore: + - l10* jobs: diff --git a/.github/workflows/docker_publish.yaml b/.github/workflows/docker_publish.yaml index 4a8cef0952..53ec505003 100644 --- a/.github/workflows/docker_publish.yaml +++ b/.github/workflows/docker_publish.yaml @@ -17,16 +17,17 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: cd - run: | - cd docker - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + - name: Login to Dockerhub + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: inventree/inventree - tag_with_ref: true - dockerfile: ./Dockerfile - target: production + - name: Build and Push + uses: docker/build-push-action@v2 + with: + context: ./docker platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + target: production + repository: inventree/inventree + tags: inventree/inventree:${{ github.event.release.tag_name }} diff --git a/.github/workflows/mysql.yaml b/.github/workflows/mysql.yaml index 5bafe56253..f0eb0efd7f 100644 --- a/.github/workflows/mysql.yaml +++ b/.github/workflows/mysql.yaml @@ -2,7 +2,14 @@ name: MySQL -on: ["push", "pull_request"] +on: + push: + branches-ignore: + - l10* + + pull_request: + branches-ignore: + - l10* jobs: diff --git a/.github/workflows/postgresql.yaml b/.github/workflows/postgresql.yaml index 3481895d85..9a56382c4e 100644 --- a/.github/workflows/postgresql.yaml +++ b/.github/workflows/postgresql.yaml @@ -2,7 +2,14 @@ name: PostgreSQL -on: ["push", "pull_request"] +on: + push: + branches-ignore: + - l10* + + pull_request: + branches-ignore: + - l10* jobs: diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 31da3ec61a..df52de1dcb 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -1,6 +1,13 @@ name: Style Checks -on: ["push", "pull_request"] +on: + push: + branches-ignore: + - l10* + + pull_request: + branches-ignore: + - l10* jobs: style: diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index a3950b2002..24106c028e 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -5,7 +5,6 @@ on: branches: - master - jobs: build: diff --git a/InvenTree/InvenTree/apps.py b/InvenTree/InvenTree/apps.py index aa60058dcf..aeddb714a0 100644 --- a/InvenTree/InvenTree/apps.py +++ b/InvenTree/InvenTree/apps.py @@ -4,8 +4,9 @@ import logging from django.apps import AppConfig from django.core.exceptions import AppRegistryNotReady +from django.conf import settings -from InvenTree.ready import canAppAccessDatabase +from InvenTree.ready import isInTestMode, canAppAccessDatabase import InvenTree.tasks @@ -20,6 +21,9 @@ class InvenTreeConfig(AppConfig): if canAppAccessDatabase(): self.start_background_tasks() + if not isInTestMode(): + self.update_exchange_rates() + def start_background_tasks(self): try: @@ -49,3 +53,53 @@ class InvenTreeConfig(AppConfig): 'InvenTree.tasks.update_exchange_rates', schedule_type=Schedule.DAILY, ) + + def update_exchange_rates(self): + """ + Update exchange rates each time the server is started, *if*: + + a) Have not been updated recently (one day or less) + b) The base exchange rate has been altered + """ + + try: + from djmoney.contrib.exchange.models import ExchangeBackend + from datetime import datetime, timedelta + from InvenTree.tasks import update_exchange_rates + except AppRegistryNotReady: + pass + + base_currency = settings.BASE_CURRENCY + + update = False + + try: + backend = ExchangeBackend.objects.get(name='InvenTreeExchange') + + last_update = backend.last_update + + if last_update is not None: + delta = datetime.now().date() - last_update.date() + if delta > timedelta(days=1): + print(f"Last update was {last_update}") + update = True + else: + # Never been updated + print("Exchange backend has never been updated") + update = True + + # Backend currency has changed? + if not base_currency == backend.base_currency: + print(f"Base currency changed from {backend.base_currency} to {base_currency}") + update = True + + except (ExchangeBackend.DoesNotExist): + print("Exchange backend not found - updating") + update = True + + except: + # Some other error - potentially the tables are not ready yet + return + + if update: + update_exchange_rates() diff --git a/InvenTree/InvenTree/exchange.py b/InvenTree/InvenTree/exchange.py index 0a75436b1e..0695e69f48 100644 --- a/InvenTree/InvenTree/exchange.py +++ b/InvenTree/InvenTree/exchange.py @@ -1,120 +1,29 @@ from django.conf import settings as inventree_settings -from djmoney.contrib.exchange.backends.base import BaseExchangeBackend -from djmoney.contrib.exchange.models import Rate - -from common.models import InvenTreeSetting +from djmoney.contrib.exchange.backends.base import SimpleExchangeBackend -def get_exchange_rate_backend(): - """ Return the exchange rate backend set by user """ - - custom = InvenTreeSetting.get_setting('CUSTOM_EXCHANGE_RATES', False) - - if custom: - return InvenTreeManualExchangeBackend() - else: - return ExchangeRateHostBackend() - - -class InvenTreeManualExchangeBackend(BaseExchangeBackend): +class InvenTreeExchange(SimpleExchangeBackend): """ - Backend for manually updating currency exchange rates + Backend for automatically updating currency exchange rates. - See the documentation for django-money: https://github.com/django-money/django-money - - Specifically: https://github.com/django-money/django-money/tree/master/djmoney/contrib/exchange/backends + Uses the exchangerate.host service API """ - name = 'inventree' - url = None - custom_rates = True - base_currency = None - currencies = [] - - def update_default_currency(self): - """ Update to base currency """ - - self.base_currency = InvenTreeSetting.get_setting('INVENTREE_DEFAULT_CURRENCY', 'USD') - - def __init__(self, url=None): - """ Overrides init to update url, base currency and currencies """ - - self.url = url - - self.update_default_currency() - - # Update name - self.name = self.name + '-' + self.base_currency.lower() - - self.currencies = inventree_settings.CURRENCIES - - super().__init__() - - def get_rates(self, **kwargs): - """ Returns a mapping : """ - - return kwargs.get('rates', {}) - - def get_stored_rates(self): - """ Returns stored rate for specified backend and base currency """ - - stored_rates = {} - - stored_rates_obj = Rate.objects.all().prefetch_related('backend') - - for rate in stored_rates_obj: - # Find match for backend and base currency - if rate.backend.name == self.name and rate.backend.base_currency == self.base_currency: - # print(f'{rate.currency} | {rate.value} | {rate.backend} | {rate.backend.base_currency}') - stored_rates[rate.currency] = rate.value - - return stored_rates - - -class ExchangeRateHostBackend(InvenTreeManualExchangeBackend): - """ - Backend for https://exchangerate.host/ - """ - - name = "exchangerate.host" + name = "InvenTreeExchange" def __init__(self): self.url = "https://api.exchangerate.host/latest" - self.custom_rates = False - - super().__init__(url=self.url) + super().__init__() def get_params(self): # No API key is required - return {} + return { + } - def update_rates(self, base_currency=None): - """ Override update_rates method using currencies found in the settings - """ + def update_rates(self, base_currency=inventree_settings.BASE_CURRENCY): - if base_currency: - self.base_currency = base_currency - else: - self.update_default_currency() - - symbols = ','.join(self.currencies) + symbols = ','.join(inventree_settings.CURRENCIES) - super().update_rates(base_currency=self.base_currency, symbols=symbols) - - def get_rates(self, **params): - """ Returns a mapping : """ - - # Set base currency - params.update(base=self.base_currency) - - response = self.get_response(**params) - - try: - return self.parse_json(response)['rates'] - except KeyError: - # API response did not contain any rate - pass - - return {} + super().update_rates(base=base_currency, symbols=symbols) diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 488e982ddc..d843c1ddef 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -16,8 +16,6 @@ from crispy_forms.bootstrap import PrependedText, AppendedText, PrependedAppende from common.models import ColorTheme from part.models import PartCategory -from .exchange import InvenTreeManualExchangeBackend - class HelperForm(forms.ModelForm): """ Provides simple integration of crispy_forms extension. """ @@ -240,35 +238,3 @@ class SettingCategorySelectForm(forms.ModelForm): css_class='row', ), ) - - -class SettingExchangeRatesForm(forms.Form): - """ Form for displaying and setting currency exchange rates manually """ - - def __init__(self, *args, **kwargs): - - super().__init__(*args, **kwargs) - - exchange_rate_backend = InvenTreeManualExchangeBackend() - - # Update default currency (in case it has changed) - exchange_rate_backend.update_default_currency() - - for currency in exchange_rate_backend.currencies: - if currency != exchange_rate_backend.base_currency: - # Set field name - field_name = currency - # Set field input box - self.fields[field_name] = forms.CharField( - label=field_name, - required=False, - widget=forms.NumberInput(attrs={ - 'name': field_name, - 'class': 'numberinput', - 'style': 'width: 200px;', - 'type': 'number', - 'min': '0', - 'step': 'any', - 'value': 0, - }) - ) diff --git a/InvenTree/InvenTree/ready.py b/InvenTree/InvenTree/ready.py index aa31fac947..5a4f1e9576 100644 --- a/InvenTree/InvenTree/ready.py +++ b/InvenTree/InvenTree/ready.py @@ -1,6 +1,17 @@ import sys +def isInTestMode(): + """ + Returns True if the database is in testing mode + """ + + if 'test' in sys.argv: + return True + + return False + + def canAppAccessDatabase(): """ Returns True if the apps.py file can access database records. diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 3582b2a3a5..43b6feee46 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -19,6 +19,8 @@ import shutil import sys from datetime import datetime +import moneyed + import yaml from django.utils.translation import gettext_lazy as _ from django.contrib.messages import constants as messages @@ -514,6 +516,20 @@ CURRENCIES = CONFIG.get( ], ) +# Check that each provided currency is supported +for currency in CURRENCIES: + if currency not in moneyed.CURRENCIES: + print(f"Currency code '{currency}' is not supported") + sys.exit(1) + +BASE_CURRENCY = get_setting( + 'INVENTREE_BASE_CURRENCY', + CONFIG.get('base_currency', 'USD') +) + +# Custom currency exchange backend +EXCHANGE_BACKEND = 'InvenTree.exchange.InvenTreeExchange' + # Extract email settings from the config file email_config = CONFIG.get('email', {}) diff --git a/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table-en-US.min.js b/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table-en-US.min.js new file mode 100644 index 0000000000..87bef30086 --- /dev/null +++ b/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table-en-US.min.js @@ -0,0 +1,10 @@ +/** + * bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation) + * + * @version v1.18.3 + * @homepage https://bootstrap-table.com + * @author wenzhixin (http://wenzhixin.net.cn/) + * @license MIT + */ + +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,n){return t(n={exports:{}},n.exports),n.exports}var i=function(t){return t&&t.Math==Math&&t},u=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof e&&e)||function(){return this}()||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},c=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),a={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,s={f:l&&!a.call({1:2},1)?function(t){var n=l(this,t);return!!n&&n.enumerable}:a},p=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},g={}.toString,d=function(t){return g.call(t).slice(8,-1)},h="".split,y=f((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==d(t)?h.call(t,""):Object(t)}:Object,m=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},v=function(t){return y(m(t))},w=function(t){return"object"==typeof t?null!==t:"function"==typeof t},b=function(t,n){if(!w(t))return t;var r,e;if(n&&"function"==typeof(r=t.toString)&&!w(e=r.call(t)))return e;if("function"==typeof(r=t.valueOf)&&!w(e=r.call(t)))return e;if(!n&&"function"==typeof(r=t.toString)&&!w(e=r.call(t)))return e;throw TypeError("Can't convert object to primitive value")},S={}.hasOwnProperty,T=function(t,n){return S.call(t,n)},O=u.document,P=w(O)&&w(O.createElement),j=!c&&!f((function(){return 7!=Object.defineProperty((t="div",P?O.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),x=Object.getOwnPropertyDescriptor,A={f:c?x:function(t,n){if(t=v(t),n=b(n,!0),j)try{return x(t,n)}catch(t){}if(T(t,n))return p(!s.f.call(t,n),t[n])}},C=function(t){if(!w(t))throw TypeError(String(t)+" is not an object");return t},E=Object.defineProperty,M={f:c?E:function(t,n,r){if(C(t),n=b(n,!0),C(r),j)try{return E(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[n]=r.value),t}},R=c?function(t,n,r){return M.f(t,n,p(1,r))}:function(t,n,r){return t[n]=r,t},F=function(t,n){try{R(u,t,n)}catch(r){u[t]=n}return n},N="__core-js_shared__",L=u[N]||F(N,{}),k=Function.toString;"function"!=typeof L.inspectSource&&(L.inspectSource=function(t){return k.call(t)});var H,I,_,D,q=L.inspectSource,z=u.WeakMap,G="function"==typeof z&&/native code/.test(q(z)),U=o((function(t){(t.exports=function(t,n){return L[t]||(L[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.9.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),B=0,W=Math.random(),J=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++B+W).toString(36)},K=U("keys"),Q={},V=u.WeakMap;if(G){var Y=L.state||(L.state=new V),X=Y.get,Z=Y.has,$=Y.set;H=function(t,n){return n.facade=t,$.call(Y,t,n),n},I=function(t){return X.call(Y,t)||{}},_=function(t){return Z.call(Y,t)}}else{var tt=K[D="state"]||(K[D]=J(D));Q[tt]=!0,H=function(t,n){return n.facade=t,R(t,tt,n),n},I=function(t){return T(t,tt)?t[tt]:{}},_=function(t){return T(t,tt)}}var nt,rt,et={set:H,get:I,has:_,enforce:function(t){return _(t)?I(t):H(t,{})},getterFor:function(t){return function(n){var r;if(!w(n)||(r=I(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},ot=o((function(t){var n=et.get,r=et.enforce,e=String(String).split("String");(t.exports=function(t,n,o,i){var f,c=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,l=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof n||T(o,"name")||R(o,"name",n),(f=r(o)).source||(f.source=e.join("string"==typeof n?n:""))),t!==u?(c?!l&&t[n]&&(a=!0):delete t[n],a?t[n]=o:R(t,n,o)):a?t[n]=o:F(n,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&n(this).source||q(this)}))})),it=u,ut=function(t){return"function"==typeof t?t:void 0},ft=function(t,n){return arguments.length<2?ut(it[t])||ut(u[t]):it[t]&&it[t][n]||u[t]&&u[t][n]},ct=Math.ceil,at=Math.floor,lt=function(t){return isNaN(t=+t)?0:(t>0?at:ct)(t)},st=Math.min,pt=function(t){return t>0?st(lt(t),9007199254740991):0},gt=Math.max,dt=Math.min,ht=function(t){return function(n,r,e){var o,i=v(n),u=pt(i.length),f=function(t,n){var r=lt(t);return r<0?gt(r+n,0):dt(r,n)}(e,u);if(t&&r!=r){for(;u>f;)if((o=i[f++])!=o)return!0}else for(;u>f;f++)if((t||f in i)&&i[f]===r)return t||f||0;return!t&&-1}},yt={includes:ht(!0),indexOf:ht(!1)}.indexOf,mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),vt={f:Object.getOwnPropertyNames||function(t){return function(t,n){var r,e=v(t),o=0,i=[];for(r in e)!T(Q,r)&&T(e,r)&&i.push(r);for(;n.length>o;)T(e,r=n[o++])&&(~yt(i,r)||i.push(r));return i}(t,mt)}},wt={f:Object.getOwnPropertySymbols},bt=ft("Reflect","ownKeys")||function(t){var n=vt.f(C(t)),r=wt.f;return r?n.concat(r(t)):n},St=function(t,n){for(var r=bt(n),e=M.f,o=A.f,i=0;i=74)&&(nt=Lt.match(/Chrome\/(\d+)/))&&(rt=nt[1]);var _t,Dt=rt&&+rt,qt=!!Object.getOwnPropertySymbols&&!f((function(){return!Symbol.sham&&(Nt?38===Dt:Dt>37&&Dt<41)})),zt=qt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Gt=U("wks"),Ut=u.Symbol,Bt=zt?Ut:Ut&&Ut.withoutSetter||J,Wt=function(t){return T(Gt,t)&&(qt||"string"==typeof Gt[t])||(qt&&T(Ut,t)?Gt[t]=Ut[t]:Gt[t]=Bt("Symbol."+t)),Gt[t]},Jt=Wt("species"),Kt=function(t,n){var r;return Mt(t)&&("function"!=typeof(r=t.constructor)||r!==Array&&!Mt(r.prototype)?w(r)&&null===(r=r[Jt])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===n?0:n)},Qt=Wt("species"),Vt=Wt("isConcatSpreadable"),Yt=9007199254740991,Xt="Maximum allowed index exceeded",Zt=Dt>=51||!f((function(){var t=[];return t[Vt]=!1,t.concat()[0]!==t})),$t=(_t="concat",Dt>=51||!f((function(){var t=[];return(t.constructor={})[Qt]=function(){return{foo:1}},1!==t[_t](Boolean).foo}))),tn=function(t){if(!w(t))return!1;var n=t[Vt];return void 0!==n?!!n:Mt(t)};!function(t,n){var r,e,o,i,f,c=t.target,a=t.global,l=t.stat;if(r=a?u:l?u[c]||F(c,{}):(u[c]||{}).prototype)for(e in n){if(i=n[e],o=t.noTargetGet?(f=Et(r,e))&&f.value:r[e],!Ct(a?e:c+(l?".":"#")+e,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;St(i,o)}(t.sham||o&&o.sham)&&R(i,"sham",!0),ot(r,e,i,t)}}({target:"Array",proto:!0,forced:!Zt||!$t},{concat:function(t){var n,r,e,o,i,u=Rt(this),f=Kt(u,0),c=0;for(n=-1,e=arguments.length;nYt)throw TypeError(Xt);for(r=0;r=Yt)throw TypeError(Xt);Ft(f,c++,i)}return f.length=c,f}}),r.default.fn.bootstrapTable.locales["en-US"]=r.default.fn.bootstrapTable.locales.en={formatCopyRows:function(){return"Copy Rows"},formatPrint:function(){return"Print"},formatLoadingMessage:function(){return"Loading, please wait"},formatRecordsPerPage:function(t){return"".concat(t," rows per page")},formatShowingRows:function(t,n,r,e){return void 0!==e&&e>0&&e>r?"Showing ".concat(t," to ").concat(n," of ").concat(r," rows (filtered from ").concat(e," total rows)"):"Showing ".concat(t," to ").concat(n," of ").concat(r," rows")},formatSRPaginationPreText:function(){return"previous page"},formatSRPaginationPageText:function(t){return"to page ".concat(t)},formatSRPaginationNextText:function(){return"next page"},formatDetailPagination:function(t){return"Showing ".concat(t," rows")},formatClearSearch:function(){return"Clear Search"},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatPaginationSwitchDown:function(){return"Show pagination"},formatPaginationSwitchUp:function(){return"Hide pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatToggleOn:function(){return"Show card view"},formatToggleOff:function(){return"Hide card view"},formatColumns:function(){return"Columns"},formatColumnsToggleAll:function(){return"Toggle all"},formatFullscreen:function(){return"Fullscreen"},formatAllRows:function(){return"All"},formatAutoRefresh:function(){return"Auto Refresh"},formatExport:function(){return"Export data"},formatJumpTo:function(){return"GO"},formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"},formatFilterControlSwitch:function(){return"Hide/Show controls"},formatFilterControlSwitchHide:function(){return"Hide controls"},formatFilterControlSwitchShow:function(){return"Show controls"}},r.default.extend(r.default.fn.bootstrapTable.defaults,r.default.fn.bootstrapTable.locales["en-US"])})); diff --git a/InvenTree/InvenTree/static/css/bootstrap-table.css b/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table.css similarity index 81% rename from InvenTree/InvenTree/static/css/bootstrap-table.css rename to InvenTree/InvenTree/static/bootstrap-table/bootstrap-table.css index 7a71650329..5729f104bb 100644 --- a/InvenTree/InvenTree/static/css/bootstrap-table.css +++ b/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table.css @@ -1,14 +1,14 @@ -@charset "UTF-8"; /** * @author zhixin wen - * version: 1.14.2 + * version: 1.18.3 * https://github.com/wenzhixin/bootstrap-table/ */ -.bootstrap-table .fixed-table-toolbar:after { +.bootstrap-table .fixed-table-toolbar::after { content: ""; display: block; clear: both; } + .bootstrap-table .fixed-table-toolbar .bs-bars, .bootstrap-table .fixed-table-toolbar .search, .bootstrap-table .fixed-table-toolbar .columns { @@ -16,26 +16,34 @@ margin-top: 10px; margin-bottom: 10px; } + .bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group { display: inline-block; margin-left: -1px !important; } + +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group > .btn { + border-radius: 0; +} + .bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group:first-child > .btn { border-top-left-radius: 4px; border-bottom-left-radius: 4px; } + .bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group:last-child > .btn { border-top-right-radius: 4px; border-bottom-right-radius: 4px; } -.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group > .btn { - border-radius: 0; -} + .bootstrap-table .fixed-table-toolbar .columns .dropdown-menu { text-align: left; max-height: 300px; overflow: auto; + -ms-overflow-style: scrollbar; + z-index: 1001; } + .bootstrap-table .fixed-table-toolbar .columns label { display: block; padding: 3px 20px; @@ -43,68 +51,188 @@ font-weight: normal; line-height: 1.428571429; } + .bootstrap-table .fixed-table-toolbar .columns-left { margin-right: 5px; } + .bootstrap-table .fixed-table-toolbar .columns-right { margin-left: 5px; } + .bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu { right: 0; left: auto; } + .bootstrap-table .fixed-table-container { position: relative; clear: both; } + +.bootstrap-table .fixed-table-container .table { + width: 100%; + margin-bottom: 0 !important; +} + +.bootstrap-table .fixed-table-container .table th, +.bootstrap-table .fixed-table-container .table td { + vertical-align: middle; + box-sizing: border-box; +} + +.bootstrap-table .fixed-table-container .table thead th { + vertical-align: bottom; + padding: 0; + margin: 0; +} + +.bootstrap-table .fixed-table-container .table thead th:focus { + outline: 0 solid transparent; +} + +.bootstrap-table .fixed-table-container .table thead th.detail { + width: 30px; +} + +.bootstrap-table .fixed-table-container .table thead th .th-inner { + padding: 0.75rem; + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.bootstrap-table .fixed-table-container .table thead th .sortable { + cursor: pointer; + background-position: right; + background-repeat: no-repeat; + padding-right: 30px !important; +} + +.bootstrap-table .fixed-table-container .table thead th .both { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC"); +} + +.bootstrap-table .fixed-table-container .table thead th .asc { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg=="); +} + +.bootstrap-table .fixed-table-container .table thead th .desc { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= "); +} + +.bootstrap-table .fixed-table-container .table tbody tr.selected td { + background-color: rgba(0, 0, 0, 0.075); +} + +.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td { + text-align: center; +} + +.bootstrap-table .fixed-table-container .table tbody tr .card-view { + display: flex; +} + +.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title { + font-weight: bold; + display: inline-block; + min-width: 30%; + width: auto !important; + text-align: left !important; +} + +.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value { + width: 100% !important; +} + +.bootstrap-table .fixed-table-container .table .bs-checkbox { + text-align: center; +} + +.bootstrap-table .fixed-table-container .table .bs-checkbox label { + margin-bottom: 0; +} + +.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type="radio"], +.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type="checkbox"] { + margin: 0 auto !important; +} + +.bootstrap-table .fixed-table-container .table.table-sm .th-inner { + padding: 0.3rem; +} + .bootstrap-table .fixed-table-container.fixed-height:not(.has-footer) { border-bottom: 1px solid #dee2e6; } + +.bootstrap-table .fixed-table-container.fixed-height.has-card-view { + border-top: 1px solid #dee2e6; + border-bottom: 1px solid #dee2e6; +} + .bootstrap-table .fixed-table-container.fixed-height .fixed-table-border { border-left: 1px solid #dee2e6; border-right: 1px solid #dee2e6; } + .bootstrap-table .fixed-table-container.fixed-height .table thead th { border-bottom: 1px solid #dee2e6; } + .bootstrap-table .fixed-table-container.fixed-height .table-dark thead th { border-bottom: 1px solid #32383e; } + .bootstrap-table .fixed-table-container .fixed-table-header { overflow: hidden; } + .bootstrap-table .fixed-table-container .fixed-table-body { overflow-x: auto; overflow-y: auto; height: 100%; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { align-items: center; background: #fff; - display: none; + display: flex; justify-content: center; position: absolute; bottom: 0; width: 100%; z-index: 1000; + transition: visibility 0s, opacity 0.15s ease-in-out; + opacity: 0; + visibility: hidden; } + +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open { + visibility: visible; + opacity: 1; +} + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap { align-items: baseline; display: flex; justify-content: center; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text { - font-size: 2rem; margin-right: 6px; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap { align-items: center; display: flex; justify-content: center; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot, -.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap:after, -.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap:before { +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before { content: ""; animation-duration: 1.5s; animation-iteration-count: infinite; @@ -117,139 +245,102 @@ opacity: 0; width: 5px; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot { animation-delay: 0.3s; } -.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap:after { + +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after { animation-delay: 0.6s; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark { background: #212529; } + .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot, -.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap:after, -.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap:before { +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before { background: #fff; } -.bootstrap-table .fixed-table-container .table { - width: 100%; - margin-bottom: 0 !important; -} -.bootstrap-table .fixed-table-container .table th, -.bootstrap-table .fixed-table-container .table td { - vertical-align: middle; - box-sizing: border-box; -} -.bootstrap-table .fixed-table-container .table thead th { - vertical-align: bottom; - padding: 0; - margin: 0; -} -.bootstrap-table .fixed-table-container .table thead th:focus { - outline: 0 solid transparent; -} -.bootstrap-table .fixed-table-container .table thead th.detail { - width: 30px; -} -.bootstrap-table .fixed-table-container .table thead th .th-inner { - padding: 0.75rem; - vertical-align: bottom; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.bootstrap-table .fixed-table-container .table thead th .sortable { - cursor: pointer; - background-position: right; - background-repeat: no-repeat; - padding-right: 30px; -} -.bootstrap-table .fixed-table-container .table thead th .both { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC"); -} -.bootstrap-table .fixed-table-container .table thead th .asc { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg=="); -} -.bootstrap-table .fixed-table-container .table thead th .desc { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= "); -} -.bootstrap-table .fixed-table-container .table tbody tr.selected td { - background-color: rgba(0, 0, 0, 0.075); -} -.bootstrap-table .fixed-table-container .table tbody tr.no-records-found { - text-align: center; -} -.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title { - font-weight: bold; - display: inline-block; - min-width: 30%; - text-align: left !important; -} -.bootstrap-table .fixed-table-container .table .bs-checkbox { - text-align: center; -} -.bootstrap-table .fixed-table-container .table input[type=radio], -.bootstrap-table .fixed-table-container .table input[type=checkbox] { - margin: 0 auto !important; -} -.bootstrap-table .fixed-table-container .table.table-sm .th-inner { - padding: 0.3rem; -} + .bootstrap-table .fixed-table-container .fixed-table-footer { overflow: hidden; } -.bootstrap-table .fixed-table-pagination:after { + +.bootstrap-table .fixed-table-pagination::after { content: ""; display: block; clear: both; } + .bootstrap-table .fixed-table-pagination > .pagination-detail, .bootstrap-table .fixed-table-pagination > .pagination { margin-top: 10px; margin-bottom: 10px; } + .bootstrap-table .fixed-table-pagination > .pagination-detail .pagination-info { line-height: 34px; margin-right: 5px; } + .bootstrap-table .fixed-table-pagination > .pagination-detail .page-list { display: inline-block; } + .bootstrap-table .fixed-table-pagination > .pagination-detail .page-list .btn-group { position: relative; display: inline-block; vertical-align: middle; } + .bootstrap-table .fixed-table-pagination > .pagination-detail .page-list .btn-group .dropdown-menu { margin-bottom: 0; } + .bootstrap-table .fixed-table-pagination > .pagination ul.pagination { margin: 0; } -.bootstrap-table .fixed-table-pagination > .pagination ul.pagination a { - padding: 6px 12px; - line-height: 1.428571429; -} + .bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a { color: #c8c8c8; } -.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a:before { - content: "⬅"; + +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a::before { + content: '\2B05'; } -.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a:after { - content: "➡"; + +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a::after { + content: '\27A1'; } + .bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.disabled a { pointer-events: none; cursor: default; } + .bootstrap-table.fullscreen { position: fixed; top: 0; left: 0; z-index: 1050; width: 100% !important; - background: #FFF; + background: #fff; + height: calc(100vh); + overflow-y: scroll; +} + +.bootstrap-table.bootstrap4 .pagination-lg .page-link, .bootstrap-table.bootstrap5 .pagination-lg .page-link { + padding: .5rem 1rem; +} + +.bootstrap-table.bootstrap5 .float-left { + float: left; +} + +.bootstrap-table.bootstrap5 .float-right { + float: right; } /* calculate scrollbar width */ @@ -278,5 +369,3 @@ div.fixed-table-scroll-outer { opacity: 0; } } - -/*# sourceMappingURL=bootstrap-table.css.map */ diff --git a/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table.js b/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table.js new file mode 100644 index 0000000000..941ec06bfa --- /dev/null +++ b/InvenTree/InvenTree/static/bootstrap-table/bootstrap-table.js @@ -0,0 +1,7409 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : + typeof define === 'function' && define.amd ? define(['jquery'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = factory(global.jQuery)); +}(this, (function ($) { 'use strict'; + + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var $__default = /*#__PURE__*/_interopDefaultLegacy($); + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _createForOfIteratorHelper(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + + var F = function () {}; + + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = o[Symbol.iterator](); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var check = function (it) { + return it && it.Math == Math && it; + }; + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global_1 = + /* global globalThis -- safe */ + check(typeof globalThis == 'object' && globalThis) || + check(typeof window == 'object' && window) || + check(typeof self == 'object' && self) || + check(typeof commonjsGlobal == 'object' && commonjsGlobal) || + // eslint-disable-next-line no-new-func -- fallback + (function () { return this; })() || Function('return this')(); + + var fails = function (exec) { + try { + return !!exec(); + } catch (error) { + return true; + } + }; + + // Detect IE8's incomplete defineProperty implementation + var descriptors = !fails(function () { + return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; + }); + + var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; + + // Nashorn ~ JDK8 bug + var NASHORN_BUG = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + + // `Object.prototype.propertyIsEnumerable` method implementation + // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable + var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$4(this, V); + return !!descriptor && descriptor.enumerable; + } : nativePropertyIsEnumerable; + + var objectPropertyIsEnumerable = { + f: f$4 + }; + + var createPropertyDescriptor = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + + var toString = {}.toString; + + var classofRaw = function (it) { + return toString.call(it).slice(8, -1); + }; + + var split = ''.split; + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var indexedObject = fails(function () { + // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 + // eslint-disable-next-line no-prototype-builtins -- safe + return !Object('z').propertyIsEnumerable(0); + }) ? function (it) { + return classofRaw(it) == 'String' ? split.call(it, '') : Object(it); + } : Object; + + // `RequireObjectCoercible` abstract operation + // https://tc39.es/ecma262/#sec-requireobjectcoercible + var requireObjectCoercible = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; + }; + + // toObject with fallback for non-array-like ES3 strings + + + + var toIndexedObject = function (it) { + return indexedObject(requireObjectCoercible(it)); + }; + + var isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + + // `ToPrimitive` abstract operation + // https://tc39.es/ecma262/#sec-toprimitive + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + var toPrimitive = function (input, PREFERRED_STRING) { + if (!isObject(input)) return input; + var fn, val; + if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; + if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + throw TypeError("Can't convert object to primitive value"); + }; + + var hasOwnProperty = {}.hasOwnProperty; + + var has$1 = function (it, key) { + return hasOwnProperty.call(it, key); + }; + + var document$1 = global_1.document; + // typeof document.createElement is 'object' in old IE + var EXISTS = isObject(document$1) && isObject(document$1.createElement); + + var documentCreateElement = function (it) { + return EXISTS ? document$1.createElement(it) : {}; + }; + + // Thank's IE8 for his funny defineProperty + var ie8DomDefine = !descriptors && !fails(function () { + return Object.defineProperty(documentCreateElement('div'), 'a', { + get: function () { return 7; } + }).a != 7; + }); + + var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor + var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject(O); + P = toPrimitive(P, true); + if (ie8DomDefine) try { + return nativeGetOwnPropertyDescriptor(O, P); + } catch (error) { /* empty */ } + if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); + }; + + var objectGetOwnPropertyDescriptor = { + f: f$3 + }; + + var anObject = function (it) { + if (!isObject(it)) { + throw TypeError(String(it) + ' is not an object'); + } return it; + }; + + var nativeDefineProperty = Object.defineProperty; + + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (ie8DomDefine) try { + return nativeDefineProperty(O, P, Attributes); + } catch (error) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + + var objectDefineProperty = { + f: f$2 + }; + + var createNonEnumerableProperty = descriptors ? function (object, key, value) { + return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); + } : function (object, key, value) { + object[key] = value; + return object; + }; + + var setGlobal = function (key, value) { + try { + createNonEnumerableProperty(global_1, key, value); + } catch (error) { + global_1[key] = value; + } return value; + }; + + var SHARED = '__core-js_shared__'; + var store$1 = global_1[SHARED] || setGlobal(SHARED, {}); + + var sharedStore = store$1; + + var functionToString = Function.toString; + + // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper + if (typeof sharedStore.inspectSource != 'function') { + sharedStore.inspectSource = function (it) { + return functionToString.call(it); + }; + } + + var inspectSource = sharedStore.inspectSource; + + var WeakMap$1 = global_1.WeakMap; + + var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1)); + + var shared = createCommonjsModule(function (module) { + (module.exports = function (key, value) { + return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); + })('versions', []).push({ + version: '3.9.1', + mode: 'global', + copyright: '© 2021 Denis Pushkarev (zloirock.ru)' + }); + }); + + var id = 0; + var postfix = Math.random(); + + var uid = function (key) { + return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); + }; + + var keys$2 = shared('keys'); + + var sharedKey = function (key) { + return keys$2[key] || (keys$2[key] = uid(key)); + }; + + var hiddenKeys$1 = {}; + + var WeakMap = global_1.WeakMap; + var set, get, has; + + var enforce = function (it) { + return has(it) ? get(it) : set(it, {}); + }; + + var getterFor = function (TYPE) { + return function (it) { + var state; + if (!isObject(it) || (state = get(it)).type !== TYPE) { + throw TypeError('Incompatible receiver, ' + TYPE + ' required'); + } return state; + }; + }; + + if (nativeWeakMap) { + var store = sharedStore.state || (sharedStore.state = new WeakMap()); + var wmget = store.get; + var wmhas = store.has; + var wmset = store.set; + set = function (it, metadata) { + metadata.facade = it; + wmset.call(store, it, metadata); + return metadata; + }; + get = function (it) { + return wmget.call(store, it) || {}; + }; + has = function (it) { + return wmhas.call(store, it); + }; + } else { + var STATE = sharedKey('state'); + hiddenKeys$1[STATE] = true; + set = function (it, metadata) { + metadata.facade = it; + createNonEnumerableProperty(it, STATE, metadata); + return metadata; + }; + get = function (it) { + return has$1(it, STATE) ? it[STATE] : {}; + }; + has = function (it) { + return has$1(it, STATE); + }; + } + + var internalState = { + set: set, + get: get, + has: has, + enforce: enforce, + getterFor: getterFor + }; + + var redefine = createCommonjsModule(function (module) { + var getInternalState = internalState.get; + var enforceInternalState = internalState.enforce; + var TEMPLATE = String(String).split('String'); + + (module.exports = function (O, key, value, options) { + var unsafe = options ? !!options.unsafe : false; + var simple = options ? !!options.enumerable : false; + var noTargetGet = options ? !!options.noTargetGet : false; + var state; + if (typeof value == 'function') { + if (typeof key == 'string' && !has$1(value, 'name')) { + createNonEnumerableProperty(value, 'name', key); + } + state = enforceInternalState(value); + if (!state.source) { + state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); + } + } + if (O === global_1) { + if (simple) O[key] = value; + else setGlobal(key, value); + return; + } else if (!unsafe) { + delete O[key]; + } else if (!noTargetGet && O[key]) { + simple = true; + } + if (simple) O[key] = value; + else createNonEnumerableProperty(O, key, value); + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative + })(Function.prototype, 'toString', function toString() { + return typeof this == 'function' && getInternalState(this).source || inspectSource(this); + }); + }); + + var path = global_1; + + var aFunction$1 = function (variable) { + return typeof variable == 'function' ? variable : undefined; + }; + + var getBuiltIn = function (namespace, method) { + return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace]) + : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; + }; + + var ceil = Math.ceil; + var floor$1 = Math.floor; + + // `ToInteger` abstract operation + // https://tc39.es/ecma262/#sec-tointeger + var toInteger = function (argument) { + return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument); + }; + + var min$6 = Math.min; + + // `ToLength` abstract operation + // https://tc39.es/ecma262/#sec-tolength + var toLength = function (argument) { + return argument > 0 ? min$6(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + }; + + var max$3 = Math.max; + var min$5 = Math.min; + + // Helper for a popular repeating case of the spec: + // Let integer be ? ToInteger(index). + // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). + var toAbsoluteIndex = function (index, length) { + var integer = toInteger(index); + return integer < 0 ? max$3(integer + length, 0) : min$5(integer, length); + }; + + // `Array.prototype.{ indexOf, includes }` methods implementation + var createMethod$4 = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIndexedObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare -- NaN check + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare -- NaN check + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + + var arrayIncludes = { + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + includes: createMethod$4(true), + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + indexOf: createMethod$4(false) + }; + + var indexOf = arrayIncludes.indexOf; + + + var objectKeysInternal = function (object, names) { + var O = toIndexedObject(object); + var i = 0; + var result = []; + var key; + for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has$1(O, key = names[i++])) { + ~indexOf(result, key) || result.push(key); + } + return result; + }; + + // IE8- don't enum bug keys + var enumBugKeys = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' + ]; + + var hiddenKeys = enumBugKeys.concat('length', 'prototype'); + + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return objectKeysInternal(O, hiddenKeys); + }; + + var objectGetOwnPropertyNames = { + f: f$1 + }; + + var f = Object.getOwnPropertySymbols; + + var objectGetOwnPropertySymbols = { + f: f + }; + + // all object keys, includes non-enumerable and symbols + var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { + var keys = objectGetOwnPropertyNames.f(anObject(it)); + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; + }; + + var copyConstructorProperties = function (target, source) { + var keys = ownKeys(source); + var defineProperty = objectDefineProperty.f; + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } + }; + + var replacement = /#|\.prototype\./; + + var isForced = function (feature, detection) { + var value = data[normalize(feature)]; + return value == POLYFILL ? true + : value == NATIVE ? false + : typeof detection == 'function' ? fails(detection) + : !!detection; + }; + + var normalize = isForced.normalize = function (string) { + return String(string).replace(replacement, '.').toLowerCase(); + }; + + var data = isForced.data = {}; + var NATIVE = isForced.NATIVE = 'N'; + var POLYFILL = isForced.POLYFILL = 'P'; + + var isForced_1 = isForced; + + var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; + + + + + + + /* + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.noTargetGet - prevent calling a getter on target + */ + var _export = function (options, source) { + var TARGET = options.target; + var GLOBAL = options.global; + var STATIC = options.stat; + var FORCED, target, key, targetProperty, sourceProperty, descriptor; + if (GLOBAL) { + target = global_1; + } else if (STATIC) { + target = global_1[TARGET] || setGlobal(TARGET, {}); + } else { + target = (global_1[TARGET] || {}).prototype; + } + if (target) for (key in source) { + sourceProperty = source[key]; + if (options.noTargetGet) { + descriptor = getOwnPropertyDescriptor$3(target, key); + targetProperty = descriptor && descriptor.value; + } else targetProperty = target[key]; + FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); + // contained in target + if (!FORCED && targetProperty !== undefined) { + if (typeof sourceProperty === typeof targetProperty) continue; + copyConstructorProperties(sourceProperty, targetProperty); + } + // add a flag to not completely full polyfills + if (options.sham || (targetProperty && targetProperty.sham)) { + createNonEnumerableProperty(sourceProperty, 'sham', true); + } + // extend global + redefine(target, key, sourceProperty, options); + } + }; + + // a string of all valid unicode whitespaces + var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + + var whitespace = '[' + whitespaces + ']'; + var ltrim = RegExp('^' + whitespace + whitespace + '*'); + var rtrim = RegExp(whitespace + whitespace + '*$'); + + // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation + var createMethod$3 = function (TYPE) { + return function ($this) { + var string = String(requireObjectCoercible($this)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; + }; + }; + + var stringTrim = { + // `String.prototype.{ trimLeft, trimStart }` methods + // https://tc39.es/ecma262/#sec-string.prototype.trimstart + start: createMethod$3(1), + // `String.prototype.{ trimRight, trimEnd }` methods + // https://tc39.es/ecma262/#sec-string.prototype.trimend + end: createMethod$3(2), + // `String.prototype.trim` method + // https://tc39.es/ecma262/#sec-string.prototype.trim + trim: createMethod$3(3) + }; + + var non = '\u200B\u0085\u180E'; + + // check that a method works with the correct list + // of whitespaces and has a correct name + var stringTrimForced = function (METHOD_NAME) { + return fails(function () { + return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME; + }); + }; + + var $trim = stringTrim.trim; + + + // `String.prototype.trim` method + // https://tc39.es/ecma262/#sec-string.prototype.trim + _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, { + trim: function trim() { + return $trim(this); + } + }); + + var arrayMethodIsStrict = function (METHOD_NAME, argument) { + var method = [][METHOD_NAME]; + return !!method && fails(function () { + // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing + method.call(null, argument || function () { throw 1; }, 1); + }); + }; + + var nativeJoin = [].join; + + var ES3_STRINGS = indexedObject != Object; + var STRICT_METHOD$3 = arrayMethodIsStrict('join', ','); + + // `Array.prototype.join` method + // https://tc39.es/ecma262/#sec-array.prototype.join + _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, { + join: function join(separator) { + return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); + } + }); + + // `RegExp.prototype.flags` getter implementation + // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags + var regexpFlags = function () { + var that = anObject(this); + var result = ''; + if (that.global) result += 'g'; + if (that.ignoreCase) result += 'i'; + if (that.multiline) result += 'm'; + if (that.dotAll) result += 's'; + if (that.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; + }; + + // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError, + // so we use an intermediate function. + function RE(s, f) { + return RegExp(s, f); + } + + var UNSUPPORTED_Y$2 = fails(function () { + // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError + var re = RE('a', 'y'); + re.lastIndex = 2; + return re.exec('abcd') != null; + }); + + var BROKEN_CARET = fails(function () { + // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 + var re = RE('^r', 'gy'); + re.lastIndex = 2; + return re.exec('str') != null; + }); + + var regexpStickyHelpers = { + UNSUPPORTED_Y: UNSUPPORTED_Y$2, + BROKEN_CARET: BROKEN_CARET + }; + + var nativeExec = RegExp.prototype.exec; + // This always refers to the native implementation, because the + // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, + // which loads this file before patching the method. + var nativeReplace = String.prototype.replace; + + var patchedExec = nativeExec; + + var UPDATES_LAST_INDEX_WRONG = (function () { + var re1 = /a/; + var re2 = /b*/g; + nativeExec.call(re1, 'a'); + nativeExec.call(re2, 'a'); + return re1.lastIndex !== 0 || re2.lastIndex !== 0; + })(); + + var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; + + // nonparticipating capturing group, copied from es5-shim's String#split patch. + // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing + var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; + + var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1; + + if (PATCH) { + patchedExec = function exec(str) { + var re = this; + var lastIndex, reCopy, match, i; + var sticky = UNSUPPORTED_Y$1 && re.sticky; + var flags = regexpFlags.call(re); + var source = re.source; + var charsAdded = 0; + var strCopy = str; + + if (sticky) { + flags = flags.replace('y', ''); + if (flags.indexOf('g') === -1) { + flags += 'g'; + } + + strCopy = String(str).slice(re.lastIndex); + // Support anchored sticky behavior. + if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) { + source = '(?: ' + source + ')'; + strCopy = ' ' + strCopy; + charsAdded++; + } + // ^(? + rx + ) is needed, in combination with some str slicing, to + // simulate the 'y' flag. + reCopy = new RegExp('^(?:' + source + ')', flags); + } + + if (NPCG_INCLUDED) { + reCopy = new RegExp('^' + source + '$(?!\\s)', flags); + } + if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; + + match = nativeExec.call(sticky ? reCopy : re, strCopy); + + if (sticky) { + if (match) { + match.input = match.input.slice(charsAdded); + match[0] = match[0].slice(charsAdded); + match.index = re.lastIndex; + re.lastIndex += match[0].length; + } else re.lastIndex = 0; + } else if (UPDATES_LAST_INDEX_WRONG && match) { + re.lastIndex = re.global ? match.index + match[0].length : lastIndex; + } + if (NPCG_INCLUDED && match && match.length > 1) { + // Fix browsers whose `exec` methods don't consistently return `undefined` + // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ + nativeReplace.call(match[0], reCopy, function () { + for (i = 1; i < arguments.length - 2; i++) { + if (arguments[i] === undefined) match[i] = undefined; + } + }); + } + + return match; + }; + } + + var regexpExec = patchedExec; + + // `RegExp.prototype.exec` method + // https://tc39.es/ecma262/#sec-regexp.prototype.exec + _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, { + exec: regexpExec + }); + + var engineIsNode = classofRaw(global_1.process) == 'process'; + + var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; + + var process = global_1.process; + var versions = process && process.versions; + var v8 = versions && versions.v8; + var match, version; + + if (v8) { + match = v8.split('.'); + version = match[0] + match[1]; + } else if (engineUserAgent) { + match = engineUserAgent.match(/Edge\/(\d+)/); + if (!match || match[1] >= 74) { + match = engineUserAgent.match(/Chrome\/(\d+)/); + if (match) version = match[1]; + } + } + + var engineV8Version = version && +version; + + var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { + /* global Symbol -- required for testing */ + return !Symbol.sham && + // Chrome 38 Symbol has incorrect toString conversion + // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); + }); + + var useSymbolAsUid = nativeSymbol + /* global Symbol -- safe */ + && !Symbol.sham + && typeof Symbol.iterator == 'symbol'; + + var WellKnownSymbolsStore = shared('wks'); + var Symbol$1 = global_1.Symbol; + var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; + + var wellKnownSymbol = function (name) { + if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) { + if (nativeSymbol && has$1(Symbol$1, name)) { + WellKnownSymbolsStore[name] = Symbol$1[name]; + } else { + WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); + } + } return WellKnownSymbolsStore[name]; + }; + + // TODO: Remove from `core-js@4` since it's moved to entry points + + + + + + + + var SPECIES$5 = wellKnownSymbol('species'); + + var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { + // #replace needs built-in support for named groups. + // #match works fine because it just return the exec results, even if it has + // a "grops" property. + var re = /./; + re.exec = function () { + var result = []; + result.groups = { a: '7' }; + return result; + }; + return ''.replace(re, '$') !== '7'; + }); + + // IE <= 11 replaces $0 with the whole match, as if it was $& + // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 + var REPLACE_KEEPS_$0 = (function () { + return 'a'.replace(/./, '$0') === '$0'; + })(); + + var REPLACE = wellKnownSymbol('replace'); + // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string + var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { + if (/./[REPLACE]) { + return /./[REPLACE]('a', '$0') === ''; + } + return false; + })(); + + // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec + // Weex JS has frozen built-in prototypes, so use try / catch wrapper + var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { + // eslint-disable-next-line regexp/no-empty-group -- required for testing + var re = /(?:)/; + var originalExec = re.exec; + re.exec = function () { return originalExec.apply(this, arguments); }; + var result = 'ab'.split(re); + return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; + }); + + var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) { + var SYMBOL = wellKnownSymbol(KEY); + + var DELEGATES_TO_SYMBOL = !fails(function () { + // String methods call symbol-named RegEp methods + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + }); + + var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { + // Symbol-named RegExp methods call .exec + var execCalled = false; + var re = /a/; + + if (KEY === 'split') { + // We can't use real regex here since it causes deoptimization + // and serious performance degradation in V8 + // https://github.com/zloirock/core-js/issues/306 + re = {}; + // RegExp[@@split] doesn't call the regex's exec method, but first creates + // a new one. We need to return the patched regex when creating the new one. + re.constructor = {}; + re.constructor[SPECIES$5] = function () { return re; }; + re.flags = ''; + re[SYMBOL] = /./[SYMBOL]; + } + + re.exec = function () { execCalled = true; return null; }; + + re[SYMBOL](''); + return !execCalled; + }); + + if ( + !DELEGATES_TO_SYMBOL || + !DELEGATES_TO_EXEC || + (KEY === 'replace' && !( + REPLACE_SUPPORTS_NAMED_GROUPS && + REPLACE_KEEPS_$0 && + !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE + )) || + (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) + ) { + var nativeRegExpMethod = /./[SYMBOL]; + var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { + if (regexp.exec === regexpExec) { + if (DELEGATES_TO_SYMBOL && !forceStringMethod) { + // The native String method already delegates to @@method (this + // polyfilled function), leasing to infinite recursion. + // We avoid it by directly calling the native @@method method. + return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; + } + return { done: true, value: nativeMethod.call(str, regexp, arg2) }; + } + return { done: false }; + }, { + REPLACE_KEEPS_$0: REPLACE_KEEPS_$0, + REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE + }); + var stringMethod = methods[0]; + var regexMethod = methods[1]; + + redefine(String.prototype, KEY, stringMethod); + redefine(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function (string, arg) { return regexMethod.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return regexMethod.call(string, this); } + ); + } + + if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true); + }; + + var MATCH$2 = wellKnownSymbol('match'); + + // `IsRegExp` abstract operation + // https://tc39.es/ecma262/#sec-isregexp + var isRegexp = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp'); + }; + + var aFunction = function (it) { + if (typeof it != 'function') { + throw TypeError(String(it) + ' is not a function'); + } return it; + }; + + var SPECIES$4 = wellKnownSymbol('species'); + + // `SpeciesConstructor` abstract operation + // https://tc39.es/ecma262/#sec-speciesconstructor + var speciesConstructor = function (O, defaultConstructor) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction(S); + }; + + // `String.prototype.{ codePointAt, at }` methods implementation + var createMethod$2 = function (CONVERT_TO_STRING) { + return function ($this, pos) { + var S = String(requireObjectCoercible($this)); + var position = toInteger(pos); + var size = S.length; + var first, second; + if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; + first = S.charCodeAt(position); + return first < 0xD800 || first > 0xDBFF || position + 1 === size + || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF + ? CONVERT_TO_STRING ? S.charAt(position) : first + : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; + }; + }; + + var stringMultibyte = { + // `String.prototype.codePointAt` method + // https://tc39.es/ecma262/#sec-string.prototype.codepointat + codeAt: createMethod$2(false), + // `String.prototype.at` method + // https://github.com/mathiasbynens/String.prototype.at + charAt: createMethod$2(true) + }; + + var charAt = stringMultibyte.charAt; + + // `AdvanceStringIndex` abstract operation + // https://tc39.es/ecma262/#sec-advancestringindex + var advanceStringIndex = function (S, index, unicode) { + return index + (unicode ? charAt(S, index).length : 1); + }; + + // `RegExpExec` abstract operation + // https://tc39.es/ecma262/#sec-regexpexec + var regexpExecAbstract = function (R, S) { + var exec = R.exec; + if (typeof exec === 'function') { + var result = exec.call(R, S); + if (typeof result !== 'object') { + throw TypeError('RegExp exec method returned something other than an Object or null'); + } + return result; + } + + if (classofRaw(R) !== 'RegExp') { + throw TypeError('RegExp#exec called on incompatible receiver'); + } + + return regexpExec.call(R, S); + }; + + var arrayPush = [].push; + var min$4 = Math.min; + var MAX_UINT32 = 0xFFFFFFFF; + + // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError + var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); }); + + // @@split logic + fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { + var internalSplit; + if ( + 'abbc'.split(/(b)*/)[1] == 'c' || + // eslint-disable-next-line regexp/no-empty-group -- required for testing + 'test'.split(/(?:)/, -1).length != 4 || + 'ab'.split(/(?:ab)*/).length != 2 || + '.'.split(/(.?)(.?)/).length != 4 || + // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing + '.'.split(/()()/).length > 1 || + ''.split(/.?/).length + ) { + // based on es5-shim implementation, need to rework it + internalSplit = function (separator, limit) { + var string = String(requireObjectCoercible(this)); + var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; + if (lim === 0) return []; + if (separator === undefined) return [string]; + // If `separator` is not a regex, use native split + if (!isRegexp(separator)) { + return nativeSplit.call(string, separator, lim); + } + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var match, lastIndex, lastLength; + while (match = regexpExec.call(separatorCopy, string)) { + lastIndex = separatorCopy.lastIndex; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1)); + lastLength = match[0].length; + lastLastIndex = lastIndex; + if (output.length >= lim) break; + } + if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop + } + if (lastLastIndex === string.length) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output.length > lim ? output.slice(0, lim) : output; + }; + // Chakra, V8 + } else if ('0'.split(undefined, 0).length) { + internalSplit = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit); + }; + } else internalSplit = nativeSplit; + + return [ + // `String.prototype.split` method + // https://tc39.es/ecma262/#sec-string.prototype.split + function split(separator, limit) { + var O = requireObjectCoercible(this); + var splitter = separator == undefined ? undefined : separator[SPLIT]; + return splitter !== undefined + ? splitter.call(separator, O, limit) + : internalSplit.call(String(O), separator, limit); + }, + // `RegExp.prototype[@@split]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@split + // + // NOTE: This cannot be properly polyfilled in engines that don't support + // the 'y' flag. + function (regexp, limit) { + var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit); + if (res.done) return res.value; + + var rx = anObject(regexp); + var S = String(this); + var C = speciesConstructor(rx, RegExp); + + var unicodeMatching = rx.unicode; + var flags = (rx.ignoreCase ? 'i' : '') + + (rx.multiline ? 'm' : '') + + (rx.unicode ? 'u' : '') + + (SUPPORTS_Y ? 'y' : 'g'); + + // ^(? + rx + ) is needed, in combination with some S slicing, to + // simulate the 'y' flag. + var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); + var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; + if (lim === 0) return []; + if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : []; + var p = 0; + var q = 0; + var A = []; + while (q < S.length) { + splitter.lastIndex = SUPPORTS_Y ? q : 0; + var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q)); + var e; + if ( + z === null || + (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p + ) { + q = advanceStringIndex(S, q, unicodeMatching); + } else { + A.push(S.slice(p, q)); + if (A.length === lim) return A; + for (var i = 1; i <= z.length - 1; i++) { + A.push(z[i]); + if (A.length === lim) return A; + } + q = p = e; + } + } + A.push(S.slice(p)); + return A; + } + ]; + }, !SUPPORTS_Y); + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + var objectKeys = Object.keys || function keys(O) { + return objectKeysInternal(O, enumBugKeys); + }; + + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = objectKeys(Properties); + var length = keys.length; + var index = 0; + var key; + while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]); + return O; + }; + + var html = getBuiltIn('document', 'documentElement'); + + var GT = '>'; + var LT = '<'; + var PROTOTYPE = 'prototype'; + var SCRIPT = 'script'; + var IE_PROTO$1 = sharedKey('IE_PROTO'); + + var EmptyConstructor = function () { /* empty */ }; + + var scriptTag = function (content) { + return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; + }; + + // Create object with fake `null` prototype: use ActiveX Object with cleared prototype + var NullProtoObjectViaActiveX = function (activeXDocument) { + activeXDocument.write(scriptTag('')); + activeXDocument.close(); + var temp = activeXDocument.parentWindow.Object; + activeXDocument = null; // avoid memory leak + return temp; + }; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var NullProtoObjectViaIFrame = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = documentCreateElement('iframe'); + var JS = 'java' + SCRIPT + ':'; + var iframeDocument; + iframe.style.display = 'none'; + html.appendChild(iframe); + // https://github.com/zloirock/core-js/issues/475 + iframe.src = String(JS); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(scriptTag('document.F=Object')); + iframeDocument.close(); + return iframeDocument.F; + }; + + // Check for document.domain and active x support + // No need to use active x approach when document.domain is not set + // see https://github.com/es-shims/es5-shim/issues/150 + // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 + // avoid IE GC bug + var activeXDocument; + var NullProtoObject = function () { + try { + /* global ActiveXObject -- old IE */ + activeXDocument = document.domain && new ActiveXObject('htmlfile'); + } catch (error) { /* ignore */ } + NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); + var length = enumBugKeys.length; + while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; + return NullProtoObject(); + }; + + hiddenKeys$1[IE_PROTO$1] = true; + + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + var objectCreate = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + EmptyConstructor[PROTOTYPE] = anObject(O); + result = new EmptyConstructor(); + EmptyConstructor[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO$1] = O; + } else result = NullProtoObject(); + return Properties === undefined ? result : objectDefineProperties(result, Properties); + }; + + var UNSCOPABLES = wellKnownSymbol('unscopables'); + var ArrayPrototype = Array.prototype; + + // Array.prototype[@@unscopables] + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + if (ArrayPrototype[UNSCOPABLES] == undefined) { + objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, { + configurable: true, + value: objectCreate(null) + }); + } + + // add a key to Array.prototype[@@unscopables] + var addToUnscopables = function (key) { + ArrayPrototype[UNSCOPABLES][key] = true; + }; + + var $includes = arrayIncludes.includes; + + + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + _export({ target: 'Array', proto: true }, { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + addToUnscopables('includes'); + + // `IsArray` abstract operation + // https://tc39.es/ecma262/#sec-isarray + var isArray = Array.isArray || function isArray(arg) { + return classofRaw(arg) == 'Array'; + }; + + // `ToObject` abstract operation + // https://tc39.es/ecma262/#sec-toobject + var toObject = function (argument) { + return Object(requireObjectCoercible(argument)); + }; + + var createProperty = function (object, key, value) { + var propertyKey = toPrimitive(key); + if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); + else object[propertyKey] = value; + }; + + var SPECIES$3 = wellKnownSymbol('species'); + + // `ArraySpeciesCreate` abstract operation + // https://tc39.es/ecma262/#sec-arrayspeciescreate + var arraySpeciesCreate = function (originalArray, length) { + var C; + if (isArray(originalArray)) { + C = originalArray.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + else if (isObject(C)) { + C = C[SPECIES$3]; + if (C === null) C = undefined; + } + } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); + }; + + var SPECIES$2 = wellKnownSymbol('species'); + + var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/677 + return engineV8Version >= 51 || !fails(function () { + var array = []; + var constructor = array.constructor = {}; + constructor[SPECIES$2] = function () { + return { foo: 1 }; + }; + return array[METHOD_NAME](Boolean).foo !== 1; + }); + }; + + var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); + var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; + var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; + + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/679 + var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () { + var array = []; + array[IS_CONCAT_SPREADABLE] = false; + return array.concat()[0] !== array; + }); + + var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); + + var isConcatSpreadable = function (O) { + if (!isObject(O)) return false; + var spreadable = O[IS_CONCAT_SPREADABLE]; + return spreadable !== undefined ? !!spreadable : isArray(O); + }; + + var FORCED$4 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; + + // `Array.prototype.concat` method + // https://tc39.es/ecma262/#sec-array.prototype.concat + // with adding support of @@isConcatSpreadable and @@species + _export({ target: 'Array', proto: true, forced: FORCED$4 }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + concat: function concat(arg) { + var O = toObject(this); + var A = arraySpeciesCreate(O, 0); + var n = 0; + var i, k, length, len, E; + for (i = -1, length = arguments.length; i < length; i++) { + E = i === -1 ? O : arguments[i]; + if (isConcatSpreadable(E)) { + len = toLength(E.length); + if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); + } else { + if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + createProperty(A, n++, E); + } + } + A.length = n; + return A; + } + }); + + // optional / simple context binding + var functionBindContext = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 0: return function () { + return fn.call(that); + }; + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; + }; + + var push = [].push; + + // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation + var createMethod$1 = function (TYPE) { + var IS_MAP = TYPE == 1; + var IS_FILTER = TYPE == 2; + var IS_SOME = TYPE == 3; + var IS_EVERY = TYPE == 4; + var IS_FIND_INDEX = TYPE == 6; + var IS_FILTER_OUT = TYPE == 7; + var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; + return function ($this, callbackfn, that, specificCreate) { + var O = toObject($this); + var self = indexedObject(O); + var boundFunction = functionBindContext(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var create = specificCreate || arraySpeciesCreate; + var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined; + var value, result; + for (;length > index; index++) if (NO_HOLES || index in self) { + value = self[index]; + result = boundFunction(value, index, O); + if (TYPE) { + if (IS_MAP) target[index] = result; // map + else if (result) switch (TYPE) { + case 3: return true; // some + case 5: return value; // find + case 6: return index; // findIndex + case 2: push.call(target, value); // filter + } else switch (TYPE) { + case 4: return false; // every + case 7: push.call(target, value); // filterOut + } + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; + }; + }; + + var arrayIteration = { + // `Array.prototype.forEach` method + // https://tc39.es/ecma262/#sec-array.prototype.foreach + forEach: createMethod$1(0), + // `Array.prototype.map` method + // https://tc39.es/ecma262/#sec-array.prototype.map + map: createMethod$1(1), + // `Array.prototype.filter` method + // https://tc39.es/ecma262/#sec-array.prototype.filter + filter: createMethod$1(2), + // `Array.prototype.some` method + // https://tc39.es/ecma262/#sec-array.prototype.some + some: createMethod$1(3), + // `Array.prototype.every` method + // https://tc39.es/ecma262/#sec-array.prototype.every + every: createMethod$1(4), + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + find: createMethod$1(5), + // `Array.prototype.findIndex` method + // https://tc39.es/ecma262/#sec-array.prototype.findIndex + findIndex: createMethod$1(6), + // `Array.prototype.filterOut` method + // https://github.com/tc39/proposal-array-filtering + filterOut: createMethod$1(7) + }; + + var $find = arrayIteration.find; + + + var FIND = 'find'; + var SKIPS_HOLES$1 = true; + + // Shouldn't skip holes + if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; }); + + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + addToUnscopables(FIND); + + var notARegexp = function (it) { + if (isRegexp(it)) { + throw TypeError("The method doesn't accept regular expressions"); + } return it; + }; + + var MATCH$1 = wellKnownSymbol('match'); + + var correctIsRegexpLogic = function (METHOD_NAME) { + var regexp = /./; + try { + '/./'[METHOD_NAME](regexp); + } catch (error1) { + try { + regexp[MATCH$1] = false; + return '/./'[METHOD_NAME](regexp); + } catch (error2) { /* empty */ } + } return false; + }; + + // `String.prototype.includes` method + // https://tc39.es/ecma262/#sec-string.prototype.includes + _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, { + includes: function includes(searchString /* , position = 0 */) { + return !!~String(requireObjectCoercible(this)) + .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined); + } + }); + + // iterable DOM collections + // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods + var domIterables = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 + }; + + var $forEach = arrayIteration.forEach; + + + var STRICT_METHOD$2 = arrayMethodIsStrict('forEach'); + + // `Array.prototype.forEach` method implementation + // https://tc39.es/ecma262/#sec-array.prototype.foreach + var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } : [].forEach; + + for (var COLLECTION_NAME$1 in domIterables) { + var Collection$1 = global_1[COLLECTION_NAME$1]; + var CollectionPrototype$1 = Collection$1 && Collection$1.prototype; + // some Chrome versions have non-configurable methods on DOMTokenList + if (CollectionPrototype$1 && CollectionPrototype$1.forEach !== arrayForEach) try { + createNonEnumerableProperty(CollectionPrototype$1, 'forEach', arrayForEach); + } catch (error) { + CollectionPrototype$1.forEach = arrayForEach; + } + } + + var trim$2 = stringTrim.trim; + + + var $parseFloat = global_1.parseFloat; + var FORCED$3 = 1 / $parseFloat(whitespaces + '-0') !== -Infinity; + + // `parseFloat` method + // https://tc39.es/ecma262/#sec-parsefloat-string + var numberParseFloat = FORCED$3 ? function parseFloat(string) { + var trimmedString = trim$2(String(string)); + var result = $parseFloat(trimmedString); + return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result; + } : $parseFloat; + + // `parseFloat` method + // https://tc39.es/ecma262/#sec-parsefloat-string + _export({ global: true, forced: parseFloat != numberParseFloat }, { + parseFloat: numberParseFloat + }); + + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + + // `Object.{ entries, values }` methods implementation + var createMethod = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!descriptors || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; + }; + + var objectToArray = { + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + entries: createMethod(true), + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + values: createMethod(false) + }; + + var $entries = objectToArray.entries; + + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + _export({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); + } + }); + + var $indexOf = arrayIncludes.indexOf; + + + var nativeIndexOf = [].indexOf; + + var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; + var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf'); + + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 }, { + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + return NEGATIVE_ZERO + // convert -0 to +0 + ? nativeIndexOf.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var test$2 = []; + var nativeSort = test$2.sort; + + // IE8- + var FAILS_ON_UNDEFINED = fails(function () { + test$2.sort(undefined); + }); + // V8 bug + var FAILS_ON_NULL = fails(function () { + test$2.sort(null); + }); + // Old WebKit + var STRICT_METHOD = arrayMethodIsStrict('sort'); + + var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD; + + // `Array.prototype.sort` method + // https://tc39.es/ecma262/#sec-array.prototype.sort + _export({ target: 'Array', proto: true, forced: FORCED$2 }, { + sort: function sort(comparefn) { + return comparefn === undefined + ? nativeSort.call(toObject(this)) + : nativeSort.call(toObject(this), aFunction(comparefn)); + } + }); + + var floor = Math.floor; + var replace = ''.replace; + var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; + var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; + + // https://tc39.es/ecma262/#sec-getsubstitution + var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) { + var tailPos = position + matched.length; + var m = captures.length; + var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; + if (namedCaptures !== undefined) { + namedCaptures = toObject(namedCaptures); + symbols = SUBSTITUTION_SYMBOLS; + } + return replace.call(replacement, symbols, function (match, ch) { + var capture; + switch (ch.charAt(0)) { + case '$': return '$'; + case '&': return matched; + case '`': return str.slice(0, position); + case "'": return str.slice(tailPos); + case '<': + capture = namedCaptures[ch.slice(1, -1)]; + break; + default: // \d\d? + var n = +ch; + if (n === 0) return match; + if (n > m) { + var f = floor(n / 10); + if (f === 0) return match; + if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); + return match; + } + capture = captures[n - 1]; + } + return capture === undefined ? '' : capture; + }); + }; + + var max$2 = Math.max; + var min$3 = Math.min; + + var maybeToString = function (it) { + return it === undefined ? it : String(it); + }; + + // @@replace logic + fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) { + var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE; + var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0; + var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; + + return [ + // `String.prototype.replace` method + // https://tc39.es/ecma262/#sec-string.prototype.replace + function replace(searchValue, replaceValue) { + var O = requireObjectCoercible(this); + var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; + return replacer !== undefined + ? replacer.call(searchValue, O, replaceValue) + : nativeReplace.call(String(O), searchValue, replaceValue); + }, + // `RegExp.prototype[@@replace]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace + function (regexp, replaceValue) { + if ( + (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) || + (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1) + ) { + var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); + if (res.done) return res.value; + } + + var rx = anObject(regexp); + var S = String(this); + + var functionalReplace = typeof replaceValue === 'function'; + if (!functionalReplace) replaceValue = String(replaceValue); + + var global = rx.global; + if (global) { + var fullUnicode = rx.unicode; + rx.lastIndex = 0; + } + var results = []; + while (true) { + var result = regexpExecAbstract(rx, S); + if (result === null) break; + + results.push(result); + if (!global) break; + + var matchStr = String(result[0]); + if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); + } + + var accumulatedResult = ''; + var nextSourcePosition = 0; + for (var i = 0; i < results.length; i++) { + result = results[i]; + + var matched = String(result[0]); + var position = max$2(min$3(toInteger(result.index), S.length), 0); + var captures = []; + // NOTE: This is equivalent to + // captures = result.slice(1).map(maybeToString) + // but for some reason `nativeSlice.call(result, 1, result.length)` (called in + // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and + // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. + for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); + var namedCaptures = result.groups; + if (functionalReplace) { + var replacerArgs = [matched].concat(captures, position, S); + if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); + var replacement = String(replaceValue.apply(undefined, replacerArgs)); + } else { + replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); + } + if (position >= nextSourcePosition) { + accumulatedResult += S.slice(nextSourcePosition, position) + replacement; + nextSourcePosition = position + matched.length; + } + } + return accumulatedResult + S.slice(nextSourcePosition); + } + ]; + }); + + var nativeAssign = Object.assign; + var defineProperty$3 = Object.defineProperty; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + var objectAssign = !nativeAssign || fails(function () { + // should have correct order of operations (Edge bug) + if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$3({}, 'a', { + enumerable: true, + get: function () { + defineProperty$3(this, 'b', { + value: 3, + enumerable: false + }); + } + }), { b: 2 })).b !== 1) return true; + // should work with symbols and should have deterministic property order (V8 bug) + var A = {}; + var B = {}; + /* global Symbol -- required for testing */ + var symbol = Symbol(); + var alphabet = 'abcdefghijklmnopqrst'; + A[symbol] = 7; + alphabet.split('').forEach(function (chr) { B[chr] = chr; }); + return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; + }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` + var T = toObject(target); + var argumentsLength = arguments.length; + var index = 1; + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + while (argumentsLength > index) { + var S = indexedObject(arguments[index++]); + var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) { + key = keys[j++]; + if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; + } + } return T; + } : nativeAssign; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { + assign: objectAssign + }); + + var $filter = arrayIteration.filter; + + + var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('filter'); + + // `Array.prototype.filter` method + // https://tc39.es/ecma262/#sec-array.prototype.filter + // with adding support of @@species + _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, { + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + // `SameValue` abstract operation + // https://tc39.es/ecma262/#sec-samevalue + var sameValue = Object.is || function is(x, y) { + // eslint-disable-next-line no-self-compare -- NaN check + return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; + }; + + // @@search logic + fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { + return [ + // `String.prototype.search` method + // https://tc39.es/ecma262/#sec-string.prototype.search + function search(regexp) { + var O = requireObjectCoercible(this); + var searcher = regexp == undefined ? undefined : regexp[SEARCH]; + return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, + // `RegExp.prototype[@@search]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@search + function (regexp) { + var res = maybeCallNative(nativeSearch, regexp, this); + if (res.done) return res.value; + + var rx = anObject(regexp); + var S = String(this); + + var previousLastIndex = rx.lastIndex; + if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0; + var result = regexpExecAbstract(rx, S); + if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; + return result === null ? -1 : result.index; + } + ]; + }); + + var trim$1 = stringTrim.trim; + + + var $parseInt = global_1.parseInt; + var hex = /^[+-]?0[Xx]/; + var FORCED$1 = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22; + + // `parseInt` method + // https://tc39.es/ecma262/#sec-parseint-string-radix + var numberParseInt = FORCED$1 ? function parseInt(string, radix) { + var S = trim$1(String(string)); + return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); + } : $parseInt; + + // `parseInt` method + // https://tc39.es/ecma262/#sec-parseint-string-radix + _export({ global: true, forced: parseInt != numberParseInt }, { + parseInt: numberParseInt + }); + + var $map = arrayIteration.map; + + + var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map'); + + // `Array.prototype.map` method + // https://tc39.es/ecma262/#sec-array.prototype.map + // with adding support of @@species + _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, { + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var $findIndex = arrayIteration.findIndex; + + + var FIND_INDEX = 'findIndex'; + var SKIPS_HOLES = true; + + // Shouldn't skip holes + if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); + + // `Array.prototype.findIndex` method + // https://tc39.es/ecma262/#sec-array.prototype.findindex + _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { + findIndex: function findIndex(callbackfn /* , that = undefined */) { + return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + addToUnscopables(FIND_INDEX); + + var aPossiblePrototype = function (it) { + if (!isObject(it) && it !== null) { + throw TypeError("Can't set " + String(it) + ' as a prototype'); + } return it; + }; + + /* eslint-disable no-proto -- safe */ + + + + // `Object.setPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.setprototypeof + // Works with __proto__ only. Old v8 can't work with null proto objects. + var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var CORRECT_SETTER = false; + var test = {}; + var setter; + try { + setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; + setter.call(test, []); + CORRECT_SETTER = test instanceof Array; + } catch (error) { /* empty */ } + return function setPrototypeOf(O, proto) { + anObject(O); + aPossiblePrototype(proto); + if (CORRECT_SETTER) setter.call(O, proto); + else O.__proto__ = proto; + return O; + }; + }() : undefined); + + // makes subclassing work correct for wrapped built-ins + var inheritIfRequired = function ($this, dummy, Wrapper) { + var NewTarget, NewTargetPrototype; + if ( + // it can work only with native `setPrototypeOf` + objectSetPrototypeOf && + // we haven't completely correct pre-ES6 way for getting `new.target`, so use this + typeof (NewTarget = dummy.constructor) == 'function' && + NewTarget !== Wrapper && + isObject(NewTargetPrototype = NewTarget.prototype) && + NewTargetPrototype !== Wrapper.prototype + ) objectSetPrototypeOf($this, NewTargetPrototype); + return $this; + }; + + var SPECIES$1 = wellKnownSymbol('species'); + + var setSpecies = function (CONSTRUCTOR_NAME) { + var Constructor = getBuiltIn(CONSTRUCTOR_NAME); + var defineProperty = objectDefineProperty.f; + + if (descriptors && Constructor && !Constructor[SPECIES$1]) { + defineProperty(Constructor, SPECIES$1, { + configurable: true, + get: function () { return this; } + }); + } + }; + + var defineProperty$2 = objectDefineProperty.f; + var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; + + + + + + var setInternalState$1 = internalState.set; + + + + var MATCH = wellKnownSymbol('match'); + var NativeRegExp = global_1.RegExp; + var RegExpPrototype$1 = NativeRegExp.prototype; + var re1 = /a/g; + var re2 = /a/g; + + // "new" should create a new object, old webkit bug + var CORRECT_NEW = new NativeRegExp(re1) !== re1; + + var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y; + + var FORCED = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () { + re2[MATCH] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; + }))); + + // `RegExp` constructor + // https://tc39.es/ecma262/#sec-regexp-constructor + if (FORCED) { + var RegExpWrapper = function RegExp(pattern, flags) { + var thisIsRegExp = this instanceof RegExpWrapper; + var patternIsRegExp = isRegexp(pattern); + var flagsAreUndefined = flags === undefined; + var sticky; + + if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) { + return pattern; + } + + if (CORRECT_NEW) { + if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source; + } else if (pattern instanceof RegExpWrapper) { + if (flagsAreUndefined) flags = regexpFlags.call(pattern); + pattern = pattern.source; + } + + if (UNSUPPORTED_Y) { + sticky = !!flags && flags.indexOf('y') > -1; + if (sticky) flags = flags.replace(/y/g, ''); + } + + var result = inheritIfRequired( + CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), + thisIsRegExp ? this : RegExpPrototype$1, + RegExpWrapper + ); + + if (UNSUPPORTED_Y && sticky) setInternalState$1(result, { sticky: sticky }); + + return result; + }; + var proxy = function (key) { + key in RegExpWrapper || defineProperty$2(RegExpWrapper, key, { + configurable: true, + get: function () { return NativeRegExp[key]; }, + set: function (it) { NativeRegExp[key] = it; } + }); + }; + var keys$1 = getOwnPropertyNames$1(NativeRegExp); + var index = 0; + while (keys$1.length > index) proxy(keys$1[index++]); + RegExpPrototype$1.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$1; + redefine(global_1, 'RegExp', RegExpWrapper); + } + + // https://tc39.es/ecma262/#sec-get-regexp-@@species + setSpecies('RegExp'); + + var TO_STRING = 'toString'; + var RegExpPrototype = RegExp.prototype; + var nativeToString = RegExpPrototype[TO_STRING]; + + var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); + // FF44- RegExp#toString has a wrong name + var INCORRECT_NAME = nativeToString.name != TO_STRING; + + // `RegExp.prototype.toString` method + // https://tc39.es/ecma262/#sec-regexp.prototype.tostring + if (NOT_GENERIC || INCORRECT_NAME) { + redefine(RegExp.prototype, TO_STRING, function toString() { + var R = anObject(this); + var p = String(R.source); + var rf = R.flags; + var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf); + return '/' + p + '/' + f; + }, { unsafe: true }); + } + + var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag'); + var test$1 = {}; + + test$1[TO_STRING_TAG$3] = 'z'; + + var toStringTagSupport = String(test$1) === '[object z]'; + + var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag'); + // ES3 wrong here + var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function (it, key) { + try { + return it[key]; + } catch (error) { /* empty */ } + }; + + // getting tag from ES6+ `Object.prototype.toString` + var classof = toStringTagSupport ? classofRaw : function (it) { + var O, tag, result; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag + // builtinTag case + : CORRECT_ARGUMENTS ? classofRaw(O) + // ES3 arguments fallback + : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; + }; + + // `Object.prototype.toString` method implementation + // https://tc39.es/ecma262/#sec-object.prototype.tostring + var objectToString = toStringTagSupport ? {}.toString : function toString() { + return '[object ' + classof(this) + ']'; + }; + + // `Object.prototype.toString` method + // https://tc39.es/ecma262/#sec-object.prototype.tostring + if (!toStringTagSupport) { + redefine(Object.prototype, 'toString', objectToString, { unsafe: true }); + } + + var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice'); + + var SPECIES = wellKnownSymbol('species'); + var nativeSlice = [].slice; + var max$1 = Math.max; + + // `Array.prototype.slice` method + // https://tc39.es/ecma262/#sec-array.prototype.slice + // fallback for not array-like ES3 strings and DOM objects + _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, { + slice: function slice(start, end) { + var O = toIndexedObject(this); + var length = toLength(O.length); + var k = toAbsoluteIndex(start, length); + var fin = toAbsoluteIndex(end === undefined ? length : end, length); + // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible + var Constructor, result, n; + if (isArray(O)) { + Constructor = O.constructor; + // cross-realm fallback + if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { + Constructor = undefined; + } else if (isObject(Constructor)) { + Constructor = Constructor[SPECIES]; + if (Constructor === null) Constructor = undefined; + } + if (Constructor === Array || Constructor === undefined) { + return nativeSlice.call(O, k, fin); + } + } + result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0)); + for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); + result.length = n; + return result; + } + }); + + var correctPrototypeGetter = !fails(function () { + function F() { /* empty */ } + F.prototype.constructor = null; + return Object.getPrototypeOf(new F()) !== F.prototype; + }); + + var IE_PROTO = sharedKey('IE_PROTO'); + var ObjectPrototype = Object.prototype; + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { + O = toObject(O); + if (has$1(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectPrototype : null; + }; + + var ITERATOR$2 = wellKnownSymbol('iterator'); + var BUGGY_SAFARI_ITERATORS$1 = false; + + var returnThis$1 = function () { return this; }; + + // `%IteratorPrototype%` object + // https://tc39.es/ecma262/#sec-%iteratorprototype%-object + var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator; + + if ([].keys) { + arrayIterator = [].keys(); + // Safari 8 has buggy iterators w/o `next` + if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true; + else { + PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)); + if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype; + } + } + + var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () { + var test = {}; + // FF44- legacy iterators case + return IteratorPrototype$2[ITERATOR$2].call(test) !== test; + }); + + if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {}; + + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + if (!has$1(IteratorPrototype$2, ITERATOR$2)) { + createNonEnumerableProperty(IteratorPrototype$2, ITERATOR$2, returnThis$1); + } + + var iteratorsCore = { + IteratorPrototype: IteratorPrototype$2, + BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1 + }; + + var defineProperty$1 = objectDefineProperty.f; + + + + var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); + + var setToStringTag = function (it, TAG, STATIC) { + if (it && !has$1(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) { + defineProperty$1(it, TO_STRING_TAG$1, { configurable: true, value: TAG }); + } + }; + + var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; + + var createIteratorConstructor = function (IteratorConstructor, NAME, next) { + var TO_STRING_TAG = NAME + ' Iterator'; + IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) }); + setToStringTag(IteratorConstructor, TO_STRING_TAG, false); + return IteratorConstructor; + }; + + var IteratorPrototype = iteratorsCore.IteratorPrototype; + var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS; + var ITERATOR$1 = wellKnownSymbol('iterator'); + var KEYS = 'keys'; + var VALUES = 'values'; + var ENTRIES = 'entries'; + + var returnThis = function () { return this; }; + + var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { + createIteratorConstructor(IteratorConstructor, NAME, next); + + var getIterationMethod = function (KIND) { + if (KIND === DEFAULT && defaultIterator) return defaultIterator; + if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; + switch (KIND) { + case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; + case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; + case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; + } return function () { return new IteratorConstructor(this); }; + }; + + var TO_STRING_TAG = NAME + ' Iterator'; + var INCORRECT_VALUES_NAME = false; + var IterablePrototype = Iterable.prototype; + var nativeIterator = IterablePrototype[ITERATOR$1] + || IterablePrototype['@@iterator'] + || DEFAULT && IterablePrototype[DEFAULT]; + var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); + var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; + var CurrentIteratorPrototype, methods, KEY; + + // fix native + if (anyNativeIterator) { + CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable())); + if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { + if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { + if (objectSetPrototypeOf) { + objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); + } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') { + createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis); + } + } + // Set @@toStringTag to native iterators + setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true); + } + } + + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + INCORRECT_VALUES_NAME = true; + defaultIterator = function values() { return nativeIterator.call(this); }; + } + + // define iterator + if (IterablePrototype[ITERATOR$1] !== defaultIterator) { + createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator); + } + + // export additional methods + if (DEFAULT) { + methods = { + values: getIterationMethod(VALUES), + keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), + entries: getIterationMethod(ENTRIES) + }; + if (FORCED) for (KEY in methods) { + if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { + redefine(IterablePrototype, KEY, methods[KEY]); + } + } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); + } + + return methods; + }; + + var ARRAY_ITERATOR = 'Array Iterator'; + var setInternalState = internalState.set; + var getInternalState = internalState.getterFor(ARRAY_ITERATOR); + + // `Array.prototype.entries` method + // https://tc39.es/ecma262/#sec-array.prototype.entries + // `Array.prototype.keys` method + // https://tc39.es/ecma262/#sec-array.prototype.keys + // `Array.prototype.values` method + // https://tc39.es/ecma262/#sec-array.prototype.values + // `Array.prototype[@@iterator]` method + // https://tc39.es/ecma262/#sec-array.prototype-@@iterator + // `CreateArrayIterator` internal method + // https://tc39.es/ecma262/#sec-createarrayiterator + var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { + setInternalState(this, { + type: ARRAY_ITERATOR, + target: toIndexedObject(iterated), // target + index: 0, // next index + kind: kind // kind + }); + // `%ArrayIteratorPrototype%.next` method + // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next + }, function () { + var state = getInternalState(this); + var target = state.target; + var kind = state.kind; + var index = state.index++; + if (!target || index >= target.length) { + state.target = undefined; + return { value: undefined, done: true }; + } + if (kind == 'keys') return { value: index, done: false }; + if (kind == 'values') return { value: target[index], done: false }; + return { value: [index, target[index]], done: false }; + }, 'values'); + + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); + + var ITERATOR = wellKnownSymbol('iterator'); + var TO_STRING_TAG = wellKnownSymbol('toStringTag'); + var ArrayValues = es_array_iterator.values; + + for (var COLLECTION_NAME in domIterables) { + var Collection = global_1[COLLECTION_NAME]; + var CollectionPrototype = Collection && Collection.prototype; + if (CollectionPrototype) { + // some Chrome versions have non-configurable methods on DOMTokenList + if (CollectionPrototype[ITERATOR] !== ArrayValues) try { + createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues); + } catch (error) { + CollectionPrototype[ITERATOR] = ArrayValues; + } + if (!CollectionPrototype[TO_STRING_TAG]) { + createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); + } + if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) { + // some Chrome versions have non-configurable methods on DOMTokenList + if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try { + createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]); + } catch (error) { + CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME]; + } + } + } + } + + var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); + + var max = Math.max; + var min$2 = Math.min; + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; + var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; + + // `Array.prototype.splice` method + // https://tc39.es/ecma262/#sec-array.prototype.splice + // with adding support of @@species + _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { + splice: function splice(start, deleteCount /* , ...items */) { + var O = toObject(this); + var len = toLength(O.length); + var actualStart = toAbsoluteIndex(start, len); + var argumentsLength = arguments.length; + var insertCount, actualDeleteCount, A, k, from, to; + if (argumentsLength === 0) { + insertCount = actualDeleteCount = 0; + } else if (argumentsLength === 1) { + insertCount = 0; + actualDeleteCount = len - actualStart; + } else { + insertCount = argumentsLength - 2; + actualDeleteCount = min$2(max(toInteger(deleteCount), 0), len - actualStart); + } + if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { + throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); + } + A = arraySpeciesCreate(O, actualDeleteCount); + for (k = 0; k < actualDeleteCount; k++) { + from = actualStart + k; + if (from in O) createProperty(A, k, O[from]); + } + A.length = actualDeleteCount; + if (insertCount < actualDeleteCount) { + for (k = actualStart; k < len - actualDeleteCount; k++) { + from = k + actualDeleteCount; + to = k + insertCount; + if (from in O) O[to] = O[from]; + else delete O[to]; + } + for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; + } else if (insertCount > actualDeleteCount) { + for (k = len - actualDeleteCount; k > actualStart; k--) { + from = k + actualDeleteCount - 1; + to = k + insertCount - 1; + if (from in O) O[to] = O[from]; + else delete O[to]; + } + } + for (k = 0; k < insertCount; k++) { + O[k + actualStart] = arguments[k + 2]; + } + O.length = len - actualDeleteCount + insertCount; + return A; + } + }); + + var getOwnPropertyNames = objectGetOwnPropertyNames.f; + var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; + var defineProperty = objectDefineProperty.f; + var trim = stringTrim.trim; + + var NUMBER = 'Number'; + var NativeNumber = global_1[NUMBER]; + var NumberPrototype = NativeNumber.prototype; + + // Opera ~12 has broken Object#toString + var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER; + + // `ToNumber` abstract operation + // https://tc39.es/ecma262/#sec-tonumber + var toNumber = function (argument) { + var it = toPrimitive(argument, false); + var first, third, radix, maxCode, digits, length, index, code; + if (typeof it == 'string' && it.length > 2) { + it = trim(it); + first = it.charCodeAt(0); + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i + case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i + default: return +it; + } + digits = it.slice(2); + length = digits.length; + for (index = 0; index < length; index++) { + code = digits.charCodeAt(index); + // parseInt parses a string to a first unavailable symbol + // but ToNumber should return NaN if a string contains unavailable symbols + if (code < 48 || code > maxCode) return NaN; + } return parseInt(digits, radix); + } + } return +it; + }; + + // `Number` constructor + // https://tc39.es/ecma262/#sec-number-constructor + if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { + var NumberWrapper = function Number(value) { + var it = arguments.length < 1 ? 0 : value; + var dummy = this; + return dummy instanceof NumberWrapper + // check on 1..constructor(foo) case + && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER) + ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it); + }; + for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : ( + // ES3: + 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES2015 (in case, if modules with ES2015 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' + + // ESNext + 'fromString,range' + ).split(','), j = 0, key; keys.length > j; j++) { + if (has$1(NativeNumber, key = keys[j]) && !has$1(NumberWrapper, key)) { + defineProperty(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key)); + } + } + NumberWrapper.prototype = NumberPrototype; + NumberPrototype.constructor = NumberWrapper; + redefine(global_1, NUMBER, NumberWrapper); + } + + var nativeReverse = [].reverse; + var test = [1, 2]; + + // `Array.prototype.reverse` method + // https://tc39.es/ecma262/#sec-array.prototype.reverse + // fix for Safari 12.0 bug + // https://bugs.webkit.org/show_bug.cgi?id=188794 + _export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { + reverse: function reverse() { + // eslint-disable-next-line no-self-assign -- dirty hack + if (isArray(this)) this.length = this.length; + return nativeReverse.call(this); + } + }); + + /* eslint-disable no-unused-vars */ + + var VERSION = '1.18.3'; + var bootstrapVersion = 4; + + try { + var rawVersion = $__default['default'].fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined. + // It is undefined in older versions of Bootstrap (tested with 3.1.1). + + if (rawVersion !== undefined) { + bootstrapVersion = parseInt(rawVersion, 10); + } + } catch (e) {// ignore + } + + try { + // eslint-disable-next-line no-undef + var _rawVersion = bootstrap.Tooltip.VERSION; + + if (_rawVersion !== undefined) { + bootstrapVersion = parseInt(_rawVersion, 10); + } + } catch (e) {// ignore + } + + var CONSTANTS = { + 3: { + iconsPrefix: 'glyphicon', + icons: { + paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down', + paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up', + refresh: 'glyphicon-refresh icon-refresh', + toggleOff: 'glyphicon-list-alt icon-list-alt', + toggleOn: 'glyphicon-list-alt icon-list-alt', + columns: 'glyphicon-th icon-th', + detailOpen: 'glyphicon-plus icon-plus', + detailClose: 'glyphicon-minus icon-minus', + fullscreen: 'glyphicon-fullscreen', + search: 'glyphicon-search', + clearSearch: 'glyphicon-trash' + }, + classes: { + buttonsPrefix: 'btn', + buttons: 'default', + buttonsGroup: 'btn-group', + buttonsDropdown: 'btn-group', + pull: 'pull', + inputGroup: 'input-group', + inputPrefix: 'input-', + input: 'form-control', + paginationDropdown: 'btn-group dropdown', + dropup: 'dropup', + dropdownActive: 'active', + paginationActive: 'active', + buttonActive: 'active' + }, + html: { + toolbarDropdown: [''], + toolbarDropdownItem: '', + toolbarDropdownSeparator: '
  • ', + pageDropdown: [''], + pageDropdownItem: '
    ', + dropdownCaret: '', + pagination: ['
      ', '
    '], + paginationItem: '
  • %s
  • ', + icon: '', + inputGroup: '
    %s%s
    ', + searchInput: '', + searchButton: '', + searchClearButton: '' + } + }, + 4: { + iconsPrefix: 'fa', + icons: { + paginationSwitchDown: 'fa-caret-square-down', + paginationSwitchUp: 'fa-caret-square-up', + refresh: 'fa-sync', + toggleOff: 'fa-toggle-off', + toggleOn: 'fa-toggle-on', + columns: 'fa-th-list', + detailOpen: 'fa-plus', + detailClose: 'fa-minus', + fullscreen: 'fa-arrows-alt', + search: 'fa-search', + clearSearch: 'fa-trash' + }, + classes: { + buttonsPrefix: 'btn', + buttons: 'secondary', + buttonsGroup: 'btn-group', + buttonsDropdown: 'btn-group', + pull: 'float', + inputGroup: 'btn-group', + inputPrefix: 'form-control-', + input: 'form-control', + paginationDropdown: 'btn-group dropdown', + dropup: 'dropup', + dropdownActive: 'active', + paginationActive: 'active', + buttonActive: 'active' + }, + html: { + toolbarDropdown: [''], + toolbarDropdownItem: '', + pageDropdown: [''], + pageDropdownItem: '%s', + toolbarDropdownSeparator: '', + dropdownCaret: '', + pagination: ['
      ', '
    '], + paginationItem: '
  • %s
  • ', + icon: '', + inputGroup: '
    %s
    %s
    ', + searchInput: '', + searchButton: '', + searchClearButton: '' + } + }, + 5: { + iconsPrefix: 'fa', + icons: { + paginationSwitchDown: 'fa-caret-square-down', + paginationSwitchUp: 'fa-caret-square-up', + refresh: 'fa-sync', + toggleOff: 'fa-toggle-off', + toggleOn: 'fa-toggle-on', + columns: 'fa-th-list', + detailOpen: 'fa-plus', + detailClose: 'fa-minus', + fullscreen: 'fa-arrows-alt', + search: 'fa-search', + clearSearch: 'fa-trash' + }, + classes: { + buttonsPrefix: 'btn', + buttons: 'secondary', + buttonsGroup: 'btn-group', + buttonsDropdown: 'btn-group', + pull: 'float', + inputGroup: 'btn-group', + inputPrefix: 'form-control-', + input: 'form-control', + paginationDropdown: 'btn-group dropdown', + dropup: 'dropup', + dropdownActive: 'active', + paginationActive: 'active', + buttonActive: 'active' + }, + html: { + dataToggle: 'data-bs-toggle', + toolbarDropdown: [''], + toolbarDropdownItem: '', + pageDropdown: [''], + pageDropdownItem: '%s', + toolbarDropdownSeparator: '', + dropdownCaret: '', + pagination: ['
      ', '
    '], + paginationItem: '
  • %s
  • ', + icon: '', + inputGroup: '
    %s
    %s
    ', + searchInput: '', + searchButton: '', + searchClearButton: '' + } + } + }[bootstrapVersion]; + var DEFAULTS = { + height: undefined, + classes: 'table table-bordered table-hover', + buttons: {}, + theadClasses: '', + headerStyle: function headerStyle(column) { + return {}; + }, + rowStyle: function rowStyle(row, index) { + return {}; + }, + rowAttributes: function rowAttributes(row, index) { + return {}; + }, + undefinedText: '-', + locale: undefined, + virtualScroll: false, + virtualScrollItemHeight: undefined, + sortable: true, + sortClass: undefined, + silentSort: true, + sortName: undefined, + sortOrder: undefined, + sortReset: false, + sortStable: false, + rememberOrder: false, + serverSort: true, + customSort: undefined, + columns: [[]], + data: [], + url: undefined, + method: 'get', + cache: true, + contentType: 'application/json', + dataType: 'json', + ajax: undefined, + ajaxOptions: {}, + queryParams: function queryParams(params) { + return params; + }, + queryParamsType: 'limit', + // 'limit', undefined + responseHandler: function responseHandler(res) { + return res; + }, + totalField: 'total', + totalNotFilteredField: 'totalNotFiltered', + dataField: 'rows', + footerField: 'footer', + pagination: false, + paginationParts: ['pageInfo', 'pageSize', 'pageList'], + showExtendedPagination: false, + paginationLoop: true, + sidePagination: 'client', + // client or server + totalRows: 0, + totalNotFiltered: 0, + pageNumber: 1, + pageSize: 10, + pageList: [10, 25, 50, 100], + paginationHAlign: 'right', + // right, left + paginationVAlign: 'bottom', + // bottom, top, both + paginationDetailHAlign: 'left', + // right, left + paginationPreText: '‹', + paginationNextText: '›', + paginationSuccessivelySize: 5, + // Maximum successively number of pages in a row + paginationPagesBySide: 1, + // Number of pages on each side (right, left) of the current page. + paginationUseIntermediate: false, + // Calculate intermediate pages for quick access + search: false, + searchHighlight: false, + searchOnEnterKey: false, + strictSearch: false, + searchSelector: false, + visibleSearch: false, + showButtonIcons: true, + showButtonText: false, + showSearchButton: false, + showSearchClearButton: false, + trimOnSearch: true, + searchAlign: 'right', + searchTimeOut: 500, + searchText: '', + customSearch: undefined, + showHeader: true, + showFooter: false, + footerStyle: function footerStyle(column) { + return {}; + }, + searchAccentNeutralise: false, + showColumns: false, + showColumnsToggleAll: false, + showColumnsSearch: false, + minimumCountColumns: 1, + showPaginationSwitch: false, + showRefresh: false, + showToggle: false, + showFullscreen: false, + smartDisplay: true, + escape: false, + filterOptions: { + filterAlgorithm: 'and' + }, + idField: undefined, + selectItemName: 'btSelectItem', + clickToSelect: false, + ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) { + var tagName = _ref.tagName; + return ['A', 'BUTTON'].includes(tagName); + }, + singleSelect: false, + checkboxHeader: true, + maintainMetaData: false, + multipleSelectRow: false, + uniqueId: undefined, + cardView: false, + detailView: false, + detailViewIcon: true, + detailViewByClick: false, + detailViewAlign: 'left', + detailFormatter: function detailFormatter(index, row) { + return ''; + }, + detailFilter: function detailFilter(index, row) { + return true; + }, + toolbar: undefined, + toolbarAlign: 'left', + buttonsToolbar: undefined, + buttonsAlign: 'right', + buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'], + buttonsPrefix: CONSTANTS.classes.buttonsPrefix, + buttonsClass: CONSTANTS.classes.buttons, + icons: CONSTANTS.icons, + iconSize: undefined, + iconsPrefix: CONSTANTS.iconsPrefix, + // glyphicon or fa(font-awesome) + loadingFontSize: 'auto', + loadingTemplate: function loadingTemplate(loadingMessage) { + return "\n ".concat(loadingMessage, "\n \n \n "); + }, + onAll: function onAll(name, args) { + return false; + }, + onClickCell: function onClickCell(field, value, row, $element) { + return false; + }, + onDblClickCell: function onDblClickCell(field, value, row, $element) { + return false; + }, + onClickRow: function onClickRow(item, $element) { + return false; + }, + onDblClickRow: function onDblClickRow(item, $element) { + return false; + }, + onSort: function onSort(name, order) { + return false; + }, + onCheck: function onCheck(row) { + return false; + }, + onUncheck: function onUncheck(row) { + return false; + }, + onCheckAll: function onCheckAll(rows) { + return false; + }, + onUncheckAll: function onUncheckAll(rows) { + return false; + }, + onCheckSome: function onCheckSome(rows) { + return false; + }, + onUncheckSome: function onUncheckSome(rows) { + return false; + }, + onLoadSuccess: function onLoadSuccess(data) { + return false; + }, + onLoadError: function onLoadError(status) { + return false; + }, + onColumnSwitch: function onColumnSwitch(field, checked) { + return false; + }, + onPageChange: function onPageChange(number, size) { + return false; + }, + onSearch: function onSearch(text) { + return false; + }, + onToggle: function onToggle(cardView) { + return false; + }, + onPreBody: function onPreBody(data) { + return false; + }, + onPostBody: function onPostBody() { + return false; + }, + onPostHeader: function onPostHeader() { + return false; + }, + onPostFooter: function onPostFooter() { + return false; + }, + onExpandRow: function onExpandRow(index, row, $detail) { + return false; + }, + onCollapseRow: function onCollapseRow(index, row) { + return false; + }, + onRefreshOptions: function onRefreshOptions(options) { + return false; + }, + onRefresh: function onRefresh(params) { + return false; + }, + onResetView: function onResetView() { + return false; + }, + onScrollBody: function onScrollBody() { + return false; + } + }; + var EN = { + formatLoadingMessage: function formatLoadingMessage() { + return 'Loading, please wait'; + }, + formatRecordsPerPage: function formatRecordsPerPage(pageNumber) { + return "".concat(pageNumber, " rows per page"); + }, + formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) { + if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) { + return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)"); + } + + return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows"); + }, + formatSRPaginationPreText: function formatSRPaginationPreText() { + return 'previous page'; + }, + formatSRPaginationPageText: function formatSRPaginationPageText(page) { + return "to page ".concat(page); + }, + formatSRPaginationNextText: function formatSRPaginationNextText() { + return 'next page'; + }, + formatDetailPagination: function formatDetailPagination(totalRows) { + return "Showing ".concat(totalRows, " rows"); + }, + formatSearch: function formatSearch() { + return 'Search'; + }, + formatClearSearch: function formatClearSearch() { + return 'Clear Search'; + }, + formatNoMatches: function formatNoMatches() { + return 'No matching records found'; + }, + formatPaginationSwitch: function formatPaginationSwitch() { + return 'Hide/Show pagination'; + }, + formatPaginationSwitchDown: function formatPaginationSwitchDown() { + return 'Show pagination'; + }, + formatPaginationSwitchUp: function formatPaginationSwitchUp() { + return 'Hide pagination'; + }, + formatRefresh: function formatRefresh() { + return 'Refresh'; + }, + formatToggle: function formatToggle() { + return 'Toggle'; + }, + formatToggleOn: function formatToggleOn() { + return 'Show card view'; + }, + formatToggleOff: function formatToggleOff() { + return 'Hide card view'; + }, + formatColumns: function formatColumns() { + return 'Columns'; + }, + formatColumnsToggleAll: function formatColumnsToggleAll() { + return 'Toggle all'; + }, + formatFullscreen: function formatFullscreen() { + return 'Fullscreen'; + }, + formatAllRows: function formatAllRows() { + return 'All'; + } + }; + var COLUMN_DEFAULTS = { + field: undefined, + title: undefined, + titleTooltip: undefined, + class: undefined, + width: undefined, + widthUnit: 'px', + rowspan: undefined, + colspan: undefined, + align: undefined, + // left, right, center + halign: undefined, + // left, right, center + falign: undefined, + // left, right, center + valign: undefined, + // top, middle, bottom + cellStyle: undefined, + radio: false, + checkbox: false, + checkboxEnabled: true, + clickToSelect: true, + showSelectTitle: false, + sortable: false, + sortName: undefined, + order: 'asc', + // asc, desc + sorter: undefined, + visible: true, + switchable: true, + cardVisible: true, + searchable: true, + formatter: undefined, + footerFormatter: undefined, + detailFormatter: undefined, + searchFormatter: true, + searchHighlightFormatter: false, + escape: false, + events: undefined + }; + var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText']; + var EVENTS = { + 'all.bs.table': 'onAll', + 'click-row.bs.table': 'onClickRow', + 'dbl-click-row.bs.table': 'onDblClickRow', + 'click-cell.bs.table': 'onClickCell', + 'dbl-click-cell.bs.table': 'onDblClickCell', + 'sort.bs.table': 'onSort', + 'check.bs.table': 'onCheck', + 'uncheck.bs.table': 'onUncheck', + 'check-all.bs.table': 'onCheckAll', + 'uncheck-all.bs.table': 'onUncheckAll', + 'check-some.bs.table': 'onCheckSome', + 'uncheck-some.bs.table': 'onUncheckSome', + 'load-success.bs.table': 'onLoadSuccess', + 'load-error.bs.table': 'onLoadError', + 'column-switch.bs.table': 'onColumnSwitch', + 'page-change.bs.table': 'onPageChange', + 'search.bs.table': 'onSearch', + 'toggle.bs.table': 'onToggle', + 'pre-body.bs.table': 'onPreBody', + 'post-body.bs.table': 'onPostBody', + 'post-header.bs.table': 'onPostHeader', + 'post-footer.bs.table': 'onPostFooter', + 'expand-row.bs.table': 'onExpandRow', + 'collapse-row.bs.table': 'onCollapseRow', + 'refresh-options.bs.table': 'onRefreshOptions', + 'reset-view.bs.table': 'onResetView', + 'refresh.bs.table': 'onRefresh', + 'scroll-body.bs.table': 'onScrollBody' + }; + Object.assign(DEFAULTS, EN); + var Constants = { + VERSION: VERSION, + THEME: "bootstrap".concat(bootstrapVersion), + CONSTANTS: CONSTANTS, + DEFAULTS: DEFAULTS, + COLUMN_DEFAULTS: COLUMN_DEFAULTS, + METHODS: METHODS, + EVENTS: EVENTS, + LOCALES: { + en: EN, + 'en-US': EN + } + }; + + var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); }); + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { + keys: function keys(it) { + return objectKeys(toObject(it)); + } + }); + + var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; + + + + + + + var nativeStartsWith = ''.startsWith; + var min$1 = Math.min; + + var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith'); + // https://github.com/zloirock/core-js/pull/702 + var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () { + var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith'); + return descriptor && !descriptor.writable; + }(); + + // `String.prototype.startsWith` method + // https://tc39.es/ecma262/#sec-string.prototype.startswith + _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, { + startsWith: function startsWith(searchString /* , position = 0 */) { + var that = String(requireObjectCoercible(this)); + notARegexp(searchString); + var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var search = String(searchString); + return nativeStartsWith + ? nativeStartsWith.call(that, search, index) + : that.slice(index, index + search.length) === search; + } + }); + + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + + + + + + + var nativeEndsWith = ''.endsWith; + var min = Math.min; + + var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith'); + // https://github.com/zloirock/core-js/pull/702 + var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () { + var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith'); + return descriptor && !descriptor.writable; + }(); + + // `String.prototype.endsWith` method + // https://tc39.es/ecma262/#sec-string.prototype.endswith + _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { + endsWith: function endsWith(searchString /* , endPosition = @length */) { + var that = String(requireObjectCoercible(this)); + notARegexp(searchString); + var endPosition = arguments.length > 1 ? arguments[1] : undefined; + var len = toLength(that.length); + var end = endPosition === undefined ? len : min(toLength(endPosition), len); + var search = String(searchString); + return nativeEndsWith + ? nativeEndsWith.call(that, search, end) + : that.slice(end - search.length, end) === search; + } + }); + + var Utils = { + getSearchInput: function getSearchInput(that) { + if (typeof that.options.searchSelector === 'string') { + return $__default['default'](that.options.searchSelector); + } + + return that.$toolbar.find('.search input'); + }, + // it only does '%s', and return '' when arguments are undefined + sprintf: function sprintf(_str) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var flag = true; + var i = 0; + + var str = _str.replace(/%s/g, function () { + var arg = args[i++]; + + if (typeof arg === 'undefined') { + flag = false; + return ''; + } + + return arg; + }); + + return flag ? str : ''; + }, + isObject: function isObject(val) { + return val instanceof Object && !Array.isArray(val); + }, + isEmptyObject: function isEmptyObject() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + return Object.entries(obj).length === 0 && obj.constructor === Object; + }, + isNumeric: function isNumeric(n) { + return !isNaN(parseFloat(n)) && isFinite(n); + }, + getFieldTitle: function getFieldTitle(list, value) { + var _iterator = _createForOfIteratorHelper(list), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var item = _step.value; + + if (item.field === value) { + return item.title; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return ''; + }, + setFieldIndex: function setFieldIndex(columns) { + var totalCol = 0; + var flag = []; + + var _iterator2 = _createForOfIteratorHelper(columns[0]), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var column = _step2.value; + totalCol += column.colspan || 1; + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + + for (var i = 0; i < columns.length; i++) { + flag[i] = []; + + for (var j = 0; j < totalCol; j++) { + flag[i][j] = false; + } + } + + for (var _i = 0; _i < columns.length; _i++) { + var _iterator3 = _createForOfIteratorHelper(columns[_i]), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var r = _step3.value; + var rowspan = r.rowspan || 1; + var colspan = r.colspan || 1; + + var index = flag[_i].indexOf(false); + + r.colspanIndex = index; + + if (colspan === 1) { + r.fieldIndex = index; // when field is undefined, use index instead + + if (typeof r.field === 'undefined') { + r.field = index; + } + } else { + r.colspanGroup = r.colspan; + } + + for (var _j = 0; _j < rowspan; _j++) { + for (var k = 0; k < colspan; k++) { + flag[_i + _j][index + k] = true; + } + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } + }, + normalizeAccent: function normalizeAccent(value) { + if (typeof value !== 'string') { + return value; + } + + return value.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); + }, + updateFieldGroup: function updateFieldGroup(columns) { + var _ref; + + var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns)); + + var _iterator4 = _createForOfIteratorHelper(columns), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var c = _step4.value; + + var _iterator5 = _createForOfIteratorHelper(c), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var r = _step5.value; + + if (r.colspanGroup > 1) { + var colspan = 0; + + var _loop = function _loop(i) { + var column = allColumns.find(function (col) { + return col.fieldIndex === i; + }); + + if (column.visible) { + colspan++; + } + }; + + for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) { + _loop(i); + } + + r.colspan = colspan; + r.visible = colspan > 0; + } + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + }, + getScrollBarWidth: function getScrollBarWidth() { + if (this.cachedWidth === undefined) { + var $inner = $__default['default']('
    ').addClass('fixed-table-scroll-inner'); + var $outer = $__default['default']('
    ').addClass('fixed-table-scroll-outer'); + $outer.append($inner); + $__default['default']('body').append($outer); + var w1 = $inner[0].offsetWidth; + $outer.css('overflow', 'scroll'); + var w2 = $inner[0].offsetWidth; + + if (w1 === w2) { + w2 = $outer[0].clientWidth; + } + + $outer.remove(); + this.cachedWidth = w1 - w2; + } + + return this.cachedWidth; + }, + calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) { + var func = name; + + if (typeof name === 'string') { + // support obj.func1.func2 + var names = name.split('.'); + + if (names.length > 1) { + func = window; + + var _iterator6 = _createForOfIteratorHelper(names), + _step6; + + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var f = _step6.value; + func = func[f]; + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + } else { + func = window[name]; + } + } + + if (func !== null && _typeof(func) === 'object') { + return func; + } + + if (typeof func === 'function') { + return func.apply(self, args || []); + } + + if (!func && typeof name === 'string' && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) { + return this.sprintf.apply(this, [name].concat(_toConsumableArray(args))); + } + + return defaultValue; + }, + compareObjects: function compareObjects(objectA, objectB, compareLength) { + var aKeys = Object.keys(objectA); + var bKeys = Object.keys(objectB); + + if (compareLength && aKeys.length !== bKeys.length) { + return false; + } + + for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) { + var key = _aKeys[_i2]; + + if (bKeys.includes(key) && objectA[key] !== objectB[key]) { + return false; + } + } + + return true; + }, + escapeHTML: function escapeHTML(text) { + if (typeof text === 'string') { + return text.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/`/g, '`'); + } + + return text; + }, + unescapeHTML: function unescapeHTML(text) { + if (typeof text === 'string') { + return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '\'').replace(/`/g, '`'); + } + + return text; + }, + getRealDataAttr: function getRealDataAttr(dataAttr) { + for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2), + attr = _Object$entries$_i[0], + value = _Object$entries$_i[1]; + + var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase(); + + if (auxAttr !== attr) { + dataAttr[auxAttr] = value; + delete dataAttr[attr]; + } + } + + return dataAttr; + }, + getItemField: function getItemField(item, field, escape) { + var value = item; + + if (typeof field !== 'string' || item.hasOwnProperty(field)) { + return escape ? this.escapeHTML(item[field]) : item[field]; + } + + var props = field.split('.'); + + var _iterator7 = _createForOfIteratorHelper(props), + _step7; + + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var p = _step7.value; + value = value && value[p]; + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } + + return escape ? this.escapeHTML(value) : value; + }, + isIEBrowser: function isIEBrowser() { + return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent); + }, + findIndex: function findIndex(items, item) { + var _iterator8 = _createForOfIteratorHelper(items), + _step8; + + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + var it = _step8.value; + + if (JSON.stringify(it) === JSON.stringify(item)) { + return items.indexOf(it); + } + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + + return -1; + }, + trToData: function trToData(columns, $els) { + var _this = this; + + var data = []; + var m = []; + $els.each(function (y, el) { + var $el = $__default['default'](el); + var row = {}; // save tr's id, class and data-* attributes + + row._id = $el.attr('id'); + row._class = $el.attr('class'); + row._data = _this.getRealDataAttr($el.data()); + row._style = $el.attr('style'); + $el.find('>td,>th').each(function (_x, el) { + var $el = $__default['default'](el); + var cspan = +$el.attr('colspan') || 1; + var rspan = +$el.attr('rowspan') || 1; + var x = _x; // skip already occupied cells in current row + + for (; m[y] && m[y][x]; x++) {// ignore + } // mark matrix elements occupied by current cell with true + + + for (var tx = x; tx < x + cspan; tx++) { + for (var ty = y; ty < y + rspan; ty++) { + if (!m[ty]) { + // fill missing rows + m[ty] = []; + } + + m[ty][tx] = true; + } + } + + var field = columns[x].field; + row[field] = $el.html().trim(); // save td's id, class and data-* attributes + + row["_".concat(field, "_id")] = $el.attr('id'); + row["_".concat(field, "_class")] = $el.attr('class'); + row["_".concat(field, "_rowspan")] = $el.attr('rowspan'); + row["_".concat(field, "_colspan")] = $el.attr('colspan'); + row["_".concat(field, "_title")] = $el.attr('title'); + row["_".concat(field, "_data")] = _this.getRealDataAttr($el.data()); + row["_".concat(field, "_style")] = $el.attr('style'); + }); + data.push(row); + }); + return data; + }, + sort: function sort(a, b, order, sortStable, aPosition, bPosition) { + if (a === undefined || a === null) { + a = ''; + } + + if (b === undefined || b === null) { + b = ''; + } + + if (sortStable && a === b) { + a = aPosition; + b = bPosition; + } // If both values are numeric, do a numeric comparison + + + if (this.isNumeric(a) && this.isNumeric(b)) { + // Convert numerical values form string to float. + a = parseFloat(a); + b = parseFloat(b); + + if (a < b) { + return order * -1; + } + + if (a > b) { + return order; + } + + return 0; + } + + if (a === b) { + return 0; + } // If value is not a string, convert to string + + + if (typeof a !== 'string') { + a = a.toString(); + } + + if (a.localeCompare(b) === -1) { + return order * -1; + } + + return order; + }, + getEventName: function getEventName(eventPrefix) { + var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000)); + return "".concat(eventPrefix, "-").concat(id); + }, + hasDetailViewIcon: function hasDetailViewIcon(options) { + return options.detailView && options.detailViewIcon && !options.cardView; + }, + getDetailViewIndexOffset: function getDetailViewIndexOffset(options) { + return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0; + }, + checkAutoMergeCells: function checkAutoMergeCells(data) { + var _iterator9 = _createForOfIteratorHelper(data), + _step9; + + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { + var row = _step9.value; + + for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) { + var key = _Object$keys[_i4]; + + if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) { + return true; + } + } + } + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); + } + + return false; + }, + deepCopy: function deepCopy(arg) { + if (arg === undefined) { + return arg; + } + + return $__default['default'].extend(true, Array.isArray(arg) ? [] : {}, arg); + } + }; + + var BLOCK_ROWS = 50; + var CLUSTER_BLOCKS = 4; + + var VirtualScroll = /*#__PURE__*/function () { + function VirtualScroll(options) { + var _this = this; + + _classCallCheck(this, VirtualScroll); + + this.rows = options.rows; + this.scrollEl = options.scrollEl; + this.contentEl = options.contentEl; + this.callback = options.callback; + this.itemHeight = options.itemHeight; + this.cache = {}; + this.scrollTop = this.scrollEl.scrollTop; + this.initDOM(this.rows, options.fixedScroll); + this.scrollEl.scrollTop = this.scrollTop; + this.lastCluster = 0; + + var onScroll = function onScroll() { + if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) { + _this.initDOM(_this.rows); + + _this.callback(); + } + }; + + this.scrollEl.addEventListener('scroll', onScroll, false); + + this.destroy = function () { + _this.contentEl.innerHtml = ''; + + _this.scrollEl.removeEventListener('scroll', onScroll, false); + }; + } + + _createClass(VirtualScroll, [{ + key: "initDOM", + value: function initDOM(rows, fixedScroll) { + if (typeof this.clusterHeight === 'undefined') { + this.cache.scrollTop = this.scrollEl.scrollTop; + this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0]; + this.getRowsHeight(rows); + } + + var data = this.initData(rows, this.getNum(fixedScroll)); + var thisRows = data.rows.join(''); + var dataChanged = this.checkChanges('data', thisRows); + var topOffsetChanged = this.checkChanges('top', data.topOffset); + var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset); + var html = []; + + if (dataChanged && topOffsetChanged) { + if (data.topOffset) { + html.push(this.getExtra('top', data.topOffset)); + } + + html.push(thisRows); + + if (data.bottomOffset) { + html.push(this.getExtra('bottom', data.bottomOffset)); + } + + this.contentEl.innerHTML = html.join(''); + + if (fixedScroll) { + this.contentEl.scrollTop = this.cache.scrollTop; + } + } else if (bottomOffsetChanged) { + this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px"); + } + } + }, { + key: "getRowsHeight", + value: function getRowsHeight() { + if (typeof this.itemHeight === 'undefined') { + var nodes = this.contentEl.children; + var node = nodes[Math.floor(nodes.length / 2)]; + this.itemHeight = node.offsetHeight; + } + + this.blockHeight = this.itemHeight * BLOCK_ROWS; + this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS; + this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS; + } + }, { + key: "getNum", + value: function getNum(fixedScroll) { + this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop; + return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0; + } + }, { + key: "initData", + value: function initData(rows, num) { + if (rows.length < BLOCK_ROWS) { + return { + topOffset: 0, + bottomOffset: 0, + rowsAbove: 0, + rows: rows + }; + } + + var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0); + var end = start + this.clusterRows; + var topOffset = Math.max(start * this.itemHeight, 0); + var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0); + var thisRows = []; + var rowsAbove = start; + + if (topOffset < 1) { + rowsAbove++; + } + + for (var i = start; i < end; i++) { + rows[i] && thisRows.push(rows[i]); + } + + return { + topOffset: topOffset, + bottomOffset: bottomOffset, + rowsAbove: rowsAbove, + rows: thisRows + }; + } + }, { + key: "checkChanges", + value: function checkChanges(type, value) { + var changed = value !== this.cache[type]; + this.cache[type] = value; + return changed; + } + }, { + key: "getExtra", + value: function getExtra(className, height) { + var tag = document.createElement('tr'); + tag.className = "virtual-scroll-".concat(className); + + if (height) { + tag.style.height = "".concat(height, "px"); + } + + return tag.outerHTML; + } + }]); + + return VirtualScroll; + }(); + + var BootstrapTable = /*#__PURE__*/function () { + function BootstrapTable(el, options) { + _classCallCheck(this, BootstrapTable); + + this.options = options; + this.$el = $__default['default'](el); + this.$el_ = this.$el.clone(); + this.timeoutId_ = 0; + this.timeoutFooter_ = 0; + } + + _createClass(BootstrapTable, [{ + key: "init", + value: function init() { + this.initConstants(); + this.initLocale(); + this.initContainer(); + this.initTable(); + this.initHeader(); + this.initData(); + this.initHiddenRows(); + this.initToolbar(); + this.initPagination(); + this.initBody(); + this.initSearchText(); + this.initServer(); + } + }, { + key: "initConstants", + value: function initConstants() { + var opts = this.options; + this.constants = Constants.CONSTANTS; + this.constants.theme = $__default['default'].fn.bootstrapTable.theme; + this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle'; + var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : ''; + this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim(); + this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {}); + + if (_typeof(this.buttons) !== 'object') { + this.buttons = {}; + } + + if (typeof opts.icons === 'string') { + opts.icons = Utils.calculateObjectValue(null, opts.icons); + } + } + }, { + key: "initLocale", + value: function initLocale() { + if (this.options.locale) { + var locales = $__default['default'].fn.bootstrapTable.locales; + var parts = this.options.locale.split(/-|_/); + parts[0] = parts[0].toLowerCase(); + + if (parts[1]) { + parts[1] = parts[1].toUpperCase(); + } + + if (locales[this.options.locale]) { + $__default['default'].extend(this.options, locales[this.options.locale]); + } else if (locales[parts.join('-')]) { + $__default['default'].extend(this.options, locales[parts.join('-')]); + } else if (locales[parts[0]]) { + $__default['default'].extend(this.options, locales[parts[0]]); + } + } + } + }, { + key: "initContainer", + value: function initContainer() { + var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '
    ' : ''; + var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '
    ' : ''; + var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]); + this.$container = $__default['default']("\n
    \n
    \n ").concat(topPagination, "\n
    \n
    \n
    \n
    \n ").concat(loadingTemplate, "\n
    \n
    \n
    \n
    \n ").concat(bottomPagination, "\n
    \n ")); + this.$container.insertAfter(this.$el); + this.$tableContainer = this.$container.find('.fixed-table-container'); + this.$tableHeader = this.$container.find('.fixed-table-header'); + this.$tableBody = this.$container.find('.fixed-table-body'); + this.$tableLoading = this.$container.find('.fixed-table-loading'); + this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not + + if (this.options.buttonsToolbar) { + this.$toolbar = $__default['default']('body').find(this.options.buttonsToolbar); + } else { + this.$toolbar = this.$container.find('.fixed-table-toolbar'); + } + + this.$pagination = this.$container.find('.fixed-table-pagination'); + this.$tableBody.append(this.$el); + this.$container.after('
    '); + this.$el.addClass(this.options.classes); + this.$tableLoading.addClass(this.options.classes); + + if (this.options.height) { + this.$tableContainer.addClass('fixed-height'); + + if (this.options.showFooter) { + this.$tableContainer.addClass('has-footer'); + } + + if (this.options.classes.split(' ').includes('table-bordered')) { + this.$tableBody.append('
    '); + this.$tableBorder = this.$tableBody.find('.fixed-table-border'); + this.$tableLoading.addClass('fixed-table-border'); + } + + this.$tableFooter = this.$container.find('.fixed-table-footer'); + } + } + }, { + key: "initTable", + value: function initTable() { + var _this = this; + + var columns = []; + this.$header = this.$el.find('>thead'); + + if (!this.$header.length) { + this.$header = $__default['default']("")).appendTo(this.$el); + } else if (this.options.theadClasses) { + this.$header.addClass(this.options.theadClasses); + } + + this._headerTrClasses = []; + this._headerTrStyles = []; + this.$header.find('tr').each(function (i, el) { + var $tr = $__default['default'](el); + var column = []; + $tr.find('th').each(function (i, el) { + var $th = $__default['default'](el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not + + if (typeof $th.data('field') !== 'undefined') { + $th.data('field', "".concat($th.data('field'))); + } + + column.push($__default['default'].extend({}, { + title: $th.html(), + class: $th.attr('class'), + titleTooltip: $th.attr('title'), + rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined, + colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined + }, $th.data())); + }); + columns.push(column); + + if ($tr.attr('class')) { + _this._headerTrClasses.push($tr.attr('class')); + } + + if ($tr.attr('style')) { + _this._headerTrStyles.push($tr.attr('style')); + } + }); + + if (!Array.isArray(this.options.columns[0])) { + this.options.columns = [this.options.columns]; + } + + this.options.columns = $__default['default'].extend(true, [], columns, this.options.columns); + this.columns = []; + this.fieldsColumnsIndex = []; + Utils.setFieldIndex(this.options.columns); + this.options.columns.forEach(function (columns, i) { + columns.forEach(function (_column, j) { + var column = $__default['default'].extend({}, BootstrapTable.COLUMN_DEFAULTS, _column); + + if (typeof column.fieldIndex !== 'undefined') { + _this.columns[column.fieldIndex] = column; + _this.fieldsColumnsIndex[column.field] = column.fieldIndex; + } + + _this.options.columns[i][j] = column; + }); + }); // if options.data is setting, do not process tbody and tfoot data + + if (!this.options.data.length) { + var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr')); + + if (htmlData.length) { + this.options.data = htmlData; + this.fromHtml = true; + } + } + + if (!(this.options.pagination && this.options.sidePagination !== 'server')) { + this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr')); + } + + if (this.footerData) { + this.$el.find('tfoot').html(''); + } + + if (!this.options.showFooter || this.options.cardView) { + this.$tableFooter.hide(); + } else { + this.$tableFooter.show(); + } + } + }, { + key: "initHeader", + value: function initHeader() { + var _this2 = this; + + var visibleColumns = {}; + var headerHtml = []; + this.header = { + fields: [], + styles: [], + classes: [], + formatters: [], + detailFormatters: [], + events: [], + sorters: [], + sortNames: [], + cellStyles: [], + searchables: [] + }; + Utils.updateFieldGroup(this.options.columns); + this.options.columns.forEach(function (columns, i) { + var html = []; + html.push("")); + var detailViewTemplate = ''; + + if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) { + var rowspan = _this2.options.columns.length > 1 ? " rowspan=\"".concat(_this2.options.columns.length, "\"") : ''; + detailViewTemplate = "\n
    \n "); + } + + if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') { + html.push(detailViewTemplate); + } + + columns.forEach(function (column, j) { + var class_ = Utils.sprintf(' class="%s"', column['class']); + var unitWidth = column.widthUnit; + var width = parseFloat(column.width); + var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align); + var align = Utils.sprintf('text-align: %s; ', column.align); + var style = Utils.sprintf('vertical-align: %s; ', column.valign); + style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined); + + if (typeof column.fieldIndex === 'undefined' && !column.visible) { + return; + } + + var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]); + var csses = []; + var classes = ''; + + if (headerStyle && headerStyle.css) { + for (var _i = 0, _Object$entries = Object.entries(headerStyle.css); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), + key = _Object$entries$_i[0], + value = _Object$entries$_i[1]; + + csses.push("".concat(key, ": ").concat(value)); + } + } + + if (headerStyle && headerStyle.classes) { + classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes); + } + + if (typeof column.fieldIndex !== 'undefined') { + _this2.header.fields[column.fieldIndex] = column.field; + _this2.header.styles[column.fieldIndex] = align + style; + _this2.header.classes[column.fieldIndex] = class_; + _this2.header.formatters[column.fieldIndex] = column.formatter; + _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter; + _this2.header.events[column.fieldIndex] = column.events; + _this2.header.sorters[column.fieldIndex] = column.sorter; + _this2.header.sortNames[column.fieldIndex] = column.sortName; + _this2.header.cellStyles[column.fieldIndex] = column.cellStyle; + _this2.header.searchables[column.fieldIndex] = column.searchable; + + if (!column.visible) { + return; + } + + if (_this2.options.cardView && !column.cardVisible) { + return; + } + + visibleColumns[column.field] = column; + } + + html.push(" 0 ? ' data-not-first-th' : '', '>'); + html.push(Utils.sprintf('
    ', _this2.options.sortable && column.sortable ? 'sortable both' : '')); + var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title; + var title = text; + + if (column.checkbox) { + text = ''; + + if (!_this2.options.singleSelect && _this2.options.checkboxHeader) { + text = ''; + } + + _this2.header.stateField = column.field; + } + + if (column.radio) { + text = ''; + _this2.header.stateField = column.field; + } + + if (!text && column.showSelectTitle) { + text += title; + } + + html.push(text); + html.push('
    '); + html.push('
    '); + html.push('
    '); + html.push(''); + }); + + if (detailViewTemplate && _this2.options.detailViewAlign === 'right') { + html.push(detailViewTemplate); + } + + html.push(''); + + if (html.length > 3) { + headerHtml.push(html.join('')); + } + }); + this.$header.html(headerHtml.join('')); + this.$header.find('th[data-field]').each(function (i, el) { + $__default['default'](el).data(visibleColumns[$__default['default'](el).data('field')]); + }); + this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) { + var $this = $__default['default'](e.currentTarget); + + if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) { + if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) { + return false; + } + } + + if (_this2.options.sortable && $this.parent().data().sortable) { + _this2.onSort(e); + } + }); + this.$header.children().children().off('keypress').on('keypress', function (e) { + if (_this2.options.sortable && $__default['default'](e.currentTarget).data().sortable) { + var code = e.keyCode || e.which; + + if (code === 13) { + // Enter keycode + _this2.onSort(e); + } + } + }); + var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id')); + $__default['default'](window).off(resizeEvent); + + if (!this.options.showHeader || this.options.cardView) { + this.$header.hide(); + this.$tableHeader.hide(); + this.$tableLoading.css('top', 0); + } else { + this.$header.show(); + this.$tableHeader.show(); + this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow + + this.getCaret(); + $__default['default'](window).on(resizeEvent, function () { + return _this2.resetView(); + }); + } + + this.$selectAll = this.$header.find('[name="btSelectAll"]'); + this.$selectAll.off('click').on('click', function (e) { + e.stopPropagation(); + var checked = $__default['default'](e.currentTarget).prop('checked'); + + _this2[checked ? 'checkAll' : 'uncheckAll'](); + + _this2.updateSelected(); + }); + } + }, { + key: "initData", + value: function initData(data, type) { + if (type === 'append') { + this.options.data = this.options.data.concat(data); + } else if (type === 'prepend') { + this.options.data = [].concat(data).concat(this.options.data); + } else { + data = data || Utils.deepCopy(this.options.data); + this.options.data = Array.isArray(data) ? data : data[this.options.dataField]; + } + + this.data = _toConsumableArray(this.options.data); + + if (this.options.sortReset) { + this.unsortedData = _toConsumableArray(this.data); + } + + if (this.options.sidePagination === 'server') { + return; + } + + this.initSort(); + } + }, { + key: "initSort", + value: function initSort() { + var _this3 = this; + + var name = this.options.sortName; + var order = this.options.sortOrder === 'desc' ? -1 : 1; + var index = this.header.fields.indexOf(this.options.sortName); + var timeoutId = 0; + + if (index !== -1) { + if (this.options.sortStable) { + this.data.forEach(function (row, i) { + if (!row.hasOwnProperty('_position')) { + row._position = i; + } + }); + } + + if (this.options.customSort) { + Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]); + } else { + this.data.sort(function (a, b) { + if (_this3.header.sortNames[index]) { + name = _this3.header.sortNames[index]; + } + + var aa = Utils.getItemField(a, name, _this3.options.escape); + var bb = Utils.getItemField(b, name, _this3.options.escape); + var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]); + + if (value !== undefined) { + if (_this3.options.sortStable && value === 0) { + return order * (a._position - b._position); + } + + return order * value; + } + + return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position); + }); + } + + if (this.options.sortClass !== undefined) { + clearTimeout(timeoutId); + timeoutId = setTimeout(function () { + _this3.$el.removeClass(_this3.options.sortClass); + + var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index(); + + _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass); + }, 250); + } + } else if (this.options.sortReset) { + this.data = _toConsumableArray(this.unsortedData); + } + } + }, { + key: "onSort", + value: function onSort(_ref) { + var type = _ref.type, + currentTarget = _ref.currentTarget; + var $this = type === 'keypress' ? $__default['default'](currentTarget) : $__default['default'](currentTarget).parent(); + var $this_ = this.$header.find('th').eq($this.index()); + this.$header.add(this.$header_).find('span.order').remove(); + + if (this.options.sortName === $this.data('field')) { + var currentSortOrder = this.options.sortOrder; + + if (currentSortOrder === undefined) { + this.options.sortOrder = 'asc'; + } else if (currentSortOrder === 'asc') { + this.options.sortOrder = 'desc'; + } else if (this.options.sortOrder === 'desc') { + this.options.sortOrder = this.options.sortReset ? undefined : 'asc'; + } + + if (this.options.sortOrder === undefined) { + this.options.sortName = undefined; + } + } else { + this.options.sortName = $this.data('field'); + + if (this.options.rememberOrder) { + this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc'; + } else { + this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order; + } + } + + this.trigger('sort', this.options.sortName, this.options.sortOrder); + $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow + + this.getCaret(); + + if (this.options.sidePagination === 'server' && this.options.serverSort) { + this.options.pageNumber = 1; + this.initServer(this.options.silentSort); + return; + } + + this.initSort(); + this.initBody(); + } + }, { + key: "initToolbar", + value: function initToolbar() { + var _this4 = this; + + var opts = this.options; + var html = []; + var timeoutId = 0; + var $keepOpen; + var switchableCount = 0; + + if (this.$toolbar.find('.bs-bars').children().length) { + $__default['default']('body').append($__default['default'](opts.toolbar)); + } + + this.$toolbar.html(''); + + if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') { + $__default['default'](Utils.sprintf('
    ', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($__default['default'](opts.toolbar)); + } // showColumns, showToggle, showRefresh + + + html = ["
    ")]; + + if (typeof opts.buttonsOrder === 'string') { + opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').split(','); + } + + this.buttons = Object.assign(this.buttons, { + paginationSwitch: { + text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(), + icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp, + render: false, + event: this.togglePagination, + attributes: { + 'aria-label': opts.formatPaginationSwitch(), + title: opts.formatPaginationSwitch() + } + }, + refresh: { + text: opts.formatRefresh(), + icon: opts.icons.refresh, + render: false, + event: this.refresh, + attributes: { + 'aria-label': opts.formatRefresh(), + title: opts.formatRefresh() + } + }, + toggle: { + text: opts.formatToggle(), + icon: opts.icons.toggleOff, + render: false, + event: this.toggleView, + attributes: { + 'aria-label': opts.formatToggleOn(), + title: opts.formatToggleOn() + } + }, + fullscreen: { + text: opts.formatFullscreen(), + icon: opts.icons.fullscreen, + render: false, + event: this.toggleFullscreen, + attributes: { + 'aria-label': opts.formatFullscreen(), + title: opts.formatFullscreen() + } + }, + columns: { + render: false, + html: function html() { + var html = []; + html.push("
    \n \n ").concat(_this4.constants.html.toolbarDropdown[0])); + + if (opts.showColumnsSearch) { + html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('', _this4.constants.classes.input, opts.formatSearch()))); + html.push(_this4.constants.html.toolbarDropdownSeparator); + } + + if (opts.showColumnsToggleAll) { + var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) { + return !_this4.isSelectionColumn(column); + }).length; + + html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf(' %s', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll()))); + html.push(_this4.constants.html.toolbarDropdownSeparator); + } + + var visibleColumns = 0; + + _this4.columns.forEach(function (column) { + if (column.visible) { + visibleColumns++; + } + }); + + _this4.columns.forEach(function (column, i) { + if (_this4.isSelectionColumn(column)) { + return; + } + + if (opts.cardView && !column.cardVisible) { + return; + } + + var checked = column.visible ? ' checked="checked"' : ''; + var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : ''; + + if (column.switchable) { + html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf(' %s', column.field, i, checked, disabled, column.title))); + switchableCount++; + } + }); + + html.push(_this4.constants.html.toolbarDropdown[1], '
    '); + return html.join(''); + } + } + }); + var buttonsHtml = {}; + + for (var _i2 = 0, _Object$entries2 = Object.entries(this.buttons); _i2 < _Object$entries2.length; _i2++) { + var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), + buttonName = _Object$entries2$_i[0], + buttonConfig = _Object$entries2$_i[1]; + + var buttonHtml = void 0; + + if (buttonConfig.hasOwnProperty('html')) { + if (typeof buttonConfig.html === 'function') { + buttonHtml = buttonConfig.html(); + } else if (typeof buttonConfig.html === 'string') { + buttonHtml = buttonConfig.html; + } + } else { + buttonHtml = "\n ").concat(this.constants.html.pageDropdown[0])]; + pageList.forEach(function (page, i) { + if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) { + var active; + + if (allSelected) { + active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : ''; + } else { + active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : ''; + } + + pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page)); + } + }); + pageNumber.push("".concat(this.constants.html.pageDropdown[1], "
    ")); + html.push(opts.formatRecordsPerPage(pageNumber.join(''))); + } + + if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) { + html.push('
    '); + } + + if (this.paginationParts.includes('pageList')) { + html.push("
    "), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText)); + + if (this.totalPages < opts.paginationSuccessivelySize) { + from = 1; + to = this.totalPages; + } else { + from = opts.pageNumber - opts.paginationPagesBySide; + to = from + opts.paginationPagesBySide * 2; + } + + if (opts.pageNumber < opts.paginationSuccessivelySize - 1) { + to = opts.paginationSuccessivelySize; + } + + if (opts.paginationSuccessivelySize > this.totalPages - from) { + from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1; + } + + if (from < 1) { + from = 1; + } + + if (to > this.totalPages) { + to = this.totalPages; + } + + var middleSize = Math.round(opts.paginationPagesBySide / 2); + + var pageItem = function pageItem(i) { + var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i); + }; + + if (from > 1) { + var max = opts.paginationPagesBySide; + if (max >= from) max = from - 1; + + for (i = 1; i <= max; i++) { + html.push(pageItem(i)); + } + + if (from - 1 === max + 1) { + i = from - 1; + html.push(pageItem(i)); + } else if (from - 1 > max) { + if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) { + i = Math.round((from - middleSize) / 2 + middleSize); + html.push(pageItem(i, ' page-intermediate')); + } else { + html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...')); + } + } + } + + for (i = from; i <= to; i++) { + html.push(pageItem(i)); + } + + if (this.totalPages > to) { + var min = this.totalPages - (opts.paginationPagesBySide - 1); + if (to >= min) min = to + 1; + + if (to + 1 === min - 1) { + i = to + 1; + html.push(pageItem(i)); + } else if (min > to + 1) { + if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) { + i = Math.round((this.totalPages - middleSize - to) / 2 + to); + html.push(pageItem(i, ' page-intermediate')); + } else { + html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...')); + } + } + + for (i = min; i <= this.totalPages; i++) { + html.push(pageItem(i)); + } + } + + html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText)); + html.push(this.constants.html.pagination[1], '
    '); + } + + this.$pagination.html(html.join('')); + var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : ''; + this.$pagination.last().find('.page-list > div').addClass(dropupClass); + + if (!opts.onlyInfoPagination) { + $pageList = this.$pagination.find('.page-list a'); + $pre = this.$pagination.find('.page-pre'); + $next = this.$pagination.find('.page-next'); + $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator'); + + if (this.totalPages <= 1) { + this.$pagination.find('div.pagination').hide(); + } + + if (opts.smartDisplay) { + if (pageList.length < 2 || opts.totalRows <= pageList[0]) { + this.$pagination.find('span.page-list').hide(); + } + } // when data is empty, hide the pagination + + + this.$pagination[this.getData().length ? 'show' : 'hide'](); + + if (!opts.paginationLoop) { + if (opts.pageNumber === 1) { + $pre.addClass('disabled'); + } + + if (opts.pageNumber === this.totalPages) { + $next.addClass('disabled'); + } + } + + if (allSelected) { + opts.pageSize = opts.formatAllRows(); + } // removed the events for last and first, onPageNumber executeds the same logic + + + $pageList.off('click').on('click', function (e) { + return _this6.onPageListChange(e); + }); + $pre.off('click').on('click', function (e) { + return _this6.onPagePre(e); + }); + $next.off('click').on('click', function (e) { + return _this6.onPageNext(e); + }); + $number.off('click').on('click', function (e) { + return _this6.onPageNumber(e); + }); + } + } + }, { + key: "updatePagination", + value: function updatePagination(event) { + // Fix #171: IE disabled button can be clicked bug. + if (event && $__default['default'](event.currentTarget).hasClass('disabled')) { + return; + } + + if (!this.options.maintainMetaData) { + this.resetRows(); + } + + this.initPagination(); + this.trigger('page-change', this.options.pageNumber, this.options.pageSize); + + if (this.options.sidePagination === 'server') { + this.initServer(); + } else { + this.initBody(); + } + } + }, { + key: "onPageListChange", + value: function onPageListChange(event) { + event.preventDefault(); + var $this = $__default['default'](event.currentTarget); + $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive); + this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text(); + this.$toolbar.find('.page-size').text(this.options.pageSize); + this.updatePagination(event); + return false; + } + }, { + key: "onPagePre", + value: function onPagePre(event) { + event.preventDefault(); + + if (this.options.pageNumber - 1 === 0) { + this.options.pageNumber = this.options.totalPages; + } else { + this.options.pageNumber--; + } + + this.updatePagination(event); + return false; + } + }, { + key: "onPageNext", + value: function onPageNext(event) { + event.preventDefault(); + + if (this.options.pageNumber + 1 > this.options.totalPages) { + this.options.pageNumber = 1; + } else { + this.options.pageNumber++; + } + + this.updatePagination(event); + return false; + } + }, { + key: "onPageNumber", + value: function onPageNumber(event) { + event.preventDefault(); + + if (this.options.pageNumber === +$__default['default'](event.currentTarget).text()) { + return; + } + + this.options.pageNumber = +$__default['default'](event.currentTarget).text(); + this.updatePagination(event); + return false; + } // eslint-disable-next-line no-unused-vars + + }, { + key: "initRow", + value: function initRow(item, i, data, trFragments) { + var _this7 = this; + + var html = []; + var style = {}; + var csses = []; + var data_ = ''; + var attributes = {}; + var htmlAttributes = []; + + if (Utils.findIndex(this.hiddenRows, item) > -1) { + return; + } + + style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style); + + if (style && style.css) { + for (var _i7 = 0, _Object$entries6 = Object.entries(style.css); _i7 < _Object$entries6.length; _i7++) { + var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2), + key = _Object$entries6$_i[0], + value = _Object$entries6$_i[1]; + + csses.push("".concat(key, ": ").concat(value)); + } + } + + attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes); + + if (attributes) { + for (var _i8 = 0, _Object$entries7 = Object.entries(attributes); _i8 < _Object$entries7.length; _i8++) { + var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2), + _key2 = _Object$entries7$_i[0], + _value = _Object$entries7$_i[1]; + + htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\"")); + } + } + + if (item._data && !Utils.isEmptyObject(item._data)) { + for (var _i9 = 0, _Object$entries8 = Object.entries(item._data); _i9 < _Object$entries8.length; _i9++) { + var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2), + k = _Object$entries8$_i[0], + v = _Object$entries8$_i[1]; + + // ignore data-index + if (k === 'index') { + return; + } + + data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'"); + } + } + + html.push(''); + + if (this.options.cardView) { + html.push("
    ")); + } + + var detailViewTemplate = ''; + + if (Utils.hasDetailViewIcon(this.options)) { + detailViewTemplate = ''; + + if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) { + detailViewTemplate += "\n \n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n \n "); + } + + detailViewTemplate += ''; + } + + if (detailViewTemplate && this.options.detailViewAlign !== 'right') { + html.push(detailViewTemplate); + } + + this.header.fields.forEach(function (field, j) { + var text = ''; + var value_ = Utils.getItemField(item, field, _this7.options.escape); + var value = ''; + var type = ''; + var cellStyle = {}; + var id_ = ''; + var class_ = _this7.header.classes[j]; + var style_ = ''; + var styleToAdd_ = ''; + var data_ = ''; + var rowspan_ = ''; + var colspan_ = ''; + var title_ = ''; + var column = _this7.columns[j]; + + if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') { + if (!column.checkbox && !column.radio) { + return; + } + } + + if (!column.visible) { + return; + } + + if (_this7.options.cardView && !column.cardVisible) { + return; + } + + if (column.escape) { + value_ = Utils.escapeHTML(value_); + } // Style concat + + + if (csses.concat([_this7.header.styles[j]]).length) { + styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; ')); + } + + if (item["_".concat(field, "_style")]) { + styleToAdd_ += "".concat(item["_".concat(field, "_style")]); + } + + if (styleToAdd_) { + style_ = " style=\"".concat(styleToAdd_, "\""); + } // Style concat + // handle id and class of td + + + if (item["_".concat(field, "_id")]) { + id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]); + } + + if (item["_".concat(field, "_class")]) { + class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]); + } + + if (item["_".concat(field, "_rowspan")]) { + rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]); + } + + if (item["_".concat(field, "_colspan")]) { + colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]); + } + + if (item["_".concat(field, "_title")]) { + title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]); + } + + cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle); + + if (cellStyle.classes) { + class_ = " class=\"".concat(cellStyle.classes, "\""); + } + + if (cellStyle.css) { + var csses_ = []; + + for (var _i10 = 0, _Object$entries9 = Object.entries(cellStyle.css); _i10 < _Object$entries9.length; _i10++) { + var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2), + _key3 = _Object$entries9$_i[0], + _value2 = _Object$entries9$_i[1]; + + csses_.push("".concat(_key3, ": ").concat(_value2)); + } + + style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\""); + } + + value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_); + + if (!(column.checkbox || column.radio)) { + value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value; + } + + if (column.searchable && _this7.searchText && _this7.options.searchHighlight) { + var defValue = ''; + var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim'); + var marker = '$1'; + var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value); + + if (isHTML) { + // value can contains a HTML tags + var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent; + var textReplaced = textContent.replace(regExp, marker); + defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3")); + } else { + // but usually not + defValue = value.toString().replace(regExp, marker); + } + + value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue); + } + + if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) { + for (var _i11 = 0, _Object$entries10 = Object.entries(item["_".concat(field, "_data")]); _i11 < _Object$entries10.length; _i11++) { + var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2), + _k = _Object$entries10$_i[0], + _v = _Object$entries10$_i[1]; + + // ignore data-index + if (_k === 'index') { + return; + } + + data_ += " data-".concat(_k, "=\"").concat(_v, "\""); + } + } + + if (column.checkbox || column.radio) { + type = column.checkbox ? 'checkbox' : type; + type = column.radio ? 'radio' : type; + var c = column['class'] || ''; + var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false; + var isDisabled = !column.checkboxEnabled || value && value.disabled; + text = [_this7.options.cardView ? "
    ") : ""), ""), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '
    ' : ''].join(''); + item[_this7.header.stateField] = value === true || !!value_ || value && value.checked; + } else if (_this7.options.cardView) { + var cardTitle = _this7.options.showHeader ? "").concat(Utils.getFieldTitle(_this7.columns, field), "") : ''; + text = "
    ".concat(cardTitle, "").concat(value, "
    "); + + if (_this7.options.smartDisplay && value === '') { + text = '
    '; + } + } else { + text = "").concat(value, ""); + } + + html.push(text); + }); + + if (detailViewTemplate && this.options.detailViewAlign === 'right') { + html.push(detailViewTemplate); + } + + if (this.options.cardView) { + html.push('
    '); + } + + html.push(''); + return html.join(''); + } + }, { + key: "initBody", + value: function initBody(fixedScroll) { + var _this8 = this; + + var data = this.getData(); + this.trigger('pre-body', data); + this.$body = this.$el.find('>tbody'); + + if (!this.$body.length) { + this.$body = $__default['default']('').appendTo(this.$el); + } // Fix #389 Bootstrap-table-flatJSON is not working + + + if (!this.options.pagination || this.options.sidePagination === 'server') { + this.pageFrom = 1; + this.pageTo = data.length; + } + + var rows = []; + var trFragments = $__default['default'](document.createDocumentFragment()); + var hasTr = false; + this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo)); + + for (var i = this.pageFrom - 1; i < this.pageTo; i++) { + var item = data[i]; + var tr = this.initRow(item, i, data, trFragments); + hasTr = hasTr || !!tr; + + if (tr && typeof tr === 'string') { + if (!this.options.virtualScroll) { + trFragments.append(tr); + } else { + rows.push(tr); + } + } + } // show no records + + + if (!hasTr) { + this.$body.html("".concat(Utils.sprintf('%s', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "")); + } else if (!this.options.virtualScroll) { + this.$body.html(trFragments); + } else { + if (this.virtualScroll) { + this.virtualScroll.destroy(); + } + + this.virtualScroll = new VirtualScroll({ + rows: rows, + fixedScroll: fixedScroll, + scrollEl: this.$tableBody[0], + contentEl: this.$body[0], + itemHeight: this.options.virtualScrollItemHeight, + callback: function callback() { + _this8.fitHeader(); + + _this8.initBodyEvent(); + } + }); + } + + if (!fixedScroll) { + this.scrollTo(0); + } + + this.initBodyEvent(); + this.updateSelected(); + this.initFooter(); + this.resetView(); + + if (this.options.sidePagination !== 'server') { + this.options.totalRows = data.length; + } + + this.trigger('post-body', data); + } + }, { + key: "initBodyEvent", + value: function initBodyEvent() { + var _this9 = this; + + // click to select by column + this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) { + var $td = $__default['default'](e.currentTarget); + var $tr = $td.parent(); + var $cardViewArr = $__default['default'](e.target).parents('.card-views').children(); + var $cardViewTarget = $__default['default'](e.target).parents('.card-view'); + var rowIndex = $tr.data('index'); + var item = _this9.data[rowIndex]; + var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex; + + var fields = _this9.getVisibleFields(); + + var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)]; + var column = _this9.columns[_this9.fieldsColumnsIndex[field]]; + var value = Utils.getItemField(item, field, _this9.options.escape); + + if ($td.find('.detail-icon').length) { + return; + } + + _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td); + + _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click + + + if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) { + var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName)); + + if ($selectItem.length) { + $selectItem[0].click(); + } + } + + if (e.type === 'click' && _this9.options.detailViewByClick) { + _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]); + } + }).off('mousedown').on('mousedown', function (e) { + // https://github.com/jquery/jquery/issues/1741 + _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey; + _this9.multipleSelectRowShiftKey = e.shiftKey; + }); + this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) { + e.preventDefault(); + + _this9.toggleDetailView($__default['default'](e.currentTarget).parent().parent().data('index')); + + return false; + }); + this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName)); + this.$selectItem.off('click').on('click', function (e) { + e.stopImmediatePropagation(); + var $this = $__default['default'](e.currentTarget); + + _this9._toggleCheck($this.prop('checked'), $this.data('index')); + }); + this.header.events.forEach(function (_events, i) { + var events = _events; + + if (!events) { + return; + } // fix bug, if events is defined with namespace + + + if (typeof events === 'string') { + events = Utils.calculateObjectValue(null, events); + } + + var field = _this9.header.fields[i]; + + var fieldIndex = _this9.getVisibleFields().indexOf(field); + + if (fieldIndex === -1) { + return; + } + + fieldIndex += Utils.getDetailViewIndexOffset(_this9.options); + + var _loop2 = function _loop2(key) { + if (!events.hasOwnProperty(key)) { + return "continue"; + } + + var event = events[key]; + + _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) { + var $tr = $__default['default'](tr); + var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex); + var index = key.indexOf(' '); + var name = key.substring(0, index); + var el = key.substring(index + 1); + $td.find(el).off(name).on(name, function (e) { + var index = $tr.data('index'); + var row = _this9.data[index]; + var value = row[field]; + event.apply(_this9, [e, value, row, index]); + }); + }); + }; + + for (var key in events) { + var _ret2 = _loop2(key); + + if (_ret2 === "continue") continue; + } + }); + } + }, { + key: "initServer", + value: function initServer(silent, query, url) { + var _this10 = this; + + var data = {}; + var index = this.header.fields.indexOf(this.options.sortName); + var params = { + searchText: this.searchText, + sortName: this.options.sortName, + sortOrder: this.options.sortOrder + }; + + if (this.header.sortNames[index]) { + params.sortName = this.header.sortNames[index]; + } + + if (this.options.pagination && this.options.sidePagination === 'server') { + params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize; + params.pageNumber = this.options.pageNumber; + } + + if (!(url || this.options.url) && !this.options.ajax) { + return; + } + + if (this.options.queryParamsType === 'limit') { + params = { + search: params.searchText, + sort: params.sortName, + order: params.sortOrder + }; + + if (this.options.pagination && this.options.sidePagination === 'server') { + params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1); + params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize; + + if (params.limit === 0) { + delete params.limit; + } + } + } + + if (this.options.search && this.options.sidePagination === 'server' && this.columns.filter(function (column) { + return !column.searchable; + }).length) { + params.searchable = []; + + var _iterator2 = _createForOfIteratorHelper(this.columns), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var column = _step2.value; + + if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) { + params.searchable.push(column.field); + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + + if (!Utils.isEmptyObject(this.filterColumnsPartial)) { + params.filter = JSON.stringify(this.filterColumnsPartial, null); + } + + $__default['default'].extend(params, query || {}); + data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request + + if (data === false) { + return; + } + + if (!silent) { + this.showLoading(); + } + + var request = $__default['default'].extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), { + type: this.options.method, + url: url || this.options.url, + data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data, + cache: this.options.cache, + contentType: this.options.contentType, + dataType: this.options.dataType, + success: function success(_res, textStatus, jqXHR) { + var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res); + + _this10.load(res); + + _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR); + + if (!silent) { + _this10.hideLoading(); + } + + if (_this10.options.sidePagination === 'server' && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) { + _this10.updatePagination(); + } + }, + error: function error(jqXHR) { + var data = []; + + if (_this10.options.sidePagination === 'server') { + data = {}; + data[_this10.options.totalField] = 0; + data[_this10.options.dataField] = []; + } + + _this10.load(data); + + _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR); + + if (!silent) _this10.$tableLoading.hide(); + } + }); + + if (this.options.ajax) { + Utils.calculateObjectValue(this, this.options.ajax, [request], null); + } else { + if (this._xhr && this._xhr.readyState !== 4) { + this._xhr.abort(); + } + + this._xhr = $__default['default'].ajax(request); + } + + return data; + } + }, { + key: "initSearchText", + value: function initSearchText() { + if (this.options.search) { + this.searchText = ''; + + if (this.options.searchText !== '') { + var $search = Utils.getSearchInput(this); + $search.val(this.options.searchText); + this.onSearch({ + currentTarget: $search, + firedByInitSearchText: true + }); + } + } + } + }, { + key: "getCaret", + value: function getCaret() { + var _this11 = this; + + this.$header.find('th').each(function (i, th) { + $__default['default'](th).find('.sortable').removeClass('desc asc').addClass($__default['default'](th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both'); + }); + } + }, { + key: "updateSelected", + value: function updateSelected() { + var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length; + this.$selectAll.add(this.$selectAll_).prop('checked', checkAll); + this.$selectItem.each(function (i, el) { + $__default['default'](el).closest('tr')[$__default['default'](el).prop('checked') ? 'addClass' : 'removeClass']('selected'); + }); + } + }, { + key: "updateRows", + value: function updateRows() { + var _this12 = this; + + this.$selectItem.each(function (i, el) { + _this12.data[$__default['default'](el).data('index')][_this12.header.stateField] = $__default['default'](el).prop('checked'); + }); + } + }, { + key: "resetRows", + value: function resetRows() { + var _iterator3 = _createForOfIteratorHelper(this.data), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var row = _step3.value; + this.$selectAll.prop('checked', false); + this.$selectItem.prop('checked', false); + + if (this.header.stateField) { + row[this.header.stateField] = false; + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + + this.initHiddenRows(); + } + }, { + key: "trigger", + value: function trigger(_name) { + var _this$options, _this$options2; + + var name = "".concat(_name, ".bs.table"); + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) { + args[_key4 - 1] = arguments[_key4]; + } + + (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this])); + + this.$el.trigger($__default['default'].Event(name, { + sender: this + }), args); + + (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this]))); + + this.$el.trigger($__default['default'].Event('all.bs.table', { + sender: this + }), [name, args]); + } + }, { + key: "resetHeader", + value: function resetHeader() { + var _this13 = this; + + // fix #61: the hidden table reset header bug. + // fix bug: get $el.css('width') error sometime (height = 500) + clearTimeout(this.timeoutId_); + this.timeoutId_ = setTimeout(function () { + return _this13.fitHeader(); + }, this.$el.is(':hidden') ? 100 : 0); + } + }, { + key: "fitHeader", + value: function fitHeader() { + var _this14 = this; + + if (this.$el.is(':hidden')) { + this.timeoutId_ = setTimeout(function () { + return _this14.fitHeader(); + }, 100); + return; + } + + var fixedBody = this.$tableBody.get(0); + var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0; + this.$el.css('margin-top', -this.$header.outerHeight()); + var focused = $__default['default'](':focus'); + + if (focused.length > 0) { + var $th = focused.parents('th'); + + if ($th.length > 0) { + var dataField = $th.attr('data-field'); + + if (dataField !== undefined) { + var $headerTh = this.$header.find("[data-field='".concat(dataField, "']")); + + if ($headerTh.length > 0) { + $headerTh.find(':input').addClass('focus-temp'); + } + } + } + } + + this.$header_ = this.$header.clone(true, true); + this.$selectAll_ = this.$header_.find('[name="btSelectAll"]'); + this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_); + this.$tableLoading.css('width', this.$el.outerWidth()); + var focusedTemp = $__default['default']('.focus-temp:visible:eq(0)'); + + if (focusedTemp.length > 0) { + focusedTemp.focus(); + this.$header.find('.focus-temp').removeClass('focus-temp'); + } // fix bug: $.data() is not working as expected after $.append() + + + this.$header.find('th[data-field]').each(function (i, el) { + _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $__default['default'](el).data('field'))).data($__default['default'](el).data()); + }); + var visibleFields = this.getVisibleFields(); + var $ths = this.$header_.find('th'); + var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0); + + while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) { + $tr = $tr.next(); + } + + var trLength = $tr.find('> *').length; + $tr.find('> *').each(function (i, el) { + var $this = $__default['default'](el); + + if (Utils.hasDetailViewIcon(_this14.options)) { + if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') { + var $thDetail = $ths.filter('.detail'); + + var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width(); + + $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth); + return; + } + } + + var index = i - Utils.getDetailViewIndexOffset(_this14.options); + + var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index])); + + if ($th.length > 1) { + $th = $__default['default']($ths[$this[0].cellIndex]); + } + + var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width(); + $th.find('.fht-cell').width($this.innerWidth() - zoomWidth); + }); + this.horizontalScroll(); + this.trigger('post-header'); + } + }, { + key: "initFooter", + value: function initFooter() { + if (!this.options.showFooter || this.options.cardView) { + // do nothing + return; + } + + var data = this.getData(); + var html = []; + var detailTemplate = ''; + + if (Utils.hasDetailViewIcon(this.options)) { + detailTemplate = '
    '; + } + + if (detailTemplate && this.options.detailViewAlign !== 'right') { + html.push(detailTemplate); + } + + var _iterator4 = _createForOfIteratorHelper(this.columns), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var column = _step4.value; + var falign = ''; + var valign = ''; + var csses = []; + var style = {}; + var class_ = Utils.sprintf(' class="%s"', column['class']); + + if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) { + continue; + } + + if (this.options.cardView && !column.cardVisible) { + return; + } + + falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align); + valign = Utils.sprintf('vertical-align: %s; ', column.valign); + style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]); + + if (style && style.css) { + for (var _i12 = 0, _Object$entries11 = Object.entries(style.css); _i12 < _Object$entries11.length; _i12++) { + var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2), + key = _Object$entries11$_i[0], + _value3 = _Object$entries11$_i[1]; + + csses.push("".concat(key, ": ").concat(_value3)); + } + } + + if (style && style.classes) { + class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes); + } + + html.push(' 0) { + colspan = this.footerData[0]["_".concat(column.field, "_colspan")] || 0; + } + + if (colspan) { + html.push(" colspan=\"".concat(colspan, "\" ")); + } + + html.push('>'); + html.push('
    '); + var value = ''; + + if (this.footerData && this.footerData.length > 0) { + value = this.footerData[0][column.field] || ''; + } + + html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value)); + html.push('
    '); + html.push('
    '); + html.push(''); + html.push(''); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + + if (detailTemplate && this.options.detailViewAlign === 'right') { + html.push(detailTemplate); + } + + if (!this.options.height && !this.$tableFooter.length) { + this.$el.append(''); + this.$tableFooter = this.$el.find('tfoot'); + } + + if (!this.$tableFooter.find('tr').length) { + this.$tableFooter.html('
    '); + } + + this.$tableFooter.find('tr').html(html.join('')); + this.trigger('post-footer', this.$tableFooter); + } + }, { + key: "fitFooter", + value: function fitFooter() { + var _this15 = this; + + if (this.$el.is(':hidden')) { + setTimeout(function () { + return _this15.fitFooter(); + }, 100); + return; + } + + var fixedBody = this.$tableBody.get(0); + var scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0; + this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class')); + var $ths = this.$tableFooter.find('th'); + var $tr = this.$body.find('>tr:first-child:not(.no-records-found)'); + $ths.find('.fht-cell').width('auto'); + + while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) { + $tr = $tr.next(); + } + + var trLength = $tr.find('> *').length; + $tr.find('> *').each(function (i, el) { + var $this = $__default['default'](el); + + if (Utils.hasDetailViewIcon(_this15.options)) { + if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') { + var $thDetail = $ths.filter('.detail'); + + var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width(); + + $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2); + return; + } + } + + var $th = $ths.eq(i); + var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width(); + $th.find('.fht-cell').width($this.innerWidth() - zoomWidth); + }); + this.horizontalScroll(); + } + }, { + key: "horizontalScroll", + value: function horizontalScroll() { + var _this16 = this; + + // horizontal scroll event + // TODO: it's probably better improving the layout than binding to scroll event + this.$tableBody.off('scroll').on('scroll', function () { + var scrollLeft = _this16.$tableBody.scrollLeft(); + + if (_this16.options.showHeader && _this16.options.height) { + _this16.$tableHeader.scrollLeft(scrollLeft); + } + + if (_this16.options.showFooter && !_this16.options.cardView) { + _this16.$tableFooter.scrollLeft(scrollLeft); + } + + _this16.trigger('scroll-body', _this16.$tableBody); + }); + } + }, { + key: "getVisibleFields", + value: function getVisibleFields() { + var visibleFields = []; + + var _iterator5 = _createForOfIteratorHelper(this.header.fields), + _step5; + + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var field = _step5.value; + var column = this.columns[this.fieldsColumnsIndex[field]]; + + if (!column || !column.visible) { + continue; + } + + visibleFields.push(field); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + + return visibleFields; + } + }, { + key: "initHiddenRows", + value: function initHiddenRows() { + this.hiddenRows = []; + } // PUBLIC FUNCTION DEFINITION + // ======================= + + }, { + key: "getOptions", + value: function getOptions() { + // deep copy and remove data + var options = $__default['default'].extend({}, this.options); + delete options.data; + return $__default['default'].extend(true, {}, options); + } + }, { + key: "refreshOptions", + value: function refreshOptions(options) { + // If the objects are equivalent then avoid the call of destroy / init methods + if (Utils.compareObjects(this.options, options, true)) { + return; + } + + this.options = $__default['default'].extend(this.options, options); + this.trigger('refresh-options', this.options); + this.destroy(); + this.init(); + } + }, { + key: "getData", + value: function getData(params) { + var _this17 = this; + + var data = this.options.data; + + if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || this.enableCustomSort || // Fix #4616: this.enableCustomSort is for extensions + !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) { + data = this.data; + } + + if (params && params.useCurrentPage) { + data = data.slice(this.pageFrom - 1, this.pageTo); + } + + if (params && !params.includeHiddenRows) { + var hiddenRows = this.getHiddenRows(); + data = data.filter(function (row) { + return Utils.findIndex(hiddenRows, row) === -1; + }); + } + + if (params && params.formatted) { + data.forEach(function (row) { + for (var _i13 = 0, _Object$entries12 = Object.entries(row); _i13 < _Object$entries12.length; _i13++) { + var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2), + key = _Object$entries12$_i[0], + value = _Object$entries12$_i[1]; + + var column = _this17.columns[_this17.fieldsColumnsIndex[key]]; + + if (!column) { + return; + } + + row[key] = Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value); + } + }); + } + + return data; + } + }, { + key: "getSelections", + value: function getSelections() { + var _this18 = this; + + return (this.options.maintainMetaData ? this.options.data : this.data).filter(function (row) { + return row[_this18.header.stateField] === true; + }); + } + }, { + key: "load", + value: function load(_data) { + var fixedScroll = false; + var data = _data; // #431: support pagination + + if (this.options.pagination && this.options.sidePagination === 'server') { + this.options.totalRows = data[this.options.totalField]; + this.options.totalNotFiltered = data[this.options.totalNotFilteredField]; + this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined; + } + + fixedScroll = data.fixedScroll; + data = Array.isArray(data) ? data : data[this.options.dataField]; + this.initData(data); + this.initSearch(); + this.initPagination(); + this.initBody(fixedScroll); + } + }, { + key: "append", + value: function append(data) { + this.initData(data, 'append'); + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + } + }, { + key: "prepend", + value: function prepend(data) { + this.initData(data, 'prepend'); + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + } + }, { + key: "remove", + value: function remove(params) { + var removed = 0; + + for (var i = this.options.data.length - 1; i >= 0; i--) { + var row = this.options.data[i]; + + if (!row.hasOwnProperty(params.field) && params.field !== '$index') { + continue; + } + + if (!row.hasOwnProperty(params.field) && params.field === '$index' && params.values.includes(i) || params.values.includes(row[params.field])) { + removed++; + this.options.data.splice(i, 1); + } + } + + if (!removed) { + return; + } + + if (this.options.sidePagination === 'server') { + this.options.totalRows -= removed; + this.data = _toConsumableArray(this.options.data); + } + + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + } + }, { + key: "removeAll", + value: function removeAll() { + if (this.options.data.length > 0) { + this.options.data.splice(0, this.options.data.length); + this.initSearch(); + this.initPagination(); + this.initBody(true); + } + } + }, { + key: "insertRow", + value: function insertRow(params) { + if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) { + return; + } + + this.options.data.splice(params.index, 0, params.row); + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + } + }, { + key: "updateRow", + value: function updateRow(params) { + var allParams = Array.isArray(params) ? params : [params]; + + var _iterator6 = _createForOfIteratorHelper(allParams), + _step6; + + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var _params = _step6.value; + + if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) { + continue; + } + + if (_params.hasOwnProperty('replace') && _params.replace) { + this.options.data[_params.index] = _params.row; + } else { + $__default['default'].extend(this.options.data[_params.index], _params.row); + } + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + } + }, { + key: "getRowByUniqueId", + value: function getRowByUniqueId(_id) { + var uniqueId = this.options.uniqueId; + var len = this.options.data.length; + var id = _id; + var dataRow = null; + var i; + var row; + var rowUniqueId; + + for (i = len - 1; i >= 0; i--) { + row = this.options.data[i]; + + if (row.hasOwnProperty(uniqueId)) { + // uniqueId is a column + rowUniqueId = row[uniqueId]; + } else if (row._data && row._data.hasOwnProperty(uniqueId)) { + // uniqueId is a row data property + rowUniqueId = row._data[uniqueId]; + } else { + continue; + } + + if (typeof rowUniqueId === 'string') { + id = id.toString(); + } else if (typeof rowUniqueId === 'number') { + if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) { + id = parseInt(id); + } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) { + id = parseFloat(id); + } + } + + if (rowUniqueId === id) { + dataRow = row; + break; + } + } + + return dataRow; + } + }, { + key: "updateByUniqueId", + value: function updateByUniqueId(params) { + var allParams = Array.isArray(params) ? params : [params]; + + var _iterator7 = _createForOfIteratorHelper(allParams), + _step7; + + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var _params2 = _step7.value; + + if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) { + continue; + } + + var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id)); + + if (rowId === -1) { + continue; + } + + if (_params2.hasOwnProperty('replace') && _params2.replace) { + this.options.data[rowId] = _params2.row; + } else { + $__default['default'].extend(this.options.data[rowId], _params2.row); + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } + + this.initSearch(); + this.initPagination(); + this.initSort(); + this.initBody(true); + } + }, { + key: "removeByUniqueId", + value: function removeByUniqueId(id) { + var len = this.options.data.length; + var row = this.getRowByUniqueId(id); + + if (row) { + this.options.data.splice(this.options.data.indexOf(row), 1); + } + + if (len === this.options.data.length) { + return; + } + + if (this.options.sidePagination === 'server') { + this.options.totalRows -= 1; + this.data = _toConsumableArray(this.options.data); + } + + this.initSearch(); + this.initPagination(); + this.initBody(true); + } + }, { + key: "updateCell", + value: function updateCell(params) { + if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) { + return; + } + + this.data[params.index][params.field] = params.value; + + if (params.reinit === false) { + return; + } + + this.initSort(); + this.initBody(true); + } + }, { + key: "updateCellByUniqueId", + value: function updateCellByUniqueId(params) { + var _this19 = this; + + var allParams = Array.isArray(params) ? params : [params]; + allParams.forEach(function (_ref6) { + var id = _ref6.id, + field = _ref6.field, + value = _ref6.value; + + var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id)); + + if (rowId === -1) { + return; + } + + _this19.options.data[rowId][field] = value; + }); + + if (params.reinit === false) { + return; + } + + this.initSort(); + this.initBody(true); + } + }, { + key: "showRow", + value: function showRow(params) { + this._toggleRow(params, true); + } + }, { + key: "hideRow", + value: function hideRow(params) { + this._toggleRow(params, false); + } + }, { + key: "_toggleRow", + value: function _toggleRow(params, visible) { + var row; + + if (params.hasOwnProperty('index')) { + row = this.getData()[params.index]; + } else if (params.hasOwnProperty('uniqueId')) { + row = this.getRowByUniqueId(params.uniqueId); + } + + if (!row) { + return; + } + + var index = Utils.findIndex(this.hiddenRows, row); + + if (!visible && index === -1) { + this.hiddenRows.push(row); + } else if (visible && index > -1) { + this.hiddenRows.splice(index, 1); + } + + this.initBody(true); + this.initPagination(); + } + }, { + key: "getHiddenRows", + value: function getHiddenRows(show) { + if (show) { + this.initHiddenRows(); + this.initBody(true); + this.initPagination(); + return; + } + + var data = this.getData(); + var rows = []; + + var _iterator8 = _createForOfIteratorHelper(data), + _step8; + + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + var row = _step8.value; + + if (this.hiddenRows.includes(row)) { + rows.push(row); + } + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + + this.hiddenRows = rows; + return rows; + } + }, { + key: "showColumn", + value: function showColumn(field) { + var _this20 = this; + + var fields = Array.isArray(field) ? field : [field]; + fields.forEach(function (field) { + _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true); + }); + } + }, { + key: "hideColumn", + value: function hideColumn(field) { + var _this21 = this; + + var fields = Array.isArray(field) ? field : [field]; + fields.forEach(function (field) { + _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true); + }); + } + }, { + key: "_toggleColumn", + value: function _toggleColumn(index, checked, needUpdate) { + if (index === -1 || this.columns[index].visible === checked) { + return; + } + + this.columns[index].visible = checked; + this.initHeader(); + this.initSearch(); + this.initPagination(); + this.initBody(); + + if (this.options.showColumns) { + var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false); + + if (needUpdate) { + $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked); + } + + if ($items.filter(':checked').length <= this.options.minimumCountColumns) { + $items.filter(':checked').prop('disabled', true); + } + } + } + }, { + key: "getVisibleColumns", + value: function getVisibleColumns() { + var _this22 = this; + + return this.columns.filter(function (column) { + return column.visible && !_this22.isSelectionColumn(column); + }); + } + }, { + key: "getHiddenColumns", + value: function getHiddenColumns() { + return this.columns.filter(function (_ref7) { + var visible = _ref7.visible; + return !visible; + }); + } + }, { + key: "isSelectionColumn", + value: function isSelectionColumn(column) { + return column.radio || column.checkbox; + } + }, { + key: "showAllColumns", + value: function showAllColumns() { + this._toggleAllColumns(true); + } + }, { + key: "hideAllColumns", + value: function hideAllColumns() { + this._toggleAllColumns(false); + } + }, { + key: "_toggleAllColumns", + value: function _toggleAllColumns(visible) { + var _this23 = this; + + var _iterator9 = _createForOfIteratorHelper(this.columns.slice().reverse()), + _step9; + + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { + var column = _step9.value; + + if (column.switchable) { + if (!visible && this.options.showColumns && this.getVisibleColumns().length === this.options.minimumCountColumns) { + continue; + } + + column.visible = visible; + } + } + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); + } + + this.initHeader(); + this.initSearch(); + this.initPagination(); + this.initBody(); + + if (this.options.showColumns) { + var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false); + + if (visible) { + $items.prop('checked', visible); + } else { + $items.get().reverse().forEach(function (item) { + if ($items.filter(':checked').length > _this23.options.minimumCountColumns) { + $__default['default'](item).prop('checked', visible); + } + }); + } + + if ($items.filter(':checked').length <= this.options.minimumCountColumns) { + $items.filter(':checked').prop('disabled', true); + } + } + } + }, { + key: "mergeCells", + value: function mergeCells(options) { + var row = options.index; + var col = this.getVisibleFields().indexOf(options.field); + var rowspan = options.rowspan || 1; + var colspan = options.colspan || 1; + var i; + var j; + var $tr = this.$body.find('>tr'); + col += Utils.getDetailViewIndexOffset(this.options); + var $td = $tr.eq(row).find('>td').eq(col); + + if (row < 0 || col < 0 || row >= this.data.length) { + return; + } + + for (i = row; i < row + rowspan; i++) { + for (j = col; j < col + colspan; j++) { + $tr.eq(i).find('>td').eq(j).hide(); + } + } + + $td.attr('rowspan', rowspan).attr('colspan', colspan).show(); + } + }, { + key: "checkAll", + value: function checkAll() { + this._toggleCheckAll(true); + } + }, { + key: "uncheckAll", + value: function uncheckAll() { + this._toggleCheckAll(false); + } + }, { + key: "_toggleCheckAll", + value: function _toggleCheckAll(checked) { + var rowsBefore = this.getSelections(); + this.$selectAll.add(this.$selectAll_).prop('checked', checked); + this.$selectItem.filter(':enabled').prop('checked', checked); + this.updateRows(); + this.updateSelected(); + var rowsAfter = this.getSelections(); + + if (checked) { + this.trigger('check-all', rowsAfter, rowsBefore); + return; + } + + this.trigger('uncheck-all', rowsAfter, rowsBefore); + } + }, { + key: "checkInvert", + value: function checkInvert() { + var $items = this.$selectItem.filter(':enabled'); + var checked = $items.filter(':checked'); + $items.each(function (i, el) { + $__default['default'](el).prop('checked', !$__default['default'](el).prop('checked')); + }); + this.updateRows(); + this.updateSelected(); + this.trigger('uncheck-some', checked); + checked = this.getSelections(); + this.trigger('check-some', checked); + } + }, { + key: "check", + value: function check(index) { + this._toggleCheck(true, index); + } + }, { + key: "uncheck", + value: function uncheck(index) { + this._toggleCheck(false, index); + } + }, { + key: "_toggleCheck", + value: function _toggleCheck(checked, index) { + var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]")); + var row = this.data[index]; + + if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) { + var _iterator10 = _createForOfIteratorHelper(this.options.data), + _step10; + + try { + for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { + var r = _step10.value; + r[this.header.stateField] = false; + } + } catch (err) { + _iterator10.e(err); + } finally { + _iterator10.f(); + } + + this.$selectItem.filter(':checked').not($el).prop('checked', false); + } + + row[this.header.stateField] = checked; + + if (this.options.multipleSelectRow) { + if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) { + var _ref8 = this.multipleSelectRowLastSelectedIndex < index ? [this.multipleSelectRowLastSelectedIndex, index] : [index, this.multipleSelectRowLastSelectedIndex], + _ref9 = _slicedToArray(_ref8, 2), + fromIndex = _ref9[0], + toIndex = _ref9[1]; + + for (var i = fromIndex + 1; i < toIndex; i++) { + this.data[i][this.header.stateField] = true; + this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true); + } + } + + this.multipleSelectRowCtrlKey = false; + this.multipleSelectRowShiftKey = false; + this.multipleSelectRowLastSelectedIndex = checked ? index : -1; + } + + $el.prop('checked', checked); + this.updateSelected(); + this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el); + } + }, { + key: "checkBy", + value: function checkBy(obj) { + this._toggleCheckBy(true, obj); + } + }, { + key: "uncheckBy", + value: function uncheckBy(obj) { + this._toggleCheckBy(false, obj); + } + }, { + key: "_toggleCheckBy", + value: function _toggleCheckBy(checked, obj) { + var _this24 = this; + + if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) { + return; + } + + var rows = []; + this.data.forEach(function (row, i) { + if (!row.hasOwnProperty(obj.field)) { + return false; + } + + if (obj.values.includes(row[obj.field])) { + var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i)); + + $el = checked ? $el.not(':checked') : $el.filter(':checked'); + + if (!$el.length) { + return; + } + + $el.prop('checked', checked); + row[_this24.header.stateField] = checked; + rows.push(row); + + _this24.trigger(checked ? 'check' : 'uncheck', row, $el); + } + }); + this.updateSelected(); + this.trigger(checked ? 'check-some' : 'uncheck-some', rows); + } + }, { + key: "refresh", + value: function refresh(params) { + if (params && params.url) { + this.options.url = params.url; + } + + if (params && params.pageNumber) { + this.options.pageNumber = params.pageNumber; + } + + if (params && params.pageSize) { + this.options.pageSize = params.pageSize; + } + + this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url)); + } + }, { + key: "destroy", + value: function destroy() { + this.$el.insertBefore(this.$container); + $__default['default'](this.options.toolbar).insertBefore(this.$el); + this.$container.next().remove(); + this.$container.remove(); + this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class + } + }, { + key: "resetView", + value: function resetView(params) { + var padding = 0; + + if (params && params.height) { + this.options.height = params.height; + } + + this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length); + this.$tableContainer.toggleClass('has-card-view', this.options.cardView); + + if (!this.options.cardView && this.options.showHeader && this.options.height) { + this.$tableHeader.show(); + this.resetHeader(); + padding += this.$header.outerHeight(true) + 1; + } else { + this.$tableHeader.hide(); + this.trigger('post-header'); + } + + if (!this.options.cardView && this.options.showFooter) { + this.$tableFooter.show(); + this.fitFooter(); + + if (this.options.height) { + padding += this.$tableFooter.outerHeight(true); + } + } + + if (this.$container.hasClass('fullscreen')) { + this.$tableContainer.css('height', ''); + this.$tableContainer.css('width', ''); + } else if (this.options.height) { + if (this.$tableBorder) { + this.$tableBorder.css('width', ''); + this.$tableBorder.css('height', ''); + } + + var toolbarHeight = this.$toolbar.outerHeight(true); + var paginationHeight = this.$pagination.outerHeight(true); + var height = this.options.height - toolbarHeight - paginationHeight; + var $bodyTable = this.$tableBody.find('>table'); + var tableHeight = $bodyTable.outerHeight(); + this.$tableContainer.css('height', "".concat(height, "px")); + + if (this.$tableBorder && $bodyTable.is(':visible')) { + var tableBorderHeight = height - tableHeight - 2; + + if (this.$tableBody[0].scrollWidth - this.$tableBody.innerWidth()) { + tableBorderHeight -= Utils.getScrollBarWidth(); + } + + this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px")); + this.$tableBorder.css('height', "".concat(tableBorderHeight, "px")); + } + } + + if (this.options.cardView) { + // remove the element css + this.$el.css('margin-top', '0'); + this.$tableContainer.css('padding-bottom', '0'); + this.$tableFooter.hide(); + } else { + // Assign the correct sortable arrow + this.getCaret(); + this.$tableContainer.css('padding-bottom', "".concat(padding, "px")); + } + + this.trigger('reset-view'); + } + }, { + key: "showLoading", + value: function showLoading() { + this.$tableLoading.toggleClass('open', true); + var fontSize = this.options.loadingFontSize; + + if (this.options.loadingFontSize === 'auto') { + fontSize = this.$tableLoading.width() * 0.04; + fontSize = Math.max(12, fontSize); + fontSize = Math.min(32, fontSize); + fontSize = "".concat(fontSize, "px"); + } + + this.$tableLoading.find('.loading-text').css('font-size', fontSize); + } + }, { + key: "hideLoading", + value: function hideLoading() { + this.$tableLoading.toggleClass('open', false); + } + }, { + key: "togglePagination", + value: function togglePagination() { + this.options.pagination = !this.options.pagination; + var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : ''; + var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : ''; + this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text)); + this.updatePagination(); + } + }, { + key: "toggleFullscreen", + value: function toggleFullscreen() { + this.$el.closest('.bootstrap-table').toggleClass('fullscreen'); + this.resetView(); + } + }, { + key: "toggleView", + value: function toggleView() { + this.options.cardView = !this.options.cardView; + this.initHeader(); + var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : ''; + var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : ''; + this.$toolbar.find('button[name="toggle"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text)); + this.initBody(); + this.trigger('toggle', this.options.cardView); + } + }, { + key: "resetSearch", + value: function resetSearch(text) { + var $search = Utils.getSearchInput(this); + $search.val(text || ''); + this.onSearch({ + currentTarget: $search + }); + } + }, { + key: "filterBy", + value: function filterBy(columns, options) { + this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $__default['default'].extend(this.options.filterOptions, options); + this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns; + this.options.pageNumber = 1; + this.initSearch(); + this.updatePagination(); + } + }, { + key: "scrollTo", + value: function scrollTo(params) { + var options = { + unit: 'px', + value: 0 + }; + + if (_typeof(params) === 'object') { + options = Object.assign(options, params); + } else if (typeof params === 'string' && params === 'bottom') { + options.value = this.$tableBody[0].scrollHeight; + } else if (typeof params === 'string' || typeof params === 'number') { + options.value = params; + } + + var scrollTo = options.value; + + if (options.unit === 'rows') { + scrollTo = 0; + this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) { + scrollTo += $__default['default'](el).outerHeight(true); + }); + } + + this.$tableBody.scrollTop(scrollTo); + } + }, { + key: "getScrollPosition", + value: function getScrollPosition() { + return this.$tableBody.scrollTop(); + } + }, { + key: "selectPage", + value: function selectPage(page) { + if (page > 0 && page <= this.options.totalPages) { + this.options.pageNumber = page; + this.updatePagination(); + } + } + }, { + key: "prevPage", + value: function prevPage() { + if (this.options.pageNumber > 1) { + this.options.pageNumber--; + this.updatePagination(); + } + } + }, { + key: "nextPage", + value: function nextPage() { + if (this.options.pageNumber < this.options.totalPages) { + this.options.pageNumber++; + this.updatePagination(); + } + } + }, { + key: "toggleDetailView", + value: function toggleDetailView(index, _columnDetailFormatter) { + var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index)); + + if ($tr.next().is('tr.detail-view')) { + this.collapseRow(index); + } else { + this.expandRow(index, _columnDetailFormatter); + } + + this.resetView(); + } + }, { + key: "expandRow", + value: function expandRow(index, _columnDetailFormatter) { + var row = this.data[index]; + var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index)); + + if ($tr.next().is('tr.detail-view')) { + return; + } + + if (this.options.detailViewIcon) { + $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose)); + } + + $tr.after(Utils.sprintf('', $tr.children('td').length)); + var $element = $tr.next().find('td'); + var detailFormatter = _columnDetailFormatter || this.options.detailFormatter; + var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], ''); + + if ($element.length === 1) { + $element.append(content); + } + + this.trigger('expand-row', index, row, $element); + } + }, { + key: "expandRowByUniqueId", + value: function expandRowByUniqueId(uniqueId) { + var row = this.getRowByUniqueId(uniqueId); + + if (!row) { + return; + } + + this.expandRow(this.data.indexOf(row)); + } + }, { + key: "collapseRow", + value: function collapseRow(index) { + var row = this.data[index]; + var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index)); + + if (!$tr.next().is('tr.detail-view')) { + return; + } + + if (this.options.detailViewIcon) { + $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen)); + } + + this.trigger('collapse-row', index, row, $tr.next()); + $tr.next().remove(); + } + }, { + key: "collapseRowByUniqueId", + value: function collapseRowByUniqueId(uniqueId) { + var row = this.getRowByUniqueId(uniqueId); + + if (!row) { + return; + } + + this.collapseRow(this.data.indexOf(row)); + } + }, { + key: "expandAllRows", + value: function expandAllRows() { + var trs = this.$body.find('> tr[data-index][data-has-detail-view]'); + + for (var i = 0; i < trs.length; i++) { + this.expandRow($__default['default'](trs[i]).data('index')); + } + } + }, { + key: "collapseAllRows", + value: function collapseAllRows() { + var trs = this.$body.find('> tr[data-index][data-has-detail-view]'); + + for (var i = 0; i < trs.length; i++) { + this.collapseRow($__default['default'](trs[i]).data('index')); + } + } + }, { + key: "updateColumnTitle", + value: function updateColumnTitle(params) { + if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) { + return; + } + + this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title; + + if (this.columns[this.fieldsColumnsIndex[params.field]].visible) { + this.$header.find('th[data-field]').each(function (i, el) { + if ($__default['default'](el).data('field') === params.field) { + $__default['default']($__default['default'](el).find('.th-inner')[0]).text(params.title); + return false; + } + }); + this.resetView(); + } + } + }, { + key: "updateFormatText", + value: function updateFormatText(formatName, text) { + if (!/^format/.test(formatName) || !this.options[formatName]) { + return; + } + + if (typeof text === 'string') { + this.options[formatName] = function () { + return text; + }; + } else if (typeof text === 'function') { + this.options[formatName] = text; + } + + this.initToolbar(); + this.initPagination(); + this.initBody(); + } + }]); + + return BootstrapTable; + }(); + + BootstrapTable.VERSION = Constants.VERSION; + BootstrapTable.DEFAULTS = Constants.DEFAULTS; + BootstrapTable.LOCALES = Constants.LOCALES; + BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS; + BootstrapTable.METHODS = Constants.METHODS; + BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION + // ======================= + + $__default['default'].BootstrapTable = BootstrapTable; + + $__default['default'].fn.bootstrapTable = function (option) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) { + args[_key5 - 1] = arguments[_key5]; + } + + var value; + this.each(function (i, el) { + var data = $__default['default'](el).data('bootstrap.table'); + var options = $__default['default'].extend({}, BootstrapTable.DEFAULTS, $__default['default'](el).data(), _typeof(option) === 'object' && option); + + if (typeof option === 'string') { + var _data2; + + if (!Constants.METHODS.includes(option)) { + throw new Error("Unknown method: ".concat(option)); + } + + if (!data) { + return; + } + + value = (_data2 = data)[option].apply(_data2, args); + + if (option === 'destroy') { + $__default['default'](el).removeData('bootstrap.table'); + } + } + + if (!data) { + data = new $__default['default'].BootstrapTable(el, options); + $__default['default'](el).data('bootstrap.table', data); + data.init(); + } + }); + return typeof value === 'undefined' ? this : value; + }; + + $__default['default'].fn.bootstrapTable.Constructor = BootstrapTable; + $__default['default'].fn.bootstrapTable.theme = Constants.THEME; + $__default['default'].fn.bootstrapTable.VERSION = Constants.VERSION; + $__default['default'].fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS; + $__default['default'].fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS; + $__default['default'].fn.bootstrapTable.events = BootstrapTable.EVENTS; + $__default['default'].fn.bootstrapTable.locales = BootstrapTable.LOCALES; + $__default['default'].fn.bootstrapTable.methods = BootstrapTable.METHODS; + $__default['default'].fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT + // ======================= + + $__default['default'](function () { + $__default['default']('[data-toggle="table"]').bootstrapTable(); + }); + + return BootstrapTable; + +}))); diff --git a/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js b/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js index e33307f565..37bf86ad25 100644 --- a/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js +++ b/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.js @@ -1,116 +1,1779 @@ -/** - * @author: general - * @website: note.generals.space - * @email: generals.space@gmail.com - * @github: https://github.com/generals-space/bootstrap-table-addrbar - * @update: zhixin wen - */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : + typeof define === 'function' && define.amd ? define(['jquery'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery)); +}(this, (function ($) { 'use strict'; + + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + var $__default = /*#__PURE__*/_interopDefaultLegacy($); + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + function _createSuper(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct(); + + return function _createSuperInternal() { + var Super = _getPrototypeOf(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possibleConstructorReturn(this, result); + }; + } + + function _superPropBase(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = _getPrototypeOf(object); + if (object === null) break; + } + + return object; + } + + function _get(target, property, receiver) { + if (typeof Reflect !== "undefined" && Reflect.get) { + _get = Reflect.get; + } else { + _get = function _get(target, property, receiver) { + var base = _superPropBase(target, property); + + if (!base) return; + var desc = Object.getOwnPropertyDescriptor(base, property); + + if (desc.get) { + return desc.get.call(receiver); + } + + return desc.value; + }; + } + + return _get(target, property, receiver || target); + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var check = function (it) { + return it && it.Math == Math && it; + }; + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global_1 = + /* global globalThis -- safe */ + check(typeof globalThis == 'object' && globalThis) || + check(typeof window == 'object' && window) || + check(typeof self == 'object' && self) || + check(typeof commonjsGlobal == 'object' && commonjsGlobal) || + // eslint-disable-next-line no-new-func -- fallback + (function () { return this; })() || Function('return this')(); + + var fails = function (exec) { + try { + return !!exec(); + } catch (error) { + return true; + } + }; + + // Detect IE8's incomplete defineProperty implementation + var descriptors = !fails(function () { + return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; + }); + + var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + + // Nashorn ~ JDK8 bug + var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + + // `Object.prototype.propertyIsEnumerable` method implementation + // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable + var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$1(this, V); + return !!descriptor && descriptor.enumerable; + } : nativePropertyIsEnumerable; + + var objectPropertyIsEnumerable = { + f: f$4 + }; + + var createPropertyDescriptor = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + + var toString = {}.toString; + + var classofRaw = function (it) { + return toString.call(it).slice(8, -1); + }; + + var split = ''.split; + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var indexedObject = fails(function () { + // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 + // eslint-disable-next-line no-prototype-builtins -- safe + return !Object('z').propertyIsEnumerable(0); + }) ? function (it) { + return classofRaw(it) == 'String' ? split.call(it, '') : Object(it); + } : Object; + + // `RequireObjectCoercible` abstract operation + // https://tc39.es/ecma262/#sec-requireobjectcoercible + var requireObjectCoercible = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; + }; + + // toObject with fallback for non-array-like ES3 strings + + + + var toIndexedObject = function (it) { + return indexedObject(requireObjectCoercible(it)); + }; + + var isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + + // `ToPrimitive` abstract operation + // https://tc39.es/ecma262/#sec-toprimitive + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + var toPrimitive = function (input, PREFERRED_STRING) { + if (!isObject(input)) return input; + var fn, val; + if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; + if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + throw TypeError("Can't convert object to primitive value"); + }; + + var hasOwnProperty = {}.hasOwnProperty; + + var has$1 = function (it, key) { + return hasOwnProperty.call(it, key); + }; + + var document = global_1.document; + // typeof document.createElement is 'object' in old IE + var EXISTS = isObject(document) && isObject(document.createElement); + + var documentCreateElement = function (it) { + return EXISTS ? document.createElement(it) : {}; + }; + + // Thank's IE8 for his funny defineProperty + var ie8DomDefine = !descriptors && !fails(function () { + return Object.defineProperty(documentCreateElement('div'), 'a', { + get: function () { return 7; } + }).a != 7; + }); + + var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor + var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject(O); + P = toPrimitive(P, true); + if (ie8DomDefine) try { + return nativeGetOwnPropertyDescriptor(O, P); + } catch (error) { /* empty */ } + if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); + }; + + var objectGetOwnPropertyDescriptor = { + f: f$3 + }; + + var anObject = function (it) { + if (!isObject(it)) { + throw TypeError(String(it) + ' is not an object'); + } return it; + }; + + var nativeDefineProperty = Object.defineProperty; + + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (ie8DomDefine) try { + return nativeDefineProperty(O, P, Attributes); + } catch (error) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + + var objectDefineProperty = { + f: f$2 + }; + + var createNonEnumerableProperty = descriptors ? function (object, key, value) { + return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); + } : function (object, key, value) { + object[key] = value; + return object; + }; + + var setGlobal = function (key, value) { + try { + createNonEnumerableProperty(global_1, key, value); + } catch (error) { + global_1[key] = value; + } return value; + }; + + var SHARED = '__core-js_shared__'; + var store$1 = global_1[SHARED] || setGlobal(SHARED, {}); + + var sharedStore = store$1; + + var functionToString = Function.toString; + + // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper + if (typeof sharedStore.inspectSource != 'function') { + sharedStore.inspectSource = function (it) { + return functionToString.call(it); + }; + } + + var inspectSource = sharedStore.inspectSource; + + var WeakMap$1 = global_1.WeakMap; + + var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1)); + + var shared = createCommonjsModule(function (module) { + (module.exports = function (key, value) { + return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); + })('versions', []).push({ + version: '3.9.1', + mode: 'global', + copyright: '© 2021 Denis Pushkarev (zloirock.ru)' + }); + }); + + var id = 0; + var postfix = Math.random(); + + var uid = function (key) { + return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); + }; + + var keys$1 = shared('keys'); + + var sharedKey = function (key) { + return keys$1[key] || (keys$1[key] = uid(key)); + }; + + var hiddenKeys$1 = {}; + + var WeakMap = global_1.WeakMap; + var set, get, has; + + var enforce = function (it) { + return has(it) ? get(it) : set(it, {}); + }; + + var getterFor = function (TYPE) { + return function (it) { + var state; + if (!isObject(it) || (state = get(it)).type !== TYPE) { + throw TypeError('Incompatible receiver, ' + TYPE + ' required'); + } return state; + }; + }; + + if (nativeWeakMap) { + var store = sharedStore.state || (sharedStore.state = new WeakMap()); + var wmget = store.get; + var wmhas = store.has; + var wmset = store.set; + set = function (it, metadata) { + metadata.facade = it; + wmset.call(store, it, metadata); + return metadata; + }; + get = function (it) { + return wmget.call(store, it) || {}; + }; + has = function (it) { + return wmhas.call(store, it); + }; + } else { + var STATE = sharedKey('state'); + hiddenKeys$1[STATE] = true; + set = function (it, metadata) { + metadata.facade = it; + createNonEnumerableProperty(it, STATE, metadata); + return metadata; + }; + get = function (it) { + return has$1(it, STATE) ? it[STATE] : {}; + }; + has = function (it) { + return has$1(it, STATE); + }; + } + + var internalState = { + set: set, + get: get, + has: has, + enforce: enforce, + getterFor: getterFor + }; + + var redefine = createCommonjsModule(function (module) { + var getInternalState = internalState.get; + var enforceInternalState = internalState.enforce; + var TEMPLATE = String(String).split('String'); + + (module.exports = function (O, key, value, options) { + var unsafe = options ? !!options.unsafe : false; + var simple = options ? !!options.enumerable : false; + var noTargetGet = options ? !!options.noTargetGet : false; + var state; + if (typeof value == 'function') { + if (typeof key == 'string' && !has$1(value, 'name')) { + createNonEnumerableProperty(value, 'name', key); + } + state = enforceInternalState(value); + if (!state.source) { + state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); + } + } + if (O === global_1) { + if (simple) O[key] = value; + else setGlobal(key, value); + return; + } else if (!unsafe) { + delete O[key]; + } else if (!noTargetGet && O[key]) { + simple = true; + } + if (simple) O[key] = value; + else createNonEnumerableProperty(O, key, value); + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative + })(Function.prototype, 'toString', function toString() { + return typeof this == 'function' && getInternalState(this).source || inspectSource(this); + }); + }); + + var path = global_1; + + var aFunction = function (variable) { + return typeof variable == 'function' ? variable : undefined; + }; + + var getBuiltIn = function (namespace, method) { + return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) + : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; + }; + + var ceil = Math.ceil; + var floor$1 = Math.floor; + + // `ToInteger` abstract operation + // https://tc39.es/ecma262/#sec-tointeger + var toInteger = function (argument) { + return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument); + }; + + var min$2 = Math.min; + + // `ToLength` abstract operation + // https://tc39.es/ecma262/#sec-tolength + var toLength = function (argument) { + return argument > 0 ? min$2(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + }; + + var max$1 = Math.max; + var min$1 = Math.min; + + // Helper for a popular repeating case of the spec: + // Let integer be ? ToInteger(index). + // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). + var toAbsoluteIndex = function (index, length) { + var integer = toInteger(index); + return integer < 0 ? max$1(integer + length, 0) : min$1(integer, length); + }; + + // `Array.prototype.{ indexOf, includes }` methods implementation + var createMethod$2 = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIndexedObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare -- NaN check + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare -- NaN check + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + + var arrayIncludes = { + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + includes: createMethod$2(true), + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + indexOf: createMethod$2(false) + }; + + var indexOf = arrayIncludes.indexOf; + + + var objectKeysInternal = function (object, names) { + var O = toIndexedObject(object); + var i = 0; + var result = []; + var key; + for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has$1(O, key = names[i++])) { + ~indexOf(result, key) || result.push(key); + } + return result; + }; + + // IE8- don't enum bug keys + var enumBugKeys = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' + ]; + + var hiddenKeys = enumBugKeys.concat('length', 'prototype'); + + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return objectKeysInternal(O, hiddenKeys); + }; + + var objectGetOwnPropertyNames = { + f: f$1 + }; + + var f = Object.getOwnPropertySymbols; + + var objectGetOwnPropertySymbols = { + f: f + }; + + // all object keys, includes non-enumerable and symbols + var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { + var keys = objectGetOwnPropertyNames.f(anObject(it)); + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; + }; + + var copyConstructorProperties = function (target, source) { + var keys = ownKeys(source); + var defineProperty = objectDefineProperty.f; + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } + }; + + var replacement = /#|\.prototype\./; + + var isForced = function (feature, detection) { + var value = data[normalize(feature)]; + return value == POLYFILL ? true + : value == NATIVE ? false + : typeof detection == 'function' ? fails(detection) + : !!detection; + }; + + var normalize = isForced.normalize = function (string) { + return String(string).replace(replacement, '.').toLowerCase(); + }; + + var data = isForced.data = {}; + var NATIVE = isForced.NATIVE = 'N'; + var POLYFILL = isForced.POLYFILL = 'P'; + + var isForced_1 = isForced; + + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + + + + + -($ => { /* - * function: 获取浏览器地址栏中的指定参数. - * key: 参数名 - * url: 默认为当前地址栏 - */ - function _GET (key, url = window.location.search) { + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.noTargetGet - prevent calling a getter on target + */ + var _export = function (options, source) { + var TARGET = options.target; + var GLOBAL = options.global; + var STATIC = options.stat; + var FORCED, target, key, targetProperty, sourceProperty, descriptor; + if (GLOBAL) { + target = global_1; + } else if (STATIC) { + target = global_1[TARGET] || setGlobal(TARGET, {}); + } else { + target = (global_1[TARGET] || {}).prototype; + } + if (target) for (key in source) { + sourceProperty = source[key]; + if (options.noTargetGet) { + descriptor = getOwnPropertyDescriptor(target, key); + targetProperty = descriptor && descriptor.value; + } else targetProperty = target[key]; + FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); + // contained in target + if (!FORCED && targetProperty !== undefined) { + if (typeof sourceProperty === typeof targetProperty) continue; + copyConstructorProperties(sourceProperty, targetProperty); + } + // add a flag to not completely full polyfills + if (options.sham || (targetProperty && targetProperty.sham)) { + createNonEnumerableProperty(sourceProperty, 'sham', true); + } + // extend global + redefine(target, key, sourceProperty, options); + } + }; + + // `RegExp.prototype.flags` getter implementation + // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags + var regexpFlags = function () { + var that = anObject(this); + var result = ''; + if (that.global) result += 'g'; + if (that.ignoreCase) result += 'i'; + if (that.multiline) result += 'm'; + if (that.dotAll) result += 's'; + if (that.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; + }; + + // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError, + // so we use an intermediate function. + function RE(s, f) { + return RegExp(s, f); + } + + var UNSUPPORTED_Y$2 = fails(function () { + // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError + var re = RE('a', 'y'); + re.lastIndex = 2; + return re.exec('abcd') != null; + }); + + var BROKEN_CARET = fails(function () { + // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 + var re = RE('^r', 'gy'); + re.lastIndex = 2; + return re.exec('str') != null; + }); + + var regexpStickyHelpers = { + UNSUPPORTED_Y: UNSUPPORTED_Y$2, + BROKEN_CARET: BROKEN_CARET + }; + + var nativeExec = RegExp.prototype.exec; + // This always refers to the native implementation, because the + // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, + // which loads this file before patching the method. + var nativeReplace = String.prototype.replace; + + var patchedExec = nativeExec; + + var UPDATES_LAST_INDEX_WRONG = (function () { + var re1 = /a/; + var re2 = /b*/g; + nativeExec.call(re1, 'a'); + nativeExec.call(re2, 'a'); + return re1.lastIndex !== 0 || re2.lastIndex !== 0; + })(); + + var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; + + // nonparticipating capturing group, copied from es5-shim's String#split patch. + // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing + var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; + + var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1; + + if (PATCH) { + patchedExec = function exec(str) { + var re = this; + var lastIndex, reCopy, match, i; + var sticky = UNSUPPORTED_Y$1 && re.sticky; + var flags = regexpFlags.call(re); + var source = re.source; + var charsAdded = 0; + var strCopy = str; + + if (sticky) { + flags = flags.replace('y', ''); + if (flags.indexOf('g') === -1) { + flags += 'g'; + } + + strCopy = String(str).slice(re.lastIndex); + // Support anchored sticky behavior. + if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) { + source = '(?: ' + source + ')'; + strCopy = ' ' + strCopy; + charsAdded++; + } + // ^(? + rx + ) is needed, in combination with some str slicing, to + // simulate the 'y' flag. + reCopy = new RegExp('^(?:' + source + ')', flags); + } + + if (NPCG_INCLUDED) { + reCopy = new RegExp('^' + source + '$(?!\\s)', flags); + } + if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; + + match = nativeExec.call(sticky ? reCopy : re, strCopy); + + if (sticky) { + if (match) { + match.input = match.input.slice(charsAdded); + match[0] = match[0].slice(charsAdded); + match.index = re.lastIndex; + re.lastIndex += match[0].length; + } else re.lastIndex = 0; + } else if (UPDATES_LAST_INDEX_WRONG && match) { + re.lastIndex = re.global ? match.index + match[0].length : lastIndex; + } + if (NPCG_INCLUDED && match && match.length > 1) { + // Fix browsers whose `exec` methods don't consistently return `undefined` + // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ + nativeReplace.call(match[0], reCopy, function () { + for (i = 1; i < arguments.length - 2; i++) { + if (arguments[i] === undefined) match[i] = undefined; + } + }); + } + + return match; + }; + } + + var regexpExec = patchedExec; + + // `RegExp.prototype.exec` method + // https://tc39.es/ecma262/#sec-regexp.prototype.exec + _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, { + exec: regexpExec + }); + + var engineIsNode = classofRaw(global_1.process) == 'process'; + + var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; + + var process = global_1.process; + var versions = process && process.versions; + var v8 = versions && versions.v8; + var match, version; + + if (v8) { + match = v8.split('.'); + version = match[0] + match[1]; + } else if (engineUserAgent) { + match = engineUserAgent.match(/Edge\/(\d+)/); + if (!match || match[1] >= 74) { + match = engineUserAgent.match(/Chrome\/(\d+)/); + if (match) version = match[1]; + } + } + + var engineV8Version = version && +version; + + var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { + /* global Symbol -- required for testing */ + return !Symbol.sham && + // Chrome 38 Symbol has incorrect toString conversion + // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); + }); + + var useSymbolAsUid = nativeSymbol + /* global Symbol -- safe */ + && !Symbol.sham + && typeof Symbol.iterator == 'symbol'; + + var WellKnownSymbolsStore = shared('wks'); + var Symbol$1 = global_1.Symbol; + var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; + + var wellKnownSymbol = function (name) { + if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) { + if (nativeSymbol && has$1(Symbol$1, name)) { + WellKnownSymbolsStore[name] = Symbol$1[name]; + } else { + WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); + } + } return WellKnownSymbolsStore[name]; + }; + + // TODO: Remove from `core-js@4` since it's moved to entry points + + + + + + + + var SPECIES$3 = wellKnownSymbol('species'); + + var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { + // #replace needs built-in support for named groups. + // #match works fine because it just return the exec results, even if it has + // a "grops" property. + var re = /./; + re.exec = function () { + var result = []; + result.groups = { a: '7' }; + return result; + }; + return ''.replace(re, '$') !== '7'; + }); + + // IE <= 11 replaces $0 with the whole match, as if it was $& + // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 + var REPLACE_KEEPS_$0 = (function () { + return 'a'.replace(/./, '$0') === '$0'; + })(); + + var REPLACE = wellKnownSymbol('replace'); + // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string + var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { + if (/./[REPLACE]) { + return /./[REPLACE]('a', '$0') === ''; + } + return false; + })(); + + // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec + // Weex JS has frozen built-in prototypes, so use try / catch wrapper + var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { + // eslint-disable-next-line regexp/no-empty-group -- required for testing + var re = /(?:)/; + var originalExec = re.exec; + re.exec = function () { return originalExec.apply(this, arguments); }; + var result = 'ab'.split(re); + return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; + }); + + var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) { + var SYMBOL = wellKnownSymbol(KEY); + + var DELEGATES_TO_SYMBOL = !fails(function () { + // String methods call symbol-named RegEp methods + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + }); + + var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { + // Symbol-named RegExp methods call .exec + var execCalled = false; + var re = /a/; + + if (KEY === 'split') { + // We can't use real regex here since it causes deoptimization + // and serious performance degradation in V8 + // https://github.com/zloirock/core-js/issues/306 + re = {}; + // RegExp[@@split] doesn't call the regex's exec method, but first creates + // a new one. We need to return the patched regex when creating the new one. + re.constructor = {}; + re.constructor[SPECIES$3] = function () { return re; }; + re.flags = ''; + re[SYMBOL] = /./[SYMBOL]; + } + + re.exec = function () { execCalled = true; return null; }; + + re[SYMBOL](''); + return !execCalled; + }); + + if ( + !DELEGATES_TO_SYMBOL || + !DELEGATES_TO_EXEC || + (KEY === 'replace' && !( + REPLACE_SUPPORTS_NAMED_GROUPS && + REPLACE_KEEPS_$0 && + !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE + )) || + (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) + ) { + var nativeRegExpMethod = /./[SYMBOL]; + var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { + if (regexp.exec === regexpExec) { + if (DELEGATES_TO_SYMBOL && !forceStringMethod) { + // The native String method already delegates to @@method (this + // polyfilled function), leasing to infinite recursion. + // We avoid it by directly calling the native @@method method. + return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; + } + return { done: true, value: nativeMethod.call(str, regexp, arg2) }; + } + return { done: false }; + }, { + REPLACE_KEEPS_$0: REPLACE_KEEPS_$0, + REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE + }); + var stringMethod = methods[0]; + var regexMethod = methods[1]; + + redefine(String.prototype, KEY, stringMethod); + redefine(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function (string, arg) { return regexMethod.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return regexMethod.call(string, this); } + ); + } + + if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true); + }; + + // `SameValue` abstract operation + // https://tc39.es/ecma262/#sec-samevalue + var sameValue = Object.is || function is(x, y) { + // eslint-disable-next-line no-self-compare -- NaN check + return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; + }; + + // `RegExpExec` abstract operation + // https://tc39.es/ecma262/#sec-regexpexec + var regexpExecAbstract = function (R, S) { + var exec = R.exec; + if (typeof exec === 'function') { + var result = exec.call(R, S); + if (typeof result !== 'object') { + throw TypeError('RegExp exec method returned something other than an Object or null'); + } + return result; + } + + if (classofRaw(R) !== 'RegExp') { + throw TypeError('RegExp#exec called on incompatible receiver'); + } + + return regexpExec.call(R, S); + }; + + // @@search logic + fixRegexpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { + return [ + // `String.prototype.search` method + // https://tc39.es/ecma262/#sec-string.prototype.search + function search(regexp) { + var O = requireObjectCoercible(this); + var searcher = regexp == undefined ? undefined : regexp[SEARCH]; + return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, + // `RegExp.prototype[@@search]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@search + function (regexp) { + var res = maybeCallNative(nativeSearch, regexp, this); + if (res.done) return res.value; + + var rx = anObject(regexp); + var S = String(this); + + var previousLastIndex = rx.lastIndex; + if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0; + var result = regexpExecAbstract(rx, S); + if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; + return result === null ? -1 : result.index; + } + ]; + }); + + var aPossiblePrototype = function (it) { + if (!isObject(it) && it !== null) { + throw TypeError("Can't set " + String(it) + ' as a prototype'); + } return it; + }; + + /* eslint-disable no-proto -- safe */ + + + + // `Object.setPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.setprototypeof + // Works with __proto__ only. Old v8 can't work with null proto objects. + var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var CORRECT_SETTER = false; + var test = {}; + var setter; + try { + setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; + setter.call(test, []); + CORRECT_SETTER = test instanceof Array; + } catch (error) { /* empty */ } + return function setPrototypeOf(O, proto) { + anObject(O); + aPossiblePrototype(proto); + if (CORRECT_SETTER) setter.call(O, proto); + else O.__proto__ = proto; + return O; + }; + }() : undefined); + + // makes subclassing work correct for wrapped built-ins + var inheritIfRequired = function ($this, dummy, Wrapper) { + var NewTarget, NewTargetPrototype; + if ( + // it can work only with native `setPrototypeOf` + objectSetPrototypeOf && + // we haven't completely correct pre-ES6 way for getting `new.target`, so use this + typeof (NewTarget = dummy.constructor) == 'function' && + NewTarget !== Wrapper && + isObject(NewTargetPrototype = NewTarget.prototype) && + NewTargetPrototype !== Wrapper.prototype + ) objectSetPrototypeOf($this, NewTargetPrototype); + return $this; + }; + + var MATCH$1 = wellKnownSymbol('match'); + + // `IsRegExp` abstract operation + // https://tc39.es/ecma262/#sec-isregexp + var isRegexp = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp'); + }; + + var SPECIES$2 = wellKnownSymbol('species'); + + var setSpecies = function (CONSTRUCTOR_NAME) { + var Constructor = getBuiltIn(CONSTRUCTOR_NAME); + var defineProperty = objectDefineProperty.f; + + if (descriptors && Constructor && !Constructor[SPECIES$2]) { + defineProperty(Constructor, SPECIES$2, { + configurable: true, + get: function () { return this; } + }); + } + }; + + var defineProperty = objectDefineProperty.f; + var getOwnPropertyNames = objectGetOwnPropertyNames.f; + + + + + + var setInternalState = internalState.set; + + + + var MATCH = wellKnownSymbol('match'); + var NativeRegExp = global_1.RegExp; + var RegExpPrototype$1 = NativeRegExp.prototype; + var re1 = /a/g; + var re2 = /a/g; + + // "new" should create a new object, old webkit bug + var CORRECT_NEW = new NativeRegExp(re1) !== re1; + + var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y; + + var FORCED$1 = descriptors && isForced_1('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () { + re2[MATCH] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; + }))); + + // `RegExp` constructor + // https://tc39.es/ecma262/#sec-regexp-constructor + if (FORCED$1) { + var RegExpWrapper = function RegExp(pattern, flags) { + var thisIsRegExp = this instanceof RegExpWrapper; + var patternIsRegExp = isRegexp(pattern); + var flagsAreUndefined = flags === undefined; + var sticky; + + if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) { + return pattern; + } + + if (CORRECT_NEW) { + if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source; + } else if (pattern instanceof RegExpWrapper) { + if (flagsAreUndefined) flags = regexpFlags.call(pattern); + pattern = pattern.source; + } + + if (UNSUPPORTED_Y) { + sticky = !!flags && flags.indexOf('y') > -1; + if (sticky) flags = flags.replace(/y/g, ''); + } + + var result = inheritIfRequired( + CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), + thisIsRegExp ? this : RegExpPrototype$1, + RegExpWrapper + ); + + if (UNSUPPORTED_Y && sticky) setInternalState(result, { sticky: sticky }); + + return result; + }; + var proxy = function (key) { + key in RegExpWrapper || defineProperty(RegExpWrapper, key, { + configurable: true, + get: function () { return NativeRegExp[key]; }, + set: function (it) { NativeRegExp[key] = it; } + }); + }; + var keys = getOwnPropertyNames(NativeRegExp); + var index = 0; + while (keys.length > index) proxy(keys[index++]); + RegExpPrototype$1.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$1; + redefine(global_1, 'RegExp', RegExpWrapper); + } + + // https://tc39.es/ecma262/#sec-get-regexp-@@species + setSpecies('RegExp'); + + var TO_STRING = 'toString'; + var RegExpPrototype = RegExp.prototype; + var nativeToString = RegExpPrototype[TO_STRING]; + + var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); + // FF44- RegExp#toString has a wrong name + var INCORRECT_NAME = nativeToString.name != TO_STRING; + + // `RegExp.prototype.toString` method + // https://tc39.es/ecma262/#sec-regexp.prototype.tostring + if (NOT_GENERIC || INCORRECT_NAME) { + redefine(RegExp.prototype, TO_STRING, function toString() { + var R = anObject(this); + var p = String(R.source); + var rf = R.flags; + var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf); + return '/' + p + '/' + f; + }, { unsafe: true }); + } + + // `String.prototype.{ codePointAt, at }` methods implementation + var createMethod$1 = function (CONVERT_TO_STRING) { + return function ($this, pos) { + var S = String(requireObjectCoercible($this)); + var position = toInteger(pos); + var size = S.length; + var first, second; + if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; + first = S.charCodeAt(position); + return first < 0xD800 || first > 0xDBFF || position + 1 === size + || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF + ? CONVERT_TO_STRING ? S.charAt(position) : first + : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; + }; + }; + + var stringMultibyte = { + // `String.prototype.codePointAt` method + // https://tc39.es/ecma262/#sec-string.prototype.codepointat + codeAt: createMethod$1(false), + // `String.prototype.at` method + // https://github.com/mathiasbynens/String.prototype.at + charAt: createMethod$1(true) + }; + + var charAt = stringMultibyte.charAt; + + // `AdvanceStringIndex` abstract operation + // https://tc39.es/ecma262/#sec-advancestringindex + var advanceStringIndex = function (S, index, unicode) { + return index + (unicode ? charAt(S, index).length : 1); + }; + + // @@match logic + fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { + return [ + // `String.prototype.match` method + // https://tc39.es/ecma262/#sec-string.prototype.match + function match(regexp) { + var O = requireObjectCoercible(this); + var matcher = regexp == undefined ? undefined : regexp[MATCH]; + return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, + // `RegExp.prototype[@@match]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@match + function (regexp) { + var res = maybeCallNative(nativeMatch, regexp, this); + if (res.done) return res.value; + + var rx = anObject(regexp); + var S = String(this); + + if (!rx.global) return regexpExecAbstract(rx, S); + + var fullUnicode = rx.unicode; + rx.lastIndex = 0; + var A = []; + var n = 0; + var result; + while ((result = regexpExecAbstract(rx, S)) !== null) { + var matchStr = String(result[0]); + A[n] = matchStr; + if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); + n++; + } + return n === 0 ? null : A; + } + ]; + }); + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + var objectKeys = Object.keys || function keys(O) { + return objectKeysInternal(O, enumBugKeys); + }; + + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + + // `Object.{ entries, values }` methods implementation + var createMethod = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject(it); + var keys = objectKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!descriptors || propertyIsEnumerable.call(O, key)) { + result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; + }; + + var objectToArray = { + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + entries: createMethod(true), + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + values: createMethod(false) + }; + + var $entries = objectToArray.entries; + + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + _export({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); + } + }); + + // `IsArray` abstract operation + // https://tc39.es/ecma262/#sec-isarray + var isArray = Array.isArray || function isArray(arg) { + return classofRaw(arg) == 'Array'; + }; + + // `ToObject` abstract operation + // https://tc39.es/ecma262/#sec-toobject + var toObject = function (argument) { + return Object(requireObjectCoercible(argument)); + }; + + var createProperty = function (object, key, value) { + var propertyKey = toPrimitive(key); + if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); + else object[propertyKey] = value; + }; + + var SPECIES$1 = wellKnownSymbol('species'); + + // `ArraySpeciesCreate` abstract operation + // https://tc39.es/ecma262/#sec-arrayspeciescreate + var arraySpeciesCreate = function (originalArray, length) { + var C; + if (isArray(originalArray)) { + C = originalArray.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + else if (isObject(C)) { + C = C[SPECIES$1]; + if (C === null) C = undefined; + } + } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); + }; + + var SPECIES = wellKnownSymbol('species'); + + var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/677 + return engineV8Version >= 51 || !fails(function () { + var array = []; + var constructor = array.constructor = {}; + constructor[SPECIES] = function () { + return { foo: 1 }; + }; + return array[METHOD_NAME](Boolean).foo !== 1; + }); + }; + + var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; + var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; + + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/679 + var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () { + var array = []; + array[IS_CONCAT_SPREADABLE] = false; + return array.concat()[0] !== array; + }); + + var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); + + var isConcatSpreadable = function (O) { + if (!isObject(O)) return false; + var spreadable = O[IS_CONCAT_SPREADABLE]; + return spreadable !== undefined ? !!spreadable : isArray(O); + }; + + var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; + + // `Array.prototype.concat` method + // https://tc39.es/ecma262/#sec-array.prototype.concat + // with adding support of @@isConcatSpreadable and @@species + _export({ target: 'Array', proto: true, forced: FORCED }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + concat: function concat(arg) { + var O = toObject(this); + var A = arraySpeciesCreate(O, 0); + var n = 0; + var i, k, length, len, E; + for (i = -1, length = arguments.length; i < length; i++) { + E = i === -1 ? O : arguments[i]; + if (isConcatSpreadable(E)) { + len = toLength(E.length); + if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); + } else { + if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + createProperty(A, n++, E); + } + } + A.length = n; + return A; + } + }); + + var floor = Math.floor; + var replace = ''.replace; + var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; + var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; + + // https://tc39.es/ecma262/#sec-getsubstitution + var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) { + var tailPos = position + matched.length; + var m = captures.length; + var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; + if (namedCaptures !== undefined) { + namedCaptures = toObject(namedCaptures); + symbols = SUBSTITUTION_SYMBOLS; + } + return replace.call(replacement, symbols, function (match, ch) { + var capture; + switch (ch.charAt(0)) { + case '$': return '$'; + case '&': return matched; + case '`': return str.slice(0, position); + case "'": return str.slice(tailPos); + case '<': + capture = namedCaptures[ch.slice(1, -1)]; + break; + default: // \d\d? + var n = +ch; + if (n === 0) return match; + if (n > m) { + var f = floor(n / 10); + if (f === 0) return match; + if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); + return match; + } + capture = captures[n - 1]; + } + return capture === undefined ? '' : capture; + }); + }; + + var max = Math.max; + var min = Math.min; + + var maybeToString = function (it) { + return it === undefined ? it : String(it); + }; + + // @@replace logic + fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) { + var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE; + var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0; + var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; + + return [ + // `String.prototype.replace` method + // https://tc39.es/ecma262/#sec-string.prototype.replace + function replace(searchValue, replaceValue) { + var O = requireObjectCoercible(this); + var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; + return replacer !== undefined + ? replacer.call(searchValue, O, replaceValue) + : nativeReplace.call(String(O), searchValue, replaceValue); + }, + // `RegExp.prototype[@@replace]` method + // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace + function (regexp, replaceValue) { + if ( + (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) || + (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1) + ) { + var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); + if (res.done) return res.value; + } + + var rx = anObject(regexp); + var S = String(this); + + var functionalReplace = typeof replaceValue === 'function'; + if (!functionalReplace) replaceValue = String(replaceValue); + + var global = rx.global; + if (global) { + var fullUnicode = rx.unicode; + rx.lastIndex = 0; + } + var results = []; + while (true) { + var result = regexpExecAbstract(rx, S); + if (result === null) break; + + results.push(result); + if (!global) break; + + var matchStr = String(result[0]); + if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); + } + + var accumulatedResult = ''; + var nextSourcePosition = 0; + for (var i = 0; i < results.length; i++) { + result = results[i]; + + var matched = String(result[0]); + var position = max(min(toInteger(result.index), S.length), 0); + var captures = []; + // NOTE: This is equivalent to + // captures = result.slice(1).map(maybeToString) + // but for some reason `nativeSlice.call(result, 1, result.length)` (called in + // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and + // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. + for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); + var namedCaptures = result.groups; + if (functionalReplace) { + var replacerArgs = [matched].concat(captures, position, S); + if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); + var replacement = String(replaceValue.apply(undefined, replacerArgs)); + } else { + replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); + } + if (position >= nextSourcePosition) { + accumulatedResult += S.slice(nextSourcePosition, position) + replacement; + nextSourcePosition = position + matched.length; + } + } + return accumulatedResult + S.slice(nextSourcePosition); + } + ]; + }); + + /** + * @author: general + * @website: note.generals.space + * @email: generals.space@gmail.com + * @github: https://github.com/generals-space/bootstrap-table-addrbar + * @update: zhixin wen + */ + + /* + * function: 获取浏览器地址栏中的指定参数. + * key: 参数名 + * url: 默认为当前地址栏 + */ + + function _GET(key) { + var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.search; + /* * 注意这里正则表达式的书写方法 * (^|&)key匹配: 直接以key开始或以&key开始的字符串 * 同理(&|$)表示以&结束或是直接结束的字符串 * ...当然, 我并不知道这种用法. */ - const reg = new RegExp(`(^|&)${key}=([^&]*)(&|$)`) - const result = url.substr(1).match(reg) + var reg = new RegExp("(^|&)".concat(key, "=([^&]*)(&|$)")); + var result = url.substr(1).match(reg); if (result) { - return decodeURIComponent(result[2]) + return decodeURIComponent(result[2]); } - return null + + return null; } - /* - * function: 根据给定参数生成url地址 - * var dic = {name: 'genreal', age: 24} - * var url = 'https://www.baidu.com?age=22'; - * _buildUrl(dic, url); - * 将得到"https://www.baidu.com?age=24&name=genreal" - * 哦, 忽略先后顺序吧... - * - * 补充: 可以参考浏览器URLSearchParams对象, 更加方便和强大. - * 考虑到兼容性, 暂时不使用这个工具. - */ + * function: 根据给定参数生成url地址 + * var dic = {name: 'genreal', age: 24} + * var url = 'https://www.baidu.com?age=22'; + * _buildUrl(dic, url); + * 将得到"https://www.baidu.com?age=24&name=genreal" + * 哦, 忽略先后顺序吧... + * + * 补充: 可以参考浏览器URLSearchParams对象, 更加方便和强大. + * 考虑到兼容性, 暂时不使用这个工具. + */ + + + function _buildUrl(dict) { + var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.search; + + for (var _i = 0, _Object$entries = Object.entries(dict); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), + key = _Object$entries$_i[0], + val = _Object$entries$_i[1]; - function _buildUrl (dict, url = window.location.search) { - for (const [key, val] of Object.entries(dict)) { // 搜索name=general这种形式的字符串(&是分隔符) - const pattern = `${key}=([^&]*)` - const targetStr = `${key}=${val}` - + var pattern = "".concat(key, "=([^&]*)"); + var targetStr = "".concat(key, "=").concat(val); + if (val === undefined) continue; /* * 如果目标url中包含了key键, 我们需要将它替换成我们自己的val * 不然就直接添加好了. */ + if (url.match(pattern)) { - const tmp = new RegExp(`(${key}=)([^&]*)`, 'gi') - url = url.replace(tmp, targetStr) + var tmp = new RegExp("(".concat(key, "=)([^&]*)"), 'gi'); + url = url.replace(tmp, targetStr); } else { - const seperator = url.match('[?]') ? '&' : '?' - url = url + seperator + targetStr + var seperator = url.match('[?]') ? '&' : '?'; + url = url + seperator + targetStr; } } + if (location.hash) { - url += location.hash + url += location.hash; } - return url + + return url; + } + /* + * function: _updateHistoryState + * var _prefix = this.options.addrPrefix || '' + * var table = this + * _updateHistoryState( table,_prefix) + * returns void + */ + + + function _updateHistoryState(table, _prefix) { + var params = {}; + params["".concat(_prefix, "page")] = table.options.pageNumber; + params["".concat(_prefix, "size")] = table.options.pageSize; + params["".concat(_prefix, "order")] = table.options.sortOrder; + params["".concat(_prefix, "sort")] = table.options.sortName; + params["".concat(_prefix, "search")] = table.options.searchText; + window.history.pushState({}, '', _buildUrl(params)); } - $.BootstrapTable = class extends $.BootstrapTable { - init () { - // 拥有addrbar选项并且其值为true的才会继续执行 - if (this.options.addrbar) { - // 标志位, 初始加载后关闭 - this.addrbarInit = true - const _prefix = this.options.addrPrefix || '' + $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, { + addrbar: false, + addrPrefix: '' + }); - // 优先级排序: 用户指定值最优先, 未指定时从地址栏获取, 未获取到时采用默认值 - this.options.pageSize = this.options.pageSize || ( - _GET(`${_prefix}limit`) ? parseInt(_GET(`${_prefix}limit`)) : $.BootstrapTable.DEFAULTS.pageSize - ) - this.options.pageNumber = this.options.pageNumber || ( - _GET(`${_prefix}page`) ? parseInt(_GET(`${_prefix}page`)) : $.BootstrapTable.DEFAULTS.pageNumber - ) - this.options.sortOrder = this.options.sortOrder || ( - _GET(`${_prefix}order`) ? _GET(`${_prefix}order`) : $.BootstrapTable.DEFAULTS.sortOrder - ) - this.options.sortName = this.options.sortName || ( - _GET(`${_prefix}sort`) ? _GET(`${_prefix}sort`) : 'id' - ) - this.options.searchText = this.options.searchText || ( - _GET(`${_prefix}search`) ? _GET(`${_prefix}search`) : $.BootstrapTable.DEFAULTS.searchText - ) + $__default['default'].BootstrapTable = /*#__PURE__*/function (_$$BootstrapTable) { + _inherits(_class, _$$BootstrapTable); - const _onLoadSuccess = this.options.onLoadSuccess + var _super = _createSuper(_class); - this.options.onLoadSuccess = data => { - if (this.addrbarInit) { - this.addrbarInit = false - } else { - const params = {} - params[`${_prefix}page`] = this.options.pageNumber, - params[`${_prefix}limit`] = this.options.pageSize, - params[`${_prefix}order`] = this.options.sortOrder, - params[`${_prefix}sort`] = this.options.sortName, - params[`${_prefix}search`] = this.options.searchText - // h5提供的修改浏览器地址栏的方法 - window.history.pushState({}, '', _buildUrl(params)) - } + function _class() { + _classCallCheck(this, _class); - if (_onLoadSuccess) { - _onLoadSuccess.call(this, data) - } + return _super.apply(this, arguments); + } + + _createClass(_class, [{ + key: "init", + value: function init() { + var _this = this, + _get2; + + if (this.options.pagination && this.options.addrbar) { + // 标志位, 初始加载后关闭 + this.addrbarInit = true; + this.options.pageNumber = +this.getDefaultOptionValue('pageNumber', 'page'); + this.options.pageSize = +this.getDefaultOptionValue('pageSize', 'size'); + this.options.sortOrder = this.getDefaultOptionValue('sortOrder', 'order'); + this.options.sortName = this.getDefaultOptionValue('sortName', 'sort'); + this.options.searchText = this.getDefaultOptionValue('searchText', 'search'); + + var _prefix = this.options.addrPrefix || ''; + + var _onLoadSuccess = this.options.onLoadSuccess; + var _onPageChange = this.options.onPageChange; + + this.options.onLoadSuccess = function (data) { + if (_this.addrbarInit) { + _this.addrbarInit = false; + } else { + _updateHistoryState(_this, _prefix); + } + + if (_onLoadSuccess) { + _onLoadSuccess.call(_this, data); + } + }; + + this.options.onPageChange = function (number, size) { + _updateHistoryState(_this, _prefix); + + if (_onPageChange) { + _onPageChange.call(_this, number, size); + } + }; } + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + (_get2 = _get(_getPrototypeOf(_class.prototype), "init", this)).call.apply(_get2, [this].concat(args)); } - super.init() - } - } -})(jQuery) + /* + * Priority order: + * The value specified by the user has the highest priority. + * If it is not specified, it will be obtained from the address bar. + * If it is not obtained, the default value will be used. + */ + + }, { + key: "getDefaultOptionValue", + value: function getDefaultOptionValue(optionName, prefixName) { + if (this.options[optionName] !== $__default['default'].BootstrapTable.DEFAULTS[optionName]) { + return this.options[optionName]; + } + + return _GET("".concat(this.options.addrPrefix || '').concat(prefixName)) || $__default['default'].BootstrapTable.DEFAULTS[optionName]; + } + }]); + + return _class; + }($__default['default'].BootstrapTable); + +}))); diff --git a/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.min.js b/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.min.js new file mode 100644 index 0000000000..9cc62f2749 --- /dev/null +++ b/InvenTree/InvenTree/static/bootstrap-table/extensions/addrbar/bootstrap-table-addrbar.min.js @@ -0,0 +1,10 @@ +/** + * bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation) + * + * @version v1.18.3 + * @homepage https://bootstrap-table.com + * @author wenzhixin (http://wenzhixin.net.cn/) + * @license MIT + */ + +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?vt:gt)(t)},bt=Math.min,xt=function(t){return t>0?bt(yt(t),9007199254740991):0},mt=Math.max,Et=Math.min,St=function(t){return function(e,n,r){var o,i=P(e),a=xt(i.length),c=function(t,e){var n=yt(t);return n<0?mt(n+e,0):Et(n,e)}(r,a);if(t&&n!=n){for(;a>c;)if((o=i[c++])!=o)return!0}else for(;a>c;c++)if((t||c in i)&&i[c]===n)return t||c||0;return!t&&-1}},Ot={includes:St(!0),indexOf:St(!1)}.indexOf,wt=function(t,e){var n,r=P(t),o=0,i=[];for(n in r)!A(rt,n)&&A(r,n)&&i.push(n);for(;e.length>o;)A(r,n=e[o++])&&(~Ot(i,n)||i.push(n));return i},jt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Rt=jt.concat("length","prototype"),Pt={f:Object.getOwnPropertyNames||function(t){return wt(t,Rt)}},Tt={f:Object.getOwnPropertySymbols},_t=dt("Reflect","ownKeys")||function(t){var e=Pt.f(k(t)),n=Tt.f;return n?e.concat(n(t)):e},It=function(t,e){for(var n=_t(e),r=L.f,o=$.f,i=0;i0&&(!i.multiline||i.multiline&&"\n"!==t[i.lastIndex-1])&&(u="(?: "+u+")",l=" "+l,f++),n=new RegExp("^(?:"+u+")",c)),Wt&&(n=new RegExp("^"+u+"$(?!\\s)",c)),Gt&&(e=i.lastIndex),r=Vt.call(a?n:i,l),a?r?(r.input=r.input.slice(f),r[0]=r[0].slice(f),r.index=i.lastIndex,i.lastIndex+=r[0].length):i.lastIndex=0:Gt&&r&&(i.lastIndex=i.global?r.index+r[0].length:e),Wt&&r&&r.length>1&&Kt.call(r[0],n,(function(){for(o=1;o=74)&&(Qt=Zt.match(/Chrome\/(\d+)/))&&(Ht=Qt[1]);var re=Ht&&+Ht,oe=!!Object.getOwnPropertySymbols&&!v((function(){return!Symbol.sham&&(Jt?38===re:re>37&&re<41)})),ie=oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=J("wks"),ce=g.Symbol,ue=ie?ce:ce&&ce.withoutSetter||et,fe=function(t){return A(ae,t)&&(oe||"string"==typeof ae[t])||(oe&&A(ce,t)?ae[t]=ce[t]:ae[t]=ue("Symbol."+t)),ae[t]},le=fe("species"),se=!v((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})),pe="$0"==="a".replace(/./,"$0"),he=fe("replace"),de=!!/./[he]&&""===/./[he]("a","$0"),ge=!v((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),ve=function(t,e,n,r){var o=fe(t),i=!v((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),a=i&&!v((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[le]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!i||!a||"replace"===t&&(!se||!pe||de)||"split"===t&&!ge){var c=/./[o],u=n(o,""[t],(function(t,e,n,r,o){return e.exec===Xt?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),{REPLACE_KEEPS_$0:pe,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:de}),f=u[0],l=u[1];st(String.prototype,t,f),st(RegExp.prototype,o,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}r&&B(RegExp.prototype[o],"sham",!0)},ye=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e},be=function(t,e){var n=t.exec;if("function"==typeof n){var r=n.call(t,e);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==O(t))throw TypeError("RegExp#exec called on incompatible receiver");return Xt.call(t,e)};ve("search",1,(function(t,e,n){return[function(e){var n=R(this),r=null==e?void 0:e[t];return void 0!==r?r.call(e,n):new RegExp(e)[t](String(n))},function(t){var r=n(e,t,this);if(r.done)return r.value;var o=k(t),i=String(this),a=o.lastIndex;ye(a,0)||(o.lastIndex=0);var c=be(o,i);return ye(o.lastIndex,a)||(o.lastIndex=a),null===c?-1:c.index}]}));var xe=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return k(n),function(t){if(!T(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(r),e?t.call(n,r):n.__proto__=r,n}}():void 0),me=fe("match"),Ee=fe("species"),Se=L.f,Oe=Pt.f,we=lt.set,je=fe("match"),Re=g.RegExp,Pe=Re.prototype,Te=/a/g,_e=/a/g,Ie=new Re(Te)!==Te,Ae=zt.UNSUPPORTED_Y;if(y&&kt("RegExp",!Ie||Ae||v((function(){return _e[je]=!1,Re(Te)!=Te||Re(_e)==_e||"/a/i"!=Re(Te,"i")})))){for(var Ce=function(t,e){var n,r,o,i=this instanceof Ce,a=T(n=t)&&(void 0!==(r=n[me])?!!r:"RegExp"==O(n)),c=void 0===e;if(!i&&a&&t.constructor===Ce&&c)return t;Ie?a&&!c&&(t=t.source):t instanceof Ce&&(c&&(e=Bt.call(t)),t=t.source),Ae&&(o=!!e&&e.indexOf("y")>-1)&&(e=e.replace(/y/g,""));var u,f,l,s,p,h=(u=Ie?new Re(t,e):Re(t,e),f=i?this:Pe,l=Ce,xe&&"function"==typeof(s=f.constructor)&&s!==l&&T(p=s.prototype)&&p!==l.prototype&&xe(u,p),u);return Ae&&o&&we(h,{sticky:o}),h},De=function(t){t in Ce||Se(Ce,t,{configurable:!0,get:function(){return Re[t]},set:function(e){Re[t]=e}})},Ne=Oe(Re),Ue=0;Ne.length>Ue;)De(Ne[Ue++]);Pe.constructor=Ce,Ce.prototype=Pe,st(g,"RegExp",Ce)}!function(t){var e=dt(t),n=L.f;y&&e&&!e[Ee]&&n(e,Ee,{configurable:!0,get:function(){return this}})}("RegExp");var $e="toString",ke=RegExp.prototype,Me=ke.toString,Le=v((function(){return"/a/b"!=Me.call({source:"a",flags:"b"})})),Be=Me.name!=$e;(Le||Be)&&st(RegExp.prototype,$e,(function(){var t=k(this),e=String(t.source),n=t.flags;return"/"+e+"/"+String(void 0===n&&t instanceof RegExp&&!("flags"in ke)?Bt.call(t):n)}),{unsafe:!0});var Fe=function(t){return function(e,n){var r,o,i=String(R(e)),a=yt(n),c=i.length;return a<0||a>=c?t?"":void 0:(r=i.charCodeAt(a))<55296||r>56319||a+1===c||(o=i.charCodeAt(a+1))<56320||o>57343?t?i.charAt(a):r:t?i.slice(a,a+2):o-56320+(r-55296<<10)+65536}},ze={codeAt:Fe(!1),charAt:Fe(!0)}.charAt,Ve=function(t,e,n){return e+(n?ze(t,e).length:1)};ve("match",1,(function(t,e,n){return[function(e){var n=R(this),r=null==e?void 0:e[t];return void 0!==r?r.call(e,n):new RegExp(e)[t](String(n))},function(t){var r=n(e,t,this);if(r.done)return r.value;var o=k(t),i=String(this);if(!o.global)return be(o,i);var a=o.unicode;o.lastIndex=0;for(var c,u=[],f=0;null!==(c=be(o,i));){var l=String(c[0]);u[f]=l,""===l&&(o.lastIndex=Ve(i,xt(o.lastIndex),a)),f++}return 0===f?null:u}]}));var Ke=Object.keys||function(t){return wt(t,jt)},qe=m.f,Ge=function(t){return function(e){for(var n,r=P(e),o=Ke(r),i=o.length,a=0,c=[];i>a;)n=o[a++],y&&!qe.call(r,n)||c.push(t?[n,r[n]]:r[n]);return c}},Ye={entries:Ge(!0),values:Ge(!1)}.entries;Lt({target:"Object",stat:!0},{entries:function(t){return Ye(t)}});var We,Xe=Array.isArray||function(t){return"Array"==O(t)},Qe=function(t){return Object(R(t))},He=function(t,e,n){var r=_(e);r in t?L.f(t,r,E(0,n)):t[r]=n},Je=fe("species"),Ze=function(t,e){var n;return Xe(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Xe(n.prototype)?T(n)&&null===(n=n[Je])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},tn=fe("species"),en=fe("isConcatSpreadable"),nn=9007199254740991,rn="Maximum allowed index exceeded",on=re>=51||!v((function(){var t=[];return t[en]=!1,t.concat()[0]!==t})),an=(We="concat",re>=51||!v((function(){var t=[];return(t.constructor={})[tn]=function(){return{foo:1}},1!==t[We](Boolean).foo}))),cn=function(t){if(!T(t))return!1;var e=t[en];return void 0!==e?!!e:Xe(t)};Lt({target:"Array",proto:!0,forced:!on||!an},{concat:function(t){var e,n,r,o,i,a=Qe(this),c=Ze(a,0),u=0;for(e=-1,r=arguments.length;enn)throw TypeError(rn);for(n=0;n=nn)throw TypeError(rn);He(c,u++,i)}return c.length=u,c}});var un=Math.floor,fn="".replace,ln=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,sn=/\$([$&'`]|\d{1,2})/g,pn=function(t,e,n,r,o,i){var a=n+t.length,c=r.length,u=sn;return void 0!==o&&(o=Qe(o),u=ln),fn.call(i,u,(function(i,u){var f;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(a);case"<":f=o[u.slice(1,-1)];break;default:var l=+u;if(0===l)return i;if(l>c){var s=un(l/10);return 0===s?i:s<=c?void 0===r[s-1]?u.charAt(1):r[s-1]+u.charAt(1):i}f=r[l-1]}return void 0===f?"":f}))},hn=Math.max,dn=Math.min;function gn(t,e){var n={};n["".concat(e,"page")]=t.options.pageNumber,n["".concat(e,"size")]=t.options.pageSize,n["".concat(e,"order")]=t.options.sortOrder,n["".concat(e,"sort")]=t.options.sortName,n["".concat(e,"search")]=t.options.searchText,window.history.pushState({},"",function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search,n=0,r=Object.entries(t);n=y&&(v+=f.slice(y,m)+j,y=m+x.length)}return v+f.slice(y)}]})),n.default.extend(n.default.fn.bootstrapTable.defaults,{addrbar:!1,addrPrefix:""}),n.default.BootstrapTable=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(p,t);var e,c,l,s=u(p);function p(){return r(this,p),s.apply(this,arguments)}return e=p,(c=[{key:"init",value:function(){var t,e=this;if(this.options.pagination&&this.options.addrbar){this.addrbarInit=!0,this.options.pageNumber=+this.getDefaultOptionValue("pageNumber","page"),this.options.pageSize=+this.getDefaultOptionValue("pageSize","size"),this.options.sortOrder=this.getDefaultOptionValue("sortOrder","order"),this.options.sortName=this.getDefaultOptionValue("sortName","sort"),this.options.searchText=this.getDefaultOptionValue("searchText","search");var n=this.options.addrPrefix||"",r=this.options.onLoadSuccess,o=this.options.onPageChange;this.options.onLoadSuccess=function(t){e.addrbarInit?e.addrbarInit=!1:gn(e,n),r&&r.call(e,t)},this.options.onPageChange=function(t,r){gn(e,n),o&&o.call(e,t,r)}}for(var a=arguments.length,c=new Array(a),u=0;u1&&void 0!==arguments[1]?arguments[1]:window.location.search,n=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),r=e.substr(1).match(n);return r?decodeURIComponent(r[2]):null}("".concat(this.options.addrPrefix||"").concat(e))||n.default.BootstrapTable.DEFAULTS[t]}}])&&o(e.prototype,c),l&&o(e,l),p}(n.default.BootstrapTable)})); diff --git a/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js b/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js index 42edf633e9..287b4bd6b9 100644 --- a/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +++ b/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js @@ -1,78 +1,1211 @@ -/** - * @author: Alec Fenichel - * @webSite: https://fenichelar.com - * @update: zhixin wen - */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : + typeof define === 'function' && define.amd ? define(['jquery'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery)); +}(this, (function ($) { 'use strict'; -($ => { - const Utils = $.fn.bootstrapTable.utils + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - $.extend($.fn.bootstrapTable.defaults, { + var $__default = /*#__PURE__*/_interopDefaultLegacy($); + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + function _createSuper(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct(); + + return function _createSuperInternal() { + var Super = _getPrototypeOf(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possibleConstructorReturn(this, result); + }; + } + + function _superPropBase(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = _getPrototypeOf(object); + if (object === null) break; + } + + return object; + } + + function _get(target, property, receiver) { + if (typeof Reflect !== "undefined" && Reflect.get) { + _get = Reflect.get; + } else { + _get = function _get(target, property, receiver) { + var base = _superPropBase(target, property); + + if (!base) return; + var desc = Object.getOwnPropertyDescriptor(base, property); + + if (desc.get) { + return desc.get.call(receiver); + } + + return desc.value; + }; + } + + return _get(target, property, receiver || target); + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var check = function (it) { + return it && it.Math == Math && it; + }; + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global_1 = + /* global globalThis -- safe */ + check(typeof globalThis == 'object' && globalThis) || + check(typeof window == 'object' && window) || + check(typeof self == 'object' && self) || + check(typeof commonjsGlobal == 'object' && commonjsGlobal) || + // eslint-disable-next-line no-new-func -- fallback + (function () { return this; })() || Function('return this')(); + + var fails = function (exec) { + try { + return !!exec(); + } catch (error) { + return true; + } + }; + + // Detect IE8's incomplete defineProperty implementation + var descriptors = !fails(function () { + return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; + }); + + var nativePropertyIsEnumerable = {}.propertyIsEnumerable; + var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + + // Nashorn ~ JDK8 bug + var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); + + // `Object.prototype.propertyIsEnumerable` method implementation + // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable + var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$1(this, V); + return !!descriptor && descriptor.enumerable; + } : nativePropertyIsEnumerable; + + var objectPropertyIsEnumerable = { + f: f$4 + }; + + var createPropertyDescriptor = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + + var toString = {}.toString; + + var classofRaw = function (it) { + return toString.call(it).slice(8, -1); + }; + + var split = ''.split; + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var indexedObject = fails(function () { + // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 + // eslint-disable-next-line no-prototype-builtins -- safe + return !Object('z').propertyIsEnumerable(0); + }) ? function (it) { + return classofRaw(it) == 'String' ? split.call(it, '') : Object(it); + } : Object; + + // `RequireObjectCoercible` abstract operation + // https://tc39.es/ecma262/#sec-requireobjectcoercible + var requireObjectCoercible = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; + }; + + // toObject with fallback for non-array-like ES3 strings + + + + var toIndexedObject = function (it) { + return indexedObject(requireObjectCoercible(it)); + }; + + var isObject = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + + // `ToPrimitive` abstract operation + // https://tc39.es/ecma262/#sec-toprimitive + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + var toPrimitive = function (input, PREFERRED_STRING) { + if (!isObject(input)) return input; + var fn, val; + if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; + if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; + throw TypeError("Can't convert object to primitive value"); + }; + + var hasOwnProperty = {}.hasOwnProperty; + + var has$1 = function (it, key) { + return hasOwnProperty.call(it, key); + }; + + var document$1 = global_1.document; + // typeof document.createElement is 'object' in old IE + var EXISTS = isObject(document$1) && isObject(document$1.createElement); + + var documentCreateElement = function (it) { + return EXISTS ? document$1.createElement(it) : {}; + }; + + // Thank's IE8 for his funny defineProperty + var ie8DomDefine = !descriptors && !fails(function () { + return Object.defineProperty(documentCreateElement('div'), 'a', { + get: function () { return 7; } + }).a != 7; + }); + + var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor + var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject(O); + P = toPrimitive(P, true); + if (ie8DomDefine) try { + return nativeGetOwnPropertyDescriptor(O, P); + } catch (error) { /* empty */ } + if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); + }; + + var objectGetOwnPropertyDescriptor = { + f: f$3 + }; + + var anObject = function (it) { + if (!isObject(it)) { + throw TypeError(String(it) + ' is not an object'); + } return it; + }; + + var nativeDefineProperty = Object.defineProperty; + + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (ie8DomDefine) try { + return nativeDefineProperty(O, P, Attributes); + } catch (error) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + + var objectDefineProperty = { + f: f$2 + }; + + var createNonEnumerableProperty = descriptors ? function (object, key, value) { + return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); + } : function (object, key, value) { + object[key] = value; + return object; + }; + + var setGlobal = function (key, value) { + try { + createNonEnumerableProperty(global_1, key, value); + } catch (error) { + global_1[key] = value; + } return value; + }; + + var SHARED = '__core-js_shared__'; + var store$1 = global_1[SHARED] || setGlobal(SHARED, {}); + + var sharedStore = store$1; + + var functionToString = Function.toString; + + // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper + if (typeof sharedStore.inspectSource != 'function') { + sharedStore.inspectSource = function (it) { + return functionToString.call(it); + }; + } + + var inspectSource = sharedStore.inspectSource; + + var WeakMap$1 = global_1.WeakMap; + + var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1)); + + var shared = createCommonjsModule(function (module) { + (module.exports = function (key, value) { + return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); + })('versions', []).push({ + version: '3.9.1', + mode: 'global', + copyright: '© 2021 Denis Pushkarev (zloirock.ru)' + }); + }); + + var id = 0; + var postfix = Math.random(); + + var uid = function (key) { + return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); + }; + + var keys = shared('keys'); + + var sharedKey = function (key) { + return keys[key] || (keys[key] = uid(key)); + }; + + var hiddenKeys$1 = {}; + + var WeakMap = global_1.WeakMap; + var set, get, has; + + var enforce = function (it) { + return has(it) ? get(it) : set(it, {}); + }; + + var getterFor = function (TYPE) { + return function (it) { + var state; + if (!isObject(it) || (state = get(it)).type !== TYPE) { + throw TypeError('Incompatible receiver, ' + TYPE + ' required'); + } return state; + }; + }; + + if (nativeWeakMap) { + var store = sharedStore.state || (sharedStore.state = new WeakMap()); + var wmget = store.get; + var wmhas = store.has; + var wmset = store.set; + set = function (it, metadata) { + metadata.facade = it; + wmset.call(store, it, metadata); + return metadata; + }; + get = function (it) { + return wmget.call(store, it) || {}; + }; + has = function (it) { + return wmhas.call(store, it); + }; + } else { + var STATE = sharedKey('state'); + hiddenKeys$1[STATE] = true; + set = function (it, metadata) { + metadata.facade = it; + createNonEnumerableProperty(it, STATE, metadata); + return metadata; + }; + get = function (it) { + return has$1(it, STATE) ? it[STATE] : {}; + }; + has = function (it) { + return has$1(it, STATE); + }; + } + + var internalState = { + set: set, + get: get, + has: has, + enforce: enforce, + getterFor: getterFor + }; + + var redefine = createCommonjsModule(function (module) { + var getInternalState = internalState.get; + var enforceInternalState = internalState.enforce; + var TEMPLATE = String(String).split('String'); + + (module.exports = function (O, key, value, options) { + var unsafe = options ? !!options.unsafe : false; + var simple = options ? !!options.enumerable : false; + var noTargetGet = options ? !!options.noTargetGet : false; + var state; + if (typeof value == 'function') { + if (typeof key == 'string' && !has$1(value, 'name')) { + createNonEnumerableProperty(value, 'name', key); + } + state = enforceInternalState(value); + if (!state.source) { + state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); + } + } + if (O === global_1) { + if (simple) O[key] = value; + else setGlobal(key, value); + return; + } else if (!unsafe) { + delete O[key]; + } else if (!noTargetGet && O[key]) { + simple = true; + } + if (simple) O[key] = value; + else createNonEnumerableProperty(O, key, value); + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative + })(Function.prototype, 'toString', function toString() { + return typeof this == 'function' && getInternalState(this).source || inspectSource(this); + }); + }); + + var path = global_1; + + var aFunction$1 = function (variable) { + return typeof variable == 'function' ? variable : undefined; + }; + + var getBuiltIn = function (namespace, method) { + return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace]) + : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; + }; + + var ceil = Math.ceil; + var floor = Math.floor; + + // `ToInteger` abstract operation + // https://tc39.es/ecma262/#sec-tointeger + var toInteger = function (argument) { + return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); + }; + + var min$1 = Math.min; + + // `ToLength` abstract operation + // https://tc39.es/ecma262/#sec-tolength + var toLength = function (argument) { + return argument > 0 ? min$1(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + }; + + var max = Math.max; + var min = Math.min; + + // Helper for a popular repeating case of the spec: + // Let integer be ? ToInteger(index). + // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). + var toAbsoluteIndex = function (index, length) { + var integer = toInteger(index); + return integer < 0 ? max(integer + length, 0) : min(integer, length); + }; + + // `Array.prototype.{ indexOf, includes }` methods implementation + var createMethod$1 = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIndexedObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare -- NaN check + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare -- NaN check + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + + var arrayIncludes = { + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + includes: createMethod$1(true), + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + indexOf: createMethod$1(false) + }; + + var indexOf = arrayIncludes.indexOf; + + + var objectKeysInternal = function (object, names) { + var O = toIndexedObject(object); + var i = 0; + var result = []; + var key; + for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has$1(O, key = names[i++])) { + ~indexOf(result, key) || result.push(key); + } + return result; + }; + + // IE8- don't enum bug keys + var enumBugKeys = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' + ]; + + var hiddenKeys = enumBugKeys.concat('length', 'prototype'); + + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return objectKeysInternal(O, hiddenKeys); + }; + + var objectGetOwnPropertyNames = { + f: f$1 + }; + + var f = Object.getOwnPropertySymbols; + + var objectGetOwnPropertySymbols = { + f: f + }; + + // all object keys, includes non-enumerable and symbols + var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { + var keys = objectGetOwnPropertyNames.f(anObject(it)); + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; + }; + + var copyConstructorProperties = function (target, source) { + var keys = ownKeys(source); + var defineProperty = objectDefineProperty.f; + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } + }; + + var replacement = /#|\.prototype\./; + + var isForced = function (feature, detection) { + var value = data[normalize(feature)]; + return value == POLYFILL ? true + : value == NATIVE ? false + : typeof detection == 'function' ? fails(detection) + : !!detection; + }; + + var normalize = isForced.normalize = function (string) { + return String(string).replace(replacement, '.').toLowerCase(); + }; + + var data = isForced.data = {}; + var NATIVE = isForced.NATIVE = 'N'; + var POLYFILL = isForced.POLYFILL = 'P'; + + var isForced_1 = isForced; + + var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + + + + + + + /* + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.noTargetGet - prevent calling a getter on target + */ + var _export = function (options, source) { + var TARGET = options.target; + var GLOBAL = options.global; + var STATIC = options.stat; + var FORCED, target, key, targetProperty, sourceProperty, descriptor; + if (GLOBAL) { + target = global_1; + } else if (STATIC) { + target = global_1[TARGET] || setGlobal(TARGET, {}); + } else { + target = (global_1[TARGET] || {}).prototype; + } + if (target) for (key in source) { + sourceProperty = source[key]; + if (options.noTargetGet) { + descriptor = getOwnPropertyDescriptor(target, key); + targetProperty = descriptor && descriptor.value; + } else targetProperty = target[key]; + FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); + // contained in target + if (!FORCED && targetProperty !== undefined) { + if (typeof sourceProperty === typeof targetProperty) continue; + copyConstructorProperties(sourceProperty, targetProperty); + } + // add a flag to not completely full polyfills + if (options.sham || (targetProperty && targetProperty.sham)) { + createNonEnumerableProperty(sourceProperty, 'sham', true); + } + // extend global + redefine(target, key, sourceProperty, options); + } + }; + + // `IsArray` abstract operation + // https://tc39.es/ecma262/#sec-isarray + var isArray = Array.isArray || function isArray(arg) { + return classofRaw(arg) == 'Array'; + }; + + // `ToObject` abstract operation + // https://tc39.es/ecma262/#sec-toobject + var toObject = function (argument) { + return Object(requireObjectCoercible(argument)); + }; + + var createProperty = function (object, key, value) { + var propertyKey = toPrimitive(key); + if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); + else object[propertyKey] = value; + }; + + var engineIsNode = classofRaw(global_1.process) == 'process'; + + var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; + + var process = global_1.process; + var versions = process && process.versions; + var v8 = versions && versions.v8; + var match, version; + + if (v8) { + match = v8.split('.'); + version = match[0] + match[1]; + } else if (engineUserAgent) { + match = engineUserAgent.match(/Edge\/(\d+)/); + if (!match || match[1] >= 74) { + match = engineUserAgent.match(/Chrome\/(\d+)/); + if (match) version = match[1]; + } + } + + var engineV8Version = version && +version; + + var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { + /* global Symbol -- required for testing */ + return !Symbol.sham && + // Chrome 38 Symbol has incorrect toString conversion + // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + (engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41); + }); + + var useSymbolAsUid = nativeSymbol + /* global Symbol -- safe */ + && !Symbol.sham + && typeof Symbol.iterator == 'symbol'; + + var WellKnownSymbolsStore = shared('wks'); + var Symbol$1 = global_1.Symbol; + var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; + + var wellKnownSymbol = function (name) { + if (!has$1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) { + if (nativeSymbol && has$1(Symbol$1, name)) { + WellKnownSymbolsStore[name] = Symbol$1[name]; + } else { + WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); + } + } return WellKnownSymbolsStore[name]; + }; + + var SPECIES$1 = wellKnownSymbol('species'); + + // `ArraySpeciesCreate` abstract operation + // https://tc39.es/ecma262/#sec-arrayspeciescreate + var arraySpeciesCreate = function (originalArray, length) { + var C; + if (isArray(originalArray)) { + C = originalArray.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + else if (isObject(C)) { + C = C[SPECIES$1]; + if (C === null) C = undefined; + } + } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); + }; + + var SPECIES = wellKnownSymbol('species'); + + var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/677 + return engineV8Version >= 51 || !fails(function () { + var array = []; + var constructor = array.constructor = {}; + constructor[SPECIES] = function () { + return { foo: 1 }; + }; + return array[METHOD_NAME](Boolean).foo !== 1; + }); + }; + + var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; + var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; + + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/679 + var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () { + var array = []; + array[IS_CONCAT_SPREADABLE] = false; + return array.concat()[0] !== array; + }); + + var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); + + var isConcatSpreadable = function (O) { + if (!isObject(O)) return false; + var spreadable = O[IS_CONCAT_SPREADABLE]; + return spreadable !== undefined ? !!spreadable : isArray(O); + }; + + var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; + + // `Array.prototype.concat` method + // https://tc39.es/ecma262/#sec-array.prototype.concat + // with adding support of @@isConcatSpreadable and @@species + _export({ target: 'Array', proto: true, forced: FORCED }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + concat: function concat(arg) { + var O = toObject(this); + var A = arraySpeciesCreate(O, 0); + var n = 0; + var i, k, length, len, E; + for (i = -1, length = arguments.length; i < length; i++) { + E = i === -1 ? O : arguments[i]; + if (isConcatSpreadable(E)) { + len = toLength(E.length); + if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); + } else { + if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); + createProperty(A, n++, E); + } + } + A.length = n; + return A; + } + }); + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + var objectKeys = Object.keys || function keys(O) { + return objectKeysInternal(O, enumBugKeys); + }; + + var nativeAssign = Object.assign; + var defineProperty = Object.defineProperty; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + var objectAssign = !nativeAssign || fails(function () { + // should have correct order of operations (Edge bug) + if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { + enumerable: true, + get: function () { + defineProperty(this, 'b', { + value: 3, + enumerable: false + }); + } + }), { b: 2 })).b !== 1) return true; + // should work with symbols and should have deterministic property order (V8 bug) + var A = {}; + var B = {}; + /* global Symbol -- required for testing */ + var symbol = Symbol(); + var alphabet = 'abcdefghijklmnopqrst'; + A[symbol] = 7; + alphabet.split('').forEach(function (chr) { B[chr] = chr; }); + return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; + }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` + var T = toObject(target); + var argumentsLength = arguments.length; + var index = 1; + var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + var propertyIsEnumerable = objectPropertyIsEnumerable.f; + while (argumentsLength > index) { + var S = indexedObject(arguments[index++]); + var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) { + key = keys[j++]; + if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; + } + } return T; + } : nativeAssign; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { + assign: objectAssign + }); + + var aFunction = function (it) { + if (typeof it != 'function') { + throw TypeError(String(it) + ' is not a function'); + } return it; + }; + + // optional / simple context binding + var functionBindContext = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 0: return function () { + return fn.call(that); + }; + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; + }; + + var push = [].push; + + // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation + var createMethod = function (TYPE) { + var IS_MAP = TYPE == 1; + var IS_FILTER = TYPE == 2; + var IS_SOME = TYPE == 3; + var IS_EVERY = TYPE == 4; + var IS_FIND_INDEX = TYPE == 6; + var IS_FILTER_OUT = TYPE == 7; + var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; + return function ($this, callbackfn, that, specificCreate) { + var O = toObject($this); + var self = indexedObject(O); + var boundFunction = functionBindContext(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var create = specificCreate || arraySpeciesCreate; + var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined; + var value, result; + for (;length > index; index++) if (NO_HOLES || index in self) { + value = self[index]; + result = boundFunction(value, index, O); + if (TYPE) { + if (IS_MAP) target[index] = result; // map + else if (result) switch (TYPE) { + case 3: return true; // some + case 5: return value; // find + case 6: return index; // findIndex + case 2: push.call(target, value); // filter + } else switch (TYPE) { + case 4: return false; // every + case 7: push.call(target, value); // filterOut + } + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; + }; + }; + + var arrayIteration = { + // `Array.prototype.forEach` method + // https://tc39.es/ecma262/#sec-array.prototype.foreach + forEach: createMethod(0), + // `Array.prototype.map` method + // https://tc39.es/ecma262/#sec-array.prototype.map + map: createMethod(1), + // `Array.prototype.filter` method + // https://tc39.es/ecma262/#sec-array.prototype.filter + filter: createMethod(2), + // `Array.prototype.some` method + // https://tc39.es/ecma262/#sec-array.prototype.some + some: createMethod(3), + // `Array.prototype.every` method + // https://tc39.es/ecma262/#sec-array.prototype.every + every: createMethod(4), + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + find: createMethod(5), + // `Array.prototype.findIndex` method + // https://tc39.es/ecma262/#sec-array.prototype.findIndex + findIndex: createMethod(6), + // `Array.prototype.filterOut` method + // https://github.com/tc39/proposal-array-filtering + filterOut: createMethod(7) + }; + + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = objectKeys(Properties); + var length = keys.length; + var index = 0; + var key; + while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]); + return O; + }; + + var html = getBuiltIn('document', 'documentElement'); + + var GT = '>'; + var LT = '<'; + var PROTOTYPE = 'prototype'; + var SCRIPT = 'script'; + var IE_PROTO = sharedKey('IE_PROTO'); + + var EmptyConstructor = function () { /* empty */ }; + + var scriptTag = function (content) { + return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; + }; + + // Create object with fake `null` prototype: use ActiveX Object with cleared prototype + var NullProtoObjectViaActiveX = function (activeXDocument) { + activeXDocument.write(scriptTag('')); + activeXDocument.close(); + var temp = activeXDocument.parentWindow.Object; + activeXDocument = null; // avoid memory leak + return temp; + }; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var NullProtoObjectViaIFrame = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = documentCreateElement('iframe'); + var JS = 'java' + SCRIPT + ':'; + var iframeDocument; + iframe.style.display = 'none'; + html.appendChild(iframe); + // https://github.com/zloirock/core-js/issues/475 + iframe.src = String(JS); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(scriptTag('document.F=Object')); + iframeDocument.close(); + return iframeDocument.F; + }; + + // Check for document.domain and active x support + // No need to use active x approach when document.domain is not set + // see https://github.com/es-shims/es5-shim/issues/150 + // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 + // avoid IE GC bug + var activeXDocument; + var NullProtoObject = function () { + try { + /* global ActiveXObject -- old IE */ + activeXDocument = document.domain && new ActiveXObject('htmlfile'); + } catch (error) { /* ignore */ } + NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); + var length = enumBugKeys.length; + while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; + return NullProtoObject(); + }; + + hiddenKeys$1[IE_PROTO] = true; + + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + var objectCreate = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + EmptyConstructor[PROTOTYPE] = anObject(O); + result = new EmptyConstructor(); + EmptyConstructor[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = NullProtoObject(); + return Properties === undefined ? result : objectDefineProperties(result, Properties); + }; + + var UNSCOPABLES = wellKnownSymbol('unscopables'); + var ArrayPrototype = Array.prototype; + + // Array.prototype[@@unscopables] + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + if (ArrayPrototype[UNSCOPABLES] == undefined) { + objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, { + configurable: true, + value: objectCreate(null) + }); + } + + // add a key to Array.prototype[@@unscopables] + var addToUnscopables = function (key) { + ArrayPrototype[UNSCOPABLES][key] = true; + }; + + var $find = arrayIteration.find; + + + var FIND = 'find'; + var SKIPS_HOLES = true; + + // Shouldn't skip holes + if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); + + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + addToUnscopables(FIND); + + /** + * @author: Alec Fenichel + * @webSite: https://fenichelar.com + * @update: zhixin wen + */ + + var Utils = $__default['default'].fn.bootstrapTable.utils; + $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, { autoRefresh: false, autoRefreshInterval: 60, autoRefreshSilent: true, autoRefreshStatus: true, autoRefreshFunction: null - }) - - $.extend($.fn.bootstrapTable.defaults.icons, { - autoRefresh: Utils.bootstrapVersion === 4 ? 'fa-clock' : 'glyphicon-time icon-time' - }) - - $.extend($.fn.bootstrapTable.locales, { - formatAutoRefresh () { - return 'Auto Refresh' + }); + $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults.icons, { + autoRefresh: { + bootstrap3: 'glyphicon-time icon-time', + materialize: 'access_time', + 'bootstrap-table': 'icon-clock' + }[$__default['default'].fn.bootstrapTable.theme] || 'fa-clock' + }); + $__default['default'].extend($__default['default'].fn.bootstrapTable.locales, { + formatAutoRefresh: function formatAutoRefresh() { + return 'Auto Refresh'; } - }) + }); + $__default['default'].extend($__default['default'].fn.bootstrapTable.defaults, $__default['default'].fn.bootstrapTable.locales); - $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) + $__default['default'].BootstrapTable = /*#__PURE__*/function (_$$BootstrapTable) { + _inherits(_class, _$$BootstrapTable); - $.BootstrapTable = class extends $.BootstrapTable { - init (...args) { - super.init(...args) + var _super = _createSuper(_class); - if (this.options.autoRefresh && this.options.autoRefreshStatus) { - this.options.autoRefreshFunction = setInterval(() => { - this.refresh({silent: this.options.autoRefreshSilent}) - }, this.options.autoRefreshInterval * 1000) - } + function _class() { + _classCallCheck(this, _class); + + return _super.apply(this, arguments); } - initToolbar (...args) { - super.initToolbar(...args) + _createClass(_class, [{ + key: "init", + value: function init() { + var _get2; - if (this.options.autoRefresh) { - const $btnGroup = this.$toolbar.find('>.btn-group') - let $btnAutoRefresh = $btnGroup.find('.auto-refresh') + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } - if (!$btnAutoRefresh.length) { - $btnAutoRefresh = $(` - - `).appendTo($btnGroup) + (_get2 = _get(_getPrototypeOf(_class.prototype), "init", this)).call.apply(_get2, [this].concat(args)); - $btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this)) + if (this.options.autoRefresh && this.options.autoRefreshStatus) { + this.setupRefreshInterval(); } } - } + }, { + key: "initToolbar", + value: function initToolbar() { + var _get3; - toggleAutoRefresh () { - if (this.options.autoRefresh) { - if (this.options.autoRefreshStatus) { - clearInterval(this.options.autoRefreshFunction) - this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('active') - } else { - this.options.autoRefreshFunction = setInterval(() => { - this.refresh({silent: this.options.autoRefreshSilent}) - }, this.options.autoRefreshInterval * 1000) - this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('active') + if (this.options.autoRefresh) { + this.buttons = Object.assign(this.buttons, { + autoRefresh: { + html: "\n \n "), + event: this.toggleAutoRefresh + } + }); } - this.options.autoRefreshStatus = !this.options.autoRefreshStatus + + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + (_get3 = _get(_getPrototypeOf(_class.prototype), "initToolbar", this)).call.apply(_get3, [this].concat(args)); } - } - } -})(jQuery) + }, { + key: "toggleAutoRefresh", + value: function toggleAutoRefresh() { + if (this.options.autoRefresh) { + if (this.options.autoRefreshStatus) { + clearInterval(this.options.autoRefreshFunction); + this.$toolbar.find('>.columns .auto-refresh').removeClass(this.constants.classes.buttonActive); + } else { + this.setupRefreshInterval(); + this.$toolbar.find('>.columns .auto-refresh').addClass(this.constants.classes.buttonActive); + } + + this.options.autoRefreshStatus = !this.options.autoRefreshStatus; + } + } + }, { + key: "destroy", + value: function destroy() { + if (this.options.autoRefresh && this.options.autoRefreshStatus) { + clearInterval(this.options.autoRefreshFunction); + } + + _get(_getPrototypeOf(_class.prototype), "destroy", this).call(this); + } + }, { + key: "setupRefreshInterval", + value: function setupRefreshInterval() { + var _this = this; + + this.options.autoRefreshFunction = setInterval(function () { + if (!_this.options.autoRefresh || !_this.options.autoRefreshStatus) { + return; + } + + _this.refresh({ + silent: _this.options.autoRefreshSilent + }); + }, this.options.autoRefreshInterval * 1000); + } + }]); + + return _class; + }($__default['default'].BootstrapTable); + +}))); diff --git a/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js b/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js new file mode 100644 index 0000000000..6f73d42111 --- /dev/null +++ b/InvenTree/InvenTree/static/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js @@ -0,0 +1,10 @@ +/** + * bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation) + * + * @version v1.18.3 + * @homepage https://bootstrap-table.com + * @author wenzhixin (http://wenzhixin.net.cn/) + * @license MIT + */ + +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n0?vt:bt)(t)},mt=Math.min,wt=function(t){return t>0?mt(gt(t),9007199254740991):0},Ot=Math.max,jt=Math.min,Rt=function(t){return function(e,n,r){var o,i=T(e),u=wt(i.length),c=function(t,e){var n=gt(t);return n<0?Ot(n+e,0):jt(n,e)}(r,u);if(t&&n!=n){for(;u>c;)if((o=i[c++])!=o)return!0}else for(;u>c;c++)if((t||c in i)&&i[c]===n)return t||c||0;return!t&&-1}},St={includes:Rt(!0),indexOf:Rt(!1)}.indexOf,Tt=function(t,e){var n,r=T(t),o=0,i=[];for(n in r)!x(nt,n)&&x(r,n)&&i.push(n);for(;e.length>o;)x(r,n=e[o++])&&(~St(i,n)||i.push(n));return i},Pt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],At=Pt.concat("length","prototype"),Et={f:Object.getOwnPropertyNames||function(t){return Tt(t,At)}},xt={f:Object.getOwnPropertySymbols},It=dt("Reflect","ownKeys")||function(t){var e=Et.f(B(t)),n=xt.f;return n?e.concat(n(t)):e},kt=function(t,e){for(var n=It(e),r=L.f,o=C.f,i=0;i=74)&&(ft=Kt.match(/Chrome\/(\d+)/))&&(st=ft[1]);var Yt,Ht=st&&+st,Jt=!!Object.getOwnPropertySymbols&&!y((function(){return!Symbol.sham&&($t?38===Ht:Ht>37&&Ht<41)})),Ut=Jt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Zt=H("wks"),te=h.Symbol,ee=Ut?te:te&&te.withoutSetter||Z,ne=function(t){return x(Zt,t)&&(Jt||"string"==typeof Zt[t])||(Jt&&x(te,t)?Zt[t]=te[t]:Zt[t]=ee("Symbol."+t)),Zt[t]},re=ne("species"),oe=function(t,e){var n;return Dt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Dt(n.prototype)?P(n)&&null===(n=n[re])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},ie=ne("species"),ue=ne("isConcatSpreadable"),ce=9007199254740991,ae="Maximum allowed index exceeded",fe=Ht>=51||!y((function(){var t=[];return t[ue]=!1,t.concat()[0]!==t})),se=(Yt="concat",Ht>=51||!y((function(){var t=[];return(t.constructor={})[ie]=function(){return{foo:1}},1!==t[Yt](Boolean).foo}))),le=function(t){if(!P(t))return!1;var e=t[ue];return void 0!==e?!!e:Dt(t)};zt({target:"Array",proto:!0,forced:!fe||!se},{concat:function(t){var e,n,r,o,i,u=Wt(this),c=oe(u,0),a=0;for(e=-1,r=arguments.length;ece)throw TypeError(ae);for(n=0;n=ce)throw TypeError(ae);Gt(c,a++,i)}return c.length=a,c}});var pe=Object.keys||function(t){return Tt(t,Pt)},he=Object.assign,ye=Object.defineProperty,de=!he||y((function(){if(d&&1!==he({b:1},he(ye({},"a",{enumerable:!0,get:function(){ye(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=he({},t)[n]||pe(he({},e)).join("")!=r}))?function(t,e){for(var n=Wt(t),r=arguments.length,o=1,i=xt.f,u=g.f;r>o;)for(var c,a=R(arguments[o++]),f=i?pe(a).concat(i(a)):pe(a),s=f.length,l=0;s>l;)c=f[l++],d&&!u.call(a,c)||(n[c]=a[c]);return n}:he;zt({target:"Object",stat:!0,forced:Object.assign!==de},{assign:de});var be,ve=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},ge=[].push,me=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,c=5==t||i;return function(a,f,s,l){for(var p,h,y=Wt(a),d=R(y),b=ve(f,s,3),v=wt(d.length),g=0,m=l||oe,w=e?m(a,v):n||u?m(a,0):void 0;v>g;g++)if((c||g in d)&&(h=b(p=d[g],g,y),t))if(e)w[g]=h;else if(h)switch(t){case 3:return!0;case 5:return p;case 6:return g;case 2:ge.call(w,p)}else switch(t){case 4:return!1;case 7:ge.call(w,p)}return i?-1:r||o?o:w}},we={forEach:me(0),map:me(1),filter:me(2),some:me(3),every:me(4),find:me(5),findIndex:me(6),filterOut:me(7)},Oe=d?Object.defineProperties:function(t,e){B(t);for(var n,r=pe(e),o=r.length,i=0;o>i;)L.f(t,n=r[i++],e[n]);return t},je=dt("document","documentElement"),Re=et("IE_PROTO"),Se=function(){},Te=function(t){return" - - - - - + + - + + + + + + diff --git a/InvenTree/templates/js/bom.js b/InvenTree/templates/js/bom.js index 462db6eba4..7328bcb331 100644 --- a/InvenTree/templates/js/bom.js +++ b/InvenTree/templates/js/bom.js @@ -243,6 +243,22 @@ function loadBomTable(table, options) { } }); + cols.push( + { + field: 'purchase_price_range', + title: '{% trans "Purchase Price Range" %}', + searchable: false, + sortable: true, + }); + + cols.push( + { + field: 'purchase_price_avg', + title: '{% trans "Purchase Price Average" %}', + searchable: false, + sortable: true, + }); + /* // TODO - Re-introduce the pricing column at a later stage, @@ -269,11 +285,18 @@ function loadBomTable(table, options) { title: '{% trans "Optional" %}', searchable: false, formatter: function(value) { - if (value == '1') return '{% trans "true" %}'; - if (value == '0') return '{% trans "false" %}'; + return yesNoLabel(value); } }); + cols.push({ + field: 'allow_variants', + title: '{% trans "Allow Variants" %}', + formatter: function(value) { + return yesNoLabel(value); + } + }) + cols.push({ field: 'inherited', title: '{% trans "Inherited" %}', @@ -281,7 +304,7 @@ function loadBomTable(table, options) { formatter: function(value, row, index, field) { // This BOM item *is* inheritable, but is defined for this BOM if (!row.inherited) { - return "-"; + return yesNoLabel(false); } else if (row.part == options.parent_id) { return '{% trans "Inherited" %}'; } else { diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js index 0233974741..9523d24d39 100644 --- a/InvenTree/templates/js/build.js +++ b/InvenTree/templates/js/build.js @@ -372,7 +372,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { data.forEach(function(item) { // Group BuildItem objects by part - var part = item.part; + var part = item.bom_part || item.part; var key = parseInt(part); if (!(key in allocations)) { @@ -461,6 +461,16 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { data: row.allocations, showHeader: true, columns: [ + { + field: 'part', + title: '{% trans "Part" %}', + formatter: function(value, row) { + + var html = imageHoverIcon(row.part_thumb); + html += renderLink(row.part_name, `/part/${value}/`); + return html; + } + }, { width: '50%', field: 'quantity', diff --git a/InvenTree/templates/js/modals.js b/InvenTree/templates/js/modals.js index f447fdce72..c8ebd90eb4 100644 --- a/InvenTree/templates/js/modals.js +++ b/InvenTree/templates/js/modals.js @@ -978,6 +978,7 @@ function showModalImage(image_url) { // Set image content $('#modal-image').attr('src', image_url); + modal.hide(); modal.show(); modal.animate({ diff --git a/InvenTree/templates/js/part.js b/InvenTree/templates/js/part.js index b7b9058769..7331ec25e0 100644 --- a/InvenTree/templates/js/part.js +++ b/InvenTree/templates/js/part.js @@ -5,6 +5,14 @@ * Requires api.js to be loaded first */ +function yesNoLabel(value) { + if (value) { + return `{% trans "YES" %}`; + } else { + return `{% trans "NO" %}`; + } +} + function toggleStar(options) { /* Toggle the 'starred' status of a part. * Performs AJAX queries and updates the display on the button. @@ -278,6 +286,64 @@ function loadParametricPartTable(table, options={}) { } +function partGridTile(part) { + // Generate a "grid tile" view for a particular part + + // Rows for table view + var rows = ''; + + if (part.IPN) { + rows += `{% trans "IPN" %}${part.IPN}`; + } + + var stock = `${part.in_stock}`; + + if (!part.in_stock) { + stock = `{% trans "No Stock" %}`; + } + + rows += `{% trans "Stock" %}${stock}`; + + if (part.on_order) { + rows += `{$ trans "On Order" %}${part.on_order}`; + } + + if (part.building) { + rows += `{% trans "Building" %}${part.building}`; + } + + var html = ` + +
    +
    +
    + + ${part.full_name} + + ${makePartIcons(part)} +
    + ${part.description} +
    +
    +
    +
    + +
    +
    + + ${rows} +
    +
    +
    +
    +
    +
    + `; + + return html; +} + + function loadPartTable(table, url, options={}) { /* Load part listing data into specified table. * @@ -452,8 +518,30 @@ function loadPartTable(table, url, options={}) { formatNoMatches: function() { return '{% trans "No parts found" %}'; }, columns: columns, showColumns: true, - }); + showCustomView: false, + showCustomViewButton: false, + customView: function(data) { + var html = ''; + + html = `
    `; + + data.forEach(function(row, index) { + + // Force a new row every 4 columns, to prevent visual issues + if ((index > 0) && (index % 4 == 0) && (index < data.length)) { + html += `
    `; + } + + html += partGridTile(row); + }); + + html += `
    `; + + return html; + } + }); + if (options.buttons) { linkButtonsToSelection($(table), options.buttons); } @@ -582,16 +670,6 @@ function loadPartCategoryTable(table, options) { }); } - -function yesNoLabel(value) { - if (value) { - return `{% trans "YES" %}`; - } else { - return `{% trans "NO" %}`; - } -} - - function loadPartTestTemplateTable(table, options) { /* * Load PartTestTemplate table. @@ -688,3 +766,60 @@ function loadPartTestTemplateTable(table, options) { ] }); } + + +function loadStockPricingChart(context, data) { + return new Chart(context, { + type: 'bar', + data: data, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: {legend: {position: 'bottom'}}, + scales: { + y: { + type: 'linear', + position: 'left', + grid: {display: false}, + title: { + display: true, + text: '{% trans "Single Price" %}' + } + }, + y1: { + type: 'linear', + position: 'right', + grid: {display: false}, + titel: { + display: true, + text: '{% trans "Quantity" %}', + position: 'right' + } + }, + y2: { + type: 'linear', + position: 'left', + grid: {display: false}, + title: { + display: true, + text: '{% trans "Single Price Difference" %}' + } + } + }, + } + }); +} + + +function loadBomChart(context, data) { + return new Chart(context, { + type: 'doughnut', + data: data, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: {legend: {position: 'bottom'}, + scales: {xAxes: [{beginAtZero: true, ticks: {autoSkip: false}}]}} + } + }); +} diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index b89cceea83..151265a3ae 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -32,17 +32,32 @@ function removeStockRow(e) { } -function passFailBadge(result) { +function passFailBadge(result, align='float-right') { if (result) { - return `{% trans "PASS" %}`; + return `{% trans "PASS" %}`; } else { - return `{% trans "FAIL" %}`; + return `{% trans "FAIL" %}`; } } -function noResultBadge() { - return `{% trans "NO RESULT" %}`; +function noResultBadge(align='float-right') { + return `{% trans "NO RESULT" %}`; +} + +function formatDate(row) { + // Function for formatting date field + var html = row.date; + + if (row.user_detail) { + html += `${row.user_detail.username}`; + } + + if (row.attachment) { + html += ``; + } + + return html; } function loadStockTestResultsTable(table, options) { @@ -50,21 +65,6 @@ function loadStockTestResultsTable(table, options) { * Load StockItemTestResult table */ - function formatDate(row) { - // Function for formatting date field - var html = row.date; - - if (row.user_detail) { - html += `${row.user_detail.username}`; - } - - if (row.attachment) { - html += ``; - } - - return html; - } - function makeButtons(row, grouped) { var html = `
    `; @@ -81,17 +81,30 @@ function loadStockTestResultsTable(table, options) { return html; } - // First, load all the test templates + var parent_node = "parent node"; + table.inventreeTable({ url: "{% url 'api-part-test-template-list' %}", method: 'get', name: 'testresult', + treeEnable: true, + rootParentId: parent_node, + parentIdField: 'parent', + idField: 'pk', + uniqueId: 'key', + treeShowField: 'test_name', formatNoMatches: function() { - return "{% trans 'No test results found' %}"; + return '{% trans "No test results found" %}'; }, queryParams: { part: options.part, }, + onPostBody: function() { + table.treegrid({ + treeColumn: 0, + }); + table.treegrid("collapseAll"); + }, columns: [ { field: 'pk', @@ -130,100 +143,85 @@ function loadStockTestResultsTable(table, options) { { field: 'date', title: '{% trans "Test Date" %}', + sortable: true, formatter: function(value, row) { return formatDate(row); - } + }, }, { field: 'buttons', formatter: function(value, row) { return makeButtons(row, false); } - }, - ], - groupBy: true, - groupByField: 'test_name', - groupByFormatter: function(field, id, data) { - - // Extract the "latest" row (data are returned in date order from the server) - var latest = data[data.length-1]; - - switch (field) { - case 'test_name': - return latest.test_name + ` (${data.length})` + passFailBadge(latest.result); - case 'value': - return latest.value; - case 'notes': - return latest.notes; - case 'date': - return formatDate(latest); - case 'buttons': - // Buttons are done differently for grouped rows - return makeButtons(latest, true); - default: - return "---"; } - }, + ], onLoadSuccess: function(tableData) { - // Once the test template data are loaded, query for results + + // Set "parent" for each existing row + tableData.forEach(function(item, idx) { + tableData[idx].parent = options.stock_item; + }); + + // Once the test template data are loaded, query for test results inventreeGet( - "{% url 'api-stock-test-result-list' %}", + '{% url "api-stock-test-result-list" %}', { stock_item: options.stock_item, user_detail: true, attachment_detail: true, + ordering: "-date", }, { success: function(data) { + // Iterate through the returned test data + data.forEach(function(item, index) { - // Iterate through the returned test result data, and group by test - data.forEach(function(item) { var match = false; var override = false; var key = item.key; - // Try to associate this result with a test row + // Attempt to associate this result with an existing test tableData.forEach(function(row, index) { - - // The result matches the test template row if (key == row.key) { - // Force the names to be the same! item.test_name = row.test_name; item.required = row.required; + match = true; + if (row.result == null) { - // The original row has not recorded a result - override! + item.parent = parent_node; tableData[index] = item; override = true; + } else { + item.parent = row.pk; } - - match = true; } }); - // No match could be found (this is a new test!) + // No match could be found if (!match) { - item.test_name = item.test; + item.parent = parent_node; } if (!override) { tableData.push(item); } + }); - // Finally, push the data back into the table! + // Push data back into the table table.bootstrapTable("load", tableData); } - }, - ); + } + ) } }); -} +} function loadStockTable(table, options) { /* Load data into a stock table with adjustable options. @@ -1306,33 +1304,6 @@ function createNewStockItem(options) { function loadInstalledInTable(table, options) { /* * Display a table showing the stock items which are installed in this stock item. - * This is a multi-level tree table, where the "top level" items are Part objects, - * and the children of each top-level item are the associated installed stock items. - * - * The process for retrieving data and displaying the table is as follows: - * - * A) Get BOM data for the stock item - * - It is assumed that the stock item will be for an assembly - * (otherwise why are we installing stuff anyway?) - * - Request BOM items for stock_item.part (and only for trackable sub items) - * - * B) Add parts to table - * - Create rows for each trackable sub-part in the table - * - * C) Gather installed stock item data - * - Get the list of installed stock items via the API - * - If the Part reference is already in the table, add the sub-item as a child - * - If this is a stock item for a *new* part, request that part from the API, - * and add that part as a new row, then add the stock item as a child of that part - * - * D) Enjoy! - * - * - * And the options object contains the following things: - * - * - stock_item: The PK of the master stock_item object - * - part: The PK of the Part reference of the stock_item object - * - quantity: The quantity of the stock item */ function updateCallbacks() { @@ -1355,246 +1326,88 @@ function loadInstalledInTable(table, options) { }); } - table.inventreeTable( - { - url: "{% url 'api-bom-list' %}", - queryParams: { - part: options.part, - sub_part_trackable: true, - sub_part_detail: true, - }, - showColumns: false, - name: 'installed-in', - detailView: true, - detailViewByClick: true, - detailFilter: function(index, row) { - return row.installed_count && row.installed_count > 0; - }, - detailFormatter: function(index, row, element) { - var subTableId = `installed-table-${row.sub_part}`; + table.inventreeTable({ + url: "{% url 'api-stock-list' %}", + queryParams: { + installed_in: options.stock_item, + part_detail: true, + }, + formatNoMatches: function() { + return '{% trans "No installed items" %}'; + }, + columns: [ + { + field: 'part', + title: '{% trans "Part" %}', + formatter: function(value, row) { + var html = ''; - var html = `
    `; + html += imageHoverIcon(row.part_detail.thumbnail); + html += renderLink(row.part_detail.full_name, `/stock/item/${row.pk}/`); - element.html(html); - - var subTable = $(`#${subTableId}`); - - // Display a "sub table" showing all the linked stock items - subTable.bootstrapTable({ - data: row.installed_items, - showHeader: true, - columns: [ - { - field: 'item', - title: '{% trans "Stock Item" %}', - formatter: function(value, subrow, index, field) { - - var pk = subrow.pk; - var html = ''; - - if (subrow.serial && subrow.quantity == 1) { - html += `{% trans "Serial" %}: ${subrow.serial}`; - } else { - html += `{% trans "Quantity" %}: ${subrow.quantity}`; - } - - return renderLink(html, `/stock/item/${subrow.pk}/`); - }, - }, - { - field: 'status', - title: '{% trans "Status" %}', - formatter: function(value, subrow, index, field) { - return stockStatusDisplay(value); - } - }, - { - field: 'batch', - title: '{% trans "Batch" %}', - }, - { - field: 'actions', - title: '', - formatter: function(value, subrow, index) { - - var pk = subrow.pk; - var html = ''; - - // Add some buttons yo! - html += `
    `; - - html += makeIconButton('fa-unlink', 'button-uninstall', pk, "{% trans 'Uninstall stock item' %}"); - - html += `
    `; - - return html; - } - } - ], - onPostBody: function() { - // Setup button callbacks - subTable.find('.button-uninstall').click(function() { - var pk = $(this).attr('pk'); - - launchModalForm( - "{% url 'stock-item-uninstall' %}", - { - data: { - 'items[]': [pk], - }, - success: function() { - // Refresh entire table! - table.bootstrapTable('refresh'); - } - } - ); - }); - } - }); - }, - columns: [ - { - checkbox: true, - title: '{% trans "Select" %}', - searchable: false, - switchable: false, - }, - { - field: 'pk', - title: 'ID', - visible: false, - switchable: false, - }, - { - field: 'part', - title: '{% trans "Part" %}', - sortable: true, - formatter: function(value, row, index, field) { - - var url = `/part/${row.sub_part}/`; - var thumb = row.sub_part_detail.thumbnail; - var name = row.sub_part_detail.full_name; - - html = imageHoverIcon(thumb) + renderLink(name, url); - - if (row.not_in_bom) { - html = `${html}` - } - - return html; - } - }, - { - field: 'installed', - title: '{% trans "Installed" %}', - sortable: false, - formatter: function(value, row, index, field) { - // Construct a progress showing how many items have been installed - - var installed = row.installed_count || 0; - var required = row.quantity || 0; - - required *= options.quantity; - - var progress = makeProgressBar(installed, required, { - id: row.sub_part.pk, - }); - - return progress; - } - }, - { - field: 'actions', - switchable: false, - formatter: function(value, row) { - var pk = row.sub_part; - - var html = `
    `; - - html += makeIconButton('fa-link', 'button-install', pk, '{% trans "Install item" %}'); - - html += `
    `; - - return html; - } + return html; } - ], - onLoadSuccess: function() { - // Grab a list of parts which are actually installed in this stock item + }, + { + field: 'quantity', + title: '{% trans "Quantity" %}', + formatter: function(value, row) { - inventreeGet( - "{% url 'api-stock-list' %}", + var html = ''; + + if (row.serial && row.quantity == 1) { + html += `{% trans "Serial" %}: ${row.serial}`; + } else { + html += `${row.quantity}`; + } + + return renderLink(html, `/stock/item/${row.pk}/`); + } + }, + { + field: 'status', + title: '{% trans "Status" %}', + formatter: function(value, row) { + return stockStatusDisplay(value); + } + }, + { + field: 'batch', + title: '{% trans "Batch" %}', + }, + { + field: 'buttons', + title: '', + switchable: false, + formatter: function(value, row) { + var pk = row.pk; + var html = ''; + + html += `
    `; + html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall Stock Item" %}'); + html += `
    `; + + return html; + } + } + ], + onPostBody: function() { + // Assign callbacks to the buttons + table.find('.button-uninstall').click(function() { + var pk = $(this).attr('pk'); + + launchModalForm( + '{% url "stock-item-uninstall" %}', { - installed_in: options.stock_item, - part_detail: true, - }, - { - success: function(stock_items) { - - var table_data = table.bootstrapTable('getData'); - - stock_items.forEach(function(item) { - - var match = false; - - for (var idx = 0; idx < table_data.length; idx++) { - - var row = table_data[idx]; - - // Check each row in the table to see if this stock item matches - table_data.forEach(function(row) { - - // Match on "sub_part" - if (row.sub_part == item.part) { - - // First time? - if (row.installed_count == null) { - row.installed_count = 0; - row.installed_items = []; - } - - row.installed_count += item.quantity; - row.installed_items.push(item); - - // Push the row back into the table - table.bootstrapTable('updateRow', idx, row, true); - - match = true; - } - - }); - - if (match) { - break; - } - } - - if (!match) { - // The stock item did *not* match any items in the BOM! - // Add a new row to the table... - - // Contruct a new "row" to add to the table - var new_row = { - sub_part: item.part, - sub_part_detail: item.part_detail, - not_in_bom: true, - installed_count: item.quantity, - installed_items: [item], - }; - - table.bootstrapTable('append', [new_row]); - - } - }); - - // Update button callback links - updateCallbacks(); + data: { + 'items[]': pk, + }, + success: function() { + table.bootstrapTable('refresh'); } } - ); - - updateCallbacks(); - }, + ) + }); } - ); + }); } \ No newline at end of file diff --git a/InvenTree/templates/js/table_filters.js b/InvenTree/templates/js/table_filters.js index 5f516e9419..d02fa50d80 100644 --- a/InvenTree/templates/js/table_filters.js +++ b/InvenTree/templates/js/table_filters.js @@ -49,6 +49,10 @@ function getAvailableTableFilters(tableKey) { inherited: { type: 'bool', title: '{% trans "Inherited" %}', + }, + allow_variants: { + type: 'bool', + title: '{% trans "Allow Variant Stock" %}', } }; } diff --git a/InvenTree/templates/registration/logged_out.html b/InvenTree/templates/registration/logged_out.html index f5882c7ff1..e26ae16c60 100644 --- a/InvenTree/templates/registration/logged_out.html +++ b/InvenTree/templates/registration/logged_out.html @@ -14,7 +14,6 @@ - diff --git a/InvenTree/templates/registration/login.html b/InvenTree/templates/registration/login.html index 3b59dde2fc..aa398cac60 100644 --- a/InvenTree/templates/registration/login.html +++ b/InvenTree/templates/registration/login.html @@ -13,7 +13,6 @@ - diff --git a/InvenTree/templates/registration/password_reset_complete.html b/InvenTree/templates/registration/password_reset_complete.html index a941aa6fee..2254e966c8 100644 --- a/InvenTree/templates/registration/password_reset_complete.html +++ b/InvenTree/templates/registration/password_reset_complete.html @@ -14,7 +14,6 @@ - diff --git a/InvenTree/templates/registration/password_reset_confirm.html b/InvenTree/templates/registration/password_reset_confirm.html index dd52cb135f..a1f6d7d258 100644 --- a/InvenTree/templates/registration/password_reset_confirm.html +++ b/InvenTree/templates/registration/password_reset_confirm.html @@ -14,7 +14,6 @@ - diff --git a/InvenTree/templates/registration/password_reset_done.html b/InvenTree/templates/registration/password_reset_done.html index 03d98846a0..044dd3d30b 100644 --- a/InvenTree/templates/registration/password_reset_done.html +++ b/InvenTree/templates/registration/password_reset_done.html @@ -14,7 +14,6 @@ - diff --git a/InvenTree/templates/registration/password_reset_form.html b/InvenTree/templates/registration/password_reset_form.html index a2c241b7d7..f221e6a11b 100644 --- a/InvenTree/templates/registration/password_reset_form.html +++ b/InvenTree/templates/registration/password_reset_form.html @@ -14,7 +14,6 @@ - diff --git a/requirements.txt b/requirements.txt index 35963ce718..4f592bf9ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,7 @@ django-stdimage==5.1.1 # Advanced ImageField management django-weasyprint==1.0.1 # HTML PDF export django-debug-toolbar==2.2 # Debug / profiling toolbar django-admin-shell==0.1.2 # Python shell for the admin interface +py-moneyed==0.8.0 # Specific version requirement for py-moneyed django-money==1.1 # Django app for currency management certifi # Certifi is (most likely) installed through one of the requirements above django-error-report==0.2.0 # Error report viewer for the admin interface