{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/js/admin/settings/tax-rates/collections/tax-rates.js","webpack:///./assets/js/admin/settings/tax-rates/index.js","webpack:///./assets/js/admin/settings/tax-rates/models/tax-rate.js","webpack:///./assets/js/admin/settings/tax-rates/views/bulk-actions.js","webpack:///./assets/js/admin/settings/tax-rates/views/manager.js","webpack:///./assets/js/admin/settings/tax-rates/views/region-field.js","webpack:///./assets/js/admin/settings/tax-rates/views/table-add.js","webpack:///./assets/js/admin/settings/tax-rates/views/table-meta.js","webpack:///./assets/js/admin/settings/tax-rates/views/table-row-empty.js","webpack:///./assets/js/admin/settings/tax-rates/views/table-row.js","webpack:///./assets/js/admin/settings/tax-rates/views/table-rows.js","webpack:///./assets/js/admin/settings/tax-rates/views/table.js","webpack:///./assets/js/utils/chosen.js","webpack:///./assets/js/utils/jquery.js","webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js","webpack:///external \"jQuery\""],"names":["TaxRates","Backbone","Collection","extend","model","TaxRate","initialize","showAll","selected","jQueryReady","noticeEl","document","getElementById","classList","add","manager","Manager","collection","rates","_","each","eddTaxRates","rate","push","id","country","name","region","description","global","scope","amount","status","set","silent","render","Model","defaults","unsaved","formattedAmount","get","parseFloat","toFixed","BulkActions","wp","View","template","events","filter","event","preventDefault","cid","value","trigger","showHide","target","checked","toggle","el","listenTo","makeDirty","querySelector","addEventListener","makeClean","views","Table","window","onbeforeunload","confirmUnload","RegionField","options","states","setElement","$el","html","find","$","chosen","getChosenVars","TableAdd","tagName","className","updateRegion","prototype","apply","arguments","self","data","action","nonce","field_name","post","ajaxurl","response","setCountry","selectedIndex","setRegion","setGlobal","setAmount","maybeAddTaxRate","keyCode","addTaxRate","i18n","alert","emptyCountry","existingCountryWide","where","length","regionString","taxRateString","duplicateRate","replace","emptyTax","attributes","TableMeta","selectAll","models","TableRowEmpty","TableRow","toJSON","attr","result","removeRow","remove","activateRow","deactivateRow","selectRow","reject","TableRows","filtered","disabledRates","chosenVars","disable_search_threshold","search_contains","inherit_select_classes","single_backstroke_delete","placeholder_text_single","edd_vars","one_option","placeholder_text_multiple","one_or_more_option","no_results_text","jQuery","inputVars","width","css","callback"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;;AACA,IAAMA,QAAQ,GAAGC,QAAQ,CAACC,UAAT,CAAoBC,MAApB,CAA4B;AAC5C;AACAC,OAAK,EAAEC,2DAFqC;;AAI5C;AACD;AACA;AACCC,YAAU,EAAE,sBAAW;AACtB,SAAKC,OAAL,GAAe,KAAf;AACA,SAAKC,QAAL,GAAgB,EAAhB;AACA;AAV2C,CAA5B,CAAjB;AAaeR,uEAAf,E;;;;;;;;;;;;ACvBA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AACAS,mEAAW,CAAE,YAAM;AAClB;AACA,MAAMC,QAAQ,GAAGC,QAAQ,CAACC,cAAT,CAAyB,yBAAzB,CAAjB;;AAEA,MAAKF,QAAL,EAAgB;AACfA,YAAQ,CAACG,SAAT,CAAmBC,GAAnB,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OAAR;AAFR;AAIA,CAjBM,C;;;;;;;;;;;;;AClBP;AAAA;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMxI,WAAW,GAAG,SAAdA,WAAc,CAAUyI,QAAV,EAAqB;AAC7C,aAAUtE,CAAV,EAAc;AACfA,KAAC,CAAEsE,QAAF,CAAD;AACA,GAFC,EAECJ,MAFD,CAAF;AAGA,CAJM,C;;;;;;;;;;;;ACTP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;;AAEA,iC;;;;;;;;;;;ACfA,wB","file":"assets/js/edd-admin-tax-rates.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./assets/js/admin/settings/tax-rates/index.js\");\n","/* global Backbone */\n\n/**\n * Internal dependencies.\n */\nimport TaxRate from './../models/tax-rate.js';\n\n/**\n * A collection of multiple tax rates.\n */\nconst TaxRates = Backbone.Collection.extend( {\n\t// Map the model.\n\tmodel: TaxRate,\n\n\t/**\n\t * Set initial state.\n\t */\n\tinitialize: function() {\n\t\tthis.showAll = false;\n\t\tthis.selected = [];\n\t},\n} );\n\nexport default TaxRates;\n","/* global _, eddTaxRates */\n\n/**\n * Internal dependencies.\n */\nimport TaxRate from './models/tax-rate.js';\nimport TaxRates from './collections/tax-rates.js';\nimport Manager from './views/manager.js';\nimport { jQueryReady } from 'utils/jquery.js';\n\n/**\n * DOM ready.\n */\njQueryReady( () => {\n\t// Show notice if taxes are not enabled.\n\tconst noticeEl = document.getElementById( 'edd-tax-disabled-notice' );\n\n\tif ( noticeEl ) {\n\t\tnoticeEl.classList.add( 'notice' );\n\t\tnoticeEl.classList.add( 'notice-warning' );\n\t}\n\n\t// Start manager with a blank collection.\n\tconst manager = new Manager( {\n\t\tcollection: new TaxRates(),\n\t} );\n\n\tconst rates = [];\n\n\t// Normalize rate data.\n\t_.each( eddTaxRates.rates, ( rate ) => rates.push( {\n\t\tid: rate.id,\n\t\tcountry: rate.name,\n\t\tregion: rate.description,\n\t\tglobal: 'country' === rate.scope,\n\t\tamount: rate.amount,\n\t\tstatus: rate.status,\n\t} ) );\n\n\t// Add initial rates.\n\tmanager.collection.set( rates, {\n\t\tsilent: true,\n\t} );\n\n\t// Render manager.\n\tmanager.render();\n} );\n","/* global Backbone */\n\n/**\n * Model a tax rate.\n */\nconst TaxRate = Backbone.Model.extend( {\n\tdefaults: {\n\t\tid: '',\n\t\tcountry: '',\n\t\tregion: '',\n\t\tglobal: true,\n\t\tamount: 0,\n\t\tstatus: 'active',\n\t\tunsaved: false,\n\t\tselected: false,\n\t},\n\n\t/**\n\t * Format a rate amount (adds a %)\n\t *\n\t * @todo This should support dynamic decimal types.\n\t */\n\tformattedAmount: function() {\n\t\tlet amount = 0;\n\n\t\tif ( this.get( 'amount' ) ) {\n\t\t\tamount = parseFloat( this.get( 'amount' ) ).toFixed( 2 );\n\t\t}\n\n\t\treturn `${ amount }%`;\n\t},\n} );\n\nexport default TaxRate;\n","/* global wp, _ */\n\n/**\n * Apply bulk actions.\n */\nconst BulkActions = wp.Backbone.View.extend( {\n\t// See https://codex.wordpress.org/Javascript_Reference/wp.template\n\ttemplate: wp.template( 'edd-admin-tax-rates-table-bulk-actions' ),\n\n\t// Watch events.\n\tevents: {\n\t\t'click .edd-admin-tax-rates-table-filter': 'filter',\n\t\t'change .edd-admin-tax-rates-table-hide input': 'showHide',\n\t},\n\n\t/**\n\t * Bulk actions for selected items.\n\t *\n\t * Currently only supports changing the status.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tfilter: function( event ) {\n\t\tevent.preventDefault();\n\n\t\t// @hack - need to access the DOM directly here because the dropdown is not tied to the button event.\n\t\tconst status = document.getElementById( 'edd-admin-tax-rates-table-bulk-actions' );\n\n\t\t_.each( this.collection.selected, ( cid ) => {\n\t\t\tconst model = this.collection.get( {\n\t\t\t\tcid: cid,\n\t\t\t} );\n\n\t\t\tmodel.set( 'status', status.value );\n\t\t} );\n\n\t\tthis.collection.trigger( 'filtered' );\n\t},\n\n\t/**\n\t * Toggle show active/inactive rates.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tshowHide: function( event ) {\n\t\tthis.collection.showAll = event.target.checked;\n\n\t\t// @hack -- shouldn't access this table directly.\n\t\tdocument.getElementById( 'edd_tax_rates' ).classList.toggle( 'has-inactive', this.collection.showAll );\n\n\t\tthis.collection.trigger( 'filtered' );\n\t},\n} );\n\nexport default BulkActions;\n","/* global wp */\n\n/**\n * Internal dependencies.\n */\nimport Table from './table.js';\nimport BulkActions from './bulk-actions.js';\n\n/**\n * Manage tax rates.\n */\nconst Manager = wp.Backbone.View.extend( {\n\t// Append to this element.\n\tel: '#edd-admin-tax-rates',\n\n\t/**\n\t * Set bind changes to collection.\n\t */\n\tinitialize: function() {\n\t\tthis.listenTo( this.collection, 'add change', this.makeDirty );\n\n\t\t// Clear unload confirmation when submitting parent form.\n\t\tdocument.querySelector( '.edd-settings-form #submit' ).addEventListener( 'click', this.makeClean );\n\t},\n\n\t/**\n\t * Output the manager.\n\t */\n\trender: function() {\n\t\tthis.views.add( new BulkActions( {\n\t\t\tcollection: this.collection,\n\t\t} ) );\n\n\t\tthis.views.add( new Table( {\n\t\t\tcollection: this.collection,\n\t\t} ) );\n\t},\n\n\t/**\n\t * Collection has changed so warn the user before exiting.\n\t */\n\tmakeDirty: function() {\n\t\twindow.onbeforeunload = this.confirmUnload;\n\t},\n\n\t/**\n\t * When submitting the main form remove the dirty check.\n\t */\n\tmakeClean: function() {\n\t\twindow.onbeforeunload = null;\n\t},\n\n\t/**\n\t * Confirm page unload.\n\t *\n\t * @param {Object} event Close event.\n\t */\n\tconfirmUnload: function( event ) {\n\t\tevent.preventDefault();\n\n\t\treturn '';\n\t},\n} );\n\nexport default Manager;\n","/* global wp, _ */\n\n/**\n * Internal dependencies.\n */\nimport { getChosenVars } from 'utils/chosen.js';\n\nconst RegionField = wp.Backbone.View.extend( {\n\t/**\n\t * Bind passed arguments.\n\t *\n\t * @param {Object} options Extra options passed.\n\t */\n\tinitialize: function( options ) {\n\t\t_.extend( this, options );\n\t},\n\n\t/**\n\t * Create a list of options.\n\t */\n\trender: function() {\n\t\tif ( this.global ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'nostates' === this.states ) {\n\t\t\tthis.setElement( '' );\n\t\t} else {\n\t\t\tthis.$el.html( this.states );\n\t\t\tthis.$el.find( 'select' ).each( function() {\n\t\t\t\tconst el = $( this );\n\t\t\t\tel.chosen( getChosenVars( el ) );\n\t\t\t} );\n\t\t}\n\t},\n} );\n\nexport default RegionField;\n","/* global wp */\n\n/**\n * Internal dependencies.\n */\nimport TaxRate from './../models/tax-rate.js';\nimport RegionField from './../views/region-field.js';\nimport { getChosenVars } from 'utils/chosen.js';\n\n/**\n * Add a new rate \"form\".\n */\nconst TableAdd = wp.Backbone.View.extend( {\n\t// Use \n\ttagName: 'tfoot',\n\n\t// Set class.\n\tclassName: 'add-new',\n\n\t// See https://codex.wordpress.org/Javascript_Reference/wp.template\n\ttemplate: wp.template( 'edd-admin-tax-rates-table-add' ),\n\n\t// Watch events.\n\tevents: {\n\t\t'click button': 'addTaxRate',\n\t\t'keypress': 'maybeAddTaxRate',\n\n\t\t'change #tax_rate_country': 'setCountry',\n\n\t\t// Can be select or input.\n\t\t'keyup #tax_rate_region': 'setRegion',\n\t\t'change #tax_rate_region': 'setRegion',\n\n\t\t'change input[type=\"checkbox\"]': 'setGlobal',\n\n\t\t// Can be click increase or keyboard.\n\t\t'keyup #tax_rate_amount': 'setAmount',\n\t\t'change #tax_rate_amount': 'setAmount',\n\t},\n\n\t/**\n\t * Set initial state and bind changes to model.\n\t */\n\tinitialize: function() {\n\t\tthis.model = new TaxRate( {\n\t\t\tglobal: true,\n\t\t\tunsaved: true,\n\t\t} );\n\n\t\tthis.listenTo( this.model, 'change:country', this.updateRegion );\n\t\tthis.listenTo( this.model, 'change:global', this.updateRegion );\n\t},\n\n\t/**\n\t * Render. Only overwritten so we can reinit chosen once cleared.\n\t */\n\trender: function() {\n\t\twp.Backbone.View.prototype.render.apply( this, arguments );\n\n\t\tthis.$el.find( 'select' ).each( function() {\n\t\t\tconst el = $( this );\n\t\t\tel.chosen( getChosenVars( el ) );\n\t\t} );\n\n\t\treturn this;\n\t},\n\n\t/**\n\t * Show a list of states or an input field.\n\t */\n\tupdateRegion: function() {\n\t\tconst self = this;\n\n\t\tconst data = {\n\t\t\taction: 'edd_get_shop_states',\n\t\t\tcountry: this.model.get( 'country' ),\n\t\t\tnonce: eddTaxRates.nonce,\n\t\t\tfield_name: 'tax_rate_region',\n\t\t};\n\n\t\t$.post( ajaxurl, data, function( response ) {\n\t\t\tself.views.set( '#tax_rate_region_wrapper', new RegionField( {\n\t\t\t\tstates: response,\n\t\t\t\tglobal: self.model.get( 'global' ),\n\t\t\t} ) );\n\t\t} );\n\t},\n\n\t/**\n\t * Set a country value.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tsetCountry: function( event ) {\n\t\tthis.model.set( 'country', event.target.options[ event.target.selectedIndex ].value );\n\t},\n\n\t/**\n\t * Set a region value.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tsetRegion: function( event ) {\n\t\tlet value = false;\n\n\t\tif ( event.target.value ) {\n\t\t\tvalue = event.target.value;\n\t\t} else {\n\t\t\tvalue = event.target.options[ event.target.selectedIndex ].value;\n\t\t}\n\n\t\tthis.model.set( 'region', value );\n\t},\n\n\t/**\n\t * Set a global scope.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tsetGlobal: function( event ) {\n\t\tthis.model.set( 'global', event.target.checked );\n\t\tthis.model.set( 'region', '' );\n\t},\n\n\t/**\n\t * Set an amount value.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tsetAmount: function( event ) {\n\t\tthis.model.set( 'amount', event.target.value );\n\t},\n\n\t/**\n\t * Monitors keyepress for \"Enter\" key.\n\t *\n\t * We cannot use the `submit` event because we cannot nest
\n\t * elements inside the settings API.\n\t *\n\t * @param {Object} event Keypress event.\n\t */\n\tmaybeAddTaxRate: function( event ) {\n\t\tif ( 13 !== event.keyCode ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.addTaxRate( event );\n\t},\n\n\t/**\n\t * Add a single rate when the \"form\" is submitted.\n\t *\n\t * @param {Object} event Event.\n\t */\n\taddTaxRate: function( event ) {\n\t\tevent.preventDefault();\n\n\t\tconst { i18n } = eddTaxRates;\n\n\t\tif ( ! this.model.get( 'country' ) ) {\n\t\t\talert( i18n.emptyCountry );\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingCountryWide = this.collection.where( {\n\t\t\tregion: this.model.get( 'region' ),\n\t\t\tcountry: this.model.get( 'country' ),\n\t\t\tglobal: '' === this.model.get( 'region' ),\n\t\t\tstatus: 'active',\n\t\t} );\n\n\t\tif ( existingCountryWide.length > 0 ) {\n\t\t\tconst regionString = '' === this.model.get( 'region' )\n\t\t\t\t? ''\n\t\t\t\t: ': ' + this.model.get( 'region' );\n\n\t\t\tconst taxRateString = this.model.get( 'country' ) + regionString;\n\n\t\t\talert( i18n.duplicateRate.replace( '%s', `\"${ taxRateString }\"` ) );\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( this.model.get( 'amount' ) <= 0 ) {\n\t\t\talert( i18n.emptyTax );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Merge cid as ID to make this a unique model.\n\t\tthis.collection.add( _.extend(\n\t\t\tthis.model.attributes,\n\t\t\t{\n\t\t\t\tid: this.model.cid,\n\t\t\t}\n\t\t) );\n\n\t\tthis.render();\n\t\tthis.initialize();\n\t},\n} );\n\nexport default TableAdd;\n","/* global wp, _ */\n\n/**\n * Output a table header and footer.\n */\nconst TableMeta = wp.Backbone.View.extend( {\n\t// See https://codex.wordpress.org/Javascript_Reference/wp.template\n\ttemplate: wp.template( 'edd-admin-tax-rates-table-meta' ),\n\n\t// Watch events.\n\tevents: {\n\t\t'change [type=\"checkbox\"]': 'selectAll',\n\t},\n\n\t/**\n\t * Select all items in the collection.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tselectAll: function( event ) {\n\t\tconst checked = event.target.checked;\n\n\t\t_.each( this.collection.models, ( model ) => {\n\t\t\t// Check individual models.\n\t\t\tmodel.set( 'selected', checked );\n\n\t\t\t// Add to global selection.\n\t\t\tthis.collection.selected.push( model.cid );\n\t\t} );\n\t},\n} );\n\nexport default TableMeta;\n","/* global wp */\n\n/**\n * Empty tax rates table.\n */\nconst TableRowEmpty = wp.Backbone.View.extend( {\n\t// Insert as a \n\ttagName: 'tr',\n\n\t// Set class.\n\tclassName: 'edd-tax-rate-row edd-tax-rate-row--is-empty',\n\n\t// See https://codex.wordpress.org/Javascript_Reference/wp.template\n\ttemplate: wp.template( 'edd-admin-tax-rates-table-row-empty' ),\n} );\n\nexport default TableRowEmpty;\n","/* global wp, _ */\n\n/**\n * A row inside a table of rates.\n */\nconst TableRow = wp.Backbone.View.extend( {\n\t// Insert as a \n\ttagName: 'tr',\n\n\t// Set class.\n\tclassName: function() {\n\t\treturn 'edd-tax-rate-row edd-tax-rate-row--' + this.model.get( 'status' );\n\t},\n\n\t// See https://codex.wordpress.org/Javascript_Reference/wp.template\n\ttemplate: wp.template( 'edd-admin-tax-rates-table-row' ),\n\n\t// Watch events.\n\tevents: {\n\t\t'click .remove': 'removeRow',\n\t\t'click .activate': 'activateRow',\n\t\t'click .deactivate': 'deactivateRow',\n\t\t'change [type=\"checkbox\"]': 'selectRow',\n\t},\n\n\t/**\n\t * Bind model to view.\n\t */\n\tinitialize: function() {\n\t\tthis.listenTo( this.model, 'change', this.render );\n\t},\n\n\t/**\n\t * Render\n\t */\n\trender: function() {\n\t\tthis.$el.html( this.template( {\n\t\t\t...this.model.toJSON(),\n\t\t\tformattedAmount: this.model.formattedAmount(),\n\t\t} ) );\n\n\t\t// Ensure the wrapper class has the new name.\n\t\tthis.$el.attr( 'class', _.result( this, 'className' ) );\n\t},\n\n\t/**\n\t * Remove a rate (can only be done if it has not been saved to the database).\n\t *\n\t * Don't use this.model.destroy() to avoid sending a DELETE request.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tremoveRow: function( event ) {\n\t\tevent.preventDefault();\n\n\t\tthis.collection.remove( this.model );\n\t},\n\n\t/**\n\t * Activate a rate.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tactivateRow: function( event ) {\n\t\tevent.preventDefault();\n\n\t\tconst { i18n } = eddTaxRates;\n\t\tconst existingCountryWide = this.collection.where( {\n\t\t\tregion: this.model.get( 'region' ),\n\t\t\tcountry: this.model.get( 'country' ),\n\t\t\tglobal: '' === this.model.get( 'region' ),\n\t\t\tstatus: 'active',\n\t\t} );\n\n\t\tif ( existingCountryWide.length > 0 ) {\n\t\t\tconst regionString = '' === this.model.get( 'region' )\n\t\t\t\t? ''\n\t\t\t\t: ': ' + this.model.get( 'region' );\n\n\t\t\tconst taxRateString = this.model.get( 'country' ) + regionString;\n\n\t\t\talert( i18n.duplicateRate.replace( '%s', `\"${ taxRateString }\"` ) );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.model.set( 'status', 'active' );\n\t},\n\n\t/**\n\t * Deactivate a rate.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tdeactivateRow: function( event ) {\n\t\tevent.preventDefault();\n\n\t\tthis.model.set( 'status', 'inactive' );\n\t},\n\n\t/**\n\t * Select or deselect for bulk actions.\n\t *\n\t * @param {Object} event Event.\n\t */\n\tselectRow: function( event ) {\n\t\tconst checked = event.target.checked;\n\n\t\tif ( ! checked ) {\n\t\t\tthis.collection.selected = _.reject( this.collection.selected, ( cid ) => {\n\t\t\t\treturn cid === this.model.cid;\n\t\t\t} );\n\t\t} else {\n\t\t\tthis.collection.selected.push( this.model.cid );\n\t\t}\n\t},\n} );\n\nexport default TableRow;\n","/* global wp, _ */\n\n/**\n * Internal dependencies.\n */\nimport TableRowEmpty from './table-row-empty.js';\nimport TableRow from './table-row.js';\n\n/**\n * A bunch of rows inside a table of rates.\n */\nconst TableRows = wp.Backbone.View.extend( {\n\t// Insert as a \n\ttagName: 'tbody',\n\n\t/**\n\t * Bind events to collection.\n\t */\n\tinitialize: function() {\n\t\tthis.listenTo( this.collection, 'add', this.render );\n\t\tthis.listenTo( this.collection, 'remove', this.render );\n\t\tthis.listenTo( this.collection, 'filtered change', this.filtered );\n\t},\n\n\t/**\n\t * Render a collection of rows.\n\t */\n\trender: function() {\n\t\t// Clear to handle sorting.\n\t\tthis.views.remove();\n\n\t\t// Show empty placeholder.\n\t\tif ( 0 === this.collection.models.length ) {\n\t\t\treturn this.views.add( new TableRowEmpty() );\n\t\t}\n\n\t\t// Add items.\n\t\t_.each( this.collection.models, ( rate ) => {\n\t\t\tthis.views.add( new TableRow( {\n\t\t\t\tcollection: this.collection,\n\t\t\t\tmodel: rate,\n\t\t\t} ) );\n\t\t} );\n\t},\n\n\t/**\n\t * Show an empty state if all items are deactivated.\n\t */\n\tfiltered: function() {\n\t\tconst disabledRates = this.collection.where( {\n\t\t\tstatus: 'inactive',\n\t\t} );\n\n\t\t// Check if all rows are invisible, and show the \"No Items\" row if so\n\t\tif ( disabledRates.length === this.collection.models.length && ! this.collection.showAll ) {\n\t\t\tthis.views.add( new TableRowEmpty() );\n\n\t\t// Possibly re-render the view\n\t\t} else {\n\t\t\tthis.render();\n\t\t}\n\t},\n} );\n\nexport default TableRows;\n","/* global wp */\n\n/**\n * Internal dependencies.\n */\nimport TableMeta from './table-meta.js';\nimport TableRows from './table-rows.js';\nimport TableAdd from './table-add.js';\n\n/**\n * Manage the tax rate rows in a table.\n */\nconst Table = wp.Backbone.View.extend( {\n\t// Render as a tag.\n\ttagName: 'table',\n\n\t// Set class.\n\tclassName: 'wp-list-table widefat fixed tax-rates',\n\n\t// Set ID.\n\tid: 'edd_tax_rates',\n\n\t/**\n\t * Output a table with a header, body, and footer.\n\t */\n\trender: function() {\n\t\tthis.views.add( new TableMeta( {\n\t\t\ttagName: 'thead',\n\t\t\tcollection: this.collection,\n\t\t} ) );\n\n\t\tthis.views.add( new TableRows( {\n\t\t\tcollection: this.collection,\n\t\t} ) );\n\n\t\tthis.views.add( new TableAdd( {\n\t\t\tcollection: this.collection,\n\t\t} ) );\n\n\t\tthis.views.add( new TableMeta( {\n\t\t\ttagName: 'tfoot',\n\t\t\tcollection: this.collection,\n\t\t} ) );\n\n\t\t// Trigger the `filtered` action to show/hide rows accordingly\n\t\tthis.collection.trigger( 'filtered' );\n\t},\n} );\n\nexport default Table;\n","/* global jQuery, edd_vars */\n\nexport const chosenVars = {\n\tdisable_search_threshold: 13,\n\tsearch_contains: true,\n\tinherit_select_classes: true,\n\tsingle_backstroke_delete: false,\n\tplaceholder_text_single: edd_vars.one_option,\n\tplaceholder_text_multiple: edd_vars.one_or_more_option,\n\tno_results_text: edd_vars.no_results_text,\n};\n\n/**\n * Determine the variables used to initialie Chosen on an element.\n *\n * @param {Object} el select element.\n * @return {Object} Variables for Chosen.\n */\nexport const getChosenVars = ( el ) => {\n\tif ( ! el instanceof jQuery ) {\n\t\tel = jQuery( el );\n\t}\n\n\tlet inputVars = chosenVars;\n\n\t// Ensure