1require.config({"config": { 2 "jsbuild":{"Amasty_CheckoutCore/js/view/shipping-mixin.js":"define(\n [\n 'underscore',\n 'ko',\n 'jquery',\n 'Magento_Ui/js/lib/view/utils/async',\n 'Magento_Customer/js/model/customer',\n 'Magento_Checkout/js/model/address-converter',\n 'Magento_Customer/js/customer-data',\n 'Magento_Checkout/js/checkout-data',\n 'Magento_Checkout/js/model/shipping-service',\n 'Magento_Checkout/js/action/select-shipping-address',\n 'Magento_Checkout/js/action/select-shipping-method',\n 'Magento_Checkout/js/action/set-shipping-information',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/customer-email-validator',\n 'Amasty_CheckoutCore/js/view/utils',\n 'Amasty_CheckoutCore/js/model/payment/payment-loading',\n 'Amasty_CheckoutCore/js/action/get-totals',\n 'Amasty_CheckoutCore/js/model/shipping-registry',\n 'Amasty_CheckoutCore/js/model/address-form-state',\n 'Amasty_CheckoutCore/js/model/events',\n 'uiRegistry',\n 'rjsResolver',\n 'mage/translate'\n ],\n function (\n _,\n ko,\n $,\n async,\n customer,\n addressConverter,\n storage,\n checkoutData,\n shippingService,\n selectShippingAddress,\n selectShippingMethod,\n setShippingInformationAction,\n quote,\n emailValidator,\n viewUtils,\n paymentLoader,\n totalsProcessor,\n shippingRegistry,\n addressFormState,\n events,\n registry,\n onLoad,\n $t\n ) {\n 'use strict';\n\n var instance = null;\n\n function removeAmazonPayButton() {\n var amazonPaymentButton = $('#PayWithAmazon_amazon-pay-button img');\n\n if (amazonPaymentButton.length > 1) {\n amazonPaymentButton.not(':first').remove();\n }\n }\n\n return function (Shipping) {\n return Shipping.extend({\n allowedDynamicalSave: false,\n allowedDynamicalValidation: true,\n isUpdateCancelledByBilling: false,\n isInitialDataSaved: false,\n previousShippingMethodData: {},\n\n initialize: function () {\n this._super();\n\n instance = this;\n onLoad(shippingRegistry.initObservers.bind(shippingRegistry, this.elems));\n onLoad(this.registerObserversAfterLoad.bind(this));\n\n if (!this.isFormInline) {\n shippingRegistry.excludedCollectionNames.push(\n 'shipping-address-fieldset',\n 'additional-fieldsets'\n );\n }\n\n registry.get(\n // eslint-disable-next-line max-len\n 'checkout.steps.shipping-step.shippingAddress.before-form.amazon-widget-address.before-widget-address.amazon-checkout-revert',\n function (component) {\n component.isAmazonAccountLoggedIn.subscribe(this.amazonLoginStatusObserver);\n }.bind(this)\n );\n\n registry.get(\n 'checkout.steps.billing-step.payment.payments-list.amazon_payment',\n function (component) {\n if (component.isAmazonAccountLoggedIn()) {\n $('button.action-show-popup').hide();\n }\n }\n );\n\n registry.get(\n // eslint-disable-next-line max-len\n 'checkout.steps.shipping-step.shippingAddress.customer-email.amazon-button-region.amazon-button',\n function (component) {\n async.async({\n selector: '#PayWithAmazon_amazon-pay-button img'\n }, function () {\n removeAmazonPayButton();\n });\n\n component.isAmazonAccountLoggedIn.subscribe(function (loggedIn) {\n if (!loggedIn) {\n removeAmazonPayButton();\n }\n });\n }\n );\n\n quote.billingAddress.subscribe(function () {\n if (this.isUpdateCancelledByBilling) {\n this.validateAndSaveIf
2Changed(true);\n }\n }, this);\n },\n\n initObservable: function () {\n this._super();\n\n quote.shippingMethod.subscribe(this.shippingMethodObserver.bind(this));\n\n if (quote.shippingMethod.getVersion() > 1) {\n this.shippingMethodObserver(quote.shippingMethod());\n }\n\n this.allowedDynamicalSave = true;\n\n events.onBeforeShippingSave(shippingRegistry.register.bind(shippingRegistry));\n events.onBeforeShippingSave(paymentLoader.bind(null, true));\n events.onAfterShippingSave(paymentLoader.bind(null, false));\n\n return this;\n },\n\n /**\n * Register subscribers who save shipping.\n * Register after full load.\n * @returns {void}\n */\n registerObserversAfterLoad: function () {\n this.isInitialDataSaved = true;\n\n shippingRegistry.isAddressChanged.subscribe(this.additionalFieldsObserver.bind(this));\n shippingService.isLoading.subscribe(function (isLoading) {\n if (!isLoading) {\n this.validateAndSaveIfChanged(true);\n }\n }, this);\n },\n\n /**\n * If checkout already have all shipping information\n * then execute validate and save process because we dont have any triggers\n * and save should be executed on storefront for 3rd party extensions compatibility\n * @returns {void}\n */\n saveInitialData: function () {\n if (!this.isInitialDataSaved) {\n onLoad(\n function () {\n shippingRegistry.initializedPromise.then(function () {\n if (this.silentValidation()) {\n this.validateAndSaveIfChanged(true);\n }\n }.bind(this));\n }.bind(this)\n );\n\n this.isInitialDataSaved = true;\n }\n },\n\n /**\n * Validate shipping without showing any errors\n * @return {Boolean} result Validation result\n */\n silentValidation: function () {\n var invalidElement,\n result = !_.isEmpty(quote.shippingMethod()) && !_.isEmpty(quote.shippingAddress());\n\n if (result && this.isFormInline) {\n invalidElement = _.find(shippingRegistry.addressComponents, function (module) {\n return ko.isObservable(module.required)\n && ko.isObservable(module.value)\n && ko.isObservable(module.visible)\n && ko.isObservable(module.disabled)\n && module.required.peek()\n && module.visible.peek()\n && !module.disabled.peek()\n && this._isValueEmpty(module.value.peek());\n }, this);\n\n result = _.isUndefined(invalidElement);\n }\n\n return result;\n },\n\n /**\n * @param {String|Number|Object|*} value\n * @return {boolean}\n * @private\n */\n _isValueEmpty: function (value) {\n if (_.isNumber(value)) {\n return !value;\n }\n\n return _.isEmpty(value);\n },\n\n setShippingInformation: function () {\n var result;\n\n this.allowedDynamicalSave = false;\n result = this._super();\n this.allowedDynamicalSave = true;\n\n return result;\n },\n\n selectShippingMethod: function (method) {\n window.loaderIsNotAllowed = true;\n this._super(method);
2\n instance.validateAndSaveIfChanged();\n delete window.loaderIsNotAllowed;\n\n return true;\n },\n\n /**\n * Copy of parent method validateShippingInformation()\n * without focus to email field\n * @param {Boolean} hideError\n * @return {Boolean}\n */\n validateShipping: function (hideError) {\n var shippingAddress,\n addressData,\n emailValidationResult = customer.isLoggedIn(),\n field,\n option = _.isObject(this.countryOptions)\n && this.countryOptions[quote.shippingAddress().countryId],\n messageContainer = registry.get('checkout.errors').messageContainer;\n\n if (!quote.shippingMethod()) {\n this.errorValidationMessage(\n $t('The shipping method is missing. Select the shipping method and try again.')\n );\n\n return false;\n }\n\n if (!customer.isLoggedIn()) {\n emailValidationResult = emailValidator.validate(hideError);\n }\n\n if (this.isFormInline) {\n this.source.set('params.invalid', false);\n this.triggerShippingDataValidateEvent();\n\n if (!quote.shippingMethod()['method_code']) {\n this.errorValidationMessage(\n $t('The shipping method is missing. Select the shipping method and try again.')\n );\n }\n\n if ((emailValidationResult\n && this.source.get('params.invalid'))\n || !quote.shippingMethod()['method_code']\n || !quote.shippingMethod()['carrier_code']\n ) {\n this.focusInvalid();\n\n return false;\n }\n\n if (this.source.get('params.invalid')) {\n return false;\n }\n\n shippingAddress = quote.shippingAddress();\n addressData = addressConverter.formAddressDataToQuoteAddress(\n this.source.get('shippingAddress')\n );\n\n // Copy form data to quote shipping address object\n // eslint-disable-next-line no-restricted-syntax\n for (field in addressData) {\n if (addressData.hasOwnProperty(field)\n && shippingAddress.hasOwnProperty(field)\n && typeof addressData[field] != 'function'\n && _.isEqual(shippingAddress[field], addressData[field])\n ) {\n shippingAddress[field] = addressData[field];\n } else if (typeof addressData[field] != 'function'\n && !_.isEqual(shippingAddress[field], addressData[field])) {\n shippingAddress = addressData;\n break;\n }\n }\n\n if (customer.isLoggedIn()) {\n shippingAddress['save_in_address_book'] = 1;\n }\n\n selectShippingAddress(shippingAddress);\n } else if (customer.isLoggedIn()\n && option\n && option['is_region_required']\n && !quote.shippingAddress().region\n ) {\n messageContainer.addErrorMessage({\n message: $t('Please specify a regionId in shipping address.')\n });\n\n return false;\n }\n\n return true;\n },\n\n /**\n * @param {Boolean} hideError\n * @returns {Boolean}\n */\n validateShippingInformation: function (hideError) {\n var result;\n\n if (hideError && (shippingRegistry.isEstimationHaveError() || !this.silentValidation())) {\n return false;\n }\n\n this.allowedDynamicalValidation = false;\n result = this.validateShipping(hideError);\n if (hideError && !result && !window.shippingErrorHideIsNotAllowed) {\n if (this.isFormInline && this.source.get('params.invalid')) {\
2n //set current value as initialValue\n this.source.trigger('data.overload');\n //set initialValue to value and reset errors\n this.source.trigger('data.reset');\n }\n\n this.errorValidationMessage(false);\n }\n this.allowedDynamicalValidation = true;\n\n return result;\n },\n\n /**\n * Calculate Totals for changed shipping method.\n * Necessary only if dynamical shipping save is not working (i.e. shipping is not valid)\n *\n * @param {Object} method Shipping method\n * @returns {void}\n */\n shippingMethodObserver: function (method) {\n this.saveInitialData();\n\n if (method\n && shippingRegistry.isEstimationHaveError()\n || this.source.get('params.invalid')\n || shippingRegistry.isEstimationHaveError.getVersion() === 1\n && shippingRegistry.isHaveUnsavedShipping()\n && !window.checkoutConfig.isNegotiableQuote\n ) {\n totalsProcessor();\n }\n },\n\n /**\n * Reselect shipping method when customer logs out of Amazon\n * @param {Boolean} loggedIn Amazon account login status\n * @returns {void}\n */\n amazonLoginStatusObserver: function (loggedIn) {\n if (!loggedIn) {\n registry.get('checkout.steps.shipping-step.shippingAddress', function (component) {\n if (component.isSelected()) {\n component.selectShippingMethod(quote.shippingMethod());\n }\n });\n }\n },\n\n /**\n * Trigger shipping address validation and save on additional address fields change\n * @param {Boolean} isChanged Change status\n * @returns {void}\n */\n additionalFieldsObserver: function (isChanged) {\n var versionBeforeChange;\n\n if (!isChanged || shippingRegistry.isEstimationHaveError()) {\n paymentLoader(false);\n\n return;\n }\n\n if (this.isFormInline) {\n versionBeforeChange = shippingService.isLoading.getVersion();\n\n if ((this.validateShippingInformation(true) || !this.source.get('params.invalid'))\n && shippingService.isLoading.hasChanged(versionBeforeChange)\n ) {\n return;\n }\n }\n\n this.validateAndSaveIfChanged(true);\n },\n\n validateAndSaveIfChanged: function (hideError) {\n var isShippingValid;\n\n if (!this.allowedDynamicalSave\n || this.isBillingAddressFormVisible()\n || !shippingRegistry.isHaveUnsavedShipping()\n ) {\n paymentLoader(false);\n\n return;\n }\n\n isShippingValid = !this.allowedDynamicalValidation;\n\n // allowedDynamicalValidation - for avoid circular dependency\n if (this.allowedDynamicalValidation) {\n this.allowedDynamicalSave = false;\n isShippingValid = this.validateShippingInformation(hideError);\n this.allowedDynamicalSave = true;\n }\n\n /*\n if isFormInline = true, method validateShippingInformation\n will set shipping address and this observer will be executed.\n validateShippingInformation - also validate email, which is not part of Shipping information.\n */\n if (isShippingValid || (this.isFormInline && !this.source.get('params.invalid'))) {\n window.loaderIsNotAllowed = true;\n events.trigger('before_shipping_save');\n setShippingInformationAction();\n delete window.loaderIsNotAllowed;\n } else {\n paymentLoader(false);\n }\n },\n\n getNameShippingAddress: function () {\n return viewUtils.getBlockTitle('shipping_address');\n },\n\n getNameShippingMethod: function () {\n return viewUtils.getBlockTitle('shipping_method');\n },\n\n isPostNlEnable: function () {\n return window.checkoutConfig.quoteData.posnt_nl_enable;\n },\n\n /**\n * Trigger Shipping data Validate Event.\n * @returns {void}\n */\n triggerShippingDataValidateEvent: function () {\n this.source.trigger('shippingAddress.data.validate');\n\n if (this.source.get('shippingAddress.custom_attributes')) {\n this.source.trigger('shippingAddress.custom_attributes.data.validate');\n }\n },\n\n validatePlaceOrder: function () {\n var loginFormSelector = 'form[data-role=email-with-possible-login]',\n emailValidationResult = this.isCu
2stomerLoggedIn();\n\n if (!emailValidationResult) {\n $(loginFormSelector).validation();\n emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid());\n }\n\n if (!emailValidationResult) {\n $(loginFormSelector + ' input[name=username]').focus();\n\n return false;\n }\n\n if (this.isFormInline) {\n this.source.set('params.invalid', false);\n this.triggerShippingDataValidateEvent();\n\n if (\n this.source.get('params.invalid')\n ) {\n return false;\n }\n }\n\n return true;\n },\n\n isModernDesign: function () {\n return window.checkoutDesign === 'modern';\n },\n\n /**\n * @param {Object} method - shipping method\n * @return {String} comment Tooltip text\n */\n getMethodTooltipText: function (method) {\n var comment = '';\n\n if (this.isModernDesign() && method.error_message) {\n comment = method.error_message;\n }\n\n if (!comment) {\n comment = this.getCommentShippingMethod(method);\n }\n\n return comment;\n },\n\n /**\n * Compatibility with Amasty_ShippingTableRates and Amasty_StorePickup\n * @param {Object} method Shipping method\n * @returns {String} Shipping method comment\n */\n getCommentShippingMethod: function (method) {\n if (!method) {\n return '';\n }\n\n if (method.comment && typeof method.comment === 'string') {\n return method.comment;\n }\n\n if (method.extension_attributes) {\n if (method.extension_attributes.amstorepick_comment) {\n return method.extension_attributes.amstorepick_comment;\n }\n\n if (method.extension_attributes.amstartes_comment) {\n return method.extension_attributes.amstartes_comment;\n }\n }\n\n return '';\n },\n\n getAdditionalClassForIcons: function (method) {\n if (this.isModernDesign()\n && Object.prototype.hasOwnProperty.call(method, 'error_message')\n && method.error_message\n ) {\n return '-error';\n }\n\n return '';\n },\n\n isShippingMethodTooltip: function (method) {\n return this.isModernDesign() && this.getMethodTooltipText(method);\n },\n\n getColspanCarrier: function (method) {\n if (this.isShippingMethodTooltip(method)) {\n return 1;\n }\n\n return 2;\n },\n\n /**\n * Disable focus on validation\n * Override parents function\n * @returns {Function}\n */\n focusInvalid: function () {\n return this;\n },\n\n /**\n * Check on visible billing address form\n * @returns {Boolean} Billing address form visibility state\n */\n isBillingAddressFormVisible: function () {\n this.isUpdateCancelledByBilling = !addressFormState.isBillingSameAsShipping()\n && addressFormState.isBillingFormVisible();\n\n return this.isUpdateCancelledByBilling;\n },\n\n /**\n * Can be used as override for getPopUp function\n * to suppress new shipping address popup.\n * Used in 'list-mixin.js'\n *\n * @return {{openModal: openModal, closeModal: closeModal}}\n */\n getPopUpOverride: function () {\n var self = this;\n\n return {\n openModal: function () {\n self.isFormPopUpVisible(true);\n },\n closeModal: function () {\n self.isFormPopUpVisible(false);\n }\n };\n }\n });\n };\n }\n);\n","Amasty_CheckoutCore/js/view/utils.js":"// Checkout views utility methods\ndefine(['underscore'], function (_) {\n 'use strict';\n\n return {\n /**\n * Find checkout block layout config in
2window.checkoutConfig\n * @param {string} blockNames\n * @returns {null|{title:string, name:string}}\n */\n getBlockLayoutConfig: function (blockNames) {\n var resultBlock = null;\n\n _.find(window.checkoutConfig.checkoutBlocksConfig, function (column) {\n return _.find(column, function (block) {\n if (blockNames === block.name) {\n resultBlock = block;\n\n return true;\n }\n });\n });\n\n return resultBlock;\n },\n\n /**\n * Get checkout block title from window.checkoutConfig\n * @param {String} blockName\n * @returns {String}\n */\n getBlockTitle: function (blockName) {\n var blockConfig = this.getBlockLayoutConfig(blockName);\n\n return blockConfig ? blockConfig.title : '';\n }\n };\n});\n","Amasty_CheckoutCore/js/view/form/element/email.js":"define([\n 'jquery',\n 'uiRegistry',\n 'ko',\n 'underscore',\n 'Magento_Checkout/js/view/form/element/email',\n 'Magento_Customer/js/model/customer',\n 'Magento_Customer/js/customer-data',\n 'Magento_Checkout/js/checkout-data',\n 'Amasty_CheckoutCore/js/model/payment-validators/login-form-validator',\n 'Amasty_CheckoutCore/js/action/save-password',\n 'Amasty_CheckoutCore/js/model/payment/place-order-state',\n 'Magento_Ui/js/lib/view/utils/async'\n], function (\n $,\n registry,\n ko,\n _,\n Component,\n customer,\n customerData,\n checkoutData,\n loginFormValidator,\n saveAction,\n placeOrderState\n) {\n 'use strict';\n\n /**\n * Setting 'Let Customers Create an Account at Checkout'\n * Decryption of codes for this.createAcc:\n * 0 - No\n * 1 - After Placing an Order\n * 2 - While Placing an Order, Optional\n * 3 - While Placing an Order, Required\n */\n\n /**\n * @return {*}\n */\n var getData = function () {\n return customerData.get('checkout-data')();\n };\n\n return Component.extend({\n defaults: {\n isCreateAccountAction: ko.observable(true),\n isPassword: ko.observable(false),\n createAcc: +window.checkoutConfig.quoteData.additional_options.create_account,\n passwordConfirmation: '',\n passValidationDelay: 500,\n loginFormSelector: 'form[data-role=\"email-with-possible-login\"]',\n modules: {\n dateOfBirth: 'checkout.sidebar.additional.checkboxes.date_of_birth',\n loginCaptcha: '${ $.name }.additional-login-form-fields.captcha',\n mspRecaptcha: '${ $.name }.msp_recaptcha',\n recaptcha: '${ $.name }.recaptcha',\n createAccountRecaptcha: '${ $.name }.recaptcha-customer-create'\n },\n listens: {\n passwordConfirmation: 'validateAndSaveRegistration'\n }\n },\n passValidationTimeout: 0,\n\n initialize: function () {\n this._super();\n\n if (this.createAcc <= '1') {\n return;\n }\n\n this.template = 'Amasty_CheckoutCore/form/element/email';\n this._renderLoginForm(this._resolveInitialPasswordVisibility());\n\n this.isLoading.subscribe(function (isLoading) {\n if (isLoading === false) {\n $.when(this.isEmailCheckComplete)\n .done(function () {\n this._isNeededCreateAccountFunc(true);\n }.bind(this))\n .fail(function () {\n this._isNeededCreateAccountFunc(false);\n }.bind(this));\n }\n }.bind(this));\n\n if (this.createAcc === 3 && !customer.isLoggedIn()) {\n this.isPassword(true);\n placeOrderState(false);\n\n this.isLoading.subscribe(function () {\n $.when(this.isEmailCheckComplete).done(function () {\n this.isPassword(true);\n }.bind(this)).fail(function () {\n this.isPassword(false);\n }.bind(this)).always(function () {\n placeOrderState(true);\n });\n }.bind(this));\n\n this.\u0441heckEnteredEmail();\n }\n }
2,\n\n initObservable: function () {\n this._super().observe('passwordConfirmation');\n\n if (this.createAcc <= 1) {\n return this;\n }\n\n this.validate = ko.computed(function () {\n $.async('#customer-password', function (elem) {\n if (this.isPasswordVisible() && this.isCreateAccountAction() === true) {\n $(elem).rules('add', 'validate-customer-password');\n } else if ($.data(elem.form, 'validator')\n && $(elem).rules().hasOwnProperty('validate-customer-password')\n ) {\n $(elem).rules('remove', 'validate-customer-password');\n }\n }.bind(this));\n\n loginFormValidator.validate();\n\n return this.isPasswordVisible() && this.isCreateAccountAction() === true;\n }.bind(this));\n\n return this;\n },\n\n /**\n * Checks the email entered before reloading the page\n *\n * @returns {void}\n */\n \u0441heckEnteredEmail: _.once(function () {\n if (this.email()) {\n this.checkEmailAvailability();\n }\n }),\n\n isPasswordRequired: function () {\n this._visibleDateOfBirth();\n this._visibleLoginCaptcha();\n this._visibleReCaptcha();\n },\n\n getTooltip: function () {\n return this.tooltip;\n },\n\n isPasswordSet: function (element) {\n this.isPassword(!!element.value);\n\n this._visibleDateOfBirth();\n this._visibleLoginCaptcha();\n this._visibleReCaptcha();\n },\n\n emailHasChanged: function () {\n this._super();\n\n if (this.createAcc <= 1) {\n return;\n }\n\n if (!this.validateEmail()) {\n this.isCreateAccountAction(false)\n }\n\n setTimeout(function () {\n this._visibleLoginCaptcha();\n this._visibleReCaptcha();\n }.bind(this), this.checkDelay);\n },\n\n getRequiredCharacterClassesNumber: function () {\n return parseInt(registry.get('checkoutProvider').requiredCharacterClassesNumber, 10);\n },\n\n getMinimumPasswordLength: function () {\n return parseInt(registry.get('checkoutProvider').minimumPasswordLength, 10);\n },\n\n validateAndSaveRegistration: function () {\n if (loginFormValidator.validate()) {\n saveAction();\n }\n },\n\n /**\n * Override submit action\n * on create account action - just validate and save\n * @returns {void|UIClass}\n */\n login: function () {\n if (this.createAcc >= 2\n && this.isPasswordVisible()\n && this.isCreateAccountAction() === true) {\n this.validateAndSaveRegistration();\n } else {\n return this._super();\n }\n },\n\n _isNeededCreateAccountFunc: function (state) {\n this.isCreateAccountAction(state);\n this.isPasswordVisible(true);\n\n this._visibleLoginCaptcha();\n this._visibleReCaptcha();\n },\n\n _renderLoginForm: function (state) {\n if (state) {\n this.isPasswordVisible(true);\n this.isCreateAccountAction(false);\n } else {\n $.async(this.loginFormSelector, function () {\n if (this.validateEmail()) {\n this.isPasswordVisible(true);\n this.isCreateAccountAction(true);\n } else {\n this.isPasswordVisible(false);\n this.isCreateAccountAction(false);\n }\n }.bind(this));\n }\n },\n\n /**\n * Resolves an initial sate of a login form.\n *\n * @returns {Boolean} - initial visibility state.\n */\n _resolveInitialPasswordVisibility: function () {\n if (checkoutData.getInputFieldEmailValue() !== '') {\n return checkoutData.getInputFieldEmailValue() === this._getCheckedEmailValue();\n }\n\n return false;\n },\n\n _getCheckedEmailValue: function () {\n return getData().checkedEmailValue || '';\n },\n\n _visibleLoginCaptcha: function () {\n if (this.loginCaptcha()) {\n this.loginCaptcha().currentCaptcha.setIsVisible(\n (this.isPasswordVisible() && !this.isCreateAccountAction() && window.checkoutConfig.amastyOscCaptcha.isLoginCaptcha)\n || (this.isCreateAccountAction() && window.checkoutConfig.amastyOscCaptcha.isCreateAccountCaptcha)\n );\n }\n },\n\n _visibleReCaptcha: function () {\n // for magento < 2.4.0\n if (this.mspRecaptcha()) {\n $.async({\n selector: '#msp-recaptcha-checkout-inline-login-wrapper'\n }, function (loginWrapper) {\n $(loginWrapper).toggle(\n this.isReCaptchaVisible()\n );\n }.bind(this));\n }\n //for magento >= 2.4.0\n if (this.recaptcha()) {\n $.async({\n // customer_login recaptcha\n selector: '#recaptcha-checkout-inline-login-wrapper'\n }, function (loginWrapper) {\n $(loginWrapper).toggle(\n this.isPasswordVisible() && !this.isCreateAccountAction() && window.checkoutConfig.amastyOscCaptcha.isLoginReCaptcha\n );\n }.bind(this));\n }\n if (this.createAccountRecaptcha()) {\n $.async({\n // customer_create recaptcha\n selector: '#recaptcha-checkout-inline-create-wrapper'\n }, function (loginWrapper) {\n $(loginWrapper).toggle(\n this.isCreateAccountAction() && window.checkoutConfig.amastyOscCaptcha.isCreateAccountReCaptcha\n );\n }.bind(this));\n }\n }
2,\n\n isReCaptchaVisible: function() {\n return (this.isPasswordVisible() && !this.isCreateAccountAction() && window.checkoutConfig.amastyOscCaptcha.isLoginReCaptcha)\n || (this.isCreateAccountAction() && window.checkoutConfig.amastyOscCaptcha.isCreateAccountReCaptcha);\n },\n\n _visibleDateOfBirth: function () {\n if (this.dateOfBirth()) {\n this.dateOfBirth().visible(this.isPassword() && this.isCreateAccountAction());\n }\n }\n });\n});\n","Amasty_CheckoutCore/js/view/form/element/tooltip.js":"/**\n * Custom tooltip initializer\n */\ndefine([\n 'jquery',\n 'uiElement',\n 'Amasty_CheckoutCore/vendor/tooltipster/js/tooltipster.min'\n], function (\n $,\n Element\n) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n selectors: {\n tooltipElement: '[data-amcheckout-js=\"tooltip\"]'\n },\n keycodes: {\n escape: 27\n }\n },\n\n initialize: function () {\n this._super();\n\n this.initTooltip();\n\n return this;\n },\n\n initTooltip: function () {\n $.async(this.selectors.tooltipElement, function (element) {\n $(element).tooltipster({\n position: 'right',\n contentAsHtml: true,\n interactive: true,\n trigger: 'click',\n theme: 'amcheckout-default-tooltip'\n });\n\n $(element).focus(function() {\n $(this).tooltipster('open');\n });\n\n $(element).blur(function() {\n $(this).tooltipster('close');\n });\n\n $(element).keydown(function(event) {\n (event.keyCode === this.keycodes.escape) && $(this).tooltipster('close');\n });\n });\n },\n\n isTouchDevice: function () {\n return ('ontouchstart' in window)\n || (navigator.maxTouchPoints > 0)\n || (navigator.msMaxTouchPoints > 0);\n }\n });\n});\n","Amasty_CheckoutCore/js/view/additional/fieldset.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Amasty_CheckoutCore/js/action/save-additional-fields',\n 'Magento_Checkout/js/checkout-data'\n], function (Component, saveAction) {\n 'use strict';\n\n return Component.extend({\n saveAllowed: false,\n\n initialize: function () {\n this._super();\n this.source.on('amcheckout.additional:save', this.saveForm.bind(this));\n },\n\n saveForm: function () {\n saveAction();\n }\n });\n});\n","Amasty_CheckoutCore/js/view/additional/subscribe.js":"define([\n 'jquery',\n 'Magento_Ui/js/form/element/single-checkbox'\n], function ($, SingleCheckbox) {\n 'use strict';\n\n return SingleCheckbox.extend({\n defaults: {\n valueMap: {\n 'true': true,\n 'false': false\n }\n },\n onUpdate: function (newValue) {\n this._super();\n if (this.initialChecked !== newValue) {\n this.source.trigger('amcheckout.additional:save');\n this.initialChecked = newValue;\n }\n }\n });\n});","Amasty_CheckoutCore/js/view/additional/date-of-birth.js":"define([\n 'Magento_Ui/js/form/element/date',\n 'jquery',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Amasty_CheckoutCore/js/model/payment-validators/dob-validator',\n 'Amasty_CheckoutCore/js/view/additional/register',\n 'Amasty_CheckoutCore/js/view/checkout/datepicker'\n], function (Component, $, paymentValidatorRegistry, dobValidator) {\n 'use strict';\n return Component.extend({\n defaults: {\n template: 'Amasty_CheckoutCore/form/date',\n listens: {\n '${ $.parentName }.register:checked': 'visible'\n },\n modules: {\n registerComponent: '${ $.parentName }.register'\n }\n },\n\n /**\n * initialize\n */\n initialize: function () {\n this._super();\n paymentValidatorRegistry.registerValidator(dobValidator);\n this.options.maxDate = '-1d';\n this.options.changeMonth = true;\n this.options.changeYear = true;\n this.options.yearRange = \"-120y:c+nn\";\n this.options.showButtonPanel = true;\n this.options.showOn = 'both';\n this.registerComponent(function (component) {\n this.visible(component.checked() && component.visible());\n }.bind(this))\n },\n onUpdate: function (newValue) {\n this._super();\n if (this.hasChanged()) {\n this.source.trigger('amcheckout.additional:save');\n }\n }\n });\n});\n","Amasty_CheckoutCore/js/view/additional/comment.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_Ui/js/form/element/textarea'\n], function (Component) {\n 'use strict';\n\n return Component.extend({\n onUpdate: function (newValue) {\n this._super();\n if (this.isDifferedFromDefault()) {\n this.source.trigger('amcheckout.additional:save');\n }\n }\n });\n});\n","Amasty_CheckoutCore/js/view/additional/register.js":"define([\n 'jquery',\n 'Magento_Ui/js/form/element/single-checkbox'\n], function ($, SingleCheckbox) {\n 'use strict';\n\n return SingleCheckbox.extend({\n defaults: {\n templates: {\n checkbox: 'Amasty_CheckoutCore/form/components/single/checkbox'\n },\n modules: {\n email: 'checkout.steps.shipping-step.shippingAddress.customer-email'\n },\n listens: {\n 'visible': 'onVisibilityChange'\n },\n valueMap: {\n 'true': true,\n 'false': false\n }\n },\n\n initialize: function () {\n this._super();\n this.email(this.emailObserver.bind(this));\n },\n onUpdate: function (newValue) {\n this._super();\n this.source.trigger('amcheckout.additional:save');\n },\n onVisibilityChange: function (visibility) {\n if (!visibility) {\n this.checked(false);\n this.checked.valueHasMutated();\n } else {\n this.checked(this.initialChecked);\n }\n },\n emailObserver: function (component) {\n this.visible(!component.isPasswordVisible());\n\n component.isLoading.subscribe(function (isLoading) {\n if (isLoading === true) {\n $.when(component.isEmailCheckComplete).done(function () {\n this.visible(true);\n }.bind(this)).fail(function () {\n this.visible(false);\n }.bind(this));\n }\n }.bind(this));\n }\n });\n});","Amasty_CheckoutCore/js/view/checkout/datepicker.js":"define([\n 'moment',\n 'ko',\n 'underscore',\n 'jquery',\n 'mage/translate',\n 'mage/calendar'\n], function (moment, ko, _, $, $t) {\n 'use strict';\n\n var defaults = {\n showsTime: false,\n timeFormat: null,\n buttonImage: null,\n buttonImageOnly: null,\n buttonText: $t('Select Date')\n };\n\n ko.bindingHandlers.amastydatepicker = {\n\n init: function (el, valueAccessor) {\n\n var config = valueAccessor(),\n observable,\n options = {};\n\n _.extend(options, defaults);\n\n if (typeof config === 'object') {\n observable = config.storage;\n\n _.extend(options, config.options);\n } else {\n observable = config;\n }\n\n var date = moment(observable(), config.elem.pickerDateTimeFormat);\n\n $(el).calendar(options);\n observable() && $(el).datepicker('setDate', date.format(config.elem.pickerDateTimeFormat));\n $(el).blur();\n\n ko.utils.registerEventHandler(el, 'change', function () {\n observable(this.value);\n });\n }\n };\n});\n","Amasty_CheckoutCore/js/view/checkout/design/collapsible-steps.js":"define([\n 'jquery',\n 'mage/collapsible',\n 'Magento_Ui/js/modal/modal'\n], function ($) {\n 'use strict';\n\n $.widget('amasty.checkoutCollapsibleSteps', $.mage.collapsible, {\n _create: function () {\n this.createCollapsible();\n this.trigger = this.element.find(this.options.header);\n },\n\n initCollapsible: function () {\n $(this.element).parent().collapsible({\n header: '[data-amcheckout-js=\"step-title\"]',\n content: $(this.element).parent().find('[data-amcheckout-js=\"step-content\"]'),\n active: true,\n openedState: '-collapsible -opened',\n closedState: '-collapsible -closed',\n icons: {\n header: 'amcheckout-icon -plus',\n activeHeader: 'amcheckout-icon -minus'\n },\n animate: 300\n });\n },\n\n createCollapsible: function () {\n var checkoutWindow = window;\n\n if (!$(this.element).parent().data('mageCollapsible')\n && checkoutWindow.checkoutDesign == 'modern'\n && (c
2heckoutWindow.checkoutLayout == '1column' || checkoutWindow.checkoutLayout == '2columns')) {\n this.initCollapsible();\n }\n },\n\n destroyCollapsible: function () {\n var collapsibleElement = $(this.element).parent();\n\n if (collapsibleElement.data('mageCollapsible')) {\n collapsibleElement.collapsible(\"forceActivate\").collapsible(\"destroy\");\n }\n }\n });\n\n return $.amasty.checkoutCollapsibleSteps;\n});\n","Amasty_CheckoutCore/js/view/checkout/summary/cart-items.js":"/**\n * Checkout cart items view.\n */\ndefine([\n 'ko',\n 'Magento_Checkout/js/model/totals',\n 'Magento_Checkout/js/view/summary/cart-items'\n], function (ko, totals, Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Amasty_CheckoutCore/checkout/summary/cart-items'\n },\n\n itemsQty: ko.observable(),\n\n initialize: function () {\n this._super();\n\n this.itemsQty(this.getItemsQty());\n totals.totals.subscribe(function () {\n this.itemsQty(this.getItemsQty());\n }, this);\n\n return this;\n },\n\n getItemsQty: function () {\n return parseFloat(totals.totals().items_qty);\n }\n });\n});\n","Amasty_CheckoutCore/js/view/checkout/summary/item/details.js":"define(\n [\n 'jquery',\n 'Magento_Checkout/js/view/summary/item/details',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Ui/js/modal/confirm',\n 'Amasty_CheckoutCore/js/action/remove-item',\n 'Amasty_CheckoutCore/js/action/update-item',\n 'mage/translate',\n 'ko',\n 'Amasty_CheckoutCore/js/options/configurable',\n 'priceOptions',\n 'mage/validation'\n ],\n function ($, Component, quote, confirm, removeItemAction, updateItemAction, $t, ko, configurable, priceOptions) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Amasty_CheckoutCore/checkout/summary/item/details',\n messages: {\n deleteItem: $t('Are you sure you would like to remove this item from the shopping cart?')\n }\n },\n\n /**\n * @param {Object} item\n * @return {*}\n */\n getItemConfig: function (item) {\n return this.getPropertyDataFromItem(item, 'amcheckout');\n },\n\n /**\n *\n * @param {Object} item\n * @param {Object} propertyName\n * @return {*}\n */\n getPropertyDataFromItem: function (item, propertyName) {\n var property,\n itemDetails,\n quoteItem;\n\n if (item.hasOwnProperty(propertyName)) {\n property = item[propertyName];\n }\n\n quoteItem = this.getItemFromQuote(item);\n\n if (quoteItem.hasOwnProperty(propertyName)) {\n property = quoteItem[propertyName];\n }\n\n if (property) {\n this.storage().set('item_details' + item.item_id + propertyName, property);\n\n return property;\n }\n\n itemDetails = this.storage().get('item_details' + item.item_id + propertyName);\n\n return itemDetails || false;\n },\n\n /**\n *\n * @param {Object} item\n * @return {*}\n */\n getItemFromQuote: function (item) {\n var items = quote.getItems(),\n quoteItems = items.filter(function (quoteItem) {\n return +quoteItem.item_id === item.item_id;\n });\n\n if (quoteItems.length === 0) {\n return false;\n }\n\n return quoteItems[0];\n },\n\n getConfigurableOptions: function (item) {\n var itemConfig = this.getItemConfig(item);\n\n if (itemConfig.hasOwnProperty('configurableAttributes')) {\n return itemConfig.configurableAttributes.template;\n }\n\n return '';\n },\n\n getCustomOptions: function (item, element) {\n var itemConfig = this.getItemConfig(item),\n template = '';\n\n if (itemConfig.hasOwnProperty('customOptions')) {\n template = itemConfig.customOptions.template;\n }\n\n $(element).html(template).trigger('contentUpdated');\n },\n\n optionsAfterRender: function (item, element) {\n $(element).one('beforeOpen', this.initOnOpen.bind(this, item));\n },\n\n initOnOpen: function (item) {\n const itemConfig = this.getItemConfig(item);\n\n if (itemConfig.hasOwnProperty('configurableAttributes')) {\n this.preSelectOptions(itemConfig, item);\n }\n },\n\n preSelectOptions: function (itemConfig, item) {\n const container = item.form;\n\n container.amcheckoutConfigurable({\n spConfig: JSON.parse(itemConfig.configurableAttributes.spConfig),\n superSelector: '[data-role=\"product-attributes\"][data-item-id=' + item.item_id + ']' + ' .super-attribute-select'\n });\n\n item.preSelect = true;\n },\n\n isDecimal: function (item) {\n var quoteItem = this.getItemFromQuote(item);\n\n return quoteItem.is_qty_decimal;\n },\n\n isEditingAvailable: function (item) {\n return this.isEditable(item) && !this.isNegotiableQuote();\n },\n\n isEditingLocked: function (item) {\n return this.isEditable(item) && this.isNegotiableQuote();\n },\n\n isEditable: function (item) {\n var itemConfig = this.getItemConfig(item);\n\n return itemConfig.isEditable;\n },\n\n isNegotiableQuote: function () {\n return window.checkoutConfig.isNegotiableQuote && this.backQuoteUrl();\n },\n\n backQuoteUrl: function () {\n return window.checkoutConfig.backQuoteUrl;\n },\n\n initOptions: function (item) {\n const itemConfig = this.getItemConfig(item),\n containerSelector = '[data-role=\"product-attributes\"][data-item-id=' + item.item_id + ']',\n container = $(containerSelector);\n\n if (itemConfig.hasOwnProperty('customOptions')) {\n container.priceOptions({\n optionConfig: JSON.parse(itemConfig.customOptions.optionConfig)\n });\n }\n\n item.form = container;
2\n item.isUpdated = ko.observable(false);\n item.validation = container.validation();\n\n container.find('input, select, textarea').change(function () {\n item.isUpdated(true);\n });\n },\n\n updateItem: function (item) {\n if (item.validation.valid()) {\n const itemConfig = this.getItemConfig(item);\n\n if (itemConfig.hasOwnProperty('configurableAttributes') && !item.preSelect) {\n this.preSelectOptions(itemConfig, item);\n }\n\n updateItemAction(item.item_id, item.form.serialize());\n }\n },\n\n /**\n * Automatically updates the order form if it`s changed\n *\n * @param {Object} item\n * @return {*}\n */\n updateItemAuto: function (item) {\n const itemConfig = this.getItemConfig(item);\n let isNotEmpty = true,\n options;\n\n if (!Object.prototype.hasOwnProperty.call(item, 'form')) {\n return;\n }\n\n if (itemConfig.hasOwnProperty('configurableAttributes') && !item.preSelect) {\n this.preSelectOptions(itemConfig, item);\n }\n\n options = item.form.serializeArray();\n $.each(options, function () {\n if (this.value === '') {\n isNotEmpty = false;\n }\n });\n\n if (isNotEmpty) {\n item.validation.valid();\n updateItemAction(item.item_id, item.form.serialize());\n }\n },\n\n deleteItem: function (item) {\n confirm({\n content: this.messages.deleteItem,\n actions: {\n confirm: function () {\n removeItemAction(item.item_id);\n },\n always: function (event) {\n event.stopImmediatePropagation();\n }\n }\n });\n },\n\n canShowDeleteButton: function () {\n return this.isCheckoutItemsEditable() && quote.getItems().length >= 1 && !this.isNegotiableQuote();\n },\n\n isCheckoutItemsEditable: function () {\n return window.checkoutConfig.isCheckoutItemsEditable;\n }\n });\n }\n);\n","Amasty_CheckoutCore/js/view/checkout/summary/item/price/unit_excl_tax.js":"/* eslint-disable dot-notation */\ndefine([\n 'Magento_Weee/js/view/checkout/summary/item/price/row_excl_tax'\n], function (Component) {\n 'use strict';\n\n return Component.extend({\n /**\n * @param {Object} item\n * @return {Number}\n */\n getUnitPriceExclTax: function (item) {\n var unitPriceExclTax = parseFloat(item['row_total']) / parseFloat(item['qty']);\n\n if (window.checkoutConfig.getIncludeWeeeFlag) {\n unitPriceExclTax += this.getUnitWeeeTaxExclTax(item);\n }\n\n return unitPriceExclTax;\n },\n\n /**\n * @param {Object} item\n * @return {Number}\n */\n getUnitWeeeTaxExclTax: function (item) {\n var totalWeeeTaxExclTaxApplied = 0,\n weeeTaxAppliedAmounts;\n\n if (item['weee_tax_applied']) {\n weeeTaxAppliedAmounts = JSON.parse(item['weee_tax_applied']);\n weeeTaxAppliedAmounts.forEach(function (weeeTaxAppliedAmount) {\n totalWeeeTaxExclTaxApplied += parseFloat(Math.max(weeeTaxAppliedAmount.amount, 0));\n });\n }\n\n return totalWeeeTaxExclTaxApplied;\n }\n });\n});\n","Amasty_CheckoutCore/js/view/checkout/summary/item/price/unit_incl_tax.js":"define([\n 'Magento_Weee/js/view/checkout/summary/item/price/row_incl_tax'\n], function (Component) {\n 'use strict';\n\n return Component.extend({\n /**\n * @param {Object} item\n * @return {Number}\n */\n getUnitPriceInclTax: function (item) {\n var unitPriceInclTax = parseFloat(item['price_incl_tax']);\n\n if (window.checkoutConfig.getIncludeWeeeFlag) {\n unitPriceInclTax += this.getUnitWeeeTaxInclTax(item);\n }\n\n return unitPriceInclTax;\n },\n\n /**\n * @param {Object}item\n * @return {Number}\n */\n getUnitWeeeTaxInclTax: function (item) {\n var totalWeeeTaxInclTaxApplied = 0,\n weeeTaxAppliedAmounts;\n\n if (item['weee_tax_applied']) {\n weeeTaxAppliedAmounts = JSON.parse(item['weee_tax_applied']);
2\n weeeTaxAppliedAmounts.forEach(function (weeeTaxAppliedAmount) {\n totalWeeeTaxInclTaxApplied += parseFloat(Math.max(weeeTaxAppliedAmount['amount_incl_tax'], 0));\n });\n }\n\n return totalWeeeTaxInclTaxApplied;\n }\n });\n});\n","Amasty_CheckoutCore/js/view/validators/agreement-validation.js":"define(\n [\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Amasty_CheckoutCore/js/model/payment-validators/agreement-validator'\n ],\n function (Component, additionalValidators, agreementValidator) {\n 'use strict';\n additionalValidators.registerValidator(agreementValidator);\n return Component.extend({});\n }\n);\n","Amasty_CheckoutCore/js/view/validators/order-summary-validation.js":"define([\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Amasty_CheckoutCore/js/model/payment-validators/order-summary-validator'\n], function (Component, additionalValidators, orderSummaryValidator) {\n 'use strict';\n\n additionalValidators.registerValidator(orderSummaryValidator);\n\n return Component.extend({});\n});\n","Amasty_CheckoutCore/js/view/summary/summary-widget.js":"define([\n 'jquery',\n 'stickyWidget',\n 'checkoutCollapsibleSteps'\n], function ($) {\n 'use strict';\n\n $.widget('amasty.summaryWidget', {\n options: {\n desktopBreakpoint: 1024,\n },\n\n _create: function () {\n if ($(this.element).parents('[data-amcheckout-js=\"main-container\"]').length) {\n this.summaryByLayout();\n }\n },\n\n summaryByLayout: function () {\n switch (window.checkoutLayout) {\n case '1column':\n $(this.element).checkoutCollapsibleSteps();\n break;\n\n case '2columns':\n this.manageCollapsible();\n if (!$(this.element).data('amastyStickyWidget')) {\n $(this.element).stickyWidget({\n parentContainer: '[data-amcheckout-js=\"main-container\"]',\n element: '[data-amcheckout-js=\"sidebar-column\"]',\n scrollContentContainer: '[data-amcheckout-js=\"main-column\"]',\n stickyOffset: {\n top: 0,\n left: 60\n },\n stickyPosition: 'right'\n });\n }\n break;\n\n default:\n break;\n }\n },\n\n manageCollapsible: function () {\n if ($(window).width() < this.options.desktopBreakpoint) {\n $(this.element).checkoutCollapsibleSteps();\n } else {\n $('[data-amcheckout-js=\"step-container\"]').on(\"dimensionsChanged\", function () {\n $(window).trigger('scroll');\n });\n }\n\n $(window).on('resize', function () {\n if ($(window).width() < this.options.desktopBreakpoint) {\n $(this.element).checkoutCollapsibleSteps().checkoutCollapsibleSteps('createCollapsible');\n } else {\n if ($(this.element).data('amastyCheckoutCollapsibleSteps')) {\n $(this.element).checkoutCollapsibleSteps('destroyCollapsible');\n }\n }\n }.bind(this));\n }\n });\n\n return $.amasty.summaryWidget;\n});\n","Amasty_CheckoutCore/js/view/summary/cart-items-mixin.js":"define([], function () {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n /**\n * After Magento 2.2.4 items is not expanded by default.\n * return true for expanded by default\n */\n isItemsBlockExpanded: function () {\n return true;\n }\n });\n }\n});","Amasty_CheckoutCore/js/view/summary/sticky-widget.js":"define([\n 'jquery'\n], function ($) {\n 'use strict';\n\n $.widget('amasty.stickyWidget', {\n options: {\n //selectors\n parentContainer: '[data-amsticky-js=\"main-container\"]',\n element: '[data-amsticky-js=\"sticky-element\"]',\n scrollContentContainer: '[data-amsticky-js=\"scroll-element\"]',\n stopper: '[data-amsticky-js=\"stopper\"]',\n\n //sticky options\n stickyOffset: {\n top: 0,\n left: 0\n },\n stickyPosition: 'right',\n stickyClass: '-sticky',\n disableBreakpoint: 1024\n },\n\n _create: function () {\n var toggleSticky = this.stickyToggle.bind(this),\n windowGlobal = window;\n\n if ($(windowGlobal).width() >= this.options.disableBreakpoint) {\n if ($(this.options.scrollContentContainer).length) {\n this.stickyPosition(this.options.stickyPosition);\n };\n\n $(windowGlobal).off('scroll', toggleSticky).on('scroll', toggleSticky);\n }\n\n $(windowGlobal).on('resize', function () {\n this.stickyToggle(
2);\n if ($(windowGlobal).width() >= this.options.disableBreakpoint) {\n this.stickyPosition(this.options.stickyPosition);\n $(windowGlobal).off('scroll', toggleSticky).on('scroll', toggleSticky);\n } else {\n $(windowGlobal).off('scroll', toggleSticky);\n }\n }.bind(this));\n },\n\n stickyToggle: function () {\n var stickyOptions = this.options,\n parentIsSet = $(stickyOptions.parentContainer).length,\n parentContainer = (parentIsSet)\n ? $(stickyOptions.parentContainer)\n : $('body'),\n parentContainerOffset = parentContainer.offset(),\n scrollContentIsSet = $(stickyOptions.scrollContentContainer).length,\n scrollContent = (scrollContentIsSet)\n ? $(stickyOptions.scrollContentContainer)\n : $('body'),\n stickyElement = $(stickyOptions.element),\n stickyIsRight = stickyOptions.stickyPosition == 'right',\n stickyOffset = stickyOptions.stickyOffset,\n stickyOffsetLeft = (scrollContentIsSet)\n ? scrollContent.offset().left + scrollContent.outerWidth() + stickyOffset.left\n : stickyOffset.left,\n stopperOffset = ($(stickyOptions.stopper).length)\n ? $(stickyOptions.stopper).offset()\n : {\n top: parentContainerOffset.top + parentContainer.height(),\n left: parentContainerOffset.left\n },\n windowScrollTop = $(window).scrollTop();\n\n if ($(window).width() < stickyOptions.disableBreakpoint) {\n this.enableMobileLayout();\n\n return;\n }\n\n if (parentContainer.height() <= stickyElement.height()) {\n this.stickyDisable(stickyElement);\n\n return;\n }\n\n if (stopperOffset.top - stickyElement[0].scrollHeight < windowScrollTop) {\n if (stickyElement.css('position') != 'absolute') {\n stickyElement.css({\n position: 'absolute',\n top: 'initial',\n right: stickyIsRight ? 0 : 'initial',\n bottom: parentContainer.height() - (stopperOffset.top - parentContainerOffset.top),\n left: stickyIsRight ? 'initial' : 0\n });\n stickyElement.removeClass(stickyOptions.stickyClass);\n }\n } else if (parentContainerOffset.top < windowScrollTop + stickyOffset.top) {\n if (stickyElement.css('position') != 'fixed') {\n stickyElement.css({\n position: 'fixed',\n top: stickyOffset.top,\n right: 'initial',\n bottom: 'initial',\n left: stickyIsRight ? stickyOffsetLeft : (parentContainerOffset.left + stickyOffset.left)\n });\n stickyElement.addClass(this.options.stickyClass);\n }\n } else {\n this.stickyDisable(stickyElement);\n }\n },\n\n stickyPosition: function (position) {\n var stickyElement = $(this.options.element),\n stickyFloat = (position == 'right') ? 'right' : 'left',\n scrollContent = $(this.options.scrollContentContainer),\n scrollContentFloat = (stickyFloat == 'right') ? 'left' : 'right';\n\n stickyElement.css('float', stickyFloat);\n scrollContent.css('float', scrollContentFloat);\n },\n\n stickyDisable: function (stickyElement) {\n if (stickyElement.css('position') != 'static') {\n stickyElement.css({\n position: 'static',\n top: 'initial',\n right: 'initial',\n bottom: 'initial',\n left: 'initial'\n });\n stickyElement.removeClass(this.options.stickyClass);\n }\n },\n\n enableMobileLayout: function () {\n var stickyElement = $(this.options.element),\n scrollContent = $(this.options.scrollContentContainer);\n\n this.stickyDisable(stickyElement);\n stickyElement.css('float', 'none');
2\n if (scrollContent.length) scrollContent.css('float', 'none');\n }\n });\n\n return $.amasty.stickyWidget;\n});\n","Amasty_CheckoutCore/js/view/summary/abstract-total.js":"define([], function () {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n isFullMode: function () {\n return this.getTotals();\n }\n });\n }\n});","Amasty_CheckoutCore/js/view/payment/list.js":"// Checkout payment methods view mixin\ndefine([\n 'Magento_Checkout/js/model/payment-service',\n 'Amasty_CheckoutCore/js/view/utils'\n], function (paymentService, viewUtils) {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n /**\n * add loader block for payment\n */\n isLoading: paymentService.isLoading,\n\n getGroupTitle: function (newValue) {\n var paymentMethodLayoutConfig = viewUtils.getBlockLayoutConfig('payment_method');\n\n if (newValue().index === 'methodGroup'\n && paymentMethodLayoutConfig !== null\n ) {\n return paymentMethodLayoutConfig.title;\n }\n\n return this._super(newValue);\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/view/payment/method-renderer/default-mixin.js":"/**\n * By default Magento flow, when payment method selected billing address is updates.\n * And when billing address updates, isPlaceOrderActionAllowed also update.\n * But One Step Checkout optimize billing address KO update. @see onepage.replaceEqualityComparer\n * So we need update isPlaceOrderActionAllowed on payment method change, to emulate default flow.\n * Also we added placeOrderState for Place Order button. Thus, we can flexibly manage its state.\n */\ndefine([\n 'jquery',\n 'ko',\n 'underscore',\n 'Magento_Checkout/js/model/quote',\n 'Amasty_CheckoutCore/js/model/payment/place-order-state',\n 'Amasty_CheckoutCore/js/model/payment/payment-loading'\n], function ($, ko, _, quote, placeOrderState, paymentLoader) {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n initObservable: function () {\n this._super();\n\n this.isPlaceOrderActionAllowed = ko.pureComputed({\n read: this.isPlaceOrderActionAllowedRead,\n write: this.isPlaceOrderActionAllowedWrite,\n owner: this\n });\n\n return this;\n },\n\n /**\n * Read function for KO computed isPlaceOrderActionAllowed.\n *\n * Don't call this function directly.\n * Use isPlaceOrderActionAllowed().\n *\n * @returns {boolean}\n */\n isPlaceOrderActionAllowedRead: function () {\n return quote.billingAddress() !== null && placeOrderState() && !paymentLoader();\n },\n\n /**\n * Write function for KO computed isPlaceOrderActionAllowed.\n *\n * Don't call this function directly.\n * Use isPlaceOrderActionAllowed(value).\n *\n * @param {boolean} value\n * @returns {boolean}\n */\n isPlaceOrderActionAllowedWrite: function (value) {\n return placeOrderState(!!value);\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/view/payment/method-renderer/braintree/cc-form-mixin.js":"// upgrade Braintree flow for One Step Checkout\ndefine([\n], function () {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n /**\n * Brantree harcoded disallow order place on initialization.\n * By default Magento flow, payment method cannot be preselected.\n * Dnd when payment method selected billing address is updates.\n * And when billing address updates, isPlaceOrderActionAllowed al
2so update.\n * But One Step Checkout optimize billing address KO update.\n */\n initFormValidationEvents: function () {\n this._super();\n this.updateIsPlaceOrderActionAllowed();\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/view/payment/method-renderer/braintree/paypal-mixin.js":"define([\n 'underscore',\n 'Magento_Checkout/js/model/quote',\n 'Amasty_CheckoutCore/js/model/events'\n], function (_, quote, events) {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n /**\n * fix braintree paypal behavior for one step checkout\n */\n initObservable: function () {\n var self = this;\n\n this._super();\n\n events.onAfterShippingSave(_.debounce(function () {\n var method = quote.paymentMethod();\n\n if (method && method.method === self.code) {\n self.reInitPayPal();\n }\n }, 50));\n\n return this;\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/view/payment/method-renderer/in-context/checkout-express-mixin.js":"define([\n 'ko',\n 'underscore',\n 'uiRegistry',\n 'rjsResolver',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/payment/method-list'\n], function (ko, _, registry, onJsLoad, quote, paymentMethods) {\n 'use strict';\n\n return function (Component) {\n return Component.extend({\n validationTimeout: 0,\n\n /**\n * fix paypal behavior for one step checkout\n * reactivate button on shipping save\n */\n initListeners: function () {\n this._super();\n onJsLoad(function () {\n var fields = registry.filter(function (module) {\n return ko.isObservable(module.required)\n && module.required.peek() === true\n && ko.isObservable(module.value)\n && ko.isObservable(module.visible)\n && ko.isObservable(module.disabled);\n });\n\n paymentMethods.subscribe(this.amDeferredValidation, this);\n _.each(fields, function (element) {\n element.value.subscribe(function (value) {\n if ((value || value === 0 || value === false)\n && element.required()\n && element.visible()\n && !element.disabled()\n ) {\n this.amDeferredValidation();\n }\n }.bind(this));\n }.bind(this));\n\n }.bind(this));\n },\n\n validate: function () {\n this._super();\n clearTimeout(this.validationTimeout);\n },\n\n amDeferredValidation: function () {\n clearTimeout(this.validationTimeout);\n\n if (quote.paymentMethod() && quote.paymentMethod().method === this.item.method) {\n this.validationTimeout = setTimeout(function () {\n window.shippingErrorHideIsNotAllowed = true;\n this.validate();\n delete window.shippingErrorHideIsNotAllowed;\n }.bind(this), 200);\n }\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/view/shipping-address/list-mixin.js":"/**\n * Change shipping address list view.\n */\ndefine([\n 'ko',\n 'underscore',\n 'Amasty_CheckoutCore/js/model/address-form-state',\n 'Amasty_CheckoutCore/js/model/shipping-registry',\n 'Magento_Customer/js/model/address-list',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/shipping-address/form-popup-state',\n 'Magento_Checkout/js/action/select-shipping-address',\n 'Magento_Checkout/js/checkout-data',\n 'mage/translate',\n 'jquery'\n], function (\n ko,\n _,\n addressFormState,\n shippingRegistry,\n addressList,\n quote,\n formPopUpState,\n selectShippingAddress,\n checkoutData,\n $t\n) {\n 'use strict';\n\n var newAddressOption = {\n /**\n * Get new address label\n * @returns {String}\n */\n getAddressInline: function () {\n return $t('New Address');\n },\n customerAddressId: null\n };\n\n function isAddressNew(address) {\n return address && (address === newAddressOption || address.getType() === 'new-customer-address');\n }\n\n return function (Component) {\n return Component.extend({\n defaults: {\n dropdownTemplate: 'Amasty_CheckoutCore/shipping-address/shipping-address',\n modules: {\n shippingInformationComponent: 'index = ship-to',\n shippingAddressComponent: '${ $.parentName }'\n }\n },\n\n initialize: function () {\n _.bindAll(\n this,\n 'addressOptionsText',\n 'changeAddress',\n 'onAddressChange',\n 'updateAddress',\n 'cancelAddressEdit'\n );\n\n this._super();\n\n if (this.getVisible()) {\n window.isShippingAddressFormOverridden(true);\n this.shippingAddressComponent(this.overrideNewShippingAddress);\n shippingRegistry.excludedCollectionNames.push('shipping-address-fieldset');\n }\n\n return this;\n }
2,\n\n initObservable: function () {\n this._super()\n .observe({\n /**\n * Current dropdown value\n */\n selectedAddress: quote.shippingAddress(),\n\n /**\n * On true shows current shipping address information as plain text\n */\n isAddressDetailsVisible: quote.shippingAddress() != null,\n\n /**\n * On true shows new address form if isAddressListVisible is also true\n */\n isAddressFormVisible: false,\n\n /**\n * On true shows dropdown and new address form\n */\n isAddressListVisible: !quote.shippingAddress(),\n });\n\n this.initSubscribers();\n\n return this;\n },\n\n /**\n * Set subscribers to observables\n */\n initSubscribers: function () {\n if (this.getVisible()) {\n quote.shippingAddress.subscribe(this.onShippingAddressUpdate, this);\n this.selectedAddress.subscribe(this.onAddressChange, this);\n this.isAddressFormVisible.subscribe(this.updatePopupState, this);\n this.isAddressListVisible.subscribe(this.isShippingFormVisibleUpdate, this);\n }\n },\n\n /**\n * Modify new shipping address for registered customer functionality.\n * Old behavior - popup; new - inline form\n *\n * @param {object} shippingComponent\n */\n overrideNewShippingAddress: function (shippingComponent) {\n //override popup functionality\n shippingComponent.getPopUp = shippingComponent.getPopUpOverride;\n },\n\n /**\n * Override for better compatibility.\n * Magento_NegotiableQuote compatibility.\n *\n * @return {string}\n */\n getTemplate: function () {\n this._super();\n\n return this.dropdownTemplate;\n },\n\n /**\n * Override to prevent not used functionality render (performance save)\n */\n initChildren: function () {\n return this;\n },\n\n /**\n * Override to prevent not used functionality render (performance save).\n * This list uses ship-to component instead origin\n */\n createRendererComponent: function () {},\n\n /**\n * Visible by default is usual variable,\n * but it can be changed to observable or computed by vendors (amazon)\n *\n * @return {boolean}\n */\n getVisible: function () {\n return ko.utils.unwrapObservable(this.visible);\n },\n\n /**\n * Subscriber\n * updates new shipping address core state\n * required to suppress address update before save\n */\n updatePopupState: function () {\n if (this.getVisible()) {\n formPopUpState.isVisible(this.isAddressListVisible() && this.isAddressFormVisible());\n }\n },\n\n /**\n * Shipping address subscriber\n * Close form on shipping address change\n *\n * @param {object} newAddress\n */\n onShippingAddressUpdate: function (newAddress) {\n if (newAddress != null) {\n this.isAddressDetailsVisible(true);\n this.isAddressListVisible(false);\n }\n },\n\n /**\n * New Address form visibility subscriber\n */\n isShippingFormVisibleUpdate: function () {\n this.updatePopupState();\n\n if (this.getVisible()) {\n addressFormState.isShippingFormVisible(\n this.isAddressListVisible()\n );\n }\n },\n\n /*\n * html Select binding methods\n */\n\n /**\n * Options array\n */\n addressOptions: ko.pureComputed(function () {\n var addressOptions = _.clone(addressList()),\n newAddressAdded;\n\n _.find(addressOptions, function (address) {\n if (isAddressNew(address)) {\n newAddressAdded = true;\n\n return true;//break\n }\n });\n\n if (!newAddressAdded) {\n addressOptions.push(newAddressOption);\n }\n\n return addressOptions;\n }),\n\n /**\n * For html option text binding\n *\n * @param {Object} address\n * @return {string}\n */\n addressOptionsText: function (address) {\n if (address.getAddressInline) {\n return address.getAddressInline();\n }\n\n if (isAddressNew(address)) {\n return $t('New Address');\n }\n\n return this.getCaptionByAddressType(address);\n },\n\n /**\n * @param {Object} address\n * @returns {*}\n */\n getCaptionByAddressType: function (address) {\n switch (address.getType()) {\n case 'gift-registry':\n return $t('Recipient Address');\n default:\n return address.getKey();\n }\n },\n\n /**\n * Update address action\n */\n updateAddress: function () {\n var canCloseForm = false;\n\n if (this.selectedAddress() != null) {\n if (this.isAddressFormVisible()) {\n this.shippingAddressComponent().saveNewAddress();\n } else {\n selectShippingAddress(this.selectedAddress());\n checkoutData.setSelectedShippingAddress(this.selectedAddress().getKey());\n canCloseForm = true;\n }\n }\n\n if (this.shippingAddressComponent().source.get('params.invalid') !== true || canCloseForm === true) {\n this.cancelAddressEdit();\n }\n },\n\n /**\n * Update dropdown selected value. Should same as current shipping address.\n */\n updateDropdownAddress: function () {\n var shippingAddress = quote.shippingAddress(),\n list = addressList(),\n addressIndex,\n selectedAddress;\n\n selectedAddress = _.find(list, function (address) {\n return address === shippingAddress;\n });\n\n if (!selectedAddress && isAddressNew(shippingAddress)) {\n //Resolve when shipping address and selectedAddress different objects with same value.\n addressIndex = _.findIndex(list, function (address) {\n return isAddressNew(address);\n });\n\n if (addressIndex !== -1) {\n list[addressIndex] = shippingAddress;\n addressList(list);\n }\n }\n\n this.selectedAddress(shippingAddress);\n },\n\n /**\n * Show address dropdown\n */\n changeAddress: function () {\n this.updateDropdownAddress();\n this.isAddressListVisible(true);
2\n this.isAddressDetailsVisible(false);\n },\n\n /**\n * Cancel address edit action.\n */\n cancelAddressEdit: function () {\n this.updateDropdownAddress();\n this.isAddressDetailsVisible(true);\n this.isAddressListVisible(false);\n },\n\n /**\n * On dropdown value change\n *\n * @param {Object} address\n */\n onAddressChange: function (address) {\n this.isAddressFormVisible(isAddressNew(address));\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/view/shipping-address/address-renderer/default-mixin.js":"define([\n 'underscore',\n 'uiRegistry'\n], function (_) {\n 'use strict';\n\n return function (targetModule) {\n return targetModule.extend({\n getCustomAttributeLabel: function (attribute) {\n if (_.isObject(attribute)\n && _.isString(attribute.attribute_code)\n && attribute.attribute_code.indexOf('custom_field_') !== -1\n ) {\n return this._super(attribute.value);\n }\n\n return this._super();\n }\n });\n };\n});\n","Amasty_CheckoutCore/js/options/configurable.js":"/*jshint browser:true jquery:true*/\ndefine([\n 'jquery',\n 'Magento_ConfigurableProduct/js/configurable',\n 'Magento_Ui/js/modal/modal'\n], function ($) {\n 'use strict';\n\n $.widget('mage.amcheckoutConfigurable', $.mage.configurable, {\n options: {\n selectorProduct: '.product'\n },\n\n /**\n * Initialize tax configuration, initial settings, and options values.\n * https://github.com/magento/magento2/issues/14211\n * @private\n */\n _initializeOptions: function () {\n const element = $(this.options.selectorProductPrice ?? this.options.priceHolderSelector);\n\n if (!element.data('magePriceBox')) {\n element.priceBox();\n }\n\n return this._super();\n },\n\n /**\n * Initialize tax configuration, initial settings, and options values.\n * https://github.com/magento/magento2/issues/14211\n * @private\n */\n _calculatePrice: function (config) {\n var element = $(this.options.priceHolderSelector);\n\n if (!element.data('magePriceBox')) {\n element.priceBox();\n }\n\n return this._super(config);\n },\n\n configureElement: function (element) {\n return this._configureElement(element);\n },\n\n _getAttributeId: function (element) {\n return +$(element).data('attribute-id');\n },\n\n _fillState: function () {\n $.each(this.options.settings, $.proxy(function (index, element) {\n var attributeId = this._getAttributeId(element);\n\n if (attributeId && this.options.spConfig.attributes[attributeId]) {\n element.config = this.options.spConfig.attributes[attributeId];\n element.attributeId = attributeId;\n this.options.state[attributeId] = false;\n }\n }, this));\n },\n\n _fillSelect: function (element) {\n var attributeId = this._getAttributeId(element),\n options = this._getAttributeOptions(attributeId),\n prevConfig,\n index = 1,\n allowedProducts,\n i,\n j;\n\n this._clearSelect(element);\n element.options[0] = new Option('', '');\n element.options[0].innerHTML = this.options.spConfig.chooseText;\n prevConfig = false;\n\n if (element.prevSetting) {\n prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];\n }\n\n if (options) {\n for (i = 0; i < options.length;
2 i++) {\n allowedProducts = [];\n\n if (prevConfig) {\n for (j = 0; j < options[i].products.length; j++) {\n // prevConfig.config can be undefined\n if (prevConfig.config &&\n prevConfig.config.allowedProducts &&\n prevConfig.config.allowedProducts.indexOf(options[i].products[j]) > -1) {\n allowedProducts.push(options[i].products[j]);\n }\n }\n } else {\n allowedProducts = options[i].products.slice(0);\n }\n\n if (allowedProducts.length > 0) {\n options[i].allowedProducts = allowedProducts;\n element.options[index] = new Option(this._getOptionLabel(options[i]), options[i].id);\n\n if (typeof options[i].price !== 'undefined') {\n element.options[index].setAttribute('price', options[i].prices);\n }\n\n element.options[index].config = options[i];\n index++;\n }\n }\n }\n }\n });\n\n return $.mage.amcheckoutConfigurable;\n});\n","Amasty_CheckoutCore/js/model/quote-mixin.js":"/**\n * Main observables equality comparer replacement\n */\n\ndefine([\n 'Amasty_CheckoutCore/js/action/is-equal-ignore-functions'\n], function (isEqualIgnoreFunctions) {\n 'use strict';\n\n return function (quote) {\n quote.shippingAddress.equalityComparer = isEqualIgnoreFunctions;\n quote.billingAddress.equalityComparer = isEqualIgnoreFunctions;\n quote.shippingMethod.equalityComparer = isEqualIgnoreFunctions;\n quote.paymentMethod.equalityComparer = isEqualIgnoreFunctions;\n\n return quote;\n };\n});\n","Amasty_CheckoutCore/js/model/events.js":"define([\n 'underscore',\n 'uiEvents'\n], function (_, uiEvents) {\n 'use strict';\n\n // events to use\n const eventBeforeShippingSave = 'before_shipping_save',\n eventAfterShippingSave = 'after_shipping_save';\n\n /**\n * object undependable event manager\n */\n return _.extend(uiEvents, {\n onBeforeShippingSave: function (callback) {\n this.on(eventBeforeShippingSave, callback);\n },\n onAfterShippingSave: function (callback) {\n this.on(eventAfterShippingSave, callback);\n }\n });\n});\n","Amasty_CheckoutCore/js/model/statistic.js":"define([\n 'jquery',\n 'mage/storage',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/url-builder',\n 'Magento_Customer/js/model/customer'\n], function ($, storage, quote, urlBuilder, customer) {\n 'use strict';\n\n return {\n canSave: true,\n paymentMethod: null,\n quoteId: quote.getQuoteId(),\n isLoggedIn:customer.isLoggedIn(),\n saveUrl: '',\n\n initialize: function () {\n quote.paymentMethod.subscribe(function (method) {\n this.paymentMethod = null;\n if (method) {\n this.paymentMethod = method.method;\n }\n }, this);\n\n if (this.isLoggedIn) {\n this.saveUrl = urlBuilder.createUrl('/checkout/saveInsertedInfo', {});\n } else {\n this.saveUrl = urlBuilder.createUrl('/checkout/:cartId/saveInsertedInfo', {cartId: this.quoteId});\n }\n\n $(window).on('beforeunload', this.saveStatistic.bind(this));\n\n return this;\n },\n\n saveStatistic: function () {\n var cashStorage = JSON.parse(window.localStorage.getItem('mage-cache-storage')),\n checkoutData,\n shippingAddress = quote.shippingAddress(),\n request = {quote_id: this.quoteId},\n isQuoteActive;\n\n if (window.checkoutConfig.isNegotiableQuote\n || !this.canSave\n || !cashStorage\n || !cashStorage.hasOwnProperty('checkout-data')\n || !this.quoteId\n ) {\n return;\n }\n\n checkoutData = cashStorage['checkout-data'];\n isQuoteActive = Object.keys(checkoutData).some(function (value) {\n return checkoutData[value] != null;\n });\n\n if (!isQuoteActive) {\n return;\n }\n\n if (shippingAddress && shippingAddress.getType() === 'new-customer-address') {\n request.shippingAddressFromData = {\n 'street': shippingAddress.street,\n 'city': shippingAddress.city,\n 'region_id': shippingAddress.regionId,\n 'region': shippingAddress.region,\n 'country_id': shippingAddress.countryId,\n 'postcode': shippingAddress.postcode,\n 'email': shippingAddress.email,\n 'customer_id': shippingAddress.customerId,\n 'firstname': shippingAddress.firstname,\n 'lastname': shippingAddress.lastname,\n 'middlename': shippingAddress.middlename,\n 'prefix': shippingAddress.prefix,\n 'suffix': shippingAddress.suffix,\n 'vat_id': shippingAddress.vatId,\n 'company': shippingAddress.company,\n 'telephone': shippingAddress.telep
2hone,\n 'fax': shippingAddress.fax,\n 'custom_attributes': shippingAddress.customAttributes,\n 'save_in_address_book': shippingAddress.saveInAddressBook\n };\n }\n\n if (checkoutData.newCustomerBillingAddress) {\n request.newCustomerBillingAddress = checkoutData.newCustomerBillingAddress;\n }\n\n if (checkoutData.selectedPaymentMethod) {\n if (checkoutData.selectedPaymentMethod.includes('braintree_cc_vault_')) {\n checkoutData.selectedPaymentMethod = 'braintree_cc_vault';\n }\n request.selectedPaymentMethod = checkoutData.selectedPaymentMethod;\n }\n\n if (checkoutData.selectedShippingRate) {\n request.selectedShippingRate = checkoutData.selectedShippingRate;\n }\n\n if (checkoutData.validatedEmailValue) {\n request.validatedEmailValue = checkoutData.validatedEmailValue;\n }\n\n if (!request.selectedPaymentMethod && this.paymentMethod) {\n request.selectedPaymentMethod = this.paymentMethod;\n }\n\n storage.post(\n this.saveUrl,\n JSON.stringify(request),\n false\n );\n }\n };\n});\n","Amasty_CheckoutCore/js/model/shipping-registry.js":"define([\n 'ko',\n 'underscore',\n 'jquery',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/shipping-rates-validation-rules',\n 'Magento_Checkout/js/model/shipping-address/form-popup-state',\n 'Magento_Checkout/js/model/address-converter',\n 'Magento_Customer/js/model/address-list',\n 'Amasty_CheckoutCore/js/model/address-form-state',\n 'Amasty_CheckoutCore/js/action/get-address-cache-key',\n 'Amasty_CheckoutCore/js/model/payment/payment-loading',\n 'Magento_Ui/js/lib/validation/validator'\n], function (\n ko,\n _,\n $,\n quote,\n validationRules,\n formPopUpState,\n addressConverter,\n addressList,\n addressFormState,\n getAddressCacheKey,\n paymentLoader,\n validator\n) {\n 'use strict';\n\n return {\n savedAddress: '',\n shippingMethod: '',\n shippingCarrier: '',\n\n /**\n * list of shipping address\n * it also can contains third party extension fields\n */\n addressComponents: [],\n\n /**\n * filtered addressComponents\n * modules that are not used in shipping estimation (not in observable)\n */\n observedComponents: [],\n\n /**\n * Saved values of observable address.\n * Update on shipping address save\n */\n additionalAddressValues: {},\n\n /**\n * @api\n * Excluded components by name (index)\n * Additional excludes should be added before initObservers executed\n */\n excludedFieldsNames: [],\n\n /**\n * @api\n * Excluded collection components by name (index)\n * Additional excludes should be added before initObservers executed\n */\n excludedCollectionNames: ['billing-address-form', 'customer-email'],\n isEstimationHaveError: ko.observable(false),\n isAddressChanged: ko.observable(false).extend({ notify: 'always', rateLimit: 20 }),\n validationTimeout: 0,\n checkDelay: 1000,\n\n /**\n * @property jQuery.Deferred\n */\n initializedPromise: $.Deferred(),\n\n /**\n * Register additional shipping fields observers\n * @param {Function} elems - observable array of shipping elements\n * @returns {void}\n */\n initObservers: function (elems) {\n if (_.isEmpty(this.addressComponents)) {\n this.excludedFieldsNames = _.union(this.excludedFieldsNames, validationRules.getObservableFields());\n this.filterElements(elems());\n\n _.each(this.addressComponents, function (element) {\n if (this.excludedFieldsNames.indexOf(element.index) === -1) {\n this.observedComponents.push(element);\n this.additionalAddressValues[element.index] = this.getInitialValue(element.index);\n }\n\n element.on('value', this.triggerValidation.bind(this, element));\n }, this);\n\n this.initializedPromise.resolve();\n }\n },\n\n /**\n * Set saved values on page load (saved on server)\n * @returns {void}\n */\n setInitialValues: function () {\n var savedAddress = window.checkoutConfig.shippingAddressFromData,\n savedMethod = window.checkoutConfig.selectedShippingMethod,\n subscriber;\n\n if (savedAddress) {\n this.savedAddress = addressConverter.formAddressDataToQuoteAddress(savedAddress);\n } else if (window.checkoutConfig.selectedShippingAddressId) {\n if (addressList.getLength()) {\n this._setCustomerAddress(addressList());\n this.isAddressChanged(true);\n } else {\n subscriber = addressList.subscribe(function (addreses) {\n this._setCustomerAddress(addreses);\n subscriber.dispose();\n }, this);\n }\n }\n\n if (savedMethod) {\n if (_.isObject(savedMethod)) {\n this.shippingMethod = savedMethod.method_code;\n this.shippingCarrier = savedMethod.carrier_code;\n } else if (_.isString(savedMethod)) {\n savedMethod = savedMethod.split('_');\n this.shippingMethod = savedMethod[0];\n this.shippingCarrier = savedMethod[1];\n }\n }\n },\n\n /**\n * Set shipping rates and saved address by customer address\n * @param {Array} addresses\n * @private\n * @returns {void}\n */\n _setCustomerAddress: function (addresses) {\n var selectedAddress;\n\n selectedAddress = _.find(addresses, function (address) {\n return address.customerAddressId * 1 === window.checkoutConfig.selectedShippingAddressId * 1;\n });\n\n if (selectedAddress) {\n this.savedAddress = selectedAddress;\n }\n },\n\n /**\n * Get initial value for additional shipping fields.\n * @param {String} index\n * @return {null|*}\n */\n getInitialValue: function (index) {\n var savedAddress = window.checkoutConfig.shippingAddressFromData;\n\n if (savedAddress) {\n if (savedAddress.custom_attributes\n && savedAddress.custom_attributes[index]\n ) {\n return savedAddress.custom_attributes[index];\n }\n\n if (savedAddress[index]) {\n return savedAddress[index];\n }\n }\n\n return null;\n },\n\n /**\n * Extract all fields wich can be observable from fields\n * @param {Array} elems\n * @returns {void}\n */\n filterElements: function (elems) {\n if (!elems || !elems.length) {\n return;\n }\n\n _.each(elems, function (element) {\n if (this._isCollection(element)) {\n try {\n if (this._isCollectionValid(element)) {\n this.filterElements(element.elems());\n }\n } catch (e) {\n // continue\n }\n\n return;// continue\n }\n\n if (this._isModuleValid(element)) {\n this.addressComponents.push(element);\n }\n }.bind(this));\n },\n\n /**\n * Is component are collection\n *\n * @param {Object} element\n * @returns {Boolean}\n * @private\n */\n _isCollection: function (element) {\n return typeof element.initChildCount === 'number';\n },\n\n /**\n * Is component collection is valid\n *\n * @param {Object} element\n * @returns {Boolean}\n * @private\n */\n _isCollectionValid: function (element) {\n return this.excludedCollectionNames.indexOf(element.index) === -1;\n },\n\n /**\n * Is component can be observable\n *\n * @param {Object} module\n * @returns {Boolean}\n * @private\n */\n _isModuleValid: function (module) {\n return ko.isObservable(module.error)\n && ko.isObservable(module.value);\n },\n\n /**\n * Debounce validation\n * @returns {void}\n */\n triggerValidation: function () {\n clearTimeout(this.validationTimeout);\n\n if (!formPopUpState.isVisible() && !addressFormState.isShippingFormVisible()) {\n paymentLoader(true);\n\n this.validationTimeout = setTimeout(this.validation.bind(this), this.checkDelay);\n }\n },\n\n validation: function () {\n var isError = false,\n valueChanged = false,\n result;\n\n _.find(this.observedComponents, function (element) {\n if (element.visible && !element.visible() || element.disabled && element.disabled()) {\n return false;// continue\n }\n\n if (element.error()) {\n isError = true;\n\n return true;// break\n }\n\n if (_.isObject(element.validation)) {\n result = validator(element.validation, element.value(), element.validationParams);\n\n if (!result.passed) {\n isError = true;\n\n return true;// break\n }\n }\n\n if (this.additionalAddressValues[element.index] !== element.value()) {\n valueChanged = true;\n }\n\n return false;\n }, this);\n\n this.isEstimationHaveError(isError);\n\n if (!isError) {\n this.isAddressChanged(valueChanged);\n } else {\n paymentLoader(false);\n }\n },\n\n /**\n * Store saved values for tracking changes\n * @returns {void}\n */\n registerAdditionAddressValues: function () {\n clearTimeout(this.validationTimeout);\n _.each(this.observedComponents, function (element) {\n this.additionalAddressValues[element.index] = element.value();\n }.bind(this));\n },\n\n /**\n * Set saved data\n * @param {object} address\n * @returns {void}\n */\n register: function (address) {\n if (!address) {\n address = quote.shippingAddress();\n }\n\n this.savedAddress = address;\n this.shippingMethod = quote.shippingMethod().method_code;\n this.shippingCarrier = quote.shippingMethod().carrier_code;\n this.isAddressChanged(false);\n this.registerAdditionAddressValues();\n },\n\n /**\n * Compare current Shipping Data with saved and determines is need to save it\n *\n * @returns {boolean}\n */\n isHaveUnsavedShipping: function () {\n var methodData = quote.shippingMethod();
2\n\n if (!methodData) {\n return false;\n }\n\n if (!this.savedAddress) {\n return true;\n }\n\n return this.isAddressChanged()\n || !this._compareObjectsData(quote.shippingAddress(), this.savedAddress)\n || this.shippingMethod !== methodData.method_code\n || this.shippingCarrier !== methodData.carrier_code;\n },\n\n /**\n * Is address objects are equal\n *\n * @param {*} quoteAddress\n * @param {*} savedAddress\n * @returns {boolean}\n * @private\n * @since 2.0.0\n * @since 3.0.0 - empty values removed from comparable objects, customer address compare optimization\n */\n _compareObjectsData: function (quoteAddress, savedAddress) {\n if (quoteAddress.getType && quoteAddress.getType() === 'customer-address') {\n // customer address is not editable, compare only ids.\n return quoteAddress.customerAddressId === savedAddress.customerAddressId;\n }\n\n // objects for isEqual should not contain functions. Same for objects of their objects.\n return _.isEqual(this._prepareAddressToCompare(quoteAddress), this._prepareAddressToCompare(savedAddress));\n },\n\n _prepareAddressToCompare: function (address) {\n let filteredAddress = _.pick(address, this._cleanupAddressFunction);\n\n if (filteredAddress.regionId) {\n filteredAddress.regionId *= 1;\n }\n\n if (filteredAddress.postcode === '-') {\n delete filteredAddress.postcode;\n }\n\n if (filteredAddress.street) {\n filteredAddress.street = _.compact(filteredAddress.street); // remove empty strings elements\n }\n\n return filteredAddress;\n },\n\n /**\n * Iterate function.\n * Remove functions and empty values.\n * Leave only acceptable array cells for comparing.\n *\n * @param {*} value\n * @param {string} key\n * @return {boolean}\n * @private\n */\n _cleanupAddressFunction: function (value, key) {\n return !_.isFunction(value)\n && key !== 'save_in_address_book'\n && value\n && (!_.isEmpty(value) || _.isNumber(value))// isEmpty - returns true for any number type (int/float)\n && (!_.isArray(value) || _.compact(value).length > 0);// delete arrays with empty strings (like street)\n }\n };\n});\n","Amasty_CheckoutCore/js/model/shipping-rate-registry-mixin.js":"define(['mage/utils/wrapper'], function (wrapper) {\n 'use strict';\n\n /**\n * Add clear registry cache functionality.\n */\n return function (target) {\n return wrapper.extend(target, {\n usedKeys: [],\n set: function (origin, addressKey) {\n if (addressKey && this.usedKeys.indexOf(addressKey) === -1) {\n this.usedKeys.push(addressKey);\n }\n\n return origin();\n },\n clearStorage: function () {\n this.usedKeys.forEach(function (key) {\n this.set(key, null);\n }, this);\n\n this.usedKeys = [];\n }\n });\n };\n});\n\n","Amasty_CheckoutCore/js/model/agreements-assigner-mixin.js":"define([\n 'mage/utils/wrapper',\n 'jquery'\n], function (wrapper, $) {\n 'use strict';\n\n return function (agreementsAssignerAction) {\n return wrapper.wrap(agreementsAssignerAction, function (originalAction, paymentData) {\n originalAction(paymentData);\n\n var amcheckoutFormData = $('.additional-options input, .additional-options textarea').serializeArray(),\n data = {},\n agreements = [],\n re = /^agreement\\[\\d+?\\]$/;\n amcheckoutFormData.forEach(function(item){\n data[item.name] = item.value;
2\n if (re.test(item.name)) {\n agreements.push(item.value);\n }\n });\n\n if (agreements.length) {\n if (paymentData['extension_attributes'] === undefined) {\n paymentData['extension_attributes'] = {};\n }\n\n paymentData['extension_attributes']['agreement_ids'] = agreements;\n }\n\n return paymentData;\n });\n };\n});","Amasty_CheckoutCore/js/model/full-screen-loader-mixin.js":"define(\n [\n 'mage/utils/wrapper',\n 'Amasty_CheckoutCore/js/model/payment/payment-loading'\n ],\n function (wrapper, paymentLoader) {\n 'use strict';\n\n return function (target) {\n /**\n * Override for avoid full screen on shipping dynamic save\n */\n target.startLoader = wrapper.wrapSuper(target.startLoader, function () {\n if (window.loaderIsNotAllowed) {\n paymentLoader(true);\n } else {\n this._super();\n }\n });\n\n return target;\n };\n }\n);\n\n","Amasty_CheckoutCore/js/model/consents-assigner-mixin.js":"/**\n * Mixin for Gdpr assigner to collect checkbox values by position\n */\ndefine([\n 'underscore',\n 'mage/utils/wrapper',\n './gdpr/consent-processor'\n], function (_, wrapper, processor) {\n 'use strict';\n\n return function (agreementsAssignerAction) {\n return wrapper.wrap(agreementsAssignerAction, function (originalAction, paymentData) {\n var consents = window.checkoutConfig.amastyOscGdprConsent || [];\n\n if (_.isEmpty(consents)) {\n originalAction(paymentData);\n\n return;\n }\n\n if (!paymentData['additional_data']) {\n paymentData['additional_data'] = {};\n }\n\n paymentData['additional_data']['amgdpr_agreement'] = JSON.stringify(processor.getConsentsData());\n\n return paymentData;\n });\n };\n});\n","Amasty_CheckoutCore/js/model/default-shipping-rate-processor-mixin.js":"define(\n [\n 'mage/utils/wrapper',\n 'Magento_Checkout/js/model/shipping-rate-registry',\n 'Magento_Checkout/js/model/shipping-service',\n 'Amasty_CheckoutCore/js/action/get-address-cache-key'\n ],\n function (wrapper, rateRegistry, shippingService, getAddressCacheKey) {\n 'use strict';\n\n /**\n * Modify shippingRegistry guest cache.\n * Reduce quantity of requests to server.\n * @since 3.0.0\n * @since 3.0.5 fixed\n */\n return function (target) {\n target.getRates = wrapper.wrapSuper(target.getRates, function (address) {\n var cacheKey, cache;\n\n if (address.getType() !== 'new-address' && address.getType() !== 'new-customer-address') {\n return this._super();\n }\n\n cacheKey = getAddressCacheKey(address);\n cache = rateRegistry.get(cacheKey);\n if (cache) {\n rateRegistry.set(address.getCacheKey(), cache);\n } else if (!rateRegistry.get(address.getCacheKey())) {\n shippingService.getShippingRates().subscribe(function (rates) {\n rateRegistry.set(cacheKey, rates);\n this.dispose();\n });\n }\n\n return this._super();\n });\n\n return target;\n };\n }\n);\n\n","Amasty_CheckoutCore/js/model/step-navigator-mixin.js":"define(\n [\n 'knockout',\n 'mage/utils/wrapper'\n ],\n function (ko, wrapper) {\n 'use strict';\n\n return function (target) {\n /**\n * Override isVisible to isActive function;\n * because in onestepcheckout all steps should be visible\n */\n target.registerStep = wrapper.wrapSuper(target.registerStep, function (code, alias, title, isVisible, navigate, sortOrder) {\n var isActive = ko.observable(isVisible());\n this._super(code, alias, title, isActive, navigate, sortOrder);\n });\n\n /**\n * Override for avoid hash in url because in our
2checkout all doing in one step\n */\n target.setHash = wrapper.wrapSuper(target.setHash, function (hash) {\n hash = '';\n this._super(hash);\n });\n\n return target;\n };\n }\n);\n\n","Amasty_CheckoutCore/js/model/quote-ext-override.js":"/**\n * Override store pickup quote mixin to set equalityComparer for shipping address before it override with computed\n */\ndefine([\n 'ko',\n 'Magento_InventoryInStorePickupFrontend/js/model/pickup-address-converter',\n './quote-mixin'\n], function (ko, pickupAddressConverter, quoteMixin) {\n 'use strict';\n\n return function (quote) {\n // amasty fix start\n quote = quoteMixin(quote);\n // amasty fix finish\n var shippingAddress = quote.shippingAddress;\n\n /**\n * Makes sure that shipping address gets appropriate type when it points\n * to a store pickup location.\n */\n quote.shippingAddress = ko.pureComputed({\n /**\n * Return quote shipping address\n */\n read: function () {\n return shippingAddress();\n },\n\n /**\n * Set quote shipping address\n */\n write: function (address) {\n shippingAddress(\n pickupAddressConverter.formatAddressToPickupAddress(address)\n );\n }\n });\n\n return quote;\n };\n});\n","Amasty_CheckoutCore/js/model/shipping-rate-service-override.js":"/**\n * Rate request moved to separate method to be able to request methods without update shipping address.\n */\ndefine([\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/shipping-rate-processor/new-address',\n 'Magento_Checkout/js/model/shipping-rate-processor/customer-address',\n 'Magento_Checkout/js/model/shipping-rate-registry',\n 'Magento_Checkout/js/action/select-billing-address',\n 'Amasty_CheckoutCore/js/model/address-form-state'\n], function (\n quote,\n defaultProcessor,\n customerAddressProcessor,\n rateRegistry,\n selectBillingAddress,\n addressFormState\n) {\n 'use strict';\n\n var RateService = {\n processors: {},\n\n /**\n * @private\n */\n _initialize: function () {\n this.processors.default = defaultProcessor;\n this.processors['customer-address'] = customerAddressProcessor;\n\n if (!quote.isVirtual()) {\n quote.shippingAddress.subscribe(this.updateRates, this);\n }\n },\n\n /**\n * @param {object|null|undefined} address\n * @param {boolean|null|undefined} forceUpdate\n */\n updateRates: function (address, forceUpdate) {\n var shippingAddress = address || quote.shippingAddress(),\n type = shippingAddress.getType();\n\n if (addressFormState.isBillingSameAsShipping()\n && (!_.isFunction(shippingAddress.canUseForBilling) || shippingAddress.canUseForBilling())\n ) {\n selectBillingAddress(shippingAddress);\n }\n\n if (forceUpdate) {\n rateRegistry.clearStorage();\n }\n\n if (this.processors[type]) {\n this.processors[type].getRates(shippingAddress);\n } else {\n this.processors.default.getRates(shippingAddress);\n }\n },\n\n /**\n * @param {String} type\n * @param {*} processor\n */\n registerProcessor: function (type, processor) {\n this.processors[type] = processor;\n }\n };\n\n RateService._initialize();\n\n return RateService;\n});\n","Amasty_CheckoutCore/js/model/address-form-state.js":"define([\n 'ko',\n 'underscore',\n 'uiRegistry',\n 'Magento_Checkout/js/model/quote'\n], function (ko, _, registry, quote) {\n 'use strict';\n\n /**\n * States of Billing Address and Shipping Address Forms which can change checkout behaviour.\n * You cant change state of form by changing this observables (one way links)\n */\n return {\n /**\n * is Billing address form in edit mode\n */\n isBillingFormVisible: ko.observable(false),\n\n /**\n * is Billing Same As Shipping\n */\n isBillingSameAsShipping: ko.observable(true),\n\n /**\n * is Shipping address form in edit mode\n */\n isShippingFormVisible: ko.observable(false),\n\n isFormRendered: ko.observable(false).extend({ rateLimit: { timeout: 100, method: 'notifyWhenChangesStop' } }),\n\n /**\n * Update states by billing form view\n */\n updateBillingFormStates: function () {\n var billingAddressFormComponent,\n billingFormCacheKey = 'billing-address-form',\n paymentMethod;\n\n if (window.checkoutConfig.displayBillingOnPaymentMethod) {\n paymentMethod = quote.paymentMethod();\n billingFormCacheKey = false;\n\n if (paymentMethod) {\n billingFormCacheKey = paymentMethod.method + '-form';\n }\n }\n\n billingAddressFormComponent = this.getBillingForm(billingFormCacheKey);\n\n if (billingAddressFormComponent) {\n this.isBillingSameAsShipping(Boolean(billingAddressFormComponent.isAddressSameAsShipping()));\n this.isBillingFormVisible(!billingAddressFormComponent.isAddressDetail
2sVisible());\n } else {\n this.isBillingSameAsShipping(true);\n this.isBillingFormVisible(false);\n\n if (!window.checkoutConfig.displayBillingOnPaymentMethod && quote.isVirtual() ||\n !quote.billingAddress() && quote.isVirtual()) {\n this.isBillingSameAsShipping(false);\n this.isBillingFormVisible(true);\n }\n }\n },\n\n _indexedBillingForm: {},\n\n getBillingForm: function (index) {\n if (index && _.isUndefined(this._indexedBillingForm[index])) {\n this._indexedBillingForm[index] = registry.get({index: index});\n }\n\n return this._indexedBillingForm[index];\n }\n };\n});\n","Amasty_CheckoutCore/js/model/shipping-rates-validator-mixin.js":"/*global define*/\ndefine(\n [\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_Checkout/js/model/shipping-service'\n ],\n function (\n $,\n wrapper,\n shippingService\n ) {\n 'use strict';\n return function (target) {\n var mixin = {\n validateAddressDataState: true,\n\n /**\n * @return {*}\n */\n postcodeValidation: function (original) {\n original();\n\n return true;\n },\n\n /**\n * Fix validation for billing address\n *\n * @param {Function} original\n * @param {Object} element\n * @param {Number} delay\n */\n bindHandler: function (original, element, delay) {\n if (element.component.indexOf('/group') !== -1\n || (element.name.indexOf('billing') === -1 && element.dataScope.indexOf('billing') === -1)\n ) {\n return original(element, delay);\n }\n\n if (element.index === 'postcode') {\n var self = this;\n\n delay = typeof delay === 'undefined' ? 1000 : delay;\n\n element.on('value', function () {\n clearTimeout(self.validateZipCodeTimeout);\n self.validateZipCodeTimeout = setTimeout(function () {\n self.postcodeValidation(element);\n }, delay);\n });\n }\n },\n\n /**\n * Save Validation State\n *\n * @param {Function} original\n * @param {Object} address\n * @return {Boolean}\n */\n validateAddressData: function (original, address) {\n this.validateAddressDataState = original(address);\n\n return this.validateAddressDataState;\n },\n\n /**\n * Hide Loader with disabled fields (ex. Country) - compatibility with 2.4.7\n *\n * @param {Function} original\n * @returns {void}\n */\n validateFields: function (original) {\n original();\n\n if (!this.validateAddressDataState) {\n shippingService.isLoading(false);\n }\n }\n };\n\n wrapper._extend(target, mixin);\n return target;\n };\n }\n);\n","Amasty_CheckoutCore/js/model/checkout-data-resolver-mixin.js":"define(\n [\n 'jquery',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/checkout-data',\n 'Magento_Checkout/js/action/select-shipping-method',\n 'Magento_Checkout/js/model/address-converter',\n 'Magento_Customer/js/model/address-list',\n 'Magento_Checkout/js/model/payment-service',\n 'Magento_Checkout/js/action/select-payment-method',\n 'Magento_Checkout/js/action/select-shipping-address',\n 'Amasty_CheckoutCore/js/model/payment/vault-payment-resolver',\n 'uiRegistry',\n 'underscore',\n 'mage/utils/wrapper'\n ],\n function (\n $,\n quote,\n checkoutData,\n selectShippingMethodAction,\n addressConverter,\n addressList,\n paymentService,\n selectPaymentMethodAction,\n selectShippingAddress,\n vaultResolver,\n registry,\n _,\n wrapper\n ) {\n 'use strict';\n\n var defaultShippingMethod = null;\n\n /**\n * Get default shipping method.\n * Store default shipping method to speedup check.\n *\n * @return {String|false}\n * @private\n */\n function _getDefaultShippingMethod () {\n var provider, defaultMethod;\n\n if (defaultShippingMethod === null) {\n provider = registry.get('checkoutProvider');\n defaultMethod = checkoutConfig.selectedShippingMethod;\n\n if (provider && provider.defaultShippingMethod) {\n defaultShippingMethod = provider.defaultShippingMethod;\n } else {\n\n if (defaultMethod !== null){\n defaultShippingMethod = defaultMethod.carrier_code + '_' + defaultMethod.method_code;\n\n return defaultShippingMethod;\n }\n\n defaultShippingMethod = false;\n }\n }\n\n return defaultShippingMethod;\n }\n\n return function (target) {\n var mixin = {\n /**\n * @param {Function} original\n * @param {Object} ratesData\n */\n resolveShippingRates: function (original, ratesData) {\
2n if (!ratesData || ratesData.length === 0) {\n selectShippingMethodAction(null);\n\n return;\n }\n\n if (ratesData.length === 1) {\n\n if (ratesData[0].error_message) {\n selectShippingMethodAction(null);\n\n return;\n }\n\n //set shipping rate if we have only one available shipping rate\n selectShippingMethodAction(ratesData[0]);\n\n return;\n }\n var selectedShippingRate = checkoutData.getSelectedShippingRate(),\n availableRate = false;\n\n if (quote.shippingMethod()) {\n availableRate = _.find(ratesData, function (rate) {\n return rate['carrier_code'] == quote.shippingMethod()['carrier_code'] && //eslint-disable-line\n rate['method_code'] == quote.shippingMethod()['method_code']; //eslint-disable-line eqeqeq\n });\n }\n\n if (!availableRate && selectedShippingRate) {\n availableRate = _.find(ratesData, function (rate) {\n return rate['carrier_code'] + '_' + rate['method_code'] === selectedShippingRate;\n });\n }\n\n if (!availableRate && window.checkoutConfig.selectedShippingMethod) {\n availableRate = _.find(ratesData, function (rate) {\n return rate['carrier_code'] + '_' + rate['method_code'] === window.checkoutConfig.selectedShippingMethod;\n });\n }\n\n if (!availableRate && _getDefaultShippingMethod()) {\n availableRate = _.find(ratesData, function (rate) {\n return rate['carrier_code'] + '_' + rate['method_code'] === _getDefaultShippingMethod();\n });\n if (!availableRate) {\n availableRate = _.find(ratesData, function (rate) {\n return !!rate.available;\n });\n }\n }\n\n if (availableRate) {\n selectShippingMethodAction(availableRate);\n } else {\n selectShippingMethodAction(null);\n }\n },\n\n /**\n * Resolve payment method. Used local storage\n * @param {Function} original\n */\n resolvePaymentMethod: function (original) {\n original();\n if (quote.paymentMethod()) {\n return;\n }\n var paymentMethod = checkoutData.getSelectedPaymentMethod();\n if (vaultResolver.isSavedVaultPayment(paymentMethod) && vaultResolver.resolve(paymentMethod)) {\n return;\n }\n var provider = registry.get('checkoutProvider');\n if (provider && provider.defaultPaymentMethod) {\n var availablePaymentMethods = paymentService.getAvailablePaymentMethods();\n availablePaymentMethods.some(function (payment) {\n if (payment.method === provider.defaultPaymentMethod) {\n selectPaymentMethodAction(payment);\n return true;\n }\n });\n }\n },\n\n /**\n * Resolve estimation address. Used local storage\n * @param {Function} original\n */\n resolveEstimationAddress: function (original) {\n original();\n var shippingAddressData = checkoutData.getShippingAddressFromData(),\n checkoutProvider = registry.get('checkoutProvider');
2\n\n if (shippingAddressData) {\n checkoutProvider.set(\n 'shippingAddress',\n $.extend(true, {}, checkoutProvider.get('shippingAddress'), shippingAddressData)\n );\n }\n },\n\n /**\n * Apply resolved estimated address to quote\n *\n * @param {Function} original\n * @param {Object} isEstimatedAddress\n */\n applyShippingAddress: function (original, isEstimatedAddress) {\n var addressData = addressList()[0];\n\n original();\n\n if (quote.shippingAddress()) {\n return;\n }\n\n if (isEstimatedAddress) {\n addressData = addressConverter.addressToEstimationAddress(addressData);\n }\n\n if (addressList().length > 1) {\n selectShippingAddress(addressData);\n }\n }\n };\n\n wrapper._extend(target, mixin);\n return target;\n };\n }\n);\n","Amasty_CheckoutCore/js/model/resource-url-manager.js":"/*jshint browser:true jquery:true*/\n/*global alert*/\ndefine(\n [\n 'Magento_Customer/js/model/customer',\n 'Magento_Checkout/js/model/url-builder',\n 'Magento_Checkout/js/model/resource-url-manager',\n 'mageUtils'\n ],\n function (customer, urlBuilder, resourceUrlManager, utils) {\n \"use strict\";\n return {\n getUrlForDelivery: function (quote) {\n var params = (this.getCheckoutMethod() == 'guest') ? {cartId: quote.getQuoteId()} : {};\n var urls = {\n 'guest': '/amasty_checkout/guest-carts/:cartId/delivery',\n 'customer': '/amasty_checkout/carts/mine/delivery'\n };\n\n return this.getUrl(urls, params);\n },\n\n getUrlForRemoveItem: function (quote) {\n var params = (this.getCheckoutMethod() == 'guest') ? {cartId: quote.getQuoteId()} : {};\n var urls = {\n 'guest': '/amasty_checkout/guest-carts/:cartId/remove-item',\n 'customer': '/amasty_checkout/carts/mine/remove-item'\n };\n\n return this.getUrl(urls, params);\n },\n\n getUrlForUpdateItem: function (quote) {\n var params = (this.getCheckoutMethod() == 'guest') ? {cartId: quote.getQuoteId()} : {};\n var urls = {\n 'guest': '/amasty_checkout/guest-carts/:cartId/update-item',\n 'customer': '/amasty_checkout/carts/mine/update-item'\n };\n\n return this.getUrl(urls, params);\n },\n\n getUrlForAdditionalFields: function (quote) {\n var params = (this.getCheckoutMethod() == 'guest') ? {cartId: quote.getQuoteId()} : {};\n var urls = {\n 'guest': '/amasty_checkout/guest-carts/:cartId/amcheckoutFields',\n 'customer': '/amasty_checkout/carts/mine/amcheckoutFields'\n };\n\n return this.getUrl(urls, params);\n },\n\n getUrlForSavePassword: function (quote) {\n var params = (this.getCheckoutMethod() == 'guest') ? {cartId: quote.getQuoteId()} : {},\n urls = {\n 'guest': '/amasty_checkout/guest-carts/:cartId/save-password'\n };\n\n return this.getUrl(urls, params);\n },\n\n /** Get url for service */\n getUrl: function (urls, urlParams) {\n var url;\n\n if (utils.isEmpty(urls)) {\n return 'Provided service call does not exist.';\n }\n\n if (!utils.isEmpty(urls['default'])) {\n url = urls['default'];\n } else {\n url = urls[this.getCheckoutMethod()];\n }
2\n return urlBuilder.createUrl(url, urlParams);\n },\n\n getCheckoutMethod: function () {\n return customer.isLoggedIn() ? 'customer' : 'guest';\n },\n\n /**\n * Making url for total estimation request.\n *\n * @param {Object} quote - Quote model.\n * @returns {String} Result url.\n */\n getUrlForTotalsEstimationForNewAddress: function (quote) {\n if (window.checkoutConfig.isNegotiableQuote) {\n var params = {\n quoteId: quote.getQuoteId()\n },\n urls = {\n 'negotiable': '/negotiable-carts/:quoteId/totals/?isNegotiableQuote=true'\n };\n\n return resourceUrlManager.getUrl(urls, params);\n }\n\n return resourceUrlManager.getUrlForTotalsEstimationForNewAddress(quote);\n }\n };\n }\n);\n","Amasty_CheckoutCore/js/model/customer-email-validator-mixin.js":"/**\n * Add functionality to hide validation errors (\"silent\" validation).\n */\ndefine([\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_Customer/js/model/customer'\n], function ($, wrapper, customer) {\n 'use strict';\n\n return function (target) {\n target.validate = wrapper.wrapSuper(target.validate, function (hideError) {\n let result = this._super();\n\n if (!result && (hideError || window.silentShippingValidation) && !customer.isLoggedIn()) {\n $('form[data-role=email-with-possible-login]').validation('clearError');\n }\n\n return result;\n });\n\n return target;\n };\n});\n","Amasty_CheckoutCore/js/model/payment-service-mixin.js":"define([\n 'ko',\n 'mage/utils/wrapper',\n 'Magento_Checkout/js/model/quote',\n 'Amasty_CheckoutCore/js/model/payment/vault-payment-resolver'\n],function (ko, wrapper, quote, vaultResolver) {\n 'use strict';\n return function (target) {\n /**\n * Fix unselection of saved vault payment method\n */\n target.setPaymentMethods = wrapper.wrapSuper(target.setPaymentMethods, function (methods) {\n if (methods && quote.paymentMethod()) {\n var selectedMethod = quote.paymentMethod().method;\n\n if (vaultResolver.isVaultMethodAvailable(selectedMethod, methods)) {\n methods.push({\n method: selectedMethod\n });\n }\n }\n\n this._super(methods);\n });\n\n return target;\n };\n});\n","Amasty_CheckoutCore/js/model/billing-address-postcode-validator-mixin.js":"define([\n 'jquery',\n 'mage/utils/wrapper'\n], function ($, wrapper) {\n 'use strict';\n\n return function (target) {\n const mixin = {\n\n /**\n * for Correct Validation of the Billing Address Form\n *\n * @param {Function} original\n * @param {Object} postcodeElement\n * @returns {*}\n */\n postcodeValidation: function (original, postcodeElement) {\n let shippingAddressCountryNode = $('.form-shipping-address select[name=\"country_id\"]'),\n validationResult;\n\n shippingAddressCountryNode.attr('name', 'amcountry_id');\n validationResult = original(postcodeElement);\n shippingAddressCountryNode.attr('name', 'country_id');\n\n return validationResult;\n }\n }\n\n wrapper._extend(target, mixin);\n\n return target;\n };\n});\n","Amasty_CheckoutCore/js/model/one-step-layout.js":"// Checkout layout options model\ndefine([\n 'ko',\n 'uiRegistry',\n 'Amasty_CheckoutCore/js/view/utils',\n 'uiLayout'\n], function (ko, registry, viewUtils, layout) {\n 'use strict';\n\n const MAPPING_BLOCK_NAME = {\n shipping_address: 'checkout.steps.shipping-step.shippingAddress',\n shipping_method: 'checkout.steps.shipping-step.shippingAddress',\n delivery: 'checkout.steps.shipping-step.amcheckout-delivery-date',\n payment_method: 'checkout.steps.billing-step',\n summary: 'checkout.sidebar',\n additional_checkboxes: 'checkout.sidebar.additional.checkboxes'\n },\n CLASS_NAMES = {\n classic: {\n main: 'opc-wrapper am-opc-wrapper',\n column: 'checkout-column opc',\n block: 'checkout-block'\n },\n modern: {\n main: 'amcheckout-main-container',\n column: 'amcheckout-column',\n block: 'amcheckout-block amcheckout-step-container'\n }\n },\n BLOCK_ATTRS = {\n classic: {},\n modern: {\n main: {\n 'data-amcheckout-js': 'main-container'\n }\n }\n };\n\n return {\n containerClassNames: ko.observable(''),\n selectedLayout: [],\n checkoutDesign: '',\n checkoutLayout: '',\n checkoutBlocks: {},\n mainAdditionalClasses: '',\n gdprConsents: window.checkoutConfig.amastyOscGdprConsent,\n gdprComponents: {}
2,\n\n /**\n * Getting checkout block by name\n * @param {String} blockName\n * @returns {observable}\n */\n getCheckoutBlock: function (blockName) {\n var requestComponent = this.checkoutBlocks[blockName]\n || this.requestComponent(MAPPING_BLOCK_NAME[blockName]);\n\n switch (blockName) {\n case 'shipping_address':\n if (requestComponent()) {\n requestComponent().template = 'Amasty_CheckoutCore/onepage/shipping/address';\n }\n\n break;\n\n case 'shipping_method':\n if (requestComponent()) {\n requestComponent().template = 'Amasty_CheckoutCore/onepage/shipping/methods';\n }\n\n break;\n\n default: break;\n }\n\n return requestComponent;\n },\n\n /**\n * Getting component by name from registry\n * @param {String} name\n * @returns {observable}\n */\n requestComponent: function (name) {\n var observable = ko.observable();\n\n registry.get(name, function (summary) {\n observable(summary);\n });\n\n this.checkoutBlocks[name] = observable;\n\n return observable;\n },\n\n /**\n * Emulate 2columns layout for virtual quote checkout\n * @returns {Array}\n */\n getVirtualLayout: function () {\n return [\n [viewUtils.getBlockLayoutConfig('payment_method')],\n [viewUtils.getBlockLayoutConfig('summary')]\n ];\n },\n\n /**\n * Getting checkout container css classes by selected design\n * @returns {String}\n */\n setContainerClassNames: function () {\n var classNames = this.containerClassNames() + ' ' + CLASS_NAMES[this.checkoutDesign].main;\n\n if (this.checkoutDesign === 'modern') {\n classNames += ' -' + this.checkoutDesign + ' -layout-' + this.checkoutLayout;\n } else {\n classNames += ' layout-' + this.checkoutLayout;\n }\n\n classNames += ' ' + this.mainAdditionalClasses;\n\n this.containerClassNames(classNames);\n },\n\n /**\n * Getting checkout container attributes by selected design\n * @returns {Object}\n */\n getContainerAttrs: function () {\n return BLOCK_ATTRS[this.checkoutDesign].main;\n },\n\n /**\n * Getting checkout column css classes by design\n * @param {Number} columnIndex\n * @returns {String}\n */\n getColumnClassNames: function (columnIndex) {\n var classNames = '',\n defaultClassNames = CLASS_NAMES;\n\n classNames = defaultClassNames[this.checkoutDesign].column\n + this.getAdditionalColumnClassNames(columnIndex);\n\n return classNames;\n },\n\n /**\n * Getting checkout column additional css classes by design, layout and column type\n * @param {Number} columnIndex\n * @returns {String}\n */\n getAdditionalColumnClassNames: function (columnIndex) {\n var additionalColumnsClasses = '';\n\n if (this.checkoutDesign === 'modern' && this.checkoutLayout === '2columns') {\n if (columnIndex === 0) {\n additionalColumnsClasses += ' -main';\n } else if (columnIndex === 1) {\n additionalColumnsClasses += ' -sidebar';\n }\n }\n\n return additionalColumnsClasses;\n },\n\n /**\n * Getting checkout column tag attributes by design, layout and column type\n * @param {Number} columnIndex\n * @returns {Object}\n */\n getColumnAttrs: function (columnIndex) {\n var columnAttrs = {},\n checkoutJsPrefix = 'data-amcheckout-js',\n defaultAttrs = BLOCK_ATTRS[this.checkoutDesign].column;\n\n columnAttrs = defaultAttrs || {};\n\n if (this.checkoutDesign === 'modern' && this.checkoutLayout === '2columns') {\n if (columnIndex === 0) {\n columnAttrs[checkoutJsPrefix] = 'main-column';\n } else if (columnIndex === 1) {\n columnAttrs[checkoutJsPrefix] = '
2sidebar-column';\n }\n }\n\n return columnAttrs;\n },\n\n /**\n * Getting checkout block css classes\n * @param {String} blockName\n * @returns {*}\n */\n getBlockClassNames: function (blockName) {\n var defaultClassNames = CLASS_NAMES,\n classNames = defaultClassNames[this.checkoutDesign].block;\n\n if (blockName === 'summary') {\n classNames += ' -summary';\n }\n\n return classNames;\n },\n\n /**\n * Getting checkout block tag attributes by design and layout\n * @returns {Object}\n */\n getBlockAttrs: function () {\n var blockAttrs = {},\n checkoutJsPrefix = 'data-amcheckout-js',\n defaultAttrs = BLOCK_ATTRS[this.checkoutDesign].block;\n\n blockAttrs = defaultAttrs || {};\n\n if (this.checkoutDesign === 'modern' && this.checkoutLayout !== '3columns') {\n blockAttrs[checkoutJsPrefix] = 'step-container';\n }\n\n return blockAttrs;\n },\n\n /**\n * Check modern 2 columns design\n * @returns {boolean}\n */\n isModernTwoColumns: function () {\n return this.checkoutDesign === 'modern' && this.checkoutLayout === '2columns';\n },\n\n /**\n * @param {String} blockName\n * @param {Object|null} componentConfig\n * @return {observable}\n */\n getGdprComponent: function (blockName, componentConfig) {\n var name = componentConfig ? componentConfig.name + '-' + blockName : '',\n component = this.gdprComponents[name],\n config = {};\n\n if (this.gdprConsents[blockName] && name && !component) {\n component = ko.observable();\n config = Object.assign(\n config,\n componentConfig,\n {\n name: name,\n items: this.gdprConsents[blockName]['consents'],\n meta: this.gdprConsents[blockName]['meta']\n }\n );\n\n // move checkbox before place order button\n if (blockName === 'summary') {\n config.parent = MAPPING_BLOCK_NAME.additional_checkboxes;\n }\n\n layout([config]);\n registry.get(name, function (target) {\n component(target);\n });\n\n this.gdprComponents[name] = component;\n }\n\n return component;\n }\n };\n});\n","Amasty_CheckoutCore/js/model/address-converter-mixin.js":"define([\n 'underscore', 'mage/utils/wrapper'\n], function (_, wrapper) {\n 'use strict';\n\n return function (target) {\n /**\n * If custom attributes array, convert to object\n */\n target.quoteAddressToFormAddressData = wrapper.wrapSuper(\n target.quoteAddressToFormAddressData,\n function (inputModelAddress) {\n var modelAddress = _.clone(inputModelAddress),\n shippingAddress,\n customAttributes;\n\n if (modelAddress.customAttributes) {\n customAttributes = {};\n _.each(modelAddress.customAttributes, function (attribute, key) {\n if (_.isObject(attribute) && _.has(attribute, 'attribute_code')) {\n customAttributes[attribute.attribute_code] = attribute.value;\n } else if (!_.isNumber(key)) {\n customAttributes[key] = attribute;\n }\n });\n\n delete modelAddress.customAttributes;\n }\n\n shippingAddress = this._super(modelAddress);\n\n if (customAttributes) {\n shippingAddress['custom_attributes'] = customAttributes;\n }\n\n return shippingAddress;\n }\n );\n\n return target;\n };\n});\n","Amasty_CheckoutCore/js/model/new-customer-address-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*jshint browser:true jquery:true*/\n/*global alert*/\ndefine([\n 'underscore',\n 'mage/utils/wrapper'\n], function (_, wrapper) {\n 'use strict';\n\n return function (newAddressFunction) {\n return wrapper.wrap(newAddressFunction, function (origin, addressData) {\
2n if (window.checkoutConfig.amdefault) {\n _.each(window.checkoutConfig.amdefault, function (defaultValue, name) {\n if (!addressData[name] && name !== 'region_id' && name !== 'region') {\n addressData[name] = defaultValue;\n }\n });\n if (addressData.country_id === window.checkoutConfig.amdefault.country_id) {\n if (!addressData.region) {\n addressData.region = {};\n }\n if (!addressData.region.region_id) {\n addressData.region.region_id = window.checkoutConfig.amdefault.region_id;\n }\n if (!addressData.region.region) {\n addressData.region.region = window.checkoutConfig.amdefault.region;\n }\n }\n }\n\n return origin(addressData);\n });\n }\n});\n","Amasty_CheckoutCore/js/model/gdpr/consent-processor.js":"/**\n * Processor for collect consent checkboxes data by each checkout block\n */\ndefine([\n 'mage/utils/wrapper',\n 'jquery',\n 'underscore'\n], function (wrapper, $, _) {\n 'use strict';\n\n return {\n\n /**\n * @return {Object}\n */\n getConsentsData: function () {\n var consents = window.checkoutConfig.amastyOscGdprConsent || [],\n consentsData = {},\n consentData,\n consentElements,\n checked;\n\n _.each(consents, function (consentByBlock, blockCode) {\n _.each(consentByBlock.consents, function (consent) {\n consentElements = $('input[data-gdpr-checkbox-code=\"' + consent.checkbox_code + '\"]:visible');\n\n _.each(consentElements, function (consentElement) {\n consentData = consentsData[consent.checkbox_code];\n checked = Boolean($(consentElement).prop('checked'));\n\n if (!consentData || !consentData.checked) {\n consentsData[consent.checkbox_code] = {\n checked: checked,\n from: blockCode\n };\n }\n });\n });\n });\n\n return consentsData;\n }\n };\n});\n","Amasty_CheckoutCore/js/model/payment-validators/shipping-validator.js":"define([\n 'uiRegistry', 'Amasty_CheckoutCore/js/model/shipping-registry'\n], function (registry, shippingRegistry) {\n 'use strict';\n\n return {\n /**\n * Validate checkout shipping step\n *\n * @returns {Boolean}\n */\n validate: function (hideError) {\n let shipping = registry.get('checkout.steps.shipping-step.shippingAddress'),\n result;\n\n if (hideError && (shippingRegistry.isEstimationHaveError() || !shipping.silentValidation())) {\n return false;\n }\n\n shipping.allowedDynamicalSave = false;\n window.silentShippingValidation = !!hideError;\n result = shipping.validateShippingInformation(hideError);\n\n delete window.silentShippingValidation;\n shipping.allowedDynamicalSave = true;\n\n return result;\n }\n };\n});\n","Amasty_CheckoutCore/js/model/payment-validators/agreement-validator.js":"define([\n 'jquery',\n 'mage/validation'\n], function ($) {\n 'use strict';\n\n var checkoutConfig = window.checkoutConfig,\n agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},\n agreementsInputPath = '.additional-options .checkout-agreements .checkout-agreement.required input',\n agreementsInputPathPayment = '.payment-method._active div.checkout-agreements input',\n agreementsError = '.additional-options .checkout-agreements .checkout-agreement div.mage-error',\n agreementsInputPathOld = '.additional-options .checkout-agreements .checkout-agreement input';\n\n return {\n /**\n * Validate checkout agreements\n *\n * @param {boolean} hideError\n * @returns {Boolean}\n */\n validate: function (hideError) {\n var isValid = true,\n agreementsForValidate = agreementsInputPath;\n\n if (!agreementsConfig || !agreementsConfig.isEnabled) {\n return true;\n }\n if ($(agreementsInputPath).length === 0) {\n if ($(agreementsInputPathPayment).length !== 0) {\n agreementsForValidate = agreementsInputPathPayment;\n } else {\n return this.validateOld(hideError);\n }\n }\n\n $(agreementsForValidate).each(function (index, element) {\n if (!$.validator.validateSingleElement(\n element,\n {\n errorElement: 'div',\n hideError: hideError || false,\n errorPlacement: function (error, element) {\n let errorPlacement = element;\n if (element.is(':checkbox') || element.is(':radio')) {\n errorPlacement = element.siblings('label').last();\n }\n errorPlacement.after(error);\n }\n }\n )) {\n isValid = false;\n }\n });\n\n return isValid;\n },\n /**\n * Validate checkout agreements with old version of magento\n *\n * @param {boolean} hideError\n * @returns {Boolean}\n */\n validateOld: function (hideError) {\n if ($(agreementsInputPathOld).length === 0) {\n return true;\n }\n\n var isValid = true,\n element = $(agreementsInputPathOld),\n validator = $('#checkout').validate({\n errorClass: 'mage-error',\n errorElement: 'div',\n meta: 'validate',\n hideError: hideError || false,\n errorPlacement: function (error, element) {\n var errorPlacement = element;\n if (element.is(':checkbox') || element.is(':radio')) {\n errorPlacement = element.siblings('label').last();\n }\n errorPlacement.after(error);\n }\n });\n\n if (element.is(':checked') == false) {\n isValid = false;\n if (!$(agreementsError).length && !hideError) {\n validator.showLabel(element, $.mage.__('This is a required field.'));\n }\n }\n\n return isValid;\n }\n };\n});\n","Amasty_CheckoutCore/js/model/payment-validators/login-form-validator.js":"define(\n [\n 'jquery',\n 'underscore',\n 'uiRegistry',\n 'Magento_Customer/js/model/customer'\n ],\n function ($, _, registry, customer) {\n 'use strict';\n\n return {\n /**\n * Validate Login Form on checkout if available\n *\n * @returns {Boolean}\n */\n validate: function (hideError) {\n let createAcc = +window?.checkoutConfig?.quoteData?.additional_options?.create_account,\n $loginForm,\n customerEmail;\n\n if (customer.isLoggedIn() || createAcc <= 1) {\n return true;\n }\n\n $loginForm = $('form[data-role=email-with-possible-login]');\n\n if (createAcc === 3) {\n customerEmail = registry.get('checkout.steps.shipping-step.shippingAddress.customer-email')\n if (!_.isUndefined(customerEmail) && customerEmail.isPassword()) {\n return this._val
2idateElement($loginForm, hideError);\n }\n }\n\n if ($loginForm.find('#customer-password').val()) {\n return this._validateElement($loginForm, hideError);\n }\n\n return true;\n },\n\n _validateElement: function ($loginForm, hideError) {\n let isValid = $loginForm.validation() && $loginForm.validation('isValid');\n\n if (hideError) {\n $loginForm.validation('clearError');\n }\n\n return isValid;\n }\n };\n }\n);\n","Amasty_CheckoutCore/js/model/payment-validators/additional-validators-mixin.js":"define(\n [\n 'mage/utils/wrapper',\n 'Amasty_CheckoutCore/js/action/focus-first-error',\n 'Amasty_CheckoutCore/js/model/payment-validators/login-form-validator'\n ],\n function (wrapper, focusFirstError, loginFormValidator) {\n 'use strict';\n\n return function (target) {\n /**\n * Focus first error after validation\n */\n target.validate = wrapper.wrapSuper(target.validate, function (hideError) {\n var result;\n\n if (!loginFormValidator.validate(hideError)) {\n if (!hideError) {\n focusFirstError();\n }\n\n return false;\n }\n\n result = this._super();\n\n if (!result && !hideError) {\n focusFirstError();\n }\n\n return result;\n });\n\n return target;\n };\n }\n);\n","Amasty_CheckoutCore/js/model/payment-validators/order-summary-validator.js":"define([\n 'jquery',\n 'uiRegistry'\n], function ($, registry) {\n 'use strict';\n\n return {\n /**\n * Validate Summary order form if automatic update setting is enabled\n *\n * @returns {Boolean}\n */\n validate: function () {\n var forms = $('[data-amcheckout-js=\"order-form\"]'),\n result = true;\n\n registry.get('checkout.sidebar.summary.cart_items.details', function (details) {\n if (!details.isAutomatically) {\n return result;\n }\n\n $.each(forms, function () {\n if (!$(this).valid()) {\n result = false;\n }\n });\n\n return result;\n });\n\n return result;\n }\n };\n});\n","Amasty_CheckoutCore/js/model/payment-validators/dob-validator.js":"\ndefine([\n 'uiRegistry'\n], function (registry) {\n 'use strict';\n\n return {\n /**\n * Validate Date of Birth if available\n *\n * @returns {Boolean}\n */\n validate: function () {\n var amastyDob = registry.get('checkout.sidebar.additional.checkboxes.date_of_birth');\n\n if (amastyDob && amastyDob.visible()) {\n var validate = amastyDob.validate();\n if (validate == false) {\n return false;\n }\n return validate.valid;\n }\n\n return true;\n }\n };\n});\n","Amasty_CheckoutCore/js/model/payment/payment-loading.js":"define([\n 'ko'\n], function (ko) {\n 'use strict';\n\n /**\n * Loader for payment block\n * @see payment-service-mixin.js\n */\n return ko.observable(false);\n});\n","Amasty_CheckoutCore/js/model/payment/salesrule-observer.js":"/**\n * Optimized replacement of Magento_SalesRule/js/action/select-payment-method-mixin\n * Payment save will be triggered only if object of payment method is changed.\n * Originally, payment save was triggered on any update action, even if there was same data.\n * Which causes a lot of unnecessary requests for One Step Checkout\n */\ndefine([\n 'jquery',\n 'Magento_Checkout/js/model/quote',\n 'Magento_SalesRule/js/model/payment/discount-messages',\n 'Magento_Checkout/js/action/set-payment-information-extended',\n 'Magento_Checkout/js/action/get-totals',\n 'Magento_SalesRule/js/model/coupon'\n],function ($, quote, messageContainer, setPaymentInformationExtended, getTotalsAction, coupon) {\n 'use strict';\n\n return {\n /**\n * @var {string|null}\n */\n savedMethod: null,\n\n /**\n * @returns {void}\n */\n initialize: function () {\n let currentMethod = quote.paymentMethod();\n\n quote.paymentMethod.subscribe(this.observer.bind(this));\n\n if (currentMethod) {\n this.observer(currentMethod);\n }\n },\n\n /**\n * Quote payment method subscriber.\n *\n * @param {Object|null} paymentMethod\n * @returns {void}\n */\n observer: function (paymentMethod) {\n if (paymentMethod === null || paymentMethod.method === this.savedMethod) {\n return;\n }\n\n $.when(\n setPaymentInformationExtended(\n messageContainer,\n {\n method: paymentMethod.method\n },\n true\n )\n ).done(\n this.updateTotals.bind(this)\n );\n\n this.savedMethod = paymentMethod.method;\n },\n\n /**\n * Emulate Magento behavior\n *\n * @returns {void}\n */\n updateTotals: function () {\n let deferred = $.Deferred();\n\n getTotalsAction([], deferred);\n $.when(deferred).done(this.updateCoupon.bind(this));\n },\n\n /**\n * Emulate Magento behavior\n *\n * @returns {void}\n */\n updateCoupon: function () {\n if (quote.totals() && !quote.totals()['coupon_code']) {\n coupon.setCouponCode('');\n coupon.setIsApplied(false);\n }\n }\n };\n});\n","Amasty_CheckoutCore/js/model/payment/place-order-state.js":"define([\n 'ko'\n], function (ko) {\n 'use strict';\n\n /**\n * State for Place Order button\n *\n * @returns {observable}\n */\n return ko.observable(true);\n});\n","Amasty_CheckoutCore/js/model/payment/vault-payment-resolver.js":"define([\n 'underscore',\n 'mageUtils',\n 'uiRegistry',\n 'Magento_Checkout/js/model/payment/method-list'\n],function (_, utils, registry, availableMethods) {\n 'use strict';\n\n return {\n /**\n * Is pyment method are saved valt payment\n *\n * @param {String} method\n * @returns {boolean}\n */\n isSavedVaultPayment: function (method) {\n try {\n if (method\n && utils.nested(window, 'checkoutConfig.payment.vault.' + method)\n ) {\n return true;\n }\n } catch (e) {\n\n }\n\n return false;\n },\n\n /**\n * Is pyment method are saved valt payment and available\n *\n * @param {String} method\n * @param {Array} methodlist optional\n * @returns {boolean}\n */\n isVaultMethodAvailable: function (vaultMethod, methodlist) {\n if (!vaultMethod) {\n return false;\n }\n\n var vaultCode = utils.nested(window, 'checkoutConfig.payment.vault.' + vaultMethod + '.config.code');\n if (!vaultCode) {\n return false;\n }\n\n if (_.isUndefined(methodlist)) {\n methodlist = availableMethods;\n }\n return !! _.some(methodlist, function (method) {\n return method.method === vaultCode;\n });\n },\n\n /**\n * Fix Magento bug with preselect saved vault payment\n * @param {String} method\n * @returns {boolean}\n */\n resolve: function (method) {\n if (this.isVaultMethodAvailable(method)) {\n registry.get({index: method}, function (vaultView) {\n if (_.isFunction(vaultView.selectPaymentMethod)) {\n vaultView.selectPaymentMethod();\n }\n });\n return true\n }\n\n return false;\n }\n };\n});\n","Amasty_CheckoutCore/vendor/tooltipster/js/tooltipster.min.js":"!function(t,i){\"function\"==typeof define&&define.amd?define([\"jquery\"],function(t){return i(t)}):\"object\"==typeof exports?module.exports=i(require(\"jquery\")):i(jQuery)}(0,function(t){var i={animation:\"fade\",animationDuration:350,content:null,contentAsHTML:!1,contentCloning:!1,debug:!0,delay:300,delayTouch:[300,500],functionInit:null,functionBefore:null,functionReady:null,functionAfter:null,functionFormat:null,IEmin:6,interactive:!1,multiple:!1,parent:null,plugins:[\"sideTip\"],repositionOnScroll:!1,restoration:\"none\",selfDestruction:!0,theme:[],timer:0,trackerInterval:500,trackOrigin:!1,trackTooltip:!1,trigger:\"hover\",triggerClose:{click:!1,mouseleave:!1,originClick:!1,scroll:!1,tap:!1,touchleave:!1},triggerOpen:{click:!1,mouseenter:!1,tap:!1,touchstart:!1},updateAnimation:\"rotate\",zIndex:9999999,styles:{backgroundColor:\"\",textColor:\"\"}},o=\"undefined\"!=typeof window?window:null,e={hasTouchCapability:!(!o||!(\"ontouchstart\"in o||o.DocumentTouch&&o.document instanceof o.DocumentTouch||o.navigator.maxTouchPoints)),hasTransitions:function(){if(!o)return!1;var t=(o.document.body||o.document.documentElement).style,i=\"transition\",e=[\"Moz\",\"Webkit\",\"Khtml\",\"O\",\"ms\"];
2if(\"string\"==typeof t[i])return!0;i=i.charAt(0).toUpperCase()+i.substr(1);for(var n=0;n<e.length;n++)if(\"string\"==typeof t[e[n]+i])return!0;return!1}(),IE:!1,semVer:\"4.2.8\",window:o},n=function(){this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__instancesLatestArr=[],this.__plugins={},this._env=e};function s(t){this.$container,this.constraints=null,this.__$tooltip,this.__init(t)}function r(i,o){var e=!0;return t.each(i,function(t,n){if(void 0===o[t]||i[t]!==o[t])return e=!1,!1}),e}function _(i){var o=i.attr(\"id\"),n=o?e.window.document.getElementById(o):null;return n?n===i[0]:t.contains(e.window.document.body,i[0])}n.prototype={__bridge:function(o,e,n){if(!e[n]){var s=function(){};s.prototype=o;var r=new s;r.__init&&r.__init(e),t.each(o,function(t,o){0!=t.indexOf(\"__\")&&(e[t]?i.debug&&console.log(\"The \"+t+\" method of the \"+n+\" plugin conflicts with another plugin or native methods\"):(e[t]=function(){return r[t].apply(r,Array.prototype.slice.apply(arguments))},e[t].bridged=r))}),e[n]=r}return this},__setWindow:function(t){return e.window=t,this},_getRuler:function(t){return new s(t)},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_plugin:function(i){if(\"string\"==typeof i){var o=i,e=null;return o.indexOf(\".\")>0?e=this.__plugins[o]:t.each(this.__plugins,function(t,i){if(i.name.substring(i.name.length-o.length-1)==\".\"+o)return e=i,!1}),e}if(i.name.indexOf(\".\")<0)throw new Error(\"Plugins must be namespaced\");return this.__plugins[i.name]=i,i.core&&this.__bridge(i.core,this,i.name),this},_trigger:function(){var t=Array.prototype.slice.apply(arguments);return\"string\"==typeof t[0]&&(t[0]={type:t[0]}),this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,t),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,t),this},instances:function(i){var o=[];return t(i||\".tooltipstered\").each(function(){var i=t(this),e=i.data(\"tooltipster-ns\");e&&t.each(e,function(t,e){o.push(i.data(e))})}),o},instancesLatest:function(){return this.__instancesLatestArr},off:function(){return this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},origins:function(i){return t((i?i+\" \":\"\")+\".tooltipstered\").toArray()},setDefaults:function(o){return t.extend(i,o),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.tooltipster=new n,t.Tooltipster=function(i,o){this.__callbacks={close:[],open:[]},this.__closingTime,this.__Content,this.__contentBcr,this.__destroyed=!1,this.__$emitterPrivate=t({}),this.__$emitterPublic=t({}),this.__enabled=!0,this.__garbageCollector,this.__Geometry,this.__lastPosition,this.__namespace=\"tooltipster-\"+Math.round(1e6*Math.random()),this.__options,this.__$originParents,this.__pointerIsOverOrigin=!1,this.__previousThemes=[],this.__state=\"closed\",this.__timeouts={close:[],open:null},this.__touchEvents=[],this.__tracker=null,this._$origin,this._$tooltip,this.__init(i,o)},t.Tooltipster.prototype={__init:function(o,n){var s=this;if(s._$origin=t(o),s.__options=t.extend(!0,{},i,n),s.__optionsFormat(),!e.IE||e.IE>=s.__options.IEmin){var r=null;if(void 0===s._$origin.data(\"tooltipster-initialTitle\")&&(void 0===(r=s._$origin.attr(\"title\"))&&(r=null),s._$origin.data(\"tooltipster-initialTitle\",r)),null!==s.__options.content)s.__contentSet(s.__options.content);else{var _,a=s._$origin.attr(\"data-tooltip-content\");a&&(_=t(a)),_&&_[0]?s.__contentSet(_.first()):s.__contentSet(r)}s._$origin.removeAttr(\"title\").addClass(\"tooltipstered\"),s.__prepareOrigin(),s.__prepareGC(),t.each(s.__options.plugins,function(t,i){s._plug(i)}),e.hasTouchCapability&&t(e.window.document.body).on(\"touchmove.\"+s.__namespace+\"-triggerOpen\",function(t){s._touchRecordEvent(t)}),s._on(\"created\",function(){s.__prepareTooltip()})._on(\"repositioned\",function(t){s.__lastPosition=t.position})}else s.__options.disabled=!0},__contentInsert:function(){var t=this._$tooltip.find(\".tooltipster-content\"),i=this.__Content;return this._trigger({type:\"format\",content:this.__Content,format:function(t){i=t}}
2),this.__options.functionFormat&&(i=this.__options.functionFormat.call(this,this,{origin:this._$origin[0]},this.__Content)),\"string\"!=typeof i||this.__options.contentAsHTML?t.empty().append(i):t.text(i),this},__contentSet:function(i){return i instanceof t&&this.__options.contentCloning&&(i=i.clone(!0)),this.__Content=i,this._trigger({type:\"updated\",content:i}),this},__destroyError:function(){throw new Error(\"This tooltip has been destroyed and cannot execute your method call.\")},__geometry:function(){var i=this._$origin,o=this._$origin.is(\"area\");if(o){var n=this._$origin.parent().attr(\"name\");i=t('img[usemap=\"#'+n+'\"]')}var s=i[0].getBoundingClientRect(),r=t(e.window.document),_=t(e.window),a=i,l={available:{document:null,window:null},document:{size:{height:r.height(),width:r.width()}},window:{scroll:{left:e.window.scrollX||e.window.document.documentElement.scrollLeft,top:e.window.scrollY||e.window.document.documentElement.scrollTop},size:{height:_.height(),width:_.width()}},origin:{fixedLineage:!1,offset:{},size:{height:s.bottom-s.top,width:s.right-s.left},usemapImage:o?i[0]:null,windowOffset:{bottom:s.bottom,left:s.left,right:s.right,top:s.top}}};if(o){var p=this._$origin.attr(\"shape\"),c=this._$origin.attr(\"coords\");
2if(c&&(c=c.split(\",\"),t.map(c,function(t,i){c[i]=parseInt(t)})),\"default\"!=p)switch(p){case\"circle\":var h=c[0],d=c[1],u=c[2],g=d-u,f=h-u;l.origin.size.height=2*u,l.origin.size.width=l.origin.size.height,l.origin.windowOffset.left+=f,l.origin.windowOffset.top+=g;break;case\"rect\":var m=c[0],w=c[1],v=c[2],y=c[3];l.origin.size.height=y-w,l.origin.size.width=v-m,l.origin.windowOffset.left+=m,l.origin.windowOffset.top+=w;break;case\"poly\":for(var b=0,$=0,C=0,O=0,T=\"even\",z=0;z<c.length;z++){var E=c[z];\"even\"==T?(E>C&&(C=E,0===z&&(b=C)),E<b&&(b=E),T=\"odd\"):(E>O&&(O=E,1==z&&($=O)),E<$&&($=E),T=\"even\")}l.origin.size.height=O-$,l.origin.size.width=C-b,l.origin.windowOffset.left+=b,l.origin.windowOffset.top+=$}}for(this._trigger({type:\"geometry\",edit:function(t){l.origin.size.height=t.height,l.origin.windowOffset.left=t.left,l.origin.windowOffset.top=t.top,l.origin.size.width=t.width},geometry:{height:l.origin.size.height,left:l.origin.windowOffset.left,top:l.origin.windowOffset.top,width:l.origin.size.width}}),l.origin.windowOffset.right=l.origin.windowOffset.left+l.origin.size.width,l.origin.windowOffset.bottom=l.origin.windowOffset.top+l.origin.size.height,l.origin.offset.left=l.origin.windowOffset.left+l.window.scroll.left,l.origin.offset.top=l.origin.windowOffset.top+l.window.scroll.top,l.origin.offset.bottom=l.origin.offset.top+l.origin.size.height,l.origin.offset.right=l.origin.offset.left+l.origin.size.width,l.available.document={bottom:{height:l.document.size.height-l.origin.offset.bottom,width:l.document.size.width},left:{height:l.document.size.height,width:l.origin.offset.left},right:{height:l.document.size.height,width:l.document.size.width-l.origin.offset.right},top:{height:l.origin.offset.top,width:l.document.size.width}},l.available.window={bottom:{height:Math.max(l.window.size.height-Math.max(l.origin.windowOffset.bottom,0),0),width:l.window.size.width},left:{height:l.window.size.height,width:Math.max(l.origin.windowOffset.left,0)},right:{height:l.window.size.height,width:Math.max(l.window.size.width-Math.max(l.origin.windowOffset.right,0),0)},top:{height:Math.max(l.origin.windowOffset.top,0),width:l.window.size.width}};\"html\"!=a[0].tagName.toLowerCase();){if(\"fixed\"==a.css(\"position\")){l.origin.fixedLineage=!0;break}a=a.parent()}return l},__optionsFormat:function(){return\"number\"==typeof this.__options.animationDuration&&(this.__options.animationDuration=[this.__options.animationDuration,this.__options.animationDuration]),\"number\"==typeof this.__options.delay&&(this.__options.delay=[this.__options.delay,this.__options.delay]),\"number\"==typeof this.__options.delayTouch&&(this.__options.delayTouch=[this.__options.delayTouch,this.__options.delayTouch]),\"
2string\"==typeof this.__options.theme&&(this.__options.theme=[this.__options.theme]),null===this.__options.parent?this.__options.parent=t(e.window.document.body):\"string\"==typeof this.__options.parent&&(this.__options.parent=t(this.__options.parent)),\"hover\"==this.__options.trigger?(this.__options.triggerOpen={mouseenter:!0,touchstart:!0},this.__options.triggerClose={mouseleave:!0,originClick:!0,touchleave:!0}):\"click\"==this.__options.trigger&&(this.__options.triggerOpen={click:!0,tap:!0},this.__options.triggerClose={click:!0,tap:!0}),this._trigger(\"options\"),this},__prepareGC:function(){var i=this;return i.__options.selfDestruction?i.__garbageCollector=setInterval(function(){var o=(new Date).getTime();i.__touchEvents=t.grep(i.__touchEvents,function(t,i){return o-t.time>6e4}),_(i._$origin)||i.close(function(){i.destroy()})},2e4):clearInterval(i.__garbageCollector),i},__prepareOrigin:function(){var t=this;if(t._$origin.off(\".\"+t.__namespace+\"-triggerOpen\"),e.hasTouchCapability&&t._$origin.on(\"touchstart.\"+t.__namespace+\"-triggerOpen touchend.\"+t.__namespace+\"-triggerOpen touchcancel.\"+t.__namespace+\"-triggerOpen\",function(i){t._touchRecordEvent(i)}),t.__options.triggerOpen.click||t.__options.triggerOpen.tap&&e.hasTouchCapability){var i=\"\";t.__options.triggerOpen.click&&(i+=\"click.\"+t.__namespace+\"-triggerOpen \"),t.__options.triggerOpen.tap&&e.hasTouchCapability&&(i+=\"touchend.\"+t.__namespace+\"-triggerOpen\"),t._$origin.on(i,function(i){t._touchIsMeaningfulEvent(i)&&t._open(i)})}if(t.__options.triggerOpen.mouseenter||t.__options.triggerOpen.touchstart&&e.hasTouchCapability){i=\"\";t.__options.triggerOpen.mouseenter&&(i+=\"mouseenter.\"+t.__namespace+\"-triggerOpen \"),t.__options.triggerOpen.touchstart&&e.hasTouchCapability&&(i+=\"touchstart.\"+t.__namespace+\"-triggerOpen\"),t._$origin.on(i,function(i){!t._touchIsTouchEvent(i)&&t._touchIsEmulatedEvent(i)||(t.__pointerIsOverOrigin=!0,t._openShortly(i))})}if(t.__options.triggerClose.mouseleave||t.__options.triggerClose.touchleave&&e.hasTouchCapability){i=\"\";t.__options.triggerClose.mouseleave&&(i+=\"mouseleave.\"+t.__namespace+\"-triggerOpen \"),t.__options.triggerClose.touchleave&&e.hasTouchCapability&&(i+=\"touchend.\"+t.__namespace+\"-triggerOpen touchcancel.\"+t.__namespace+\"-triggerOpen\"),t._$origin.on(i,function(i){t._touchIsMeaningfulEvent(i)&&(t.__pointerIsOverOrigin=!1)})}return t},__prepareTooltip:function(){var i=this,o=i.__options.interactive?\"auto\":\"\";return i._$tooltip.attr(\"id\",i.__namespace).css({\"pointer-events\":o,zIndex:i.__options.zIndex}),t.each(i.__previousThemes,function(t,o){i._$tooltip.removeClass(o)}),t.each(i.__options.theme,function(t,o){i._$tooltip.addClass(o)}),i.__previousThemes=t.merge([],i.__options.theme),i},__scrollHandler:function(i){if(this.__options.triggerClose.scroll)this._close(i);else if(_(this._$origin)&&_(this._$tooltip)){var o=null;if(i.target===e.window.document)this.__Geometry.origin.fixedLineage||this.__options.repositionOnScroll&&this.reposition(i);else{o=this.__geometry();var n=!1;if(\"fixed\"!=this._$origin.css(\"position\")&&this.__$originParents.each(function(i,e){var s=t(e),r=s.css(\"overflow-x\"),_=s.css(\"overflow-y\");
2if(\"visible\"!=r||\"visible\"!=_){var a=e.getBoundingClientRect();if(\"visible\"!=r&&(o.origin.windowOffset.left<a.left||o.origin.windowOffset.right>a.right))return n=!0,!1;if(\"visible\"!=_&&(o.origin.windowOffset.top<a.top||o.origin.windowOffset.bottom>a.bottom))return n=!0,!1}if(\"fixed\"==s.css(\"position\"))return!1}),n)this._$tooltip.css(\"visibility\",\"hidden\");else if(this._$tooltip.css(\"visibility\",\"visible\"),this.__options.repositionOnScroll)this.reposition(i);else{var s=o.origin.offset.left-this.__Geometry.origin.offset.left,r=o.origin.offset.top-this.__Geometry.origin.offset.top;this._$tooltip.css({left:this.__lastPosition.coord.left+s,top:this.__lastPosition.coord.top+r})}}this._trigger({type:\"scroll\",event:i,geo:o})}return this},__stateSet:function(t){return this.__state=t,this._trigger({type:\"state\",state:t}),this},__timeoutsClear:function(){return clearTimeout(this.__timeouts.open),this.__timeouts.open=null,t.each(this.__timeouts.close,function(t,i){clearTimeout(i)}),this.__timeouts.close=[],this},__trackerStart:function(){var t=this,i=t._$tooltip.find(\".tooltipster-content\");return t.__options.trackTooltip&&(t.__contentBcr=i[0].getBoundingClientRect()),t.__tracker=setInterval(function(){if(_(t._$origin)&&_(t._$tooltip)){if(t.__options.trackOrigin){var o=t.__geometry(),e=!1;r(o.origin.size,t.__Geometry.origin.size)&&(t.__Geometry.origin.fixedLineage?r(o.origin.windowOffset,t.__Geometry.origin.windowOffset)&&(e=!0):r(o.origin.offset,t.__Geometry.origin.offset)&&(e=!0)),e||(t.__options.triggerClose.mouseleave?t._close():t.reposition())}if(t.__options.trackTooltip){var n=i[0].getBoundingClientRect();n.height===t.__contentBcr.height&&n.width===t.__contentBcr.width||(t.reposition(),t.__contentBcr=n)}}else t._close()},t.__options.trackerInterval),t},_close:function(i,o,n){var s=this,r=!0;if(s._trigger({type:\"close\",event:i,stop:function(){r=!1}}),r||n){o&&s.__callbacks.close.push(o),s.__callbacks.open=[],s.__timeoutsClear();var _=function(){t.each(s.__callbacks.close,function(t,o){o.call(s,s,{event:i,origin:s._$origin[0]})}),s.__callbacks.close=[]};if(\"closed\"!=s.__state){var a=!0,l=(new Date).getTime()+s.__options.animationDuration[1];if(\"disappearing\"==s.__state&&l>s.__closingTime&&s.__options.animationDuration[1]>0&&(a=!1),a){s.__closingTime=l,\"disappearing\"!=s.__state&&s.__stateSet(\"disappearing\");var p=function(){clearInterval(s.__tracker),s._trigger({type:\"closing\",event:i}),s._$tooltip.off(\".\"+s.__namespace+\"-triggerClose\").removeClass(\"tooltipster-dying\"),t(e.window).off(\".\"+s.__namespace+\"-triggerClose\"),s.__$originParents.each(function(i,o){t(o).off(\"scroll.\"+s.__namespace+\"-triggerClose\")}),s.__$originParents=null,t(e.window.document.body).off(\".\"+s.__namespace+\"-triggerClose\"),s._$origin.off(\".\"+s.__namespace+\"-triggerClose\"),s._off(\"dismissable\"),s.__stateSet(\"closed\"),s._trigger({type:\"after\",event:i}),s.__options.functionAfter&&s.__options.functionAfter.call(s,s,{event:i,origin:s._$origin[0]}),_()};e.hasTransitions?(s._$tooltip.css({\"-moz-animation-duration\":s.__options.animationDuration[1]+\"ms\",\"-ms-animation-duration\":s.__options.animationDuration[1]+\"ms\",\"-o-animation-duration\":s.__options.animationDuration[1]+\"ms\",\"-webkit-animation-duration\":s.__options.animationDuration[1]+\"ms\",\"animation-duration\":s.__options.animationDuration[1]+\"ms\",\"transition-duration\":s.__options.animationDuration[1]+\"ms\"}),s._$tooltip.clearQueue().removeClass(\"tooltipster-show\").addClass(\"tooltipster-dying\"),s.__options.animationDuration[1]>0&&s._$tooltip.delay(s.__options.animationDuration[1]),s._$tooltip.queue(p)):s._$tooltip.stop().fadeOut(s.__options.animationDuration[1],p)}}else _()}return s},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_open:function(i,o){var n=this;if(!n.__destroying&&_(n._$origin)&&n.__enabled){var s=!0;if(\"closed\"==n.__state&&(n._trigger({type:\"before\",event:i,stop:function(){s=!1}}),s&&n.__options.functionBefore&&(s=n.__options.functionBefore.call(n,n,{event:i,origin:n._$origin[0]}))),!1!==s&&null!==n.__Content){o&&n.__callbacks.open.push(o),n.__callbacks.close=[],n.__timeoutsClear();var r,a=function(){\"stable\"!=n.__state&&n.__stateSet(\"stable\"),t.each(n.__callbacks.open,function(t,i){i.c
2all(n,n,{origin:n._$origin[0],tooltip:n._$tooltip[0]})}),n.__callbacks.open=[]};if(\"closed\"!==n.__state)r=0,\"disappearing\"===n.__state?(n.__stateSet(\"appearing\"),e.hasTransitions?(n._$tooltip.clearQueue().removeClass(\"tooltipster-dying\").addClass(\"tooltipster-show\"),n.__options.animationDuration[0]>0&&n._$tooltip.delay(n.__options.animationDuration[0]),n._$tooltip.queue(a)):n._$tooltip.stop().fadeIn(a)):\"stable\"==n.__state&&a();else{if(n.__stateSet(\"appearing\"),r=n.__options.animationDuration[0],n.__contentInsert(),n.reposition(i,!0),e.hasTransitions?(n._$tooltip.addClass(\"tooltipster-\"+n.__options.animation).addClass(\"tooltipster-initial\").css({\"-moz-animation-duration\":n.__options.animationDuration[0]+\"ms\",\"-ms-animation-duration\":n.__options.animationDuration[0]+\"ms\",\"-o-animation-duration\":n.__options.animationDuration[0]+\"ms\",\"-webkit-animation-duration\":n.__options.animationDuration[0]+\"ms\",\"animation-duration\":n.__options.animationDuration[0]+\"ms\",\"transition-duration\":n.__options.animationDuration[0]+\"ms\"}),setTimeout(function(){\"closed\"!=n.__state&&(n._$tooltip.addClass(\"tooltipster-show\").removeClass(\"tooltipster-initial\"),n.__options.animationDuration[0]>0&&n._$tooltip.delay(n.__options.animationDuration[0]),n._$tooltip.queue(a))},0)):n._$tooltip.css(\"display\",\"none\").fadeIn(n.__options.animationDuration[0],a),n.__trackerStart(),t(e.window).on(\"resize.\"+n.__namespace+\"-triggerClose\",function(i){var o=t(document.activeElement);(o.is(\"input\")||o.is(\"textarea\"))&&t.contains(n._$tooltip[0],o[0])||n.reposition(i)}).on(\"scroll.\"+n.__namespace+\"-triggerClose\",function(t){n.__scrollHandler(t)}),n.__$originParents=n._$origin.parents(),n.__$originParents.each(function(i,o){t(o).on(\"scroll.\"+n.__namespace+\"-triggerClose\",function(t){n.__scrollHandler(t)})}),n.__options.triggerClose.mouseleave||n.__options.triggerClose.touchleave&&e.hasTouchCapability){n._on(\"dismissable\",function(t){t.dismissable?t.delay?(h=setTimeout(function(){n._close(t.event)},t.delay),n.__timeouts.close.push(h)):n._close(t):clearTimeout(h)});var l=n._$origin,p=\"\",c=\"\",h=null;n.__options.interactive&&(l=l.add(n._$tooltip)),n.__options.triggerClose.mouseleave&&(p+=\"mouseenter.\"+n.__namespace+\"-triggerClose \",c+=\"mouseleave.\"+n.__namespace+\"-triggerClose \"),n.__options.triggerClose.touchleave&&e.hasTouchCapability&&(p+=\"touchstart.\"+n.__namespace+\"-triggerClose\",c+=\"touchend.\"+n.__namespace+\"-triggerClose touchcancel.\"+n.__namespace+\"-triggerClose\"),l.on(c,function(t){if(n._touchIsTouchEvent(t)||!n._touchIsEmulatedEvent(t)){var i=\"mouseleave\"==t.type?n.__options.delay:n.__options.delayTouch;n._trigger({delay:i[1],dismissable:!0,event:t,type:\"dismissable\"})}}).on(p,function(t){!n._touchIsTouchEvent(t)&&n._touchIsEmulatedEvent(t)||n._trigger({dismissable:!1,event:t,type:\"dismissable\"})})}n.__options.triggerClose.originClick&&n._$origin.on(\"click.\"+n.__namespace+\"-triggerClose\",function(t){n._touchIsTouchEvent(t)||n._touchIsEmulatedEvent(t)||n._close(t)}),(n.__options.triggerClose.click||n.__options.triggerClose.tap&&e.hasTouchCapability)&&setTimeout(function(){if(\"closed\"!=n.__state){var i=\"\",o=t(e.window.document.body);n.__options.triggerClose.click&&(i+=\"click.\"+n.__namespace+\"-triggerClose \"),n.__options.triggerClose.tap&&e.hasTouchCapability&&(i+=\"touchend.\"+n.__namespace+\"-triggerClose\"),o.on(i,function(i){n._touchIsMeaningfulEvent(i)&&(n._touchRecordEvent(i),n.__options.interactive&&t.contains(n._$tooltip[0],i.target)||n._close(i))}),n.__options.triggerClose.tap&&e.hasTouchCapability&&o.on(\"touchstart.\"+n.__namespace+\"-triggerClose\",function(t){n._touchRecordEvent(t)})}},0),n._trigger(\"ready\"),n.__options.functionReady&&n.__options.functionReady.call(n,n,{origin:n._$origin[0],tooltip:n._$tooltip[0]})}if(n.__options.timer>0){h=setTimeout(function(){n._close()},n.__options.timer+r);n.__timeouts.close.push(h)}}}return n},_openShortly:function(t){var i=this,o=!0;if(\"stable\"!=i.__state&&\"appearing\"!=i.__state&&!i.__timeouts.open&&(i._trigger({type:\"start\",event:t,stop:function(){o=!1}
2}),o)){var e=0==t.type.indexOf(\"touch\")?i.__options.delayTouch:i.__options.delay;e[0]?i.__timeouts.open=setTimeout(function(){i.__timeouts.open=null,i.__pointerIsOverOrigin&&i._touchIsMeaningfulEvent(t)?(i._trigger(\"startend\"),i._open(t)):i._trigger(\"startcancel\")},e[0]):(i._trigger(\"startend\"),i._open(t))}return i},_optionsExtract:function(i,o){var e=this,n=t.extend(!0,{},o),s=e.__options[i];return s||(s={},t.each(o,function(t,i){var o=e.__options[t];void 0!==o&&(s[t]=o)})),t.each(n,function(i,o){void 0!==s[i]&&(\"object\"!=typeof o||o instanceof Array||null==o||\"object\"!=typeof s[i]||s[i]instanceof Array||null==s[i]?n[i]=s[i]:t.extend(n[i],s[i]))}),n},_plug:function(i){var o=t.tooltipster._plugin(i);if(!o)throw new Error('The \"'+i+'\" plugin is not defined');return o.instance&&t.tooltipster.__bridge(o.instance,this,o.name),this},_touchIsEmulatedEvent:function(t){for(var i=!1,o=(new Date).getTime(),e=this.__touchEvents.length-1;e>=0;e--){var n=this.__touchEvents[e];if(!(o-n.time<500))break;n.target===t.target&&(i=!0)}return i},_touchIsMeaningfulEvent:function(t){return this._touchIsTouchEvent(t)&&!this._touchSwiped(t.target)||!this._touchIsTouchEvent(t)&&!this._touchIsEmulatedEvent(t)},_touchIsTouchEvent:function(t){return 0==t.type.indexOf(\"touch\")},_touchRecordEvent:function(t){return this._touchIsTouchEvent(t)&&(t.time=(new Date).getTime(),this.__touchEvents.push(t)),this},_touchSwiped:function(t){for(var i=!1,o=this.__touchEvents.length-1;o>=0;o--){var e=this.__touchEvents[o];if(\"touchmove\"==e.type){i=!0;break}if(\"touchstart\"==e.type&&t===e.target)break}return i},_trigger:function(){var i=Array.prototype.slice.apply(arguments);return\"string\"==typeof i[0]&&(i[0]={type:i[0]}),i[0].instance=this,i[0].origin=this._$origin?this._$origin[0]:null,i[
vendor: 4,402 bytes, line 2
20].tooltip=this._$tooltip?this._$tooltip[0]:null,this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,i),t.tooltipster._trigger.apply(t.tooltipster,i),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,i),this},_unplug:function(i){var o=this;if(o[i]){var e=t.tooltipster._plugin(i);e.instance&&t.each(e.instance,function(t,e){o[t]&&o[t].bridged===o[i]&&delete o[t]}),o[i].__destroy&&o[i].__destroy(),delete o[i]}return o},close:function(t){return this.__destroyed?this.__destroyError():this._close(null,t),this},content:function(t){var i=this;if(void 0===t)return i.__Content;if(i.__destroyed)i.__destroyError();else if(i.__contentSet(t),null!==i.__Content){if(\"closed\"!==i.__state&&(i.__contentInsert(),i.reposition(),i.__options.updateAnimation))if(e.hasTransitions){var o=i.__options.updateAnimation;i._$tooltip.addClass(\"tooltipster-update-\"+o),setTimeout(function(){\"closed\"!=i.__state&&i._$tooltip.removeClass(\"tooltipster-update-\"+o)},1e3)}else i._$tooltip.fadeTo(200,.5,function(){\"closed\"!=i.__state&&i._$tooltip.fadeTo(200,1)})}else i._close();return i},destroy:function(){var i=this;if(i.__destroyed)i.__destroyError();else{\"closed\"!=i.__state?i.option(\"animationDuration\",0)._close(null,null,!0):i.__timeoutsClear(),i._trigger(\"destroy\"),i.__destroyed=!0,i._$origin.removeData(i.__namespace).off(\".\"+i.__namespace+\"-triggerOpen\"),t(e.window.document.body).off(\".\"+i.__namespace+\"-triggerOpen\");var o=i._$origin.data(\"tooltipster-ns\");if(o)if(1===o.length){var n=null;\"previous\"==i.__options.restoration?n=i._$origin.data(\"tooltipster-initialTitle\"):\"current\"==i.__options.restoration&&(n=\"string\"==typeof i.__Content?i.__Content:t(\"<div></div>\").append(i.__Content).html()),n&&i._$origin.attr(\"title\",n),i._$origin.removeClass(\"tooltipstered\"),i._$origin.removeData(\"tooltipster-ns\").removeData(\"tooltipster-initialTitle\")}else o=t.grep(o,function(t,o){return t!==i.__namespace}),i._$origin.data(\"tooltipster-ns\",o);i._trigger(\"destroyed\"),i._off(),i.off(),i.__Content=null,i.__$emitterPrivate=null,i.__$emitterPublic=null,i.__options.parent=null,i._$origin=null,i._$tooltip=null,t.tooltipster.__instancesLatestArr=t.grep(t.tooltipster.__instancesLatestArr,function(t,o){return i!==t}),clearInterval(i.__garbageCollector)}return i},disable:function(){return this.__destroyed?(this.__destroyError(),this):(this._close(),this.__enabled=!1,this)},elementOrigin:function(){if(!this.__destroyed)return this._$origin[0];this.__destroyError()},elementTooltip:function(){return this._$tooltip?this._$tooltip[0]:null},enable:function(){return this.__enabled=!0,this},hide:function(t){return this.close(t)},instance:function(){return this},off:function(){return this.__destroyed||this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},open:function(t){return this.__destroyed?this.__destroyError():this._open(null,t),this},option:function(i,o){return void 0===o?this.__options[i]:(this.__destroyed?this.__destroyError():(this.__options[i]=o,this.__optionsFormat(),t.inArray(i,[\"trigger\",\"triggerClose\",\"triggerOpen\"])>=0&&this.__prepareOrigin(),\"selfDestruction\"===i&&this.__prepareGC()),this)},reposition:function(t,i){return this.__destroyed?this.__destroyError():\"closed\"!=this.__state&&_(this._$origin)&&(i||_(this._$tooltip))&&(i||this._$tooltip.detach(),this.__Geometry=this.__geometry(),this._trigger({type:\"reposition\",event:t,helper:{geo:this.__Geometry}})),this},show:function(t){return this.open(t)},status:function(){return{destroyed:this.__destroyed,enabled:this.__enabled,open:\"closed\"!==this.__state,state:this.__state}},triggerHandler:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},t.fn.tooltipster=function(){var o=Array.prototype.slice.apply(arguments),e=\"You are using a single HTML element as content for several tooltips. You probably want to set the contentCloning option to TRUE.\";if(0===this.length)return this;
2if(\"string\"==typeof o[0]){var n=\"#*$~&\";return this.each(function(){var i=t(this).data(\"tooltipster-ns\"),s=i?t(this).data(i[0]):null;if(!s)throw new Error(\"You called Tooltipster's \\\"\"+o[0]+'\" method on an uninitialized element');if(\"function\"!=typeof s[o[0]])throw new Error('Unknown method \"'+o[0]+'\"');this.length>1&&\"content\"==o[0]&&(o[1]instanceof t||\"object\"==typeof o[1]&&null!=o[1]&&o[1].tagName)&&!s.__options.contentCloning&&s.__options.debug&&console.log(e);var r=s[o[0]](o[1],o[2]);if(r!==s||\"instance\"===o[0])return n=r,!1}),\"#*$~&\"!==n?n:this}t.tooltipster.__instancesLatestArr=[];var s=o[0]&&void 0!==o[0].multiple,r=s&&o[0].multiple||!s&&i.multiple,_=o[0]&&void 0!==o[0].content,a=_&&o[0].content||!_&&i.content,l=o[0]&&void 0!==o[0].contentCloning,p=l&&o[0].contentCloning||!l&&i.contentCloning,c=o[0]&&void 0!==o[0].debug,h=c&&o[0].debug||!c&&i.debug;return this.length>1&&(a instanceof t||\"object\"==typeof a&&null!=a&&a.tagName)&&!p&&h&&console.log(e),this.each(function(){var i=!1,e=t(this),n=e.data(\"tooltipster-ns\"),s=null;n?r?i=!0:h&&(console.log(\"Tooltipster: one or more tooltips are already attached to the element below. Ignoring.\"),console.log(this)):i=!0,i&&(s=new t.Tooltipster(this,o[0]),n||(n=[]),n.push(s.__namespace),e.data(\"tooltipster-ns\",n),e.data(s.__namespace,s),s.__options.functionInit&&s.__options.functionInit.call(s,s,{origin:this}),s._trigger(\"init\")),t.tooltipster.__instancesLatestArr.push(s)}),this},s.prototype={__init:function(i){this.__$tooltip=i,this.__$tooltip.css({left:0,overflow:\"hidden\",position:\"absolute\",top:0}).find(\".tooltipster-content\").css(\"overflow\",\"auto\"),this.$container=t('<div class=\"tooltipster-ruler\"></div>').append(this.__$tooltip).appendTo(e.window.document.body)},__forceRedraw:function(){var t=this.__$tooltip.parent();this.__$tooltip.detach(),this.__$tooltip.appendTo(t)},constrain:function(t,i){return this.constraints={width:t,height:i},this.__$tooltip.css({display:\"block\",height:\"\",overflow:\"auto\",width:t}),this},destroy:function(){this.__$tooltip.detach().find(\".tooltipster-content\").css({display:\"\",overflow:\"\"}),this.$container.remove()},free:function(){return this.constraints=null,this.__$tooltip.css({display:\"\",height:\"\",overflow:\"visible\",width:\"\"}),this},measure:function(){this.__forceRedraw();var t=this.__$tooltip[0].getBoundingClientRect(),i={size:{height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}};if(this.constraints){var o=this.__$tooltip.find(\".tooltipster-content\"),n=this.__$tooltip.outerHeight(),s=o[0].getBoundingClientRect(),r={height:n<=this.constraints.height,width:t.width<=this.constraints.width&&s.width>=o[0].scrollWidth-1};i.fits=r.height&&r.width}return e.IE&&e.IE<=11&&i.size.width!==e.window.document.documentElement.clientWidth&&(i.size.width=Math.ceil(i.size.width)+1),i}};var a=navigator.userAgent.toLowerCase();-1!=a.indexOf(\"msie\")?e.IE=parseInt(a.split(\"msie\")[1]):-1!==a.toLowerCase().indexOf(\"trident\")&&-1!==a.indexOf(\" rv:11\")?e.IE=11:-1!=a.toLowerCase().indexOf(\"edge/\")&&(e.IE=parseInt(a.toLowerCase().split(\"edge/\")[1]));return t.tooltipster._plugin({name:\"tooltipster.sideTip\",instance:{__defaults:function(){return{arrow:!0,distance:6,functionPosition:null,maxWidth:null,minIntersection:16,minWidth:0,position:null,side:\"top\",viewportAware:!0,defaultStyles:{backgroundColor:\"#fff\",textColor:\"#000\"}}},__init:function(t){var i=this;i.__instance=t,i.__namespace=\"tooltipster-sideTip-\"+Math.round(1e6*Math.random()),i.__previousState=\"closed\",i.__options,i.__optionsFormat(),i.__instance._on(\"state.\"+i.__namespace,function(t){\"closed\"==t.state?i.__close():\"appearing\"==t.state&&\"closed\"==i.__previousState&&i.__create(),i.__previousState=t.state}),i.__instance._on(\"options.\"+i.__namespace,function(){i.__optionsFormat()}),i.__instance._on(\"reposition.\"+i.__namespace,function(t){i.__reposition(t.event,t.helper)})},__close:function(){this.__instance.content()instanceof t&&this.__instance.content().detach(),this.__instance._$tooltip.remove(),this.__instance._$tooltip=null},__create:function(){var i=this.__instance.__options.styles,o=t('<div class=\"tooltipster-base tooltipster-sidetip\"><div class=\"tooltipster-box\"><div class=\"tooltipster-content\"></div></div><div class=\"tooltipster-arrow\"><div class=\"tooltipster-arrow-uncropped\"><div class=\"tooltipster-arrow-border\"></div><div class=\"tooltipster-arrow-background\"></div></div></div></div>');o.find(\".tooltipster-box\").css({color:i.textColor?i.textColor:this.__options.defaultStyles.textColor,backgroundColor:i.backgroundColor?i.backgroundColor:this.__options.defaultStyles.backgroundColor}),o.find(\".tooltipster-arrow-border\").css({backgroundColor:i.backgroundColor?i.backgroundColor:this.__options.defaultStyles.backgroundColor}),this.__options.arrow||o.find(\".tooltipster-box\").css(\"margin\",0).end().find(\".tooltipster-arrow\").hide(),this.__options.minWidth&&o.css(\"min-width\",this.__options.minWidth+\"px\"),this.__options.maxWidth&&o.css(\"max-width\",this.__options.maxWidth+\"px\"),this.__instance._$tooltip=o,this.__instance._trigger(\"created\")},__destroy:function(){this.__instance._off(\".\"+self.__namespace)},__optionsFormat:function(){if(this.__options=this.__instance._optionsExtract(\"tooltipster.sideTip\",this.__defaults()),this.__options.position&&(this.__options.side=this.__options.position),\"object\"!=typeof this.__options.distance&&(this.__options.distance=[this.__options.distance]),this.__options.distance.length<4&&(void 0===this.__options.distance[1]&&(this.__options.distance[1]=this.__options.distance[0]),void 0===this.__options.distance[2]&&(this.__options.distance[2]=this.__options.distance[0]),void 0===this.__options.distance[3]&&(this.__options.distance[3]=this.__options.distance[1])),this.__options.distance={top:this.__options.distance[0],right:this.__options.distance[1],bottom:this.__options.distance[2],left:this.__options.distance[3]}
2,\"string\"==typeof this.__options.side){this.__options.side=[this.__options.side,{top:\"bottom\",right:\"left\",bottom:\"top\",left:\"right\"}[this.__options.side]],\"left\"==this.__options.side[0]||\"right\"==this.__options.side[0]?this.__options.side.push(\"top\",\"bottom\"):this.__options.side.push(\"right\",\"left\")}6===t.tooltipster._env.IE&&!0!==this.__options.arrow&&(this.__options.arrow=!1)},__reposition:function(i,o){var e,n=this,s=n.__targetFind(o),r=[];n.__instance._$tooltip.detach();var _=n.__instance._$tooltip.clone(),a=t.tooltipster._getRuler(_),l=!1,p=n.__instance.option(\"animation\");switch(p&&_.removeClass(\"tooltipster-\"+p),t.each([\"window\",\"document\"],function(e,p){var c=null;if(n.__instance._trigger({container:p,helper:o,satisfied:l,takeTest:function(t){c=t},results:r,type:\"positionTest\"}),1==c||0!=c&&0==l&&(\"window\"!=p||n.__options.viewportAware))for(e=0;e<n.__options.side.length;e++){var h={horizontal:0,vertical:0},d=n.__options.side[e];\"top\"==d||\"bottom\"==d?h.vertical=n.__options.distance[d]:h.horizontal=n.__options.distance[d],n.__sideChange(_,d),t.each([\"natural\",\"constrained\"],function(t,e){if(c=null,n.__instance._trigger({container:p,event:i,helper:o,mode:e,results:r,satisfied:l,side:d,takeTest:function(t){c=t},type:\"positionTest\"}),1==c||0!=c&&0==l){var _={container:p,distance:h,fits:null,mode:e,outerSize:null,side:d,size:null,target:s[d],whole:null},u=(\"natural\"==e?a.free():a.constrain(o.geo.available[p][d].width-h.horizontal,o.geo.available[p][d].height-h.vertical)).measure();if(_.size=u.size,_.outerSize={height:u.size.height+h.vertical,width:u.size.width+h.horizontal},\"natural\"==e?o.geo.available[p][d].width>=_.outerSize.width&&o.geo.available[p][d].height>=_.outerSize.height?_.fits=!0:_.fits=!1:_.fits=u.fits,\"window\"==p&&(_.fits?_.whole=\"top\"==d||\"bottom\"==d?o.geo.origin.windowOffset.right>=n.__options.minIntersection&&o.geo.window.size.width-o.geo.origin.windowOffset.left>=n.__options.minIntersection:o.geo.origin.windowOffset.bottom>=n.__options.minIntersection&&o.geo.window.size.height-o.geo.origin.windowOffset.top>=n.__options.minIntersection:_.whole=!1),r.push(_),_.whole)l=!0;else if(\"natural\"==_.mode&&(_.fits||_.size.width<=o.geo.available[p][d].width))return!1}})}}),n.__instance._trigger({edit:function(t){r=t},event:i,helper:o,results:r,type:\"positionTested\"}),r.sort(function(t,i){return t.whole&&!i.whole?-1:!t.whole&&i.whole?1:t.whole&&i.whole?(o=n.__options.side.indexOf(t.side))<(e=n.__options.side.indexOf(i.side))?-1:o>e?1:\"natural\"==t.mode?-1:1:t.fits&&!i.fits?-1:!t.fits&&i.fits?1:t.fits&&i.fits?(o=n.__options.side.indexOf(t.side))<(e=n.__options.side.indexOf(i.side))?-1:o>e?1:\"natural\"==t.mode?-1:1:\"document\"==t.container&&\"bottom\"==t.side&&\"natural\"==t.mode?-1:1;var o,e}),(e=r[0]).coord={},e.side){case\"left\":case\"right\":e.coord.top=Math.floor(e.target-e.size.height/2);break;case\"bottom\":case\"top\":e.coord.left=Math.floor(e.target-e.size.width/2)}switch(e.side){case\"left\":e.coord.left=o.geo.origin.windowOffset.left-e.outerSize.width;break;case\"right\":e.coord.left=o.geo.origin.windowOffset.right+e.distance.horizontal;break;case\"top\":e.coord.top=o.geo.origin.windowOffset.top-e.outerSize.height;break;case\"bottom\":e.coord.top=o.geo.origin.windowOffset.bottom+e.distance.vertical}\"window\"==e.container?\"top\"==e.side||\"bottom\"==e.side?e.coord.left<0?o.geo.origin.windowOffset.right-this.__options.minIntersection>=0?e.coord.left=0:e.coord.left=o.geo.origin.windowOffset.right-this.__options.minIntersection-1:e.coord.left>o.geo.window.size.width-e.size.width&&(o.geo.origin.windowOffset.left+this.__options.minIntersection<=o.geo.window.size.width?e.coord.left=o.geo.window.size.width-e.size.width:e.coord.left=o.geo.origin.windowOffset.left+this.__options.minIntersection+1-e.size.width):e.coord.top<0?o.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?e.coord.top=0:e.coord.top=o.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:e.coord.top>o.geo.window.size.height-e.size.height&&(o.geo.origin.windowOffset.top+this.__options.minIntersection<=o.geo.window.size.height?e.coord.top=o.geo.window.size.height-e.size.height:e.coord.top=o.geo.origin.windowOffset.top+this.__options.minIntersection+1-e.size.height):(e.coord.left>o.geo.window.size.width-e.size.width&&(e.coord.left=o.geo.window.size.width-e.size.width),e.coord.left<0&&(e.coord.left=0)),n.__sideChange(_,e.side),o.tooltipClone=_[0],o.tooltipParent=n.__instance.option(\"parent\").parent[0],o.mode=e.mode,o.whole=e.whole,o.origin=n.__instance._$origin[0],o.tooltip=n.__instance._$tooltip[0],delete e.container,delete e.fits,delete e.mode,delete e.outerSize,delete e.whole,e.distance=e.distance.horizontal||e.distance.vertical;var c,h,d,u=t.extend(!0,{},e);if(n.__instance._trigger({edit:function(t){e=t},event:i,helper:o,position:u,type:\"position\"}),n.__options.functionPosition){var g=n.__options.functionPosition.call(n,n.__instance,o,u);g&&(e=g)}a.destroy(),\"top\"==e.side||\"bottom\"==e.side?(c={prop:\"left\",val:e.target-e.coord.left},h=e.size.width-this.__options.minIntersection):(c={prop:\"top\",val:e.target-e.coord.top},h=e.size.height-this.__options.minIntersection),c.val<this.__options.minIntersection?c.val=this.__options.minIntersection:c.val>h&&(c.val=h),d=o.geo.origin.fixedLineage?o.geo.origin.windowOffset:{left:o.geo.origin.windowOffset.left+o.geo.window.scroll.left,top:o.geo.origin.windowOffset.top+o.geo.window.scroll.top},e.coord={left:d.left+(e.coord.left-o.geo.origin.windowOffset.left),top:d.top+(e.coord.top-o.geo.origin.windowOffset.top)},n.__sideChange(n.__instance._$tooltip,e.side),o.geo.origin.fixedLineage?n.__instance._$tooltip.css(\"position\",\"fixed\"):n.__instance._$tooltip.css(\"position\",\"\"),n.__instance._$tooltip.css({left:e.coord.left,top:e.coord.top,height:e.size.height,width:e.size.width}).find(\".tooltipster-arrow\").css({left:\"\",top:\"\"}).css(c.prop,c.val),n.__instance._$tooltip.appendTo(n.__instance.option(\"parent\")),n.__instance._trigger({type:\"repositioned\",event:i,position:e})},__sideChange:function(t,i){t.removeClass(\"tooltipster-bottom\").removeClass(\"tooltipster-left\").removeClass(\"tooltipster-right\").removeClass(\"tooltipster-top\").addClass(\"tooltipster-\"+i)},__targetFind:function(t){var i={},o=this.__instance._$origin[0].getClientRects();o.length>1&&(1==this.__instance._$origin.css(\"opacity\")&&(this.__instance._$origin.css(\"opacity\",.99),o=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css(\"opacity\",1)));if(o.length<2)i.top=Math.floor(t.geo.origin.windowOffset.left+t.geo.origin.size.width/2),i.bottom=i.top,i.left=Math.floor(t.geo.origin.windowOffset.top+t.geo.origin.size.height/2),i.right=i.left;else{var e=o[0];i.top=Math.floor(e.left+(e.right-e.left)/2),e=o.length>2?o[Math.ceil(o.length/2)-1]:o[0],i.right=Math.floor(e.top+(e.bottom-e.top)/2),e=o[o.length-1],i.bottom=Math.floor(e.left+(e.right-e.left)/2),e=o.length>2?o[Math.ceil((o.length+1)/2)-1]:o[o.length-1],i.left=Math.floor(e.top+(e.bottom-e.top)/2)}return i}}}),t});\n","Magento_ReCaptchaCheckout/js/reCaptchaCheckout.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(\n [\n 'Magento_ReCaptchaWebapiUi/js/webapiReCaptcha',\n 'jquery'\n ],\n function (Component, $) {\n 'use strict';\n\n var reCaptchaIds = new WeakMap(),\n uuid = 0;\n\n return Component.extend({\n defaults: {\n template: 'Magento_ReCaptchaCheckout/reCaptcha',\n skipPayments: [] // List of payment methods that do not require this reCaptcha\n }
2,\n\n /**\n * Render reCAPTCHA for payment method\n *\n * @param {Object} method\n */\n renderReCaptchaFor: function (method) {\n var reCaptcha;\n\n if (this.isCheckoutReCaptchaRequiredFor(method)) {\n reCaptcha = $.extend(true, {}, this, {reCaptchaId: this.getReCaptchaIdFor(method)});\n reCaptcha.renderReCaptcha();\n }\n },\n\n /**\n * Get reCAPTCHA ID for payment method\n *\n * @param {Object} method\n * @returns {String}\n */\n getReCaptchaIdFor: function (method) {\n if (!reCaptchaIds.has(method)) {\n reCaptchaIds.set(method, this.getReCaptchaId() + '-' + uuid++);\n }\n return reCaptchaIds.get(method);\n },\n\n /**\n * Check whether checkout reCAPTCHA is required for payment method\n *\n * @param {Object} method\n * @returns {Boolean}\n */\n isCheckoutReCaptchaRequiredFor: function (method) {\n return !this.skipPayments || !this.skipPayments.hasOwnProperty(method.getCode());\n },\n\n /**\n * @inheritdoc\n */\n initCaptcha: function () {\n var $wrapper,\n $recaptchaResponseInput;\n\n this._super();\n // Since there will be multiple reCaptcha in the payment form,\n // they may override each other if the form data is serialized and submitted.\n // Instead, the reCaptcha response will be collected in the callback: reCaptchaCallback()\n // and sent in the request header X-ReCaptcha\n $wrapper = $('#' + this.getReCaptchaId() + '-wrapper');\n $recaptchaResponseInput = $wrapper.find('[name=g-recaptcha-response]');\n if ($recaptchaResponseInput.length) {\n $recaptchaResponseInput.prop('disabled', true);\n }\n }\n });\n }\n);\n","Magento_ReCaptchaCheckout/js/webapiReCaptchaRegistry-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return function (originalFunction) {\n /**\n * {@inheritDoc}\n */\n originalFunction.addListener = function (id , func) {\n this._listeners[id] = func;\n };\n\n return originalFunction;\n };\n\n});\n","Magento_ReCaptchaCheckout/js/model/place-order-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable max-nested-callbacks */\n\ndefine([\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry'\n], function ($, wrapper, recaptchaRegistry) {\n 'use strict';\n\n return function (placeOrder) {\n return wrapper.wrap(placeOrder, function (originalAction, serviceUrl, payload, messageContainer) {\n var recaptchaDeferred,\n reCaptchaId,\n $activeReCaptcha;\n\n $activeReCaptcha = $('.recaptcha-checkout-place-order:visible .g-recaptcha');\n\n if ($activeReCaptcha.length > 0) {\n reCaptchaId = $activeReCaptcha.last().attr('id');\n }\n\n if (reCaptchaId !== undefined && recaptchaRegistry.triggers.hasOwnProperty(reCaptchaId)) {\n //ReCaptcha is present for checkout\n recaptchaDeferred = $.Deferred();\n recaptchaRegistry.addListener(reCaptchaId, function (token) {\n //Add reCaptcha value to place-order request and resolve deferred with the API call results\n payload.xReCaptchaValue = token;\n originalAction(serviceUrl, payload, messageContainer).done(function () {\n recaptchaDeferred.resolve.apply(recaptchaDeferred, arguments);\n }).fail(function () {\n recaptchaDeferred.reject.apply(recaptchaDeferred, arguments);\n });\n });\n //Trigger ReCaptcha validation\n recaptchaRegistry.triggers[reCaptchaId]();\n\n if (\n !recaptchaRegistry._isInvisibleType.hasOwnProperty(reCaptchaId) ||\n recaptchaRegistry._isInvisibleType[reCaptchaId] === false\n ) {\n //remove listener so that place order action is only triggered by the 'Place Order' button\n recaptchaRegistry.removeListener(reCaptchaId);\n }\n\n return recaptchaDeferred;\n }\n\n //No ReCaptcha, just sending the request\n return originalAction(serviceUrl, payload, messageContainer);\n });\n };\n});\n","js-cookie/cookie-wrapper.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'js-cookie/js.cookie'\n], function ($, cookie) {\n 'use strict';\n\n window.Cookies = window.Cookies || cookie;\n\n var config = $.cookie = function (key, value, options) {\n if (value !== undefined) {\n options = $.extend({}, config.defaults, options);\n\n return cookie.set(key, value, options);\n }\n\n var result = key ? undefined : {},\n cookies = document.cookie ? document.cookie.split('; ') : [],\n i;\n\n for (i = 0; i < cookies.length;
2 i++) {\n var parts = cookies[i].split('='),\n name = config.raw ? parts.shift() : decodeURIComponent(parts.shift()),\n cookieValue = parts.join('=');\n\n if (key && key === name) {\n result = decodeURIComponent(cookieValue.replace('/\\\\+/g', ' '));\n break;\n }\n\n if (!key && (cookieValue = decodeURIComponent(cookieValue.replace('/\\\\+/g', ' '))) !== undefined) {\n result[name] = cookieValue;\n }\n }\n\n return result;\n };\n\n config.defaults = {};\n\n $.removeCookie = function (key, options) {\n if ($.cookie(key) === undefined) {\n return false;\n }\n\n $.cookie(key, '', $.extend({}, options, { expires: -1 }));\n return !$.cookie(key);\n };\n});\n","js-cookie/js.cookie.js":"/*! js-cookie v3.0.5 | MIT */\n;\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {\n var current = global.Cookies;\n var exports = global.Cookies = factory();\n exports.noConflict = function () { global.Cookies = current; return exports; };\n })());\n})(this, (function () { 'use strict';\n\n /* eslint-disable no-var */\n function assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n target[key] = source[key];\n }\n }\n return target\n }\n /* eslint-enable no-var */\n\n /* eslint-disable no-var */\n var defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n };\n /* eslint-enable no-var */\n\n /* eslint-disable no-var */\n\n function init (converter, defaultAttributes) {\n function set (name, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n name = encodeURIComponent(name)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n name + '=' + converter.write(value, name) + stringifiedAttributes)\n }\n\n function get (name) {\n if (typeof document === 'undefined' || (arguments.length && !name)) {\
2n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var found = decodeURIComponent(parts[0]);\n jar[found] = converter.read(value, found);\n\n if (name === found) {\n break\n }\n } catch (e) {}\n }\n\n return name ? jar[name] : jar\n }\n\n return Object.create(\n {\n set,\n get,\n remove: function (name, attributes) {\n set(\n name,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n }\n\n var api = init(defaultConverter, { path: '/' });\n /* eslint-enable no-var */\n\n return api;\n\n}));\n","Magento_GroupedProduct/js/grouped-product.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'underscore',\n 'jquery-ui-modules/widget',\n 'jquery/jquery.parsequery'\n], function ($) {\n 'use strict';\n\n $.widget('mage.groupedProduct', {\n options: {\n qtySelector: 'input.qty',\n qtyNameSelector: 'super_group'\n },\n\n /**\n * Creates widget\n * @private\n */\n _create: function () {\n // Override defaults with URL query parameters and/or inputs values\n this._overrideDefaults();\n },\n\n /**\n * Override default options values settings with either URL query parameters or\n * initialized inputs values.\n * @private\n */\n _overrideDefaults: function () {\n var hashIndex = window.location.href.indexOf('#');\n\n if (hashIndex !== -1) {\n this._parseQueryParams(window.location.href.substr(hashIndex + 1));\n }\n },\n\n /**\n * Parse query parameters from a query string and set options values based on the\n * key value pairs of the parameters.\n * @param {*} queryString - URL query string containing query parameters.\n * @private\n */\n _parseQueryParams: function (queryString) {\n var queryParams = $.parseQuery({\n query: queryString\n }),\n form = this.element,\n qtyNameSelector = this.options.qtyNameSelector,\n qtys = $(this.options.qtySelector, form);\n\n $.each(queryParams, $.proxy(function (key, value) {\n qtys.each(function (index, qty) {\n var nameSelector = qtyNameSelector.concat('[', key, ']');\n\n if (qty.name === nameSelector) {\n $(qty).val(value);\n }\n });\n }, this));\n }\n });\n\n return $.mage.groupedProduct;\n});\n","Magento_GroupedProduct/js/product-ids-resolver.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'Magento_Catalog/js/product/view/product-ids',\n 'Magento_Catalog/js/product/view/product-info'\n], function ($, productIds, productInfo) {\n 'use strict';\n\n /**\n * Returns id's of products in form.\n *\n * @param {Object} config\n * @param {HTMLElement} element\n * @return {Array}\n */\n return function (config, element) {\n $(element).find('div[data-product-id]').each(function () {\n productIds.push($(this).data('productId').toString());\n productInfo.push(\n {\n 'id': $(this).data('productId').toString()\n }\n );\n });\n\n return productIds();\n };\n});\n","Magento_PaymentServicesPaypal/js/order-review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'uiComponent',\n 'Magento_Customer/js/customer-data'\n], function ($, Component, customerData) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n element: null,\n placeOrderButtonSelector: '#review-button',\n shippingMethodFormSelector: '#shipping-method-form',\n shippingMethodInputSelector: '#shipping-method',\n updateContainerSelector: '#details-reload',\n waitLoadingContainer: '#review-please-wait',\n orderFormSelector: '#order-review-form',\n editShoppingCartSelector: '.magento-payments-review-items .edit',\n updateShippingMethodUrl: null,\n placeOrderUrl: null,\n canEditShippingMethod: false,\n isVirtual: false\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n this._super();\n this.element = element;\n\n $(this.placeOrderButtonSelector).on('click', this.submitOrder.bind(this));\n $(this.editShoppingCartSelector).on('click', this.invalidateCustomerData.bind(this));\n\n if (!this.isVirtual && this.canEditShippingMethod) {\n $(this.shippingMethodInputSelector).on('change', this.selectShippingMethod.bind(this));\n this.setPlaceOrderButtonActive(!!$(this.shippingMethodInputSelector).val());\n }\n },\n\n invalidateCustomerData: function () {\n customerData.invalidate(['cart']);\n },\n\n /**\n * Before request start\n */\n beforeRequestStart: function () {\n $(this.waitLoadingContainer).show();\n },\n\n /**\n * On request complete\n */\n onRequestComplete: function () {\n $(this.waitLoadingContainer).hide();\n },\n\n /**\n * Submit order\n */\n submitOrder: function () {\n if (this.validateForm()) {\n this.beforeRequestStart();\n $(this.orderFormSelector).trigger('submit');\n this.setPlaceOrderButtonActive(false);\n }\n },\n\n /**\n * Validate form\n */\n validateForm: function () {\n return $(this.element).validation().valid();\n },\n\n /**\n * Enable/disable order button\n *\n * @param {Boolean} isActive\n */\n setPlaceOrderButtonActive: function (isActive) {\n $(this.placeOrderButtonSelector).prop('disabled', !isActive).toggleClass('no-checkout', !isActive);\n },\n\n /**\n * Select shipping method\n */\n selectShippingMethod: function () {\n var shippingMethod,\n formData,\n responseCallback;\n\n if ($(this.waitLoadingContainer).is(':visible')) {\n return false;\n }\n shippingMethod = $(this.shippingMethodInputSelector).val();\n shippingMethod = shippingMethod.trim();\n this.setPlaceOrderButtonActive(false);\n\n if (shippingMethod) {\n formData = $(this.shippingMethodFormSelector).seri
2alize() + '&isAjax=true';\n\n /**\n * @param {Object} response\n */\n responseCallback = function (response) {\n if (typeof response.redirectUrl == 'undefined') {\n $(this.updateContainerSelector).html(response.html);\n } else {\n window.location = response.redirectUrl;\n }\n this.setPlaceOrderButtonActive(true);\n this.onRequestComplete();\n };\n $.ajax({\n url: this.updateShippingMethodUrl,\n type: 'post',\n context: this,\n beforeSend: this.beforeRequestStart,\n data: formData,\n success: responseCallback\n });\n }\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/helpers/map-address-to-magento.js":"define([\n 'Magento_Checkout/js/model/new-customer-address',\n 'Magento_PaymentServicesPaypal/js/helpers/get-allowed-locations',\n 'Magento_PaymentServicesPaypal/js/helpers/get-street-line-count',\n 'Magento_PaymentServicesPaypal/js/helpers/get-region-id'\n], function (Address, getAllowedLocations, getStreetLineCount, getRegionId) {\n 'use strict';\n\n /**\n * Creates an array of empty strings with the length being the set street lines for a customer address.\n *\n * @returns {Array}\n */\n const createEmptyStreetArray = () => {\n const streetLines = getStreetLineCount();\n return Array.apply(null, Array(streetLines))\n .reduce((prev, curr, index) => { prev[index] = ''; return prev; }, {});\n };\n\n /**\n * Fastlane provides an address object that isn't in the correct Adobe Commerce format so map it to the\n * correct format.\n *\n * @param {Object} address - An address object as gathered from Fastlane.\n * @returns {Object} - A correctly mapped address using 'Magento_Checkout/js/model/new-customer-address' model.\n */\n return function (address) {\n const street = createEmptyStreetArray();\n\n street[0] = address.address.addressLine1 || address.address.streetAddress;\n\n if (address.address.addressLine2 || address.address.extendedAddress) {\n street[1] = address.address.addressLine2 || address.address.extendedAddress;\n }\n\n const mappedAddress = Address({\n region: {\n region_id: getRegionId(\n address.address.countryCode || address.address.countryCodeAlpha2,\n address.address.adminArea1 || address.address.region\n ),\n region_code: address.address.adminArea1 || address.address.region,\n region: address.address.adminArea1 || address.address.region\n },\n company: address.address.company || '',\n country_id: address.address.countryCode || address.address.countryCodeAlpha2,\n street,\n firstname: address.name?.firstName || '',\n lastname: address.name?.lastName || '',\n city: address.address.adminArea2 || address.address.locality,\n telephone: address.phoneNumber?.nationalNumber || '00000000000',\n postcode: address.address.postalCode\n }),\n allowedLocations = getAllowedLocations();\n\n mappedAddress.country_id = mappedAddress.countryId;\n mappedAddress.region_code = mappedAddress.regionCode;\n mappedAddress.region_id = mappedAddress.regionId;\n mappedAddress.street = street;\n\n // If the country / region isn't available on this website then throw an error.\n if (!allowedLocations.includes(mappedAddress.countryId)) {\n const error = new Error();\n\n error.name = 'paypal_fastlane:address_unavailable';\n throw error;\n }\n\n return mappedAddress;\n };\n});\n","Magento_PaymentServicesPaypal/js/helpers/is-fastlane-available.js":"define(['Magento_Customer/js/model/customer'], function (customer) {\n 'use strict';\n\n /**\n * Small helper to check if Fastlane is enabled and the User is NOT logged in.\n *\n * @retuns {boolean}\n */\n return function () {\n return window.checkoutConfig.payment.payment_services_paypal_fastlane?.isVisible && !customer.isLoggedIn();\n };\n});\n","Magento_PaymentServicesPaypal/js/helpers/map-address-to-fastlane.js":"define(function () {\n 'use strict';\n\n /**\n * Formats an address object back to the format expected by Fastlane.\n *\n * @param {Object} address - Address that ideally is a 'Magento_Checkout/js/model/new-customer-address' object.\n * @returns {Object}
2 - A correctly mapped address that is expected by Fastlane.\n */\n return function (address) {\n const formattedAddress = {\n firstName: address.firstname,\n lastName: address.lastname,\n company: address.company,\n locality: address.city,\n region: address.regionCode,\n postalCode: address.postcode,\n countryCodeAlpha2: address.countryId,\n phoneNumber: address.telephone\n };\n\n // Street needs a little bit of extra work because it can be more than two lines.\n formattedAddress.streetAddress = address.street?.[0];\n\n // If there is a second line available then join all of the remaining array properties together.\n if (address.street?.[1]) {\n formattedAddress.extendedAddress = address.street.slice(1).join(', ');\n }\n\n return formattedAddress;\n };\n});\n","Magento_PaymentServicesPaypal/js/helpers/get-region-id.js":"define(['Magento_Customer/js/customer-data'], function (customerData) {\n 'use strict';\n\n /**\n * Converts a region string into the associated region ID.\n *\n * @returns {number}\n */\n return function (countryCode, administrativeArea) {\n const countryData = customerData.get('directory-data')(),\n country = countryData[countryCode];\n\n if (country?.regions) {\n const regionIds = Object.keys(country.regions);\n\n return regionIds.find((regionId) => {\n return country.regions[regionId].code === administrativeArea;\n }) || 0;\n }\n\n return 0;\n };\n});\n","Magento_PaymentServicesPaypal/js/helpers/get-street-line-count.js":"define(['uiRegistry'], function (uiRegistry) {\n 'use strict';\n\n /**\n * Returns the integer count of the number of street lines available on a customer address.\n *\n * @returns {number}\n */\n return function () {\n const shippingAddress = uiRegistry.get('checkout.steps.shipping-step.shippingAddress');\n return Object.values(shippingAddress.source.shippingAddress.street).length;\n };\n});\n","Magento_PaymentServicesPaypal/js/helpers/get-allowed-locations.js":"define(['uiRegistry'], function (uiRegistry) {\n 'use strict';\n\n /**\n * Get the available list of countries as defined in configuration.\n *\n * @returns {Array}\n */\n return function () {\n const countries = uiRegistry.get('checkoutProvider').get('dictionaries.country_id'),\n allowedLocations = countries.map(({ value }) => value).filter((value) => value && value !== 'delimiter');\n\n return allowedLocations;\n };\n});\n","Magento_PaymentServicesPaypal/js/lib/script-loader-wrapper.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine(['underscore', 'Magento_PaymentServicesPaypal/js/lib/script-loader'], function (_, scriptLoader) {\n 'use strict';\n\n var promises = {},\n defaultNamespace = 'paypal';\n\n /**\n * Parse src query string and move all params to object\n *\n * @param {Object} params\n * @return {Object}\n */\n function processParamsSrc(params) {\n var processedParams = _.clone(params),\n url = new URL(params.src),\n queryString = url.search.substring(1),\n urlParams = JSON.parse('{\"' +\n decodeURI(queryString).replace(/\"/g, '\\\\\"').replace(/&/g, '\",\"').replace(/=/g, '\":\"') +\n '\"}');\n\n _.extend(processedParams, urlParams);\n delete processedParams.src;\n\n return processedParams;\n }\n\n /**\n * Convert params to object key => value format\n *\n * @param {Object} params\n * @return {Object}\n */\n function convertToParamsObject(params) {\n var processedParams = {};\n\n _.each(params, function (param) {\n processedParams[param.name] = param.value;\n });\n\n return processedParams;\n }\n\n /**\n * Load PayPal sdk with params.\n *\n * @param {Array} params\n * @param {String} sdkNamespace\n * @return {Promise}\n */\n return function (params, sdkNamespace) {\n var src;\n\n if (!params || !params.length) {\n return Promise.reject();\n }\n\n params = convertToParamsObject(params);\n params['data-namespace'] = sdkNamespace || defaultNamespace;\n\n if (!params || !params.src) {\n return Promise.reject();\n }\n\n src = params.src;\n\n if (!promises[src]) {\n params = processParamsSrc(params);\n\n promises[src] = scriptLoader.load(params);\n }\n\n return promises[src];\n };\n});\n","Magento_PaymentServicesPaypal/js/lib/script-loader.min.js":"/*!\n * paypal-js v3.1.1 (2021-03-14T21:08
2:07.006Z)\n * Copyright 2020-present, PayPal, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar paypalLoadScript=function(t){\"use strict\";function e(t,e){var r=document.querySelector('script[src=\"'.concat(t,'\"]'));if(null===r)return null;var n=a(t,e);if(Object.keys(r.dataset).length!==Object.keys(n.dataset).length)return null;var o=!0;return Object.keys(r.dataset).forEach((function(t){r.dataset[t]!==n.dataset[t]&&(o=!1)})),o?r:null}function r(t){var e=t.url,r=t.attributes,n=t.onSuccess,o=t.onError,i=a(e,r);i.onerror=o,i.onload=n,document.head.insertBefore(i,document.head.firstElementChild)}function n(t){var e=\"https://www.paypal.com/sdk/js\";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL);var r=function(t,e){var r=\"\",n=\"\";Array.isArray(t)?t.length>1?(r=\"*\",n=t.toString()):r=t.toString():\"string\"==typeof t&&t.length>0?r=t:\"string\"==typeof e&&e.length>0&&(r=\"*\",n=e);return{\"merchant-id\":r,\"data-merchant-id\":n}}(t[\"merchant-id\"],t[\"data-merchant-id\"]),n=Object.assign(t,r),a=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&\"\"!==n[t]})).reduce((function(t,e){var r=n[e].toString();return\"data-\"===e.substring(0,5)?t.dataAttributes[e]=r:t.queryParams[e]=r,t}),{queryParams:{},dataAttributes:{}}),i=a.queryParams,u=a.dataAttributes;return{url:\"\".concat(e,\"?\").concat(o(i)),dataAttributes:u}}function o(t){var e=\"\";return Object.keys(t).forEach((function(r){0!==e.length&&(e+=\"&\"),e+=r+\"=\"+t[r]})),e}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(\"script\");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),\"data-csp-nonce\"===t&&r.setAttribute(\"nonce\",e[\"data-csp-nonce\"])})),r}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u();s(t,e);var n=t.url,o=t.attributes;if(\"string\"!=typeof n||0===n.length)throw new Error(\"Invalid url.\");if(void 0!==o&&\"object\"!=typeof o)throw new Error(\"Expected attributes to be an object.\");return new e((function(t,e){if(\"undefined\"==typeof window)return t();r({url:n,attributes:o,onSuccess:function(){return t()},onError:function(){return e(new Error('The script \"'.concat(n,'\" failed to load.')))}})}))}function u(){if(\"undefined\"==typeof Promise)throw new Error(\"Promise is undefined. To resolve the issue, use a Promise polyfill.\");return Promise}function c(t){return window[t]}function s(t,e){if(\"object\"!=typeof t||null===t)throw new Error(\"Expected an options object.\");if(void 0!==e&&\"function\"!=typeof e)throw new Error(\"Expected PromisePonyfill to be a function.\")}return t.loadCustomScript=i,t.loadScript=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u();if(s(t,r),\"undefined\"==typeof window)return r.resolve(null);var o=n(t),a=o.url,d=o.dataAttributes,l=d[\"data-namespace\"]||\"paypal\",f=c(l);return e(a,d)&&f?r.resolve(f):i({url:a,attributes:d},r).then((function(){var t=c(l);if(t)return t;throw new Error(\"The window.\".concat(l,\" global variable is not available.\"))}))},t.version=\"3.1.1\",Object.defineProperty(t,\"__esModule\",{value:!0}),t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;\n","Magento_PaymentServicesPaypal/js/view/shipping-information-mixin.js":"define([\n 'Magento_PaymentServicesPaypal/js/helpers/is-fastlane-available',\n 'Magento_PaymentServicesPaypal/js/view/payment/fastlane'\n], function (isFastlaneAvailable, fastlaneModel) {\n 'use strict';\n\n var mixin = {\n initialize: function () {\n this._super();\n\n // Early return if Fastlane is not available\n if (!isFastlaneAvailable()) {\n return;\n }\n\n fastlaneModel.setup();\n\n return this;\n },\n\n /**\n * Override the core back behaviour to call Fastlane if required.\n */\n back: function () {\n if (fastlaneModel.profileData()) {\n fastlaneModel.displayChangeShipping();\n } else {\n this._super();\n }\n }\n };\n\n return function (shippingInformation) {\n return shippingInformation.extend(mixin);\n };\n});\n","Magento_PaymentServicesPaypal/js/view/form/element/powered-by.js":"define([\n 'knockout',\n 'uiComponent',\n 'Magento_PaymentServicesPaypal/js/helpers/is-fastlane-available',\n 'Magento_PaymentServicesPaypal/js/view/payment/fastlane'\n], function (ko, Component, isFastlaneAvailable, fastlaneModel) {\n 'use strict';\n\n return Component.extend({\n profileData: null,\n\n defaults: {\n template: 'Magento_PaymentServicesPaypal/form/element/powered-by'\n },\n\n /**\n * Initialise the watermark component.\n *\n * @returns {Object} Chainable.\n */\n initialize: function (config) {\n this._super(config);\n\n this.id = config.id;\n this.profileData = fastlaneModel.profileData;\n this.isVisible = ko.observable(false);\n\n // Add subscription to profile data changes so we try to render again if needed.\n this.profileData.subscribe(this.renderWatermark.bind(this));\n\n return this;\n },\n\n /**\n * Gets whether the watermark is enabled for the email address section.\n *\n * @returns {Boolean}\n */\n isEmailWatermarkEnabled: function () {\n return this.id === 'paypal-fastlane-email-watermark'\n && window.checkoutConfig.payment.payment_services_paypal_fastlane.messaging;\n },\n\n /**\n * Gets whether the watermark is enabled for the shipping address section.\n *\n * @returns {Boolean}\n */\n isShippingWatermarkEnabled: function () {\n return this.id !== 'paypal-fastlane-email-watermark' && !!this.profileData();\n },\n\n shouldRenderWatermark: async function () {\n // Early return if Fastlane is not available.\n if (!isFastlaneAvailable()) {\n return false;\n }\n\n await fastlaneModel.setup();\n\n // Fastlane Watermark should be rendered based on the following:\n // - Email watermark is based on the branding configuration\n // - All others are based on whether we have profile data\n const shouldRender = this.isEmailWatermarkEnabled() || this.isShippingWatermarkEnabled();\n\n this.isVisible(shouldRender);\n },\n\n renderWatermark: async function () {\n await this.shouldRenderWatermark();\n\n if (this.isVisible()) {\n fastlaneModel.renderFastlaneWatermarkComponent(`#${this.id}`);\n }\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/form/element/change-address.js":"define([\n 'uiComponent',\n 'Magento_PaymentServicesPaypal/js/helpers/is-fastlane-available',\n 'Magento_PaymentServicesPaypal/js/view/payment/fastlane'\n], function (Component, isFastlaneAvailable, fastlaneModel) {\n 'use strict';\n\n return Component.extend({\n profileData: null,\n\n defaults: {\n template: 'Magento_PaymentServicesPaypal/form/element/change-address'\n },\n\n /**\n * Initialise the change address component.\n *\n * @returns {Object} Chainable.\n */\n initialize: function () {\n this._super();\n\n // Early return if Fastlane is not available\n if (!isFastlaneAvailable()) {\n return this;\n }\n\n this.profileData = fastlaneModel.profileData;\n\n return this;\n }
2,\n\n /**\n * Display the shipping address modal from Fastlane.\n *\n * @returns {void}\n */\n displayChangeShipping: async function () {\n fastlaneModel.displayChangeShipping();\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/form/element/email-mixin.js":"define([\n 'Magento_Checkout/js/model/step-navigator',\n 'Magento_PaymentServicesPaypal/js/helpers/is-fastlane-available',\n 'Magento_PaymentServicesPaypal/js/view/payment/fastlane'\n], function (stepsNavigator, isFastlaneAvailable, fastlaneModel) {\n 'use strict';\n\n var mixin = {\n shippingServiceSubscription: null,\n\n /**\n * Add mixin to the checkEmailAvailability so we can trigger Fastlane.\n */\n checkEmailAvailability: async function () {\n this._super();\n\n // Early return if this is not the shipping address email input.\n if (this.name !== 'checkout.steps.shipping-step.shippingAddress.customer-email') {\n return;\n }\n\n // Early return if Fastlane is not available\n if (!isFastlaneAvailable()) {\n return;\n }\n\n // Early return if we are already on the payment page.\n if (stepsNavigator.getActiveItemIndex() !== 0) {\n return;\n }\n\n await fastlaneModel.setup();\n\n // Check the entered email against Fastlane to see if we have an account.\n fastlaneModel.lookupCustomerByEmail(this.email());\n }\n };\n\n return function (target) {\n return target.extend(mixin);\n };\n});\n","Magento_PaymentServicesPaypal/js/view/product/grouped-product-data-provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['jquery', 'underscore', 'uiClass'], function ($, _, Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n tableWrapperSelector: '.table-wrapper.grouped',\n qtyFieldSelector: '.input-text.qty',\n priceBoxSelector: '[data-role=\"priceBox\"]',\n priceInfo: {}\n },\n\n /**\n * @inheritdoc\n */\n initialize: function () {\n this._super();\n $('tbody tr', this.tableWrapperSelector).each(function (index, element) {\n var priceBox = $(this.priceBoxSelector, element),\n qtyElement = $(this.qtyFieldSelector, element),\n productId = priceBox.data('productId'),\n priceElement = $('#product-price-' + productId);\n\n this.priceInfo[productId] = {\n qty: this.getQuantity(qtyElement),\n price: priceElement.data('priceAmount')\n };\n }.bind(this));\n this.quantitySubscribe();\n\n return this;\n },\n\n /**\n * Subscribe for quantity changes.\n */\n quantitySubscribe: function () {\n $(this.qtyFieldSelector).on('change', function (event) {\n var qtyElement = $(event.target),\n parent = qtyElement.parents('tr'),\n priceBox = $(this.priceBoxSelector, parent),\n productId = priceBox.data('productId');\n\n if (this.priceInfo[productId]) {\n this.priceInfo[productId].qty = this.getQuantity(qtyElement);\n }\n\n this.updateAmount(this.getAmount());\n }.bind(this));\n },\n\n /**\n * Get product amount.\n *\n * @return {Number}\n */\n getAmount: function () {\n var amount = 0;\n\n _.each(this.priceInfo, function (info) {\n amount += info.price * info.qty;\n });\n\n return amount;\n },\n\n /**\n * Get product quantity.\n *\n * @param {HTMLElement} element\n * @return {Number}\n */\n getQuantity: function (element) {\n var qty = parseFloat(element.val());\n\n return !isNaN(qty) && qty ? qty : 0;\n },\n\n /**\n * Checks if product is grouped type.\n *\n * @return {Boolean}\n */\n isProductGrouped: function () {\n return !!$(this.constructor.defaults.tableWrapperSelector).length;\n },\n\n /**\n * Subscribe for price change.\n */\n priceSubscribe: function () {\n },\n\n /**\n * Trigger price update.\n */\n updatePrice: function () {\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/product/product-data-provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['jquery', 'uiClass', 'priceBox'], function ($, Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n qtyFieldSelector: '#qty',\n priceBoxSelector: '.price-box',\n priceBoxContextSelector: '.product-info-main',\n finalPriceSelector: '[data-price-type=\"finalPrice\"]',\n price: 0,\n qty: 0\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.price = $(this.finalPriceSelector, this.priceBoxContextSelector).attr('data-price-amount');\n this.qty = $(this.qtyFieldSelector).val();
2\n this.quantitySubscribe();\n this.priceSubscribe();\n\n return this;\n },\n\n /**\n * Subscribe for quantity changes.\n */\n quantitySubscribe: function () {\n $(this.qtyFieldSelector).on('change', function () {\n this.qty = $(this.qtyFieldSelector).val();\n this.updateAmount(this.getAmount());\n }.bind(this));\n },\n\n /**\n * Subscribe for price change.\n */\n priceSubscribe: function () {\n $(this.priceBoxSelector, this.priceBoxContextSelector).on('updatePrice', function (event) {\n var prices = $(event.target).data('magePriceBox').cache.displayPrices;\n\n this.price = prices.finalPrice.amount;\n this.updateAmount(this.getAmount());\n }.bind(this));\n },\n\n /**\n * Trigger price update.\n */\n updatePrice: function () {\n $(this.priceBoxSelector).trigger('updatePrice');\n },\n\n /**\n * Get product amount.\n *\n * @return {Number}\n */\n getAmount: function () {\n return this.qty * this.price;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/product/gift-card-product-data-provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'underscore',\n 'Magento_PaymentServicesPaypal/js/view/product/product-data-provider'\n], function ($, _, Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n priceBoxContextSelector: '.giftcard-amount',\n priceBoxSelector: '#giftcard-amount, #giftcard-amount-input'\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.price = $(this.priceBoxSelector, this.priceBoxContextSelector).val();\n\n return this;\n },\n\n /**\n * Subscribe for price change.\n */\n priceSubscribe: function () {\n $(this.priceBoxSelector, this.priceBoxContextSelector).on('change', function (event) {\n this.price = event.target.value;\n this.updateAmount(this.getAmount());\n }.bind(this));\n },\n\n /**\n * Checks if product is grouped type.\n *\n * @return {Boolean}\n */\n isProductGiftCard: function () {\n return !!$(this.constructor.defaults.priceBoxContextSelector).length;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/product/bundle-product-data-provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'underscore',\n 'Magento_PaymentServicesPaypal/js/view/product/product-data-provider'\n], function ($, _, Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n priceBoxContextSelector: '#bundleSummary',\n slideSelector: '#bundle-slide'\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n // Need to track bundle product slide to trigger amount update to make message visible.\n $(this.slideSelector).on('click', function () {\n setTimeout(function () {\n this.updateAmount(this.getAmount());\n }.bind(this), 300);\n }.bind(this));\n this.updateAmount(this.getAmount());\n\n return this;\n },\n\n /**\n * Checks if product is grouped type.\n *\n * @return {Boolean}\n */\n isBundleProduct: function () {\n return !!$(this.constructor.defaults.priceBoxContextSelector).length;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/customer_account/vault/add-card-button.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget',\n 'mage/translate'\n], function ($) {\n 'use strict';\n\n $.widget('mage.cards', {\n /**\n * Bind event handlers for adding cards.\n * @private\n */\n _create: function () {\n let options = this.options;\n let addCard = options.addCard;\n\n if (addCard) {\n $(document).on('click', addCard, this._addCard.bind(this));\n }\n },\n\n /**\n * Add a new card.\n * @private\n */\n _addCard: function () {\n window.location = this.options.addCardLocation;\n }\n });\n\n return $.mage.cards;\n});\n","Magento_PaymentServicesPaypal/js/view/customer_account/vault/add-card-form.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n \"jquery\",\n \"underscore\",\n \"uiComponent\",\n \"scriptLoader\",\n 'Magento_PaymentServicesPaypal/js/lib/script-loader',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n], function ($, _, Component, loadSdkScript, scriptLoader, $t, customerData) {\n \"use strict\";\n\n const cardFormSubmitButton = document.getElementById(\"paymentservices-add-card-button\");\n const paymentServicesAddVaultCardContainer = document.getElementById(\"paymentservices_add_vault_card\");\n const cardFormAddress = $(\".form-address-edit\")\n\n return Component.extend({\n defaults: {\n template: \"Magento_PaymentServicesPaypal/customer_account/vault/add-card-form\",\n componentParams: null,\n paymentsSdk: null,\n paymentsSdkInitPromise: null,\n invalidFields: [],\n emptyErrorMessage: $t('This is a required field.'),\n fields: {\n number: {\n errorMessage: $t('Please enter a valid credit card number.'),\n },\n expirationDate: {\n errorMessage: $t('Incorrect credit card expiration date.'),\n },\n cvv: {\n errorMessage: $t('Please enter a valid credit card security code.'),\n }\n }\n },\n\n /**\n * @inheritdoc\n */\n initialize: function () {\n this._super()\n .observe('invalidFields');\n\n this.initPaymentsSDK(this.componentParams);\n\n return this;\n },\n\n initPaymentsSDK: function ({ paymentsSDKUrl, storeViewCode, oauthToken, graphQLEndpointUrl }) {\n this.showLoader(true);\n this.paymentsSdkInitPromise = scriptLoader\n .loadCustom({url: paymentsSDKUrl})\n .then(async () => {\n const sdkConfig = {\n storeViewCode: storeViewCode\n }\n\n if (oauthToken) {\n sdkConfig.getCustomerToken = () => oauthToken;\n }\n\n if (graphQLEndpointUrl) {\n sdkConfig.apiUrl = graphQLEndpointUrl;\n }\n\n this.paymentsSdk = new PaymentServicesSDK(sdkConfig)\n await this.paymentsSdk.Vault.init()\n });\n },\n\n /**\n * @inheritdoc\n */\n afterRender: function () {\n this.paymentsSdkInitPromise.then(async () => {\n\n this.showLoader(false);
2\n\n if (!this.paymentsSdk.Vault.CreditCard.isAvailable()) {\n paymentServicesAddVaultCardContainer.innerHTML = this.displayMessage($t(\"CreditCard Vault is not available.\"), 'error');\n return;\n }\n\n await this.paymentsSdk.Vault.CreditCard.render({\n styles: {\n input: {\n 'font-family': '\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif',\n 'font-size': '14px',\n 'font-weight': '400',\n 'border': '1px solid #c2c2c2',\n 'border-radius': '1px',\n 'padding': '0 9px',\n 'height': '32px',\n 'width': '100%',\n 'box-sizing': 'border-box',\n },\n ':focus': {\n color: '#333'\n },\n '.valid': {\n color: '#333'\n },\n '.invalid': {\n 'color': '#ed8380',\n 'box-shadow': 'none'\n },\n body: {\n 'margin': '0',\n 'padding': '0',\n },\n // Remove card icon\n \"input.card-field-number.display-icon + .card-icon\": {\n display: \"none !important\",\n height: \"0\",\n },\n // Unindent card number\n \"input.card-field-number.display-icon\": {\n padding: \"0 9px !important\",\n },\n },\n fields: {\n description: {selector: \"#card-vault-container #vault-card-description\"},\n number: {selector: \"#card-vault-container #vault-card-number\"},\n expirationDate: {selector: \"#card-vault-container #vault-expiration-date\"},\n cvv: {selector: \"#card-vault-container #vault-cvv\"},\n },\n onError: (error) => {\n this.addMessage($t(\"Error while vaulting the card, please try again.\"), \"error\");\n console.error(error.message)\n this.showLoader(false);\n },\n onCancel: () => {\n console.debug(\"user cancelled the card vaulting process\");\n this.showLoader(false);\n },\n getBillingAddress: this.getBillingAddress.bind(this),\n onSuccess: () => {\n this.showLoader(false);\n paymentServicesAddVaultCardContainer.innerHTML = this.displayMessage($t('Card vaulted successfully. Please wait to be redirected to the Stored Payment Methods page.'), 'success');\n\n // Redirect to saved card list page\n setTimeout(() => {\n window.location.replace(this.componentParams.savedCardListUrl);\n }, 3000);\n },\n onValidityChange: this.onValidityChange.bind(this),\n }).then((creditCardVault) => {\n cardFormSubmitButton.addEventListener(\"click\", () => {\n\n // Display errors for card fields\n if (!creditCardVault.isFormValid()) {\n var fields = creditCardVault.getFormState();\n Object.keys(fields).forEach((field) => {\n this.onValidityChange(fields, field);\n })\n creditCardVault.submit();\n }\n\n // Validate the address form\n if (!cardFormAddress.validation() || !cardFormAddress.validation('isValid')) {\
2n this.showLoader(false);\n return;\n }\n\n if (creditCardVault.isFormValid()) {\n this.showLoader(true);\n creditCardVault.submit();\n }\n });\n }).catch((e) => {\n this.showLoader(false);\n this.addMessage($t(\"Error rendering Payment SDK, please reload the page and try again.\"), \"error\");\n console.error('Error rendering Payments SDK', e);\n });\n }).catch((error) => {\n this.showLoader(false);\n paymentServicesAddVaultCardContainer.innerHTML = this.displayMessage($t(\"Error initializing Payment SDK, please reload the page and try again.\"), 'error');\n console.error(\"Error initializing Payment SDK:\", error);\n });\n },\n\n /**\n * Provide the billing address from the form\n */\n getBillingAddress: function () {\n const regionInput = cardFormAddress.find(\"[name='region']\").val();\n const regionIdDropdown = cardFormAddress.find(\"[name='region_id']\");\n const regionIdValue = regionIdDropdown.val();\n const regionIdLabel = regionIdDropdown.val() ? regionIdDropdown.find(`option[value='${regionIdValue}']`).text() : \"\";\n\n return {\n firstName: cardFormAddress.find(\"[name='firstname']\").val(),\n lastName: cardFormAddress.find(\"[name='lastname']\").val(),\n streetAddress: cardFormAddress.find(\"[name='street[0]']\").val(),\n extendedAddress: cardFormAddress.find(\"[name='street[1]']\").val(),\n region: regionIdDropdown.prop('disabled') ? regionInput : regionIdLabel,\n locality: cardFormAddress.find(\"[name='city']\").val(),\n postalCode: cardFormAddress.find(\"[name='postcode']\").val(),\n countryCodeAlpha2: cardFormAddress.find(\"[name='country_id']\").val(),\n };\n },\n\n /**\n * Show/hide loader.\n *\n * @param {Boolean} show\n */\n showLoader: function (show) {\n var event = show ? 'processStart' : 'processStop';\n\n $('body').trigger(event);\n },\n\n /**\n * Add message to customer data.\n *\n * @param {String} message\n * @param {String} [type]\n */\n addMessage: function (message, type) {\n type = type || 'error';\n customerData.set('messages', {\n messages: [{\n type: type,\n text: message\n }],\n 'data_id': Math.floor(Date.now() / 1000)\n });\n },\n\n onValidityChange: function (fields, emittedBy) {\n var valid = _.every(fields, function (field) {\n return field.isValid\n });\n\n var invalidFields = this.invalidFields().filter(field => field.name !== emittedBy);\n\n if (!valid) {\n if (fields[emittedBy] && !fields[emittedBy].isValid) {\n invalidFields.push({\n name: emittedBy,\n message: fields[emittedBy].isEmpty ? this.emptyErrorMessage : this.fields[emittedBy].errorMessage\n });\n }\n this.invalidFields(invalidFields)\n } else {\n this.invalidFields([]);\n }\n },\n\n isFieldValid: function (fieldName) {\n return !this.invalidFields.findWhere({\n name: fieldName\n });\n },\n\n getFieldErrorMessage: function (fieldName) {\n return !this.isFieldValid(fieldName) ? this.invalidFields.findWhere({\n name: fieldName\n }).message : '';\n },\n\n displayMessage: function (text, type) {\n return `<div class=\"${type} message\"><div>${$t(text)}</div></div>`;\n },\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/message-product.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'Magento_PaymentServicesPaypal/js/view/payment/message',\n 'Magento_PaymentServicesPaypal/js/view/product/product-data-provider',\n 'Magento_PaymentServicesPaypal/js/view/product/grouped-product-data-provider',\n 'Magento_PaymentServicesPaypal/js/view/product/bundle-product-data-provider',\n 'Magento_PaymentServicesPaypal/js/view/product/gift-card-product-data-provider'\n], function (\n Component,\n Message,\n ProductDataProvider,\n GroupedProductDataProvider,\n BundledProductDataProvider,\n GiftCardProductDataProvider\n) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalProduct',\n element: null,\n message: null\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n var providerOptions = {\n updateAmount: this.updateAmount.bind(this)\n };\n\n this.element = element;\n this._super();\n\n if (GroupedProductDataProvider.prototype.isProductGrouped()) {\n this.provider = new GroupedProductDataProvider(providerOptions);\n } else if (BundledProductDataProvider.prototype.isBundleProduct()) {\n this.provider = new BundledProductDataProvider(providerOptions);\n } else if (GiftCardProductDataProvider.prototype.isProductGiftCard()) {\n this.provider = new GiftCardProductDataProvider(providerOptions);\n } else {\n this.provider = new ProductDataProvider(providerOptions);\n }
2\n this.getSdkParams()\n .then(this.initMessage.bind(this))\n .then(this.render.bind(this));\n },\n\n /**\n * Create instance of messages.\n */\n initMessage: function () {\n this.message = new Message({\n sdkNamespace: this.sdkNamespace,\n scriptParams: this.sdkParams,\n element: this.element,\n renderContainer: this.renderContainer,\n styles: this.styles,\n placement: this.placement,\n amount: this.provider.getAmount()\n });\n },\n\n /**\n * Update message amount.\n */\n updateAmount: function () {\n this.message && this.message.updateAmount(this.provider.getAmount());\n },\n\n /**\n * Render the message\n */\n render: function () {\n this.message.render();\n this.provider.updatePrice();\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/apple-pay-product.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'underscore',\n 'mageUtils',\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/apple-pay',\n], function ($, _, utils, Component, $t, customerData, ResponseError, ApplePayButton) {\n 'use strict';\n\n const HTTP_STATUS_OK = 200;\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalApplePay',\n scriptParams: {},\n buttonContainerId: 'apple-pay-${ $.uid }',\n template: 'Magento_PaymentServicesPaypal/payment/apple-pay',\n paymentsOrderId: null,\n paypalOrderId: null,\n sdkLoaded: null,\n quoteIdForRest: null,\n quoteId: null,\n sdkParamsKey: 'applepay',\n paymentTypeIconTitle: $t('Pay with Apple Pay'),\n notEligibleErrorMessage: $t('This payment option is currently unavailable.'),\n productFormSelector: '#product_addtocart_form'\n },\n\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n _.bindAll(this, 'initApplePayButton', 'onClick', 'afterUpdateQuote', 'beforeCreateOrder',\n 'afterCreateOrder', 'afterOnAuthorize', 'onCancel');\n config.uid = utils.uniqueid();\n this._super();\n this.element = element;\n this.element.id = this.buttonContainerId;
2\n this.getSdkParams()\n .then(this.initApplePayButton)\n .catch(console.log);\n\n return this;\n },\n\n initApplePayButton: function () {\n this.applePayButton = new ApplePayButton({\n scriptParams: this.sdkParams,\n createOrderUrl: this.createOrderUrl,\n updateQuoteUrl: this.authorizeOrderUrl,\n shippingInformationWhenGuestUrl: this.shippingInformationWhenGuestUrl,\n shippingInformationWhenLoggedInUrl: this.shippingInformationWhenLoggedInUrl,\n estimateShippingMethodsWhenGuestUrl: this.estimateShippingMethodsWhenGuestUrl,\n estimateShippingMethodsWhenLoggedInUrl: this.estimateShippingMethodsWhenLoggedInUrl,\n updatePayPalOrderUrl: this.updatePayPalOrderUrl,\n setQuoteAsInactiveUrl: this.setQuoteAsInactiveUrl,\n countriesUrl: this.countriesUrl,\n placeOrderUrl: this.placeOrderUrl,\n onClick: this.onClick,\n beforeCreateOrder: this.beforeCreateOrder,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n onError: this.catchError,\n buttonContainerId: this.buttonContainerId,\n afterUpdateQuote: this.afterUpdateQuote,\n shippingAddressRequired: !this.isVirtual,\n styles: this.styles,\n afterOnAuthorize: this.afterOnAuthorize,\n onCancel: this.onCancel,\n location: this.pageType,\n });\n\n $('#' + this.buttonContainerId).on('click', this.onClick);\n\n this.applePayButton.sdkLoaded\n .then(this.applePayButton.initAppleSDK);\n }
2,\n\n afterUpdateQuote: function (data) {\n window.location = data.redirectUrl;\n this.applePayButton.showLoader(false);\n },\n\n onClick: function () {\n\n var $form = $(this.productFormSelector);\n\n if ($form.data('mageValidation')) {\n this.formValid = $form.validation('isValid');\n }\n\n if (this.formValid) {\n this.applePayButton.showLoaderAsync(true)\n .then(() => {\n return this.applePayButton.createOrder();\n })\n .then(() => {\n refreshCustomerData(this.createOrderUrl);\n })\n .catch(error => {\n this.applePayButton.catchError(error);\n });\n }\n },\n\n setQuoteInactive: function () {\n // Set Quote as inactive to avoid having multiple active quotes for the customer\n $.ajax({\n type: 'POST',\n url: this.setQuoteAsInactiveUrl,\n });\n },\n\n showPopup: function (paymentData) {\n\n const paymentRequest = {\n countryCode: this.applePayButton.applePayConfig.countryCode,\n merchantCapabilities: this.applePayButton.applePayConfig.merchantCapabilities,\n supportedNetworks: this.applePayButton.applePayConfig.supportedNetworks,\n currencyCode: String(paymentData['currencyCode']),\n requiredShippingContactFields: [\"name\", \"phone\", \"email\", \"postalAddress\"],\n requiredBillingContactFields: [\"postalAddress\"],\n total: {\n label: $t(\"Summary\"),\n type: \"final\",\n amount: Number(paymentData['totalPrice']).toString(),\n }\n };\n\n // See https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession\n this.applePaySession = new ApplePaySession(this.applePayButton.applePayVersionNumber, paymentRequest);\n this.applePayButton.onApplePayValidateMerchant(this.applePaySession);\n this.applePayButton.onApplePayCancel(this.applePaySession, this.setQuoteInactive.bind(this));\n this.applePayButton.onApplePayShippingContactSelected(this.applePaySession, this.quoteIdForRest, paymentRequest.total, null);\n this.applePayButton.onApplePayShippingMethodSelected(this.applePaySession, this.quoteId, this.quoteIdForRest, this.paypalOrderId);\n this.applePayButton.onApplePayPaymentAuthorized(this.applePaySession);\n\n this.applePaySession.begin();\n },\n\n /**\n * Before create order.\n *\n * @return {String}\n */\n beforeCreateOrder: function () {\n if (this.formInvalid) {\n throw new Error('Form is Invalid');\n }\n\n let xhr = new XMLHttpRequest();\n xhr.open('POST', this.addToCartUrl, false);\n xhr.send(new FormData($(this.productFormSelector)[0]));\n\n if (xhr.status !== HTTP_STATUS_OK) {\n throw new Error('Request failed');\n } else {\n try {\n let result = JSON.parse(xhr.responseText);\n\n if (typeof result.success !== 'undefined') {\n refreshCustomerData(this.addToCartUrl);\n this.quoteIdForRest = result.success.quoteIdMask;\n this.quoteId = result.success.quoteId;\n return result.success;\n }\n } catch (parseError) {\n throw new Error('Failed to parse response JSON: ' + parseError.message);\n }\n }\n },\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}
2\n */\n afterCreateOrder: function (data) {\n if (data.response['paypal-order'] && data.response['paypal-order']['mp_order_id']) {\n this.paymentsOrderId = data.response['paypal-order']['mp_order_id'];\n this.paypalOrderId = data.response['paypal-order'].id;\n\n this.showPopup({\n displayItems: [],\n currencyCode: data.response['paypal-order']['currency_code'],\n totalPriceStatus: 'FINAL',\n totalPrice: Number(data.response['paypal-order']['amount']).toString(),\n totalPriceLabel: $t('Total')\n });\n\n return this.paypalOrderId;\n }\n\n throw new Error();\n },\n\n afterOnAuthorize: function (data) {\n\n this.applePayButton.showLoaderAsync(true)\n .then(() => {\n fetch(this.placeOrderUrl, {\n method: 'POST'\n }).then(response => {\n if (response.redirected && response.url.includes(\"review\")) {\n throw new Error();\n }\n return response.text();\n }).then(result => {\n if (result) {\n customerData.invalidate(['cart']);\n document.open();\n document.write(result);\n document.close();\n }\n })\n .catch(error => {\n this.applePayButton.showLoader(false);\n this.applePayButton.catchError(error);\n });\n })\n .catch(error => {\n this.catchError(error);\n });\n },\n\n /**\n * Redirect to cart on cancel.\n *\n * @param {Object} data\n * @param {Object} actions\n */\n onCancel: function () {\n customerData.invalidate(['cart']);\n window.location = this.cancelUrl;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/smart-buttons-cart.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'jquery',\n 'mageUtils',\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'scriptLoader',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/smart-buttons',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error'\n], function (_, $, utils, Component, loadSdkScript, SmartButtons, $t, customerData, ResponseError) {\n 'use strict';\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalCart',\n buttonsContainerId: 'smart-buttons-${ $.uid }',\n element: null,\n paymentActionError: $t('Something went wrong with your request. Please try again later.'),\n isErrorDisplayed: false\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n _.bindAll(this, 'renderButtons', 'initSmartButtons', 'catchError', 'beforeCreateOrder', 'afterCreateOrder',\n 'beforeOnAuthorize', 'onCancel');\n config.uid = utils.uniqueid();\n this._super();\n this.element = element;\n this.element.id = this.buttonsContainerId;
2\n this.getSdkParams()\n .then(this.initSmartButtons)\n .then(this.renderButtons)\n .catch(function (e) {\n console.log(e);\n });\n\n return this;\n },\n\n /**\n * Create instance of smart buttons.\n */\n initSmartButtons: function () {\n this.buttons = new SmartButtons({\n sdkNamespace: this.sdkNamespace,\n scriptParams: this.sdkParams,\n styles: this.styles,\n createOrderUrl: this.createOrderUrl,\n placeOrderUrl: this.placeOrderUrl,\n authorizeOrderUrl: this.authorizeOrderUrl,\n completeOrderUrl: this.completeOrderUrl,\n beforeCreateOrder: this.beforeCreateOrder,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n finallyCreateOrder: this.showLoader.bind(this, false),\n beforeOnAuthorize: this.beforeOnAuthorize,\n afterOnAuthorize: this.afterOnAuthorize,\n catchOnAuthorize: this.catchError,\n finallyOnAuthorize: this.showLoader.bind(this, false),\n onError: this.catchError,\n onCancel: this.onCancel,\n location: this.pageType,\n });\n },\n\n /**\n * Render buttons\n */\n renderButtons: function () {\n if (!this.buttons || !this.buttons.sdkLoaded) {\n return;\n }\n\n this.buttons.sdkLoaded.then(function () {\n var containerSelector = '#' + this.buttonsContainerId;\n if ($(containerSelector).length > 0) {\n this.buttons.render(containerSelector);\n } else {\n console.warn('PayPal button container not found:', containerSelector);\n }\n }.bind(this)).catch(function () {\n console.log('Error: Failed to load PayPal SDK script!');\n });\n },\n\n /**\n * Show/hide loader.\n *\n * @param {Boolean} show\n */\n showLoader: function (show) {\n var event = show ? 'processStart' : 'processStop';\n\n $('body').trigger(event);\n },\n\n /**\n * Catch errors.\n *\n * @param {*} error\n */\n catchError: function (error) {\n var message = error instanceof ResponseError ? error.message : this.paymentActionError;\n\n this.showLoader(false);\n\n if (this.isErrorDisplayed) {\n return;\n }\n this.addMessage(message);\n this.isErrorDisplayed = true;\n },\n\n /**\n * Add message to customer data.\n *\n * @param {String} message\n * @param {String} [type]\n */\n addMessage: function (message, type) {\n type = type || 'error';\n customerData.set('messages', {\n messages: [{\n type: type,\n text: message\n }],\n 'data_id': Math.floor(Date.now() / 1000)\n });\n },\n\n /**\n * Before create order.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n this.isErrorDisplayed = false;\n this.showLoader(true);\n\n return Promise.resolve();\n },\n\n /**\n * After order id created.\n *\n * @param {Object} res\n * @return {*}\n */\n afterCreateOrder: function (res) {\n if (res.response['is_successful']) {\n refreshCustomerData(this.createOrderUrl);\n\n return res.response['paypal-order'].id;\n }\n\n throw new ResponseError(res.response.error);\n },\n\n /**\n * Before onAuthorize execute\n *\n * @param {Object} data\n * @return {Promise}
2\n */\n beforeOnAuthorize: function (data) {\n this.showLoader(true);\n\n return Promise.resolve(data);\n },\n\n /**\n * Redirect to cart on cancel.\n *\n * @param {Object} data\n * @param {Object} actions\n */\n onCancel: function (data, actions) {\n customerData.invalidate(['cart']);\n actions.redirect(this.cancelUrl);\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/message.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'uiComponent',\n 'scriptLoader'\n], function ($, Component, loadSdkScript) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypal',\n renderContainer: null,\n amountAttribute: 'data-pp-amount',\n amount: null\n },\n\n /**\n * @inheritdoc\n */\n initialize: function () {\n this._super();\n this.sdkLoaded = loadSdkScript(this.scriptParams, this.sdkNamespace);\n\n return this;\n },\n\n /**\n * Update amount\n *\n * @param {*} amount\n */\n updateAmount: function (amount) {\n this.amount = amount;\n $(this.renderContainer).attr(this.amountAttribute, this.amount);\n },\n\n /**\n * Render message\n *\n * @return {Promise}\n */\n render: function () {\n return this.sdkLoaded.then(function (sdkScript) {\n const styles = this.getStyles();\n\n if (!styles) {\n return;\n }\n\n sdkScript.Messages({\n amount: parseFloat(this.amount).toFixed(2),\n placement: this.placement,\n style: styles\n })\n .render(this.renderContainer);\n }.bind(this)).catch(function (exception) {\n console.log('Error: Failed to load PayPal SDK script!');\n console.log(exception.message);\n });\n },\n\n /**\n * Gets the Pay Later Message styling for the given placement.\n *\n * Returns null if the placement is disabled.\n *\n * @returns {Object|bool}\n */\n getStyles: function () {\n if (!this.styles) {\n return {};\n }\n\n let parsedStyles = JSON.parse(this.styles),\n placement = this.placement === 'payment' ? 'checkout' : this.placement,\n styles = parsedStyles[placement];\n\n if (!styles) {\n return false;\n }\n\n return styles;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/google-pay-cart.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'jquery',\n 'mageUtils',\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/google-pay'\n], function (_, $, utils, Component, $t, customerData, ResponseError, GooglePayButton) {\n 'use strict';\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalGooglePay',\n sdkParamsKey: 'googlepay',\n buttonContainerId: 'google-pay-${ $.uid }',\n paymentActionError: $t('Something went wrong with your request. Please try again later.'),\n isErrorDisplayed: fal
2se\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n _.bindAll(this, 'initGooglePayButton', 'onClick',\n 'afterOnAuthorize', 'catchError', 'onCancel');\n config.uid = utils.uniqueid();\n this._super();\n this.element = element;\n this.element.id = this.buttonContainerId;\n this.getSdkParams()\n .then(this.initGooglePayButton)\n .catch(console.log);\n\n return this;\n },\n\n initGooglePayButton: function () {\n this.googlePayButton = new GooglePayButton({\n scriptParams: this.sdkParams,\n createOrderUrl: this.createOrderUrl,\n updateQuoteUrl: this.authorizeOrderUrl,\n onClick: this.onClick,\n catchCreateOrder: this.catchError,\n onError: this.catchError,\n buttonContainerId: this.buttonContainerId,\n afterOnAuthorize: this.afterOnAuthorize,\n shippingAddressRequired: !this.isVirtual,\n styles: this.styles,\n onCancel: this.onCancel,\n mode: this.googlePayMode,\n getOrderDetailsUrl: this.getOrderDetailsUrl,\n threeDSMode: this.threeDSMode,\n location: this.pageType,\n });\n\n this.googlePayButton.sdkLoaded\n .then(this.googlePayButton.initGoogleSDK);\n }
2,\n\n afterOnAuthorize: function (data) {\n window.location = data.redirectUrl;\n this.googlePayButton.showLoader(false);\n },\n\n onClick: function () {\n this.isErrorDisplayed = false;\n\n this.googlePayButton.showLoaderAsync(true)\n .then(() => {\n return this.googlePayButton.createOrder();\n })\n .then(() => {\n refreshCustomerData(this.createOrderUrl);\n })\n .catch(error => {\n this.catchError(error);\n });\n },\n\n /**\n * Catch errors.\n *\n * @param {*} error\n */\n catchError: function (error) {\n var message = error instanceof ResponseError ? error.message : this.paymentActionError;\n\n console.log(error);\n\n this.googlePayButton.showLoader(false);\n\n if (this.isErrorDisplayed) {\n return;\n }\n\n if (error.hidden === undefined || !error.hidden) {\n this.addMessage(message);\n }\n\n this.isErrorDisplayed = true;\n },\n\n /**\n * Add message to customer data.\n *\n * @param {String} message\n * @param {String} [type]\n */\n addMessage: function (message, type) {\n type = type || 'error';\n customerData.set('messages', {\n messages: [{\n type: type,\n text: message\n }],\n 'data_id': Math.floor(Date.now() / 1000)\n });\n },\n\n /**\n * Redirect to cart on cancel.\n *\n * @param {Object} data\n * @param {Object} actions\n */\n onCancel: function () {\n customerData.invalidate(['cart']);\n window.location = this.cancelUrl;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/fastlane.js":"define([\n 'jquery',\n 'knockout',\n 'uiRegistry',\n 'mage/translate',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/action/select-payment-method',\n 'Magento_Checkout/js/action/set-shipping-information',\n 'Magento_Checkout/js/checkout-data',\n 'Magento_Checkout/js/model/shipping-service',\n 'Magento_Checkout/js/model/step-navigator',\n 'Magento_Customer/js/model/address-list',\n 'Magento_Ui/js/model/messageList',\n 'Magento_PaymentServicesPaypal/js/helpers/get-allowed-locations',\n 'Magento_PaymentServicesPaypal/js/helpers/map-address-to-fastlane',\n 'Magento_PaymentServicesPaypal/js/helpers/map-address-to-magento',\n 'scriptLoader'\n], function ($, ko, uiRegistry, $t, quote, selectPaymentMethodAction, setShippingInformationAction, checkoutData,\n shippingService, stepNavigator, addressList, messageList,\n getAllowedLocations, mapAddressToFastlane, mapAddressToMagento, loadSdkScript) {\n 'use strict';\n\n return {\n code: 'payment_services_paypal_fastlane',\n clientInstance: null,\n fastlaneInstance: null,\n fastlanePaymentComponent: null,\n fastlaneWatermarkComponent: null,\n deviceData: null,\n runningSetup: null,\n customerContextId: null,\n profileData: ko.observable(null),\n email: null,\n sdkNamespace: 'paypalFastlane',\n\n /**\n * Creates the Fastlane instance.\n *\n * The Fastlane instance is assigned to this.fastlaneInstance.\n *\n * @returns {void}\n */\n createFastlaneInstance: function () {\n return new Promise((resolve) => {\n const braintreeVersion = '3.116.2';\n const fastlaneRequire = require.config({\n context: 'fastlane',\n paths: {\n braintree: `https://js.braintreegateway.com/web/${braintreeVersion}/js`,\n fastlane: 'https://www.paypalobjects.com/connect-boba',\n 'fastlane/axo.min': 'https://www.paypalobjects.com/connect-boba/axo',\n },\n shim: {\n 'fastlane/axo': {\
2n deps: ['braintree/client', 'braintree/hosted-fields'],\n },\n 'fastlane/axo.min': {\n deps: ['braintree/client.min', 'braintree/hosted-fields.min'],\n },\n },\n });\n\n fastlaneRequire(['fastlane/axo.min'], () => {\n (async () => {\n window.braintree = window.braintree || {};\n window.braintree.client = await new Promise(resolve => fastlaneRequire(['braintree/client.min'], resolve));\n window.braintree.hostedFields = await new Promise(resolve => fastlaneRequire(['braintree/hosted-fields.min'], resolve));\n window.braintree.version = braintreeVersion;\n\n await loadSdkScript(window.checkoutConfig.payment[this.getCode()].sdkParams, this.sdkNamespace)\n\n const fastlaneInstance = await window[this.sdkNamespace].Connect({\n shippingAddressOptions: {\n allowedLocations: getAllowedLocations(),\n },\n styles: this.getStyles()\n });\n\n resolve(fastlaneInstance);\n })();\n });\n });\n },\n\n /**\n * Return the payment method code.\n *\n * @returns {string}\n */\n getCode: function () {\n return this.code;\n },\n\n getStyles: function () {\n return {\n root: {\n backgroundColor: window.checkoutConfig.payment[this.getCode()].styling.rootBackgroundColor,\n errorColor: window.checkoutConfig.payment[this.getCode()].styling.rootErrorColor,\n fontFamily: window.checkoutConfig.payment[this.getCode()].styling.rootFontFamily,\n fontSizeBase: window.checkoutConfig.payment[this.getCode()].styling.rootFontSize,\n padding: window.checkoutConfig.payment[this.getCode()].styling.rootPadding,\n primaryColor: window.checkoutConfig.payment[this.getCode()].styling.rootPrimaryColor,\n textColorBase: window.checkoutConfig.payment[this.getCode()].styling.rootTextColor,\n },\n input: {\n backgroundColor: window.checkoutConfig.payment[this.getCode()].styling.inputBackgroundColor,\n borderColor: window.checkoutConfig.payment[this.getCode()].styling.inputBorderColor,\n borderRadius: window.checkoutConfig.payment[this.getCode()].styling.inputBorderRadius,\n borderWidth: window.checkoutConfig.payment[this.getCode()].styling.inputBorderWidth,\n focusBorderColor: window.checkoutConfig.payment[this.getCode()].styling.inputFocusBorderColor,\n textColorBase: window.checkoutConfig.payment[this.getCode()].styling.inputTextColor,\n }\n };\n },\n\n /**\n * Setups all the required instances needed for Fastlane.\n *\n * @returns {Promise} A promise that completes once the client, data collector and Fastlane instances\n * have been created.\n */\n setup: async function () {\n // If the Fastlane instance has already been creates then immediately return a completed promise.\n if (this.fastlaneInstance !== null) {\n return Promise.resolve();\n }\n\n // There are multiple different components that can call the setup function at the same time so this\n // is in place to prevent creating multiple instances.\n if (this.runningSetup) {\n return this.runningSetup;\n }\n\n this.runningSetup = new Promise(async (resolve) => {\n this.attachStepsListener();\n\n if (this.fastlaneInstance === null) {\n this.fastlaneInstance = await this.createFastlaneInstance();\n }\n\n resolve();\n });\n\n return this.runningSetup;\n },\n\n /**\n * Attach a listener on the steps so that going to payment page opens Fastlane by default.\n */\n attachStepsListener: function () {\n stepNavigator.steps.subscribe((steps) =>
2 {\n const payment = steps.find(({ code }) => code === 'payment');\n\n // Check against a few things:\n // 1. The payment step is visible\n // 2. The User has authenticated with Fastlane\n // 3. No other payment method has been selected\n if (payment.isVisible() && this.profileData() && !quote.paymentMethod()) {\n checkoutData.setSelectedPaymentMethod(this.code);\n selectPaymentMethodAction({ method: this.code });\n }\n });\n },\n\n /**\n * Run the lookup for an email address within Fastlane.\n *\n * This will reset data within this.profileData and this.customerContextId and then trigger\n * another authentication if a new account is found.\n *\n * @param {string} email\n * @returns {void}\n */\n lookupCustomerByEmail: async function (email) {\n // Early return if we haven't run setup and got a valid Fastlane instance.\n if (!this.fastlaneInstance) {\n return;\n }\n\n try {\n this.showLoader(true);\n\n // When we perform another lookup destroy all existing data.\n this.profileData(null);\n this.customerContextId = null;\n\n // Lookup the new User.\n const { customerContextId } = await this.fastlaneInstance?.identity?.lookupCustomerByEmail(email) || {};\n\n this.showLoader(false);\n\n this.customerContextId = customerContextId;\n\n // If we have do have an account then trigger the authentication.\n if (this.customerContextId) {\n return this.triggerAuthenticationFlow();\n }\n } catch (error) {\n console.warn(error);\n this.showLoader(false);\n }\n },\n\n /**\n * Checks whether the quote already contains a customer email address and shipping address.\n *\n * @param {Object} profileData - The complete profile data as gathered from Fastlane.\n * @param {Object} [profileData.card] - Optional card data object.\n * @param {Object} [profileData.name] - Optional name data object.\n * @param {Object} [profileData.shippingAddress] - Optional shipping address object.\n * @returns {Boolean}\n */\n quoteHasAddressSaved: function (profileData) {\n return !this.email\n && profileData?.shippingAddress?.address?.addressLine1\n && !quote.shippingAddress().postcode;\n },\n\n /**\n * Checks whether the User has changed their email address against the quote.\n *\n * @returns {Boolean}\n */\n userHasChangedEmailAddress: function () {\n return this.email && this.email !== quote.guestEmail;\n },\n\n /**\n * Trigger the authentication flow within Fastlane.\n *\n * Once the User has finished the action the information will be available within this.profileData.\n *\n * @returns {void}\n */\n triggerAuthenticationFlow: async function () {\n // Early return if we haven't run setup and got a valid Fastlane instance.\n if (!this.fastlaneInstance) {\n return;\n }\n\n this.showLoader(true);\n const { profileData }\n = await this.fastlaneInstance.identity.triggerAuthenticationFlow(this.customerContextId);\n\n this.showLoader(false);
2\n\n // With the account data push it into the required models.\n if (profileData) {\n // Before processing the data we need to check for a few things:\n // - If there is no email address already but we do have a postcode then don't override as this will\n // be a custom address set by the User.\n // - If we have an email address stored but it doesn't match with the quote then the User must have\n // updated their email address and authenticated so process their new profile data.\n if (this.quoteHasAddressSaved(profileData) || this.userHasChangedEmailAddress()) {\n this.processUserData(profileData);\n }\n\n // Store the current email address and profile data.\n this.email = quote.guestEmail;\n this.profileData(profileData);\n }\n },\n\n /**\n * Renders the Fastlane card component inside the given css selector.\n *\n * @param {string} selector The css selector where to render the card component.\n * @returns {void}\n */\n renderFastlanePaymentComponent: async function (selector) {\n // Early return if we haven't run setup and got a valid Fastlane instance.\n if (!this.fastlaneInstance) {\n return;\n }\n\n // If there is no customer context ID they must have reloaded on the payment page so trigger the\n // authentication here again.\n if (this.customerContextId === null) {\n await this.lookupCustomerByEmail(quote.guestEmail);\n }\n\n const shippingAddress = mapAddressToFastlane(quote.shippingAddress()),\n fields = {\n phoneNumber: {\n prefill: this.profileData()?.shippingAddress?.phoneNumber\n || quote.shippingAddress().telephone || ''\n },\n cardholderName: {\n // Enabled flag currently not available within Fastlane SDK but leaving functionality\n // in as it will be in a later release.\n // enabled: window.checkoutConfig.fastlane.show_cardholder_name,\n prefill: shippingAddress.firstName && shippingAddress.lastName\n ? `${shippingAddress.firstName} ${shippingAddress.lastName}` : ''\n }\n },\n styles = this.getStyles();\n\n this.fastlanePaymentComponent = await this.fastlaneInstance\n .FastlanePaymentComponent({ fields, shippingAddress, styles });\n this.fastlanePaymentComponent.render(selector);\n },\n\n /**\n * Shows the address Fastlane address selector.\n *\n * When the User selects a new address this will automatically call `processUserData` with the updated\n * information.\n *\n * @returns {void}\n */\n displayChangeShipping: async function () {\n // Early return if we haven't run setup and got a valid Fastlane instance.\n if (!this.fastlaneInstance?.profile) {\n return;\n }\n\n this.showLoader(true);\n\n const {\n selectionChanged,\n selectedAddress\n } = await this.fastlaneInstance.profile.showShippingAddressSelector();\n\n if (selectionChanged) {\n this.processUserData({ shippingAddress: selectedAddress });\n }\n\n this.showLoader(false);\n },\n\n /**\n * Renders the Fastlane watermark into the given selector.\n * @param {string} selector The css selector where to render the watermark component.\n * @returns {void}\n */\n renderFastlaneWatermarkComponent: async function (selector) {\n // Early return if we haven't run setup and got a valid Fastlane instance.\n if (!this.fastlaneInstance) {\n return;\n }\n\n // Make sure the element still exists.\n if (!document.querySelector(selector)) {\
2n return;\n }\n\n this.fastlaneWatermarkComponent = await this.fastlaneInstance.FastlaneWatermarkComponent({\n includeAdditionalInfo: true\n });\n this.fastlaneWatermarkComponent.render(selector);\n },\n\n /**\n * Handles all of the data from Fastlane and populating that into Adobe Commerce checkout models.\n *\n * @param {Object} profileData - The complete profile data as gathered from Fastlane.\n * @param {Object} [profileData.card] - Optional card data object.\n * @param {Object} [profileData.name] - Optional name data object.\n * @param {Object} [profileData.shippingAddress] - Optional shipping address object.\n * @returns {void}\n */\n processUserData: async function (profileData) {\n // Clean up any existing subscriptions so we don't add more than one at a time.\n if (this.shippingServiceSubscription) {\n this.shippingServiceSubscription.dispose();\n }\n\n try {\n // If the quote is virtual then open paypal and stop.\n if (quote.isVirtual()) {\n selectPaymentMethodAction({ method: this.code });\n return;\n }\n\n const shippingAddress = uiRegistry.get('checkout.steps.shipping-step.shippingAddress'),\n mappedAddress = mapAddressToMagento(profileData.shippingAddress);\n\n // Subscribe to get the updated shipping rates.\n this.shippingServiceSubscription = shippingService.getShippingRates().subscribe(function (rates) {\n this.shippingServiceSubscription.dispose();\n\n // Filter out the \"instore\" option as we cannot select the pickup location\n rates = rates.filter(function (rate) {\n return rate.carrier_code !== 'instore';\n });\n\n if (!rates || !rates.length) {\n this.redirectToShipping();\n return;\n }\n\n // If the shipping address is valid and we have some shipping rates then set the data to quote.\n if (!shippingAddress.source.get('params.invalid') && rates && rates[0]) {\n shippingAddress.selectShippingMethod(rates[0]);\n\n setShippingInformationAction().done(\n function () {\n // If we are on the first step of the checkout then we can skip to the next step.\n if (stepNavigator.getActiveItemIndex() === 0) {\n stepNavigator.next();\n }\n }\n );\n }\n }.bind(this));\n\n // Push mapped address into the correct models which will trigger getting the updated shipping methods.\n addressList.push(mappedAddress);\n this.addAddressToCheckoutProvider(mappedAddress);\n\n shippingAddress.source.set('params.invalid', false);\n shippingAddress.triggerShippingDataValidateEvent();\n\n if (shippingAddress.source.get('params.invalid')) {\n this.redirectToShipping();\n }\n } catch {\n messageList.addErrorMessage({\n message: $t('The selected shipping address is not available to be used. Please enter a new one.')\n });\n this.showLoader(false);\n }\n },\n\n /**\n * Redirects the User back to the shipping step.\n * @returns {void}\n */\n redirectToShipping: function () {\n stepNavigator.setHash('shipping');\n this.showLoader(false);\n },\n\n /**\n * Push the new address into the checkout provider.\n *\n * @param {Object} address - A complete address object in the correct Adobe Commerce format.\n * @returns {void}\n */\n addAddressToCheckoutProvider: function (address) {\n const checkoutProvider = uiRegistry.get('checkoutProvider');\n const billingAddress = uiRegistry.get('checkout.steps.billing-step.payment.payments-list.paypal_billing_agreement-form');\n\n checkoutProvider.set(\n 'shippingAddress',\n address\n );\n\n // If the billing address is set to be the same as the shipping then update the billing address with\n // the same changed address.\n if (billingAddress && billingAddress.isAddressSameAsShipping()) {\n quote.shippingAddress({ ...address, street: Object.values(address.street) });\n quote.billingAddress({ ...address, street: Object.values(address.street) });\n }\n },\n\n /**\n * Get the payment token.\n *\n * @returns {Promise}\n */\n getPaymentToken: function () {\n if (!this.fastlanePaymentComponent) {\n const error = new Error();
2\n\n error.name = 'paypal_paypal:undefined_component';\n throw error;\n }\n\n return this.fastlanePaymentComponent.getPaymentToken();\n },\n\n /**\n * Show/hide loader.\n *\n * @param {Boolean} show\n */\n showLoader: function (show) {\n var event = show ? 'processStart' : 'processStop';\n\n $('body').trigger(event);\n },\n };\n});\n","Magento_PaymentServicesPaypal/js/view/payment/vault.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*browser:true*/\n\n/* @api */\ndefine([\n 'underscore',\n 'uiComponent',\n 'mage/translate',\n 'Magento_Checkout/js/model/payment/renderer-list',\n 'uiLayout',\n 'uiRegistry'\n], function (_, Component, $t, rendererList, layout, registry) {\n 'use strict';\n\n var vaultGroupName = 'vaultGroup';\n\n layout([{\n name: vaultGroupName,\n component: 'Magento_Checkout/js/model/payment/method-group',\n alias: 'vault',\n sortOrder: 10,\n title: $t('Stored Cards')\n }]);\n\n registry.get(vaultGroupName, function (vaultGroup) {\n _.each(window.checkoutConfig.payment.vault, function (config, index) {\n rendererList.push(\n {\n type: index,\n config: config.config,\n component: config.component,\n group: vaultGroup,\n\n /**\n * Custom payment method types comparator\n * @param {String} typeA\n * @param {String} typeB\n * @return {Boolean}\n */\n typeComparatorCallback: function (typeA, typeB) {\n // vault token items have the same name as vault payment without index\n return typeA.substring(0, typeA.lastIndexOf('_')) === typeB;\n }\n }\n );\n });\n });\n\n /**\n * Add view logic here if needed\n */\n return Component.extend({});\n});\n","Magento_PaymentServicesPaypal/js/view/payment/smart-buttons-product.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'jquery',\n 'mageUtils',\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'scriptLoader',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/smart-buttons',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'jquery/jquery-storageapi'\n], function (_, $, utils, Component, loadSdkScript, SmartButtons, $t, customerData, ResponseError) {\n 'use strict';\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalProduct',\n buttonsContainerId: 'smart-buttons-${ $.uid }',\n element: null,\n productFormSelector: '#product_addtocart_form',\n formInvalid: false,\n paymentActionError: $t('Something went wrong with your request. Please try again later.'),\n addToCartUrl: null,\n isErrorDisplayed: false\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n _.bindAll(this, 'renderButtons', 'initSmartButtons', 'onClick', 'catchError', 'beforeCreateOrder',\n 'afterCreateOrder', 'beforeOnAuthorize', 'onCancel');\n config.uid = utils.uniqueid();\n this._super();\n this.element = element;
2\n this.element.id = this.buttonsContainerId;\n this.getSdkParams()\n .then(this.initSmartButtons)\n .then(this.renderButtons)\n .catch(function (e) {\n console.log(e);\n });\n\n return this;\n },\n\n /**\n * Create instance of smart buttons.\n */\n initSmartButtons: function () {\n this.buttons = new SmartButtons({\n sdkNamespace: this.sdkNamespace,\n scriptParams: this.sdkParams,\n styles: this.styles,\n createOrderUrl: this.createOrderUrl,\n placeOrderUrl: this.placeOrderUrl,\n authorizeOrderUrl: this.authorizeOrderUrl,\n completeOrderUrl: this.completeOrderUrl,\n onClick: this.onClick,\n setQuoteAsInactiveUrl: this.setQuoteAsInactiveUrl,\n beforeCreateOrder: this.beforeCreateOrder,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n finallyCreateOrder: this.showLoader.bind(this, false),\n beforeOnAuthorize: this.beforeOnAuthorize,\n afterOnAuthorize: this.afterOnAuthorize,\n catchOnAuthorize: this.catchError,\n finallyOnAuthorize: this.showLoader.bind(this, false),\n onError: this.catchError,\n onCancel: this.onCancel,\n location: this.pageType,\n });\n },\n\n /**\n * Render buttons\n */\n renderButtons: function () {\n this.buttons.sdkLoaded.then(function () {\n try {\n this.buttons && this.buttons.render('#' + this.buttonsContainerId);\n } catch (e) {\n console.log(e);\n }\n }.bind(this)).catch(function () {\n console.log('Error: Failed to load PayPal SDK script!');\n });\n },\n\n /**\n * Show/hide loader.\n *\n * @param {Boolean} show\n */\n showLoader: function (show) {\n var event = show ? 'processStart' : 'processStop';\n\n $('body').trigger(event);\n },\n\n /**\n * Catch errors.\n *\n * @param {*} error\n */\n catchError: function (error) {\n var message = error instanceof ResponseError ? error.message : this.paymentActionError;\n\n this.showLoader(false);\n\n if (this.isErrorDisplayed) {\n return;\n }\n this.addMessage(message);\n this.isErrorDisplayed = true;\n },\n\n /**\n * Add message to customer data.\n *\n * @param {String} message\n * @param {String} [type]\n */\n addMessage: function (message, type) {\n type = type || 'error';\n customerData.set('messages', {\n messages: [{\n type: type,\n text: message\n }],\n 'data_id': Math.floor(Date.now() / 1000)\n });\n },\n\n /**\n * Calls when user click paypal button\n *\n * @param {Object} data\n * @param {Promise} actions\n * @return {Promise}\n */\n onClick: function (data, actions) {\n var $form = $(this.productFormSelector);\n\n if ($form.data('mageValidation')) {\n this.formInvalid = !$form.validation('isValid');\n }\n\n if (this.formInvalid) {\n return actions.reject();\n }\n\n return actions.resolve();\n },\n\n /**\n * Set quote created from PDP as Inactive\n */\n setQuoteInactive: function () {\n // Set Quote as inactive to avoid having multiple active quotes for the customer\n return $.ajax({\n type: 'POST',\n url: this.setQuoteAsInactiveUrl\n });\n },\n\n /**\n * Before create order.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n this.isErrorDisplayed = false;\n this.showLoader(true);\n\n return new Promise(function (resolve, reject) {\n if (this.formInvalid) {\n return reject();\n }\n\n fetch(this.addToCartUrl, {\n method: 'POST',\n headers: {},\n body: new FormData($(this.productFormSelector)[0]),\n credentials: 'same-origin'\n }).then(function (response) {\n return response.json();\n }
2).then(function (data) {\n if (typeof data.success !== 'undefined') {\n refreshCustomerData(this.addToCartUrl);\n\n return resolve();\n }\n\n return reject(new ResponseError(data.error));\n }.bind(this)).catch(function () {\n return reject();\n });\n }.bind(this));\n },\n\n /**\n * After order id created.\n *\n * @param {Object} res\n * @return {*}\n */\n afterCreateOrder: function (res) {\n if (res.response['is_successful']) {\n refreshCustomerData(this.createOrderUrl);\n\n return res.response['paypal-order'].id;\n }\n\n throw new ResponseError(res.response.error);\n },\n\n /**\n * Before onAuthorize execute\n *\n * @param {Object} data\n * @return {Promise}\n */\n beforeOnAuthorize: function (data) {\
2n this.showLoader(true);\n\n return Promise.resolve(data);\n },\n\n /**\n * Set the quote inactive on cancel\n */\n onCancel: function () {\n this.setQuoteInactive()\n .always(() => {\n this.showLoader(false);\n });\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/google-pay-product.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'jquery',\n 'mageUtils',\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/google-pay'\n], function (_, $, utils, Component, $t, customerData, ResponseError, GooglePayButton) {\n 'use strict';\n\n const HTTP_STATUS_OK = 200;\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalGooglePay',\n scriptParams: {},\n buttonContainerId: 'google-pay-${ $.uid }',\n template: 'Magento_PaymentServicesPaypal/payment/google-pay',\n paymentsOrderId: null,\n paypalOrderId: null,\n sdkLoaded: null,\n sdkParamsKey: 'googlepay',\n paymentTypeIconTitle: $t('Pay with Google Pay'),\n requestProcessingError: $t('Something went wrong with your request. Please try again later.'),\n notEligibleErrorMessage: $t('This payment option is currently unavailable.'),\n productFormSelector: '#product_addtocart_form'\n },\n\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n _.bindAll(this, 'initGooglePayButton', 'onClick', 'afterUpdateQuote',\n 'catchError', 'beforeCreateOrder', 'afterOnAuthorize', 'onCancel');\n config.uid = utils.uniqueid();\n this._super();\n this.element = element;\n this.element.id = this.buttonContainerId;
2\n this.getSdkParams()\n .then(this.initGooglePayButton)\n .catch(console.log);\n\n return this;\n },\n\n initGooglePayButton: function () {\n this.googlePayButton = new GooglePayButton({\n scriptParams: this.sdkParams,\n createOrderUrl: this.createOrderUrl,\n updateQuoteUrl: this.authorizeOrderUrl,\n onClick: this.onClick,\n setQuoteAsInactiveUrl: this.setQuoteAsInactiveUrl,\n beforeCreateOrder: this.beforeCreateOrder,\n catchCreateOrder: this.catchError,\n onError: this.catchError,\n buttonContainerId: this.buttonContainerId,\n afterUpdateQuote: this.afterUpdateQuote,\n shippingAddressRequired: !this.isVirtual,\n styles: this.styles,\n afterOnAuthorize: this.afterOnAuthorize,\n onCancel: this.onCancel,\n mode: this.googlePayMode,\n getOrderDetailsUrl: this.getOrderDetailsUrl,\n threeDSMode: this.threeDSMode,\n location: this.pageType,\n });\n\n this.googlePayButton.sdkLoaded\n .then(this.googlePayButton.initGoogleSDK);\n }
2,\n\n afterUpdateQuote: function (data) {\n window.location = data.redirectUrl;\n this.googlePayButton.showLoader(false);\n },\n\n onClick: function () {\n var $form = $(this.productFormSelector);\n\n if ($form.data('mageValidation')) {\n this.formValid = $form.validation('isValid');\n }\n\n if (this.formValid) {\n this.isErrorDisplayed = false;\n\n this.googlePayButton.showLoaderAsync(true)\n .then(() => {\n return this.googlePayButton.createOrder();\n })\n .then(() => {\n refreshCustomerData(this.createOrderUrl);\n })\n .catch(error => {\n this.catchError(error);\n });\n }\n },\n\n /**\n * Set quote created from PDP as Inactive\n */\n setQuoteInactive: function () {\n // Set Quote as inactive to avoid having multiple active quotes for the customer\n return $.ajax({\n type: 'POST',\n url: this.setQuoteAsInactiveUrl\n });\n },\n\n /**\n * Catch errors.\n *\n * @param {*} error\n */\n catchError: function (error) {\n console.log(error);\n this.googlePayButton.showLoader(false);\n\n if (error.name !== \"PayPalGooglePayError\") {\n try {\n this.setQuoteInactive()\n } catch (e) {\n console.warn('Failed to set quote inactive:', e);\n }\n }\n\n if (this.isErrorDisplayed) {\n return;\n }\n\n if (error.hidden === undefined || !error.hidden) {\n this.addMessage(this.requestProcessingError);\n }\n\n this.isErrorDisplayed = true;\n },\n\n /**\n * Add message to customer data.\n *\n * @param {String} message\n * @param {String} [type]\n */\n addMessage: function (message, type) {\n type = type || 'error';\n customerData.set('messages', {\n messages: [{\n type: type,\n text: message\n }],\n 'data_id': Math.floor(Date.now() / 1000)\n });\n },\n\n /**\n * Before create order.\n *\n * @return {String}\n */\n beforeCreateOrder: function () {\n this.isErrorDisplayed = false;\n\n if (this.formInvalid) {\n throw new Error('Form is Invalid');\n }\n\n let xhr = new XMLHttpRequest();\n xhr.open('POST', this.addToCartUrl, false);\n xhr.send(new FormData($(this.productFormSelector)[0]));\n\n if (xhr.status !== HTTP_STATUS_OK) {\n throw new Error('Request failed');\n } else {\n try {\n let result = JSON.parse(xhr.responseText);\n\n if (typeof result.success !== 'undefined') {\n refreshCustomerData(this.addToCartUrl);\n return result.success;\n }\n } catch (parseError) {\n throw new Error('Failed to parse response JSON: ' + parseError.message);\n }\n }\n }
2,\n\n afterOnAuthorize: function (data) {\n window.location = data.redirectUrl;\n this.googlePayButton.showLoader(false);\n },\n\n /**\n * Set quote inactive on cancel\n */\n onCancel: function () {\n this.setQuoteInactive()\n .always(() => {\n this.googlePayButton.showLoader(false);\n });\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/message-cart.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'Magento_PaymentServicesPaypal/js/view/payment/message',\n 'Magento_Customer/js/customer-data'\n], function (Component, Message, customerData) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalCart',\n element: null,\n message: null\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n var cartData = customerData.get('cart');\n\n this.element = element;\n this._super();
2\n this.getSdkParams()\n .then(this.initMessage.bind(this))\n .then(function () {\n cartData.subscribe(function (updatedCart) {\n this.message.updateAmount(updatedCart.subtotalAmount);\n }, this);\n }.bind(this))\n .then(this.render.bind(this));\n\n },\n\n /**\n * Create instance of messages.\n */\n initMessage: function () {\n var cartData = customerData.get('cart');\n\n this.message = new Message({\n sdkNamespace: this.sdkNamespace,\n scriptParams: this.sdkParams,\n element: this.element,\n renderContainer: this.renderContainer,\n styles: this.styles,\n placement: this.placement,\n amount: cartData().subtotalAmount\n });\n },\n\n /**\n * Render message\n */\n render: function () {\n this.message.render();\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_PaymentServicesPaypal/js/view/payment/actions/get-sdk-params'\n], function (Component, getSdkParams) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n sdkParamsKey: 'paypal',\n sdkParams: [],\n cacheTtl: 30000\n },\n\n /**\n * Get sdk params\n *\n * @return {Promise<Object>}\n */\n getSdkParams: function () {\n return getSdkParams(this.cacheTtl)\n .then(function (sdkParams) {\n this.sdkParams = sdkParams[this.sdkParamsKey];\n }.bind(this));\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/apple-pay-cart.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'jquery',\n 'mageUtils',\n 'Magento_PaymentServicesPaypal/js/view/payment/paypal-abstract',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/apple-pay',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/cart/totals-processor/default',\n 'Magento_Customer/js/model/customer',\n], function (_, $, utils, Component, $t, customerData, ResponseError, ApplePayButton, quote, totalsProcessor, customer) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalApplePay',\n sdkParamsKey: 'applepay',\n buttonContainerId: 'apple-pay-${ $.uid }',\n paymentActionError: $t('Something went wrong with your request. Please try again later.'),\n isErrorDisplayed: false\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config, element) {\n _.bindAll(this, 'initApplePayButton', 'onClick', 'afterOnAuthorize', 'afterCreateOrder', 'showPopup', 'cancelApplePay');\n config.uid = utils.uniqueid();\n this._super();\n this.element = element;\n this.element.id = this.buttonContainerId;
2\n\n this.getSdkParams()\n .then(this.initApplePayButton)\n .catch(console.log);\n\n return this;\n },\n\n initApplePayButton: function () {\n this.applePayButton = new ApplePayButton({\n scriptParams: this.sdkParams,\n createOrderUrl: this.createOrderUrl,\n estimateShippingMethodsWhenLoggedInUrl: this.estimateShippingMethodsWhenLoggedInUrl,\n estimateShippingMethodsWhenGuestUrl: this.estimateShippingMethodsWhenGuestUrl,\n shippingInformationWhenLoggedInUrl: this.shippingInformationWhenLoggedInUrl,\n shippingInformationWhenGuestUrl: this.shippingInformationWhenGuestUrl,\n updatePaypalOrderUrl: this.updatePaypalOrderUrl,\n countriesUrl: this.countriesUrl,\n placeOrderUrl: this.placeOrderUrl,\n showPopup: this.showPopup,\n updateQuoteUrl: this.authorizeOrderUrl,\n onClick: this.onClick,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n onError: this.catchError,\n buttonContainerId: this.buttonContainerId,\n afterOnAuthorize: this.afterOnAuthorize,\n shippingAddressRequired: !this.isVirtual,\n styles: this.styles,\n location: this.pageType,\n });\n\n $('#' + this.buttonContainerId).on('click', this.onClick);\n\n this.applePayButton.sdkLoaded\n .then(this.applePayButton.initAppleSDK);\n }
2,\n\n afterOnAuthorize: function (data) {\n\n this.applePayButton.showLoaderAsync(true)\n .then(() => {\n fetch(this.placeOrderUrl, {\n method: 'POST'\n }).then(response => {\n if (response.redirected && response.url.includes(\"review\")) {\n throw new Error();\n }\n return response.text();\n }).then(result => {\n if (result) {\n customerData.invalidate(['cart']);\n document.open();\n document.write(result);\n document.close();\n }\n })\n .catch(error => {\n this.applePayButton.showLoader(false);\n this.applePayButton.catchError(error);\n });\n })\n .catch(error => {\n this.catchError(error);\n });\n },\n\n onClick: function () {\n // Reload customer data to use correct loggedin/guest urls in the applepay button\n // See smart_buttons_minicart.phtml:21-22\n if (this.location === 'minicart') {\n this.fixCustomerData();\n }\n\n // Show popup with initial order amount from window.checkoutConfig\n // See smart_buttons_minicart.phtml:20\n this.applePayButton.showLoaderAsync(true).then(() => {\n const data = {\n response: {\n 'paypal-order': {\n currency_code: window.checkoutConfig.quoteData.base_currency_code,\n amount: window.checkoutConfig.quoteData.grand_total.toString(),\n }\n }\n }\n this.applePayButton.showPopup(data);\n })\n\n this.isErrorDisplayed = false;\n },\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}
2\n */\n afterCreateOrder: function (data) {\n if (data.response['paypal-order'] && data.response['paypal-order']['mp_order_id']) {\n this.paymentsOrderId = data.response['paypal-order']['mp_order_id'];\n this.paypalOrderId = data.response['paypal-order'].id;\n return this.paypalOrderId;\n }\n\n throw new Error();\n },\n\n cancelApplePay: function (){\n customerData.invalidate(['cart']);\n window.location.reload();\n },\n\n showPopup: function (paymentData) {\n const paymentRequest = {\n countryCode: this.applePayButton.applePayConfig.countryCode,\n merchantCapabilities: this.applePayButton.applePayConfig.merchantCapabilities,\n supportedNetworks: this.applePayButton.applePayConfig.supportedNetworks,\n currencyCode: paymentData.response['paypal-order']['currency_code'],\n requiredShippingContactFields: [\"name\", \"phone\", \"email\", \"postalAddress\"],\n requiredBillingContactFields: [\"postalAddress\"],\n total: {\n label: $t(\"Summary\"),\n type: \"final\",\n amount: Number(paymentData.response['paypal-order']['amount']).toString(),\n }\n };\n\n // See https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession\n this.applePaySession = new ApplePaySession(this.applePayButton.applePayVersionNumber, paymentRequest);\n\n this.applePayButton.onApplePayValidateMerchant(this.applePaySession);\n this.applePayButton.onApplePayCancel(this.applePaySession, this.cancelApplePay);\n this.applePayButton.onApplePayShippingContactSelected(this.applePaySession, quote.getQuoteId() , paymentRequest.total, quote.isVirtual());\n this.applePayButton.onApplePayShippingMethodSelectedInCartPage(this.applePaySession, quote.getQuoteId());\n this.applePayButton.onApplePayPaymentAuthorized(this.applePaySession);\n\n this.applePaySession.begin();\n },\n\n /**\n * Fix customer data\n *\n * Why do we need this?\n * See: src/app/code/Magento/Customer/view/frontend/web/js/model/customer.js:17\n *\n * When we initialise customer data on the page where the minicart was not rendered yet,\n * the customer data in the \"window\" object is 'undefined' at first because . This makes this line\n * var isLoggedIn = ko.observable(window.isCustomerLoggedIn),\n * to create an observable of undefined variable, that does not work in knockout.\n * knockout expects an existing variable to create an observable.\n *\n * Later, when we render minicart and update \"window\" object with customer data,\n * it's not being picked up by customer.js logic and when try to read the data, it's still undefined,\n * even though it exists in the \"window\" object.\n *\n * This function forces the customer data to be updated from the \"window\" object.\n */\n fixCustomerData: function () {\n if (customer.isLoggedIn() === undefined && window.isCustomerLoggedIn !== undefined) {\n customer.setIsLoggedIn(window.isCustomerLoggedIn);\n }\n\n if (customer.isLoggedIn() && _.isEmpty(customer.customerData)) {\n customer.customerData = window.customerData;\n }\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/renderer-list',\n 'Magento_PaymentServicesPaypal/js/helpers/is-fastlane-available'\n], function (Component, rendererList, isFastlaneAvailable) {\n 'use strict';\n\n const cardField = isFastlaneAvailable() ? {\n type: 'payment_services_paypal_fastlane',\n component: 'Magento_PaymentServicesPaypal/js/view/payment/method-renderer/fastlane'\n } : {\n type: 'payment_services_paypal_hosted_fields',\n component: 'Magento_PaymentServicesPaypal/js/view/payment/method-renderer/hosted-fields'\n };\n\n rendererList.push({\n type: 'payment_services_paypal_smart_buttons',\n component: 'Magento_PaymentServicesPaypal/js/view/payment/method-renderer/smart-buttons'\n }, {\n type: 'payment_services_paypal_apple_pay',\n component: 'Magento_PaymentServicesPaypal/js/view/payment/method-renderer/apple-pay'\n }, {\n type: 'payment_services_paypal_google_pay',\n component: 'Magento_PaymentServicesPaypal/js/view/payment/method-renderer/google-pay'\n }, cardField);\n\n return Component.extend({});\n});\n","Magento_PaymentServicesPaypal/js/view/payment/actions/get-sdk-params.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'underscore',\n 'Magento_Customer/js/customer-data',\n 'jquery/jquery-storageapi'\n], function ($, _, customerData) {\n 'use strict';\n\n var promise = null,\n timeoutKey = 'payments-sdk-params-timeout',\n paymentsKey = 'payments',\n sdkParamsKey = 'sdkParams';\n\n return function (cacheTtl) {\n if (!promise) {\n promise = new Promise(function (resolve, reject) {\n var dateNow = Date.now(),\n dateTo = dateNow + cacheTtl,\n timeout = $.localStorage.get(timeoutKey);\n if (timeout < dateNow || !timeout) {\n return customerData.reload([paymentsKey]).done(function () {\n $.localStorage.set(timeoutKey, dateTo);\n resolve(customerData.get(paymentsKey)()[sdkParamsKey]);\n }).fail(reject.bind(this, []));\n }\n\n if (!_.isEmpty(customerData.get(paymentsKey)())) {\n return resolve(customerData.get(paymentsKey)()[sdkParamsKey]);\n }\n\n customerData.get(paymentsKey).subscribe(function (payments) {\n resolve(payments[sdkParamsKey]);\n });\n\n });\n }\n\n return promise;\n };\n});\n","Magento_PaymentServicesPaypal/js/view/payment/methods/hosted-fields.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'uiComponent',\n 'mage/translate',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'scriptLoader'\n], function (_, Class, $t, ResponseError, loadSdkScript) {\n 'use strict';\n\n return Class.extend({\n defaults: {\n sdkNamespace: 'paypal',\n paypal: null,\n formId: 'hosted-fields-form',\n instance: undefined,\n createOrderUrl: null,\n orderCreateErrorMessage: {\n default: $t('Failed to place order. Try again or refresh the page if that does not resolve the issue.'), // eslint-disable-line max-len,\n //TODO: Update messages\n 'POSTAL_CODE_REQUIRED': $t('Postal code is required.'),\n 'CITY_REQUIRED': $t('City is required.')\n },\n styles: {\n input: {\n color: '#ccc',\n 'font-family': '\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif',\n 'font-size': '16px',\n 'font-weight': '400'\n }
2,\n ':focus': {\n color: '#333'\n },\n '.valid': {\n color: '#333'\n }\n },\n fields: {\n number: {\n class: 'number',\n selector: '#${ $.formId } .${ $.fields.number.class }',\n placeholder: ''\n },\n expirationDate: {\n class: 'expiration-date',\n selector: '#${ $.formId } .${ $.fields.expirationDate.class }',\n placeholder: 'MM/YY'\n },\n cvv: {\n class: 'cvv',\n selector: '#${ $.formId } .${ $.fields.cvv.class }',\n placeholder: ''\n }\n },\n scriptParams: [],\n sdkLoaded: null,\n shouldCardBeVaulted: false\n },\n\n /** @inheritdoc */\n initialize: function (config) {\n _.bindAll(this, 'createOrder');\n\n if (config.fields) {\n this.constructor.defaults.fields = config.fields;\n }\n this._super();\n this.sdkLoaded = loadSdkScript(this.scriptParams, this.sdkNamespace).then(function (sdkScript) {\n this.paypal = sdkScript;\n }.bind(this));\n return this;\n },\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe('shouldCardBeVaulted');\n\n return this;\n },\n\n /**\n * Check if eligible\n *\n * @return {Boolean}\n */\n isEligible: function () {\n return typeof this.paypal !== 'undefined' &&\n this.paypal.HostedFields &&\n this.paypal.HostedFields.isEligible();\n },\n\n /**\n * Render fields.\n *\n * @return {*}\n */\n render: function () {\n return this.paypal.HostedFields.render({\n createOrder: this.createOrder,\n styles: this.styles,\n fields: this.fields\n }).then(function (instance) {\n this.instance = instance;\n\n return instance;\n }.bind(this));\n },\n\n /**\n * Calls before create order.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n return Promise.resolve();\n },\n\n /**\n * Create order in payment service / PayPal\n *\n * @returns {Promise<any>}\n */\n createOrder: function () {\n return this.beforeCreateOrder()\n .then(function () {\n const shouldCardBeVaulted = this.shouldCardBeVaulted(),\n orderData = new FormData();\n\n orderData.append('payment_source', this.paymentSource);\n\n return fetch(`${this.createOrderUrl}?vault=${shouldCardBeVaulted}`, {\n method: 'POST',\n headers: {},\n body: orderData\n });\n }.bind(this)).then(function (res) {\n return res.json();\n }
2).then(function (data) {\n if (data.response['is_successful']) {\n this.onOrderSuccess(data.response['paypal-order']);\n } else {\n throw new ResponseError(\n this.orderCreateErrorMessage[data.response.message] || this.orderCreateErrorMessage.default\n );\n }\n\n return data.response['paypal-order'].id;\n }.bind(this)).catch(function (error) {\n if (error instanceof ResponseError) {\n throw error;\n }\n throw new ResponseError(this.orderCreateErrorMessage.default);\n }.bind(this));\n },\n\n /**\n * Customizable handler for order creation.\n */\n onOrderSuccess: function () {}\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/methods/google-pay.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'underscore',\n 'uiComponent',\n 'scriptLoader',\n 'Magento_PaymentServicesPaypal/js/lib/script-loader',\n 'mage/translate',\n 'mage/cookies'\n], function ($, _, Component, loadSdkScript, scriptLoader, $t) {\n 'use strict';\n\n const HTTP_STATUS_CREATED = 201;\n\n const googleSDKSrc = 'https://pay.google.com/gp/p/js/pay.js',\n baseRequest = {\n apiVersion: 2,\n apiVersionMinor: 0,\n callbackIntents: ['PAYMENT_AUTHORIZATION'],\n emailRequired: true,\n shippingAddressParameters: {phoneNumberRequired: true}\n };\n\n /**\n * Create order request.\n *\n * @param {String} url\n * @param {Object} payPalOrderData\n * @param {FormData} orderData\n * @param {String | false} threeDSMode\n * @return {Object}\n */\n var performCreateOrder = function (url, payPalOrderData, orderData, threeDSMode) {\n\n orderData = orderData || new FormData();\n orderData.append('form_key', $.mage.cookies.get('form_key'));\n orderData.append('payment_source', payPalOrderData['paymentSource']);\n\n if (threeDSMode) {\n orderData.append('three_ds_mode', threeDSMode);\n }\n\n let xhr = new XMLHttpRequest();\n xhr.open('POST', url, false);\n xhr.send(orderData);\n\n if (xhr.status !== HTTP_STATUS_CREATED) {\n throw new Error('Request failed');\n } else {\n return JSON.parse(xhr.responseText);\n }\n },\n\n /**\n * Payment authorization request.\n *\n * @return {Promise<Object>}\n */\n performOnAuthorize = function (url, data) {\n var orderData = new FormData();\n\n orderData.append('form_key', $.mage.cookies.get('form_key'));\n orderData.append('paypal_order_id', data.orderID);\n\n return fetch(url, {\n method: 'POST',\n headers: {},\n body: orderData,\n credentials: 'same-origin'\n }).then(function (response) {\n return response.json();\n });\n };\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypal',\n paypal: null,\n paymentSource: 'googlepay',\n createOrderUrl: '',\n updateQuoteUrl: '',\n setQuoteAsInactiveUrl: '',\n instance: null,\n scriptParams: {},\n allowedPaymentMethods: null,\n merchantInfo: null,\n buttonContainerId: null,\n paypalOrderId: null,\n eligible: false,\n mode: 'TEST',\n shippingAddressRequired: true,\n getOrderDetailsUrl: '',\n threeDSMode: '',\n },\n\n /** @inheritdoc */\n initialize: function () {\n _.bindAll(this, 'createOrder', 'onApprove', 'onError', 'initGoogleSDK', 'performAuthorization',\n 'onClick', 'beforeOnAuthorize', 'afterOnAuthorize', 'onCancel');\n this._super();\n this.sdkLoaded = Promise.all([this.loadPayPalSDK(), this.loadGoogleSDK()]);\n\n return this;\n },\n\n loadPayPalSDK: function () {\n return loadSdkScript(this.scriptParam
2s, this.sdkNamespace)\n .then(function (sdkScript) {\n this.paypal = sdkScript;\n }.bind(this))\n .catch(function (e) {\n this.onError(e);\n });\n },\n\n loadGoogleSDK: function () {\n return scriptLoader.loadCustom({url: googleSDKSrc})\n .catch(function (e) {\n this.onError(e);\n });\n },\n\n initGoogleSDK: function () {\n return this.getGooglePayConfig()\n .then(config =>\n this.getGooglePaymentsClient()\n .isReadyToPay(this.getGoogleIsReadyToPayRequest(config.allowedPaymentMethods))\n .then(function (response) {\n if (response.result) {\n this.renderGooglePayButton();\n }\n }.bind(this))\n ).catch(function (e) {\n this.onError({\n hidden: true,\n error: e\n });\n }.bind(this));\n },\n\n getGooglePaymentsClient: function () {\n if (this.instance === null) {\n this.instance = new google.payments.api.PaymentsClient({\n environment: this.mode,\n paymentDataCallbacks: {\n onPaymentAuthorized: this.performAuthorization\n }\n });\n }\n return this.instance;\n },\n\n showPopup: function (paymentData) {\n this.getGooglePaymentDataRequest(paymentData)\n .then((data) => {\n this.getGooglePaymentsClient()\n .loadPaymentData(data)\n .catch(this.onCancel);\n }).catch((error) => this.onError(error));\n },\n\n onCancel: function () {\n this.showLoader(false);\n },\n\n getGooglePaymentDataRequest: async function (transactionInfo) {\n const paymentDataRequest = Object.assign({}, baseRequest),\n {allowedPaymentMethods, merchantInfo} = await this.getGooglePayConfig();\n\n paymentDataRequest.allowedPaymentMethods = allowedPaymentMethods;\n paymentDataRequest.transactionInfo = transactionInfo;\n paymentDataRequest.merchantInfo = merchantInfo;\n paymentDataRequest.shippingAddressRequired = this.shippingAddressRequired;\n\n return paymentDataRequest;\n },\n\n getGooglePayConfig: async function () {\n if (this.allowedPaymentMethods === null || this.merchantInfo === null) {\n const googlePayConfig = await this.paypal.Googlepay().config();\n\n this.allowedPaymentMethods = googlePayConfig.allowedPaymentMethods;\n this.merchantInfo = googlePayConfig.merchantInfo;\n }\n\n return {\n allowedPaymentMethods: this.allowedPaymentMethods,\n merchantInfo: this.merchantInfo\n };\n },\n\n getGoogleIsReadyToPayRequest: function (allowedPaymentMethods) {\n return Object.assign({}, baseRequest, {\n allowedPaymentMethods: allowedPaymentMethods\n });\n },\n\n renderGooglePayButton: function () {\n const buttonContainer = $('#' + this.buttonContainerId);\n\n let buttonProps = {\n onClick: this.onClick,\n buttonColor: this.styles.button_color,\n buttonType: this.styles.button_type\n };\n\n buttonProps.buttonSizeMode = 'fill';\n\n if (this.styles.button_custom_height) {\n buttonContainer.height(this.styles.button_custom_height);\n }\n\n buttonContainer.append(\n this.getGooglePaymentsClient().createButton(buttonProps)\n );\n this.eligible = true;\n },\n\n enableButton: function () {\n $('#' + this.buttonContainerId).find('button').prop('disabled', false);\n },\n\n disableButton: function () {\n $('#' + this.buttonContainerId).find('button').prop('disabled', true);\n },\n\n performAuthorization: function (paymentData) {\n return new Promise(function (resolve) {\n this.processPayment(paymentData)\n .then(resolve)\n .catch(function () {\n this.onError(new Error('couldn\\'t process payment'));
2\n resolve({transactionState: 'ERROR'});\n }.bind(this));\n }.bind(this));\n },\n\n processPayment: async function (paymentData) {\n try {\n const {status} = await this.paypal.Googlepay().confirmOrder({\n orderId: this.paypalOrderId,\n paymentMethodData: paymentData.paymentMethodData,\n shippingAddress: paymentData.shippingAddress,\n email: paymentData.email\n });\n\n if (status === 'APPROVED') {\n this.onApprove(paymentData);\n return {transactionState: 'SUCCESS'};\n }\n\n if (status === 'PAYER_ACTION_REQUIRED') {\n this.paypal.Googlepay().initiatePayerAction({orderId: this.paypalOrderId}).then(\n async () => {\n return fetch(`${this.getOrderDetailsUrl}`, {\n method: 'GET'\n }).then((res) => {\n return res.json();\n }).then((data) => {\n if (data.response['is_successful'] && data.response['paypal-order']) {\n const order = data.response['paypal-order'];\n let authenticationResult = order.payment_source_details.card.authentication_result;\n if (authenticationResult\n && (\n authenticationResult.liability_shift === 'POSSIBLE'\n || authenticationResult.liability_shift === \"YES\"\n || authenticationResult.liability_shift === undefined\n )\n ) {\n this.onApprove(paymentData);\n } else {\n this.onError(new Error('couldn\\'t approve order using 3DS'));\n }\n }\n }).catch((error) => {\n console.log(\"ERROR: \", error)\n this.onError(new Error('couldn\\'t approve order using 3DS'));\n })\n }\n ).catch((error) => {\n console.log(\"ERROR: \", error)\n this.onError(new Error('couldn\\'t approve order using 3DS'));\n });\n\n return {transactionState: 'SUCCESS'};\n }\n\n this.onError(new Error('couldn\\'t process payment'));\n\n return {transactionState: 'ERROR'};\n } catch (err) {\n this.onError(err);\n return {\n transactionState: 'ERROR',\n error: {\n message: err.message\n }\n };\n }\n },\n\n onClick: function () {\n },\n\n /**\n * Calls before create order.\n */\n beforeCreateOrder: function () {\n },\n\n /**\n * Create order.\n *\n * @return {String}\n */\n createOrder: function () {\n let data = {'paymentSource': this.paymentSource};\n\n try {\n this.beforeCreateOrder();\n\n // add location to the order create request\n let formData = new FormData();\n formData.append('location', this.location);\n\n let orderData = performCreateOrder(this.createOrderUrl, data, formData, this.threeDSMode);\n this.paypalOrderId = this.afterCreateOrder(orderData);\n return this.paypalOrderId;\n } catch (error) {\n return this.catchCreateOrder(error);\n }\n }
2,\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}\n */\n afterCreateOrder: function (data) {\n if (data.response['paypal-order'] && data.response['paypal-order']['mp_order_id']) {\n this.paymentsOrderId = data.response['paypal-order']['mp_order_id'];\n this.paypalOrderId = data.response['paypal-order'].id;\n\n this.showPopup({\n displayItems: [],\n currencyCode: data.response['paypal-order']['currency_code'],\n totalPriceStatus: 'FINAL',\n totalPrice: Number(data.response['paypal-order']['amount']).toString(),\n totalPriceLabel: $t('Total')\n });\n\n return this.paypalOrderId;\n }\n\n throw new Error();\n },\n\n /**\n * Catch error on order creation.\n */\n catchCreateOrder: function () {\n },\n\n /**\n * On payment approve.\n *\n * @param {Object} data\n * @param {Object} actions\n * @return {Promise}\n */\n onApprove: function () {\n const data = {orderID: this.paypalOrderId};\n\n return this.beforeOnAuthorize()\n .then(performOnAuthorize.bind(this, this.updateQuoteUrl, data))\n .then(this.afterOnAuthorize)\n .catch(this.onError);\n },\n\n beforeOnAuthorize: function () {\n return Promise.resolve();\n },\n\n afterOnAuthorize: function () {\n return Promise.resolve();\n },\n\n /**\n * Calls when error happened on PayPal side.\n *\n * @param {Error} error\n */\n onError: function (error) {\n console.log('Error: ', error.message);\n },\n\n isEligible: function () {\n return this.eligible;\n },\n\n /**\n * Async Show/hide loader\n *\n * @param {Boolean} show\n */\n showLoaderAsync: function (show) {\n return new Promise(function (resolve, reject) {\n var event = show ? 'processStart' : 'processStop';\n $('body').trigger(event);\n\n // Set minimum time for loader to show\n setTimeout(() => {\n resolve();\n }, 10);\n });\n },\n\n /**\n * Show/hide loader.\n *\n * @param {Boolean} show\n */\n showLoader: function (show) {\n var event = show ? 'processStart' : 'processStop';\n\n $('body').trigger(event);\n },\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/methods/apple-pay.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'underscore',\n 'uiComponent',\n 'scriptLoader',\n 'Magento_PaymentServicesPaypal/js/lib/script-loader',\n 'Magento_Customer/js/customer-data',\n 'Magento_Customer/js/model/customer',\n 'mage/translate',\n], function ($, _, Component, loadSdkScript, scriptLoader, customerData, customer, $t) {\n 'use strict';\n\n const HTTP_STATUS_CREATED = 201;\n\n const APPLE_PAY_VERSION_NUMBER = 4; // See https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session\n const appleSDKSrc = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';\n\n /**\n * Create order request.\n *\n * @param {String} url\n * @param {Object} payPalOrderData\n * @param {FormData} orderData\n * @return {Object}\n */\n var performCreateOrder = function (url, payPalOrderData, orderData) {\n\n orderData = orderData || new FormData();\n orderData.append('form_key', $.mage.cookies.get('form_key'));\n orderData.append('payment_source', payPalOrderData['paymentSource']);\n\n let xhr = new XMLHttpRequest();\n xhr.open('POST', url, false);\n xhr.send(orderData);\n\n if (xhr.status !== HTTP_STATUS_CREATED) {\n throw new Error('Request failed');\n } else {\n return JSON.parse(xhr.responseText);\n }\n },\n\n /**\n * Payment authorization request.\n *\n * @return {Promise<Object>}\n */\n performOnAuthorize = function (url, data) {\n var orderData = new FormData();\n\n orderData.append('form_key', $.mage.cookies.get('form_key'));\n orderData.append('paypal_order_id', data.orderID);\n\n return fetch(url, {\n method: 'POST',\n headers: {},\n body: orderData,\n credentials: 'same-origin'\n }).then(function (response) {\n return response.json();\n });\n };\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypal',\n paypal: null,\n paymentSource: 'applepay',\n createOrderUrl: '',\n placeOrderUrl: '',\n updateQuoteUrl: '',\n estimateShippingMethodsWhenLoggedInUrl: '',\n estimateShippingMethodsWhenGuestUrl: '',\n shippingInformationWhenLoggedInUrl: '',\n shippingInformationWhenGuestUrl: '',\n updatePaypalOrderUrl: '',\n setQuoteAsInactiveUrl: '',\n countriesUrl: '',\n instance: null,\n scriptParam
2s: {},\n allowedPaymentMethods: null,\n merchantInfo: null,\n buttonContainerId: null,\n paypalOrderId: null,\n eligible: false,\n applePayInstance: null,\n applePayConfig: null,\n appleSession: null,\n applePayVersionNumber: APPLE_PAY_VERSION_NUMBER,\n countryCode: null,\n regionCode: null,\n regionId: null,\n postalCode: null,\n requestProcessingError: $t('Something went wrong with your request. Please try again later.'),\n },\n\n /** @inheritdoc */\n initialize: function () {\n _.bindAll(this, 'createOrder', 'onApprove', 'onError', 'initAppleSDK', 'performAuthorization',\n 'onClick', 'beforeOnAuthorize', 'afterOnAuthorize', 'onCancel');\n this._super();\n this.sdkLoaded = Promise.all([this.loadPayPalSDK(), this.loadAppleSDK()]);\n\n return this;\n },\n\n loadPayPalSDK: function () {\n return loadSdkScript(this.scriptParams, this.sdkNamespace)\n .then(function (sdkScript) {\n this.paypal = sdkScript;\n }.bind(this))\n .catch(function (e) {\n this.onError(e);\n });\n },\n\n loadAppleSDK: function () {\n return scriptLoader.loadCustom({url: appleSDKSrc})\n .catch(function (e) {\n this.onError(e);\n });\n },\n\n isCustomerLoggedIn: function () {\n return customer.isLoggedIn();\n },\n\n initAppleSDK: function () {\n if (!window.ApplePaySession) {\n console.warn('This device does not support Apple Pay');\n return;\n }\n\n if (!ApplePaySession.canMakePayments()) {\n console.warn('This device is not capable of making Apple Pay payments');\n }\n\n this.applePayInstance = this.paypal.Applepay();\n return this.applePayInstance.config()\n .then(applePayConfig => {\n this.applePayConfig = applePayConfig;\n this.renderApplePayButton();\n })\n .catch(applepayConfigError => {\n console.error('Error while fetching Apple Pay configuration.');\n });\n },\n\n onApplePayValidateMerchant: function (applePaySession) {\n applePaySession.onvalidatemerchant = (event) => {\n this.applePayInstance\n .validateMerchant({\n validationUrl: event.validationURL,\n })\n .then((payload) => {\n applePaySession.completeMerchantValidation(payload.merchantSession);\n })\n .catch((error) => {\n applePaySession.abort();\n this.isErrorDisplayed = false;\n this.catchError(error)\n });\n };\n },\n\n onApplePayPaymentAuthorized: function (applePaySession, paypalOrderId = null) {\n applePaySession.onpaymentauthorized = async (event) => {\n try {\n let shippingContact = event.payment.shippingContact;\n\n // Remove non-numeric characters from phone number as Paypal doesn't allow it\n if (shippingContact && shippingContact.phoneNumber) {\n shippingContact = {\n ...shippingContact,\n phoneNumber: shippingContact.phoneNumber.replace(/\\D/g, '')\n };\n }\n\n await this.applePayInstance.confirmOrder({\n orderId: paypalOrderId !== null ? paypalOrderId : this.paypalOrderId,\n token: event.payment.token,\n billingContact: event.payment.billingContact,\n shippingContact: shippingContact\n });\n\n applePaySession.completePayment({\n status: window.ApplePaySession.STATUS_SUCCESS,\n });\n\n await this.onApprove();\n } catch (error) {\n applePaySession.completePayment({\n status: window.ApplePaySession.STATUS_FAILURE,\n });\n this.isErrorDisplayed = false;\n this.catchError(error)\n }\n };\n },\n\n onApplePayShippingContactSelected: function (applePaySession, quoteId, total, isVirtual) {\n applePaySession.onshippingcontactselected = (event) => {\n\n const shippingMethods = [];
2\n\n let estimateShippingMethodURL = (this.isCustomerLoggedIn())\n ? this.estimateShippingMethodsWhenLoggedInUrl\n : this.estimateShippingMethodsWhenGuestUrl.replace(':cartId', quoteId);\n\n if (this.location === 'product') {\n // Product Page: we need to use guest cart quote because it is created outside the checkout process\n estimateShippingMethodURL = this.estimateShippingMethodsWhenGuestUrl.replace(':cartId', quoteId);\n }\n\n this.countryCode = event.shippingContact.countryCode;\n this.regionCode = event.shippingContact.administrativeArea;\n this.postalCode = event.shippingContact.postalCode;\n\n this.getRegionIdByCode(this.regionCode, this.countryCode)\n .then((regionId) => {\n this.regionId = regionId;\n })\n .catch((error)=> {\n // If the Apple region Code doesn't match to the one in Commerce\n // we set the regionId to null to still apply the taxes of the country\n // to continue with the checkout\n console.log(error);\n this.regionId = null;\n });\n\n $.ajax({\n type: 'POST',\n url: estimateShippingMethodURL,\n headers: {\n 'Content-Type': 'application/json',\n },\n data: JSON.stringify({\n address: {\n country_id: event.shippingContact.countryCode,\n postcode: event.shippingContact.postalCode,\n city: event.shippingContact.locality\n }\n })\n }).then(estimateShippingMethods => {\n\n estimateShippingMethods.forEach(method => {\n shippingMethods.push({\n label: method.method_title,\n detail: method.carrier_title,\n amount: method.amount.toString(),\n identifier: method.carrier_code + '_' + method.method_code,\n });\n });\n\n applePaySession.completeShippingContactSelection({\n newShippingMethods: shippingMethods,\n newTotal: total,\n })\n\n }, error => {\n this.isErrorDisplayed = false;\n applePaySession.abort();\n this.catchError(error);\n });\n\n if (isVirtual) {\n // If Quote is virtual, no need to select shipping\n // We can already create the order\n this.createOrder();\n }\n }\n },\n\n onApplePayShippingMethodSelectedInCartPage: function (applePaySession, quoteId) {\n this.onApplePayShippingMethodSelected(applePaySession, quoteId, null,null);\n },\n\n onApplePayShippingMethodSelected: function (applePaySession, quoteId, quoteMaskedId, paypalOrderId) {\n applePaySession.onshippingmethodselected = (event) => {\n\n let shippingInformationURL = (this.isCustomerLoggedIn())\n ? this.shippingInformationWhenLoggedInUrl\n : this.shippingInformationWhenGuestUrl.replace(':quoteId', quoteId);\n\n if (this.location === 'product') {\n // Product Page: we need to use quoteMaskedId as the quote is created outside the checkout process\n shippingInformationURL = this.shippingInformationWhenGuestUrl.replace(':quoteId', quoteMaskedId);\n }\n\n $.ajax({\n type: 'POST',\n url: shippingInformationURL,\n headers: {\n 'Content-Type': 'application/json',\n },\n data: JSON.stringify({\n addressInformation: {\n shipping_address: {\"country_id\": this.countryCode, \"region_id\": this.regionId, \"postcode\": this.postalCode},\n shipping_method_code: event.shippingMethod.identifier.split('_')[1],\n shipping_carrier_code: event.shippingMethod.identifier.split('_')[0],\n extension_attributes: {}\n }\n })\n }).then(result => {\n\n let items = [];\n\n result['totals']['items'].forEach(item => {\n items.push({\n label: item.name + ' ( x ' + item.qty + ' )',\n type: \"final\",\n amount: item.row_total\n });\n });\n\n items.push({\n label: \"Shipping\",\n type: \"final\",\n amount: result['totals']['shipping_amount'],\n });\n\n if (result['totals']['tax_amount'] !== 0) {\n items.push({\n label: \"Tax\",\n type: \"final\",\n amount: result['totals']['tax_amount'],\n });\n }\n\n applePaySession.completeShippingMethodSelection({\n newLineItems: items,\n newTotal: {\n label: \"Summary\",\n type: \"final\",\n amount: result['totals']['grand_total'],\n },\n });\n\n if (this.location === 'product') {\n // In the product page, the paypal order has been created on the onClick handler\n // so we just need to update the amount with the shipping selected\n this.updatePaypalOrder();\n } else {\n // In Cart and Minicart, we need to create the Paypal Order\n this.createOrder();\n }\n\n }).catch(error => {\n applePaySession.abort();\n this.isErrorDisplayed = false;\n this.catchError(error);\n });\n };\n }
2,\n\n updatePaypalOrder: function() {\n\n // Update PayPal Order Amount as the shipping method has been selected and the price changed\n // Without the update, the payment is failing as the order amount could be different\n $.ajax({\n type: 'POST',\n url: this.updatePayPalOrderUrl,\n }).catch(error => {\n this.catchError(error);\n });\n },\n\n onApplePayCancel: function (applePaySession, callback) {\n applePaySession.oncancel = () => {\n if (typeof callback === 'function') {\n callback();\n }\n\n this.showLoader(false);\n }\n },\n\n getApplePaymentRequestLineItems: function (quote){\n let items = [];\n\n quote.getItems().forEach(item => {\n items.push({\n label: item.name + ' ( x ' + item.qty + ' )',\n type: \"final\",\n amount: item.price * item.qty,\n });\n });\n\n items.push({\n label: $t(\"Shipping\"),\n type: \"final\",\n amount: quote.getTotals()()['shipping_amount'],\n });\n\n if (quote.getTotals()['tax_amount'] !== 0) {\n items.push({\n label: $t(\"Tax\"),\n type: \"final\",\n amount: quote.getTotals()()['tax_amount'],\n });\n }\n\n return items;\n },\n\n showPopup: function (paymentData, quote) {\n const paymentRequest = {\n countryCode: this.applePayConfig.countryCode,\n merchantCapabilities: this.applePayConfig.merchantCapabilities,\n supportedNetworks: this.applePayConfig.supportedNetworks,\n currencyCode: paymentData.response['paypal-order']['currency_code'],\n lineItems: this.getApplePaymentRequestLineItems(quote),\n requiredBillingContactFields: [\"postalAddress\"],\n shippingContact: {\n countryCode: quote.shippingAddress().countryId,\n postalCode: quote.shippingAddress().postcode,\n locality: quote.shippingAddress().city,\n administrativeArea: quote.shippingAddress().regionCode,\n familyName: quote.shippingAddress().lastname,\n givenName: quote.shippingAddress().firstname,\n addressLines: quote.shippingAddress().street,\n },\n total: {\n label: $t(\"Summary\"),\n type: \"final\",\n amount: Number(paymentData.response['paypal-order']['amount']).toString(),\n }\n };\n\n // See https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession\n this.applePaySession = new ApplePaySession(APPLE_PAY_VERSION_NUMBER, paymentRequest);\n this.onApplePayValidateMerchant(this.applePaySession);\n this.onApplePayPaymentAuthorized(this.applePaySession, paymentData.response['paypal-order']['id']);\n this.onApplePayCancel(this.applePaySession);\n\n this.applePaySession.begin();\n },\n\n onCancel: function () {\n window.location = data.redirectUrl;\n this.showLoader(false);\n },\n\n renderApplePayButton: function () {\n if (this.applePayConfig.isEligible) {\n const buttonStyle = this.mapButtonStyle();\n const buttonType = this.mapButtonType();\n const height = this.styles.height > 0\n ? this.styles.height + \"px\"\n : \"40px\";\n\n const btnId = this.generateUniqueElementId();\n document.getElementById(this.buttonContainerId).innerHTML = `\n <apple-pay-button\n id=\"${btnId}\"\n buttonstyle=\"${buttonStyle}\"\n type=\"${buttonType}\"\n locale=\"${window.LOCALE}\"\n style=\" --apple-pay-button-width: 100%; --apple-pay-button-height: ${height}\"\n >`;\n document.getElementById(btnId).addEventListener(\"click\", this.onClick);\n }\n }
2,\n\n generateUniqueElementId: function() {\n return `btn-appl-${Date.now()}-${Math.floor(Math.random() * 1000)}`;\n },\n\n mapButtonStyle: function () {\n return this.styles.color === 'white' ? 'white' : 'black';\n },\n\n mapButtonType: function () {\n switch (this.styles.label) {\n case 'paypal':\n case 'installment':\n return 'plain';\n case 'checkout':\n return 'check-out';\n case 'buynow':\n return 'buy';\n default:\n return 'pay';\n }\n },\n\n enableButton: function () {\n $('#' + this.buttonContainerId).find('button').prop('disabled', false);\n },\n\n disableButton: function () {\n $('#' + this.buttonContainerId).find('button').prop('disabled', true);\n },\n\n performAuthorization: function (paymentData) {},\n\n onClick: function () {},\n\n /**\n * Calls before create order.\n */\n beforeCreateOrder: function () {},\n\n /**\n * Create order.\n *\n * @return {String}\n */\n createOrder: function () {\n let data = {'paymentSource': this.paymentSource};\n\n // add location to the order create request\n let createOrderData = new FormData();\n createOrderData.append('location', this.location);\n\n try {\n this.beforeCreateOrder();\n let orderData = performCreateOrder(this.createOrderUrl, data, createOrderData);\n this.paypalOrderId = this.afterCreateOrder(orderData);\n return this.paypalOrderId;\n } catch (error) {\n this.isErrorDisplayed = false;\n this.catchError(error);\n\n // Propagate the error to be caught in the promise chain\n return Promise.reject(error);\n }\n },\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}\n */\n afterCreateOrder: function (data) {},\n\n /**\n * Catch error on order creation.\n */\n catchCreateOrder: function () {},\n\n /**\n * On payment approve.\n *\n * @param {Object} data\n * @param {Object} actions\n * @return {Promise}\n */\n onApprove: function () {\n const data = {orderID: this.paypalOrderId};\n\n return this.beforeOnAuthorize()\n .then(performOnAuthorize.bind(this, this.updateQuoteUrl, data))\n .then(this.afterOnAuthorize)\n .catch(this.onError);\n },\n\n beforeOnAuthorize: function () {\n return Promise.resolve();\n },\n\n afterOnAuthorize: function () {\n return Promise.resolve();\n },\n\n /**\n * Calls when error happened on paypal side.\n *\n * @param {Error} error\n */\n onError: function (error) {\n console.log('Error: ', error.message);\n },\n\n isEligible: function () {\n return this.eligible;\n },\n\n /**\n * Async Show/hide loader\n *\n * @param {Boolean} show\n */\n showLoaderAsync: function (show) {\n return new Promise(function (resolve, reject) {\n var event = show ? 'processStart' : 'processStop';\n $('body').trigger(event);\n\n // Set minimum time for loader to show\n setTimeout(() => {\n resolve();\n }, 50);\n });\n },\n\n /**\n * Show/hide loader.\n *\n * @param {Boolean} show\n */\n showLoader: function (show) {\n var event = show ? 'processStart' : 'processStop';\n\n $('body').trigger(event);\n },\n\n /**\n * Get region ID by region code and country code\n *\n * @param regionCode\n * @param countryCode\n * @returns {null}\n */\n getRegionIdByCode: function (regionCode, countryCode) {\n return new Promise(function (resolve, reject) {\n $.ajax({\n url: this.countriesUrl.replace(':countryCode', countryCode),\n method: 'GET',\n success: function (response) {\n if (response.available_regions && response.available_regions.length) {\n var matchedRegion = response.available_regions.find(function (region) {\
2n return region.code === regionCode;\n });\n\n if (matchedRegion) {\n resolve(matchedRegion.id);\n } else {\n reject('Region not found');\n }\n } else {\n reject('No regions available for country: ' + countryCode);\n }\n },\n error: function () {\n reject('Error fetching regions for country: ' + countryCode);\n }\n });\n }.bind(this));\n },\n\n /**\n * Catch errors.\n *\n * @param {*} error\n */\n catchError: function (error) {\n this.showLoader(false);\n\n if (this.isErrorDisplayed) {\n return;\n }\n\n if (error.hidden === undefined || !error.hidden) {\n this.addMessage(this.requestProcessingError);\n }\n\n this.isErrorDisplayed = true;\n },\n\n /**\n * Add message to customer data.\n *\n * @param {String} message\n * @param {String} [type]\n */\n addMessage: function (message, type) {\n type = type || 'error';\n\n // Need to set a slight delay to avoid refresh from core\n setTimeout(function () {\n customerData.set('messages', {\n messages: [{\n text: message,\n type: type\n }]\n });\n }, 1000);\n },\n\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/methods/smart-buttons.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'underscore',\n 'uiComponent',\n 'scriptLoader',\n 'Magento_Customer/js/customer-data'\n], function ($, _, Component, loadSdkScript, customerData) {\n 'use strict';\n\n /**\n * Create order request.\n *\n * @param {String} url\n * @param {Object} payPalOrderData\n * @param {FormData} orderData\n * @return {Promise<Object>}\n */\n const performCreateOrder = function (url, payPalOrderData, orderData) {\n orderData = orderData || new FormData();\n orderData.append('form_key', $.mage.cookies.get('form_key'));\n orderData.append('payment_source', payPalOrderData['paymentSource']);\n\n return fetch(url, {\n method: 'POST',\n headers: {},\n body: orderData || new FormData(),\n credentials: 'same-origin'\n }).then(function (response) {\n return response.json();\n });\n },\n\n /**\n * Payment authorization request.\n *\n * @return {Promise<Object>}\n */\n performAuthorization = function (url, data) {\n return fetch(url, {\n method: 'POST',\n headers: {\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n orderId: data.orderID\n })\n }).then((response) => {\n if (!response.ok) {\n throw new Error($t('We\u2019re unable to take that order right now.'));\n }\n return response.json();\n }).then((response) => {\n const parsed = JSON.parse(response);\n if (!parsed.success) {\n throw new Error($t('We\u2019re unable to take that order right now.'));\n }\n\n customerData.invalidate(['cart']);\n window.location.replace(parsed.redirectUrl);\n });\n };\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypal',\n paypal: null,\n paymentSource: '',\n creatOrderUrl: '',\n placeOrderUrl: '',\n authorizeOrderUrl: '',\n setQuoteAsInactiveUrl: '',\n completeOrderUrl: '',\n style: {},\n paymentRequest: {\n applepay: {\n requiredShippingContactFields: []\n }\n },\n element: null,\n instance: null\n },\n\n /** @inheritdoc */\n initialize: function () {\n _.bindAll(this, 'createOrder', 'onApprove', 'onError', 'onCancel');\n this._super();
2\n this.sdkLoaded = loadSdkScript(this.scriptParams, this.sdkNamespace).then(function (sdkScript) {\n this.paypal = sdkScript;\n }.bind(this));\n\n return this;\n },\n\n /**\n * In the case where the button color is not supported by Apple (black or white)\n * Map the button color to black (same behavior as PayPal SDK script)\n *\n * @param buttonStyles\n * @returns {(*&{color: string})|*}\n */\n mapButtonColorForApplePay: function (buttonStyles) {\n var buttonColor = buttonStyles.color;\n\n if (buttonColor === 'black' || buttonColor === 'white') {\n return buttonStyles;\n }\n return {\n ...buttonStyles,\n color: 'black'\n };\n },\n\n /**\n * Render Smart Buttons.\n *\n * @param {HTMLElement} element\n * @return {*}\n */\n render: function (element) {\n var buttonsConfig;\n\n if (typeof this.paypal === 'undefined' || !this.paypal.Buttons) {\n return null;\n }\n\n if (element) {\n this.element = element;\n }\n\n buttonsConfig = {\n element: this.element,\n paymentRequest: this.paymentRequest,\n style: this.styles,\n onClick: this.onClick,\n createOrder: this.createOrder,\n onApprove: this.onApprove,\n onError: this.onError,\n onCancel: this.onCancel,\n onInit: this.onInit\n };\n\n if (this.onShippingChange) {\n buttonsConfig.onShippingChange = this.onShippingChange.bind(this);\n }\n if (this.fundingSource) {\n buttonsConfig.fundingSource = this.fundingSource;\n if (this.fundingSource === 'applepay') {\n buttonsConfig.style = this.mapButtonColorForApplePay(this.styles);\n }\n }\n\n this.instance = this.paypal.Buttons(buttonsConfig);\n\n if (this.instance.isEligible()) {\n this.instance.render(this.element);\n }\n\n return this.instance;\n },\n\n /**\n * Calls when smart buttons initializing\n */\n onInit: function () {\n },\n\n /**\n * Calls when user click PayPal button.\n */\n onClick: function () {\n },\n\n /**\n * Calls before create order.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n return Promise.resolve();\n },\n\n /**\n * Create order.\n *\n * @return {Promise}
2\n */\n createOrder: function (data) {\n this.paymentSource = data['paymentSource'];\n\n // add location to the order create request\n let orderData = new FormData();\n orderData.append('location', this.location);\n\n return this.beforeCreateOrder()\n .then(performCreateOrder.bind(this, this.createOrderUrl, data, orderData))\n .then(function (orderData) {\n return this.afterCreateOrder(orderData);\n }.bind(this)).catch(function (error) {\n return this.catchCreateOrder(error);\n }.bind(this)).finally(function (error) {\n return this.finallyCreateOrder(error);\n }.bind(this));\n },\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {*}\n */\n afterCreateOrder: function (data) {\n return data.orderId;\n },\n\n /**\n * Catch error on order creation.\n */\n catchCreateOrder: function () {\n },\n\n /**\n * Finally for order creation.\n *\n */\n finallyCreateOrder: function () {\n },\n\n /**\n * Before authorization call.\n *\n * @return {Promise}\n */\n beforeOnAuthorize: function (data, actions) {\n return Promise.resolve(data);\n },\n\n /**\n * On payment approve.\n *\n * @param {Object} data\n * @param {Object} actions\n * @return {Promise}\n */\n onApprove: function (data, actions) {\n return this.beforeOnAuthorize(data, actions)\n .then(performAuthorization.bind(this, this.completeOrderUrl))\n .catch(function (error) {\n return this.catchOnAuthorize(error);\n }.bind(this)).finally(function (error) {\n return this.finallyOnAuthorize(error);\n }.bind(this));\n },\n\n /**\n * Catch payment authorization errors.\n */\n catchOnAuthorize: function () {\n },\n\n /**\n * Finally for payment authorization.\n */\n finallyOnAuthorize: function () {\n },\n\n /**\n * Calls when shipping address changes..\n *\n * @param {Object} data\n */\n onShippingChange: undefined,\n\n /**\n * Calls when error happened on PayPal side.\n *\n * @param {Error} error\n */\n onError: function (error) {\n console.log('Error: ', error.message);\n },\n\n /**\n * Calls when user canceled payment.\n */\n onCancel: function () {}\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer/hosted-fields.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'underscore',\n 'mage/translate',\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'Magento_Checkout/js/action/set-billing-address',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Vault/js/view/payment/vault-enabler',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_PaymentServicesPaypal/js/lib/script-loader',\n 'ko'\n], function (\n $,\n _,\n $t,\n Component,\n quote,\n loader,\n ResponseError,\n setBillingAddressAction,\n globalMessageList,\n VaultEnabler,\n additionalValidators,\n scriptLoader,\n ko\n) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n isFormValid: false,\n invalidFields: [],\n isAvailable: false,\n isFormRendered: false,\n fields: {\n number: {\n class: 'card-number-field',\n label: $t('Credit Card Number'),\n errorMessage: $t('Please enter a valid credit card number.'),\n selector: '#${ $.formId } .${ $.fields.number.class }',\n placeholder: '',\n showLockIcon: true\n },\n expirationDate: {\n class: 'expiration-date-field',\n selector: '#${ $.formId } .expiration-date-field',\n label: $t('Expiration Date'),\n errorMessage: $t('Incorrect credit card expiration date.'),\n placeholder: 'MM/YY'\n },\n cvv: {\n class: 'cvv-field',\n selector: '#${ $.formId } .cvv-field',\n label: $t('Card Security Code'),\n errorMessage: $t('Please enter a valid credit card security code.'),\n tooltip: {\n title: $t('What is this?'),\n src: $.cvvImgUrl,\n contentUnsanitizedHtml: '<img src=\"${ $.cvvImgUrl }\" ' +\n 'alt=\"${ $.cvvTitle }\" title=\"${ $.cvvTitle }\" />'\n },\n placeholder: ''\n }\n },\n cardsByCode: {\n \"amex\": \"AE\",\n \"discover\": \"DI\",\n \"elo\": \"ELO\",\n \"hiper\": \"HC\",\n \"jcb\": \"JCB\",\n \"mastercard\": \"MC\",\n \"visa\": \"VI\",\n },\n cards: {\n AE: {\n eligibilityCode: 'amex',\n typeCode: 'american-express'\n },\n DI: {\n eligibilityCode: 'discover',\n typeCode: 'discover'\n }
2,\n ELO: {\n eligibilityCode: 'elo',\n typeCode: 'elo'\n },\n HC: {\n eligibilityCode: 'hiper',\n typeCode: 'hiper'\n },\n JCB: {\n eligibilityCode: 'jcb',\n typeCode: 'jcb'\n },\n MC: {\n eligibilityCode: 'mastercard',\n typeCode: 'master-card'\n },\n VI: {\n eligibilityCode: 'visa',\n typeCode: 'visa'\n }\n },\n orderCreateErrorMessage: {\n default: $t('Failed to place order. Try again or refresh the page if that does not resolve the issue.'), // eslint-disable-line max-len,\n 'POSTAL_CODE_REQUIRED': $t('Postal code is required.'),\n 'CITY_REQUIRED': $t('City is required.')\n },\n availableCards: [],\n getOrderDetailsUrl: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].getOrderDetailsUrl, // eslint-disable-line max-len\n requiresCardDetails: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].requiresCardDetails, // eslint-disable-line max-len\n ccIcons: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].ccIcons,\n paymentSource: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].paymentSource,\n cvvImgUrl: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].cvvImageUrl,\n isCommerceVaultEnabled: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].isCommerceVaultEnabled, // eslint-disable-line max-len\n emptyErrorMessage: $t('This is a required field.'),\n paymentTypeIconUrl: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].paymentTypeIconUrl, // eslint-disable-line max-len\n paymentTypeIconTitle: $t('Pay with credit card'),\n lockTitle: $t('Secure transaction'),\n cvvTitle: $t('The card security code is a three or four digit number printed on a credit card. Visa, Mastercard, and Discover cards have a three digit code on the card back. American Express cards have a four digit code on the card front.'), // eslint-disable-line max-len\n paymentMethodValidationError: $t('Your payment was not successful. Ensure you have entered your details correctly and try again, or try a different payment method. If you have continued problems, contact the issuing bank for your payment method.'), // eslint-disable-line max-len\n notEligibleErrorMessage: $t('This payment option is currently unavailable.'),\n generalErrorMessage: '${ $.paymentMethodValidationError }',\n placeOrderTitle: $t('Place Order'),\n formId: 'hosted-fields-form',\n template: 'Magento_PaymentServicesPaypal/payment/credit-card',\n ccType: '',\n billingAddress: quote.billingAddress,\n paymentsOrderId: null,\n paypalOrderId: null,\n cardBin: null,\n holderName: null,\n cardLast4: null,\n cardExpiryMonth: null,\n cardExpiryYear: null,\n hostedFields: null,\n shouldCardBeVaulted: false,\n\n paymentsSdk: null,\n paymentsSdkInitPromise: null,\n isInProgress: ko.observable(false),\n },\n\n /** @inheritdoc */\n initialize: function () {\n _.bindAll(\n this,\n 'onError',\n 'getOrderCardDetails'\n );\n this._super();\n this.initPaymentsSDK();\n this.initVaulting();\n\n return this;\n },\n\n /**\n * Initialize Payments SDK\n * Load js script and initialize SDK\n */\n initPaymentsSDK: function () {\n this.paymentsSdkInitPromise = new Promise(\n function (resolve, reject) {\n scriptLoader.loadCustom({url: this.getPaymentsSDKUrl()})\n .then(function () {\n const sdkConfig = {\n storeViewCode: this.getGraphQLStoreCode()\n }\n\n if (this.getGraphQLToken()) {\n sdkConfig.getCustomerToken = () => this.getGraphQLToken();\n }\n\n if (this.getGraphQLUrl()) {\n sdkConfig.apiUrl = this.getGraphQLUrl();\n }\n\n this.paymentsSdk = new window.PaymentServicesSDK(sdkConfig);\n\n this.paymentsSdk.Payment.init({location: \"CHECKOUT\"})\n .then(() => {resolve()})\n .catch((e) => {reject(e)});\n }.bind(this)).catch((e) => {reject(e)});\n }.bind(this)\n );\n },\n\n /**\n * Initialize vaulting\n */\n initVaulting: function () {\n this.vaultEnabler = new VaultEnabler();\n this.vaultEnabler.isActivePaymentTokenEnabler(false);\n this.vaultEnabler.setPaymentCode(window.checkoutConfig.payment[this.getCode()].ccVaultCode);\n }
2,\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe('billingAddress paymentsOrderId paypalOrderId cardBin ' +\n 'holderName cardLast4 cardExpiryMonth cardExpiryYear ' +\n 'ccType isFormValid invalidFields availableCards isAvailable isFormRendered shouldCardBeVaulted');\n\n return this;\n },\n\n /** @inheritdoc */\n getCode: function () {\n return 'payment_services_paypal_hosted_fields';\n },\n\n /** @inheritdoc */\n getData: function () {\n var data = this._super();\n\n data['additional_data'] = {\n payments_order_id: this.paymentsOrderId(),\n paypal_order_id: this.paypalOrderId(),\n payment_source: this.paymentSource\n };\n\n if (this.cardBin()) {\n data['additional_data']['cardBin'] = this.cardBin();\n }\n\n if (this.holderName()) {\n data['additional_data']['holderName'] = this.holderName();\n }\n\n if (this.cardLast4()) {\n data['additional_data']['cardLast4'] = this.cardLast4();\n }\n\n if (this.cardExpiryMonth()) {\n data['additional_data']['cardExpiryMonth'] = this.cardExpiryMonth();\n }\n\n if (this.cardExpiryYear()) {\n data['additional_data']['cardExpiryYear'] = this.cardExpiryYear();\n }\n\n this.vaultEnabler.visitAdditionalData(data);\n return data;\n },\n\n /** @inheritdoc */\n afterRender: function () {\n this.$form = $('#' + this.formId);\n\n this.paymentsSdkInitPromise.then(function () {\n this.isAvailable(this.paymentsSdk.Payment.CreditCard.isAvailable())\n\n if (!this.isAvailable()) {\n this.isFormRendered(true);\n return;\n }\n\n this.paymentsSdk.Payment.CreditCard.render({\n fields: {\n number: {\n selector: this.fields.number.selector,\n label: this.fields.number.label,\n class: this.fields.number.class,\n },\n expirationDate: {\n selector: this.fields.expirationDate.selector,\n label: this.fields.expirationDate.label,\n class: this.fields.expirationDate.class,\n },\n cvv: {\n selector: this.fields.cvv.selector,\n label: this.fields.cvv.label,\n class: this.fields.cvv.class,\n },\n },\n styles: {\n input: {\n color: '#ccc',\n 'font-family': '\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif',\n 'font-size': '16px',\n 'font-weight': '400'\n }
2,\n ':focus': {\n color: '#333'\n },\n '.valid': {\n color: '#333'\n }\n },\n onRender: this.onRender.bind(this),\n getCartId: this.getMaskedCardId,\n onStart: this.onStart.bind(this),\n onSuccess: this.onSuccess.bind(this),\n getBillingAddress: this.getBillingAddress.bind(this),\n getShouldVaultCard: () => this.isCommerceVaultEnabled && this.checkShouldCardBeVaulted(),\n onValidityChange: this.onValidityChange.bind(this),\n onCardTypeChange: this.onCardTypeChange.bind(this),\n onError: this.onError.bind(this),\n getShouldSetPaymentMethodOnCard: () => false,\n });\n }.bind(this))\n .catch((e) => {\n console.log('Error initializing Payments SDK', e);\n this.isFormRendered(true);\n this.isAvailable(false);\n });\n },\n\n /**\n * Get masked cart id\n */\n getMaskedCardId: function () {\n return window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].quoteMaskedId;\n },\n\n /**\n * Get Payments SDK URL to load JS script\n */\n getPaymentsSDKUrl: function () {\n return window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].paymentsSDKUrl;\n },\n\n /**\n * Get GraphQL store code to use in GraphQL requests\n */\n getGraphQLStoreCode: function () {\n return window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].storeViewCode;\n },\n\n /**\n * Get GraphQL edpoint\n */\n getGraphQLUrl: function () {\n return window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].graphQLEndpointUrl;\n },\n\n /**\n * Get GraphQL token for authentication\n */\n getGraphQLToken: function () {\n return window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].oauthToken;\n },\n\n /**\n * Provide billing address for the order\n */\n getBillingAddress: function () {\n return {\n firstName: this.billingAddress().firstname,\n lastName: this.billingAddress().lastname,\n streetAddress: this.billingAddress().street[0],\n extendedAddress: this.billingAddress().street[1],\n region: this.billingAddress().region,\n locality: this.billingAddress().city,\n postalCode: this.billingAddress().postcode,\n countryCodeAlpha2: this.billingAddress().countryId,\n };\n },\n\n /**\n * Start callback for Hosted Fields\n * Called when the form is submitted\n *\n * @param preventCheckout\n * @returns {Promise<void>}\n */\n onStart: async function (preventCheckout) {\n if (!this.canProceedWithOrder()) {\n preventCheckout(\"invalid form\");\n }\n\n loader.startLoader();\n\n await setBillingAddressAction(globalMessageList);\n },\n\n /**\n * Success callback for Hosted Fields\n * Called when PP order is created and card details are collected\n *\n * @param data\n */\n onSuccess: function (data) {\
2n this.paymentsOrderId(data.mpOrderId);\n this.paypalOrderId(data.payPalOrderId);\n\n this.getOrderCardDetails()\n .then(this.placeOrder.bind(this))\n .catch(this.onError.bind(this));\n },\n\n /**\n * Called after Hosted Fields are rendered\n *\n * @param hostedFields\n */\n onRender: function (hostedFields) {\n this.isFormValid(false);\n this.ccType('');\n this.invalidFields([]);\n\n var cards = hostedFields.getEligibleCards()\n .filter(card => this.cardsByCode[card.code] !== undefined)\n .map(card => this.cardsByCode[card.code]);\n\n this.availableCards(cards);\n\n this.$form.off('submit');\n this.$form.on('submit', function (e) {\n e.preventDefault();\n this.isInProgress(true);\n hostedFields.submit()\n .catch(this.onError.bind(this))\n .finally(function () {\n loader.stopLoader();\n this.isInProgress(false);\n }.bind(this));\n }.bind(this));\n\n this.isFormRendered(true);\n },\n\n /**\n * Validity change handler.\n *\n * @param {Object} hostedFields\n * @param {Object} event\n */\n onValidityChange: function (fields, emittedBy) {\n var valid = _.every(fields, function (field) {return field.isValid});\n var invalidFields = this.invalidFields().filter(field => field.name !== emittedBy);\n\n if (!valid) {\n if (fields[emittedBy] && !fields[emittedBy].isValid) {\n invalidFields.push({\n name: emittedBy,\n message: fields[emittedBy].isEmpty ? this.emptyErrorMessage : this.fields[emittedBy].errorMessage\n });\n }\n this.invalidFields(invalidFields)\n }\n\n this.isFormValid(valid);\n this.isFormValid() && this.invalidFields([]);\n },\n\n /**\n * Check if field is valid.\n *\n * @param {String} fieldName\n * @return {Boolean}\n */\n isFieldValid: function (fieldName) {\n return !this.invalidFields.findWhere({\n name: fieldName\n });\n },\n\n /**\n * Get error message for field.\n *\n * @param {String} fieldName\n * @return {String}\n */\n getFieldErrorMessage: function (fieldName) {\n return !this.isFieldValid(fieldName) ? this.invalidFields.findWhere({\n name: fieldName\n }).message : '';\n },\n\n /**\n * Card type changes handler.\n *\n * @param {Array} a list of cards\n */\n onCardTypeChange: function (cards) {\n var code = '';\n\n if (cards.length === 1 && this.cardsByCode[cards[0].code]) {\n code = this.cardsByCode[cards[0].code]\n }\n\n this.ccType(code);\n },\n\n /**\n * Get order card details\n * Used when Signifyd is enabled and requires card details\n *\n * @param response\n * @returns {Promise<any>|Promise<Awaited<unknown>>}\n */\n getOrderCardDetails: function (response) {\n if (!this.requiresCardDetails) {\n return Promise.resolve(response);\n }\n\n return fetch(`${this.getOrderDetailsUrl}`, {\n method: 'GET'\n }).then(function (res) {\n return res.json();\n }
2).then(function (data) {\n if (data.response['is_successful'] && data.response['paypal-order']) {\n const order = data.response['paypal-order'];\n\n this.cardBin(order?.payment_source_details?.card?.bin_details?.bin);\n this.holderName(order?.payment_source_details?.card?.name);\n this.cardLast4(order?.payment_source_details?.card?.last_digits);\n this.cardExpiryMonth(order?.payment_source_details?.card?.card_expiry_month);\n this.cardExpiryYear(order?.payment_source_details?.card?.card_expiry_year);\n }\n\n return response;\n }.bind(this)).catch(function (err) {\n console.log(\n 'Could not get order details. Proceeding with order placement without card details',\n err\n );\n return response;\n });\n },\n\n /**\n * Error callback for transaction.\n */\n onError: function (error) {\n loader.stopLoader();\n var message = this.generalErrorMessage;\n\n if (error instanceof ResponseError) {\n message = error.message;\n } else if (error['debug_id']) {\n message = this.paymentMethodValidationError;\n }\n\n if (this.isOrderCreateError(error)) {\n message = this.parseOrderCreateError(error);\n }\n\n this.messageContainer.addErrorMessage({\n message: message\n });\n\n if (error instanceof Error) {\n console.log(error.toString());\n } else {\n console.log('Error' + JSON.stringify(error));\n }\n },\n\n /**\n * Place order\n * Click event handler for place order button\n */\n placeOrderClick: function () {\n if (this.isPlaceOrderActionAllowed() === true) {\n $('#' + this.formId).trigger('submit');\n }\n },\n\n /**\n * Check if customer checks the \"Save for later\" box upon checkout\n *\n * @returns {*}\n */\n checkShouldCardBeVaulted: function () {\n const checked = this.vaultEnabler.isActivePaymentTokenEnabler();\n\n this.shouldCardBeVaulted(checked);\n return checked;\n },\n\n /**\n * Check if the form is valid and the order can be placed\n *\n * @returns {*}\n */\n canProceedWithOrder: function () {\n return this.validate()\n && additionalValidators.validate()\n && this.isFormValid()\n && this.isPlaceOrderActionAllowed();\n },\n\n isOrderCreateError: function (error) {\n return error?.cause?.graphQLErrors\n ?.find(e => e?.path?.join(\"\").indexOf(\"createPaymentOrder\") > -1) !== undefined;\n },\n\n parseOrderCreateError: function (error) {\n if (this.isErrorCode(error, 'POSTAL_CODE_REQUIRED')) {\n return this.orderCreateErrorMessage.POSTAL_CODE_REQUIRED;\n }\n\n if (this.isErrorCode(error, 'CITY_REQUIRED')) {\n return this.orderCreateErrorMessage.CITY_REQUIRED;\n }\n\n return this.orderCreateErrorMessage.default;\n },\n\n isErrorCode: function (error, code) {\n return error?.cause?.graphQLErrors\n ?.find(e => e?.path?.join(\"\").indexOf(\"createPaymentOrder\") > -1)\n ?.extensions?.debugMessage?.indexOf(code) > -1;\n }\n\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer/fastlane.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'jquery',\n 'mage/translate',\n 'uiRegistry',\n 'Magento_Checkout/js/action/set-billing-address',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_PaymentServicesPaypal/js/helpers/map-address-to-magento',\n 'Magento_PaymentServicesPaypal/js/view/payment/fastlane',\n 'Magento_Ui/js/model/messageList',\n], function (\n $,\n $t,\n uiRegistry,\n setBillingAddressAction,\n loader,\n additionalValidators,\n quote,\n Component,\n mapAddressToMagento,\n fastlaneModel,\n messageList\n) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n code: 'payment_services_paypal_fastlane',\n template: 'Magento_PaymentServicesPaypal/payment/fastlane',\n createOrderUrl: window.checkoutConfig.payment['payment_services_paypal_fastlane'].createOrderUrl,\n paymentTypeIconUrl: window.checkoutConfig.payment['payment_services_paypal_fastlane'].paymentTypeIconUrl, // eslint-disable-line max-len\n paymentTypeIconTitle: $t('Pay with credit card'),\n location: window.checkoutConfig.payment['payment_services_paypal_fastlane'].location,\n paymentSource: window.checkoutConfig.payment['payment_services_paypal_fastlane'].paymentSource,\n requiresCardDetail
2s: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].requiresCardDetails,\n threeDSMode: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].threeDS,\n getOrderDetailsUrl: window.checkoutConfig.payment['payment_services_paypal_hosted_fields'].getOrderDetailsUrl,\n paymentsOrderId: null,\n paypalOrderId: null,\n fastlaneToken: null,\n },\n\n /**\n * @returns {exports.initialize}\n */\n initialize: async function (config) {\n this._super(config);\n\n return this;\n },\n\n afterRender: async function () {\n await fastlaneModel.setup();\n fastlaneModel.renderFastlanePaymentComponent('#payment-services-paypal-fastlane');\n },\n\n onClick: async function () {\n if (!additionalValidators.validate()) {\n return;\n }\n\n // Create the order with PayPal\n // Get the token from Fastlane\n // Submit payment\n try {\n const { id, paymentSource: { card: { billingAddress, name } } } = await fastlaneModel.getPaymentToken(),\n [firstname, ...lastname] = name.split(' '),\n mappedAddress = mapAddressToMagento({ address: billingAddress }),\n shippingAddress = quote.shippingAddress();\n\n // Fastlane doesn't provide a phone number in the billing address so get it from shipping if available.\n if (shippingAddress.telep
2hone) {\n mappedAddress.telephone = shippingAddress.telephone;\n }\n\n // Add the firstname and lastname as these aren't within the billing address from Fastlane either.\n mappedAddress.firstname = firstname;\n mappedAddress.lastname = lastname.join(' ');\n\n quote.billingAddress({...mappedAddress, street: Object.values(mappedAddress.street)});\n\n if (this.isBillingAddressValid()) {\n this.fastlaneToken = id;\n this.placeOrder();\n } else {\n this.isProcessing = false;\n messageList.addErrorMessage({\n message: $t('Your billing address is not valid.')\n });\n }\n } catch(error) {\n loader.stopLoader();\n messageList.addErrorMessage({\n message: $t('Cannot validate payment.')\n });\n }\n },\n\n /**\n * Validates the billing address in the checkout provider.\n *\n * @returns {Boolean}\n */\n isBillingAddressValid() {\n // Load the Braintree payment form.\n const billingAddress = uiRegistry.get('checkoutProvider');\n\n // Reset the validation.\n billingAddress.set('params.invalid', false);\n\n // Call validation and also the custom attributes validation if they exist.\n billingAddress.trigger(billingAddress.dataScopePrefix + '.data.validate');\n\n if (billingAddress.get(billingAddress.dataScopePrefix + '.custom_attributes')) {\n billingAddress.trigger(billingAddress.dataScopePrefix + '.custom_attributes.data.validate');\n }\n\n return !billingAddress.get('params.invalid');\n }
2,\n\n getOrderPaymentDetails: function (data) {\n if (!this.requiresCardDetails) {\n return Promise.resolve(data);\n }\n\n return fetch(`${this.getOrderDetailsUrl}`, {\n method: 'GET'\n }).then((res) => {\n return res.json();\n }).catch(function (err) {\n console.log(\n 'Could not get order details. Proceeding with order placement without card details.',\n err\n );\n return data;\n });\n },\n\n /**\n * Check the 3DS configuration and if the payment has passed validation.\n *\n * @param {Object} data\n * @returns {Promise|Error}\n */\n checkThreeDs: function (data) {\n if (!this.threeDSMode) {\n return Promise.resolve(data);\n }\n\n if (data.liabilityShift === 'POSSIBLE' || data.liabilityShift === undefined) {\n return Promise.resolve(data);\n } else {\n throw new Error('User failed 3DS validation.');\n }\n },\n\n /** @inheritdoc */\n getData: function () {\n var data = this._super();\n\n data['additional_data'] = {\n paypal_fastlane_profile: fastlaneModel.profileData() ? 'Yes' : 'No',\n payment_source: this.paymentSource,\n paypal_fastlane_token: this.fastlaneToken\n };\n\n return data;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer/vault.js":"/**\n * Copyright \u00a9 2013-2017 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'mage/translate',\n 'Magento_Vault/js/view/payment/method-renderer/vault',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'Magento_PaymentServicesPaypal/js/view/errors/response-error',\n 'escaper'\n], function (\n $t,\n VaultComponent,\n loader,\n ResponseError,\n escaper\n) {\n 'use strict';\n\n return VaultComponent.extend({\n defaults: {\n template: 'Magento_PaymentServicesPaypal/payment/vault',\n paymentSource: 'vault',\n paypalOrderId: null,\n paymentsOrderId: null,\n generalErrorMessage: $t('An error occurred. Refresh the page and try again.'),\n paymentMethodValidationError: $t('Your payment was not successful. Try again.'),\n allowedTags: ['br'],\n },\n\n /**\n * Get card brand\n * @returns {String}\n */\n getCardBrand: function () {\n return this.mapCardBrand(this.details.brand);\n },\n\n /**\n * Map the credit card brand received from PayPal to the Commerce standard\n * @param payPalCardBrand\n * @returns {*}\n */\n mapCardBrand: function (payPalCardBrand) {\n const cardBrandMapping = {\n AMEX: 'AE',\n DISCOVER: 'DI',\n DINERS: 'DN',\n ELO: 'ELO',\n HIPER: 'HC',\n JCB: 'JCB',\n MAESTRO: 'MI',\n MASTER_CARD: 'MC',\n MASTERCARD: 'MC',\n VISA: 'VI'\n };\n\n return cardBrandMapping[payPalCardBrand];\n },\n\n /**\n * Get last 4 digits of card\n * @returns {String}\n */\n getMaskedCard: function () {\n return this.details.maskedCC;\n },\n\n /**\n * Get card Description\n * @returns {String}\n */\n getCardDescription: function () {\n return this.details.description;\n },\n\n /**\n * Get formatted card billing address\n * @returns {String}\n */\n getFormattedCardBillingAddress: function () {\n let billingAddress = this.details.billingAddress;\n\n if (!billingAddress) {\n return '';\n }\n\n let street1 = billingAddress.address_line_1 || '';\n let street2 = billingAddress.address_line_2 || '';\n let region = billingAddress.region || '';\n let city = billingAddress.city || '';\n let postalCode = billingAddress.postal_code || '';
2\n let countryCode = billingAddress.country_code || '';\n\n let formattedAddress = street1 + '<br/>';\n\n if (street2 !== '') {\n formattedAddress += street2 + '<br/>';\n }\n\n formattedAddress += region + ' ' + city + ' ' + postalCode + '<br/>' +\n countryCode;\n\n return this.getSafeHtml(formattedAddress);\n },\n\n /**\n * Get card holder name\n * @returns {String}\n */\n getCardHolderName: function () {\n return this.details.cardholderName;\n },\n\n /**\n * Sanitize text\n *\n * @param {String} html\n * @returns {String}\n */\n getSafeHtml: function (html) {\n return escaper.escapeHtml(html, this.allowedTags);\n },\n\n /**\n * Get PayPal order ID\n */\n getData: function () {\n let data = this._super();\n\n data['additional_data']['paypal_order_id'] = this.paypalOrderId;\n data['additional_data']['payments_order_id'] = this.paymentsOrderId;\n data['additional_data']['public_hash'] = this.publicHash;\n data['additional_data']['payment_source'] = this.paymentSource;\n return data;\n },\n\n /**\n * Place order\n */\n onPlaceOrder: function () {\n loader.startLoader();\n this.createOrder()\n .then(function (order) {\n this.onOrderSuccess(order);\n }.bind(this))\n .then(function () {\n this.placeOrder();\n }.bind(this))\n .catch(this.onError.bind(this))\n .finally(loader.stopLoader);\n },\n\n /**\n * Create PayPal order\n * @returns {Promise<any>}\n */\n createOrder: function () {\n var orderData = new FormData();\n\n orderData.append('payment_source', this.paymentSource);\n orderData.append('location', this.location);\n\n return fetch(this.createOrderUrl, {\n method: 'POST',\n headers: {},\n body: orderData,\n credentials: 'same-origin'\n }).then(function (res) {\n return res.json();\n }
2).then(function (data) {\n if (data.response['is_successful']) {\n return data.response['paypal-order'];\n }\n });\n },\n\n /**\n * populate PayPal order ID and trigger Commerce order flow\n * @param order\n */\n onOrderSuccess: function (order) {\n this.paypalOrderId = order['id'];\n this.paymentsOrderId = order['mp_order_id'];\n },\n\n /**\n * handle payment error\n * @param error\n */\n onError: function (error) {\n var message = this.generalErrorMessage;\n\n if (error instanceof ResponseError) {\n message = error.message;\n } else if (error['debug_id']) {\n message = this.paymentMethodValidationError;\n }\n\n this.messageContainer.addErrorMessage({\n message: message\n });\n console.log(error['debug_id'] ? 'Error' + JSON.stringify(error) : error.toString());\n },\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer/google-pay.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'Magento_Checkout/js/view/payment/default',\n 'jquery',\n 'underscore',\n 'mageUtils',\n 'Magento_Checkout/js/model/quote',\n 'mage/translate',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/google-pay',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/set-billing-address',\n 'Magento_Ui/js/model/messageList',\n 'uiRegistry',\n 'Magento_Customer/js/customer-data'\n], function (\n Component,\n $,\n _,\n utils,\n quote,\n $t,\n GooglePayButton,\n additionalValidators,\n setBillingAddressAction,\n globalMessageList,\n registry,\n customerData\n) {\n 'use strict';\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n buttonContainerId: 'google-pay-${ $.uid }',\n template: 'Magento_PaymentServicesPaypal/payment/google-pay',\n isAvailable: false,\n isButtonRendered: false,\n paymentsOrderId: null,\n paypalOrderId: null,\n paymentTypeIconTitle: $t('Pay with Google Pay'),\n requestProcessingError: $t('Error happened when processing the request. Please try again later.'),\n notEligibleErrorMessage: $t('This payment option is currently unavailable.'),\n paymentTypeIconUrl: window.checkoutConfig.payment['payment_services_paypal_google_pay'].paymentTypeIconUrl,\n fundingSource: window.checkoutConfig.payment['payment_services_paypal_google_pay'].paymentSource\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config) {\n _.bindAll(this, 'catchError', 'beforeCreateOrder', 'afterCreateOrder', 'placeOrder', 'onClick');\n config.uid = utils.uniqueid();\n this._super();\n this.initGooglePayButton();\n\n return this;\n },\n\n /**\n * Initialize observables\n *\n * @returns {Component} Chainable.\n */\n initObservable: function () {\n this._super().observe('isAvailable isButtonRendered');\n\n return this;\n },\n\n initGooglePayButton: function () {\n this.googlePayButton = new GooglePayButton({\n scriptParams: window.checkoutConfig.payment[this.getCode()].sdkParams,\n createOrderUrl: window.checkoutConfig.payment[this.getCode()].createOrderUrl,\n onClick: this.onClick,\n beforeCreateOrder: this.beforeCreateOrder,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n onError: this.catchError,\n buttonContainerId: this.buttonContainerId,\n onApprove: this.placeOrder,\n styles: window.checkoutConfig.payment[this.getCode()].styles,\n mode: window.checkoutConfig.payment[this.getCode()].mode,\n shippingAddressRequired: false,\n getOrderDetailsUrl: window.checkoutConfig.payment[this.getCode()].getOrderDetailsUrl,\n threeDSMode: window.checkoutConfig.payment[this.getCode()].threeDSMode,\n location: window.checkoutConfig.payment[this.getCode()].location,\n });\n\n if (!this.isPlaceOrderActionAllowed()) {\n this.googlePayButton.disableButton();\n }\n\n this.isPlaceOrderActionAllowed.subscribe(function (isAllowed) {\n if (isAllowed) {\n this.googlePayButton.enableButton();\n } else {\n this.googlePayButton.disableButton();\n }\n }.bind(this));\n },\n\n /**\n * Get method code\n *\n * @return {String}\n */\n getCode: function () {\n return 'payment_services_paypal_google_pay';\n },\n\n /**\n * Get method data\n *\n * @return {Object}\n */\n getData: function () {\n return {\n 'method': this.item.method,\n 'additional_data': {\n 'payments_order_id': this.paymentsOrderId,\n 'paypal_order_id': this.paypalOrderId,\n 'payment_source': this.fundingSource\n }\n };\n },\n\n onClick: function () {\n this.googlePayButton.showLoaderAsync(true)\n .then(() =>
2 {\n return this.googlePayButton.createOrder();\n })\n .then(() => {\n refreshCustomerData(window.checkoutConfig.payment[this.getCode()].createOrderUrl);\n })\n .catch(error => {\n this.catchError(error);\n });\n },\n\n /**\n * Render buttons\n */\n afterRender: function () {\n this.googlePayButton.sdkLoaded\n .then(function () {\n this.googlePayButton.initGoogleSDK()\n .then(function () {\n this.isAvailable(this.googlePayButton.isEligible());\n }.bind(this)).catch(function () {\n this.isAvailable(false);\n }.bind(this)).finally(function () {\n this.isButtonRendered(true);\n }.bind(this)\n );\n }.bind(this));\n },\n\n /**\n * Before order created.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n if (this.validate() && this.isPlaceOrderActionAllowed() && additionalValidators.validate()) {\n setBillingAddressAction(globalMessageList)\n .fail(function () {\n throw {message: 'Failed to set billing address'};\n });\n } else {\n throw {message: 'before create order validation failed', hidden: true};\n }\n },\n\n /**\n * @inheritdoc\n */\n validate: function () {\n var isShippingValid = true,\n source, shippingAddress;\n\n if (!this._super()) {\n return false;\n }\n source = registry.get('checkoutProvider');\n shippingAddress = registry.get('index = shippingAddress');\n\n if (source && shippingAddress) {\n source.set('params.invalid', false);\n if (quote.billingAddress() === null) {\n this.triggerBillingValidation(source);\n }\n\n // skip shipping validation if quote is virtual or in-store pickup\n if (!quote.isVirtual() && !quote.shippingMethod()['method_code'] === 'pickup') {\n isShippingValid = shippingAddress.validateShippingInformation();\n }\n\n return isShippingValid && !source.get('params.invalid');\n }\n\n return true;\n },\n\n /**\n * Trigger billing address validation\n *\n * @param {Object} source\n */\n triggerBillingValidation: function (source) {\n var dataScope = `billingAddress${ window.checkoutConfig.displayBillingOnPaymentMethod ?\n this.getCode() : 'shared'}`;\n\n source.trigger(`${ dataScope }.data.validate`);\n\n if (source.get(`${dataScope}.custom_attributes`)) {\n source.trigger(`${dataScope}.custom_attributes.data.validate`);\n }\n },\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}
2\n */\n afterCreateOrder: function (data) {\n if (data.response['paypal-order'] && data.response['paypal-order']['mp_order_id']) {\n this.paymentsOrderId = data.response['paypal-order']['mp_order_id'];\n this.paypalOrderId = data.response['paypal-order'].id;\n\n let displayItems = [],\n subTotal = this.getTotalsSegment('subtotal'),\n shippingTotal = this.getTotalsSegment('shipping'),\n taxTotal = this.getTotalsSegment('tax'),\n discountTotal = this.getTotalsSegment('discount');\n\n if (subTotal != null) {\n displayItems.push(\n {\n label: $t('Subtotal'),\n type: 'SUBTOTAL',\n price: subTotal.value.toString()\n }\n );\n }\n if (taxTotal != null) {\n displayItems.push(\n {\n label: $t('Tax'),\n type: 'TAX',\n price: taxTotal.value.toString()\n }\n );\n }\n\n if (shippingTotal != null) {\n displayItems.push(\n {\n label: $t('Shipping'),\n type: 'LINE_ITEM',\n price: shippingTotal.value.toString()\n }\n );\n }\n\n if (discountTotal != null) {\n displayItems.push(\n {\n label: $t('Discount'),\n type: 'LINE_ITEM',\n price: discountTotal.value.toString()\n }\n );\n }\n\n this.googlePayButton.showPopup({\n displayItems: displayItems,\n currencyCode: quote.totals()['base_currency_code'].toString(),\n totalPriceStatus: 'FINAL',\n totalPrice: quote.totals()['base_grand_total'].toString(),\n totalPriceLabel: $t('Total')\n });\n\n return this.paypalOrderId;\n }\n\n throw new Error();\n },\n\n /**\n * Catch error.\n *\n * @param {Error} error\n */\n catchError: function (error) {\n if (error.hidden === undefined || !error.hidden) {\n this.messageContainer.addErrorMessage({\n message: this.requestProcessingError\n });\n }\n\n this.googlePayButton.showLoader(false);\n\n console.log('Error: ', error);\n },\n\n getTotalsSegment: function (code) {\n var segment = null;\n\n if (!('total_segments' in quote.totals())) {\n return null;\n }\n\n quote.totals()['total_segments'].forEach(function (s) {\n if (s.code === code) {\n segment = s;\n }\n });\n\n return segment;\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer/apple-pay.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'Magento_Checkout/js/view/payment/default',\n 'jquery',\n 'underscore',\n 'mageUtils',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'mage/translate',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/apple-pay',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/set-billing-address',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Customer/js/customer-data'\n], function (\n Component,\n $,\n _,\n utils,\n quote,\n fullScreenLoader,\n $t,\n ApplePayButton,\n additionalValidators,\n setBillingAddressAction,\n globalMessageList,\n customerData\n) {\n 'use strict';\n\n var refreshCustomerData = function (url) {\n // Trigger aja
2xComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalApplePay',\n fundingSource: 'applepay',\n buttonContainerId: 'apple-pay-${ $.uid }',\n template: 'Magento_PaymentServicesPaypal/payment/apple-pay',\n isAvailable: false,\n isButtonRendered: false,\n grandTotalAmount: null,\n paymentsOrderId: null,\n paypalOrderId: null,\n paymentTypeIconTitle: $t('Pay with Apple Pay'),\n requestProcessingError: $t('Error happened when processing the request. Please try again later.'),\n notEligibleErrorMessage: $t('This payment option is currently unavailable.'),\n paymentTypeIconUrl: window.checkoutConfig.payment['payment_services_paypal_apple_pay'].paymentTypeIconUrl\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config) {\n _.bindAll(this, 'catchError', 'beforeCreateOrder', 'afterCreateOrder', 'placeOrder', 'onClick');\n config.uid = utils.uniqueid();\n this._super();\n this.initApplePayButton();\n\n return this;\n },\n\n /**\n * Initialize observables\n *\n * @returns {Component} Chainable.\n */\n initObservable: function () {\n this._super().observe('grandTotalAmount isAvailable isButtonRendered');\n this.grandTotalAmount(quote.totals()['base_grand_total']);\n\n return this;\n },\n\n /**\n * Create instance of smart buttons.\n */\n initApplePayButton: function () {\n this.applePayButton = new ApplePayButton({\n scriptParams: window.checkoutConfig.payment[this.getCode()].sdkParams,\n createOrderUrl: window.checkoutConfig.payment[this.getCode()].createOrderUrl,\n estimateShippingMethodsWhenLoggedInUrl: window.checkoutConfig.payment[this.getCode()].estimateShippingMethodsWhenLoggedInUrl,\n estimateShippingMethodsWhenGuestUrl: window.checkoutConfig.payment[this.getCode()].estimateShippingMethodsWhenGuestUrl,\n shippingInformationWhenLoggedInUrl: window.checkoutConfig.payment[this.getCode()].shippingInformationWhenLoggedInUrl,\n shippingInformationWhenGuestUrl: window.checkoutConfig.payment[this.getCode()].shippingInformationWhenGuestUrl,\n updatePayPalOrderUrl: window.checkoutConfig.payment[this.getCode()].updatePayPalOrderUrl,\n countriesUrl: window.checkoutConfig.payment[this.getCode()].countriesUrl,\n onClick: this.onClick,\n beforeCreateOrder: this.beforeCreateOrder,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n onError: this.catchError,\n buttonContainerId: this.buttonContainerId,\n onApprove: this.placeOrder,\n styles: window.checkoutConfig.payment[this.getCode()].buttonStyles,\n location: window.checkoutConfig.payment[this.getCode()].location,\n });\n },\n\n /**\n * Get method code\n *\n * @return {String}\n */\n getCode: function () {\n return 'payment_services_paypal_apple_pay';\n },\n\n /**\n * Get method data\n *\n * @return {Object}\n */\n getData: function () {\n return {\n 'method': this.item.method,\n 'additional_data': {\n 'payments_order_id': this.paymentsOrderId,\n 'paypal_order_id': this.paypalOrderId,\n 'payment_source': this.fundingSource\n }\n };\n }
2,\n\n /**\n * Render buttons\n */\n afterRender: function () {\n this.applePayButton.sdkLoaded\n .then(this.applePayButton.initAppleSDK)\n .then(function () {\n this.isAvailable(true);\n this.isButtonRendered(true);\n }.bind(this)\n ).catch(function () {\n this.isAvailable(false);\n }.bind(this)).finally(function () {\n this.isButtonRendered(true);\n }.bind(this));\n },\n\n /**\n * Enable/disable buttons.\n *\n * @param {Object} data\n * @param {Object} actions\n */\n onInit: function (data, actions) {\n if (!this.isPlaceOrderActionAllowed()) {\n actions.disable();\n }\n\n this.isPlaceOrderActionAllowed.subscribe(function (isAllowed) {\n if (isAllowed) {\n actions.enable();\n } else {\n actions.disable();\n }\n });\n },\n\n /**\n * Validate form onClick\n *\n * @param {Object} data\n * @param {Object} actions\n * @return {*}\n */\n onClick: function (data, actions) {\n this.applePayButton.showLoaderAsync(true)\n .then(() => {\n this.applePayButton.createOrder();\n })\n .then(() => {\n refreshCustomerData(window.checkoutConfig.payment[this.getCode()].createOrderUrl);\n })\n .catch(error => {\n this.catchError(error);\n });\n },\n\n /**\n * Before order created.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n if (this.validate() && this.isPlaceOrderActionAllowed() && additionalValidators.validate()) {\n return new Promise(function (resolve, reject) {\n setBillingAddressAction(globalMessageList).done(resolve.bind(null, null)).fail(reject);\n });\n } else {\n throw {message: 'before create order validation failed', hidden: true};\n }\n },\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}
2\n */\n afterCreateOrder: function (data) {\n if (data.response['paypal-order'] && data.response['paypal-order']['mp_order_id']) {\n this.paymentsOrderId = data.response['paypal-order']['mp_order_id'];\n this.paypalOrderId = data.response['paypal-order'].id;\n\n this.applePayButton.showPopup(data, quote);\n\n return this.paypalOrderId;\n }\n\n throw new Error();\n },\n\n /**\n * Catch error.\n *\n * @param {Error} error\n */\n catchError: function (error) {\n this.messageContainer.addErrorMessage({\n message: this.requestProcessingError\n });\n console.log('Error: ', error.message);\n }\n });\n});\n","Magento_PaymentServicesPaypal/js/view/payment/method-renderer/smart-buttons.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'Magento_Checkout/js/view/payment/default',\n 'jquery',\n 'underscore',\n 'mageUtils',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'mage/translate',\n 'Magento_PaymentServicesPaypal/js/view/payment/methods/smart-buttons',\n 'Magento_PaymentServicesPaypal/js/view/payment/message',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/set-billing-address',\n 'Magento_Ui/js/model/messageList',\n 'uiRegistry',\n 'Magento_Customer/js/customer-data'\n], function (\n Component,\n $,\n _,\n utils,\n quote,\n fullScreenLoader,\n $t,\n SmartButtons,\n Message,\n additionalValidators,\n setBillingAddressAction,\n globalMessageList,\n registry,\n customerData\n) {\n 'use strict';\n\n var refreshCustomerData = function (url) {\n // Trigger ajaxComplete event to update customer data\n customerData.onAjaxComplete(\n {},\n {\n type: 'POST',\n url: url,\n }\n );\n }\n\n return Component.extend({\n defaults: {\n sdkNamespace: 'paypalCheckoutButtons',\n buttonsContainerId: 'smart-buttons-${ $.uid }',\n payLaterMessageContainerId: 'pay-later-message-${ $.uid }',\n template: 'Magento_PaymentServicesPaypal/payment/smart-buttons',\n isAvailable: false,\n isButtonsRendered: false,\n grandTotalAmount: null,\n paymentsOrderId: null,\n paypalOrderId: null,\n requestProcessingError: $t('Error happened when processing the request. Please try again later.'),\n notEligibleErrorMessage: $t('This payment option is currently unavailable.'),\n paymentTypeIconUrl: window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].paymentTypeIconUrl, // eslint-disable-line max-len\n paymentTypeIconTitle: $t('Pay with PayPal')\n },\n\n /**\n * @inheritdoc\n */\n initialize: function (config) {\n _.bindAll(this, 'onClick', 'onInit', 'catchError', 'beforeCreateOrder', 'afterCreateOrder');\n config.uid = utils.uniqueid();\n this._super();\n this.initSmartButtons();\n this.initMessage();\n quote.totals.subscribe(function (totals) {\n this.grandTotalAmount(totals['base_grand_total']);\n this.message.updateAmount(totals['base_grand_total']);\n }.bind(this));\n\n return this;\n },\n\n /**\n * Initialize observables\n *\n * @returns {Component} Chainable.\n */\n initObservable: function () {\n this._super().observe('grandTotalAmount isAvailable isButtonsRendered');\n this.grandTotalAmount(quote.totals()['base_grand_total']);\n\n return this;\n },\n\n /**\n * Create instance of smart buttons.\n */\n initSmartButtons: function () {\n this.buttons = new SmartButtons({\n sdkNamespace: this.sdkNamespace,\n scriptParam
2s: window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].sdkParams,\n createOrderUrl: window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].createOrderUrl,\n styles: window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].buttonStyles,\n onInit: this.onInit,\n onClick: this.onClick,\n beforeCreateOrder: this.beforeCreateOrder,\n afterCreateOrder: this.afterCreateOrder,\n catchCreateOrder: this.catchError,\n onApprove: function () {\n this.placeOrder();\n }.bind(this),\n onError: this.catchError,\n location: window.checkoutConfig.payment[this.getCode()].location,\n });\n },\n\n /**\n * Initialize message component\n */\n initMessage: function () {\n this.message = new Message({\n scriptParams: window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].sdkParams,\n element: this.element,\n renderContainer: '#' + this.payLaterMessageContainerId,\n styles: window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].messageStyles,\n placement: 'payment',\n amount: this.grandTotalAmount()\n });\n },\n\n /**\n * Get method code\n *\n * @return {String}\n */\n getCode: function () {\n return 'payment_services_paypal_smart_buttons';\n },\n\n /**\n * Get method data\n *\n * @return {Object}\n */\n getData: function () {\n return {\n 'method': this.item.method,\n 'additional_data': {\n 'payments_order_id': this.paymentsOrderId,\n 'paypal_order_id': this.paypalOrderId,\n 'payment_source': this.buttons.paymentSource\n }\n };\n },\n\n /**\n * Render buttons\n */\n afterRender: function () {\n this.buttons.sdkLoaded.then(function () {\n this.buttons.render('#' + this.buttonsContainerId);\n this.renderMessage();\n this.isAvailable(!!this.buttons.instance && this.buttons.instance.isEligible());\n }.bind(this)).catch(function () {\n this.isAvailable(false);\n\n return this.buttons;\n }.bind(this)).finally(function () {\n this.isButtonsRendered(true);\n }.bind(this));\n },\n\n /**\n * Render message\n */\n renderMessage: function () {\n if (window.checkoutConfig.payment['payment_services_paypal_smart_buttons'].canDisplayMessage) {\n this.message.render();\n }\n },\n\n /**\n * Enable/disable buttons.\n *\n * @param {Object} data\n * @param {Object} actions\n */\n onInit: function (data, actions) {\n if (!this.isPlaceOrderActionAllowed()) {\n actions.disable();\n }\n\n this.isPlaceOrderActionAllowed.subscribe(function (isAllowed) {\n if (isAllowed) {\n actions.enable();\n } else {\n actions.disable();\n }\n });\n },\n\n /**\n * @inheritdoc\n */\n validate: function () {\n var isShippingValid = true,\n source, shippingAddress;\n\n if (!this._super()) {\n return false;\n }\n source = registry.get('checkoutProvider');\n shippingAddress = registry.get('index = shippingAddress');\n\n if (source && shippingAddress) {\n source.set('params.invalid', false);\n if (quote.billingAddress() === null) {\n this.triggerBillingValidation(source);\n }\n\n // skip shipping validation if quote is virtual or in-store pickup\n if (!quote.isVirtual() && !quote.shippingMethod()['method_code'] === 'pickup') {\n isShippingValid = shippingAddress.validateShippingInformation();\n }\n\n return isShippingValid && !source.get('params.invalid');\n }\n\n return true;\n },\n\n /**\n * Trigger billing address validation\n *\n * @param {Object} source\n */\n triggerBillingValidation: function (source) {\n var dataScope = `billingAddress${ window.checkoutConfig.displayBillingOnPaymentMethod ?\n this.getCode() : 'shared'}`;\n\n source.trigger(`${ dataScope }.data.validate`);\n\n if (source.get(`${dataScope}.custom_attributes`)) {\n source.trigger(`${dataScope}.custom_attributes.data.validate`);\n }\n },\n\n /**\n * Validate form onClick\n *\n * @param {Object} data\n * @param {Object} actions\n * @return {*}\n */\n onClick: function (data, actions) {\n if (this.validate() && additionalValidators.validate()) {\n return actions.resolve();\n }\n\n return actions.reject();\n },\n\n /**\n * Before order created.\n *\n * @return {Promise}\n */\n beforeCreateOrder: function () {\n return new Promise(function (resolve, reject) {\n setBillingAddressAction(globalMessageList).done(resolve.bind(null, null)).fail(reject);\n });\n }
2,\n\n /**\n * After order created.\n *\n * @param {Object} data\n * @return {String}\n */\n afterCreateOrder: function (data) {\n if (data.response['paypal-order'] && data.response['paypal-order']['mp_order_id']) {\n refreshCustomerData(window.checkoutConfig.payment[this.getCode()].createOrderUrl);\n\n this.paymentsOrderId = data.response['paypal-order']['mp_order_id'];\n this.paypalOrderId = data.response['paypal-order'].id;\n\n return this.paypalOrderId;\n }\n\n throw new Error();\n },\n\n /**\n * Catch error.\n *\n * @param {Error} error\n */\n catchError: function (error) {\n this.messageContainer.addErrorMessage({\n message: this.requestProcessingError\n });\n console.log('Error: ', error.message);\n }\n\n });\n});\n","Magento_PaymentServicesPaypal/js/view/errors/response-error.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n /**\n * Error type to handle response errors.\n *\n * @param {String} message\n * @constructor\n */\n function ResponseError(message) {\n this.name = 'ResponseError';\n this.message = message;\n this.stack = new Error().stack;\n }\n\n ResponseError.prototype = new Error;\n\n /**\n * Return a string representation\n *\n * @returns {String}\n */\n ResponseError.prototype.toString = function () {\n return this.message;\n };\n\n return ResponseError;\n});\n","Magento_PaymentServicesPaypal/js/model/payment-service-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* eslint-disable no-undef */\ndefine([\n 'underscore',\n 'mage/utils/wrapper'\n], function (_, wrapper) {\n 'use strict';\n\n /**\n * Free method filter\n * @param {Object} paymentMethod\n * @return {Boolean}\n */\n var paymentServicesMethods = [\n 'payment_services_paypal_smart_buttons',\n 'payment_services_paypal_apple_pay',\n 'payment_services_paypal_google_pay',\n 'payment_services_paypal_hosted_fields',\n 'payment_services_paypal_fastlane'\n ],\n\n /**\n * Check if payment method is from payment services.\n *\n * @param {String} needleName\n * @param {String} paymentMethod\n * @returns {Boolean}\n */\n isPaymentServicesButtonsPaymentMethod = function (needleName, paymentMethod) {\n return paymentMethod.method === needleName;\n },\n\n /**\n * Check if Apple Pay method is available.\n */\n checkApplePayAvailability = function () {\n window.checkoutConfig.payment['payment_services_paypal_apple_pay'].isVisible = !!(\n window.checkoutConfig.payment['payment_services_paypal_apple_pay'].isVisible &&\n window.ApplePaySession\n );\n !window.ApplePaySession && console.log('Apple Pay is not supported or not available');\n },\n\n extender = {\n /**\n * Filter hidden payment methods.\n *\n * @param {Function} originFn - Original method.\n * @param {Array} methods\n */\n setPaymentMethods: function (originFn, methods) {\n var paymentServicesButtonMethodIndex;\n\n checkApplePayAvailability();\n\n _.each(paymentServicesMethods, function (paymentMethod) {\n if (!window.checkoutConfig.payment[paymentMethod].isVisible) {\n paymentServicesButtonMethodIndex = _.findIndex(\n methods,\n isPaymentServicesButtonsPaymentMethod.bind(null, paymentMethod)\n );\n paymentServicesButtonMethodIndex >= 0 && methods.splice(paymentServicesButtonMethodIndex, 1);\n }\n });\n\n return originFn(methods);\n }\n };\n\n return function (target) {\n return wrapper.extend(target, extender);\n };\n});\n","Magento_Review/js/submit-review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery'\n], function ($) {\n 'use strict';\n\n return function (config, element) {\n $(element).on('submit', function () {\n if ($(this).val
2id()) {\n $(this).find('.submit').attr('disabled', true);\n }\n });\n };\n});\n","Magento_Review/js/error-placement.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/mage'\n], function ($) {\n 'use strict';\n\n return function (config, element) {\n $(element).mage('validation', {\n /** @inheritdoc */\n errorPlacement: function (error, el) {\n\n if (el.parents('#product-review-table').length) {\n $('#product-review-table').siblings(this.errorElement + '.' + this.errorClass).remove();\n $('#product-review-table').after(error);\n } else {\n el.after(error);\n }\n }\n });\n };\n});\n","Magento_Review/js/validate-review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery/validate',\n 'mage/translate'\n], function ($) {\n 'use strict';\n\n $.validator.addMethod(\n 'rating-required', function (value) {\n return value !== undefined;\n }, $.mage.__('Please select one of each of the ratings above.'));\n});\n","Magento_Review/js/process-reviews.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'tabs',\n 'collapsible'\n], function ($) {\n 'use strict';\n\n /**\n * @param {String} url\n * @param {*} fromPages\n */\n function processReviews(url, fromPages) {\n $.ajax({\n url: url,\n cache: true,\n dataType: 'html',\n showLoader: false,\n loaderContext: $('.product.data.items')\n }
2).done(function (data) {\n $('#product-review-container').html(data).trigger('contentUpdated');\n $('[data-role=\"product-review\"] .pages a').each(function (index, element) {\n $(element).on('click', function (event) { //eslint-disable-line max-nested-callbacks\n processReviews($(element).attr('href'), true);\n event.preventDefault();\n });\n });\n }).always(function () {\n if (fromPages == true) { //eslint-disable-line eqeqeq\n $('html, body').animate({\n scrollTop: $('#reviews').offset().top - 50\n }, 300);\n }\n });\n }\n\n return function (config) {\n var reviewTab = $(config.reviewsTabSelector),\n requiredReviewTabRole = 'tab';\n\n if (reviewTab.attr('role') === requiredReviewTabRole && reviewTab.hasClass('active')) {\n processReviews(config.productReviewUrl, location.hash === '#reviews');\n } else {\n reviewTab.one('beforeOpen', function () {\n processReviews(config.productReviewUrl);\n });\n }\n\n $(function () {\n $('.product-info-main .reviews-actions a').on('click', function (event) {\n var anchor, addReviewBlock;\n\n event.preventDefault();\n anchor = $(this).attr('href').replace(/^.*?(#|$)/, '');\n addReviewBlock = $('#' + anchor);\n\n if (addReviewBlock.length) {\n $('.product.data.items [data-role=\"content\"]').each(function (index) { //eslint-disable-line\n if (this.id == 'reviews') { //eslint-disable-line eqeqeq\n $('.product.data.items').tabs('activate', index);\n }\n });\n $('html, body').animate({\n scrollTop: addReviewBlock.offset().top - 50\n }, 300);\n }\n\n });\n });\n };\n});\n","Magento_Review/js/view/review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'Magento_Customer/js/view/customer'\n], function (Component, customerData) {\n 'use strict';\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n this.review = customerData.get('review').extend({\n disposableCustomerData: 'review'\n });\n },\n\n /**\n * @return {*}\n */\n nickname: function () {\n return this.review().nickname || customerData.get('customer')().firstname;\n }\n });\n});\n","Magento_OfflinePayments/js/view/payment/offline-payments.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* @api */\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/renderer-list'\n], function (Component, rendererList) {\n 'use strict';\n\n rendererList.push(\n {\n type: 'checkmo',\n component: 'Magento_OfflinePayments/js/view/payment/method-renderer/checkmo-method'\n },\n {\n type: 'banktransfer',\n component: 'Magento_OfflinePayments/js/view/payment/method-renderer/banktransfer-method'\n },\n {\n type: 'cashondelivery',\n component: 'Magento_OfflinePayments/js/view/payment/method-renderer/cashondelivery-method'\n },\n {\n type: 'purchaseorder',\n component: 'Magento_OfflinePayments/js/view/payment/method-renderer/purchaseorder-method'\n }\n );\n\n /** Add view logic here if needed */\n return Component.extend({});\n});\n","Magento_OfflinePayments/js/view/payment/method-renderer/cashondelivery-method.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* @api */\ndefine([\n 'Magento_Checkout/js/view/payment/default'\n], function (Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_OfflinePayments/payment/cashondelivery'\n },\n\n /**\n * Returns payment method instructions.\n *\n * @return {*}\n */\n getInstructions: function () {\n return window.checkoutConfig.payment.instructions[this.item.method];\n }\n });\n});\n","Magento_OfflinePayments/js/view/payment/method-renderer/purchaseorder-method.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* @api */\ndefine([\n 'Magento_Checkout/js/view/payment/default',\n 'jquery',\n 'mage/validation'\n], function (Component, $) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_OfflinePayments/payment/purchaseorder-form',\n purchaseOrderNumber: ''\n }
2,\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe('purchaseOrderNumber');\n\n return this;\n },\n\n /**\n * @return {Object}\n */\n getData: function () {\n return {\n method: this.item.method,\n 'po_number': this.purchaseOrderNumber(),\n 'additional_data': null\n };\n },\n\n /**\n * @return {jQuery}\n */\n validate: function () {\n var form = 'form[data-role=purchaseorder-form]';\n\n return $(form).validation() && $(form).validation('isValid');\n }\n });\n});\n","Magento_OfflinePayments/js/view/payment/method-renderer/checkmo-method.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* @api */\ndefine([\n 'Magento_Checkout/js/view/payment/default'\n], function (Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_OfflinePayments/payment/checkmo'\n },\n\n /**\n * Returns send check to info.\n *\n * @return {*}\n */\n getMailingAddress: function () {\n return window.checkoutConfig.payment.checkmo.mailingAddress;\n },\n\n /**\n * Returns payable to info.\n *\n * @return {*}\n */\n getPayableTo: function () {\n return window.checkoutConfig.payment.checkmo.payableTo;\n }\n });\n});\n","Magento_OfflinePayments/js/view/payment/method-renderer/banktransfer-method.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* @api */\ndefine([\n 'ko',\n 'Magento_Checkout/js/view/payment/default'\n], function (ko, Component) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_OfflinePayments/payment/banktransfer'\n },\n\n /**\n * Get value of instruction field.\n * @returns {String}\n */\n getInstructions: function () {\n return window.checkoutConfig.payment.instructions[this.item.method];\n }\n });\n});\n","Magento_Wishlist/js/wishlist.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'mage/template',\n 'Magento_Ui/js/modal/alert',\n 'jquery-ui-modules/widget',\n 'mage/validation/validation',\n 'mage/dataPost'\n], function ($, mageTemplate, alert) {\n 'use strict';\n\n $.widget('mage.wishlist', {\n options: {\n dataAttribute: 'item-id',\n nameFormat: 'qty[{0}]',\n btnRemoveSelector: '[data-role=remove]',\n qtySelector: '[data-role=qty]',\n addToCartSelector: '[data-role=tocart]',\n addAllToCartSelector: '[data-role=all-tocart]',\n commentInputType: 'textarea',\n infoList: false\n },\n\n /**\n * Bind handlers to events.\n */\n _create: function () {\n var _this = this;\n\n if (!this.options.infoList) {\n this.element\n .on('addToCart', function (event, context) {\n var urlParams;\n\n event.stopPropagation(event);\n $(context).data('stop-processing', true);\n urlParams = _this._getItemsToCartParams(\n $(context).parents('[data-row=product-item]').find(_this.options.addToCartSelector)\n );\n $.mage.dataPost().postData(urlParams);\n\n return false;\n })\n .on('click', this.options.btnRemoveSelector, $.proxy(function (event) {\n event.preventDefault();
2\n $.mage.dataPost().postData($(event.currentTarget).data('post-remove'));\n }, this))\n .on('click', this.options.addToCartSelector, $.proxy(this._beforeAddToCart, this))\n .on('click', this.options.addAllToCartSelector, $.proxy(this._addAllWItemsToCart, this))\n .on('focusin focusout', this.options.commentInputType, $.proxy(this._focusComment, this));\n }\n\n // Setup validation for the form\n this.element.mage('validation', {\n /** @inheritdoc */\n errorPlacement: function (error, element) {\n error.insertAfter(element.next());\n }\n });\n },\n\n /**\n * Process data before add to cart\n *\n * - update item's qty value.\n *\n * @param {Event} event\n * @private\n */\n _beforeAddToCart: function (event) {\n var elem = $(event.currentTarget),\n itemId = elem.data(this.options.dataAttribute),\n qtyName = $.validator.format(this.options.nameFormat, itemId),\n qtyValue = elem.parents().find('[name=\"' + qtyName + '\"]').val(),\n params = elem.data('post');\n\n if (params) {\n params.data = $.extend({}, params.data, {\n 'qty': qtyValue\n });\n elem.data('post', params);\n }\n },\n\n /**\n * Add wish list items to cart.\n * @private\n * @param {jQuery} elem - clicked 'add to cart' button\n */\n _getItemsToCartParams: function (elem) {\n var itemId, url, qtyName, qtyValue;\n\n if (elem.data(this.options.dataAttribute)) {\n itemId = elem.data(this.options.dataAttribute);\n url = this.options.addToCartUrl;\n qtyName = $.validator.format(this.options.nameFormat, itemId);\n qtyValue = elem.parents().find('[name=\"' + qtyName + '\"]').val();\n url.data.item = itemId;\n url.data.qty = qtyValue;\n\n return url;\n }\n },\n\n /**\n * Add all wish list items to cart\n * @private\n */\n _addAllWItemsToCart: function () {\n var urlParams = this.options.addAllToCartUrl,\n separator = urlParams.action.indexOf('?') >= 0 ? '&' : '?';\n\n this.element.find(this.options.qtySelector).each(function (index, element) {\n urlParams.action += separator + $(element).prop('name') + '=' + encodeURIComponent($(element).val());\n separator = '&';\n });\n $.mage.dataPost().postData(urlParams);\n },\n\n /**\n * Toggle comment string.\n * @private\n * @param {Event} e\n */\n _focusComment: function (e) {\n var commentInput = e.currentTarget;\n\n if (commentInput.value === '' || commentInput.value === this.options.commentString) {\n commentInput.value = commentInput.value === this.options.commentString ?\n '' : this.options.commentString;\n }\n }\n });\n\n // Extension for mage.wishlist - Select All checkbox\n $.widget('mage.wishlist', $.mage.wishlist, {\n options: {\n selectAllCheckbox: '#select-all',\n parentContainer: '#wishlist-table'\n },\n\n /** @inheritdoc */\n _create: function () {\n var selectAllCheckboxParent, checkboxCount;\n\n this._super();\n selectAllCheckboxParent = $(this.options.selectAllCheckbox).parents(this.options.parentContainer);\n checkboxCount = selectAllCheckboxParent\n .find('input:checkbox:not(' + this.options.selectAllCheckbox + ')').length;\n // If Select all checkbox is checked, check all item checkboxes, if unchecked, uncheck all item checkboxes\n $(this.options.selectAllCheckbox).on('click', function () {\n selectAllCheckboxParent.find('input
2:checkbox').attr('checked', $(this).is(':checked'));\n });\n // If all item checkboxes are checked, check select all checkbox,\n // if not all item checkboxes are checked, uncheck select all checkbox\n selectAllCheckboxParent.on(\n 'click',\n 'input:checkbox:not(' + this.options.selectAllCheckbox + ')',\n $.proxy(function () {\n var checkedCount = selectAllCheckboxParent\n .find('input:checkbox:checked:not(' + this.options.selectAllCheckbox + ')').length;\n\n $(this.options.selectAllCheckbox).attr('checked', checkboxCount === checkedCount);\n }, this)\n );\n }\n });\n // Extension for mage.wishlist info add to cart\n $.widget('mage.wishlist', $.mage.wishlist, {\n /** @inheritdoc */\n _create: function () {\n this._super();\n\n if (this.options.infoList) {\n this.element.on('addToCart', $.proxy(function (event, context) {\n this.element.find('input:checkbox').attr('checked', false);\n $(context).closest('tr').find('input:checkbox').attr('checked', true);\n this.element.trigger('submit');\n }, this));\n this._checkBoxValidate();\n }\n },\n\n /**\n * validate checkbox selection.\n * @private\n */\n _checkBoxValidate: function () {\n this.element.validation({\n submitHandler: $.proxy(function (form) {\n if ($(form).find('input:checkbox:checked').length) {\n form.submit();\n } else {\n alert({\n content: this.options.checkBoxValidationMessage\n });\n }\n }, this)\n });\n }\n });\n\n // Extension for mage.wishlist - Add Wishlist item to Gift Registry\n $.widget('mage.wishlist', $.mage.wishlist, {\n options: {\n formTmplSelector: '#form-tmpl',\n formTmplId: '#wishlist-hidden-form'\n },\n\n /** @inheritdoc */\n _create: function () {\n var _this = this;\n\n this._super();\n this.element.on('click', '[data-wishlist-to-giftregistry]', function () {\n var json = $(this).data('wishlist-to-giftregistry'),\n tmplJson = {\n item: json.itemId,\n entity: json.entity,\n url: json.url\n },\n html = mageTemplate(_this.options.formTmplSelector, {\n data: tmplJson\n });\n\n $(html).appendTo('body');\n $(_this.options.formTmplId).trigger('submit');\n });\n }\n });\n\n return $.mage.wishlist;\n});\n","Magento_Wishlist/js/add-to-wishlist.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.addToWishlist', {\n options: {\n bundleInfo: 'div.control [name^=bundle_option]',\n configurableInfo: '.super-attribute-select',\n groupedInfo: '#super-product-table input',\n downloadableInfo: '#downloadable-links-list input',\n customOptionsInfo: '.product-custom-option',\n qtyInfo: '#qty',\n actionElement: '[data-action=\"add-to-wishlist\"]',\n productListWrapper: '.product-item-info',\n productPageWrapper: '.product-info-main'\n },\n\n /** @inheritdoc */\n _create: function () {\n this._bind();\n this._triggerWishlistFormUpdate();\n },\n\n /**\n * @private\n */\n _bind: function () {\n var options = this.options,\n dataUpdateFunc = '_updateWishlistData',\n validateProductQty = '_validateWishlistQty',\n changeCustomOption = 'change ' + options.customOptionsInfo,\n changeQty = 'change ' + options.qtyInfo,\n updateWishlist = 'click ' + options.actionElement,\n events = {},\n key;\n\n if ('productType' in options) {\n if (typeof options.productType === 'string') {\n options.productType = [options.productType];\n }\n } else {\n options.productType = [];\n }\n\n events[changeCustomOption] = dataUpdateFunc;\n events[changeQty] = dataUpdateFunc;\n events[updateWishlist] = validateProductQty;\n\n for (key in options.productType) {\n if (options.productType.hasOwnProperty(key) && options.productType[key] + 'Info' in options) {\n events['change ' + options[options.productType[key] + 'Info']] = dataUpdateFunc;\n }\n }\n this._on(events);\n },\n\n /**\n * Update wishlist on page load and before submit\n *\n * @private\n */\n _triggerWishlistFormUpdate: function () {\n var key;\n\n $(this.options.qtyInfo).trigger('change');\n for (key in this.options.productType) {\n if (this.options.productType.hasOwnProperty(key)\n && this.options.productType[key] + 'Info' in this.options) {\n $(this.options[this.options.productType[key] + 'Info']).trigger('change');\n }\n }\n },\n\n /**\n * @param {jQuery.Event} event\n * @private\n */\n _updateWishlistData: function (event) {\n var dataToAdd = {},\n isFileUploaded = false,\n handleObjSelector = null,\n self = this;\n\n if (event.handleObj.selector == this.options.qtyInfo) { //eslint-disable-line eqeqeq\n this._updateAddToWishlistButton({}, event);\n event.stopPropagation();\n\n return;\n }\n\n handleObjSelector = $(event.currentTarget).closest('form').find(event.handleObj.selector);\n\n handleObjSelector.each(function (index, element) {\n if ($(element).is('input[type=text]') ||\n $(element).is('input[type=email]') ||\n $(element).is('input[type=number]') ||\n $(element).is('input[type=hidden]') ||\n $(element).is('input[type=checkbox]:checked') ||\n $(element).is('input[type=radio]:checked') ||\n $(element).is('textarea') ||\n $('#' + element.i
2d + ' option:selected').length\n ) {\n if ($(element).data('selector') || $(element).attr('name')) {\n dataToAdd = $.extend({}, dataToAdd, self._getElementData(element));\n }\n\n return;\n }\n\n if ($(element).is('input[type=file]') && $(element).val()) {\n isFileUploaded = true;\n }\n });\n\n if (isFileUploaded) {\n this.bindFormSubmit();\n }\n this._updateAddToWishlistButton(dataToAdd, event);\n event.stopPropagation();\n },\n\n /**\n * @param {Object} dataToAdd\n * @param {jQuery.Event} event\n * @private\n */\n _updateAddToWishlistButton: function (dataToAdd, event) {\n var self = this,\n buttons = this._getAddToWishlistButton(event);\n\n buttons.each(function (index, element) {\n var params = $(element).data('post'),\n currentTarget = event.currentTarget,\n targetElement,\n targetValue;\n\n if (!params) {\n params = {\n 'data': {}\n };\n } else if ($(currentTarget).data('selector') || $(currentTarget).attr('name')) {\n targetElement = self._getElementData(currentTarget);\n targetValue = Object.keys(targetElement)[0];\n\n if (params.data.hasOwnProperty(targetValue) && !dataToAdd.hasOwnProperty(targetValue)) {\n delete params.data[targetValue];\n }\n }\n\n params.data = $.extend({}, params.data, dataToAdd, {\n 'qty': $(self.options.qtyInfo).val()\n });\n $(element).data('post', params);\n });\n },\n\n /**\n * @param {jQuery.Event} event\n * @private\n */\n _getAddToWishlistButton: function (event) {\n var productListWrapper = $(event.currentTarget).closest(this.options.productListWrapper);\n\n if (productListWrapper.length) {\n return productListWrapper.find(this.options.actionElement);\n }\n\n return $(this.options.actionElement);\n },\n\n /**\n * @param {Object} array1\n * @param {Object} array2\n * @return {Object}\n * @private\n * @deprecated\n */\n _arrayDiffByKeys: function (array1, array2) {\n var result = {};\n\n $.each(array1, function (key, value) {\n if (key.indexOf('option') === -1) {\n return;\n }\n\n if (!array2[key]) {\n result[key] = value;\n }\n });\n\n return result;\n },\n\n /**\n * @param {HTMLElement} element\n * @return {Object}\n * @private\n */\n _getElementData: function (element) {\n var data, elementName, elementValue;\n\n element = $(element);\n data = {};\n elementName = element.data('selector') ? element.data('selector') : element.attr('name');\n elementValue = element.val();\n\n if (element.is('select[multiple]') && elementValue !== null) {\n if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq\n elementName = elementName.substring(0, elementName.length - 2);\n }\n $.each(elementValue, function (key, option) {\n data[elementName + '[' + option + ']'] = option;\n });\n } else if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq, max-depth\n elementName = elementName.substring(0, elementName.length - 2);\n\n data[elementName + '[' + elementValue + ']'] = elementValue;\n } else {\n data[elementName] = elementValue;\n }\n\n return data;\n },\n\n /**\n * @param {Object} params\n * @param {Object} dataToAdd\n * @private\n * @deprecated\n */\n _removeExcessiveData: function (params, dataToAdd) {\n var dataToRemove = this._arrayDiffByKeys(params.data, dataToAdd);\n\n $.each(dataToRemove, function (key) {\n delete params.data[key];\n });\n },\n\n /**\n * Unbind previous form submit listener.\n */\n unbindFormSubmit: function () {\n $('[data-action=\"add-to-wis
2hlist\"]').off('click');\n },\n\n /**\n * Bind form submit.\n */\n bindFormSubmit: function () {\n var self = this;\n\n // Prevents double handlers and duplicate requests to add to Wishlist\n this.unbindFormSubmit();\n\n $('[data-action=\"add-to-wishlist\"]').on('click', function (event) {\n var element, params, form, action;\n\n event.stopPropagation();\n event.preventDefault();\n\n element = $('input[type=file]' + self.options.customOptionsInfo);\n params = $(event.currentTarget).data('post');\n form = $(element).closest('form');\n action = params.action;\n\n if (params.data.id) {\n $('<input>', {\n type: 'hidden',\n name: 'id',\n value: params.data.id\n }).appendTo(form);\n }\n\n if (params.data.uenc) {\n action += 'uenc/' + params.data.uenc;\n }\n\n $(form).attr('action', action).trigger('submit');\n });\n },\n\n /**\n * Validate product quantity before updating Wish List\n *\n * @param {jQuery.Event} event\n * @private\n */\n _validateWishlistQty: function (event) {\n var element = $(this.options.qtyInfo);\n\n if (!(element.validation() && element.validation('isValid'))) {\n event.preventDefault();\n event.stopPropagation();\n\n return;\n }\n\n this._triggerWishlistFormUpdate();\n }\n });\n\n return $.mage.addToWishlist;\n});\n","Magento_Wishlist/js/search.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.wishlistSearch', {\n\n /**\n * Bind handlers to events\n */\n _create: function () {\n this.element.on('change', $.proxy(this._toggleForm, this));\n },\n\n /**\n * Toggle Form\n * @private\n */\n _toggleForm: function () {\n switch (this.element.val()) {\n case 'name':\n $(this.options.emailFormSelector).hide();\n $(this.options.nameFormSelector).show();\n break;\n\n case 'email':\n $(this.options.nameFormSelector).hide();\n $(this.options.emailFormSelector).show();\n break;\n default:\n $(this.options.emailFormSelector).add(this.options.nameFormSelector).hide();\n }\n }\n });\n\n return $.mage.wishlistSearch;\n});\n","Magento_Wishlist/js/product/addtowishlist-button.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/uenc-processor',\n 'Magento_Catalog/js/product/list/column-status-validator'\n], function (Element, uencProcessor, columnStatusValidator) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n label: ''\n },\n\n /**\n * Get request POST data.\n *\n * @param {Object} row\n * @return {String}\n */\n getDataPost: function (row) {\n return uencProcessor(row['extension_attributes']['wishlist_button'].url);\n },\n\n /**\n * Check if component must be shown.\n *\n * @return {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'add_to_wishlist', 'show_buttons');\n },\n\n /**\n * Get button label.\n *\n * @return {String}\n */\n getLabel: function () {\n return this.label;\n }\n });\n});\n","Magento_Wishlist/js/view/wishlist.js":"/**\n * Copyright 2015 Adobe\n * All Rights Reserved.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'underscore'\n], function (Component, customerData, _) {\n 'use strict';\n\n var wishlistReloaded = false;\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.wishlist = customerData.get('wishlist');\n this.company = customerData.get('company');
2\n if (!wishlistReloaded\n && !_.isEmpty(this.wishlist())\n // Expired section names are reloaded on page load.\n && _.indexOf(customerData.getExpiredSectionNames(), 'wishlist') === -1\n && window.checkout\n && window.checkout.storeId\n && (window.checkout.storeId !== this.wishlist().storeId || this.company().is_enabled)\n ) {\n //set count to 0 to prevent \"Wishlist products\" blocks and count to show with wrong count and items\n this.wishlist().counter = 0;\n customerData.invalidate(['wishlist']);\n customerData.reload(['wishlist'], false);\n wishlistReloaded = true;\n }\n }\n });\n});\n","Magento_Translation/js/add-class.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['jquery'], function ($) {\n 'use strict';\n\n return function (config, element) {\n $(element).addClass(config.class);\n };\n});\n","Magento_Translation/js/i18n-config.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n(function () {\n 'use strict';\n\n require.config({\n config: {\n 'Magento_Ui/js/lib/knockout/bindings/i18n': {\n inlineTranslation: true\n }\n }\n });\n})();\n","Magento_Translation/js/mage-translation-dictionary.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'text!js-translation.json'\n], function (dict) {\n 'use strict';\n\n return JSON.parse(dict);\n});\n","Magento_Shipping/js/view/checkout/shipping/shipping-policy.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Shipping/js/model/config'\n\n], function (Component, config) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_Shipping/checkout/shipping/shipping-policy'\n },\n config: config()\n });\n});\n","Magento_Shipping/js/model/config.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return function () {\n return window.checkoutConfig.shippingPolicy;\n };\n});\n","Magento_Variable/js/grid/columns/radioselect.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'underscore',\n 'mage/translate',\n 'Magento_Ui/js/grid/columns/column',\n 'jquery'\n], function (_, $t, Column, jQuery) {\n 'use strict';\n\n return Column.extend({\n defaults: {\n bodyTmpl: 'Magento_Variable/grid/cells/radioselect',\n draggable: false,\n sortable: false,\n selectedVariableCode: null,\n selectedVariableType: null\n },\n\n /**\n * Calls 'initObservable' of parent\n *\n * @returns {Object} Chainable.\n */\n initObservable: function () {\n this._super().observe(['selectedVariableCode']);\n\n return this;\n },\n\n /**\n * Remove disable class from Insert Variable button after Variable has been chosen.\n *\n * @return {Boolean}\n */\n selectVariable: function () {\n if (jQuery('#insert_variable').hasClass('disabled')) {\n jQuery('#insert_variable').removeClass('disabled');\n }\n\n return true;\n }\n });\n});\n","Magento_Multishipping/js/overview.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget',\n 'mage/translate'\n], function ($) {\n 'use strict';\n\n $.widget('mage.orderOverview', {\n options: {\n opacity: 0.5, // CSS opacity for the 'Place Order' button when it's clicked and then disabled.\n pleaseWaitLoader: 'span.please-wait', // 'Submitting order information...' Ajax loader.\n placeOrderSubmit: 'button[type=\"submit\"]', // The 'Place Order' button.\n agreements: '.checkout-agreements' // Container for all of the checkout agreements and terms/conditions\n },\n\n /**\n * Bind a submit handler to the form.\n * @private\n */\n _create: function () {\n this.element.on('submit', $.proxy(this._showLoader, this));\n },\n\n /**\n * Verify that all agreements and terms/conditions are checked. Show the Ajax loader. Disable\n * the submit button (i.e. Place Order).\n * @return {Boolean}\n * @private\n */\n _showLoader: function () {\n if ($(this.options.agreements).find('input[type=\"checkbox\"]:not(:checked)').length > 0) {\n return false;\n }\n this.element.find(this.options.pleaseWaitLoader).show().end()\n .find(this.options.placeOrderSubmit).prop('disabled', true).css('opacity', this.options.opacity);\n\n return true;\n }\n });\n\n return $.mage.orderOverview;\n});\n","Magento_Multishipping/js/payment.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/template',\n 'Magento_Ui/js/modal/alert',\n 'jquery-ui-modules/widget',\n 'mage/translate'\n], function ($, mageTemplate, alert) {\n 'use strict';\n\n $.widget('mage.payment', {\n options: {\n continueSelector: '#payment-continue',\n methodsContainer: '#payment-methods',\n minBalance: 0,\n tmpl: '<input id=\"hidden-free\" type=\"hidden\" name=\"payment[method]\" value=\"free\">'\n },\n\n /** @inheritdoc */\n _create: function () {\n this.element.find('dd [name^=\"payment[\"]').prop('disabled', true).end()\n .on('click', this.options.continueSelector, $.proxy(this._submitHandler, this))\n .on('updateCheckoutPrice', $.proxy(function (event, data) {\n //updating the checkoutPrice\n if (data.price) {\n this.options.checkoutPrice += data.price;\n }\n\n //updating total price\n if (data.totalPrice) {\n data.totalPrice = this.options.checkoutPrice;\n }\n\n if (this.options.checkoutPrice <= this.options.minBalance) {\n // Add free input field, hide and disable unchecked\n // checkbox payment method and all radio button payment methods\n this._disablePaymentMethods();\n } else {\n // Remove free input field, show all payment method\n this._enablePaymentMethods();\n }\n }, this))\n .on('click', 'dt input:radio', $.proxy(this._paymentMethodHandler, this));\n\n if (this.options.checkoutPrice < this.options.minBalance) {\n this._disablePaymentMethods();\n } else {\n this._enablePaymentMethods();\n }\n }
2,\n\n /**\n * Display payment details when payment method radio button is checked\n * @private\n * @param {EventObject} e\n */\n _paymentMethodHandler: function (e) {\n var element = $(e.target),\n parentsDl = element.closest('dl');\n\n parentsDl.find('dt input:radio').prop('checked', false);\n parentsDl.find('dd').addClass('no-display').end()\n .find('.items').hide()\n .find('[name^=\"payment[\"]').prop('disabled', true);\n element.prop('checked', true).parent()\n .next('dd').removeClass('no-display')\n .find('.items').show().find('[name^=\"payment[\"]').prop('disabled', false);\n },\n\n /**\n * make sure one payment method is selected\n * @private\n * @return {Boolean}\n */\n _validatePaymentMethod: function () {\n var methods = this.element.find('[name^=\"payment[\"]'),\n isValid = false;\n\n if (methods.length === 0) {\n alert({\n content: $.mage.__('We can\\'t complete your order because you don\\'t have a payment method set up.')\n });\n } else if (this.options.checkoutPrice <= this.options.minBalance) {\n isValid = true;\n } else if (methods.filter('input:radio:checked').length) {\n isValid = true;\n } else {\n alert({\n content: $.mage.__('Please choose a payment method.')\n });\n }\n\n return isValid;\n },\n\n /**\n * Disable and enable payment methods\n * @private\n */\n _disablePaymentMethods: function () {\n var tmpl = mageTemplate(this.options.tmpl, {\n data: {}\n });\n\n this.element.find('input[name=\"payment[method]\"]').prop('disabled', true).end()\n .find('input[id^=\"use\"][name^=\"payment[use\"]:not(:checked)').prop('disabled', true).parent().hide();\n this.element.find('[name=\"payment[method]\"][value=\"free\"]').parent('dt').remove();\n this.element.find(this.options.methodsContainer).hide().find('[name^=\"payment[\"]').prop('disabled', true);\n\n $(tmpl).appendTo(this.element);\n },\n\n /**\n * Enable and enable payment methods\n * @private\n */\n _enablePaymentMethods: function () {\n this.element.find('input[name=\"payment[method]\"]').prop('disabled', false).end()\n .find('dt input:radio:checked').trigger('click').end()\n .find('input[id^=\"use\"][name^=\"payment[use\"]:not(:checked)').prop('disabled', false).parent().show();\n this.element.find(this.options.methodsContainer).show();\n },\n\n /**\n * Returns checked payment method.\n *\n * @private\n */\n _getSelectedPaymentMethod: function () {\n return this.element.find('input[name=\\'payment[method]\\']:checked');\n },\n\n /**\n * Validate before form submit\n * @private\n * @param {EventObject} e\n */\n _submitHandler: function (e) {\n var currentMethod,\n submitButton;\n\n e.preventDefault();\n\n if (this._validatePaymentMethod()) {\n currentMethod = this._getSelectedPaymentMethod();\n submitButton = currentMethod.parent().next('dd').find('button[type=submit]');\n\n if (submitButton.length) {\n submitButton.first().trigger('click');\n } else {\n this.element.trigger('submit');\n }\n }\n }\n });\n\n return $.mage.payment;\n});\n","Magento_Multishipping/js/multi-shipping-balance.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/dataPost',\n 'jquery-ui-modules/widget'\n], function ($, dataPost) {\n 'use strict';\n\n $.widget('mage.multiShippingBalance', {\n options: {\n changeUrl: ''\n },\n\n /**\n * Initialize balance checkbox events.\n *\n * @private\n */\n _create: function () {\n this.element.on('change', $.proxy(function (event) {\n dataPost(
2).postData({\n action: this.options.changeUrl,\n data: {\n useBalance: +$(event.target).is(':checked')\n }\n });\n }, this));\n }\n });\n\n return $.mage.multiShippingBalance;\n});\n","Magento_Multishipping/js/multi-shipping.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Customer/js/customer-data',\n 'jquery-ui-modules/widget'\n], function ($, customerData) {\n 'use strict';\n\n $.widget('mage.multiShipping', {\n options: {\n itemsQty: 0,\n addNewAddressBtn: 'button[data-role=\"add-new-address\"]', // Add a new multishipping address.\n addNewAddressFlag: '#add_new_address_flag', // Hidden input field with value 0 or 1.\n canContinueBtn: 'button[data-role=\"can-continue\"]', // Continue (update quantity or go to shipping).\n canContinueFlag: '#can_continue_flag' // Hidden input field with value 0 or 1.\n },\n\n /**\n * Bind event handlers to click events for corresponding buttons.\n * @private\n */\n _create: function () {\n this._prepareCartData();\n $(this.options.addNewAddressBtn).on('click', $.proxy(this._addNewAddress, this));\n $(this.options.canContinueBtn).on('click', $.proxy(this._canContinue, this));\n },\n\n /**\n * Takes cart items qty from current cart data and compare it with current items qty\n * Reloads cart data if cart items qty is wrong\n * @private\n */\n _prepareCartData: function () {\n var cartData = customerData.get('cart');\n\n if (cartData()['summary_count'] !== this.options.itemsQty) {\n customerData.reload(['cart'], false);\n }\n },\n\n /**\n * Add a new address. Set the hidden input field and submit the form. Then enter a new shipping address.\n * @private\n */\n _addNewAddress: function () {\n $(this.options.addNewAddressFlag).val(1);\n this.element.submit();\n },\n\n /**\n * Can the user continue to the next step? The data-flag attribute holds either 0 (no) or 1 (yes).\n * @private\n * @param {Event} event - Click event on the corresponding button.\n */\n _canContinue: function (event) {\n $(this.options.canContinueFlag).val(parseInt($(event.currentTarget).data('flag'), 10));\n }\n });\n\n return $.mage.multiShipping;\n});\n","Magento_LoginAsCustomerFrontendUi/js/login.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Customer/js/customer-data',\n 'Magento_Customer/js/section-config'\n], function ($, customerData, sectionConfig) {\n\n 'use strict';\n\n return function (config) {\n customerData.reload(sectionConfig.getSectionNames()).done(function () {\n window.location.href = config.redirectUrl;\n });\n };\n});\n","Magento_LoginAsCustomerFrontendUi/js/view/loginAsCustomer.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'underscore',\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'mage/translate'\n], function ($, _, Component, customer) {\n 'use strict';\n\n return Component.extend({\n\n defaults: {\n isVisible: false\n },\n\n /** @inheritdoc */\n initialize: function () {\n var customerData, loggedAsCustomerData;\n\n this._super();\n\n customerData = customer.get('customer');\n loggedAsCustomerData = customer.get('loggedAsCustomer');
2\n\n customerData.subscribe(function (data) {\n this.fullname = data.fullname;\n this.updateBanner();\n }.bind(this));\n loggedAsCustomerData.subscribe(function (data) {\n this.adminUserId = data.adminUserId;\n this.websiteName = data.websiteName;\n this.updateBanner();\n }.bind(this));\n\n this.fullname = customerData().fullname;\n this.adminUserId = loggedAsCustomerData().adminUserId;\n this.websiteName = loggedAsCustomerData().websiteName;\n\n this.updateBanner();\n },\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe(['isVisible', 'notificationText']);\n\n return this;\n },\n\n /**\n * Update banner area\n *\n * @returns void\n */\n updateBanner: function () {\n if (this.adminUserId !== undefined) {\n this.isVisible(this.adminUserId);\n }\n\n if (this.fullname !== undefined && this.websiteName !== undefined) {\n this.notificationText($.mage.__('You are connected as <strong>%1</strong> on %2')\n .replace('%1', _.escape(this.fullname))\n .replace('%2', _.escape(this.websiteName)));\n }\n }\n });\n});\n","Magento_GoogleAnalytics/js/google-analytics.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/* jscs:disable */\n/* eslint-disable */\ndefine([\n 'jquery',\n 'mage/cookies'\n], function ($) {\n 'use strict';\n\n /**\n * @param {Object} config\n */\n return function (config) {\n var allowServices = false,\n allowedCookies,\n allowedWebsites;\n\n if (config.isCookieRestrictionModeEnabled) {\n allowedCookies = $.mage.cookies.get(config.cookieName);\n\n if (allowedCookies !== null) {\n allowedWebsites = JSON.parse(allowedCookies);\n\n if (allowedWebsites[config.currentWebsite] === 1) {\n allowServices = true;\n }\n }\n } else {\n allowServices = true;\n }\n\n if (allowServices) {\n (function (i, s, o, g, r, a, m) {\n i.GoogleAnalyticsObject = r;\n i[r] = i[r] || function () {\n (i[r].q = i[r].q || []).push(arguments)\n }, i[r].l = 1 * new Date();\n a = s.createElement(o),\n m = s.getElementsByTagName(o)[0];\n a.async = 1;\n a.src = g;\n m.parentNode.insertBefore(a, m)\n })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');\n\n // Process page info\n ga('create', config.pageTrackingData.accountId, 'auto');\n\n if (config.pageTrackingData.isAnonymizedIpActive) {\n ga('set', 'anonymizeIp', true);\n }\n\n // Process orders data\n if (config.ordersTrackingData.hasOwnProperty('currency')) {\n ga('require', 'ec', 'ec.js');\n\n ga('set', 'currencyCode', config.ordersTrackingData.currency);\n\n // Collect product data for GA\n if (config.ordersTrackingData.products) {\n $.each(config.ordersTrackingData.products, function (index, value) {\n ga('ec:addProduct', value);\n });\n }\n\n // Collect orders data for GA\n if (config.ordersTrackingData.orders) {\n $.each(config.ordersTrackingData.orders, function (index, value) {\n ga('ec:setAction', 'purchase', value);\n });\n }\n\n ga('send', 'pageview');\n } else {\n // Process Data if not orders\n ga('send', 'pageview' + config.pageTrackingData.optPageUrl);\n }\n }\n }\n});\n","Magento_CardinalCommerce/js/cardinal-factory.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery'\n], function ($) {\n 'use strict';\n\n return function (environment) {\n var deferred = $.Deferred(),\n dependency = 'cardinaljs';\n\n if (environment === 'sandbox') {\n dependency = 'cardinaljsSandbox';\n }
2\n\n require(\n [dependency],\n function (Cardinal) {\n deferred.resolve(Cardinal);\n },\n deferred.reject\n );\n\n return deferred.promise();\n };\n});\n","Magento_CardinalCommerce/js/cardinal-client.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'uiClass',\n 'Magento_CardinalCommerce/js/cardinal-factory',\n 'Magento_Checkout/js/model/quote',\n 'mage/translate'\n], function ($, Class, cardinalFactory, quote, $t) {\n 'use strict';\n\n return {\n /**\n * Starts Cardinal Consumer Authentication\n *\n * @param {Object} cardData\n * @return {jQuery.Deferred}\n */\n startAuthentication: function (cardData) {\n var deferred = $.Deferred();\n\n if (this.cardinalClient) {\n this._startAuthentication(deferred, cardData);\n } else {\n cardinalFactory(this.getEnvironment())\n .done(function (client) {\n this.cardinalClient = client;\n this._startAuthentication(deferred, cardData);\n }.bind(this));\n }\n\n return deferred.promise();\n },\n\n /**\n * Cardinal Consumer Authentication\n *\n * @param {jQuery.Deferred} deferred\n * @param {Object} cardData\n */\n _startAuthentication: function (deferred, cardData) {\n //this.cardinalClient.configure({ logging: { level: 'verbose' } });\n this.cardinalClient.on('payments.validated', function (data, jwt) {\n if (data.ErrorNumber !== 0) {\n deferred.reject(data.ErrorDescription);\n } else if ($.inArray(data.ActionCode, ['FAILURE', 'ERROR']) !== -1) {\n deferred.reject($t('Authentication Failed. Please try again with another form of payment.'));\n } else {\n deferred.resolve(jwt);\n }\n this.cardinalClient.off('payments.validated');\n }.bind(this));\n\n this.cardinalClient.on('payments.setupComplete', function () {\n this.cardinalClient.start('cca', this.getRequestOrderObject(cardData));\n this.cardinalClient.off('payments.setupComplete');\n }.bind(this));\n\n this.cardinalClient.setup('init', {\n jwt: this.getRequestJWT()\n });\n },\n\n /**\n * Returns request order object.\n *\n * The request order object is structured object that is used to pass data\n * to Cardinal that describes an order you'd like to process.\n *\n * If you pass a request object in both the JWT and the browser,\n * Cardinal will merge the objects together where the browser overwrites\n * the JWT object as it is considered the most recently captured data.\n *\n * @param {Object} cardData\n * @returns {Object}\n */\n getRequestOrderObject: function (cardData) {\n var totalAmount = quote.totals()['base_grand_total'],\n currencyCode = quote.totals()['base_currency_code'],\n billingAddress = quote.billingAddress(),\n requestObject;\n\n requestObject = {\n OrderDetails: {\n Amount: totalAmount * 100,\n CurrencyCode: currencyCode\n },\n Consumer: {\n Account: {\n AccountNumber: cardData.accountNumber,\n ExpirationMonth: cardData.expMonth,\n ExpirationYear: cardData.expYear,\n CardCode: cardData.cardCode\n },\n BillingAddress: {\n FirstName: billingAddress.firstname,\n LastName: billingAddress.lastname,\n Address1: billingAddress.street[0],\n Address2: billingAddress.street[1],\n City: billingAddress.city,\n State: billingAddress.region,\n PostalCode: billingAddress.postcode,\n CountryCode: billingAddress.countryId,\n Phone1: billingAddress.telep
2hone\n }\n }\n };\n\n return requestObject;\n },\n\n /**\n * Returns request JWT\n * @returns {String}\n */\n getRequestJWT: function () {\n return window.checkoutConfig.cardinal.requestJWT;\n },\n\n /**\n * Returns type of environment\n * @returns {String}\n */\n getEnvironment: function () {\n return window.checkoutConfig.cardinal.environment;\n }\n };\n});\n","Magento_OfflineShipping/js/view/shipping-rates-validation/flatrate.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/shipping-rates-validator',\n 'Magento_Checkout/js/model/shipping-rates-validation-rules',\n '../../model/shipping-rates-validator/flatrate',\n '../../model/shipping-rates-validation-rules/flatrate'\n], function (\n Component,\n defaultShippingRatesValidator,\n defaultShippingRatesValidationRules,\n flatrateShippingRatesValidator,\n flatrateShippingRatesValidationRules\n) {\n 'use strict';\n\n defaultShippingRatesValidator.registerValidator('flatrate', flatrateShippingRatesValidator);\n defaultShippingRatesValidationRules.registerRules('flatrate', flatrateShippingRatesValidationRules);\n\n return Component;\n});\n","Magento_OfflineShipping/js/view/shipping-rates-validation/tablerate.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/shipping-rates-validator',\n 'Magento_Checkout/js/model/shipping-rates-validation-rules',\n '../../model/shipping-rates-validator/tablerate',\n '../../model/shipping-rates-validation-rules/tablerate'\n], function (\n Component,\n defaultShippingRatesValidator,\n defaultShippingRatesValidationRules,\n tablerateShippingRatesValidator,\n tablerateShippingRatesValidationRules\n) {\n 'use strict';\n\n defaultShippingRatesValidator.registerValidator('tablerate', tablerateShippingRatesValidator);\n defaultShippingRatesValidationRules.registerRules('tablerate', tablerateShippingRatesValidationRules);\n\n return Component;\n});\n","Magento_OfflineShipping/js/view/shipping-rates-validation/freeshipping.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/shipping-rates-validator',\n 'Magento_Checkout/js/model/shipping-rates-validation-rules',\n '../../model/shipping-rates-validator/freeshipping',\n '../../model/shipping-rates-validation-rules/freeshipping'\n], function (\n Component,\n defaultShippingRatesValidator,\n defaultShippingRatesValidationRules,\n freeshippingShippingRatesValidator,\n freeshippingShippingRatesValidationRules\n) {\n 'use strict';\n\n defaultShippingRatesValidator.registerValidator('freeshipping', freeshippingShippingRatesValidator);\n defaultShippingRatesValidationRules.registerRules('freeshipping', freeshippingShippingRatesValidationRules);\n\n return Component;\n});\n","Magento_OfflineShipping/js/model/shipping-rates-validator/flatrate.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mageUtils',\n '../shipping-rates-validation-rules/flatrate',\n 'mage/translate'\n], function ($, utils, validationRules, $t) {\n 'use strict';\n\n return {\n validationErrors: [],\n\n /**\n * @param {Object} address\n * @return {Boolean}\n */\n validate: function (address) {\n var self = this;\n\n this.validationErrors = [];\n $.each(validationRules.getRules(), function (field, rule) {\n var message;\n\n if (rule.required && utils.isEmpty(address[field])) {\n message = $t('Field ') + field + $t(' is required.');\n self.validationErrors.push(message);\n }\n });\n\n return !this.validationErrors.length;\n }\n };\n});\n","Magento_OfflineShipping/js/model/shipping-rates-validator/tablerate.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mageUtils',\n '../shipping-rates-validation-rules/tablerate',\n 'mage/translate'\n], function ($, utils, validationRules, $t) {\n 'use strict';\n\n return {\n validationErrors: [],\n\n /**\n * @param {Object} address\n * @return {Boolean}\n */\n validate: function (address) {\n var self = this;\n\n this.validationErrors = [];\n $.each(validationRules.getRules(), function (field, rule) {\n var message, regionFields;\n\n if (rule.required && utils.isEmpty(address[field])) {\n message = $t('Field ') + field + $t(' is required.');
2\n regionFields = ['region', 'region_id', 'region_id_input'];\n\n if (\n $.inArray(field, regionFields) === -1 ||\n utils.isEmpty(address.region) && utils.isEmpty(address['region_id'])\n ) {\n self.validationErrors.push(message);\n }\n }\n });\n\n return !this.validationErrors.length;\n }\n };\n});\n","Magento_OfflineShipping/js/model/shipping-rates-validator/freeshipping.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mageUtils',\n '../shipping-rates-validation-rules/freeshipping',\n 'mage/translate'\n], function ($, utils, validationRules, $t) {\n 'use strict';\n\n return {\n validationErrors: [],\n\n /**\n * @param {Object} address\n * @return {Boolean}\n */\n validate: function (address) {\n var self = this;\n\n this.validationErrors = [];\n $.each(validationRules.getRules(), function (field, rule) {\n var message;\n\n if (rule.required && utils.isEmpty(address[field])) {\n message = $t('Field ') + field + $t(' is required.');\n self.validationErrors.push(message);\n }\n });\n\n return !this.validationErrors.length;\n }\n };\n});\n","Magento_OfflineShipping/js/model/shipping-rates-validation-rules/flatrate.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return {\n /**\n * @return {Object}\n */\n getRules: function () {\n return {\n 'country_id': {\n 'required': true\n }\n };\n }\n };\n});\n","Magento_OfflineShipping/js/model/shipping-rates-validation-rules/tablerate.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return {\n /**\n * @return {Object}\n */\n getRules: function () {\n return {\n 'postcode': {\n 'required': true\n },\n 'country_id': {\n 'required': true\n }
2,\n 'region_id': {\n 'required': true\n },\n 'region_id_input': {\n 'required': true\n }\n };\n }\n };\n});\n","Magento_OfflineShipping/js/model/shipping-rates-validation-rules/freeshipping.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return {\n /**\n * @return {Object}\n */\n getRules: function () {\n return {\n 'country_id': {\n 'required': true\n }\n };\n }\n };\n});\n","Magento_Sales/js/orders-returns.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.ordersReturns', {\n options: {\n zipCode: '#oar-zip', // Search by zip code.\n emailAddress: '#oar-email', // Search by email address.\n searchType: '#quick-search-type-id' // Search element used for choosing between the two.\n },\n\n /** @inheritdoc */\n _create: function () {\n $(this.options.searchType).on('change', $.proxy(this._showIdentifyBlock, this)).trigger('change');\n },\n\n /**\n * Show either the search by zip code option or the search by email address option.\n * @private\n * @param {jQuery.Event} e - Change event. Event target value is either 'zip' or 'email'.\n */\n _showIdentifyBlock: function (e) {\n var value = $(e.target).val();\n\n $(this.options.zipCode).toggle(value === 'zip');\n $(this.options.emailAddress).toggle(value === 'email');\n }\n });\n\n return $.mage.ordersReturns;\n});\n","Magento_Sales/js/gift-message.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.giftMessage', {\n options: {\n rowPrefix: '#order-item-row-', // Selector prefix for item's row in the table.\n linkPrefix: '#order-item-gift-message-link-', // Selector prefix for the 'Gift Message' link.\n duration: 100, // Toggle duration.\n expandedClass: 'expanded', // Class added/removed to/from the 'Gift Message' link.\n expandedContentClass: 'expanded-content', // Class added/removed to/from the 'Gift Message' content.\n lastClass: 'last' // Class added/removed to/from the last item's row in the products table.\n },\n\n /**\n * Bind a click handler on the widget's element to toggle the gift message.\n * @private\n */\n _create: function () {\n this.element.on('click', $.proxy(this._toggleGiftMessage, this));\n },\n\n /**\n * Toggle the display of the item's corresponding gift message.\n * @private\n * @param {jQuery.Event} event - Click event.\n */\n _toggleGiftMessage: function (event) {\n var element = $(event.target), // Click target. The 'Gift Message' link or 'Close' button.\n options = this.options, // Cached widget options.\n itemId = element.data('item-id'), // The individual item's numeric id.\n link = $(options.linkPrefix + itemId), // The 'Gift Message' expandable link.\n row = $(options.rowPrefix + itemId), // The item's row in the products table.\n region = $('#' + element.attr('aria-controls')); // The gift message container region.\n\n region.toggleClass(options.expandedContentClass, options.duration, function () {\n if (region.attr('aria-expanded') === 'true') {\n region.attr('aria-expanded', 'false');\n\n if (region.hasClass(options.lastClass)) {\n row.addClass(options.lastClass);\n }\n } else {\n region.attr('aria-expanded', 'true');\n\n if (region.hasClass(options.lastClass)) {\n row.removeClass(options.lastClass);\n }\n }\n link.toggleClass(options.expandedClass);\n });\n event.preventDefault(); // Prevent event propagation and avoid going to the link's href.\n }\n });\n\n return $.mage.giftMessage;\n});\n","Magento_Sales/js/view/last-ordered-items.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'underscore'\n], function (Component, customerData, _) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n isShowAddToCart: false\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.lastOrderedItems = customerData.get('last-ordered-items');\n this.lastOrderedItems.subscribe(this.checkSalableItems.bind(this));\n this.checkSalableItems();\n\n return this;\n }
2,\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe('isShowAddToCart');\n\n return this;\n },\n\n /**\n * Check if items is_saleable and change add to cart button visibility.\n */\n checkSalableItems: function () {\n var isShowAddToCart = _.some(this.lastOrderedItems().items, {\n 'is_saleable': true\n });\n\n this.isShowAddToCart(isShowAddToCart);\n }\n });\n});\n","Magento_CheckoutAgreements/js/view/checkout-agreements.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'ko',\n 'jquery',\n 'uiComponent',\n 'Magento_CheckoutAgreements/js/model/agreements-modal'\n], function (ko, $, Component, agreementsModal) {\n 'use strict';\n\n var checkoutConfig = window.checkoutConfig,\n agreementManualMode = 1,\n agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};\n\n return Component.extend({\n defaults: {\n template: 'Magento_CheckoutAgreements/checkout/checkout-agreements'\n },\n isVisible: agreementsConfig.isEnabled,\n agreements: agreementsConfig.agreements,\n modalTitle: ko.observable(null),\n modalContent: ko.observable(null),\n contentHeight: ko.observable(null),\n modalWindow: null,\n\n /**\n * Checks if agreement required\n *\n * @param {Object} element\n */\n isAgreementRequired: function (element) {\n return element.mode == agreementManualMode; //eslint-disable-line eqeqeq\n },\n\n /**\n * Show agreement content in modal\n *\n * @param {Object} element\n */\n showContent: function (element) {\n this.modalTitle(element.checkboxText);\n this.modalContent(element.content);\n this.contentHeight(element.contentHeight ? element.contentHeight : 'auto');\n agreementsModal.showModal();\n },\n\n /**\n * build a unique id for the term checkbox\n *\n * @param {Object} context - the ko context\n * @param {Number} agreementId\n */\n getCheckboxId: function (context, agreementId) {\n var paymentMethodName = '',\n paymentMethodRenderer = context.$parents[1];\n\n // corresponding payment method fetched from parent context\n if (paymentMethodRenderer) {\n // item looks like this: {title: \"Check / Money order\", method: \"checkmo\"}\n paymentMethodName = paymentMethodRenderer.item ?\n paymentMethodRenderer.item.method : '';\n }\n\n return 'agreement_' + paymentMethodName + '_' + agreementId;\n },\n\n /**\n * Init modal window for rendered element\n *\n * @param {Object} element\n */\n initModal: function (element) {\n agreementsModal.createModal(element);\n }\n });\n});\n","Magento_CheckoutAgreements/js/view/agreement-validation.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_CheckoutAgreements/js/model/agreement-validator'\n], function (Component, additionalValidators, agreementValidator) {\n 'use strict';\n\n additionalValidators.registerValidator(agreementValidator);\n\n return Component.extend({});\n});\n","Magento_CheckoutAgreements/js/model/agreement-validator.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/validation'\n], function ($) {\n 'use strict';\n\n var checkoutConfig = window.checkoutConfig,\n agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},\n agreementsInputPath = '.payment-method._active div.checkout-agreements input';\n\n return {\n /**\n * Validate checkout agreements\n *\n * @returns {Boolean}\n */\n validate: function (hideError) {\n var isValid = true;\n\n if (!agreementsConfig.isEnabled || $(agreementsInputPath).length === 0) {\n return true;\n }\n\n $(agreementsInputPath).each(function (index, element) {\n if (!$.validator.validateSingleElement(element, {\n errorElement: 'div',\n hideError: hideError || false\n })) {\n isValid = false;\n }\n });\n\n return isValid;\n }\n };\n});\n","Magento_CheckoutAgreements/js/model/agreements-modal.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Ui/js/modal/modal',\n 'mage/translate'\n], function ($, modal, $t) {\n 'use strict';\n\n return {\n modalWindow: null,\n\n /**\n * Create popUp window for provided element.\n *\n * @param {HTMLElement} element\n */\n createModal: function (element) {\n var options;\n\n this.modalWindow = element;\n options = {\n 'type': 'popup',\n 'modalClass': 'agreements-modal',\n 'responsive': true,\n 'innerScroll': true,\n 'trigger': '.show-modal',\n 'buttons': [\n {\n text: $t('Close'),\n class: 'action secondary action-hide-popup',\n\n /** @inheritdoc */\n click: function () {\n this.closeModal();\n }\n }\n ]\n };\n modal(options, $(this.modalWindow));\n },\n\n /** Show login popup window */\n showModal: function () {\n $(this.modalWindow).modal('openM
2odal');\n }\n };\n});\n","Magento_CheckoutAgreements/js/model/set-payment-information-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_CheckoutAgreements/js/model/agreements-assigner'\n], function ($, wrapper, agreementsAssigner) {\n 'use strict';\n\n return function (placeOrderAction) {\n\n /** Override place-order-mixin for set-payment-information action as they differs only by method signature */\n return wrapper.wrap(placeOrderAction, function (originalAction, messageContainer, paymentData) {\n agreementsAssigner(paymentData);\n\n return originalAction(messageContainer, paymentData);\n });\n };\n});\n","Magento_CheckoutAgreements/js/model/agreements-assigner.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery'\n], function ($) {\n 'use strict';\n\n var agreementsConfig = window.checkoutConfig.checkoutAgreements;\n\n /** Override default place order action and add agreement_ids to request */\n return function (paymentData) {\n var agreementForm,\n agreementData,\n agreementIds;\n\n if (!agreementsConfig.isEnabled) {\n return;\n }\n\n agreementForm = $('.payment-method._active div[data-role=checkout-agreements] input');\n agreementData = agreementForm.serializeArray();\n agreementIds = [];\n\n agreementData.forEach(function (item) {\n agreementIds.push(item.value);\n });\n\n if (paymentData['extension_attributes'] === undefined) {\n paymentData['extension_attributes'] = {};\n }\n\n paymentData['extension_attributes']['agreement_ids'] = agreementIds;\n };\n});\n","Magento_CheckoutAgreements/js/model/place-order-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_CheckoutAgreements/js/model/agreements-assigner'\n], function ($, wrapper, agreementsAssigner) {\n 'use strict';\n\n return function (placeOrderAction) {\n\n /** Override default place order action and add agreement_ids to request */\n return wrapper.wrap(placeOrderAction, function (originalAction, paymentData, messageContainer) {\n agreementsAssigner(paymentData);\n\n return originalAction(paymentData, messageContainer);\n });\n };\n});\n","MGS_Ajaxlayernavigation/js/range-slider-widget.js":"/**\n * DISCLAIMER\n *\n * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer\n * versions in the future.\n *\n * @category Smile\n * @package Smile\\ElasticsuiteCatalog\n * @author Aurelien FOUCRET <[email protected]>\n * @copyright 2020 Smile\n * @license Open Software License (\"OSL\") v. 3.0\n */\n\n\n/*jshint browser:true jquery:true*/\n/*global alert*/\n\ndefine(['jquery', 'Magento_Catalog/js/price-utils', 'mage/template', 'jquery/ui', 'Magento_Ui/js/modal/modal'],\n function ($, priceUtil, mageTemplate) {\n\n \"use strict\";\n\t\n\treturn function(widget){\n $.widget('smileEs.rangeSlider', widget, {\n _onSliderChange: function (ev, ui) {\n this.from = ui.values[0];\n\t\t\t\tthis.to = ui.values[1];\n\t\t\t\tthis._refreshDisplay();\n this._applyRange();\n }\n })\n }\n\n return $.smileEs.rangeSlider;\n});\n","MGS_Ajaxlayernavigation/js/ajax-navigation.js":"/**\n\n * Copyright \u00a9 2013-2017 Magento, Inc. All rights reserved.\n\n * See COPYING.txt for license details.\n\n */\n\ndefine([\n\n 'jquery',\n\n 'mage/apply/main',\n\n 'MGS_Ajaxlayernavigation/js/ion.rangeSlider.min',\n\n 'ellipsis',\n\n 'scrollbar'\n\n], function($, mage, ionRangeSlider, ellipsis, scrollbar) {\n\n 'use strict';\n\n\n\n $.widget('mage.ajaxnavigation', {\n\n options: {\n\n\n\n }
2,\n\n _create: function() {\n\n this.url = $(location).attr('href');\n\n this.useAjax = this.options.useAjax;\n\n this.usePrice_slide = this.options.use_range_price;\n\n this.minPrice = $(\"#price-range-slider\").data(\"from\");\n\n this.maxPrice = $(\"#price-range-slider\").data(\"to\");\n\n this.fromPrice = $(\"#price-range-slider\").data(\"from\");\n\n this.toPrice = $(\"#price-range-slider\").data(\"to\");\n\n this.pricePrefix = this.options.pricePrefix;\n\n this.pricePostfix = this.options.pricePostfix;\n\n this.initNavigation();\n\n\n },\n\n initNavigation: function() {\n\n if (this.usePrice_slide) {\n\n this.addPriceSlider();\n\n }\n\n var self = this;\n\n this.addFilterObservers();\n\n setTimeout(function() {\n\n self.addToolbarObservers();\n\n }, 300);\n\n },\n\n addPriceSlider: function() {\n\n var self = this,\n\n priceActive = location.search.split('price=')[1];\n\n if (priceActive) {\n\n $(\"#price-range-slider\").data('from', this.fromPrice);\n\n $(\"#price-range-slider\").data('to', this.toPrice);\n\n }\n\n $(\"#price-range-slider\").ionRangeSlider({\n\n type: \"double\",\n\n min: self.minPrice,\n\n max: self.maxPrice,\n\n from: self.fromPrice,\n\n to: self.toPrice,\n\n prettify_enabled: true,\n\n prefix: self.pricePrefix,\n\n postfix: self.pricePostfix,\n\n grid: true,\n\n onFinish: function(obj) {\n\n self.applyToolbarElement('price', obj.from + '-' + obj.to);\n\n self.fromPrice = obj.from;\n\n self.toPrice = obj.to;\n\n }\n\n });\n\n },\n\n addFilterObservers: function() {\n\n var selectedIds, checkbox, filterItem,\n\n self = this;\n\n\n\n $(\"#layered-filter-block .filter-title strong\").off();\n\n\n\n $(\".mgs-layered-checkbox\").on('change', function() {\n\n self.applyFilter($(this).parent().next());\n\n return false;\n\n });\n\n\n\n $(\".mgs-ajax-layer-item\").off();\n\n $(\".mgs-ajax-layer-item\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n var checkboxWrapper = $(this).prev(),\n\n checkbox = checkboxWrapper.find('input');\n\n\n\n self.toggleCheckbox(checkbox);\n\n self.applyFilter($(this));\n\n return false;\n\n });\n\n\n\n $(\".filter-active-item-link\").off();\n\n $(\".state-item-remove\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyFilter($(this).next());\n\n return false;\n\n });\n\n\n\n\n\n $(\".swatch-attribute-options a\").off();\n\n $(\".swatch-attribute-options a\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyFilter($(this));\n\n return false;\n\n });\n\n\n\n $(\".filter-active-item-clear-all\").off();\n\n $(\".filter-active-item-clear-all\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyFilter($(this));\n\n return false;\n\n });\n\n // show hide filter\n\n $(\".filter-content dt\").off();\n\n $(\".filter-content dt\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.toggleFilter($(this));\n\n return false;\n\n });\n\n },\n\n toggleCheckbox: function(el) {\n\n if (el.prop('checked')) {\n\n el.prop(\"checked\", false);\n\n } else {\n\n el.addClass('loading');\n\n el.prop(\"checked\", true);\n\n }\n\n }
2,\n\n\n\n addToolbarObservers: function() {\n\n var self = this;\n\n $(\"#mode-list\").off();\n\n $(\"#mode-list\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyToolbarElement('product_list_mode', 'list');\n\n return false;\n\n });\n\n\n\n $(\"#mode-grid\").off();\n\n $(\"#mode-grid\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyToolbarElement('product_list_mode', 'grid');\n\n return false;\n\n });\n\n\n\n $(\"#sorter\").off();\n\n $(\"#sorter\").on(\"change\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyToolbarElement('product_list_order', $(this).val());\n\n return false;\n\n });\n\n\n\n $(\".sorter-action\").off();\n\n $(\".sorter-action\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyToolbarElement('product_list_dir', $(this).attr(\"data-value\"));\n\n return false;\n\n });\n\n\n\n\n\n $(\".limiter-options\").off();\n\n $(\".limiter-options\").on(\"change\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n\n\n self.applyToolbarElement('product_list_limit', $(this).val());\n\n return false;\n\n });\n\n\n\n $(\".pages-items a\").off();\n\n $(\".pages-items a\").on(\"click\", function(e) {\n\n e.preventDefault();\n\n e.stopPropagation();\n\n self.applyFilter($(this));\n\n $('html, body').animate({\n\n scrollTop: $(\"#maincontent\").offset().top\n\n }, 500);\n\n return false;\n\n });\n\n },\n\n\n\n applyToolbarElement: function(param, value) {\n\n var self = this,\n\n urlParams = self.urlParams(self.url),\n\n url = self.url.split(\"?\")[0];\n\n\n\n urlParams[param] = value;\n\n self.ajax_init(url + '?' + $.param(urlParams));\n\n },\n\n\n\n applyFilter: function(el) {\n\n this.ajax_init($(el).attr('href'));\n\n },\n\n\n\n ajax_init: function(url) {\n\n var self = this;\n\n if (!this.useAjax) {\n\n window.location = decodeURIComponent(url);\n\n return false;\n\n }\n\n window.history.pushState(\"\", \"\", decodeURIComponent(url));\n\n $.ajax({\n\n method: \"GET\",\n\n url: decodeURIComponent(url),\n\n dataType: \"json\",\n\n data: {\n\n is_ajax: 1\n\n },\n\n showLoader: true\n\n }).done(function(data) {\n\n if (data.list) {\n\n $(\".main .toolbar-products\").remove();\n\n $(\".main .products\").remove();\n\n $(\".main .filter-active\").remove();\n\n if ($('.ajaxscroll-enable').length) {\n\n $('.ajaxscroll-enable').remove();\n\n }\n\n $(\".main .message\").remove();\n\n $(\".category-product-actions\").first().before(data.state);\n\n $(\".category-product-actions\").first().after(data.list);\n\n }\n\n if (data.filters) {\n\n $(\"#layered-filter-block\").remove();\n\n if ($('.sidebar-main').length) {\n\n $(\".sidebar-main\").prepend(data.filters);\n\n } else {\n\n $(\".column.main\").prepend(data.filters);\n\n }\n\n\n\n }\n\n if ($('.category-product-actions').length > 1) {\n\n $('.category-product-actions').first().remove();\n\n }\n\n self.url = url;\n\n self.initNavigation();\n\n $(mage.apply);\n\n self.reInitFunction();\n\n $(\".products-grid .product-item-info .product-item-details .product-item-name a\").ellipsis({\n\n lines: 1,\n\n responsive: true\n\n });\n\n let scollbar = setInterval(() =>
2 {\n\n addScrollbar();\n\n if($('.block.filter .block-content.filter-content .filter-options-item .filter-options-content .scrollbar-outer').hasClass('scroll-wrapper')){\n\n clearInterval(scollbar);\n\n }\n\n }, 1000);\n\n \n\n \n\n function addScrollbar(){\n\n $('.block.filter .block-content.filter-content .filter-options-item .filter-options-content .scrollbar-outer').scrollbar({\n\n scrollx : null\n\n });\n\n }\n\n }).fail(function(jqXHR, textStatus, errorThrown) {\n\n console.log(errorThrown);\n\n });\n\n },\n\n\n\n urlParams: function(url) {\n\n var result = {};\n\n var searchIndex = url.indexOf(\"?\");\n\n if (searchIndex == -1) return result;\n\n var sPageURL = url.substring(searchIndex + 1);\n\n var sURLVariables = sPageURL.split('&');\n\n for (var i = 0; i < sURLVariables.length; i++) {\n\n var sParameterName = sURLVariables[i].split('=');\n\n result[sParameterName[0]] = sParameterName[1];\n\n }\n\n\n\n return result;\n\n },\n\n\n\n toggleFilter: function(el) {\n\n el.toggleClass('inactive');\n\n el.toggleClass('active');\n\n el.next().slideToggle();\n\n },\n\n\n\n isMobile: function() {\n\n if (navigator.userAgent.match(/Android/i) ||\n\n navigator.userAgent.match(/webOS/i) ||\n\n navigator.userAgent.match(/iPhone/i) ||\n\n navigator.userAgent.match(/iPad/i) ||\n\n navigator.userAgent.match(/iPod/i) ||\n\n navigator.userAgent.match(/BlackBerry/i) ||\n\n navigator.userAgent.match(/Windows Phone/i)\n\n ) {\n\n return true;\n\n } else {\n\n return false;\n\n }\n\n },\n\n reInitFunction: function() {\n\n var formKey = $(\"input[name*='form_key']\").first().val();\n\n $(\"input[name*='form_key']\").val(formKey);\n\n $(\".mgs-quickview\").bind(\"click\", function() {\n\n var b = $(this).attr(\"data-quickview-url\");\n\n b.length && reInitQuickview($, b)\n\n });\n\n\n\n $(\"img.lazy\").unveil(25, function() {\n\n var self = $(this);\n\n setTimeout(function() {\n\n self.removeClass('lazy');\n\n }, 0);\n\n });\n\n\n\n return;\n\n\n\n }\n\n });\n\n\n\n return $.mage.ajaxnavigation;\n\n});","MGS_Ajaxlayernavigation/js/ion.rangeSlider.min.js":"// Ion.RangeSlider | version 2.1.4 | https://github.com/IonDen/ion.rangeSlider\r\n;(function(g){\"function\"===typeof define&&define.amd?define([\"jquery\"],function(q){g(q,document,window,navigator)}):g(jQuery,document,window,navigator)})(function(g,q,h,t,v){var u=0,p=function(){var a=t.userAgent,b=/msie\\s\\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(\" \")[1],9>a)?(g(\"html\").addClass(\"lt-ie9\"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if(\"function\"!=typeof b)throw new TypeError;var c=d.call(arguments,1),e=function(){if(this instanceof\r\ne){var f=function(){};f.prototype=b.prototype;var f=new f,l=b.apply(f,c.concat(d.call(arguments)));return Object(l)===l?l:f}return b.apply(a,c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var d;if(null==this)throw new TypeError('\"this\" is null or not defined');var c=Object(this),e=c.length>>>0;if(0===e)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=e)return-1;for(d=Math.max(0<=d?d:e-Math.abs(d),0);d<e;){if(d in c&&c[d]===a)return d;d++}return-1});\r\nvar r=function(a,b,d){this.VERSION=\"2.1.4\";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count=this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.is_update=this.is_key=this.no_diapason=this.force_redraw=this.dragging=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;this.$cache={win:g(h),body:g(q.body),input:g(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,\r\ns_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0,w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,\r\np_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop(\"value\");var e;d={type:\"single\",min:10,max:100,from:null,to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_
2shadow:!1,prettify_enabled:!0,prettify_separator:\" \",prettify:null,force_edges:!1,keyboard:!1,keyboard_step:5,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:\"\",\r\npostfix:\"\",max_postfix:\"\",decorate_both:!0,values_separator:\" \\u2014 \",input_values_separator:\";\",disable:!1,onStart:null,onChange:null,onFinish:null,onUpdate:null};c={type:c.data(\"type\"),min:c.data(\"min\"),max:c.data(\"max\"),from:c.data(\"from\"),to:c.data(\"to\"),step:c.data(\"step\"),min_interval:c.data(\"minInterval\"),max_interval:c.data(\"maxInterval\"),drag_interval:c.data(\"dragInterval\"),values:c.data(\"values\"),from_fixed:c.data(\"fromFixed\"),from_min:c.data(\"fromMin\"),from_max:c.data(\"fromMax\"),from_shadow:c.data(\"fromShadow\"),\r\nto_fixed:c.data(\"toFixed\"),to_min:c.data(\"toMin\"),to_max:c.data(\"toMax\"),to_shadow:c.data(\"toShadow\"),prettify_enabled:c.data(\"prettifyEnabled\"),prettify_separator:c.data(\"prettifySeparator\"),force_edges:c.data(\"forceEdges\"),keyboard:c.data(\"keyboard\"),keyboard_step:c.data(\"keyboardStep\"),grid:c.data(\"grid\"),grid_margin:c.data(\"gridMargin\"),grid_num:c.data(\"gridNum\"),grid_snap:c.data(\"gridSnap\"),hide_min_max:c.data(\"hideMinMax\"),hide_from_to:c.data(\"hideFromTo\"),prefix:c.data(\"prefix\"),postfix:c.data(\"postfix\"),\r\nmax_postfix:c.data(\"maxPostfix\"),decorate_both:c.data(\"decorateBoth\"),values_separator:c.data(\"valuesSeparator\"),input_values_separator:c.data(\"inputValuesSeparator\"),disable:c.data(\"disable\")};c.values=c.values&&c.values.split(\",\");for(e in c)c.hasOwnProperty(e)&&(c[e]||0===c[e]||delete c[e]);a&&(a=a.split(c.input_values_separator||b.input_values_separator||\";\"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=\r\na[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));g.extend(d,b);g.extend(d,c);this.options=d;this.validate();this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};r.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target=\"base\";this.toggleInput();this.append();this.setMinMax();\r\na?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart());this.updateScene()},append:function(){this.$cache.input.before('<span class=\"irs js-irs-'+this.plugin_count+'\"></span>');this.$cache.input.prop(\"readonly\",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class=\"irs\"><span class=\"irs-line\" tabindex=\"-1\"><span class=\"irs-line-left\"></span><span class=\"irs-line-mid\"></span><span class=\"irs-line-right\"></span></span><span class=\"irs-min\">0</span><span class=\"irs-max\">1</span><span class=\"irs-from\">0</span><span class=\"irs-to\">0</span><span class=\"irs-single\">0</span></span><span class=\"irs-grid\"></span><span class=\"irs-bar\"></span>');\r\nthis.$cache.rs=this.$cache.cont.find(\".irs\");this.$cache.min=this.$cache.cont.find(\".irs-min\");this.$cache.max=this.$cache.cont.find(\".irs-max\");this.$cache.from=this.$cache.cont.find(\".irs-from\");this.$cache.to=this.$cache.cont.find(\".irs-to\");this.$cache.single=this.$cache.cont.find(\".irs-single\");this.$cache.bar=this.$cache.cont.find(\".irs-bar\");this.$cache.line=this.$cache.cont.find(\".irs-line\");this.$cache.grid=this.$cache.cont.find(\".irs-grid\");\"single\"===this.options.type?(this.$cache.cont.append('<span class=\"irs-bar-edge\"></span><span class=\"irs-shadow shadow-single\"></span><span class=\"irs-slider single\"></span>'),\r\nthis.$cache.edge=this.$cache.cont.find(\".irs-bar-edge\"),this.$cache.s_single=this.$cache.cont.find(\".single\"),this.$cache.from[0].style.visibility=\"hidden\",this.$cache.to[0].style.visibility=\"hidden\",this.$cache.shad_single=this.$cache.cont.find(\".shadow-single\")):(this.$cache.cont.append('<span class=\"irs-shadow shadow-from\"></span><span class=\"irs-shadow shadow-to\"></span><span class=\"irs-slider from\"></span><span class=\"irs-slider to\"></span>'),this.$cache.s_from=this.$cache.cont.find(\".from\"),\r\nthis.$cache.s_to=this.$cache.cont.find(\".to\"),this.$cache.shad_from=this.$cache.cont.find(\".shadow-from\"),this.$cache.shad_to=this.$cache.cont.find(\".shadow-to\"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display=\"none\",this.$cache.to[0].style.display=\"none\",this.$cache.single[0].style.display=\"none\");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass(\"irs-disabled\"),this.$cache.input[0].disabled=\r\n!1,this.bindEvents());this.options.drag_interval&&(this.$cache.bar[0].style.cursor=\"ew-resize\")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass(\"type_last\"):b<a&&this.$cache.s_to.addClass(\"type_last\")},changeLevel:function(a){switch(a){case \"single\":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case \"from\":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake);\r\nthis.$cache.s_from.addClass(\"state_hover\");this.$cache.s_from.addClass(\"type_last\");this.$cache.s_to.removeClass(\"type_last\");break;case \"to\":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass(\"state_hover\");this.$cache.s_to.addClass(\"type_last\");this.$cache.s_from.removeClass(\"type_last\");break;case \"both\":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-\r\nthis.coords.p_pointer),this.$cache.s_to.removeClass(\"type_last\"),this.$cache.s_from.removeClass(\"type_last\")}},appendDisableMask:function(){this.$cache.cont.append('<span class=\"irs-disable-mask\"></span>');this.$cache.cont.addClass(\"irs-disabled\")},remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off(\"keydown.irs_\"+this.plugin_count);this.$cache.body.off(\"touchmove.irs_\"+this.plugin_count);this.$cache.body.off(\"mousemove.irs_\"+this.plugin_count);this.$cache.win.off(\"touchend.irs_\"+\r\nthis.plugin_count);this.$cache.win.off(\"mouseup.irs_\"+this.plugin_count);p&&(this.$cache.body.off(\"mouseup.irs_\"+this.plugin_count),this.$cache.body.off(\"mouseleave.irs_\"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on(\"touchmove.irs_\"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on(\"mousemove.irs_\"+this.plugin_count,\r\nthis.pointerMove.bind(this));this.$cache.win.on(\"touchend.irs_\"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on(\"mouseup.irs_\"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\"));this.$cache.line.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\"));this.options.drag_interval&&\"double\"===this.options.type?(this.$cache.bar.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\r\n\"both\")),this.$cache.bar.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"both\"))):(this.$cache.bar.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.bar.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")));\"single\"===this.options.type?(this.$cache.single.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),this.$cache.s_single.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),\r\nthis.$cache.shad_single.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),this.$cache.s_single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),this.$cache.edge.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.shad_single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\"))):(this.$cache.single.on(\"touchstart.irs_\"+\r\nthis.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.s_from.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.to.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"to\")),this.$cache.s_to.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"to\")),\r\nthis.$cache.shad_from.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.shad_to.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.from.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.s_from.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.to.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"to\")),this.$cache.s_to.on(\"mousedown.irs_\"+\r\nthis.plugin_count,this.pointerDown.bind(this,\"to\")),this.$cache.shad_from.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.shad_to.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")));if(this.options.keyboard)this.$cache.line.on(\"keydown.irs_\"+this.plugin_count,this.key.bind(this,\"keyboard\"));p&&(this.$cache.body.on(\"mouseup.irs_\"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on(\"mouseleave.irs_\"+this.plugin_count,this.pointerUp.bind(this)))}},\r\npointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())}
2,pointerUp:function(a){if(this.current_plugin===this.plugin_count&&this.is_active){this.is_active=!1;this.$cache.cont.find(\".state_hover\").removeClass(\"state_hover\");this.force_redraw=!0;p&&g(\"*\").prop(\"unselectable\",!1);this.updateScene();this.restoreOriginalMinInterval();if(g.contains(this.$cache.cont[0],a.target)||this.dragging)this.is_finish=\r\n!0,this.callOnFinish();this.dragging=!1}},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(\"both\"===a&&this.setTempMinInterval(),a||(a=this.target),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),p&&g(\"*\").prop(\"unselectable\",!0),this.$cache.line.trigger(\"focus\"),\r\nthis.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger(\"focus\"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();\r\nthis.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options&&(this.options.hide_min_max?(this.$cache.min[0].style.display=\"none\",this.$cache.max[0].style.display=\"none\"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),\r\nthis.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)))},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval);\r\nthis.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;
2if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();\"click\"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,a=this.getHandleX(),this.target=\r\nthis.options.drag_interval?\"both_one\":this.chooseHandle(a));switch(this.target){case \"base\":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,\r\nthis.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case \"single\":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real=\r\nthis.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case \"from\":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);\r\nthis.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,\"from\");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,\"from\");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case \"to\":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real=\r\nthis.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,\"to\");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,\"to\");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);\r\nbreak;case \"both\":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.1*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,\"from\");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);\r\nthis.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,\"to\");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case \"both_one\":if(!this.options.from_fixed&&!this.options.to_fixed){var d=this.convertToRealPercent(a);\r\na=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake=\r\nthis.convertToFakePercent(this.coords.p_to_real)}}\"single\"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-\r\nthis.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)?\r\nthis.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)}
2,getHandleX:function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle=\r\n\"single\"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return\"single\"===this.options.type?\"single\":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?\"from\":\"to\":this.options.from_fixed?\"to\":\"from\"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=\r\nthis.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&(\"single\"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=\r\nthis.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=\r\nthis.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&&\r\n(cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target=\"base\",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),\r\nthis.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+\"%\";this.$cache.bar[0].style.width=this.coords.p_bar_w+\"%\";if(\"single\"===this.options.type)this.$cache.s_single[0].style.left=\r\nthis.coords.p_single_fake+\"%\",this.$cache.single[0].style.left=this.labels.p_single_left+\"%\",this.options.values.length?this.$cache.input.prop(\"value\",this.result.from_value):this.$cache.input.prop(\"value\",this.result.from),this.$cache.input.data(\"from\",this.result.from);else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+\"%\";this.$cache.s_to[0].style.left=this.coords.p_to_fake+\"%\";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+\r\n\"%\";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+\"%\";this.$cache.single[0].style.left=this.labels.p_single_left+\"%\";this.options.values.length?this.$cache.input.prop(\"value\",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop(\"value\",this.result.from+this.options.input_values_separator+this.result.to);this.$cache.input.data(\"from\",this.result.from);this.$cache.input.data(\"to\",this.result.to)}this.old_from===\r\nthis.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger(\"change\");this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click)this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length,\r\nb=this.options.p_values,d;if(!this.options.hide_from_to)if(\"single\"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?\"hidden\":\"visible\",this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?\"hidden\":\"visible\";else{a?(this.options.decorate_both?\r\n(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+\r\nthis.options.values_separator+this._prettify(this.result.to),this.result.to),d=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single_fake;d=this.labels.p_to_left+this.labels.p_to_fake;var c=Math.max(a,d);this.labels.p_from_left+\r\nthis.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility=\"hidden\",this.$cache.to[0].style.visibility=\"hidden\",this.$cache.single[0].style.visibility=\"visible\",this.result.from===this.result.to?(\"from\"===this.target?this.$cache.from[0].style.visibility=\"visible\":\"to\"===this.target?this.$cache.to[0].style.visibility=\"visible\":this.target||(this.$cache.from[0].style.visibility=\"visible\"),this.$cache.single[0].style.visibility=\"hidden\",c=d):(this.$cache.from[0].style.visibility=\r\n\"hidden\",this.$cache.to[0].style.visibility=\"hidden\",this.$cache.single[0].style.visibility=\"visible\",c=Math.max(a,d))):(this.$cache.from[0].style.visibility=\"visible\",this.$cache.to[0].style.visibility=\"visible\",this.$cache.single[0].style.visibility=\"hidden\");this.$cache.min[0].style.visibility=b<this.labels.p_min+1?\"hidden\":\"visible\";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?\"hidden\":\"visible\"}}},drawShadow:function(){var a=this.options,b=this.$cache,d=\"number\"===typeof a.from_min&&\r\n!isNaN(a.from_min),c=\"number\"===typeof a.from_max&&!isNaN(a.from_max),e=\"number\"===typeof a.to_min&&!isNaN(a.to_min),f=\"number\"===typeof a.to_max&&!isNaN(a.to_max);\"single\"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display=\"block\",b.shad_single[0].style.left=d+\"%\",b.shad_single[0].style.width=\r\nc+\"%\"):b.shad_single[0].style.display=\"none\":(a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display=\"block\",b.shad_from[0].style.left=d+\"%\",b.shad_from[0].style.width=c+\"%\"):b.shad_from[0].style.display=\"none\",a.to_shadow&&(e||f)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(f?\r\na.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display=\"block\",b.shad_to[0].style.left=e+\"%\",b.shad_to[0].style.width=a+\"%\"):b.shad_to[0].style.display=\"none\")},callOnStart:function(){if(this.options.onStart&&\"function\"===typeof this.options.onStart)this.options.onStart(this.result)},callOnChange:function(){if(this.options.onChange&&\"function\"===typeof this.options.onChange)this.options.onChange(this.result)},\r\ncallOnFinish:function(){if(this.options.onFinish&&\"function\"===typeof this.options.onFinish)this.options.onFinish(this.result)},callOnUpdate:function(){if(this.options.onUpdate&&\"function\"===typeof this.options.onUpdate)this.options.onUpdate(this.result)},toggleInput:function(){this.$cache.input.toggleClass(\"irs-hidden-input\")},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=\r\nthis.options.min,d=this.options.max,c=b.toString().split(\".\")[1],e=d.toString().split(\".\")[1],f,l,g=0,k=0;if(0===a)return this.options.min;if(100===a)return this.options.max;c&&(g=f=c.length);e&&(g=l=e.length);f&&l&&(g=f>=l?f:l);0>b&&(k=Math.abs(b),b=+(b+k).toFixed(g),d=+(d+k).toFixed(g));a=(d-b)/100*a+b;(b=this.options.step.toString().split(\".\")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));k&&(a-=k);k=b?+a.toFixed(b.length):this.toFixed(a);k<this.options.min?\r\nk=this.options.min:k>this.options.max&&(k=this.options.max);return k},calcWithStep:function(a){var b=Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);\"from\"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=\r\nthis.options;if(!c.max_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);\"from\"===d?b-a>c.max_interval&&(a=b-c.max_interval):a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;\"number\"!==typeof b&&(b=c.min);\"number\"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(9);return+a},_prettify:function(a){return this.options.prettify_enabled?\r\nthis.options.prettify&&\"function\"===typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\\d{1,3}(?=(?:\\d\\d\\d)+(?!\\d)))/g,\"$1\"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e,f;
2\"string\"===typeof a.min&&(a.min=+a.min);\"string\"===typeof a.max&&\r\n(a.max=+a.max);\"string\"===typeof a.from&&(a.from=+a.from);\"string\"===typeof a.to&&(a.to=+a.to);\"string\"===typeof a.step&&(a.step=+a.step);\"string\"===typeof a.from_min&&(a.from_min=+a.from_min);\"string\"===typeof a.from_max&&(a.from_max=+a.from_max);\"string\"===typeof a.to_min&&(a.to_min=+a.to_min);\"string\"===typeof a.to_max&&(a.to_max=+a.to_max);\"string\"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);\"string\"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=\r\n[],a.min=0,a.max=c-1,a.step=1,a.grid_num=a.max,a.grid_snap=!0,f=0;f<c;f++)e=+d[f],isNaN(e)?e=d[f]:(d[f]=e,e=this._prettify(e)),a.p_values.push(e);if(\"number\"!==typeof a.from||isNaN(a.from))a.from=a.min;if(\"number\"!==typeof a.to||isNaN(a.from))a.to=a.max;if(\"single\"===a.type)a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max);else{if(a.from<a.min||a.from>a.max)a.from=a.min;if(a.to>a.max||a.to<a.min)a.to=a.max;a.from>a.to&&(a.from=a.to)}if(\"number\"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=\r\n1;if(\"number\"!==typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;\"number\"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);\"number\"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);\"number\"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);\"number\"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>\r\nb.max)b.to=a.to}if(\"number\"!==typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if(\"number\"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d=\"\",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?\r\n(d+=c.max_postfix,c.postfix&&(d+=\" \")):b===c.max&&(d+=c.max_postfix,c.postfix&&(d+=\" \")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])},\r\nupdateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,d;b=a.max-a.min;var c=a.grid_num,e=0,f=0,g=4,h,k,m=0,n=\"\";this.calcGridMargin();a.grid_snap?(c=b/a.step,e=this.toFixed(a.step/(b/100))):e=this.toFixed(100/c);4<c&&(g=3);7<c&&(g=2);14<c&&(g=1);28<c&&(g=0);for(b=0;b<c+1;b++){h=g;f=this.toFixed(e*b);100<f&&(f=100,h-=2,0>h&&(h=0));this.coords.big[b]=f;k=(f-e*(b-1))/\r\n(h+1);for(d=1;d<=h&&0!==f;d++)m=this.toFixed(f-k*d),n+='<span class=\"irs-grid-pol small\" style=\"left: '+m+'%\"></span>';n+='<span class=\"irs-grid-pol\" style=\"left: '+f+'%\"></span>';m=this.convertToValue(f);m=a.values.length?a.p_values[m]:this._prettify(m);n+='<span class=\"irs-grid-text js-grid-text-'+b+'\" style=\"left: '+f+'%\">'+m+\"</span>\"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass(\"irs-with-grid\");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a,\r\nb,d=this.coords.big_num;for(b=0;b<d;b++)a=this.$cache.grid.find(\".js-grid-text-\"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+\r\nthis.coords.big_p[a]);this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0],\r\nb.style.marginLeft=-this.coords.big_x[a]+\"%\"},calcGridCollision:function(a,b,d){var c,e,f,g=this.coords.big_num;for(c=0;c<g;c+=a){e=c+a/2;if(e>=g)break;f=this.$cache.grid_labels[e][0];f.style.visibility=d[c]<=b[e]?\"visible\":\"hidden\"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle=\"single\"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/\r\nthis.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[
20].style.width=this.toFixed(100-this.coords.p_handle)+\"%\",this.$cache.grid[0].style.left=this.coords.grid_gap+\"%\"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.options=g.extend(this.options,a),this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(),\r\nthis.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop(\"readonly\",!1),g.data(this.input,\"ionRangeSlider\",null),this.remove(),this.options=this.input=null)}};g.fn.ionRangeSlider=function(a){return this.each(function(){g.data(this,\"ionRangeSlider\")||g.data(this,\"ionRangeSlider\",new r(this,a,u++))})};(function(){for(var a=0,b=[\"ms\",\"moz\",\"webkit\",\"o\"],d=0;d<b.length&&!h.requestAnimationFrame;++d)h.requestAnimationFrame=h[b[d]+\"RequestAnimationFrame\"],h.cancelAnimationFrame=\r\nh[b[d]+\"CancelAnimationFrame\"]||h[b[d]+\"CancelRequestAnimationFrame\"];h.requestAnimationFrame||(h.requestAnimationFrame=function(b,d){var f=(new Date).getTime(),g=Math.max(0,16-(f-a)),p=h.setTimeout(function(){b(f+g)},g);a=f+g;return p});h.cancelAnimationFrame||(h.cancelAnimationFrame=function(a){clearTimeout(a)})})()});\r\n","Magento_Bundle/js/validation.js":"define([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n var enhancedMageValidation = {\n /**\n * @param {*} error\n * @param {*} element\n */\n options: {\n errorPlacement: function (error, element) {\n var errorPlacement = element,\n fieldWrapper,messageBox;\n\n // logic for date-picker error placement\n if (element.hasClass('_has-datepicker')) {\n errorPlacement = element.siblings('button');\n }\n // logic for field wrapper\n fieldWrapper = element.closest('.addon');\n\n if (fieldWrapper.length) {\n errorPlacement = fieldWrapper.after(error);\n }\n //logic for checkboxes/radio\n if (element.is(':checkbox') || element.is(':radio')) {\n errorPlacement = element.parents('.control').children().last();\n\n //fallback if group does not have .control parent\n if (!errorPlacement.length) {\n errorPlacement = element.siblings('label').last();\n }\n }\n if (element.attr('data-errors-msg-box')) {\n messageBox = $(element.attr('data-errors-msg-box'));\n messageBox.html(error);\n return;\n }\n //logic for control with tooltip\n if (element.siblings('.tooltip').length) {\n errorPlacement = element.siblings('.tooltip');\n }\n //logic for select with tooltip in after element\n if (element.next().find('.tooltip').length) {\n errorPlacement = element.next();\n }\n errorPlacement.after(error);\n }\n\n }\n };\n\n return function (mageValidation) {\n $.widget('mage.validation', mageValidation, enhancedMageValidation);\n return $.mage.validation;\n };\n});\n","Magento_Bundle/js/slide.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.slide', {\n options: {\n slideSpeed: 1500,\n slideSelector: '#bundle-slide',\n slideBackSelector: '.bundle-slide-back',\n bundleProductSelector: '#bundleProduct',\n bundleOptionsContainer: '#options-container',\n productViewContainer: '#productView',\n slidedown: true\n\n },\n\n /** @inheritdoc */\n _create: function () {\n if (this.options.slidedown === true) {\n $(this.options.slideSelector).on('click', $.proxy(this._show, this));\n $(this.options.slideBackSelector).on('click', $.proxy(this._hide, this));\n this.options.autostart && this._show();\n } else {\n $(this.options.slideSelector).on('click', $.proxy(this._slide, this));\n $(this.options.slideBackSelector).on('click', $.proxy(this._slideBack, this));\n this.options.autostart && this._slide();\n }\n },\n\n /**\n * slide bundleOptionsContainer over to the main view area\n * @private\n */\n _slide: function () {\n $(this.options.bundleProductSelector).css('top', '0px');\n $(this.options.bundleOptionsContainer).show();\n this.element.css('height', $(this.options.productViewContainer).height() + 'px');\n $(this.options.bundleProductSelector).css('left', '0px').animate(\n {\n 'left': '-' + this.element.width() + 'px'\n },\n this.options.slideSpeed,\n $.proxy(function () {\n this.element.css('height', 'auto');\n $(this.options.productViewContainer).hide();\n }, this)\n );\n },\n\n /**\n * slideback productViewContainer to main view area\n * @private\n */\n _slideBack: function () {\n $(this.options.bundleProductSelector).css('top', '0px');\n $(this.options.productViewContainer).show();\n this.element.css('height', $(this.options.bundleOptionsContainer).height() + 'px');\n $(this.options.bundleProductSelector).animate(\n {\n 'left': '0px'\n },\n this.options.slideSpeed,\n $.proxy(function () {\n $(this.options.bundleOptionsContainer).hide();\n this.element.css('height', 'auto');\n }, this)\n );\n },\n\n /**\n * @private\n */\n _show: function () {\n $(this.options.bundleOptionsContainer).slideDown(800);\n $('html, body').animate({\n scrollTop: $(this.options.bundleOptionsContainer).offset().top\n }, 600);\n $('#product-options-wrapper > fieldset').trigger('focus');\n },\n\n /**\n * @private\n */\n _hide: function () {\n $('html, body').animate({\n scrollTop: 0\n }, 600);\n $(this.options.bundleOptionsContainer).slideUp(800);\n }\n });\n\n return $.mage.slide;\n});\n","Magento_Bundle/js/price-bundle.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'underscore',\n 'mage/template',\n 'priceUtils',\n 'jquery/jquery.parsequery',\n 'priceBox'\n], function ($, _, mageTemplate, utils) {\n 'use strict';\n\n var globalOptions = {\n optionConfig: null,\n productBundleSelector: 'input.bundle.option, select.bundle.option, textarea.bundle.option',\n qtyFieldSelector: 'input.qty',\n priceBoxSelector: '.price-box',\n optionHandlers: {},\n optionTemplate: '<%- data.label %>' +\n '<% if (data.finalPrice.value) { %>' +\n ' +<%- data.finalPrice.formatted %>' +\n '<% } %>',\n controlContainer: 'dd', // should be eliminated\n priceFormat: {},\n isFixedPrice: false,\n optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role=\"selection-tier-prices\"]',\n isOptionsInitialized: false\n };\n\n $.widget('mage.priceBundle', {\n options: globalOptions,\n\n /**\n * @private\n */\n _init: function initPriceBundle() {\n var form = this.element,\n options = $(this.options.productBundleSelector, form),\n qty = $(this.options.qtyFieldSelector, form);\n\n // Override defaults with URL query parameters and/or inputs values\n this._overrideDefaults();\n\n options.trigger('change');\n qty.trigger('change');\n },\n\n /**\n * @private\n */\n _create: function createPriceBundle() {\n var form = this.element,\n options = $(this.options.productBundleSelector, form),\n priceBox = $(this.options.priceBoxSelector, form),\n qty = $(this.options.qtyFieldSelector, form);\n\n this._updatePriceBox();\n priceBox.on('price-box-initialized', this._updatePriceBox.bind(this));\n options.on('change', this._onBundleOptionChanged.bind(this));\n qty.on('change', this._onQtyFieldChanged.bind(this));\n },\n\n /**\n * Override default options values settings with either URL query parameters or\n * initialized inputs values.\
2n * @private\n */\n _overrideDefaults: function () {\n var hashIndex = window.location.href.indexOf('#');\n\n if (hashIndex !== -1) {\n this._parseQueryParams(window.location.href.substr(hashIndex + 1));\n }\n },\n\n /**\n * Parse query parameters from a query string and set options values based on the\n * key value pairs of the parameters.\n * @param {*} queryString - URL query string containing query parameters.\n * @private\n */\n _parseQueryParams: function (queryString) {\n var queryParams = $.parseQuery({\n query: queryString\n }),\n selectedValues = [],\n form = this.element,\n options = $(this.options.productBundleSelector, form),\n qtys = $(this.options.qtyFieldSelector, form);\n\n $.each(queryParams, $.proxy(function (key, value) {\n qtys.each(function (index, qty) {\n if (qty.name === key) {\n $(qty).val(value);\n }\n });\n options.each(function (index, option) {\n let optionType = $(option).prop('type');\n\n if (option.name === key ||\n optionType === 'select-multiple'\n && key.indexOf(option.name.substr(0, option.name.length - 2)) !== false\n ) {\n\n switch (optionType) {\n case 'radio':\n $(option).val() === value ? $(option).prop('checked', true) : '';\n break;\n case 'checkbox':\n $(option).prop('checked', true);\n break;\n case 'hidden':\n case 'select-one':\n $(option).val(value);\n break;\n case 'select-multiple':\n selectedValues.push(value);\n break;\n }\n if (optionType === 'select-multiple' && selectedValues.length) {\n $(option).val(selectedValues);\n }\n }\n });\n }, this));\n },\n\n /**\n * Update price box config with bundle option prices\n * @private\n */\n _updatePriceBox: function () {\n var form = this.element,\n options = $(this.options.productBundleSelector, form),\n priceBox = $(this.options.priceBoxSelector, form);\n\n if (!this.options.isOptionsInitialized) {\n if (priceBox.data('magePriceBox') &&\n priceBox.priceBox('option') &&\n priceBox.priceBox('option').priceConfig\n ) {\n if (priceBox.priceBox('option').priceConfig.optionTemplate) { //eslint-disable-line max-depth\n this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate);\n }\n this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);\n priceBox.priceBox('setDefault', this.options.optionConfig.prices);\n this.options.isOptionsInitialized = true;\n }\n this._applyOptionNodeFix(options);\n }\n\n return this;\n },\n\n /**\n * Handle change on bundle option inputs\n * @param {jQuery.Event} event\n * @private\n */\n _onBundleOptionChanged: function onBundleOptionChanged(event) {\n var changes,\n bundleOption = $(event.target),\n priceBox = $(this.options.priceBoxSelector, this.element),\n handler = this.options.optionHandlers[bundleOption.data('role')];\n\n bundleOption.data('optionContainer', bundleOption.closest(this.options.controlContainer));\n bundleOption.data('qtyField', bundleOption.data('optionContainer').find(this.options.qtyFieldSelector));\n\n if (handler && handler instanceof Function) {\n changes = handler(bundleOption, this.options.optionConfig, this);\n } else {\n changes = defaultGetOptionValue(bundleOption, this.options.optionConfig);//eslint-disable-line\n }\n\n // eslint-disable-next-line no-use-before-define\n if (isValidQty(bundleOption)) {\n if (changes) {\n priceBox.trigger('updatePrice', changes);\n }\n\n this._displayTierPriceBlock(bundleOption);\n this.updateProductSummary();\n }\n }
2,\n\n /**\n * Handle change on qty inputs near bundle option\n * @param {jQuery.Event} event\n * @private\n */\n _onQtyFieldChanged: function onQtyFieldChanged(event) {\n var field = $(event.target),\n optionInstance,\n optionConfig;\n\n if (field.data('optionId') && field.data('optionValueId')) {\n optionInstance = field.data('option');\n optionConfig = this.options.optionConfig\n .options[field.data('optionId')]\n .selections[field.data('optionValueId')];\n optionConfig.qty = field.val();\n\n // eslint-disable-next-line no-use-before-define\n if (isValidQty(optionInstance)) {\n optionInstance.trigger('change');\n }\n }\n },\n\n /**\n * Helper to fix backend behavior:\n * - if default qty large than 1 then backend multiply price in config\n *\n * @deprecated\n * @private\n */\n _applyQtyFix: function applyQtyFix() {\n var config = this.options.optionConfig;\n\n if (config.isFixedPrice) {\n _.each(config.options, function (option) {\n _.each(option.selections, function (item) {\n if (item.qty && item.qty !== 1) {\n _.each(item.prices, function (price) {\n price.amount /= item.qty;\n });\n }\n });\n });\n }\n },\n\n /**\n * Helper to fix issue with option nodes:\n * - you can't place any html in option ->\n * so you can't style it via CSS\n * @param {jQuery} options\n * @private\n */\n _applyOptionNodeFix: function applyOptionNodeFix(options) {\n var config = this.options,\n format = config.priceFormat,\n template = config.optionTemplate;\n\n template = mageTemplate(template);\n options.filter('select').each(function (index, element) {\n var $element = $(element),\n optionId = utils.findOptionId($element),\n optionConfig = config.optionConfig && config.optionConfig.options[optionId].selections,\n value;\n\n $element.find('option').each(function (idx, option) {\n var $option,\n optionValue,\n toTemplate,\n prices;\n\n $option = $(option);\n optionValue = $option.val();\n\n if (!optionValue && optionValue !== 0) {\n return;\n }\n\n toTemplate = {\n data: {\n label: optionConfig[optionValue] && optionConfig[optionValue].name\n }\n };\n prices = optionConfig[optionValue].prices;\n\n _.each(prices, function (price, type) {\n value = +price.amount;\n value += _.reduce(price.adjustments, function (sum, x) {//eslint-disable-line\n return sum + x;\n }, 0);\n toTemplate.data[type] = {\n value: value,\n formatted: utils.formatPriceLocale(value, format)\n };\n });\n\n $option.html(template(toTemplate));\n });\n });\n },\n\n /**\n * Custom behavior on getting options:\n * now widget able to deep merge accepted configuration with instance options.\n * @param {Object} options\n * @return {$.Widget}\n */\n _setOptions: function setOptions(options) {\n $.extend(true, this.options, options);\n\n this._super(options);\n\n return this;\n },\n\n /**\n * Show or hide option tier prices block\n *\n * @param {Object} optionElement\n * @private\n */\n _displayTierPriceBlock: function (optionElement) {\n var optionType = optionElement.prop('type'),\n optionId,\n optionValue,\n optionTierPricesElements;\n\n if (optionType === 'select-one') {\n optionId = utils.findOptionId(optionElement[0]);\n optionValue = optionElement.val() || null;\n optionTierPricesElements = $(this.options.optionTierPricesBlocksSelector.replace('{1}', optionId));\n\n _.each(optionTierPricesElements, function (tierPriceElement) {\n var selectionId = $(tierPriceElement).data('selection-id') + '';\n\n if (selectionId === optionValue) {\n $(tierPriceElement).show();\n } else {\n $(tierPriceElement).hide();\n }\n });\n }\n },\n\n /**\n * Handler to update productSummary box\n */\n updateProductSummary: function updateProductSummary() {\n this.element.trigger('updateProductSummary', {\n config: this.options.optionConfig\n });\n }\n });\n\n return $.mage.priceBundle;\n\n /**\n * Converts option value to priceBox object\n *\n * @param {jQuery} element\n * @param {Object} config\n * @returns {Object|null} - priceBox object with additional prices\n */\n function defaultGetOptionValue(element, config) {\n var changes = {},\n optionHash,\n tempChanges,\n qtyField,\n optionId = utils.findOptionId(element[0]),\n optionValue = element.val() || null,\n optionName = element.prop('name'),\n optionType = element.prop('type'),\n optionConfig = config.options[optionId].selections,\n optionQty = 0,\n canQtyCustomize = false,\n selectedIds = config.selected;\n\n switch (optionType) {\n case 'radio':\n case 'select-one':\n\n if (optionType === 'radio' && !element.is(':checked')) {\n return null;\n }\n\n qtyField = element.data('qtyField');\n qtyField.data('option', element);\n\n if (optionValue) {\n optionQty = optionConfig[optionValue].qty || 0;\n canQtyCustomize = optionConfig[optionValue].customQty === '1';\n toggleQtyField(qtyField, optionQty, optionId, optionValue, canQtyCustomize);//eslint-disable-line\n tempChanges = utils.deepClone(optionConfig[optionValue].prices);\n tempChanges = applyTierPrice(//eslint-disable-line\n tempChanges,\n optionQty,\n optionConfig[optionValue]\n );\n tempChanges = applyQty(tempChanges, optionQty);//eslint-disable-line\n } else {\n tempChanges = {};\n toggleQtyField(qtyField, '0', optionId, optionValue, false);//eslint-disable-line\n }\n optionHash = 'bundle-option-' + optionName;\n changes[optionHash] = tempChanges;\n selectedIds[optionId] = [optionValue];\n break;\n\n case 'select-multiple':\n optionValue = _.compact(optionValue);\n\n _.each(optionConfig, function (row, optionValueCode) {\n optionHash = 'bundle-option-' + optionName + '##' + optionValueCode;\n optionQty = row.qty || 0;\n tempChanges = utils.deepClone(row.prices);\n tempChanges = applyTierPrice(tempChanges, optionQty, optionConfig);//eslint-disable-line\n tempChanges = applyQty(tempChanges, optionQty);//eslint-disable-line\n changes[optionHash] = _.contains(optionValue, optionValueCode) ? tempChanges : {};\n });\n\n selectedIds[optionId] = optionValue || [];\n break;\n\n case 'checkbox':\n optionHash = 'bundle-option-' + optionName + '##' + optionValue;\n optionQty = optionConfig[optionValue].qty || 0;\n tempChanges = utils.deepClone(optionConfig[optionValue].prices);\n tempChanges = applyTierPrice(tempChanges, optionQty, optionConfig);//eslint-disable-line\n tempChanges = applyQty(tempChanges, optionQty);//eslint-disable-line\n changes[optionHash] = element.is(':checked') ? tempChanges : {};\n\n selectedIds[optionId] = selectedIds[optionId] || [];\n\n if (!_.contains(selectedIds[optionId], optionValue) && element.is(':checked')) {\n selectedIds[optionId].push(optionValue);\n } else if (!element.is(':checked')) {\n selectedIds[optionId] = _.without(selectedIds[optionId], optionValue);\n }\n break;\n\n case 'hidden':\n optionHash = 'bundle-option-' + optionName + '##' + optionValue;\n optionQty = optionConfig[optionValue].qty || 0;\n canQtyCustomize = optionConfig[optionValue].customQty === '1';\n qtyField = element.data('qtyField');\n qtyField.data('option', element);\n toggleQtyField(qtyField, optionQty, optionId, optionValue, canQtyCustomize);//eslint-disable-line\n tempChanges = utils.deepClone(optionConfig[optionValue].prices);\n tempChanges = applyTierPrice(tempChanges, optionQty, optionConfig);//eslint-disable-line\n tempChanges = applyQty(tempChanges, optionQty);//eslint-disable-line\n\n optionHash = 'bundle-option-' + optionName;\n changes[optionHash] = tempChanges;\n selectedIds[optionId] = [optionValue];\n break;\n }\n\n return changes;\n }\n\n /**\n * Check the quantity field if negative value occurs.\n *\n * @param {Object} bundleOption\n */\n function isValidQty(bundleOption) {\n var isValid = true,\n qtyElem = bundleOption.data('qtyField'),\n bundleOptionType = bundleOption.prop('type');\n\n if (['radio', 'select-one'].includes(bundleOptionType) && qtyElem.val() < 0) {\n isValid = false;\n }\n\n return isValid;\n }\n\n /**\n * Helper to toggle qty field\n * @param {jQuery} element\n * @param {String|Number}
2 value\n * @param {String|Number} optionId\n * @param {String|Number} optionValueId\n * @param {Boolean} canEdit\n */\n function toggleQtyField(element, value, optionId, optionValueId, canEdit) {\n element\n .val(value)\n .data('optionId', optionId)\n .data('optionValueId', optionValueId)\n .attr('disabled', !canEdit);\n\n if (canEdit) {\n element.removeClass('qty-disabled');\n } else {\n element.addClass('qty-disabled');\n }\n }\n\n /**\n * Helper to multiply on qty\n *\n * @param {Object} prices\n * @param {Number} qty\n * @returns {Object}\n */\n function applyQty(prices, qty) {\n _.each(prices, function (everyPrice) {\n everyPrice.amount *= qty;\n _.each(everyPrice.adjustments, function (el, index) {\n everyPrice.adjustments[index] *= qty;\n });\n });\n\n return prices;\n }\n\n /**\n * Helper to limit price with tier price\n *\n * @param {Object} oneItemPrice\n * @param {Number} qty\n * @param {Object} optionConfig\n * @returns {Object}\n */\n function applyTierPrice(oneItemPrice, qty, optionConfig) {\n var tiers = optionConfig.tierPrice,\n magicKey = _.keys(oneItemPrice)[0],\n tiersFirstKey = _.keys(optionConfig)[0],\n lowest = false;\n\n if (!tiers) {//tiers is undefined when options has only one option\n tiers = optionConfig[tiersFirstKey].tierPrice;\n }\n\n tiers.sort(function (a, b) {//sorting based on \"price_qty\"\n return a['price_qty'] - b['price_qty'];\n });\n\n _.each(tiers, function (tier, index) {\n if (tier['price_qty'] > qty) {\n return;\n }\n\n if (tier.prices[magicKey].amount < oneItemPrice[magicKey].amount) {\n lowest = index;\n }\n });\n\n if (lowest !== false) {\n oneItemPrice = utils.deepClone(tiers[lowest].prices);\n }\n\n return oneItemPrice;\n }\n});\n","Magento_Bundle/js/product-summary.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'mage/template',\n 'jquery-ui-modules/widget',\n 'Magento_Bundle/js/price-bundle'\n], function ($, mageTemplate) {\n 'use strict';\n\n /**\n * Widget product Summary:\n * Handles rendering of Bundle options and displays them in the Summary box\n */\n $.widget('mage.productSummary', {\n options: {\n mainContainer: '#product_addtocart_form',\n templates: {\n summaryBlock: '[data-template=\"bundle-summary\"]',\n optionBlock: '[data-template=\"bundle-option\"]'\n },\n optionSelector: '[data-container=\"options\"]',\n summaryContainer: '[data-container=\"product-summary\"]',\n bundleSummaryContainer: '.bundle-summary'\n },\n cache: {},\n\n /**\n * Method attaches event observer to the product form\n * @private\n */\n _create: function () {\n this.element\n .closest(this.options.mainContainer)\n .on('updateProductSummary', $.proxy(this._renderSummaryBox, this))\n .priceBundle({})\n ;\n },\n\n /**\n * Method extracts data from the event and renders Summary box\n * using jQuery template mechanism\n * @param {Event} event\n * @param {Object} data\n * @private\n */\n _renderSummaryBox: function (event, data) {\n this.cache.currentElement = data.config;\n this.cache.currentElementCount = 0;\n\n // Clear Summary box\n this.element.html('');\n this.cache.currentElement.positions.forEach(function (optionId) {\n this._renderOption(optionId, this.cache.currentElement.selected[optionId]);\n }, this);\n this.element\n .parents(this.options.bundleSummaryContainer)\n .toggleClass('empty', !this.cache.currentElementCount); // Zero elements equal '.empty' container\n },\n\n /**\n * @param {String} key\n * @param {String} row\n * @private\n */\n _renderOption: function (key, row) {\n var template;\n\n if (row && row.length > 0 && row[0] !== null) {\n template = this.element\n .closest(this.options.summaryContainer)\n .find(this.options.templates.summaryBlock)\n .html();\n template = mageTemplate(template.trim(), {\n data: {\n _label_: this.cache.currentElement.options[key].title\n }\n });\n\n this.cache.currentKey = key;\n this.cache.summaryContainer = $(template);\n this.element.append(this.cache.summaryContainer);\n\n $.each(row, this._renderOptionRow.bind(this));\n this.cache.currentElementCount += row.length;\n\n //Reset Cache\n this.cache.currentKey = null;\n }\n },\n\n /**\n * @param {String} key\n * @param {String} optionIndex\n * @private\n */\n _renderOptionRow: function (key, optionIndex) {\n var template;\n\n template = this.element\n .closest(this.options.summaryContainer)\n .find(this.options.templates.optionBlock)\n .html();\n template = mageTemplate(template.trim(), {\n data: {\n _quantity_: this.cache.currentElement.options[this.cache.currentKey].selections[optionIndex].qty,\
2n _label_: this.cache.currentElement.options[this.cache.currentKey].selections[optionIndex].name\n }\n });\n this.cache.summaryContainer\n .find(this.options.optionSelector)\n .append(template);\n }\n });\n\n return $.mage.productSummary;\n});\n","Magento_Catalog/product/view/validation.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget',\n 'mage/validation/validation'\n], function ($) {\n 'use strict';\n\n $.widget('mage.validation', $.mage.validation, {\n options: {\n radioCheckboxClosest: 'ul, ol'\n },\n\n /**\n * @param {*} error\n * @param {HTMLElement} element\n */\n errorPlacement: function (error, element) {\n var messageBox,\n dataValidate;\n\n if ($(element).hasClass('datetime-picker')) {\n element = $(element).parent();\n\n if (element.parent().find('.mage-error').length) {\n return;\n }\n }\n\n if (element.attr('data-errors-message-box')) {\n messageBox = $(element.attr('data-errors-message-box'));\n messageBox.html(error);\n\n return;\n }\n\n dataValidate = element.attr('data-validate');\n\n if (dataValidate && dataValidate.indexOf('validate-one-checkbox-required-by-name') > 0) {\n error.appendTo('#links-advice-container');\n } else if (element.is(':radio, :checkbox')) {\n element.closest(this.radioCheckboxClosest).after(error);\n } else {\n element.after(error);\n }\n },\n\n /**\n * @param {HTMLElement} element\n * @param {String} errorClass\n */\n highlight: function (element, errorClass) {\n var dataValidate = $(element).attr('data-validate');\n\n if (dataValidate && dataValidate.indexOf('validate-required-datetime') > 0) {\n $(element).parent().find('.datetime-picker').each(function () {\n $(this).removeClass(errorClass);\n\n if ($(this).val().length === 0) {\n $(this).addClass(errorClass);\n }\n });\n } else if ($(element).is(':radio, :checkbox')) {\n $(element).closest(this.radioCheckboxClosest).addClass(errorClass);\n } else {\n $(element).addClass(errorClass);\n }\n },\n\n /**\n * @param {HTMLElement} element\n * @param {String} errorClass\n */\n unhighlight: function (element, errorClass) {\n var dataValidate = $(element).attr('data-validate');\n\n if (dataValidate && dataValidate.indexOf('validate-required-datetime') > 0) {\n $(element).parent().find('.datetime-picker').removeClass(errorClass);\n } else if ($(element).is(':radio, :checkbox')) {\n $(element).closest(this.radioCheckboxClosest).removeClass(errorClass);\n } else {\n $(element).removeClass(errorClass);\n }\n }\n });\n\n return $.mage.validation;\n});\n","Magento_Catalog/js/price-box.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'Magento_Catalog/js/price-utils',\n 'underscore',\n 'mage/template',\n 'jquery/ui'\n], function ($, utils, _, mageTemplate) {\n 'use strict';\n\n var globalOptions = {\n productId: null,\n priceConfig: null,\n prices: {},\n priceTemplate: '<span class=\"price\"><%- data.formatted %></span>'\n };\n\n $.widget('mage.priceBox', {\n options: globalOptions,\n\n /**\n * Widget initialisation.\n * Every time when option changed prices also can be changed. So\n * changed o
2ptions.prices -> changed cached prices -> recalculation -> redraw price box\n */\n _init: function initPriceBox() {\n var box = this.element;\n\n box.trigger('updatePrice');\n this.cache.displayPrices = utils.deepClone(this.options.prices);\n },\n\n /**\n * Widget creating.\n */\n _create: function createPriceBox() {\n var box = this.element;\n\n this.cache = {};\n this._setDefaultsFromPriceConfig();\n this._setDefaultsFromDataSet();\n\n box.on('reloadPrice', this.reloadPrice.bind(this));\n box.on('updatePrice', this.onUpdatePrice.bind(this));\n },\n\n /**\n * Call on event updatePrice. Proxy to updatePrice method.\n * @param {Event} event\n * @param {Object} prices\n */\n onUpdatePrice: function onUpdatePrice(event, prices) {\n return this.updatePrice(prices);\n },\n\n /**\n * Updates price via new (or additional values).\n * It expects object like this:\n * -----\n * \"option-hash\":\n * \"price-code\":\n * \"amount\": 999.99999,\n * ...\n * -----\n * Empty option-hash object or empty price-code object treats as zero amount.\n * @param {Object} newPrices\n */\n updatePrice: function updatePrice(newPrices) {\n var prices = this.cache.displayPrices,\n additionalPrice = {},\n pricesCode = [],\n priceValue, origin, finalPrice;\n\n this.cache.additionalPriceObject = this.cache.additionalPriceObject || {};\n\n if (newPrices) {\n $.extend(this.cache.additionalPriceObject, newPrices);\n }\n\n if (!_.isEmpty(additionalPrice)) {\n pricesCode = _.keys(additionalPrice);\n } else if (!_.isEmpty(prices)) {\n pricesCode = _.keys(prices);\n }\n\n _.each(this.cache.additionalPriceObject, function (additional) {\n if (additional && !_.isEmpty(additional)) {\n pricesCode = _.keys(additional);\n }\n _.each(pricesCode, function (priceCode) {\n priceValue = additional[priceCode] || {};\n priceValue.amount = +priceValue.amount || 0;\n priceValue.adjustments = priceValue.adjustments || {};\n\n additionalPrice[priceCode] = additionalPrice[priceCode] || {\n 'amount': 0,\n 'adjustments': {}\n };\n additionalPrice[priceCode].amount = 0 + (additionalPrice[priceCode].amount || 0) +\n priceValue.amount;\n _.each(priceValue.adjustments, function (adValue, adCode) {\n additionalPrice[priceCode].adjustments[adCode] = 0 +\n (additionalPrice[priceCode].adjustments[adCode] || 0) + adValue;\n });\n });\n });\n\n if (_.isEmpty(additionalPrice)) {\n this.cache.displayPrices = utils.deepClone(this.options.prices);\n } else {\n _.each(additionalPrice, function (option, priceCode) {\n origin = this.options.prices[priceCode] || {};\n finalPrice = prices[priceCode] || {};\n option.amount = option.amount || 0;\n origin.amount = origin.amount || 0;\n origin.adjustments = origin.adjustments || {};\n finalPrice.adjustments = finalPrice.adjustments || {};\n\n finalPrice.amount = 0 + origin.amount + option.amount;\n _.each(option.adjustments, function (pa, paCode) {\n finalPrice.adjustments[paCode] = 0 + (origin.adjustments[paCode] || 0) + pa;\n });\n }, this);\n }\n\n this.updateFinalPrice();\n\n this.element.trigger('reloadPrice');\n }
2,\n\n //update final price \n updateFinalPrice: function(){\n let $this = this,\n wrapPrice = $this.element;\n if (!$('body').hasClass('page-product-grouped')) {\n let price = $this.cache.displayPrices.finalPrice.amount;\n\n if (price != undefined) {\n $(wrapPrice).find('.price-wrapper[data-price-type=finalPrice] ').attr('data-price-amount', price);\n }\n }\n },\n\n /*eslint-disable no-extra-parens*/\n /**\n * Render price unit block.\n */\n reloadPrice: function reDrawPrices() {\n var priceFormat = (this.options.priceConfig && this.options.priceConfig.priceFormat) || {},\n priceTemplate = mageTemplate(this.options.priceTemplate);\n\n _.each(this.cache.displayPrices, function (price, priceCode) {\n price.final = _.reduce(price.adjustments, function (memo, amount) {\n return memo + amount;\n }, price.amount);\n\n price.formatted = utils.formatPrice(price.final, priceFormat);\n\n $('[data-price-type=\"' + priceCode + '\"]', this.element).html(priceTemplate({\n data: price\n }));\n }, this);\n },\n\n /*eslint-enable no-extra-parens*/\n /**\n * Overwrites initial (default) prices object.\n * @param {Object} prices\n */\n setDefault: function setDefaultPrices(prices) {\n this.cache.displayPrices = utils.deepClone(prices);\n this.options.prices = utils.deepClone(prices);\n },\n\n /**\n * Custom behavior on getting options:\n * now widget able to deep merge of accepted configuration.\n * @param {Object} options\n * @return {mage.priceBox}\n */\n _setOptions: function setOptions(options) {\n $.extend(true, this.options, options);\n\n if ('disabled' in options) {\n this._setOption('disabled', options.disabled);\n }\n\n return this;\n },\n\n /**\n * setDefaultsFromDataSet\n */\n _setDefaultsFromDataSet: function _setDefaultsFromDataSet() {\n var box = this.element,\n priceHolders = $('[data-price-type]', box),\n prices = this.options.prices;\n\n this.options.productId = box.data('productId');\n\n if (_.isEmpty(prices)) {\n priceHolders.each(function (index, element) {\n var type = $(element).data('priceType'),\n amount = parseFloat($(element).data('priceAmount'));\n\n if (type && !_.isNaN(amount)) {\n prices[type] = {\n amount: amount\n };\n }\n });\n }\n },\n\n /**\n * setDefaultsFromPriceConfig\n */\n _setDefaultsFromPriceConfig: function _setDefaultsFromPriceConfig() {\n var config = this.options.priceConfig;\n\n if (config && config.prices) {\n this.options.prices = config.prices;\n }\n }\n });\n\n return $.mage.priceBox;\n});\n","Magento_Catalog/js/storage-manager.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'uiElement',\n 'mageUtils',\n 'Magento_Catalog/js/product/storage/storage-service',\n 'Magento_Customer/js/section-config',\n 'jquery'\n], function (_, Element, utils, storage, sectionConfig, $) {\n 'use strict';\n\n /**\n * Flush events, that are clones of the same customer data sections\n * Events listener\n */\n $(document).on('submit', function (event) {\n var sections;\n\n if (event.target.hasAttribute('method') && event.target.getAttribute('method').match(/post|put|delete/i)) {\n sections = sectionConfig.getAffectedSections(event.target.action);\n\n if (sections && window.localStorage) {\n _.each(sections, function (section) {\n window.localStorage.removeItem(section);\n });\n }\n }\n });\n\n return Element.extend({\n defaults: {\n defaultNamespace: {\n lifetime: 1000\n },\n storagesConfiguration: {\n 'recently_viewed_product': {\n namespace: 'recently_viewed_product',\n className: 'IdsStorage',\n lifetime: '${ $.defaultNamespace.lifetime }
2',\n requestConfig: {\n typeId: '${ $.storagesConfiguration.recently_viewed_product.namespace }'\n },\n savePrevious: {\n namespace: '${ $.storagesConfiguration.recently_viewed_product.namespace }' + '_previous',\n className: '${ $.storagesConfiguration.recently_viewed_product.className }'\n },\n allowToSendRequest: 0\n },\n 'recently_compared_product': {\n namespace: 'recently_compared_product',\n className: 'IdsStorageCompare',\n provider: 'compare-products',\n lifetime: '${ $.defaultNamespace.lifetime }',\n requestConfig: {\n typeId: '${ $.storagesConfiguration.recently_compared_product.namespace }'\n },\n savePrevious: {\n namespace: '${ $.storagesConfiguration.recently_compared_product.namespace }' + '_previous',\n className: '${ $.storagesConfiguration.recently_compared_product.className }'\n },\n allowToSendRequest: 0\n },\n 'product_data_storage': {\n namespace: 'product_data_storage',\n className: 'DataStorage',\n allowToSendRequest: 0,\n updateRequestConfig: {\n url: '',\n method: 'GET',\n dataType: 'json'\n }\n }\n },\n requestConfig: {\n method: 'POST',\n dataType: 'json',\n ajaxSaveType: 'default',\n ignoreProcessEvents: true\n },\n requestSent: 0\n },\n\n /**\n * Initializes provider component.\n *\n * @returns {Object} Chainable.\n */\n initialize: function () {\n this._super()\n .prepareStoragesConfig()\n .initStorages()\n .initStartData()\n .initUpdateStorageDataListener();\n\n return this;\n },\n\n /**\n * Initializes storages.\n *\n * @returns {Object} Chainable.\n */\n initStorages: function () {\n _.each(this.storagesNamespace, function (name) {\n this[name] = storage.createStorage(this.storagesConfiguration[name]);\n\n if (this.storagesConfiguration[name].savePrevious) {\n this[name].previous = storage.createStorage(this.storagesConfiguration[name].savePrevious);\n }\n }.bind(this));\n\n return this;\n },\n\n /**\n * Initializes start data.\n *\n * @returns {Object} Chainable.\n */\n initStartData: function () {\n _.each(this.storagesNamespace, function (name) {\n this.updateDataHandler(name, this[name].get());\n }.bind(this));\n\n return this;\n },\n\n /**\n * Prepare storages congfig.\n *\n * @returns {Object} Chainable.\n */\n prepareStoragesConfig: function () {\n this.storagesNamespace = _.keys(this.storagesConfiguration);\n\n _.each(this.storagesNamespace, function (name) {\n this.storagesConfiguration[name].requestConfig = _.extend(\n utils.copy(this.requestConfig),\n this.storagesConfiguration[name].requestConfig\n );\n }.bind(this));\n\n return this;\n },\n\n /**\n * Prepare date in UTC format (in GMT), and calculate unix timestamp based in seconds\n *\n * @returns {Number}\n * @private\n */\n getUtcTime: function () {\n return new Date().getTime() / 1000;\n },\n\n /**\n * Initializes listeners to storages \"data\" property.\n */\n initUpdateStorageDataListener: function () {\n _.each(this.storagesNamespace, function (name) {\n if (this[name].data) {\n this[name].data.subscribe(this.updateDataHandler.bind(this, name));\n }\n }.bind(this));\n },\n\n /**\n * Handlers for storages \"data\" property\n */\n updateDataHandler: function (name, data) {\n var previousData = this[name].previous ? this[name].previous.get() : false;\n\n if (!_.isEmpty(previousData) &&\n !_.isEmpty(data) &&\n !utils.compare(data, previousData).equal) {\n this[name].set(data);\n this[name].previous.set(data);\n this.sendRequest(name, data);\n } else if (\n _.isEmpty(previousData) &&\n !_.isEmpty(data)\n ) {\n this[name].set(data);\n this.sendRequest(name, data);\n }\n },\n\n /**\n * Gets last updated time\n *\n * @param {String} name - storage name\n */\n getLastUpdate: function (name) {\n return window.localStorage.getItem(this[name].namespace + '_last_update');\n },\n\n /**\n * Sets last updated time\n *\n * @param {String} name - storage name\n */\n setLastUpdate: function (name) {\n window.localStorage.setItem(this[name].namespace + '_last_update', this.getUtcTime());\n },\n\n /**\n * Request handler\n *\n * @param {String} name - storage name\n */\n requestHandler: function (name) {\n this.setLastUpdate(name);\n this.requestSent = 1;\n },\n\n /**\n * Sends request to server to gets data\n *\n * @param {String} name - storage name\n * @param {Object} data - ids\n */\n sendRequest: function (name, data) {\n var params = utils.copy(this.storagesConfiguration[name].requestConfig),\n url = params.syncUrl,\n typeId = params.typeId;\n\n if (this.requestSent || !~~this.storagesConfiguration[name].allowToSendRequest) {\n return;\n }\n\n delete params.typeId;\n delete params.url;\n this.requestSent = 1;\n\n return utils.ajaxSubmit({\n url: url,\n data: {\n ids: data,\n 'type_id': typeId\n }\n }, params).done(this.requestHandler.bind(this, name));\n }\n });\n});\n","Magento_Catalog/js/related-products.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget',\n 'mage/translate'\n], function ($) {\n 'use strict';\n\n $.widget('mage.relatedProducts', {\n options: {\n relatedCheckbox: '.related-checkbox', // Class name for a related product's input checkbox.\n relatedProductsCheckFlag: false, // Related products checkboxes are initially unchecked.\n relatedProductsField: '#related-products-field', // Hidden input field that stores related products.\n selectAllMessage: $.mage.__('select all'),\n unselectAllMessage: $.mage.__('unselect all'),\n selectAllLink: '[data-role=\"select-all\"]',\n elementsSelector: '.item.product'\n },\n\n /**\n * Bind events to the appropriate handlers.\n * @private\n */\n _create: function () {\n $(this.options.selectAllLink, this.element).on('click', $.proxy(this._selectAllRelated, this));\n $(this.options.relatedCheckbox, this.element).on('click', $.proxy(this._addRelatedToProduct, this));\n\n if (this.element.data('shuffle')) {\n this._shuffle(this.element.find(this.options.elementsSelector));\n }\n this._showRelatedProducts(\n this.element.find(this.options.elementsSelector),\n this.element.data('limit'),\n this.element.data('shuffle-weighted')\n );\n },\n\n /**\n * This method either checks all checkboxes for a product's set of related products (select all)\n * or unchecks them (unselect all).\n * @private\n * @param {jQuery.Event} e - Click event on either the \"select all\" link or the \"unselect all\" link.\n * @return {Boolean} - Prevent default event action and event propagation.\n */\n _selectAllRelated: function (e) {\n let isChecked = this.options.relatedProductsCheckFlag;\n\n $(e.target).html(isChecked ? this.options.selectAllMessage : this.options.unselectAllMessage);\n this.options.relatedProductsCheckFlag = !isChecked;\n\n $(this.options.relatedCheckbox + ':visible').prop('checked', this.options.relatedProductsCheckFlag);\n this._addRelatedToProduct();\n\n return false;\n },\n\n /**\n * This method iterates through each checkbox for all related products and collects only those products\n * whose checkbox has been checked. The selected related products are stored in a hidden input field.\n * @private\n */\n _addRelatedToProduct: function () {\n $(this.options.relatedProductsField).val(\n $(this.options.relatedCheckbox + ':checked').map(function () {\n return this.value;\n }).get().join(',')\n );\n },\n\n /* jscs:disable */\n /* eslint-disable */\n /**\n * Show related products according to limit. Shuffle if needed.\n * @param {*} elements\n * @param {*} limit\n * @param weightedRandom\n * @private\n */\n _showRelatedProducts: function (elements, limit, weightedRandom) {\n var index, weights = [], random = [], weight = 2, shown = 0, $element, currentGroup, prevGroup;\n\n if (limit === 0) {\n limit = elements.length;\n }\n\n if (weightedRandom && limit > 0 && limit < elements.length) {\n for (index = 0; index < limit; index++) {\n $element = $(elements[index]);\n if ($element.data('shuffle-group') !== '') {\n break;\n }\n $element.show();\n shown++;\n }\n limit -= shown;\n for (index = elements.length - 1; index >= 0; index--) {\n $element = $(elements[index]);\n currentGroup = $element.data('shuffle-group');\n if (currentGroup !== '') {\n weights.push([index, Math.log(weight)]);\n if (typeof prevGroup !== 'undefined' && prevGroup !== currentGroup) {\n weight += 2;\n }\n prevGroup = currentGroup;\n }\n }\n\n if (weights.length === 0) {\n return;\n }\n\n for (index = 0; index < weights.length; index++) {\n random.push([weights[index][0], Math.pow(Math.random(), 1 / weights[index][1])]);\n }\n\n random.sort(function(a, b) {\n a = a[1];\n b = b[1];\n return a < b ? 1 : (a > b ? -1 : 0);\n });\n index = 0;\n while (limit) {\n $(elements[random[index][0]]).show();\n limit--;\n index++\n }\n return;\n }\n\n for (index = 0; index < limit; index++) {\n $(elements[index]).show();\n }\n },\n\n /* jscs:disable */\n /* eslint-disable */\n /**\n * Shuffle an array\n * @param {Array} elements\n * @returns {*}\n */\n _shuffle: function shuffle(elements) {\n var parent, child, lastSibling;\n if (elements.length) {\n parent = $(elements[0]).parent();\n }\n while (elements.length) {\n child = elements.splice(Math.floor(Math.random() * elements.length), 1)[0];\n lastSibling = parent.find('[data-shuffle-group=\"' + $(child).data('shuffle-group') + '\"]').last();\n lastSibling.after(child);\n }\n }\n\n /* jscs:disable */\n /* eslint:disable */\n });\n\n return $.mage.relatedProducts;\n});\n","Magento_Catalog/js/gallery.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.gallery', {\n options: {\n minWidth: 300, // Minimum width of the gallery image.\n widthOffset: 90, // Offset added to the width of the gallery image.\n heightOffset: 210, // Offset added to the height of the gallery image.\n closeWindow: 'div.buttons-set a[role=\"close-window\"]' // Selector for closing the gallery popup window.\n },\n\n /**\n * Bind click handler for closing the popup window and resize the popup based on the image size.\n * @private\n */\n _create: function () {\n $(this.options.closeWindow).on('click', function () {\n window.close();\n });\n this._resizeWindow();\n },\n\n /**\n * Resize the gallery image popup window based on the image's dimensions.\n * @private\n */\n _resizeWindow: function () {\n var img = this.element,\n width = img.width() < this.options.minWidth ? this.options.minWidth : img.width();\n\n window.resizeTo(width + this.options.widthOffset, img.height() + this.options.heightOffset);\n }\n });\n\n return $.mage.gallery;\n});\n","Magento_Catalog/js/price-option-file.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.priceOptionFile', {\n options: {\n fileName: '',\n fileNamed: '',\n fieldNameAction: '',\n changeFileSelector: '',\n deleteFileSelector: ''\n },\n\n /**\n * Creates instance of widget\n * @private\n */\n _create: function () {\n this.fileDeleteFlag = this.fileChangeFlag = false;\n this.inputField = this.element.find('input[name=' + this.options.fileName + ']')[0];\n this.inputFieldAction = this.element.find('input[name=' + this.options.fieldNameAction + ']')[0];\n this.fileNameSpan = this.element.parent('dd').find('.' + this.options.fileNamed);\n\n $(this.options.changeFileSelector).on('click', $.proxy(function () {\n this._toggleFileChange();\n }, this));\n $(this.options.deleteFileSelector).on('click', $.proxy(function () {\n this._toggleFileDelete();\n }, this));\n },\n\n /**\n * Toggles whether the current file is being changed or not. If the file is being deleted\n * then the option to change the file is disabled.\n * @private\n */\n _toggleFileChange: function () {\n this.element.toggle(
2);\n this.fileChangeFlag = !this.fileChangeFlag;\n\n if (!this.fileDeleteFlag) {\n $(this.inputFieldAction).attr('value', this.fileChangeFlag ? 'save_new' : 'save_old');\n this.inputField.disabled = !this.fileChangeFlag;\n }\n },\n\n /**\n * Toggles whether the file is to be deleted. When the file is being deleted, the name of\n * the file is decorated with strike-through text and the option to change the file is\n * disabled.\n * @private\n */\n _toggleFileDelete: function () {\n this.fileDeleteFlag = $(this.options.deleteFileSelector + ':checked').val();\n $(this.inputFieldAction).attr('value',\n this.fileDeleteFlag ? '' : this.fileChangeFlag ? 'save_new' : 'save_old');\n this.inputField.disabled = this.fileDeleteFlag || !this.fileChangeFlag;\n this.fileNameSpan.css('text-decoration', this.fileDeleteFlag ? 'line-through' : 'none');\n }\n });\n\n return $.mage.priceOptionFile;\n});\n","Magento_Catalog/js/catalog-add-to-cart.js":"/**\n * Copyright \u00a9 2016 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'mage/translate',\n 'jquery/ui'\n], function($, $t) {\n \"use strict\";\n\n $.widget('mage.catalogAddToCart', {\n\n options: {\n processStart: null,\n processStop: null,\n bindSubmit: true,\n minicartSelector: '[data-block=\"minicart\"]',\n messagesSelector: '[data-placeholder=\"messages\"]',\n productStatusSelector: '.stock.available',\n addToCartButtonSelector: '.action.tocart',\n addToCartButtonDisabledClass: 'disabled',\n addToCartButtonTextWhileAdding: '',\n addToCartButtonTextAdded: '',\n addToCartButtonTextDefault: ''\n },\n\n _create: function() {\n if (this.options.bindSubmit) {\n this._bindSubmit();\n }\n },\n\n _bindSubmit: function() {\n var self = this;\n this.element.on('submit', function(e) {\n e.preventDefault();\n self.submitForm($(this));\n });\n },\n\n isLoaderEnabled: function() {\n return this.options.processStart && this.options.processStop;\n },\n\n /**\n * Handler for the form 'submit' event\n *\n * @param {Object} form\n */\n submitForm: function (form) {\n var addToCartButton, self = this;\n\n if (form.has('input[type=\"file\"]').length && form.find('input[type=\"file\"]').val() !== '') {\n self.element.off('submit');\n // disable 'Add to Cart' button\n addToCartButton = $(form).find(this.options.addToCartButtonSelector);\n addToCartButton.prop('disabled', true);\n addToCartButton.addClass(this.options.addToCartButtonDisabledClass);\n form.submit();\n } else {\n self.ajaxSubmit(form);\n }\n },\n\n ajaxSubmit: function(form) {\n var self = this;\n $(self.options.minicartSelector).trigger('contentLoading');\n self.disableAddToCartButton(form);\n\n $.ajax({\n url: form.attr('action'),\n data: form.serialize(),\n type: 'post',\n dataType: 'json',\n beforeSend: function() {\n if (self.isLoaderEnabled()) {\n $('body').trigger(self.options.processStart);\n }\n },\n success: function(res) {\n if (self.isLoaderEnabled()) {\n $('body').trigger(self.options.processStop);\n }\n\n if (res.backUrl) {\n window.location = res.backUrl;\n return;\n }\n if (res.messages) {\n $(self.options.messagesSelector).html(res.messages);\n }\n if (res.minicart) {\n $(self.options.minicartSelector).replaceWith(res.minicart);\n $(self.options.minicartSelector).trigger('contentUpdated');\n }\n if (res.product && res.product.statusText) {\n $(self.options.productStatusSelector)\n .removeClass('available')\n .addClass('unavailable')\n .find('span')\n .html(res.product.statusText);\n }\n self.enableAddToCartButton(form);\n }\n });\n },\n\n disableAddToCartButton: function(form) {\n var addToCartButtonTextWhileAdding = this.options.addToCartButtonTextWhileAdding || $t('Adding...');\n var addToCartButton = $(form).find(this.options.addToCartButtonSelector);\n addToCartButton.addClass(this.options.addToCartButtonDisabledClass);\n\t\t\taddToCartButton.find('.fa').addClass('fa-spin');\n addToCartButton.find('span:not(.fa)').text(addToCartButtonTextWhileAdding);\n addToCartButton.attr('title', addToCartButtonTextWhileAdding);\n },\n\n enableAddToCartButton: function(form) {\n var addToCartButtonTextAdded = this.options.addToCartButtonTextAdded || $t('Added');\n var self = this,\n addToCartButton = $(form).find(this.options.addToCartButtonSelector);\n\n addToCartButton.find('span:not(.fa)').text(addToCartButtonTextAdded);\n\t\t\taddToCartButton.find('.fa').removeClass('fa-spin');\n\t\t\taddToCartButton.find('.fa').addClass('fa-added');\n addToCartButton.attr('title', addToCartButtonTextAdded);
2\n\n setTimeout(function() {\n var addToCartButtonTextDefault = self.options.addToCartButtonTextDefault || $t('Add to Cart');\n addToCartButton.removeClass(self.options.addToCartButtonDisabledClass);\n addToCartButton.find('span:not(.fa)').text(addToCartButtonTextDefault);\n\t\t\t\taddToCartButton.find('.fa').removeClass('fa-added');\n addToCartButton.attr('title', addToCartButtonTextDefault);\n }, 1000);\n }\n });\n\n return $.mage.catalogAddToCart;\n});\n","Magento_Catalog/js/price-utils.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'underscore'\n], function ($, _) {\n 'use strict';\n\n var globalPriceFormat = {\n requiredPrecision: 2,\n integerRequired: 1,\n decimalSymbol: ',',\n groupSymbol: ',',\n groupLength: ','\n };\n\n /**\n * Repeats {string} {times} times\n * @param {String} string\n * @param {Number} times\n * @return {String}\n */\n function stringPad(string, times) {\n return new Array(times + 1).join(string);\n }\n\n /**\n * Format the price with the compliance to the specified locale\n *\n * @param {Number} amount\n * @param {Object} format\n * @param {Boolean} isShowSign\n */\n function formatPriceLocale(amount, format, isShowSign)\n {\n var s = '',\n precision, pattern, locale, r;\n\n format = _.extend(globalPriceFormat, format);\n precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;\n pattern = format.pattern || '%s';\n locale = window.LOCALE || 'en-US';\n if (isShowSign === undefined || isShowSign === true) {\n s = amount < 0 ? '-' : isShowSign ? '+' : '';\n } else if (isShowSign === false) {\n s = '';\n }\n pattern = pattern.indexOf('{sign}') < 0 ? s + pattern : pattern.replace('{sign}', s);\n amount = Number(Math.round(Math.abs(+amount || 0) + 'e+' + precision) + ('e-' + precision));\n r = amount.toLocaleString(locale, {minimumFractionDigits: precision});\n\n return pattern.replace('%s', r).replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n }\n\n /**\n * Formatter for price amount\n * @param {Number} amount\n * @param {Object} format\n * @param {Boolean} isShowSign\n * @return {String} Formatted value\n * @deprecated\n */\n function formatPrice(amount, format, isShowSign) {\n var s = '',\n precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;\n\n format = _.extend(globalPriceFormat, format);\n\n // copied from price-option.js | Could be refactored with varien/js.js\n\n precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;\n integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;\n decimalSymbol = format.decimalSymbol === undefined ? ',' : format.decimalSymbol;\n groupSymbol = format.groupSymbol === undefined ? '.' : format.groupSymbol;\n groupLength = format.groupLength === undefined ? 3 : format.groupLength;\n pattern = format.pattern || '%s';\n\n if (isShowSign === undefined || isShowSign === true) {\n s = amount < 0 ? '-' : isShowSign ? '+' : '';\n } else if (isShowSign === false) {\n s = '';\n }\n pattern = pattern.indexOf('{sign}') < 0 ? s + pattern : pattern.replace('{sign}', s);\n\n // we're avoiding the usage of to fixed, and using round instead with the e representation to address\n // numbers like 1.005 = 1.01. Using ToFixed to only provide trailing zeroes in case we have a whole number\n i = parseInt(\n amount = Number(Math.round(Math.abs(+amount || 0) + 'e+' + precision) + ('e-' + precision)),\n 10\n ) + '';\n pad = i.length < integerRequired ? integerRequired - i.length : 0;\n\n i = stringPad('0', pad) + i;\n\n j = i.length > groupLength ? i.length % groupLength : 0;\n re = new RegExp('(\\\\d{' + groupLength + '})(?=\\\\d)', 'g');\n\n // replace(/-/, 0) is only for fixing Safari bug which appears\n // when Math.abs(0).toFixed() executed on '0' number.\n // Result is '0.-0' :(\n\n am = Number(Math.round(Math.abs(amount - i) + 'e+' + precision) + ('e-' + precision));\n r = (j ? i.substr(0, j) + groupSymbol : '') +\n i.substr(j).replace(re, '$1' + groupSymbol) +\n (precision ? decimalSymbol + am.toFixed(precision).replace(/-/, 0).slice(2) : '');\n\n return pattern.replace('%s', r).replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n }\n\n /**\n * Deep clone of Object. Doesn't support functions\n * @param {Object} obj\n * @return {Object}\n */\n function objectDeepClone(obj) {\n return JSON.parse(JSON.stringify(obj));\n }\n\n /**\n * Helper to find ID in name attribute\n * @param {jQuery} element\n * @returns {undefined|String}\n */\n function findOptionId(element) {\n var re, id, name;\n\n if (!element) {\n return id;\n }\n name = $(element).attr('name');\n\n if (name.indexOf('[') !== -1) {\n re = /\\[([^\\]]+)?\\]/;\n } else {\n re = /_([^\\]]+)?_/;
2 // just to support file-type-option\n }\n id = re.exec(name) && re.exec(name)[1];\n\n if (id) {\n return id;\n }\n }\n\n return {\n formatPriceLocale: formatPriceLocale,\n formatPrice: formatPrice,\n deepClone: objectDeepClone,\n strPad: stringPad,\n findOptionId: findOptionId\n };\n});\n","Magento_Catalog/js/price-option-date.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'priceUtils',\n 'priceOptions',\n 'jquery-ui-modules/widget'\n], function ($, utils) {\n 'use strict';\n\n var globalOptions = {\n fromSelector: 'form',\n dropdownsSelector: '[data-role=calendar-dropdown]'\n },\n optionHandler = {};\n\n optionHandler.optionHandlers = {};\n\n /**\n * Custom handler for Date-with-Dropdowns option type.\n * @param {jQuery} siblings\n * @return {Function} function that return object { optionHash : optionAdditionalPrice }\n */\n function onCalendarDropdownChange(siblings) {\n return function (element, optionConfig) {\n var changes = {},\n optionId = utils.findOptionId(element),\n overhead = optionConfig[optionId].prices,\n isNeedToUpdate = true,\n optionHash = 'price-option-calendar-' + optionId;\n\n siblings.each(function (index, el) {\n isNeedToUpdate = isNeedToUpdate && !!$(el).val();\n });\n\n overhead = isNeedToUpdate ? overhead : {};\n changes[optionHash] = overhead;\n\n return changes;\n };\n }\n\n /**\n * Returns number of days for special month and year\n * @param {Number} month\n * @param {Number} year\n * @return {Number}\n */\n function getDaysInMonth(month, year) {\n return new Date(year, month, 0).getDate();\n }\n\n /**\n * Adjusts the number of days in the day option element based on which month or year\n * is selected (changed). Adjusts the days to 28, 29, 30, or 31 typically.\n * @param {jQuery} dropdowns\n */\n function onDateChange(dropdowns) {\n var daysNodes,\n curMonth, curYear, expectedDays,\n options, needed,\n month = dropdowns.filter('[data-calendar-role=month]'),\n year = dropdowns.filter('[data-calendar-role=year]');\n\n if (month.length && year.length) {\n daysNodes = dropdowns.filter('[data-calendar-role=day]').find('option');\n\n curMonth = month.val() || '01';\n curYear = year.val() || '2000';\n expectedDays = getDaysInMonth(curMonth, curYear);\n\n if (daysNodes.length - 1 > expectedDays) { // remove unnecessary option nodes\n daysNodes.each(function (i, e) {\n if (e.value > expectedDays) {\n $(e).remove();\n }\n });\n } else if (daysNodes.length - 1 < expectedDays) { // add missing option nodes\n options = [];\n needed = expectedDays - daysNodes.length + 1;\n\n while (needed--) { //eslint-disable-line max-depth\n options.push(\n '<option value=\"' + (expectedDays - needed) + '\">' + (expectedDays - needed) + '</option>'\n );\n }\n $(options.join('')).insertAfter(daysNodes.last());\n }\n }\n }\n\n $.widget('mage.priceOptionDate', {\n options: globalOptions,\n\n /**\n * Function-initializer of priceOptionDate widget\n * @private\n */\n _create: function initOptionDate() {\n var field = this.element,\n form = field.closest(this.options.fromSelector),\n dropdowns = $(this.options.dropdownsSelector, field),\n dateOptionId;\n\n if (dropdowns.length) {\n dateOptionId = this.options.dropdownsSelector + dropdowns.attr('name');\n\n optionHandler.optionHandlers[dateOptionId] = onCalendarDropdownChange(dropdowns);\n\n form.priceOptions(optionHandler);\n\n dropdowns.data('role', dateOptionId);\n dropdowns.on('change', onDateChange.bind(this, dropdowns));\n }\n }\n });\n\n return $.mage.priceOptionDate;\n});\n","Magento_Catalog/js/price-options.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'underscore',\n 'mage/template',\n 'priceUtils',\n 'priceBox',\n 'jquery-ui-modules/widget'\n], function ($, _, mageTemplate, utils) {\n 'use strict';\n\n var globalOptions = {\n productId: null,\n priceHolderSelector: '.price-box', //data-role=\"priceBox\"\n optionsSelector: '.product-custom-option',\n optionConfig: {},\n optionHandlers: {},\n optionTemplate: '<%= data.label %>' +\n '<% if (data.finalPrice.value > 0) { %>' +\n ' +<%- data.finalPrice.formatted %>' +\n '<% } else if (data.finalPrice.value < 0) { %>' +\n ' <%- data.finalPrice.formatted %>' +\n '<% } %>',\n controlContainer: 'dd'\n };\n\n /**\n * Custom option preprocessor\n * @param {jQuery} element\n * @param {Object} optionsConfig - part of config\n * @return {Object}\n */\n function defaultGetOptionValue(element, optionsConfig) {\n var changes = {},\n optionValue = element.val(),\n optionId = utils.findOptionId(element[0]),\n optionName = element.prop('name'),\n optionType = element.prop('type'),\n optionConfig = optionsConfig[optionId],\n optionHash = optionName;\n\n switch (optionType) {\n case 'text':\n case 'textarea':\n changes[optionHash] = optionValue ? optionConfig.prices : {};\n break;\n\n case 'radio':\n if (element.is(':checked')) {\n changes[optionHash] = optionConfig[optionValue] && optionConfig[optionValue].prices || {};\n }\n break;\n\n case 'select-one':\n changes[optionHash] = optionConfig[optionValue] && optionConfig[optionValue].prices || {};\n break;\n\n case 'select-multiple':\n _.each(optionConfig, function (row, optionValueCode) {\n optionHash = optionName + '##' + optionValueCode;\n changes[optionHash] = _.contains(optionValue, optionValueCode) ? row.prices : {};\n });\n break;\n\n case 'checkbox':\n optionHash = optionName + '##' + optionValue;\n changes[optionHash] = element.is(':checked') ? optionConfig[optionValue].prices : {};\n break;\n\n case 'file':\n // Checking for 'disable' property equal to checking DOMNode with i
2d*=\"change-\"\n changes[optionHash] = optionValue || element.prop('disabled') ? optionConfig.prices : {};\n break;\n }\n\n return changes;\n }\n\n $.widget('mage.priceOptions', {\n options: globalOptions,\n\n /**\n * @private\n */\n _init: function initPriceBundle() {\n $(this.options.optionsSelector, this.element).trigger('change');\n },\n\n /**\n * Widget creating method.\n * Triggered once.\n * @private\n */\n _create: function createPriceOptions() {\n var form = this.element,\n options = $(this.options.optionsSelector, form),\n priceBox = $(this.options.priceHolderSelector, $(this.options.optionsSelector).element);\n\n if (priceBox.data('magePriceBox') &&\n priceBox.priceBox('option') &&\n priceBox.priceBox('option').priceConfig\n ) {\n if (priceBox.priceBox('option').priceConfig.optionTemplate) {\n this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate);\n }\n this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);\n }\n\n this._applyOptionNodeFix(options);\n\n options.on('change', this._onOptionChanged.bind(this));\n },\n\n /**\n * Custom option change-event handler\n * @param {Event} event\n * @private\n */\n _onOptionChanged: function onOptionChanged(event) {\n var changes,\n option = $(event.target),\n handler = this.options.optionHandlers[option.data('role')];\n\n option.data('optionContainer', option.closest(this.options.controlContainer));\n\n if (handler && handler instanceof Function) {\n changes = handler(option, this.options.optionConfig, this);\n } else {\n changes = defaultGetOptionValue(option, this.options.optionConfig);\n }\n $(this.options.priceHolderSelector).trigger('updatePrice', changes);\n },\n\n /**\n * Helper to fix issue with option nodes:\n * - you can't place any html in option ->\n * so you can't style it via CSS\n * @param {jQuery} options\n * @private\n */\n _applyOptionNodeFix: function applyOptionNodeFix(options) {\n var config = this.options,\n format = config.priceFormat,\n template = config.optionTemplate;\n\n template = mageTemplate(template);\n options.filter('select').each(function (index, element) {\n var $element = $(element),\n optionId = utils.findOptionId($element),\n optionConfig = config.optionConfig && config.optionConfig[optionId];\n\n $element.find('option').each(function (idx, option) {\n var $option,\n optionValue,\n toTemplate,\n prices;\n\n $option = $(option);\n optionValue = $option.val();\n\n if (!optionValue && optionValue !== 0) {\n return;\n }\n\n toTemplate = {\n data: {\n label: optionConfig[optionValue] && optionConfig[optionValue].name\n }\n };\n prices = optionConfig[optionValue] ? optionConfig[optionValue].prices : null;\n\n if (prices) {\n _.each(prices, function (price, type) {\n var value = +price.amount;\n\n value += _.reduce(price.adjustments, function (sum, x) { //eslint-disable-line\n return sum + x;\n }, 0);\n toTemplate.data[type] = {\n value: value,\n formatted: utils.formatPrice
2Locale(value, format)\n };\n });\n\n $option.text(template(toTemplate));\n }\n });\n });\n },\n\n /**\n * Custom behavior on getting options:\n * now widget able to deep merge accepted configuration with instance options.\n * @param {Object} options\n * @return {$.Widget}\n * @private\n */\n _setOptions: function setOptions(options) {\n $.extend(true, this.options, options);\n this._super(options);\n\n return this;\n }\n });\n\n return $.mage.priceOptions;\n});\n","Magento_Catalog/js/validate-product.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'mage/mage',\n 'Magento_Catalog/product/view/validation',\n 'catalogAddToCart'\n], function ($) {\n 'use strict';\n\n $.widget('mage.productValidate', {\n options: {\n bindSubmit: false,\n radioCheckboxClosest: '.nested',\n addToCartButtonSelector: '.action.tocart'\n },\n\n /**\n * Uses Magento's validation widget for the form object.\n * @private\n */\n _create: function () {\n var bindSubmit = this.options.bindSubmit;\n\n this.element.validation({\n radioCheckboxClosest: this.options.radioCheckboxClosest,\n\n /**\n * Uses catalogAddToCart widget as submit handler.\n * @param {Object} form\n * @returns {Boolean}\n */\n submitHandler: function (form) {\n var jqForm = $(form).catalogAddToCart({\n bindSubmit: bindSubmit\n });\n\n jqForm.catalogAddToCart('submitForm', jqForm);\n\n return false;\n }\n });\n $(this.options.addToCartButtonSelector).attr('disabled', false);\n }\n });\n\n return $.mage.productValidate;\n});\n","Magento_Catalog/js/upsell-products.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.upsellProducts', {\n options: {\n elementsSelector: '.item.product'\n },\n\n /**\n * Bind events to the appropriate handlers.\n * @private\n */\n _create: function () {\n if (this.element.data('shuffle')) {\n this._shuffle(this.element.find(this.options.elementsSelector));\n }\n this._showUpsellProducts(\n this.element.find(this.options.elementsSelector),\n this.element.data('limit'),\n this.element.data('shuffle-weighted')\n );\n },\n\n /* jscs:disable */\n /* eslint-disable */\n /**\n * Show upsell products according to limit. Shuffle if needed.\n * @param {*} elements\n * @param {Number} limit\n * @param {Boolean} weightedRandom\n * @private\n */\n _showUpsellProducts: function (elements, limit, weightedRandom) {\n var index, weights = [], random = [], weight = 2, shown = 0, $element, currentGroup, prevGroup;\n\n if (limit === 0) {\n limit = elements.length;\n }\n\n if (weightedRandom && limit > 0 && limit < elements.length) {\n for (index = 0; index < limit; index++) {\n $element = $(elements[index]);\n if ($element.data('shuffle-group') !== '') {\n break;\n }\n $element.show();\n shown++;\n }\n limit -= shown;\n for (index = elements.length - 1; index >= 0; index--) {\n $element = $(elements[index]);\n currentGroup = $element.data('shuffle-group');\n if (currentGroup !== '') {\n weights.push([index, Math.log(weight)]);\n if (typeof prevGroup !== 'undefined' && prevGroup !== currentGroup) {\n weight += 2;\n }\n prevGroup = currentGroup;\n }\n }\n\n if (weights.length === 0) {\n return;\n }\n\n for (index = 0; index < weights.length; index++) {\n random.push([weights[index][0], Math.pow(Math.random(), 1 / weights[index][1])]);\n }\n\n random.sort(function(a, b) {\n a = a[1];\n b = b[1];\n return a < b ? 1 : (a > b ? -1 : 0);\n });\n index = 0;\n while (limit) {\n $(elements[random[index][0]]).show();\n limit--;\n index++\n }\n return;\n }\n\n for (index = 0; index < limit; index++) {\n $(elements[index]).show();\n }\n },\n\n /* jscs:disable */\n /* eslint-disable */\n /**\n * Shuffle an array\n * @param elements\n * @returns {*}\n */\n _shuffle: function shuffle(elements){ //v1.0\n var parent, child, lastSibling;\n if (elements.length) {\n parent = $(elements[0]).parent();\n }\n while (elements.length) {\n child = elements.splice(Math.floor(Math.random() * elements.length), 1)[0];\n lastSibling = parent.find('[data-shuffle-group=\"' + $(child).data('shuffle-group') + '\"]').last();\n lastSibling.after(child);\n }\n }\n\n /* jscs:disable */\n /* eslint:disable */\n });\n\n return $.mage.upsellProducts;\n});\n","Magento_Catalog/js/list.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.compareList', {\n\n /** @inheritdoc */\n _create: function () {\n var elem = this.element,\n products = $('thead td', elem),\n headings;\n\n if (products.length >
2 this.options.productsInRow) {\n headings = $('<table></table>')\n .addClass('comparison headings data table')\n .insertBefore(elem.closest('.container'));\n\n elem.addClass('scroll');\n\n $('th', elem).each(function () {\n var th = $(this),\n thCopy = th.clone();\n\n th.animate({\n top: '+=0'\n }, 50, function () {\n var height = th.height();\n\n thCopy.css('height', height)\n .appendTo(headings)\n .wrap('<tr></tr>');\n });\n });\n }\n\n $(this.options.windowPrintSelector).on('click', function (e) {\n e.preventDefault();\n window.print();\n });\n }\n });\n\n return $.mage.compareList;\n});\n","Magento_Catalog/js/product/provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'underscore',\n 'jquery',\n 'mageUtils',\n 'uiElement',\n 'Magento_Catalog/js/product/storage/storage-service',\n 'Magento_Customer/js/customer-data',\n 'Magento_Catalog/js/product/view/product-ids-resolver'\n], function (_, $, utils, Element, storage, customerData, productResolver) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n identifiersConfig: {\n namespace: ''\n },\n productStorageConfig: {\n namespace: 'product_data_storage',\n customerDataProvider: 'product_data_storage',\n updateRequestConfig: {\n url: '',\n method: 'GET',\n dataType: 'json'\n },\n className: 'DataStorage'\n },\n ids: {},\n listens: {\n ids: 'idsHandler'\n }\n },\n\n /**\n * Initializes provider component.\n *\n * @returns {Provider} Chainable.\n */\n initialize: function () {\n this._super()\n .initIdsStorage();\n\n return this;\n },\n\n /**\n * Calls 'initObservable' of parent\n *\n * @returns {Object} Chainable.\n */\n initObservable: function () {\n this._super();\n this.observe('ids');\n\n return this;\n },\n\n /**\n * Initializes ids storage.\n *\n * @returns {Provider} Chainable.\n */\n initIdsStorage: function () {\n storage.onStorageInit(this.identifiersConfig.namespace, this.idsStorageHandler.bind(this));\n\n return this;\n },\n\n /**\n * Initializes ids storage handler.\n *\n * @param {Object} idsStorage\n */\n idsStorageHandler: function (idsStorage) {\n this.idsStorage = idsStorage;\n this.productStorage = storage.createStorage(this.productStorageConfig);\n this.productStorage.data.subscribe(this.dataCollectionHandler.bind(this));\n\n if (~~this.idsStorage.allowToSendRequest) {\n customerData.reload([idsStorage.namespace]).done(this._resolveDataByIds.bind(this));\n } else {\n this._resolveDataByIds();\n }\n },\n\n /**\n * Callback, which load by ids from ids-storage product data\n *\n * @private\n */\n _resolveDataByIds: function () {\n if (!window.checkout || !window.checkout.baseUrl) {\n // We need data that the minicart provdes to determine storeId/websiteId\n return;\n }\n\n // Filter initial ids to remove \"out of scope\" and \"outdated\" data\n this.ids(\n this.filterIds(this.ids())\n );\n this.initIdsListener();\n this.idsMerger(\n this.idsStorage.get(),\n this.prepareDataFromCustomerData(customerData.get(this.identifiersConfig.namespace)())\n );\n },\n\n /**\n * Init ids storage listener.\n */\n initIdsListener: function () {\n customerData.get(this.identifiersConfig.namespace).subscribe(function (data) {\
2n this.idsMerger(this.prepareDataFromCustomerData(data));\n }.bind(this));\n this.idsStorage.data.subscribe(this.idsMerger.bind(this));\n },\n\n /**\n * Prepare data from customerData.\n *\n * @param {Object} data\n *\n * @returns {Object}\n */\n prepareDataFromCustomerData: function (data) {\n data = data.items ? data.items : data;\n\n return data;\n },\n\n /**\n * Filter ids by their lifetime in order to show only hot ids :)\n *\n * @param {Object} ids\n * @returns {Array}\n */\n filterIds: function (ids) {\n var _ids = {},\n currentTime = new Date().getTime() / 1000,\n currentProductIds = productResolver($('#product_addtocart_form')),\n productCurrentScope = this.data.productCurrentScope,\n scopeId = productCurrentScope === 'store' ? window.checkout.storeId :\n productCurrentScope === 'group' ? window.checkout.storeGroupId :\n window.checkout.websiteId;\n\n _.each(ids, function (id, key) {\n if (\n currentTime - ids[key]['added_at'] < ~~this.idsStorage.lifetime &&\n !_.contains(currentProductIds, ids[key]['product_id']) &&\n (!id.hasOwnProperty('scope_id') || ids[key]['scope_id'] === scopeId)\n ) {\n _ids[id['product_id']] = id;\n\n }\n }, this);\n\n return _ids;\n },\n\n /**\n * Merges id from storage and customer data\n *\n * @param {Object} data\n * @param {Object} optionalData\n */\n idsMerger: function (data, optionalData) {\n if (data && optionalData) {\n data = _.extend(data, optionalData);\n }\n\n if (!_.isEmpty(data)) {\n this.ids(\n this.filterIds(_.extend(utils.copy(this.ids()), data))\n );\n }\n },\n\n /**\n * Ids update handler\n *\n * @param {Object}
2 data\n */\n idsHandler: function (data) {\n this.productStorage.setIds(this.data.currency, this.data.store, data);\n },\n\n /**\n * Process data\n *\n * @param {Object} data\n */\n processData: function (data) {\n var curData = utils.copy(this.data),\n ids = this.ids();\n\n delete data['data_id'];\n data = _.values(data);\n\n _.each(data, function (record, index) {\n record._rowIndex = index;\n record['added_at'] = ids[record.id]['added_at'];\n }, this);\n\n curData.items = data;\n this.set('data', curData);\n },\n\n /**\n * Product storage data handler\n *\n * @param {Object} data\n */\n dataCollectionHandler: function (data) {\n data = this.filterData(data);\n this.processData(data);\n },\n\n /**\n * Filters data from product storage by ids\n *\n * @param {Object} data\n *\n * @returns {Object}
2\n */\n filterData: function (data) {\n var result = {},\n i = 0,\n ids = _.keys(this.ids()),\n length = ids.length;\n\n for (i; i < length; i++) {\n if (ids[i] && data[ids[i]]) {\n result[ids[i]] = data[ids[i]];\n }\n }\n\n return result;\n }\n });\n});\n","Magento_Catalog/js/product/breadcrumbs.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Theme/js/model/breadcrumb-list'\n], function ($, breadcrumbList) {\n 'use strict';\n\n return function (widget) {\n\n $.widget('mage.breadcrumbs', widget, {\n options: {\n categoryUrlSuffix: '',\n useCategoryPathInUrl: false,\n product: '',\n categoryItemSelector: '.category-item',\n menuContainer: '[data-action=\"navigation\"] > ul'\n },\n\n /** @inheritdoc */\n _render: function () {\n this._appendCatalogCrumbs();\n this._super();\n },\n\n /**\n * Append category and product crumbs.\n *\n * @private\n */\n _appendCatalogCrumbs: function () {\n var categoryCrumbs = this._resolveCategoryCrumbs();\n\n categoryCrumbs.forEach(function (crumbInfo) {\n breadcrumbList.push(crumbInfo);\n });\n\n if (this.options.product) {\n breadcrumbList.push(this._getProductCrumb());\n }\n },\n\n /**\n * Resolve categories crumbs.\n *\n * @return Array\n * @private\n */\n _resolveCategoryCrumbs: function () {\n var menuItem = this._resolveCategoryMenuItem(),\n categoryCrumbs = [];\n\n if (menuItem !== null && menuItem.length) {\n categoryCrumbs.unshift(this._getCategoryCrumb(menuItem));\n\n while ((menuItem = this._getParentMenuItem(menuItem)) !== null) {\n categoryCrumbs.unshift(this._getCategoryCrumb(menuItem));\n }\n }\n\n return categoryCrumbs;\n },\n\n /**\n * Returns crumb data.\n *\n * @param {Object} menuItem\n * @return {Object}\n * @private\n */\n _getCategoryCrumb: function (menuItem) {\n return {\n 'name': 'category',\n 'label': menuItem.text(),\n 'link': menuItem.attr('href'),\n 'title': ''\n };\n },\n\n /**\n * Returns product crumb.\n *\n * @return {Object}\n * @private\n */\n _getProductCrumb: function () {\n return {\n 'name': 'product',\n 'label': this.options.product,\n 'link': '',\n 'title': ''\n };\n },\n\n /**\n * Find parent menu item for current.\n *\n * @param {Object} menuItem\n * @return {Object|null}\n * @private\n */\n _getParentMenuItem: function (menuItem) {\n var classes,\n classNav,\n parentClass,\n parentMenuItem = null;\n\n if (!menuItem) {\n return null;\n }\n\n classes = menuItem.parent().attr('class');\n classNav = classes.match(/(nav\\-)[0-9]+(\\-[0-9]+)+/gi);\n\n if (classNav) {\n classNav = classNav[0];\n parentClass = classNav.substr(0, classNav.lastIndexOf('-'));\n\n if (parentClass.lastIndexOf('-') !== -1) {\n parentMenuItem = $(this.options.menuContainer).find('.' + parentClass + ' > a');\n parentMenuItem = parentMenuItem.length ? parentMenuItem : null;\n }\n }\n\n return parentMenuItem;\n },\n\n /**\n * Returns category menu item.\n *\n * Tries to resolve category from url or from referrer as fallback and\n * find menu item from navigation menu by category url.\n *\n * @return {Object|null}\n * @private\n */\n _resolveCategoryMenuItem: function () {\n var categoryUrl = this._resolveCategoryUrl(),\
2n menu = $(this.options.menuContainer),\n categoryMenuItem = null;\n\n if (categoryUrl && menu.length) {\n categoryMenuItem = menu.find(\n this.options.categoryItemSelector +\n ' > a[href=\"' + categoryUrl + '\"]'\n );\n }\n\n return categoryMenuItem;\n },\n\n /**\n * Returns category url.\n *\n * @return {String}\n * @private\n */\n _resolveCategoryUrl: function () {\n var categoryUrl;\n\n if (this.options.useCategoryPathInUrl) {\n // In case category path is used in product url - resolve category url from current url.\n categoryUrl = window.location.href.split('?')[0];\n categoryUrl = categoryUrl.substring(0, categoryUrl.lastIndexOf('/')) +\n this.options.categoryUrlSuffix;\n } else {\n // In other case - try to resolve it from referrer (without parameters).\n categoryUrl = document.referrer;\n\n if (categoryUrl.indexOf('?') > 0) {\n categoryUrl = categoryUrl.substr(0, categoryUrl.indexOf('?'));\n }\n }\n\n return categoryUrl;\n }\n });\n\n return $.mage.breadcrumbs;\n };\n});\n","Magento_Catalog/js/product/addtocart-button.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/uenc-processor',\n 'Magento_Catalog/js/product/list/column-status-validator'\n], function (Element, uencProcessor, columnStatusValidator) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n label: ''\n },\n\n /**\n * Prepare data, that will be inserted as data-mage-init attribute into button. With help of this attribute\n * Add To * buttons can understand post data and urls\n *\n * @param {Object} row\n * @returns {String}\n */\n getDataMageInit: function (row) {\n return '{\"redirectUrl\": { \"url\" : \"' + uencProcessor(row['add_to_cart_button'].url) + '\"}}';\n },\n\n /**\n * Prepare Data-Post data that will be used in data-mage-init\n *\n * @param {Object} row\n * @return {String}\n */\n getDataPost: function (row) {\n return uencProcessor(row['add_to_cart_button']['post_data']);\n },\n\n /**\n * Check if product has required options.\n *\n * @param {Object} row\n * @return {Boolean}\n */\n hasRequiredOptions: function (row) {\n return row['add_to_cart_button']['required_options'];\n },\n\n /**\n * Depends on this option, \"Add to cart\" button can be shown or hide\n *\n * @param {Object} row\n * @returns {Boolean}\n */\n isSalable: function (row) {\n return row['is_salable'];\n },\n\n /**\n * Depends on this option, stock status text can be \"In stock\" or \"Out Of Stock\"\n *\n * @param {Object} row\n * @returns {Boolean}\n */\n isAvailable: function (row) {\n return row['is_available'];\n },\n\n /**\n * Depends on this option, \"Add to cart\" button can be shown or hide. Depends on backend configuration\n *\n * @returns {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'add_to_cart', 'show_buttons');\n },\n\n /**\n * Get button label.\n *\n * @return {String}\n */\n getLabel: function () {\n return this.label;\n }\n });\n});\n","Magento_Catalog/js/product/name.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/list/column-status-validator',\n 'escaper'\n], function (Column, columnStatusValidator, escaper) {\n 'use strict';\n\n return Column.extend({\n defaults: {\n allowedTags: ['div', 'span', 'b', 'strong', 'i', 'em', 'u', 'a']\n }
2,\n\n /**\n * Depends on this option, product name can be shown or hide. Depends on backend configuration\n *\n * @returns {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'name', 'show_attributes');\n },\n\n /**\n * Name column.\n *\n * @param {String} label\n * @returns {String}\n */\n getNameUnsanitizedHtml: function (label) {\n return escaper.escapeHtml(label, this.allowedTags);\n }\n });\n});\n","Magento_Catalog/js/product/provider-compared.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'underscore',\n './provider',\n 'Magento_Catalog/js/product/storage/storage-service',\n 'Magento_Customer/js/customer-data'\n], function (_, Provider, storage, customerData) {\n 'use strict';\n\n return Provider.extend({\n\n /**\n * Ids update handler\n *\n * @param {Object}
2 data\n */\n idsHandler: function (data) {\n this.productStorage.setIds(this.data.currency, this.data.store, this.dataFilter(data));\n },\n\n /**\n * Filters data by provider\n *\n * @param {Object} data\n *\n * @returns {Object}\n */\n dataFilter: function (data) {\n var providerData = this.idsStorage.prepareData(customerData.get(this.identifiersConfig.provider)().items),\n result = {},\n productCurrentScope,\n scopeId;\n\n if (typeof this.data.productCurrentScope !== 'undefined' && window.checkout && window.checkout.baseUrl) {\n productCurrentScope = this.data.productCurrentScope;\n scopeId = productCurrentScope === 'store' ? window.checkout.storeId :\n productCurrentScope === 'group' ? window.checkout.storeGroupId :\n window.checkout.websiteId;\n _.each(data, function (value, key) {\n if (!providerData[productCurrentScope + '-' + scopeId + '-' + key]) {\n result[key] = value;\n }\n });\n } else {\n _.each(data, function (value, key) {\n if (!providerData[key]) {\n result[key] = value;\n }\n });\n }\n\n return result;\n },\n\n /**\n * Filters data from product storage by ids\n *\n * @param {Object} data\n *\n * @returns {Object}
2\n */\n filterData: function (data) {\n var result = {},\n i = 0,\n ids = _.keys(this.dataFilter(this.ids())),\n length = ids.length;\n\n for (i; i < length; i++) {\n if (ids[i] && data[ids[i]]) {\n result[ids[i]] = data[ids[i]];\n }\n }\n\n return result;\n }\n });\n});\n","Magento_Catalog/js/product/uenc-processor.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([], function () {\n 'use strict';\n\n /**\n * Check data to JSON.\n *\n * @returns {Boolean}\n */\n function _isJSON(data) {\n try {\n JSON.parse(data);\n } catch (e) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Processes data.\n *\n * @param {Object} data\n * @param {String} placeholder\n * @param {String} uenc\n *\n * @returns {String}\n */\n function _stringProcessor(data, placeholder, uenc) {\n if (data && ~data.indexOf(placeholder)) {\n return data.replace(placeholder, uenc);\n }\n\n return data;\n }\n\n /**\n * Processes data.\n *\n * @param {Object} data\n * @param {String} placeholder\n * @param {String} uenc\n *\n * @returns {String}\n */\n function _objectProcessor(data, placeholder, uenc) {\n data = JSON.parse(data);\n\n if (data.hasOwnProperty('action')) {\n data.action = _stringProcessor(data.action, placeholder, uenc);\n }\n\n if (data.hasOwnProperty('data') && data.data.hasOwnProperty('uenc')) {\n data.data.uenc = uenc;\n }\n\n return JSON.stringify(data);\n }\n\n /**\n * Processes data.\n *\n * @param {Object} data\n * @param {String} placeholder\n *\n * @returns {String}\n */\n return function (data, placeholder) {\n var uenc = btoa(window.location.href).replace('+/=', '-_,');\n\n placeholder = placeholder || encodeURI('%uenc%');\n\n return _isJSON(data) ?\n _objectProcessor(data, placeholder, uenc) :\n _stringProcessor(data, placeholder, uenc);\n\n };\n }\n);\n","Magento_Catalog/js/product/query-builder.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'underscore'\n ], function (_) {\n 'use strict';\n\n return {\n\n /**\n * Build query to get id\n *\n * @param {Object} data\n */\n buildQuery: function (data) {\
2n var filters = [];\n\n _.each(data, function (value, key) {\n filters.push({\n field: key,\n value: value,\n 'condition_type': 'in'\n });\n });\n\n return {\n searchCriteria: {\n filterGroups: [\n {\n filters: filters\n }\n ]\n }\n };\n }\n };\n }\n);\n","Magento_Catalog/js/product/remaining-characters.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/translate',\n 'jquery-ui-modules/widget'\n], function ($, $t) {\n 'use strict';\n\n $.widget('mage.remainingCharacters', {\n options: {\n remainingText: $t('remaining'),\n tooManyText: $t('too many'),\n errorClass: 'mage-error',\n noDisplayClass: 'no-display'\n },\n\n /**\n * Initializes custom option component\n *\n * @private\n */\n _create: function () {\n this.note = $(this.options.noteSelector);\n this.counter = $(this.options.counterSelector);\n\n this.updateCharacterCount();\n this.element.on('change keyup paste', this.updateCharacterCount.bind(this));\n },\n\n /**\n * Updates counter message\n */\n updateCharacterCount: function () {\n var length = this.element.val().length,\n diff = this.options.maxLength - length;\n\n this.counter.text(this._formatMessage(diff));\n this.counter.toggleClass(this.options.noDisplayClass, length === 0);\n this.note.toggleClass(this.options.errorClass, diff < 0);\n },\n\n /**\n * Format remaining characters message\n *\n * @param {int} diff\n * @returns {String}\n * @private\n */\n _formatMessage: function (diff) {\n var count = Math.abs(diff),\n qualifier = diff < 0 ? this.options.tooManyText : this.options.remainingText;\n\n return '(' + count + ' ' + qualifier + ')';\n }\n });\n\n return $.mage.remainingCharacters;\n});\n","Magento_Catalog/js/product/learn-more.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/list/column-status-validator'\n], function (Column, columnStatusValidator) {\n 'use strict';\n\n return Column.extend({\n /**\n * Depends on this option, \"Learn More\" link can be shown or hide. Depends on backend configuration\n *\n * @returns {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'learn_more', 'show_attributes');\n }\n });\n});\n","Magento_Catalog/js/product/addtocompare-button.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/uenc-processor',\n 'Magento_Catalog/js/product/list/column-status-validator'\n], function (Column, uencProcessor, columnStatusValidator) {\n 'use strict';\n\n return Column.extend({\n defaults: {\n label: ''\n },\n\n /**\n * Prepare Data-Post data that will be used in data-mage-init\n *\n * @param {Object} row\n * @returns {Array}\n */\n getDataPost: function (row) {\n return uencProcessor(row['add_to_compare_button'].url ||\n row['add_to_compare_button']['post_data']);\n },\n\n /**\n * Depends on this option, \"Add to compare\" button can be shown or hide. Depends on backend configuration\n *\n * @returns {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'add_to_compare', 'show_buttons');\n },\n\n /**\n * Get button label.\n *\n * @return {String}\n */\n getLabel: function () {\n return this.label;\n }\n });\n});\n","Magento_Catalog/js/product/list/listing.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'ko',\n 'underscore',\n 'Magento_Ui/js/grid/listing'\n], function (ko, _, Listing) {\n 'use strict';\n\n return Listing.extend({\n defaults: {\n additionalClasses: '',\n filteredRows: {},\n limit: 5,\n listens: {\n elems: 'filterRowsFromCac
2he',\n '${ $.provider }:data.items': 'filterRowsFromServer'\n }\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.filteredRows = ko.observable();\n this.initProductsLimit();\n this.hideLoader();\n },\n\n /**\n * Initialize product limit\n * Product limit can be configured through Ui component.\n * Product limit are present in widget form\n *\n * @returns {exports}\n */\n initProductsLimit: function () {\n if (this.source['page_size']) {\n this.limit = this.source['page_size'];\n }\n\n return this;\n },\n\n /**\n * Initializes observable properties.\n *\n * @returns {Listing} Chainable.\n */\n initObservable: function () {\n this._super()\n .track({\n rows: []\n });\n\n return this;\n },\n\n /**\n * Sort and filter rows, that are already in magento storage cache\n *\n * @return void\n */\n filterRowsFromCache: function () {\n this._filterRows(this.rows);\n },\n\n /**\n * Sort and filter rows, that are come from backend\n *\n * @param {Object} rows\n */\n filterRowsFromServer: function (rows) {\n this._filterRows(rows);\n },\n\n /**\n * Filter rows by limit and sort them\n *\n * @param {Array} rows\n * @private\n */\n _filterRows: function (rows) {\n this.filteredRows(_.sortBy(rows, 'added_at').reverse().slice(0, this.limit));\n },\n\n /**\n * Can retrieve product url\n *\n * @param {Object} row\n * @returns {String}\n */\n getUrl: function (row) {\n return row.url;\n },\n\n /**\n * Get product attribute by code.\n *\n * @param {String} code\n * @return {Object}\n */\n getComponentByCode: function (code) {\n var elems = this.elems() ? this.elems() : ko.getObservable(this, 'elems'),\n component;\n\n component = _.filter(elems, function (elem) {\n return elem.index === code;\n }, this).pop();\n\n return component;\n }\n });\n});\n","Magento_Catalog/js/product/list/toolbar.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n /**\n * ProductListToolbarForm Widget - this widget is setting cookie and submitting form according to toolbar controls\n */\n $.widget('mage.productListToolbarForm', {\n\n options: {\n modeControl: '[data-role=\"mode-switcher\"]',\n directionControl: '[data-role=\"direction-switcher\"]',\n orderControl: '[data-role=\"sorter\"]',\n limitControl: '[data-role=\"limiter\"]',\n mode: 'product_list_mode',\n direction: 'product_list_dir',\n order: 'product_list_order',\n limit: 'product_list_limit',\n page: 'p',\n modeDefault: 'grid',\n directionDefault: 'asc',\n orderDefault: 'position',\n limitDefault: '9',\n url: '',\n formKey: '',\n post: false\n },\n\n /** @inheritdoc */\n _create: function () {\n this._bind(\n $(this.options.modeControl, this.element),\n this.options.mode,\n this.options.modeDefault\n );\n this._bind(\n $(this.options.directionControl, this.element),\n this.options.direction,\n this.options.directionDefault\n );\n this._bind(\n $(this.options.orderControl, this.element),\n this.options.order,\n this.options.orderDefault\n );\n this._bind(\n $(this.options.limitControl, this.element),\n this.options.limit,\n this.options.limitDefault\n );\n },\n\n /** @inheritdoc */\n _bind: function (element, paramName, defaultValue) {\n if (element.is('select')) {\n element.on('change', {\n paramName: paramName,\n 'default': defaultValue\n }, $.proxy(this._processSelect, this));\n } else {\n element.on('click', {\n paramName: paramName,\n 'default': defaultValue\n }, $.proxy(this._processLink, this));\n }\n },\n\n /**\n * @param {jQuery.Event} event\n * @private\n */\n _processLink: function (event) {\n event.preventDefault();\n this.changeUrl(\n event.data.paramName,\n $(event.currentTarget).data('value'),\n event.data.default\n );\n },\n\n /**\n * @param {jQuery.Event} event\n * @private\n */\n _processSelect: function (event) {\n this.changeUrl(\n event.data.paramName,\n event.currentTarget.options[event.currentTarget.selectedIndex].value,\n event.data.default\n );\n },\n\n /**\n * @private\n */\n getUrlParams: function () {\n var decode = window.decodeURIComponent,\n urlPaths = this.options.url.split('?'),\n urlParam
2s = urlPaths[1] ? urlPaths[1].split('&') : [],\n params = {},\n parameters, i;\n\n for (i = 0; i < urlParams.length; i++) {\n parameters = urlParams[i].split('=');\n params[decode(parameters[0])] = parameters[1] !== undefined ?\n decode(parameters[1].replace(/\\+/g, '%20')) :\n '';\n }\n\n return params;\n },\n\n /**\n * @returns {String}\n * @private\n */\n getCurrentLimit: function () {\n return this.getUrlParams()[this.options.limit] || this.options.limitDefault;\n },\n\n /**\n * @returns {String}\n * @private\n */\n getCurrentPage: function () {\n return this.getUrlParams()[this.options.page] || 1;\n },\n\n /**\n * @param {String} paramName\n * @param {*} paramValue\n * @param {*} defaultValue\n */\n changeUrl: function (paramName, paramValue, defaultValue) {\n var urlPaths = this.options.url.split('?'),\n baseUrl = urlPaths[0],\n paramData = this.getUrlParams(),\n currentPage = this.getCurrentPage(),\n form, params, key, input, formKey, newPage;\n\n if (currentPage > 1 && paramName === this.options.mode) {\n delete paramData[this.options.page];\n }\n\n if (currentPage > 1 && paramName === this.options.limit) {\n newPage = Math.floor(this.getCurrentLimit() * (currentPage - 1) / paramValue) + 1;\n\n if (newPage > 1) {\n paramData[this.options.page] = newPage;\n } else {\n delete paramData[this.options.page];\n }\n }\n\n paramData[paramName] = paramValue;\n\n if (this.options.post) {\n form = document.createElement('form');\n params = [this.options.mode, this.options.direction, this.options.order, this.options.limit];\n\n for (key in paramData) {\n if (params.indexOf(key) !== -1) { //eslint-disable-line max-depth\n input = document.createElement('input');\n input.name = key;\n input.value = paramData[key];\n form.appendChild(input);\n delete paramData[key];\n }\n }\n formKey = document.createElement('input');\n formKey.name = 'form_key';\n formKey.value = this.options.formKey;\n form.appendChild(formKey);\n\n paramData = $.param(paramData);\n baseUrl += paramData.length ? '?' + paramData : '';\n\n form.action = baseUrl;\n form.method = 'POST';\n document.body.appendChild(form);\n form.submit();\n } else {\n if (paramValue == defaultValue) { //eslint-disable-line eqeqeq\n delete paramData[paramName];\n }\n\n paramData = $.param(paramData);\n location.href = baseUrl + (paramData.length ? '?' + paramData : '');\n }\n }\n });\n\n return $.mage.productListToolbarForm;\n});\n","Magento_Catalog/js/product/list/column-status-validator.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore'\n], function (_) {\n 'use strict';\n\n return _.extend({\n /**\n * Check whether we can show column depends on server settings or not\n *\n * @param {Object} source\n * @param {String} attributeCode\n * @param {String} type\n * @returns {Boolean}\n */\n isValid: function (source, attributeCode, type) {\n var attributes;\n\n if (!source[type]) {\n return false;\n }\n\n attributes = source[type].split(',');\n\n return _.contains(attributes, attributeCode);\n }\n });\n});\n","Magento_Catalog/js/product/list/columns/price-box.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'ko',\n 'underscore',\n 'uiRegistry',\n 'mageUtils',\n 'uiCollection',\n 'Magento_Catalog/js/product/list/column-status-validator',\n 'uiLayout'\n], function (ko, _, registry, utils, Collection, columnStatusValidator, layout) {\n 'use strict';\n\n return Collection.extend({\n defaults: {\n label: '',\n hasSpecialPrice
2: false,\n showMinimalPrice: false,\n useLinkForAsLowAs: false,\n visible: true,\n headerTmpl: 'ui/grid/columns/text',\n bodyTmpl: 'Magento_Catalog/product/price/price_box',\n disableAction: false,\n controlVisibility: true,\n sortable: false,\n sorting: false,\n draggable: true,\n fieldClass: {},\n renders: {\n default: {}\n },\n ignoreTmpls: {\n fieldAction: true\n },\n statefull: {\n visible: true,\n sorting: true\n },\n imports: {\n exportSorting: 'sorting'\n },\n listens: {\n elems: ''\n },\n modules: {\n source: '${ $.provider }'\n },\n pricesInit: {}\n },\n\n /**\n * Sort prices api\n *\n * @returns {exports}\n */\n sort: function () {\n return this;\n },\n\n /**\n * Check whether is allowed to render price or not\n *\n * @returns {*}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'price', 'show_attributes');\n },\n\n /**\n * Retrieve array of prices, that should be rendered for specific product\n *\n * @param {Array} row\n * @return {Array}\n */\n getPrices: function (row) {\n var elems = this.elems() ? this.elems() : ko.getObservable(this, 'elems'),\n result;\n\n //we cant take type of product from row\n this.initPrices(row);\n result = _.filter(elems, function (elem) {\n return elem.productType === row.type;\n });\n\n return result;\n },\n\n /**\n * Recursive Merging of objects\n *\n * @param {Array} target\n * @param {Array} source\n * @returns {Array}\n * @private\n */\n _deepObjectExtend: function (target, source) {\n var _target = utils.copy(target);\n\n _.each(source, function (value, key) {\n if (_.keys(value).length && typeof _target[key] !== 'undefined') {\n _target[key] = this._deepObjectExtend(_target[key], value);\n } else {\n _target[key] = value;\n }\n }, this);\n\n return _target;\n },\n\n /**\n * Init price type box, in cases when product type has custom component or bodyTmpl\n *\n * @param {String} productType\n * @private\n */\n _initPriceWithCustomMetaData: function (productType) {\n var price = this._deepObjectExtend(\n this.renders.prices['default'],\n this.renders.prices[productType]\n );\n\n price.name = productType + '.default';\n price.parent = this.name;\n price.source = this.source;\n price.productType = productType;\n layout([price]);\n },\n\n /**\n * Init Prices by product type and add them to layout\n *\n * @param {Array} _priceData\n * @param {String} productType\n * @private\n */\n _initPricesForProductType: function (_priceData, productType) {\n var prices = [];\n\n this._setPriceNamesToPrices(_priceData, productType);\n _.sortBy(_priceData, this._comparePrices);\n\n _.each(_priceData, function (priceData) {\n if (!priceData.component) {\n return;\n }\n\n priceData.parent = this.name;\n priceData.provider = this.provider;\n priceData.productType = productType;\n priceData = utils.template(priceData, this);\n prices.push(priceData);\n }, this);\n\n layout(prices);\n },\n\n /**\n * Init dynamic price components\n *\n * @param {Array} row\n * @returns {void}\n */\n initPrices: function (row) {\n var _priceData = [],\n productType = row.type,\n defaultPrice = this.renders.prices['default'];\n\n if (this.pricesInit[productType]) {\n return true;\n }\n\n this.pricesInit[productType] = true;\n\n if (this.renders.prices[productType] && this._needToApplyCustomTemplate(this.renders.prices[productType])) {\n return this._initPriceWithCustomMetaData(productType);\n }\n\n if (this.renders.prices[productType] && this.renders.prices[productType].children) {\n _priceData = this._deepObjectExtend(defaultPrice.children, this.renders.prices[productType].children);\n } else {\n _priceData = defaultPrice.children;\n }\n\n return this._initPricesForProductType(_priceData, productType);\n },\n\n /**\n * Set name to all price components\n *\n * @param {Array} prices\n * @param {String} productType\n * @private\n */\n _setPriceNamesToPrices: function (prices, productType) {\n _.each(prices, function (price, name) {\n price.priceType = name;\n price.name = name + '.' + productType;\n });\n\n return prices;\n },\n\n /**\n * Sort callback to compare prices by sort order\n *\n * @param {Number} firstPrice\n * @param {Number} secondPrice\n * @returns {Number}\n * @private\n */\n _comparePrices: function (firstPrice, secondPrice) {\n if (firstPrice.s
2ortOrder < secondPrice.sortOrder) {\n return -1;\n }\n\n if (firstPrice.sortOrder > secondPrice.sortOrder) {\n return 1;\n }\n\n return 0;\n },\n\n /**\n * Check whether metadata of product type prices was changed, and we should\n * to apply custom template or custom component\n *\n * @param {Array} productData\n * @returns {*}\n * @private\n */\n _needToApplyCustomTemplate: function (productData) {\n return productData.bodyTmpl || productData.component;\n },\n\n /**\n * Returns path to the columns' body template.\n *\n * @returns {String}\n */\n getBody: function () {\n return this.bodyTmpl;\n },\n\n /**\n * Get price label.\n *\n * @returns {String}\n */\n getLabel: function () {\n return this.label;\n }\n });\n});\n","Magento_Catalog/js/product/list/columns/final-price.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'uiRegistry',\n 'mageUtils',\n 'uiCollection'\n], function (_, registry, utils, Collection) {\n 'use strict';\n\n return Collection.extend({\n defaults: {\n label: false,\n headerTmpl: 'ui/grid/columns/text',\n showMinimalPrice: false,\n showMaximumPrice: false,\n useLinkForAsLowAs: false,\n bodyTmpl: 'Magento_Catalog/product/final_price',\n priceWrapperCssClasses: '',\n priceWrapperAttr: {}\n },\n\n /**\n * Get product final price.\n *\n * @param {Object} row\n * @return {HTMLElement} final price html\n */\n getPrice: function (row) {\n return row['price_info']['formatted_prices']['final_price'];\n },\n\n /**\n * UnsanitizedHtml version of getPrice.\n *\n * @param {Object} row\n * @return {HTMLElement} final price html\n */\n getPriceUnsanitizedHtml: function (row) {\n return this.getPrice(row);\n },\n\n /**\n * Get product regular price.\n *\n * @param {Object} row\n * @return {HTMLElement} regular price html\n */\n getRegularPrice: function (row) {\n return row['price_info']['formatted_prices']['regular_price'];\n },\n\n /**\n * UnsanitizedHtml version of getRegularPrice.\n *\n * @param {Object} row\n * @return {HTMLElement} regular price html\n */\n getRegularPriceUnsanitizedHtml: function (row) {\n return this.getRegularPrice(row);\n },\n\n /**\n * Check if product has a price range.\n *\n * @param {Object} row\n * @return {Boolean}\n */\n hasPriceRange: function (row) {\n return row['price_info']['max_regular_price'] !== row['price_info']['min_regular_price'];\n },\n\n /**\n * Check if product has special price.\n *\n * @param {Object} row\n * @return {HTMLElement} special price html\n */\n hasSpecialPrice: function (row) {\n return row['price_info']['regular_price'] > row['price_info']['final_price'];\n },\n\n /**\n * Check if product has minimal price.\n *\n * @param {Object} row\n * @return {HTMLElement} minimal price html\n */\n isMinimalPrice: function (row) {\n return row['price_info']['minimal_price'] < row['price_info']['final_price'];\n },\n\n /**\n * Get product minimal price.\n *\n * @param {Object} row\n * @return {HTMLElement} minimal price html\n */\n getMinimalPrice: function (row) {\n return row['price_info']['formatted_prices']['minimal_price'];\n },\n\n /**\n * UnsanitizedHtml version of getMinimalPrice.\n *\n * @param {Object} row\n * @return {HTMLElement} minimal price html\n */\n getMinimalPriceUnsanitizedHtml: function (row) {\n return this.getMinimalPrice(row);\n },\n\n /**\n * Check if product is salable.\n *\n * @param {Object} row\n * @return {Boolean}\n */\n isSalable: function (row) {\n return row['is_salable'];\n },\n\n /**\n * Get product maximum price.\n *\n * @param {Object} row\n * @return {HTMLElement} maximum price html\n */\n getMaxPrice: function (row) {\n return row['price_info']['formatted_prices']['max_price'];\n },\n\n /**\n * UnsanitizedHtml version of getMaxPrice.\n *\n * @param {Object} row\n * @return {HTMLElement} maximum price html\n */\n getMaxPriceUnsanitizedHtml: function (row) {\n return this.getMaxPrice(row);\n },\n\n /**\n * Get product maximum regular price in case of price range and special price.\n *\n * @param {Object} row\n * @return {HTMLElement} maximum regular price html\n */\n getMaxRegularPrice: function (row) {\n return row['price_info']['formatted_prices']['max_regular_price'];\n },\n\n /**\n * UnsanitizedHtml version of getMaxRegularPrice.\n *\n * @param {Object} row\n * @return {HTMLElement} maximum regular price html\n */\n getMaxRegularPriceUnsanitizedHtml: function (row) {\n return this.getMaxRegularPrice(row);\n },\n\n /**\n * Get product minimal regular price in case of price range and special price.\n *\n * @param {Object} row\n * @return {HTMLElement} minimal regular price html\n */\n getMinRegularPrice: function (row) {\n return row['price_info']['formatted_prices']['min_regular_price'];\n },\n\n /**\n * UnsanitizedHtml version of getMinRegularPrice.\n *\n * @param {Object} row\n * @return {HTMLElement} minimal regular price html\n */\n getMinRegularPriceUnsanitizedHtml: function (row) {\n return this.getMinRegularPrice(row);\n },\n\n /**\n * Get adjustments names and return as string.\n *\n * @return {String} adjustments classes\n */\n getAdjustmentCssClasse
2s: function () {\n return _.pluck(this.getAdjustments(), 'index').join(' ');\n },\n\n /**\n * Get product minimal price as number.\n *\n * @param {Object} row\n * @return {Number} minimal price amount\n */\n getMinimalPriceAmount: function (row) {\n return row['price_info']['minimal_price'];\n },\n\n /**\n * UnsanitizedHtml version of getMinimalPriceAmount\n *\n * @param {Object} row\n * @return {Number} minimal price amount\n */\n getMinimalPriceAmountUnsanitizedHtml: function (row) {\n return this.getMinimalPriceAmount(row);\n },\n\n /**\n * Get product minimal regular price as number in case of special price.\n *\n * @param {Object} row\n * @return {Number} minimal regular price amount\n */\n getMinimalRegularPriceAmount: function (row) {\n return row['price_info']['min_regular_price'];\n },\n\n /**\n * Get product maximum price as number.\n *\n * @param {Object} row\n * @return {Number} maximum price amount\n */\n getMaximumPriceAmount: function (row) {\n return row['price_info']['max_price'];\n },\n\n /**\n * Get product maximum regular price as number in case of special price.\n *\n * @param {Object} row\n * @return {Number} maximum regular price amount\n */\n getMaximumRegularPriceAmount: function (row) {\n return row['price_info']['max_regular_price'];\n },\n\n /**\n * Check if minimal regular price exist for product.\n *\n * @param {Object} row\n * @return {Boolean}\n */\n showMinRegularPrice: function (row) {\n return this.getMinimalPriceAmount(row) < this.getMinimalRegularPriceAmount(row);\n },\n\n /**\n * Check if maximum regular price exist for product.\n *\n * @param {Object} row\n * @return {Boolean}\n */\n showMaxRegularPrice: function (row) {\n return this.getMaximumPriceAmount(row) < this.getMaximumRegularPriceAmount(row);\n },\n\n /**\n * Get path to the columns' body template.\n *\n * @returns {String}\n */\n getBody: function () {\n return this.bodyTmpl;\n },\n\n /**\n * Get all price adjustments.\n *\n * @returns {Object}\n */\n getAdjustments: function () {\n var adjustments = this.elems();\n\n _.each(adjustments, function (adjustment) {\n adjustment.setPriceType(this.priceType);\n adjustment.source = this.source;\n }, this);\n\n return adjustments;\n }\n });\n});\n","Magento_Catalog/js/product/list/columns/image.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'underscore',\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/list/column-status-validator'\n], function (_, Element, columnStatusValidator) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n bodyTmpl: 'Magento_Catalog/product/list/columns/image',\n imageCode: 'default',\n image: {}\n },\n\n /**\n * Find image by code in scope of images\n *\n * @param {Object} images\n * @returns {*|T}\n */\n getImage: function (images) {\n return _.filter(images, function (image) {\n return this.imageCode === image.code;\n }, this).pop();\n },\n\n /**\n * Get image path.\n *\n * @param {Object} row\n * @return {String}\n */\n getImageUrl: function (row) {\n return this.getImage(row.images).url;\n },\n\n /**\n * Get image box width.\n *\n * @param {Object} row\n * @return {Number}\n */\n getWidth: function (row) {\n return this.getImage(row.images).width;\n }
2,\n\n /**\n * Get image box height.\n *\n * @param {Object} row\n * @return {Number}\n */\n getHeight: function (row) {\n return this.getImage(row.images).height;\n },\n\n /**\n * Get resized image width.\n *\n * @param {Object} row\n * @return {Number}\n */\n getResizedImageWidth: function (row) {\n return this.getImage(row.images)['resized_width'];\n },\n\n /**\n * Get resized image height.\n *\n * @param {Object} row\n * @return {Number}\n */\n getResizedImageHeight: function (row) {\n return this.getImage(row.images)['resized_height'];\n },\n\n /**\n * Get image alt text.\n *\n * @param {Object} row\n * @return {String}\n */\n getLabel: function (row) {\n if (!this.imageExists(row)) {\n return this._super();\n }\n\n return this.getImage(row.images).label;\n },\n\n /**\n * Check if image exist.\n *\n * @param {Object} row\n * @return {Boolean}\n */\n imageExists: function (row) {\n return this.getImage(row.images) !== 'undefined';\n },\n\n /**\n * Check if component must be shown.\n *\n * @return {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'image', 'show_attributes');\n }\n });\n});\n","Magento_Catalog/js/product/list/columns/pricetype-box.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'ko',\n 'underscore',\n 'uiCollection'\n], function (ko, _, Collection) {\n 'use strict';\n\n return Collection.extend({\n /**\n * Find from all price ui components, price with specific code, init source on it and set priceType\n *\n * @param {String} code\n * @returns {*|T}\n */\n getPriceByCode: function (code) {\n var elems = this.elems() ? this.elems() : ko.getObservable(this, 'elems'),\n price;\n\n price = _.filter(elems, function (elem) {\n return elem.index.split('.').shift() === code;\n }, this).pop();\n\n price.source = this.source();\n price.priceType = code;\n\n return price;\n },\n\n /**\n * Retrieve body template\n *\n * @returns {String}\n */\n getBody: function () {\n return this.bodyTmpl;\n },\n\n /**\n * Check whether price has price range, depends on different options, that can be choose\n *\n * @param {Object} row\n * @returns {Boolean}\n */\n hasPriceRange: function (row) {\n return row['price_info']['max_regular_price'] !== row['price_info']['min_regular_price'];\n }\n });\n});\n","Magento_Catalog/js/product/storage/ids-storage-compare.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'ko',\n 'mageUtils',\n 'Magento_Customer/js/customer-data',\n 'Magento_Catalog/js/product/storage/ids-storage'\n], function (_, ko, utils, customerData, idsStorage) {\n 'use strict';\n\n return _.extend(utils.copy(idsStorage), {\n\n /**\n * Class name\n */\n name: 'IdsStorageCompare',\n\n /**\n * Initializes class\n *\n * @return Chainable.\n */\n initialize: function () {\n if (!this.data) {\n this.data = ko.observable({});\n }\n\n if (this.provider && window.checkout && window.checkout.baseUrl) {\n this.providerDataHandler(customerData.get(this.provider)());\n this.initProviderListener();\n }\n\n this.initLocalStorage()\n .cachesDataFromLocalStorage()\n .initDataListener();\n\n return this;\n },\n\n /**\n * Initializes listener for external data provider\n */\n initProviderListener: function () {\n customerData.get(this.provider).subscribe(this.providerDataHandler.bind(this));\n },\n\n /**\n * Initializes handler for external data provider update\n *\n * @param {Object} data\n */\n providerDataHandler: function (data) {\
2n data = data.items || data;\n data = this.prepareData(data);\n\n this.add(data);\n },\n\n /**\n * Prepares data to correct interface\n *\n * @param {Object} data\n *\n * @returns {Object} data\n */\n prepareData: function (data) {\n var result = {},\n scopeId;\n\n _.each(data, function (item) {\n if (typeof item.productScope !== 'undefined') {\n scopeId = item.productScope === 'store' ? window.checkout.storeId :\n item.productScope === 'group' ? window.checkout.storeGroupId :\n window.checkout.websiteId;\n\n result[item.productScope + '-' + scopeId + '-' + item.id] = {\n 'added_at': new Date().getTime() / 1000,\n 'product_id': item.id,\n 'scope_id': scopeId\n };\n } else {\n result[item.id] = {\n 'added_at': new Date().getTime() / 1000,\n 'product_id': item.id\n };\n }\n });\n\n return result;\n }\n });\n});\n","Magento_Catalog/js/product/storage/storage-service.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'underscore',\n 'mageUtils',\n 'mage/translate',\n 'Magento_Catalog/js/product/storage/ids-storage',\n 'Magento_Catalog/js/product/storage/data-storage',\n 'Magento_Catalog/js/product/storage/ids-storage-compare'\n], function ($, _, utils, $t, IdsStorage, DataStore, IdsStorageCompare) {\n 'use strict';\n\n return (function () {\n\n var /**\n * {Object} storages - list of storages\n */\n storages = {},\n\n /**\n * {Object} classes - list of classes\n */\n classes = {},\n\n /**\n * {Object} prototype - methods that will be added to all storage classes to prototype property.\n */\n prototype = {\n\n /**\n * Sets data to storage\n *\n * @param {*} data\n */\n set: function (data) {\
2n if (!utils.compare(data, this.data()).equal) {\n this.data(data);\n }\n },\n\n /**\n * Adds some data to current storage data\n *\n * @param {*} data\n */\n add: function (data) {\n if (!_.isEmpty(data)) {\n this.data(_.extend(utils.copy(this.data()), data));\n }\n },\n\n /**\n * Gets current storage data\n *\n * @returns {*} data\n */\n get: function () {\n return this.data();\n }\n },\n\n /**\n * Required properties to storage\n */\n storagesInterface = {\n data: 'function',\n initialize: 'function',\n namespace: 'string'\n },\n\n /**\n * Private service methods\n */\n _private = {\n\n /**\n * Overrides class method and add ability use _super to call parent method\n *\n * @param {Object} extensionMethods\n * @param {Object} originInstance\n */\n overrideClassMethods: function (extensionMethods, originInstance) {\n var methodsName = _.keys(extensionMethods),\n i = 0,\n length = methodsName.length;\n\n for (i; i < length; i++) {\n if (_.isFunction(originInstance[methodsName[i]])) {\n originInstance[methodsName[i]] = extensionMethods[methodsName[i]];\n }\n }\n\n return originInstance;\n },\n\n /**\n * Checks is storage implement interface\n *\n * @param {Object} classInstance\n *\n * @returns {Boolean}\n */\n isImplementInterface: function (classInstance) {\n _.each(storagesInterface, function (key, value) {\n if (typeof classInstance[key] !== value) {\n return false;\n }\n });\n\n return true;\n }\n },\n\n /**\n * Subscribers list\n */\n subscribers = {};\n\n (function () {\n /**\n * @param {Object} config\n * @return void\n */\n classes[IdsStorage.name] = function (config) {\n _.extend(this, IdsStorage, config);\n };\n\n /**\n * @param {Object} config\n * @return void\n */\n classes[IdsStorageCompare.name] = function (config) {\n _.extend(this, IdsStorageCompare, config);\n };\n\n /**\n * @param {Object} config\n * @return void\n */\n classes[DataStore.name] = function (config) {\n _.extend(this, DataStore, config);\n };\n\n _.each(classes, function (classItem) {\n classItem.prototype = prototype;\n });\n })();\n\n return {\n\n /**\n * Creates new storage or returns if storage with declared namespace exist\n *\n * @param {Object} config - storage config\n * @throws {Error}\n * @returns {Object} storage instance\n */\n createStorage: function (config) {\n var instance,\n initialized;\n\n if (storages[config.namespace]) {\n return storages[config.namespace];\n }\n\n instance = new classes[config.className](config);\n\n if (_private.isImplementInterface(instance)) {\n initialized = storages[config.namespace] = instance.initialize();\n this.processSubscribers(initialized, config);\n\n return initialized;\n }\n\n throw new Error('Class ' + config.className + $t('does not implement Storage Interface'));\n },\n\n /**\n * Process subscribers\n *\n * Differentiate subscribers by their namespaces: recently_viewed or recently_compared\n * and process callbacks. Callbacks can be add through onStorageInit function\n *\n * @param {Object} initialized\n * @param {Object} config\n * @return void\n */\n processSubscribers: function (initialized, config) {\n if (subscribers[config.namespace]) {\n _.each(subscribers[config.namespace], function (callback) {\n callback(initialized);\n });\n\n delete subscribers[config.namespace];\n }\n }
2,\n\n /**\n * Listens storage creating by namespace\n *\n * @param {String} namespace\n * @param {Function} callback\n * @return void\n */\n onStorageInit: function (namespace, callback) {\n if (storages[namespace]) {\n callback(storages[namespace]);\n } else {\n subscribers[namespace] ?\n subscribers[namespace].push(callback) :\n subscribers[namespace] = [callback];\n }\n },\n\n /**\n * Gets storage by namespace\n *\n * @param {String} namespace\n *\n * @returns {Object} storage insance\n */\n getStorage: function (namespace) {\n return storages[namespace];\n }\n };\n })();\n});\n\n","Magento_Catalog/js/product/storage/ids-storage.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'underscore',\n 'ko',\n 'mageUtils',\n 'jquery/jquery-storageapi'\n], function ($, _, ko, utils) {\n 'use strict';\n\n /**\n * Set data to localStorage with support check.\n *\n * @param {String} namespace\n * @param {Object} data\n */\n function setLocalStorageItem(namespace, data) {\n try {\n window.localStorage.setItem(namespace, JSON.stringify(data));\n } catch (e) {\n console.warn('localStorage is unavailable - skipping local caching of product data');\n console.error(e);\n }\n }\n\n return {\n\n /**\n * Class name\n */\n name: 'IdsStorage',\n\n /**\n * Initializes class\n *\n * @return Chainable.\n */\n initialize: function () {\n if (!this.data) {\n this.data = ko.observable({});\n }\n\n this.initCustomerDataReloadListener()\n .initLocalStorage()\n .cachesDataFromLocalStorage()\n .initDataListener();\n\n return this;\n },\n\n /**\n * Gets data from local storage by current namespace\n *\n * @return {Object}.\n */\n getDataFromLocalStorage: function () {\n return this.localStorage.get();\n },\n\n /**\n * Caches data from local storage to local scope\n *\n * @return Chainable.\n */\n cachesDataFromLocalStorage: function () {\n this.data(this.getDataFromLocalStorage());\n\n return this;\n },\n\n /**\n * Initialize localStorage\n *\n * @return Chainable.\n */\n initLocalStorage: function () {\n this.localStorage = $.initNamespaceStorage(this.namespace).localStorage;\n\n return this;\n },\n\n /**\n * Initializes listener to \"data\" property\n */\n initDataListener: function () {\n this.data.subscribe(this.internalDataHandler.bind(this));\n },\n\n /**\n * Initialize listener to customer data reload\n *\n * @return Chainable.\n */\n initCustomerDataReloadListener: function () {\n $(document).on('customer-data-reload', function (event, sections) {\n if ((_.isEmpty(sections) || _.contains(sections, this.namespace)) && ~~this.allowToSendRequest) {\n this.localStorage.removeAll();\n this.data();\n }\n }.bind(this));\n\n return this;\n },\n\n /**\n * Initializes handler to \"data\" property update\n */\n internalDataHandler: function (data) {\
2n setLocalStorageItem(this.namespace, data);\n },\n\n /**\n * Initializes handler to storage update\n */\n externalDataHandler: function (data) {\n data = data.items ? data.items : data;\n\n this.set(_.extend(utils.copy(this.data()), data));\n }\n };\n});\n\n","Magento_Catalog/js/product/storage/data-storage.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'underscore',\n 'ko',\n 'mageUtils',\n 'Magento_Catalog/js/product/query-builder',\n 'Magento_Customer/js/customer-data',\n 'jquery/jquery-storageapi'\n], function ($, _, ko, utils, queryBuilder, customerData) {\n 'use strict';\n\n /**\n * Process data from API request\n *\n * @param {Object} data\n * @returns {Object}\n */\n function getParsedDataFromServer(data) {\n var result = {};\n\n _.each(data.items, function (item) {\n if (item.id) {\n result[item.id] = item;\n }\n }\n );\n\n return {\n items: result\n };\n }\n\n /**\n * Set data to localStorage with support check.\n *\n * @param {String} namespace\n * @param {Object} data\n */\n function setLocalStorageItem(namespace, data) {\n try {\n window.localStorage.setItem(namespace, JSON.stringify(data));\n } catch (e) {\n console.warn('localStorage is unavailable - skipping local caching of product data');\n console.error(e);\n }\n }\n\n return {\n\n /**\n * Class name\n */\n name: 'DataStorage',\n request: {},\n customerDataProvider: 'product_data_storage',\n\n /**\n * Initialize class\n *\n * @return Chainable.\n */\n initialize: function () {\n if (!this.data) {\n this.data = ko.observable({});\n }\n\n this.initLocalStorage()\n .initCustomerDataReloadListener()\n .cachesDataFromLocalStorage()\n .initDataListener()\n .initProvideStorage()\n .initProviderListener();\n\n return this;\n },\n\n /**\n * Initialize listener to customer data reload\n *\n * @return Chainable.\n */\n initCustomerDataReloadListener: function () {\n $(document).on('customer-data-invalidate', this._flushProductStorage.bind(this));\n\n return this;\n },\n\n /**\n * Flush product storage\n *\n * @private\n * @return void\n */\n _flushProductStorage: function (event, sections) {\n if (_.isEmpty(sections) || _.contains(sections, 'product_data_storage')) {\n this.localStorage.removeAll();\n }\n },\n\n /**\n * Initialize listener to data property\n *\n * @return Chainable.\n */\n initDataListener: function () {\n this.data.subscribe(this.dataHandler.bind(this));\n\n return this;\n },\n\n /**\n * Initialize provider storage\n *\n * @return Chainable.\n */\n initProvideStorage: function () {\n this.providerHandler(customerData.get(this.customerDataProvider)());\n\n return this;\n },\n\n /**\n * Handler to update \"data\" property.\n * Sets data to localStorage\n *\n * @param {Object}
2 data\n */\n dataHandler: function (data) {\n if (_.isEmpty(data)) {\n this.localStorage.removeAll();\n } else {\n setLocalStorageItem(this.namespace, data);\n }\n },\n\n /**\n * Handler to update data in provider.\n *\n * @param {Object} data\n */\n providerHandler: function (data) {\n var currentData = utils.copy(this.data()),\n ids = _.keys(data.items);\n\n if (data.items && ids.length) {\n //we can extend only items\n data = data.items;\n this.data(_.extend(currentData, data));\n }\n },\n\n /**\n * Sets data ids\n *\n * @param {String} currency\n * @param {String} store\n * @param {Object} ids\n */\n setIds: function (currency, store, ids) {\n if (!this.hasInCache(currency, store, ids)) {\n this.loadDataFromServer(currency, store, ids);\n } else {\n this.data.valueHasMutated();\n }\n },\n\n /**\n * Gets data from \"data\" property by identifiers\n *\n * @param {String} currency\n * @param {String} store\n * @param {Object} productIdentifiers\n *\n * @return {Object} data.\n */\n getDataByIdentifiers: function (currency, store, productIdentifiers) {\n var data = {},\n dataCollection = this.data(),\n id;\n\n for (id in productIdentifiers) {\n if (productIdentifiers.hasOwnProperty(id)) {\n data[id] = dataCollection[id];\n }\n }\n\n return data;\n },\n\n /**\n * Checks has cached data or not\n *\n * @param {String} currency\n * @param {String} store\n * @param {Object} ids\n *\n * @return {Boolean}\n */\n hasInCache: function (currency, store, ids) {\n var data = this.data(),\n id;\n\n for (id in ids) {\n if (!data.hasOwnProperty(id) ||\n data[id]['currency_code'] !== currency ||\n ~~data[id]['store_id'] !== ~~store\n ) {\n return false;\n }\n }\n\n return true;\n },\n\n /**\n * Load data from server by ids\n *\n * @param {String} currency\n * @param {String} store\n * @param {Object} ids\n *\n * @return void\n */\n loadDataFromServer: function (currency, store, ids) {\n var idsArray = _.keys(ids),\n prepareAjaxParams = {\n 'entity_id': idsArray.join(',')\n };\n\n if (this.request.sent && this.hasIdsInSentRequest(ids)) {\n return;\n }\n\n this.request = {\n sent: true,\n data: ids\n };\n\n this.updateRequestConfig.data = queryBuilder.buildQuery(prepareAjaxParams);\n this.updateRequestConfig.data['store_id'] = store;\n this.updateRequestConfig.data['currency_code'] = currency;\n $.ajax(this.updateRequestConfig).done(function (data) {\
2n this.request = {};\n this.providerHandler(getParsedDataFromServer(data));\n }.bind(this));\n },\n\n /**\n * Each product page consist product cache data,\n * this function prepare those data to appropriate view, and save it\n *\n * @param {Object} data\n */\n addDataFromPageCache: function (data) {\n this.providerHandler(getParsedDataFromServer(data));\n },\n\n /**\n * @param {Object} ids\n * @returns {Boolean}\n */\n hasIdsInSentRequest: function (ids) {\n var sentDataIds,\n currentDataIds;\n\n if (this.request.data) {\n sentDataIds = _.keys(this.request.data);\n currentDataIds = _.keys(ids);\n\n return _.every(currentDataIds, function (id) {\n return _.lastIndexOf(sentDataIds, id) !== -1;\n });\n }\n\n return false;\n },\n\n /**\n * Initialize provider listener\n *\n * @return Chainable.\n */\n initProviderListener: function () {\n customerData.get(this.customerDataProvider).subscribe(this.providerHandler.bind(this));\n\n return this;\n },\n\n /**\n * Caches data from local storage to local scope\n *\n * @return Chainable.\n */\n cachesDataFromLocalStorage: function () {\n this.data(this.getDataFromLocalStorage());\n\n return this;\n },\n\n /**\n * Gets data from local storage by current namespace\n *\n * @return {Object}.\n */\n getDataFromLocalStorage: function () {\n return this.localStorage.get();\n },\n\n /**\n * Initialize localStorage\n *\n * @return Chainable.\n */\n initLocalStorage: function () {\n this.localStorage = $.initNamespaceStorage(this.namespace).localStorage;\n\n return this;\n }\n };\n});
2\n","Magento_Catalog/js/product/view/provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'uiElement',\n 'Magento_Catalog/js/product/storage/storage-service'\n], function (_, Element, storage) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n identifiersConfig: {\n namespace: 'recently_viewed_product'\n },\n productStorageConfig: {\n namespace: 'product_data_storage',\n updateRequestConfig: {\n method: 'GET',\n dataType: 'json'\n },\n className: 'DataStorage'\n }\n },\n\n /**\n * Initializes\n *\n * @returns {Object} Chainable.\n */\n initialize: function () {\n this._super();\n\n if (window.checkout && window.checkout.baseUrl) {\n this.initIdsStorage();\n }\n\n this.initDataStorage();\n\n return this;\n },\n\n /**\n * Init ids storage\n *\n * @returns {Object} Chainable.\n */\n initIdsStorage: function () {\n storage.onStorageInit(this.identifiersConfig.namespace, this.idsStorageHandler.bind(this));\n\n return this;\n },\n\n /**\n * Init data storage\n *\n * @returns {Object} Chainable.\n */\n initDataStorage: function () {\n storage.onStorageInit(this.productStorageConfig.namespace, this.dataStorageHandler.bind(this));\n\n return this;\n },\n\n /**\n * Init data storage handler\n *\n * @param {Object} dataStorage - storage instance\n */\n dataStorageHandler: function (dataStorage) {\n this.productStorage = dataStorage;\n this.productStorage.add(this.data.items);\n },\n\n /**\n * Init ids storage handler\n *\n * @param {Object} idsStorage - storage instance\n */\n idsStorageHandler: function (idsStorage) {\n this.idsStorage = idsStorage;\n this.idsStorage.add(this.getIdentifiers());\n },\n\n /**\n * Gets ids from items\n *\n * @returns {Object}\n */\n getIdentifiers: function () {\n var result = {},\n productCurrentScope = this.data.productCurrentScope,\n scopeId = productCurrentScope === 'store' ? window.checkout.storeId :\n productCurrentScope === 'group' ? window.checkout.storeGroupId :\n window.checkout.websiteId;\n\n _.each(this.data.items, function (item, key) {\n result[productCurrentScope + '-' + scopeId + '-' + key] = {\n 'added_at': new Date().getTime() / 1000,\n 'product_id': key,\n 'scope_id': scopeId\n };\n }, this);\n\n return result;\n }\n });\n});\n","Magento_Catalog/js/product/view/product-info.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'ko'\n], function (ko) {\n 'use strict';\n\n return ko.observableArray([]);\n});\n","Magento_Catalog/js/product/view/product-info-resolver.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'Magento_Catalog/js/product/view/product-info'\n], function (_, productInfo) {\n 'use strict';\n\n /**\n * Returns info about products in form.\n *\n * @param {jQuery} $form\n * @return {Array}\n */\n return function ($form) {\n var product = _.findWhere($form.serializeArray(), {\n name: 'product'\n });\n\n if (!_.isUndefined(product)) {\n productInfo().push(\n {\n 'id': product.value\
2n }\n );\n }\n\n return _.uniq(productInfo(), function (item) {\n return item.id;\n });\n };\n});\n\n","Magento_Catalog/js/product/view/product-ids.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'ko'\n], function (ko) {\n 'use strict';\n\n return ko.observableArray([]);\n});\n","Magento_Catalog/js/product/view/product-ids-resolver.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'Magento_Catalog/js/product/view/product-ids'\n], function (_, productIds) {\n 'use strict';\n\n /**\n * Returns id's of products in form.\n *\n * @param {jQuery} $form\n * @return {Array}\n */\n return function ($form) {\n var idSet = productIds(),\n product = _.findWhere($form.serializeArray(), {\n name: 'product'\n });\n\n if (!_.isUndefined(product)) {\n idSet.push(product.value);\n }\n\n return _.uniq(idSet);\n };\n});\n","Magento_Catalog/js/view/image.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent'\n], function (Component) {\n 'use strict';\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n this.template = window.checkout.imageTemplate || this.template;\n }\n });\n});\n","Magento_Catalog/js/view/compare-products.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'jquery',\n 'underscore',\n 'mage/mage',\n 'mage/decorate'\n], function (Component, customerData, $, _) {\n 'use strict';\n\n var sidebarInitialized = false,\n compareProductsReloaded = false;\n\n /**\n * Initialize sidebar\n */\n function initSidebar() {\n if (sidebarInitialized) {\n return;\n }\n\n sidebarInitialized = true;\n $('[data-role=compare-products-sidebar]').decorate('list', true);\n }\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.compareProducts = customerData.get('compare-products');\n if (!compareProductsReloaded\n && !_.isEmpty(this.compareProducts())\n //Expired section names are reloaded on page load\n && _.indexOf(customerData.getExpiredSectionNames(), 'compare-products') === -1\n && window.checkout\n && window.checkout.websiteId\n && window.checkout.websiteId !== this.compareProducts().websiteId\n ) {\n //set count to 0 to prevent \"compared products\" blocks and count to show with wrong count and items\n this.compareProducts().count = 0;\n customerData.reload(['compare-products'], false);\n compareProductsReloaded = true;\n }\n initSidebar();\n }\n });\n});\n","MGS_Mpanel/js/jquery.ajaxscroll.min.js":"var callback = function() {\r\n return this.list = [], this.stack = [], this.removing = !1, this.isDisabled = !1, this.fire = function(a) {\r\n var b = a[0],\r\n c = a[1],\r\n d = a[2];\r\n this.removing = !0;\r\n for (var e = 0, f = this.list.length; f > e; e++)\r\n if (!1 === this.list[e].fn.apply(b, d)) {\r\n c.reject();\r\n break\r\n }\r\n this.removing = !1, c.resolve(), this.stack.length && this.fire(this.stack.shift())\r\n }, this.inList = function(a, b) {\r\n b = b || 0;\r\n for (var c = b, d = this.list.length; d > c; c++)\r\n if (this.list[c].fn === a || a.guid && this.list[c].fn.guid && a.guid === this.list[c].fn.guid) return c;\r\n return -1\r\n }, this\r\n};\r\ncallback.prototype = {\r\n add: function(a, b) {\r\n var c = {\r\n fn: a,\r\n priority: b\r\n };\r\n b = b || 0;\r\n for (var d = 0, e = this.list.length; e > d; d++)\r\n if (b > this.list[d].priority) return this.list.splice(d, 0, c), this;\r\n return this.list.push(c), this\r\n },\r\n remove: function(a) {\r\n for (var b = 0;\r\n (b = this.inList(a, b)) > -1;) this.list.splice(b, 1);\r\n return this\r\n },\r\n has: function(a) {\r\n return this.inList(a) > -1\r\n },\r\n fireWith: function(a, b) {\r\n var c = jQuery.Deferred();\r\n return this.isDisabled ? c.reject() : (b = b || [], b = [a, c, b.slice ? b.slice() : b], this.removing ? this.stack.push(b) : this.fire(b), c)\r\n },\r\n disable: function() {\r\n this.isDisabled = !0\r\n },\r\n enable: function() {\r\n this.isDisabled = !1\r\n }\r\n },\r\n function(a) {\r\n \"use strict\";\r\n var b = -1,\r\n c = function(c, d) {\r\n return this.itemsContainerSelector = d.wrapperSelector, this.itemSelector = d.itemSelector, this.nextSelector = d.nextSelector, this.paginationSelector = d.paginationSelector, this.$scrollC
2ontainer = c, this.$itemsContainer = a(this.itemsContainerSelector), this.$container = window === c.get(0) ? a(document) : c, this.defaultDelay = d.delay, this.negativeMargin = d.negativeMargin, this.nextUrl = null, this.isBound = !1, this.listeners = {\r\n next: new callback,\r\n load: new callback,\r\n loaded: new callback,\r\n render: new callback,\r\n rendered: new callback,\r\n scroll: new callback,\r\n noneLeft: new callback,\r\n ready: new callback\r\n }, this.extensions = [], this.scrollHandler = function() {\r\n var a = this.getCurrentScrollOffset(this.$scrollContainer),\r\n c = this.getScrollThreshold();\r\n this.isBound && b != c && (this.fire(\"scroll\", [a, c]), a >= c && this.next())\r\n }, this.getLastItem = function() {\r\n return a(this.itemSelector, this.$itemsContainer.get(0)).last()\r\n }, this.getFirstItem = function() {\r\n return a(this.itemSelector, this.$itemsContainer.get(0)).first()\r\n }, this.getScrollThreshold = function(a) {\r\n var c;\r\n return a = a || this.negativeMargin, a = a >= 0 ? -1 * a : a, c = this.getLastItem(), 0 === c.size() ? b : c.offset().top + c.height() + a\r\n }, this.getCurrentScrollOffset = function(a) {\r\n var b = 0,\r\n c = a.height();\r\n return b = window === a.get(0) ? a.scrollTop() : a.offset().top, (-1 != navigator.platform.indexOf(\"iPhone\") || -1 != navigator.platform.indexOf(\"iPod\")) && (c += 80), b + c\r\n }, this.getNextUrl = function(b) {\r\n return b || (b = this.$container), a(this.nextSelector, b).last().attr(\"href\")\r\n }, this.load = function(b, c, d) {\r\n var e, f, g = this,\r\n h = [],\r\n i = +new Date;\r\n d = d || this.defaultDelay;\r\n var j = {\r\n url: b\r\n };\r\n return g.fire(\"load\", [j]), a.get(j.url, null, a.proxy(function(b) {\r\n e = a(this.itemsContainerSelector, b).eq(0), 0 === e.length && (e = a(b).filter(this.itemsContainerSelector).eq(0)), e && e.find(this.itemSelector).each(function() {\r\n h.push(this)\r\n }), g.fire(\"loaded\", [b, h]), c && (f = +new Date - i, d > f ? setTimeout(function() {\r\n c.call(g, b, h)\r\n }, d - f) : c.call(g, b, h))\r\n }, g), \"html\")\r\n }, this.render = function(b, c) {\r\n var d = this,\r\n e = this.getLastItem(),\r\n f = 0,\r\n g = this.fire(\"render\", [b]);\r\n g.done(function() {\r\n a(b).hide(), e.after(b), a(b).fadeIn(400, function() {\r\n ++f < b.length || (d.fire(\"rendered\", [b]), c && c())\r\n }), a(\".mgs-quickview\").bind(\"click\", function() {\r\n var b = a(this).attr(\"data-quickview-url\");\r\n b.length && reInitQuickview(a, b)\r\n })\r\n })\r\n }, this.hidePagination = function() {\r\n this.paginationSelector && a(this.paginationSelector, this.$container).hide(), a(\".toolbar-amount\").hide()\r\n }, this.restorePagination = function() {\r\n this.paginationSelector && a(this.paginationSelector, this.$container).show()\r\n }, this.throttle = function(b, c) {\r\n var d, e, f = 0;\r\n return d = function() {\r\n function a() {\r\n f = +new Date, b.apply(d, g)\r\n }\r\n var d = this,\r\n g = arguments,\r\n h = +new Date - f;\r\n e ? clearTimeout(e) : a(), h > c ? a() : e = setTimeout(a, c)\r\n }, a.guid && (d.guid = b.guid = b.guid || a.guid++), d\r\n }, this.fire = function(a, b) {\r\n return this.listeners[a].fireWith(this, b)\r\n }, this\r\n };\r\n c.prototype.initialize = function() {\r\n var a = this.getCurrentScrollOffset(this.$scrollC
2ontainer),\r\n b = this.getScrollThreshold();\r\n this.hidePagination(), this.bind();\r\n for (var c = 0, d = this.extensions.length; d > c; c++) this.extensions[c].bind(this);\r\n return this.fire(\"ready\"), this.nextUrl = this.getNextUrl(), a >= b && this.next(), this\r\n }, c.prototype.bind = function() {\r\n this.isBound || (this.$scrollContainer.on(\"scroll\", a.proxy(this.throttle(this.scrollHandler, 150), this)), this.isBound = !0)\r\n }, c.prototype.unbind = function() {\r\n this.isBound && (this.$scrollContainer.off(\"scroll\", this.scrollHandler), this.isBound = !1)\r\n }, c.prototype.destroy = function() {\r\n this.unbind()\r\n }, c.prototype.on = function(b, c, d) {\r\n if (\"undefined\" == typeof this.listeners[b]) throw new Error('There is no event called \"' + b + '\"');\r\n return d = d || 0, this.listeners[b].add(a.proxy(c, this), d), this\r\n }, c.prototype.one = function(a, b) {\r\n var c = this,\r\n d = function() {\r\n c.off(a, b), c.off(a, d)\r\n };\r\n return this.on(a, b), this.on(a, d), this\r\n }, c.prototype.off = function(a, b) {\r\n if (\"undefined\" == typeof this.listeners[a]) throw new Error('There is no event called \"' + a + '\"');\r\n return this.listeners[a].remove(b), this\r\n }, c.prototype.next = function() {\r\n var a = this.nextUrl,\r\n b = this;\r\n if (this.unbind(), !a) return this.fire(\"noneLeft\", [this.getLastItem()]), this.listeners.noneLeft.disable(), b.bind(), !1;\r\n var c = this.fire(\"next\", [a]);\r\n return c.done(function() {\r\n b.load(a, function(a, c) {\r\n b.render(c, function() {\r\n b.nextUrl = b.getNextUrl(a), b.bind()\r\n })\r\n })\r\n }), c.fail(function() {\r\n b.bind()\r\n }), !0\r\n }, c.prototype.extension = function(a) {\r\n if (\"undefined\" == typeof a.bind) throw new Error('Extension doesn\\'t have required method \"bind\"');\r\n return \"undefined\" != typeof a.initialize && a.initialize(this), this.extensions.push(a), this\r\n }, a.scroll = function() {\r\n var b = a(window);\r\n return b.scroll.apply(b, arguments)\r\n }, a.fn.scroll = function(b) {\r\n var d = Array.prototype.slice.call(arguments),\r\n e = this;\r\n return this.each(function() {\r\n var f = a(this),\r\n g = f.data(\"scroll\"),\r\n h = a.extend({}, a.fn.scroll.defaults, f.data(), \"object\" == typeof b && b);\r\n if (g || (f.data(\"scroll\", g = new c(f, h)), a(document).ready(a.proxy(g.initialize, g))), \"string\" == typeof b) {\r\n if (\"function\" != typeof g[b]) throw new Error('There is no method called \"' + b + '\"');\r\n d.shift(), g[b].apply(g, d), \"destroy\" === b && f.data(\"scroll\", null)\r\n }\r\n e = f.data(\"scroll\")\r\n }), e\r\n }, a.fn.scroll.defaults = {\r\n itemSelector: \".product-item\",\r\n wrapperSelector: \"#product-wrapper\",\r\n nextSelector: \".pagination .next\",\r\n paginationSelector: \".pagination .item\",\r\n delay: 500,\r\n negativeMargin: 10\r\n }\r\n }(jQuery);\r\nvar scrollLoading = function(a) {\r\n return a = jQuery.extend({}, this.defaults, a), this.scroll = null, this.uid = (new Date).getTime(), this.src = a.src, this.html = a.html.replace(\"{src}\", this.src), this.displayLoader = function() {\r\n var a = this.getLoader() || this.initLoader(),\r\n b = this.scroll.getLastItem();\r\n b.after(a), a.fadeIn()\r\n }, this.displayLoaderBefore = function() {\r\n var a = this.getLoader() || this.initLoader(),\r\n b = this.scroll.getFirstItem();\r\n b.before(a), a.fadeIn()\r\n }, this.hideLoader = function() {\r\n this.loaderExist() && this.getLoader().remove()\r\n }, this.getLoader = function() {\r\n var a = jQuery(\"#scroll_loading\" + this.uid);\r\n return a.size() > 0 && a\r\n }, this.loaderExist = function() {\r\n var a = jQuery(\"#scroll_loading\" + this.uid);\r\n return a.size() > 0\r\n }, this.initLoader = function() {\r\n var a = jQuery(this.html).attr(\"id\", \"scroll_loading\" + this.uid);\r\n return a.hide(), a\r\n }, this\r\n};\r\nscrollLoading.prototype.bind = function(a) {\r\n this.scroll = a, a.on(\"next\", jQuery.proxy(this.displayLoader, this));\r\n try {\r\n a.on(\"prev\", jQuery.proxy(this.displayLoaderBefore, this))\r\n } catch (a) {}\r\n a.on(\"render\", jQuery.proxy(this.hideLoader, this))\r\n}, scrollLoading.prototype.defaults = {\r\n src: \"\",\r\n html: \"\"\r\n};","MGS_Mpanel/js/jquery.mb.YTPlayer.src.js":"/*\n * YoutubeBackgroun
2d - A wrapper for the Youtube API - Great for fullscreen background videos or just regular videos.\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/mit-license.php\n *\n *\n * Version: 1.0.4\n *\n */\n\n// Chain of Responsibility pattern. Creates base class that can be overridden.\nif (typeof Object.create !== \"function\") {\n Object.create = function(obj) {\n function F() {}\n F.prototype = obj;\n return new F();\n };\n}\n\n(function($, window, document) {\n var\n loadAPI = function loadAPI(callback) {\n\n // Load Youtube API\n var tag = document.createElement('script'),\n head = document.getElementsByTagName('head')[0];\n \n if(window.location.origin == 'file://') {\n tag.src = 'http://www.youtube.com/iframe_api';\n } else {\n tag.src = '//www.youtube.com/iframe_api';\n }\n \n head.appendChild(tag);\n\n // Clean up Tags.\n head = null;\n tag = null;\n\n iframeIsReady(callback);\n },\n iframeIsReady = function iframeIsReady(callback) {\n // Listen for Gobal YT player callback\n if (typeof YT === 'undefined' && typeof window.loadingPlayer === 'undefined') {\n // Prevents Ready Event from being called twice\n window.loadingPlayer = true;\n\n \n // Creates deferred so, other players know when to wait.\n window.dfd = $.Deferred();\n window.onYouTubeIframeAPIReady = function() {\n window.onYouTubeIframeAPIReady = null;\n window.dfd.resolve( \"done\" );\n callback();\n };\n } else if (typeof YT === 'object') {\n callback();\n } else {\n window.dfd.done(function( name ) {\n callback();\n });\n }\n };\n\n // YTPlayer Object\n YTPlayer = {\n player: null,\n\n // Defaults\n defaults: {\n ratio: 16 / 9,\n videoId: 'LSmgKRx5pBo',\n mute: true,\n repeat: true,\n width: $(window).width(),\n playButtonClass: 'YTPlayer-play',\n pauseButtonClass: 'YTPlayer-pause',\n muteButtonClass: 'YTPlayer-mute',\n volumeUpClass: 'YTPlayer-volume-up',\n volumeDownClass: 'YTPlayer-volume-down',\n start: 0,\n pauseOnScroll: false,\n fitToBackground: true,\n playerVars: {\n iv_load_policy: 3,\n modestbranding: 1,\n autoplay: 1,\n controls: 0,\n showinfo: 0,\n wmode: 'opaque',\n branding: 0,\n autohide: 0\n },\n events: null\n },\n\n /**\n * @function init\n * Intializes YTPlayer object\n */\n init: function init(node, userOptions) {\n var self = this;\n\n self.userOptions = userOptions;\n\n self.$body = $('body'),\n self.$node = $(node),\n self.$window = $(window);\n\n // Setup event defaults with the reference to this\n self.defaults.events = {\n 'onReady': function(e) {\n self.onPlayerReady(e);\n\n // setup up pause on scroll\n if (self.options.pauseOnScroll) {\n self.pauseOnScroll();\n }\n\n // Callback for when finished\n if (typeof self.options.callback == 'function') {\n self.options.callback.call(this);\n }\n },\n 'onStateChange': function(e) {\n if (e.data === 1) {\n\n self.$node.find('img').fadeOut(400);\n self.$node.addClass('loaded');\n } else if (e.data === 0 && self.options.repeat) { // video ended and repeat option is set true\n self.player.seekTo(self.options.start);\n }\n }\n }\n\n\n self.options = $.extend(true, {}, self.defaults, self.userOptions);\n self.options.height = Math.ceil(self.options.width / self.options.ratio);\n self.ID = (new Date()).getTime();\n self.holderID = 'YTPlayer-ID-' + self.ID;\n\n if (self.options.fitToBackground) {\n self.createBackgroundVideo();\n } else {\n self.createContainerVideo();\n }\n // Listen for Resize Event\n self.$window.on('resize.YTplayer' + self.ID, function() {\
2n self.resize(self);\n });\n\n loadAPI(self.onYouTubeIframeAPIReady.bind(self));\n\n self.resize(self);\n\n return self;\n },\n\n\n /**\n * @function pauseOnScroll\n * Adds window events to pause video on scroll.\n */\n pauseOnScroll: function pauseOnScroll() {\n var self = this;\n self.$window.on('scroll.YTplayer' + self.ID, function() {\n var state = self.player.getPlayerState();\n if (state === 1) {\n self.player.pauseVideo();\n }\n });\n self.$window.scrollStopped(function(){\n var state = self.player.getPlayerState();\n if (state === 2) {\n self.player.playVideo();\n }\n });\n },\n /**\n * @function createContainerVideo\n * Adds HTML for video in a container\n */\n createContainerVideo: function createContainerVideo() {\n var self = this;\n\n /*jshint multistr: true */\n var $YTPlayerString = $('<div id=\"ytplayer-container' + self.ID + '\" >\\\n <div id=\"' + self.holderID + '\" class=\"ytplayer-player-inline\"></div> \\\n </div> \\\n <div id=\"ytplayer-shield\" class=\"ytplayer-shield\"></div>');\n\n self.$node.append($YTPlayerString);\n self.$YTPlayerString = $YTPlayerString;\n $YTPlayerString = null;\n },\n\n /**\n * @function createBackgroundVideo\n * Adds HTML for video background\n */\n createBackgroundVideo: function createBackgroundVideo() {\n /*jshint multistr: true */\n var self = this,\n $YTPlayerString = $('<div id=\"ytplayer-container' + self.ID + '\" class=\"ytplayer-container background\">\\\n <div id=\"' + self.holderID + '\" class=\"ytplayer-player\"></div>\\\n </div>\\\n <div id=\"ytplayer-shield\" class=\"ytplayer-shield\"></div>');\n\n self.$node.append($YTPlayerString);\n self.$YTPlayerString = $YTPlayerString;\n $YTPlayerString = null;\n },\n\n /**\n * @function resize\n * Resize event to change video size\n */\n resize: function resize(self) {\n //var self = this;\n var container = $(window);\n\n if (!self.options.fitToBackground) {\n container = self.$node;\n }\n\n var width = container.width(),\n pWidth, // player width, to be defined\n height = container.height(),\n pHeight, // player height, tbd\n $YTPlayerPlayer = $('#' + self.holderID);\n\n // when screen aspect ratio differs from video, video must center and underlay one dimension\n if (width / self.options.ratio < height) {\n pWidth = Math.ceil(height * self.options.ratio); // get new player width\n $YTPlayerPlayer.width(pWidth).height(height).css({\n left: (width - pWidth) / 2,\n top: 0\n }); // player width is greater, offset left; reset top\n } else { // new video width < window width (gap to right)\n pHeight = Math.ceil(width / self.options.ratio); // get new player height\n $YTPlayerPlayer.width(width).height(pHeight).css({\n left: 0,\n top: (height - pHeight) / 2\n }); // player height is greater, offset top; reset left\n }\n\n $YTPlayerPlayer = null;\n container = null;\n },\n\n /**\n * @function onYouTubeIframeAPIReady\n * @ params {object} YTPlayer object for access to options\n * Youtube API calls this function when the player is ready.\n */\n onYouTubeIframeAPIReady: function onYouTubeIframeAPIReady() {\n var self = this;\n self.player = new window.YT.Player(self.holderID, self.options); \n },\n\n /**\n * @function onPlayerReady\n * @ params {event} window event from youtube player\n */\n onPlayerReady: function onPlayerReady(e) {\n if (this.options.mute) {\n e.target.mute();\n }\n e.target.playVideo();\n },\n\n /**\n * @function getPlayer\n * returns youtube player\n */\n getPlayer: function getPlayer() {\n return this.player;\n },\n\n /**\n * @function destroy\n * destroys all!\n */\n destroy: function destroy() {\n var self = this;\n\n self.$node\n .removeData('yt-init')\n .removeData('ytPlayer')\n .removeClass('loaded');\n\n self.$YTPlayerString.remove();\n\n $(window).off('resize.YTplayer' + self.ID);\n $(window).off('scroll.YTplayer' + self.ID);\n self.$body = null;\n self.$node = null;\n self.$YTPlayerString = null;\n self.player.destroy();\n self.player = null;\n }\n };\n\n // Scroll Stopped event.\n $.fn.scrollStopped = function(callback) {\n var $this = $(this), self = this;\n $this.scroll(function(){\n if ($this.data('scrollTimeout')) {\n clearTimeout($this.data('scrollTimeout'));\n }\n $this.data('scrollTimeout', setTimeout(callback,250,self));\n });\n };\n\n // Create plugin\n $.fn.YTPlayer = function(options) {\n\n return this.each(function() {\
2n var el = this;\n\n $(el).data(\"yt-init\", true);\n var player = Object.create(YTPlayer);\n player.init(el, options);\n $.data(el, \"ytPlayer\", player);\n });\n };\n\n})(jQuery, window, document);","MGS_Mpanel/js/media-uploader.js":"/**\n *\n * Copyright \u00a9 2016 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*global byteConvert*/\ndefine([\n 'jquery',\n 'mage/template',\n 'Magento_Ui/js/modal/alert',\n 'mage/translate',\n 'jquery/file-uploader'\n], function ($, mageTemplate, alert) {\n 'use strict';\n\n $.widget('mage.mediaUploader', {\n\n /**\n *\n * @private\n */\n _create: function () {\n var\n self = this,\n progressTmpl = mageTemplate('[data-template=\"uploader\"]');\n\n this.element.find('input[type=file]').fileupload({\n dataType: 'json',\n formData: {\n 'form_key': window.FORM_KEY\n },\n dropZone: '[data-tab-panel=image-management]',\n sequentialUploads: true,\n acceptFileTypes: /(\\.|\\/)(gif|jpe?g|png)$/i,\n maxFileSize: this.options.maxFileSize,\n\n /**\n * @param {Object} e\n * @param {Object} data\n */\n add: function (e, data) {\n var\n fileSize,\n tmpl;\n\n $.each(data.files, function (index, file) {\n fileSize = typeof file.size == 'undefined' ?\n $.mage.__('We could not detect a size.') :\n byteConvert(file.size);\n\n data.fileId = Math.random().toString(33).substr(2, 18);\n\n tmpl = progressTmpl({\n data: {\n name: file.name,\n size: fileSize,\n id: data.fileId\n }\n });\n\n $(tmpl).appendTo(self.element);\n });\n\n $(this).fileupload('process', data).done(function () {\n data.submit();\n });\n },\n\n /**\n * @param {Object} e\n * @param {Object} data\n */\n done: function (e, data) {\n if (data.result && !data.result.error) {\n self.element.trigger('addItem', data.result);\n } else {\n alert({\n content: $.mage.__('We don\\'t recognize or support this file extension type.')\n });\n }\n self.element.find('#' + data.fileId).remove();\n },\n\n /**\n * @param {Object} e\n * @param {Object} data\n */\n progress: function (e, data) {\n var progress = parseInt(data.loaded / data.total * 100, 10),\n progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';\n\n self.element.find(progressSelector).css('width', progress + '%');\n },\n\n /**\n * @param {Object} e\n * @param {Object} data\n */\n fail: function (e, data) {\n var progressSelector = '#' + data.fileId;\n\n self.element.find(progressSelector).removeClass('upload-progress').addClass('upload-failure')\n .delay(2000)\n .hide('highlight')\n .remove();\n }\n });\n\n this.element.find('input[type=file]').fileupload('option', {\n process: [{\n action: 'load',\n fileTypes: /^image\\/(gif|jpeg|png)$/\n }, {\n action: 'resize',\n maxWidth: this.options.maxWidth,\n maxHeight: this.options.maxHeight\n }, {\n action: 'save'\n }]\n });\n }\n });\n\n return $.mage.mediaUploader;\n});
2\n","MGS_Mpanel/js/slick.min.js":"/*\n _ _ _ _\n ___| (_) ___| | __ (_)___\n/ __| | |/ __| |/ / | / __|\n\\__ \\ | | (__| < _ | \\__ \\\n|___/_|_|\\___|_|\\_(_)/ |___/\n |__/\n\n Version: 1.6.0\n Author: Ken Wheeler\n Website: http://kenwheeler.github.io\n Docs: http://kenwheeler.github.io/slick\n Repo: http://github.com/kenwheeler/slick\n Issues: http://github.com/kenwheeler/slick/issues\n\n */\n!function(a){\"use strict\";\"function\"==typeof define&&define.amd?define([\"jquery\"],a):\"undefined\"!=typeof exports?module.exports=a(require(\"jquery\")):a(jQuery)}(function(a){\"use strict\";var b=window.Slick||{};b=function(){function c(c,d){var f,e=this;e.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:a(c),appendDots:a(c),arrows:!0,asNavFor:null,prevArrow:'<button type=\"button\" data-role=\"none\" class=\"slick-prev\" aria-label=\"Previous\" tabindex=\"0\" role=\"button\">Previous</button>',nextArrow:'<button type=\"button\" data-role=\"none\" class=\"slick-next\" aria-label=\"Next\" tabindex=\"0\" role=\"button\">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:\"50px\",cssEase:\"ease\",customPaging:function(b,c){return a('<button type=\"button\" data-role=\"none\" role=\"button\" tabindex=\"0\" />').text(c+1)},dots:!1,dotsClass:\"slick-dots\",draggable:!0,easing:\"linear\",edgeFriction:.35,fade:!1,focusOnSelect:!1,infinite:!0,initialSlide:0,lazyLoad:\"ondemand\",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:\"window\",responsive:null,rows:1,rtl:!1,slide:\"\",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},e.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},a.extend(e,e.initials),e.activeBreakpoint=null,e.animType=null,e.animProp=null,e.breakpoints=[],e.breakpointSettings=[],e.cssTransitions=!1,e.focussed=!1,e.interrupted=!1,e.hidden=\"hidden\",e.paused=!0,e.positionProp=null,e.respondTo=null,e.rowCount=1,e.shouldClick=!0,e.$slider=a(c),e.$slidesCache=null,e.transformType=null,e.transitionType=null,e.visibilityChange=\"visibilitychange\",e.windowWidth=0,e.windowTimer=null,f=a(c).data(\"slick\")||{},e.options=a.extend({},e.defaults,d,f),e.currentSlide=e.options.initialSlide,e.originalSettings=e.options,\"undefined\"!=typeof document.mozHidden?(e.hidden=\"mozHidden\",e.visibilityChange=\"mozvisibilitychange\"):\"undefined\"!=typeof document.webkitHidden&&(e.hidden=\"webkitHidden\",e.visibilityChange=\"webkitvisibilitychange\"),e.autoPlay=a.proxy(e.autoPlay,e),e.autoPlayClear=a.proxy(e.autoPlayClear,e),e.autoPlayIterator=a.proxy(e.autoPlayIterator,e),e.changeSlide=a.proxy(e.changeSlide,e),e.clickHandler=a.proxy(e.clickHandler,e),e.selectHandler=a.proxy(e.selectHandler,e),e.setPosition=a.proxy(e.setPosition,e),e.swipeHandler=a.proxy(e.swipeHandler,e),e.dragHandler=a.proxy(e.dragHandler,e),e.keyHandler=a.proxy(e.keyHandler,e),e.instanceUid=b++,e.htmlExpr=/^(?:\\s*(<[\\w\\W]+>)[^>]*)$/,e.registerBreakpoints(),e.init(!0)}var b=0;return c}(),b.prototype.activateADA=function(){var a=this;a.$slideTrack.find(\".slick-active\").attr({\"aria-hidden\":\"false\"}).find(\"a, input, button, select\").attr({tabindex:\"0\"})},b.prototype.addSlide=b.prototype.slickAdd=function(b,c,d){var e=this;if(\"boolean\"==typeof c)d=c,c=null;else if(0>c||c>=e.slideCount)return!1;e.unload(),\"number\"==typeof c?0===c&&0===e.$slides.length?a(b).appendTo(e.$slideTrack):d?a(b).insertBefore(e.$slides.eq(c)):a(b).insertAfter(e.$slides.eq(c)):d===!0?a(b).prependTo(e.$slideTrack):a(b).appendTo(e.$slideTrack),e.$slides=e.$slideTrack.children(this.options.slide),e.$slideTrack.children(this.options.slide).detach(),e.$slideTrack.append(e.$slides),e.$slides.each(function(b,c){a(c).attr(\"data-slick-index\",b)}),e.$slidesCache=e.$slides,e.reinit()},b.prototype.animateHeight=function(){var a=this;if(1===a.options.slidesToShow&&a.options.adaptiveHeight===!0&&a.options.vertical===!1){var b=a.$slides.eq(a.currentSlide).outerHeight(!0);a.$list.animate({height:b},a.options.speed)}},b.prototype.animateSlide=function(b,c){var d={},e=this;e.animateHeight(),e.options.rtl===!0&&e.options.vertical===!1&&(b=-b),e.transformsEnabled===!1?e.options.vertical===!1?e.$slideTrack.animate({left:b},e.options.speed,e.options.easing,c):e.$slideTrack.animate({top:b},e.options.speed,e.options.easing,c):e.cssTransitions===!1?(e.options.rtl===!0&&(e.currentLeft=-e.currentLeft),a({animStart:e.currentLeft}).animate({animStart:b},{duration:e.options.speed,easing:e.options.easing,step:function(a){a=Math.ceil(a),e.options.vertical===!1?(d[e.animType]=\"translate(\"+a+\"px, 0px)\",e.$slideTrack.css(d)):(d[e.animType]=\"translate(0px,\"+a+\"px)\",e.$slideTrack.css(d))}
2,complete:function(){c&&c.call()}})):(e.applyTransition(),b=Math.ceil(b),e.options.vertical===!1?d[e.animType]=\"translate3d(\"+b+\"px, 0px, 0px)\":d[e.animType]=\"translate3d(0px,\"+b+\"px, 0px)\",e.$slideTrack.css(d),c&&setTimeout(function(){e.disableTransition(),c.call()},e.options.speed))},b.prototype.getNavTarget=function(){var b=this,c=b.options.asNavFor;return c&&null!==c&&(c=a(c).not(b.$slider)),c},b.prototype.asNavFor=function(b){var c=this,d=c.getNavTarget();null!==d&&\"object\"==typeof d&&d.each(function(){var c=a(this).slick(\"getSlick\");c.unslicked||c.slideHandler(b,!0)})},b.prototype.applyTransition=function(a){var b=this,c={};b.options.fade===!1?c[b.transitionType]=b.transformType+\" \"+b.options.speed+\"ms \"+b.options.cssEase:c[b.transitionType]=\"opacity \"+b.options.speed+\"ms \"+b.options.cssEase,b.options.fade===!1?b.$slideTrack.css(c):b.$slides.eq(a).css(c)},b.prototype.autoPlay=function(){var a=this;a.autoPlayClear(),a.slideCount>a.options.slidesToShow&&(a.autoPlayTimer=setInterval(a.autoPlayIterator,a.options.autoplaySpeed))},b.prototype.autoPlayClear=function(){var a=this;a.autoPlayTimer&&clearInterval(a.autoPlayTimer)},b.prototype.autoPlayIterator=function(){var a=this,b=a.currentSlide+a.options.slidesToScroll;a.paused||a.interrupted||a.focussed||(a.options.infinite===!1&&(1===a.direction&&a.currentSlide+1===a.slideCount-1?a.direction=0:0===a.direction&&(b=a.currentSlide-a.options.slidesToScroll,a.currentSlide-1===0&&(a.direction=1))),a.slideHandler(b))},b.prototype.buildArrows=function(){var b=this;b.options.arrows===!0&&(b.$prevArrow=a(b.options.prevArrow).addClass(\"slick-arrow\"),b.$nextArrow=a(b.options.nextArrow).addClass(\"slick-arrow\"),b.slideCount>b.options.slidesToShow?(b.$prevArrow.removeClass(\"slick-hidden\").removeAttr(\"aria-hidden tabindex\"),b.$nextArrow.removeClass(\"slick-hidden\").removeAttr(\"aria-hidden tabindex\"),b.htmlExpr.test(b.options.prevArrow)&&b.$prevArrow.prependTo(b.options.appendArrows),b.htmlExpr.test(b.options.nextArrow)&&b.$nextArrow.appendTo(b.options.appendArrows),b.options.infinite!==!0&&b.$prevArrow.addClass(\"slick-disabled\").attr(\"aria-disabled\",\"true\")):b.$prevArrow.add(b.$nextArrow).addClass(\"slick-hidden\").attr({\"aria-disabled\":\"true\",tabindex:\"-1\"}))},b.prototype.buildDots=function(){var c,d,b=this;if(b.options.dots===!0&&b.slideCount>b.options.slidesToShow){for(b.$slider.addClass(\"slick-dotted\"),d=a(\"<ul />\").addClass(b.options.dotsClass),c=0;c<=b.getDotCount();c+=1)d.append(a(\"<li />\").append(b.options.customPaging.call(this,b,c)));b.$dots=d.appendTo(b.options.appendDots),b.$dots.find(\"li\").first().addClass(\"slick-active\").attr(\"aria-hidden\",\"false\")}},b.prototype.buildOut=function(){var b=this;b.$slides=b.$slider.children(b.options.slide+\":not(.slick-cloned)\").addClass(\"slick-slide\"),b.slideCount=b.$slides.length,b.$slides.each(function(b,c){a(c).attr(\"data-slick-index\",b).data(\"originalStyling\",a(c).attr(\"style\")||\"\")}),b.$slider.addClass(\"slick-slider\"),b.$slideTrack=0===b.slideCount?a('<div class=\"slick-track\"/>').appendTo(b.$slider):b.$slides.wrapAll('<div class=\"slick-track\"/>').parent(),b.$list=b.$slideTrack.wrap('<div aria-live=\"polite\" class=\"slick-list\"/>').parent(),b.$slideTrack.css(\"opacity\",0),(b.options.centerMode===!0||b.options.swipeToSlide===!0)&&(b.options.slidesToScroll=1),a(\"img[data-lazy]\",b.$slider).not(\"[src]\").addClass(\"slick-loading\"),b.setupInfinite(),b.buildArrows(),b.buildDots(),b.updateDots(),b.setSlideClasses(\"number\"==typeof b.currentSlide?b.currentSlide:0),b.options.draggable===!0&&b.$list.addClass(\"draggable\")},b.prototype.buildRows=function(){var b,c,d,e,f,g,h,a=this;if(e=document.createDocumentFragment(),g=a.$slider.children(),a.options.rows>1){for(h=a.options.slidesPerRow*a.options.rows,f=Math.ceil(g.length/h),b=0;f>b;b++){var i=document.createElement(\"div\");for(c=0;c<a.options.rows;c++){var j=document.createElement(\"div\");for(d=0;d<a.options.slidesPerRow;d++){var k=b*h+(c*a.options.slidesPerRow+d);g.get(k)&&j.appendChild(g.get(k))}i.appendChild(j)}e.appendChild(i)}a.$slider.empty().append(e),a.$slider.children().children().children().css({width:100/a.options.slidesPerRow+\"%\",display:\"inline-block\"})}},b.prototype.checkResponsive=function(b,c){var e,f,g,d=this,h=!1,i=d.$slider.width(),j=window.innerWidth||a(window).width();if(\"window\"===d.respondTo?g=j:\"slider\"===d.respondTo?g=i:\"min\"===d.respondTo&&(g=Math.min(j,i)),d.options.responsive&&d.options.responsive.length&&null!==d.options.responsive){f=null;for(e in d.breakpoints)d.breakpoints.hasOwnProperty(e)&&(d.originalSettings.mobileFirst===!1?g<d.breakpoints[e]&&(f=d.breakpoints[e]):g>d.breakpoints[e]&&(f=d.breakpoints[e]));null!==f?null!==d.activeBreakpoint?(f!==d.activeBreakpoint||c)&&(d.activeBreakpoint=f,\"unslick\"===d.breakpointSettings[f]?d.unslick(f):(d.options=a.extend({},d.originalSettings,d.breakpointSettings[f]),b===!0&&(d.currentSlide=d.options.initialSlide),d.refresh(b)),h=f):(d.activeBreakpoint=f,\"unslick\"===d.breakpointSettings[f]?d.unslick(f):(d.options=a.extend({},d.originalSettings,d.breakpointSettings[f]),b===!0&&(d.currentSlide=d.options.initialSlide),d.refresh(b)),h=f):null!==d.activeBreakpoint&&(d.activeBreakpoint=null,d.options=d.originalSettings,b===!0&&(d.currentSlide=d.options.initialSlide),d.refresh(b),h=f),b||h===!1||d.$slider.trigger(\"breakpoint\",[d,h])}},b.prototype.changeSlide=function(b,c){var f,g,h,d=this,e=a(b.currentTarget);switch(e.is(\"a\")&&b.preventDefault(),e.is(\"li\")||(e=e.closest(\"li\")),h=d.slideCount%d.options.slidesToScroll!==0,f=h?0:(d.slideCount-d.currentSlide)%d.options.slidesToScroll,b.data.message){case\"previous\":g=0===f?d.options.slidesToScroll:d.options.slidesToShow-f,d.slideCount>d.options.slidesToShow&&d.slideHandler(d.currentSlide-g,!1,c);break;case\"next\":g=0===f?d.options.slidesToScroll:f,d.slideCount>d.options.slidesToShow&&d.slideHandler(d.currentSlide+g,!1,c);break;case\"index\":var i=0===b.data.index?0:b.data.index||e.index()*d.options.slidesToScroll;d.slideHandler(d.checkNavigable(i),!1,c),e.children().trigger(\"focus\");break;default:return}},b.prototype.checkNavigable=function(a){var c,d,b=this;if(c=b.getNavigableIndexes(),d=0,a>c[c.length-1])a=c[c.length-1];else for(var e in c){if(a<c[e]){a=d;break}d=c[e]}return a},b.prototype.cleanUpEvents=function(){var b=this;b.options.dots&&null!==b.$dots&&a(\"li\",b.$dots).off(\"click.slick\",b.changeSlide).off(\"mouseenter.slick\",a.proxy(b.interrupt,b,!0)).off(\"mouseleave.
2slick\",a.proxy(b.interrupt,b,!1)),b.$slider.off(\"focus.slick blur.slick\"),b.options.arrows===!0&&b.slideCount>b.options.slidesToShow&&(b.$prevArrow&&b.$prevArrow.off(\"click.slick\",b.changeSlide),b.$nextArrow&&b.$nextArrow.off(\"click.slick\",b.changeSlide)),b.$list.off(\"touchstart.slick mousedown.slick\",b.swipeHandler),b.$list.off(\"touchmove.slick mousemove.slick\",b.swipeHandler),b.$list.off(\"touchend.slick mouseup.slick\",b.swipeHandler),b.$list.off(\"touchcancel.slick mouseleave.slick\",b.swipeHandler),b.$list.off(\"click.slick\",b.clickHandler),a(document).off(b.visibilityChange,b.visibility),b.cleanUpSlideEvents(),b.options.accessibility===!0&&b.$list.off(\"keydown.slick\",b.keyHandler),b.options.focusOnSelect===!0&&a(b.$slideTrack).children().off(\"click.slick\",b.selectHandler),a(window).off(\"orientationchange.slick.slick-\"+b.instanceUid,b.orientationChange),a(window).off(\"resize.slick.slick-\"+b.instanceUid,b.resize),a(\"[draggable!=true]\",b.$slideTrack).off(\"dragstart\",b.preventDefault),a(window).off(\"load.slick.slick-\"+b.instanceUid,b.setPosition),a(document).off(\"ready.slick.slick-\"+b.instanceUid,b.setPosition)},b.prototype.cleanUpSlideEvents=function(){var b=this;b.$list.off(\"mouseenter.slick\",a.proxy(b.interrupt,b,!0)),b.$list.off(\"mouseleave.
2slick\",a.proxy(b.interrupt,b,!1))},b.prototype.cleanUpRows=function(){var b,a=this;a.options.rows>1&&(b=a.$slides.children().children(),b.removeAttr(\"style\"),a.$slider.empty().append(b))},b.prototype.clickHandler=function(a){var b=this;b.shouldClick===!1&&(a.stopImmediatePropagation(),a.stopPropagation(),a.preventDefault())},b.prototype.destroy=function(b){var c=this;c.autoPlayClear(),c.touchObject={},c.cleanUpEvents(),a(\".slick-cloned\",c.$slider).detach(),c.$dots&&c.$dots.remove(),c.$prevArrow&&c.$prevArrow.length&&(c.$prevArrow.removeClass(\"slick-disabled slick-arrow slick-hidden\").removeAttr(\"aria-hidden aria-disabled tabindex\").css(\"display\",\"\"),c.htmlExpr.test(c.options.prevArrow)&&c.$prevArrow.remove()),c.$nextArrow&&c.$nextArrow.length&&(c.$nextArrow.removeClass(\"slick-disabled slick-arrow slick-hidden\").removeAttr(\"aria-hidden aria-disabled tabindex\").css(\"display\",\"\"),c.htmlExpr.test(c.options.nextArrow)&&c.$nextArrow.remove()),c.$slides&&(c.$slides.removeClass(\"slick-slide slick-active slick-center slick-visible slick-current\").removeAttr(\"aria-hidden\").removeAttr(\"data-slick-index\").each(function(){a(this).attr(\"style\",a(this).data(\"originalStyling\"))}),c.$slideTrack.children(this.options.slide).detach(),c.$slideTrack.detach(),c.$list.detach(),c.$slider.append(c.$slides)),c.cleanUpRows(),c.$slider.removeClass(\"slick-slider\"),c.$slider.removeClass(\"slick-initialized\"),c.$slider.removeClass(\"slick-dotted\"),c.unslicked=!0,b||c.$slider.trigger(\"destroy\",[c])},b.prototype.disableTransition=function(a){var b=this,c={};c[b.transitionType]=\"\",b.options.fade===!1?b.$slideTrack.css(c):b.$slides.eq(a).css(c)},b.prototype.fadeSlide=function(a,b){var c=this;c.cssTransitions===!1?(c.$slides.eq(a).css({zIndex:c.options.zIndex}),c.$slides.eq(a).animate({opacity:1},c.options.speed,c.options.easing,b)):(c.applyTransition(a),c.$slides.eq(a).css({opacity:1,zIndex:c.options.zIndex}),b&&setTimeout(function(){c.disableTransition(a),b.call()},c.options.speed))},b.prototype.fadeSlideOut=function(a){var b=this;b.cssTransitions===!1?b.$slides.eq(a).animate({opacity:0,zIndex:b.options.zIndex-2},b.options.speed,b.options.easing):(b.applyTransition(a),b.$slides.eq(a).css({opacity:0,zIndex:b.options.zIndex-2}))},b.prototype.filterSlides=b.prototype.slickFilter=function(a){var b=this;null!==a&&(b.$slidesCache=b.$slides,b.unload(),b.$slideTrack.children(this.options.slide).detach(),b.$slidesCache.filter(a).appendTo(b.$slideTrack),b.reinit())},b.prototype.focusHandler=function(){var b=this;b.$slider.off(\"focus.slick blur.slick\").on(\"focus.slick blur.slick\",\"*:not(.slick-arrow)\",function(c){c.stopImmediatePropagation();var d=a(this);setTimeout(function(){b.options.pauseOnFocus&&(b.focussed=d.is(\":focus\"),b.autoPlay())},0)})},b.prototype.getCurrent=b.prototype.slickCurrentSlide=function(){var a=this;return a.currentSlide},b.prototype.getDotCount=function(){var a=this,b=0,c=0,d=0;if(a.options.infinite===!0)for(;b<a.slideCount;)++d,b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;else if(a.options.centerMode===!0)d=a.slideCount;else if(a.options.asNavFor)for(;b<a.slideCount;)++d,b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;else d=1+Math.ceil((a.slideCount-a.options.slidesToShow)/a.options.slidesToScroll);return d-1},b.prototype.getLeft=function(a){var c,d,f,b=this,e=0;return b.slideOffset=0,d=b.$slides.first().outerHeight(!0),b.options.infinite===!0?(b.slideCount>b.options.slidesToShow&&(b.slideOffset=b.slideWidth*b.options.slidesToShow*-1,e=d*b.options.slidesToShow*-1),b.slideCount%b.options.slidesToScroll!==0&&a+b.options.slidesToScroll>b.slideCount&&b.slideCount>b.options.slidesToShow&&(a>b.slideCount?(b.slideOffset=(b.options.slidesToShow-(a-b.slideCount))*b.slideWidth*-1,e=(b.options.slidesToShow-(a-b.slideCount))*d*-1):(b.slideOffset=b.slideCount%b.options.slidesToScroll*b.slideWidth*-1,e=b.slideCount%b.options.slidesToScroll*d*-1))):a+b.o
vendor: 4,011 bytes, line 2
2ptions.slidesToShow>b.slideCount&&(b.slideOffset=(a+b.options.slidesToShow-b.slideCount)*b.slideWidth,e=(a+b.options.slidesToShow-b.slideCount)*d),b.slideCount<=b.options.slidesToShow&&(b.slideOffset=0,e=0),b.options.centerMode===!0&&b.options.infinite===!0?b.slideOffset+=b.slideWidth*Math.floor(b.options.slidesToShow/2)-b.slideWidth:b.options.centerMode===!0&&(b.slideOffset=0,b.slideOffset+=b.slideWidth*Math.floor(b.options.slidesToShow/2)),c=b.options.vertical===!1?a*b.slideWidth*-1+b.slideOffset:a*d*-1+e,b.options.variableWidth===!0&&(f=b.slideCount<=b.options.slidesToShow||b.options.infinite===!1?b.$slideTrack.children(\".slick-slide\").eq(a):b.$slideTrack.children(\".slick-slide\").eq(a+b.options.slidesToShow),c=b.options.rtl===!0?f[0]?-1*(b.$slideTrack.width()-f[0].offsetLeft-f.width()):0:f[0]?-1*f[0].offsetLeft:0,b.options.centerMode===!0&&(f=b.slideCount<=b.options.slidesToShow||b.options.infinite===!1?b.$slideTrack.children(\".slick-slide\").eq(a):b.$slideTrack.children(\".slick-slide\").eq(a+b.options.slidesToShow+1),c=b.options.rtl===!0?f[0]?-1*(b.$slideTrack.width()-f[0].offsetLeft-f.width()):0:f[0]?-1*f[0].offsetLeft:0,c+=(b.$list.width()-f.outerWidth())/2)),c},b.prototype.getOption=b.prototype.slickGetOption=function(a){var b=this;return b.options[a]},b.prototype.getNavigableIndexes=function(){var e,a=this,b=0,c=0,d=[];for(a.options.infinite===!1?e=a.slideCount:(b=-1*a.options.slidesToScroll,c=-1*a.options.slidesToScroll,e=2*a.slideCount);e>b;)d.push(b),b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;return d},b.prototype.getSlick=function(){return this},b.prototype.getSlideCount=function(){var c,d,e,b=this;return e=b.options.centerMode===!0?b.slideWidth*Math.floor(b.options.slidesToShow/2):0,b.options.swipeToSlide===!0?(b.$slideTrack.find(\".slick-slide\").each(function(c,f){return f.offsetLeft-e+a(f).outerWidth()/2>-1*b.swipeLeft?(d=f,!1):void 0}),c=Math.abs(a(d).attr(\"data-slick-index\")-b.currentSlide)||1):b.options.slidesToScroll},b.prototype.goTo=b.prototype.slickGoTo=function(a,b){var c=this;c.changeSlide({data:{message:\"index\",index:parseInt(a)}},b)},b.prototype.init=function(b){var c=this;a(c.$slider).hasClass(\"slick-initialized\")||(a(c.$slider).addClass(\"slick-initialized\"),c.buildRows(),c.buildOut(),c.setProps(),c.startLoad(),c.loadSlider(),c.initializeEvents(),c.updateArrows(),c.updateDots(),c.checkResponsive(!0),c.focusHandler()),b&&c.$slider.trigger(\"init\",[c]),c.options.accessibility===!0&&c.initADA(),c.options.autoplay&&(c.paused=!1,c.autoPlay())},b.prototype.initADA=function(){var b=this;b.$slides.add(b.$slideTrack.find(\".slick-cloned\")).attr({\"aria-hidden\":\"true\",tabindex:\"-1\"}).find(\"a, input, button, select\").attr({tabindex:\"-1\"}),b.$slideTrack.attr(\"role\",\"listbox\"),b.$slides.not(b.$slideTrack.find(\".slick-cloned\")).each(function(c){a(this).attr({role:\"option\",\"aria-describedby\":\"slick-slide\"+b.instanceUid+c})}),null!==b.$dots&&b.$dots.attr(\"role\",\"tablist\").find(\"li\").each(function(c){a(this).attr({role:\"presentation\",\"aria-selected\":\"false\",\"aria-controls\":\"navigation\"+b.instanceUid+c,id:\"slick-slide\"+b.instanceUid+c})}).first().attr(\"aria-selected\",\"true\").end().find(\"button\").attr(\"role\",\"button\").end().closest(\"div\").attr(\"role\",\"toolbar\"),b.activateADA()},b.prototype.initArrowEvents=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.off(\"click.slick\").on(\"click.slick\",{message:\"previous\"},a.changeSlide),a.$nextArrow.off(\"click.slick\").on(\"click.slick\",{message:\"next\"},a.changeSlide))},b.prototype.initDotEvents=function(){var b=this;b.options.dots===!0&&b.slideCount>b.options.slidesToShow&&a(\"li\",b.$dots).on(\"click.slick\",{message:\"index\"},b.changeSlide),b.options.dots===!0&&b.options.pauseOnDotsHover===!0&&a(\"li\",b.$dots).on(\"mouseenter.slick\",a.proxy(b.interrupt,b,!0)).on(\"mouseleave.
2slick\",a.proxy(b.interrupt,b,!1))},b.prototype.initSlideEvents=function(){var b=this;b.options.pauseOnHover&&(b.$list.on(\"mouseenter.slick\",a.proxy(b.interrupt,b,!0)),b.$list.on(\"mouseleave.slick\",a.proxy(b.interrupt,b,!1)))},b.prototype.initializeEvents=function(){var b=this;b.initArrowEvents(),b.initDotEvents(),b.initSlideEvents(),b.$list.on(\"touchstart.slick mousedown.slick\",{action:\"start\"},b.swipeHandler),b.$list.on(\"touchmove.slick mousemove.slick\",{action:\"move\"},b.swipeHandler),b.$list.on(\"touchend.slick mouseup.slick\",{action:\"end\"},b.swipeHandler),b.$list.on(\"touchcancel.slick mouseleave.slick\",{action:\"end\"},b.swipeHandler),b.$list.on(\"click.slick\",b.clickHandler),a(document).on(b.visibilityChange,a.proxy(b.visibility,b)),b.options.accessibility===!0&&b.$list.on(\"keydown.slick\",b.keyHandler),b.options.focusOnSelect===!0&&a(b.$slideTrack).children().on(\"click.slick\",b.selectHandler),a(window).on(\"orientationchange.slick.slick-\"+b.instanceUid,a.proxy(b.orientationChange,b)),a(window).on(\"resize.slick.slick-\"+b.instanceUid,a.proxy(b.resize,b)),a(\"[draggable!=true]\",b.$slideTrack).on(\"dragstart\",b.preventDefault),a(window).on(\"load.slick.slick-\"+b.instanceUid,b.setPosition),a(document).on(\"ready.slick.slick-\"+b.instanceUid,b.setPosition)},b.prototype.initUI=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.show(),a.$nextArrow.show()),a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&a.$dots.show()},b.prototype.keyHandler=function(a){var b=this;a.target.tagName.match(\"TEXTAREA|INPUT|SELECT\")||(37===a.keyCode&&b.options.accessibility===!0?b.changeSlide({data:{message:b.options.rtl===!0?\"next\":\"previous\"}}):39===a.keyCode&&b.options.accessibility===!0&&b.changeSlide({data:{message:b.options.rtl===!0?\"previous\":\"next\"}}))},b.prototype.lazyLoad=function(){function g(c){a(\"img[data-lazy]\",c).each(function(){var c=a(this),d=a(this).attr(\"data-lazy\"),e=document.createElement(\"img\");e.onload=function(){c.animate({opacity:0}
2,100,function(){c.attr(\"src\",d).animate({opacity:1},200,function(){c.removeAttr(\"data-lazy\").removeClass(\"slick-loading\")}),b.$slider.trigger(\"lazyLoaded\",[b,c,d])})},e.onerror=function(){c.removeAttr(\"data-lazy\").removeClass(\"slick-loading\").addClass(\"slick-lazyload-error\"),b.$slider.trigger(\"lazyLoadError\",[b,c,d])},e.src=d})}var c,d,e,f,b=this;b.options.centerMode===!0?b.options.infinite===!0?(e=b.currentSlide+(b.options.slidesToShow/2+1),f=e+b.options.slidesToShow+2):(e=Math.max(0,b.currentSlide-(b.options.slidesToShow/2+1)),f=2+(b.options.slidesToShow/2+1)+b.currentSlide):(e=b.options.infinite?b.options.slidesToShow+b.currentSlide:b.currentSlide,f=Math.ceil(e+b.options.slidesToShow),b.options.fade===!0&&(e>0&&e--,f<=b.slideCount&&f++)),c=b.$slider.find(\".slick-slide\").slice(e,f),g(c),b.slideCount<=b.options.slidesToShow?(d=b.$slider.find(\".slick-slide\"),g(d)):b.currentSlide>=b.slideCount-b.options.slidesToShow?(d=b.$slider.find(\".slick-cloned\").slice(0,b.options.slidesToShow),g(d)):0===b.currentSlide&&(d=b.$slider.find(\".slick-cloned\").slice(-1*b.options.slidesToShow),g(d))},b.prototype.loadSlider=function(){var a=this;a.setPosition(),a.$slideTrack.css({opacity:1}),a.$slider.removeClass(\"slick-loading\"),a.initUI(),\"progressive\"===a.options.lazyLoad&&a.progressiveLazyLoad()},b.prototype.next=b.prototype.slickNext=function(){var a=this;a.changeSlide({data:{message:\"next\"}})},b.prototype.orientationChange=function(){var a=this;a.checkResponsive(),a.setPosition()},b.prototype.pause=b.prototype.slickPause=function(){var a=this;a.autoPlayClear(),a.paused=!0},b.prototype.play=b.prototype.slickPlay=function(){var a=this;a.autoPlay(),a.options.autoplay=!0,a.paused=!1,a.focussed=!1,a.interrupted=!1},b.prototype.postSlide=function(a){var b=this;b.unslicked||(b.$slider.trigger(\"afterChange\",[b,a]),b.animating=!1,b.setPosition(),b.swipeLeft=null,b.options.autoplay&&b.autoPlay(),b.options.accessibility===!0&&b.initADA())},b.prototype.prev=b.prototype.slickPrev=function(){var a=this;a.changeSlide({data:{message:\"previous\"}})},b.prototype.preventDefault=function(a){a.preventDefault()},b.prototype.progressiveLazyLoad=function(b){b=b||1;var e,f,g,c=this,d=a(\"img[data-lazy]\",c.$slider);d.length?(e=d.first(),f=e.attr(\"data-lazy\"),g=document.createElement(\"img\"),g.onload=function(){e.attr(\"src\",f).removeAttr(\"data-lazy\").removeClass(\"slick-loading\"),c.options.adaptiveHeight===!0&&c.setPosition(),c.$slider.trigger(\"lazyLoaded\",[c,e,f]),c.progressiveLazyLoad()},g.onerror=function(){3>b?setTimeout(function(){c.progressiveLazyLoad(b+1)},500):(e.removeAttr(\"data-lazy\").removeClass(\"slick-loading\").addClass(\"slick-lazyload-error\"),c.$slider.trigger(\"lazyLoadError\",[c,e,f]),c.progressiveLazyLoad())},g.src=f):c.$slider.trigger(\"allImagesLoaded\",[c])},b.prototype.refresh=function(b){var d,e,c=this;e=c.slideCount-c.options.slidesToShow,!c.options.infinite&&c.currentSlide>e&&(c.currentSlide=e),c.slideCount<=c.options.slidesToShow&&(c.currentSlide=0),d=c.currentSlide,c.destroy(!0),a.extend(c,c.initials,{currentSlide:d}),c.init(),b||c.changeSlide({data:{message:\"index\",index:d}},!1)},b.prototype.registerBreakpoints=function(){var c,d,e,b=this,f=b.options.responsive||null;if(\"array\"===a.type(f)&&f.length){b.respondTo=b.options.respondTo||\"window\";for(c in f)if(e=b.breakpoints.length-1,d=f[c].breakpoint,f.hasOwnProperty(c)){for(;e>=0;)b.breakpoints[e]&&b.breakpoints[e]===d&&b.breakpoints.splice(e,1),e--;b.breakpoints.push(d),b.breakpointSettings[d]=f[c].settings}b.breakpoints.sort(function(a,c){return b.options.mobileFirst?a-c:c-a})}},b.prototype.reinit=function(){var b=this;b.$slides=b.$slideTrack.children(b.options.slide).addClass(\"slick-slide\"),b.slideCount=b.$slides.length,b.currentSlide>=b.slideCount&&0!==b.currentSlide&&(b.currentSlide=b.currentSlide-b.options.slidesToScroll),b.slideCount<=b.options.slidesToShow&&(b.currentSlide=0),b.registerBreakpoints(),b.setProps(),b.setupInfinite(),b.buildArrows(),b.updateArrows(),b.initArrowEvents(),b.buildDots(),b.updateDots(),b.initDotEvents(),b.cleanUpSlideEvents(),b.initSlideEvents(),b.checkResponsive(!1,!0),b.options.focusOnSelect===!0&&a(b.$slideTrack).children().on(\"click.slick\",b.selectHandler),b.setSlideClasses(\"number\"==typeof b.currentSlide?b.currentSlide:0),b.setPosition(),b.focu
2sHandler(),b.paused=!b.options.autoplay,b.autoPlay(),b.$slider.trigger(\"reInit\",[b])},b.prototype.resize=function(){var b=this;a(window).width()!==b.windowWidth&&(clearTimeout(b.windowDelay),b.windowDelay=window.setTimeout(function(){b.windowWidth=a(window).width(),b.checkResponsive(),b.unslicked||b.setPosition()},50))},b.prototype.removeSlide=b.prototype.slickRemove=function(a,b,c){var d=this;return\"boolean\"==typeof a?(b=a,a=b===!0?0:d.slideCount-1):a=b===!0?--a:a,d.slideCount<1||0>a||a>d.slideCount-1?!1:(d.unload(),c===!0?d.$slideTrack.children().remove():d.$slideTrack.children(this.options.slide).eq(a).remove(),d.$slides=d.$slideTrack.children(this.options.slide),d.$slideTrack.children(this.options.slide).detach(),d.$slideTrack.append(d.$slides),d.$slidesCache=d.$slides,void d.reinit())},b.prototype.setCSS=function(a){var d,e,b=this,c={};b.options.rtl===!0&&(a=-a),d=\"left\"==b.positionProp?Math.ceil(a)+\"px\":\"0px\",e=\"top\"==b.positionProp?Math.ceil(a)+\"px\":\"0px\",c[b.positionProp]=a,b.transformsEnabled===!1?b.$slideTrack.css(c):(c={},b.cssTransitions===!1?(c[b.animType]=\"translate(\"+d+\", \"+e+\")\",b.$slideTrack.css(c)):(c[b.animType]=\"translate3d(\"+d+\", \"+e+\", 0px)\",b.$slideTrack.css(c)))},b.prototype.setDimensions=function(){var a=this;a.options.vertical===!1?a.options.centerMode===!0&&a.$list.css({padding:\"0px \"+a.options.centerPadding}):(a.$list.height(a.$slides.first().outerHeight(!0)*a.options.slidesToShow),a.options.centerMode===!0&&a.$list.css({padding:a.options.centerPadding+\" 0px\"})),a.listWidth=a.$list.width(),a.listHeight=a.$list.height(),a.options.vertical===!1&&a.options.variableWidth===!1?(a.slideWidth=Math.ceil(a.listWidth/a.options.slidesToShow),a.$slideTrack.width(Math.ceil(a.slideWidth*a.$slideTrack.children(\".slick-slide\").length))):a.options.variableWidth===!0?a.$slideTrack.width(5e3*a.slideCount):(a.slideWidth=Math.ceil(a.listWidth),a.$slideTrack.height(Math.ceil(a.$slides.first().outerHeight(!0)*a.$slideTrack.children(\".slick-slide\").length)));var b=a.$slides.first().outerWidth(!0)-a.$slides.first().width();a.options.variableWidth===!1&&a.$slideTrack.children(\".slick-slide\").width(a.slideWidth-b)},b.prototype.setFade=function(){var c,b=this;b.$slides.each(function(d,e){c=b.slideWidth*d*-1,b.options.rtl===!0?a(e).css({position:\"relative\",right:c,top:0,zIndex:b.options.zIndex-2,opacity:0}
2):a(e).css({position:\"relative\",left:c,top:0,zIndex:b.options.zIndex-2,opacity:0})}),b.$slides.eq(b.currentSlide).css({zIndex:b.options.zIndex-1,opacity:1})},b.prototype.setHeight=function(){var a=this;if(1===a.options.slidesToShow&&a.options.adaptiveHeight===!0&&a.options.vertical===!1){var b=a.$slides.eq(a.currentSlide).outerHeight(!0);a.$list.css(\"height\",b)}},b.prototype.setOption=b.prototype.slickSetOption=function(){var c,d,e,f,h,b=this,g=!1;if(\"object\"===a.type(arguments[0])?(e=arguments[0],g=arguments[1],h=\"multiple\"):\"string\"===a.type(arguments[0])&&(e=arguments[0],f=arguments[1],g=arguments[2],\"responsive\"===arguments[0]&&\"array\"===a.type(arguments[1])?h=\"responsive\":\"undefined\"!=typeof arguments[1]&&(h=\"single\")),\"single\"===h)b.options[e]=f;else if(\"multiple\"===h)a.each(e,function(a,c){b.options[a]=c});else if(\"responsive\"===h)for(d in f)if(\"array\"!==a.type(b.options.responsive))b.options.responsive=[f[d]];else{for(c=b.options.responsive.length-1;c>=0;)b.options.responsive[c].breakpoint===f[d].breakpoint&&b.options.responsive.splice(c,1),c--;b.options.responsive.push(f[d])}g&&(b.unload(),b.reinit())},b.prototype.setPosition=function(){var a=this;a.setDimensions(),a.setHeight(),a.options.fade===!1?a.setCSS(a.getLeft(a.currentSlide)):a.setFade(),a.$slider.trigger(\"setPosition\",[a])},b.prototype.setProps=function(){var a=this,b=document.body.style;a.positionProp=a.options.vertical===!0?\"top\":\"left\",\"top\"===a.positionProp?a.$slider.addClass(\"slick-vertical\"):a.$slider.removeClass(\"slick-vertical\"),(void 0!==b.WebkitTransition||void 0!==b.MozTransition||void 0!==b.msTransition)&&a.options.useCSS===!0&&(a.cssTransitions=!0),a.options.fade&&(\"number\"==typeof a.options.zIndex?a.options.zIndex<3&&(a.options.zIndex=3):a.options.zIndex=a.defaults.zIndex),void 0!==b.OTransform&&(a.animType=\"OTransform\",a.transformType=\"-o-transform\",a.transitionType=\"OTransition\",void 0===b.perspectiveProperty&&void 0===b.webkitPerspective&&(a.animType=!1)),void 0!==b.MozTransform&&(a.animType=\"MozTransform\",a.transformType=\"-moz-transform\",a.transitionType=\"MozTransition\",void 0===b.perspectiveProperty&&void 0===b.MozPerspective&&(a.animType=!1)),void 0!==b.webkitTransform&&(a.animType=\"webkitTransform\",a.transformType=\"-webkit-transform\",a.transitionType=\"webkitTransition\",void 0===b.perspectiveProperty&&void 0===b.webkitPerspective&&(a.animType=!1)),void 0!==b.msTransform&&(a.animType=\"msTransform\",a.transformType=\"-ms-transform\",a.transitionType=\"msTransition\",void 0===b.msTransform&&(a.animType=!1)),void 0!==b.transform&&a.animType!==!1&&(a.animType=\"transform\",a.transformType=\"transform\",a.transitionType=\"transition\"),a.transformsEnabled=a.options.useTransform&&null!==a.animType&&a.animType!==!1},b.prototype.setSlideClasses=function(a){var c,d,e,f,b=this;d=b.$slider.find(\".slick-slide\").removeClass(\"slick-active slick-center slick-current\").attr(\"aria-hidden\",\"true\"),b.$slides.eq(a).addClass(\"slick-current\"),b.options.centerMode===!0?(c=Math.floor(b.options.slidesToShow/2),b.options.infinite===!0&&(a>=c&&a<=b.slideCount-1-c?b.$slides.slice(a-c,a+c+1).addClass(\"slick-active\").attr(\"aria-hidden\",\"false\"):(e=b.options.slidesToShow+a,\nd.slice(e-c+1,e+c+2).addClass(\"slick-active\").attr(\"aria-hidden\",\"false\")),0===a?d.eq(d.length-1-b.o
2ptions.slidesToShow).addClass(\"slick-center\"):a===b.slideCount-1&&d.eq(b.options.slidesToShow).addClass(\"slick-center\")),b.$slides.eq(a).addClass(\"slick-center\")):a>=0&&a<=b.slideCount-b.options.slidesToShow?b.$slides.slice(a,a+b.options.slidesToShow).addClass(\"slick-active\").attr(\"aria-hidden\",\"false\"):d.length<=b.options.slidesToShow?d.addClass(\"slick-active\").attr(\"aria-hidden\",\"false\"):(f=b.slideCount%b.options.slidesToShow,e=b.options.infinite===!0?b.options.slidesToShow+a:a,b.options.slidesToShow==b.options.slidesToScroll&&b.slideCount-a<b.options.slidesToShow?d.slice(e-(b.options.slidesToShow-f),e+f).addClass(\"slick-active\").attr(\"aria-hidden\",\"false\"):d.slice(e,e+b.options.slidesToShow).addClass(\"slick-active\").attr(\"aria-hidden\",\"false\")),\"ondemand\"===b.options.lazyLoad&&b.lazyLoad()},b.prototype.setupInfinite=function(){var c,d,e,b=this;if(b.options.fade===!0&&(b.options.centerMode=!1),b.options.infinite===!0&&b.options.fade===!1&&(d=null,b.slideCount>b.options.slidesToShow)){for(e=b.options.centerMode===!0?b.options.slidesToShow+1:b.options.slidesToShow,c=b.slideCount;c>b.slideCount-e;c-=1)d=c-1,a(b.$slides[d]).clone(!0).attr(\"id\",\"\").attr(\"data-slick-index\",d-b.slideCount).prependTo(b.$slideTrack).addClass(\"slick-cloned\");for(c=0;e>c;c+=1)d=c,a(b.$slides[d]).clone(!0).attr(\"id\",\"\").attr(\"data-slick-index\",d+b.slideCount).appendTo(b.$slideTrack).addClass(\"slick-cloned\");b.$slideTrack.find(\".slick-cloned\").find(\"[id]\").each(function(){a(this).attr(\"id\",\"\")})}},b.prototype.interrupt=function(a){var b=this;a||b.autoPlay(),b.interrupted=a},b.prototype.selectHandler=function(b){var c=this,d=a(b.target).is(\".slick-slide\")?a(b.target):a(b.target).parents(\".slick-slide\"),e=parseInt(d.attr(\"data-slick-index\"));return e||(e=0),c.slideCount<=c.options.slidesToShow?(c.setSlideClasses(e),void c.asNavFor(e)):void c.slideHandler(e)},b.prototype.slideHandler=function(a,b,c){var d,e,f,g,j,h=null,i=this;return b=b||!1,i.animating===!0&&i.options.waitForAnimate===!0||i.options.fade===!0&&i.currentSlide===a||i.slideCount<=i.options.slidesToShow?void 0:(b===!1&&i.asNavFor(a),d=a,h=i.getLeft(d),g=i.getLeft(i.currentSlide),i.currentLeft=null===i.swipeLeft?g:i.swipeLeft,i.options.infinite===!1&&i.options.centerMode===!1&&(0>a||a>i.getDotCount()*i.options.slidesToScroll)?void(i.options.fade===!1&&(d=i.currentSlide,c!==!0?i.animateSlide(g,function(){i.postSlide(d)}):i.postSlide(d))):i.options.infinite===!1&&i.options.centerMode===!0&&(0>a||a>i.slideCount-i.options.slidesToScroll)?void(i.options.fade===!1&&(d=i.currentSlide,c!==!0?i.animateSlide(g,function(){i.postSlide(d)}):i.postSlide(d))):(i.options.autoplay&&clearInterval(i.autoPlayTimer),e=0>d?i.slideCount%i.options.slidesToScroll!==0?i.slideCount-i.slideCount%i.options.slidesToScroll:i.slideCount+d:d>=i.slideCount?i.slideCount%i.options.slidesToScroll!==0?0:d-i.slideCount:d,i.animating=!0,i.$slider.trigger(\"beforeChange\",[i,i.currentSlide,e]),f=i.currentSlide,i.currentSlide=e,i.setSlideClasses(i.currentSlide),i.options.asNavFor&&(j=i.getNavTarget(),j=j.slick(\"getSlick\"),j.slideCount<=j.options.slidesToShow&&j.setSlideClasses(i.currentSlide)),i.updateDots(),i.updateArrows(),i.options.fade===!0?(c!==!0?(i.fadeSlideOut(f),i.fadeSlide(e,function(){i.postSlide(e)})):i.postSlide(e),void i.animateHeight()):void(c!==!0?i.animateSlide(h,function(){i.postSlide(e)}):i.postSlide(e))))},b.prototype.startLoad=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.hide(),a.$nextArrow.hide()),a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&a.$dots.hide(),a.$slider.addClass(\"slick-loading\")},b.prototype.swipeDirection=function(){var a,b,c,d,e=this;return a=e.touchObject.startX-e.touchObject.curX,b=e.touchObject.startY-e.touchObject.curY,c=Math.atan2(b,a),d=Math.round(180*c/Math.PI),0>d&&(d=360-Math.abs(d)),45>=d&&d>=0?e.options.rtl===!1?\"left\":\"right\":360>=d&&d>=315?e.options.rtl===!1?\"left\":\"right\":d>=135&&225>=d?e.options.rtl===!1?\"right\":\"left\":e.options.verticalSwiping===!0?d>=35&&135>=d?\"down\":\"up\":\"vertical\"},b.prototype.swipeEnd=function(a){var c,d,b=this;if(b.dragging=!1,b.interrupted=!1,b.shouldClick=b.touchObject.swipeLength>10?!1:!0,void 0===b.touchObject.curX)return!1;if(b.touchObject.edgeHit===!0&&b.$slider.trigger(\"edge\",[b,b.swipeDirection()]),b.touchObject.swipeLength>=b.touchObject.minSwipe){switch(d=b.swipeDirection()){case\"left\":case\"down\":c=b.options.swipeToSlide?b.checkNavigable(b.currentSlide+b.getSlideCount()):b.currentSlide+b.getSlideCount(),b.currentDirection=0;break;case\"right\":case\"up\":c=b.options.swipeToSlide?b.checkNavigable(b.currentSlide-b.getSlideCount()):b.currentSlide-b.getSlideCount(),b.currentDirection=1}\"vertical\"!=d&&(b.slideHandler(c),b.touchObject={},b.$slider.trigger(\"swipe\",[b,d]))}else b.touchObject.startX!==b.touchObject.curX&&(b.slideHandler(b.currentSlide),b.touchObject={})},b.prototype.swipeHandler=function(a){var b=this;if(!(b.options.swipe===!1||\"ontouchend\"in document&&b.options.swipe===!1||b.options.draggable===!1&&-1!==a.type.indexOf(\"mouse\")))switch(b.touchObject.fingerCount=a.originalEvent&&void 0!==a.originalEvent.touches?a.originalEvent.touches.length:1,b.touchObject.minSwipe=b.listWidth/b.options.touchThreshold,b.options.verticalSwiping===!0&&(b.touchObject.minSwipe=b.listHeight/b.options.touchThreshold),a.data.action){case\"start\":b.swipeStart(a);break;case\"move\":b.swipeMove(a);break;case\"end\":b.swipeEnd(a)}},b.prototype.swipeMove=function(a){var d,e,f,g,h,b=this;return h=void 0!==a.originalEvent?a.originalEvent.touches:null,!b.dragging||h&&1!==h.length?!1:(d=b.getLeft(b.currentSlide),b.touchObject.curX=void 0!==h?h[0].pageX:a.clientX,b.touchObject.curY=void 0!==h?h[0].pageY:a.clientY,b.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(b.touchObject.curX-b.touchObject.startX,2))),b.options.verticalSwiping===!0&&(b.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(b.touchObject.curY-b.touchObject.startY,2)))),e=b.swipeDirection(),\"vertical\"!==e?(void 0!==a.originalEvent&&b.touchObject.swipeLength>
vendor: 4,619 bytes, line 2
24&&a.preventDefault(),g=(b.options.rtl===!1?1:-1)*(b.touchObject.curX>b.touchObject.startX?1:-1),b.options.verticalSwiping===!0&&(g=b.touchObject.curY>b.touchObject.startY?1:-1),f=b.touchObject.swipeLength,b.touchObject.edgeHit=!1,b.options.infinite===!1&&(0===b.currentSlide&&\"right\"===e||b.currentSlide>=b.getDotCount()&&\"left\"===e)&&(f=b.touchObject.swipeLength*b.options.edgeFriction,b.touchObject.edgeHit=!0),b.options.vertical===!1?b.swipeLeft=d+f*g:b.swipeLeft=d+f*(b.$list.height()/b.listWidth)*g,b.options.verticalSwiping===!0&&(b.swipeLeft=d+f*g),b.options.fade===!0||b.options.touchMove===!1?!1:b.animating===!0?(b.swipeLeft=null,!1):void b.setCSS(b.swipeLeft)):void 0)},b.prototype.swipeStart=function(a){var c,b=this;return b.interrupted=!0,1!==b.touchObject.fingerCount||b.slideCount<=b.options.slidesToShow?(b.touchObject={},!1):(void 0!==a.originalEvent&&void 0!==a.originalEvent.touches&&(c=a.originalEvent.touches[0]),b.touchObject.startX=b.touchObject.curX=void 0!==c?c.pageX:a.clientX,b.touchObject.startY=b.touchObject.curY=void 0!==c?c.pageY:a.clientY,void(b.dragging=!0))},b.prototype.unfilterSlides=b.prototype.slickUnfilter=function(){var a=this;null!==a.$slidesCache&&(a.unload(),a.$slideTrack.children(this.options.slide).detach(),a.$slidesCache.appendTo(a.$slideTrack),a.reinit())},b.prototype.unload=function(){var b=this;a(\".slick-cloned\",b.$slider).remove(),b.$dots&&b.$dots.remove(),b.$prevArrow&&b.htmlExpr.test(b.options.prevArrow)&&b.$prevArrow.remove(),b.$nextArrow&&b.htmlExpr.test(b.options.nextArrow)&&b.$nextArrow.remove(),b.$slides.removeClass(\"slick-slide slick-active slick-visible slick-current\").attr(\"aria-hidden\",\"true\").css(\"width\",\"\")},b.prototype.unslick=function(a){var b=this;b.$slider.trigger(\"unslick\",[b,a]),b.destroy()},b.prototype.updateArrows=function(){var b,a=this;b=Math.floor(a.options.slidesToShow/2),a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&!a.options.infinite&&(a.$prevArrow.removeClass(\"slick-disabled\").attr(\"aria-disabled\",\"false\"),a.$nextArrow.removeClass(\"slick-disabled\").attr(\"aria-disabled\",\"false\"),0===a.currentSlide?(a.$prevArrow.addClass(\"slick-disabled\").attr(\"aria-disabled\",\"true\"),a.$nextArrow.removeClass(\"slick-disabled\").attr(\"aria-disabled\",\"false\")):a.currentSlide>=a.slideCount-a.options.slidesToShow&&a.options.centerMode===!1?(a.$nextArrow.addClass(\"slick-disabled\").attr(\"aria-disabled\",\"true\"),a.$prevArrow.removeClass(\"slick-disabled\").attr(\"aria-disabled\",\"false\")):a.currentSlide>=a.slideCount-1&&a.options.centerMode===!0&&(a.$nextArrow.addClass(\"slick-disabled\").attr(\"aria-disabled\",\"true\"),a.$prevArrow.removeClass(\"slick-disabled\").attr(\"aria-disabled\",\"false\")))},b.prototype.updateDots=function(){var a=this;null!==a.$dots&&(a.$dots.find(\"li\").removeClass(\"slick-active\").attr(\"aria-hidden\",\"true\"),a.$dots.find(\"li\").eq(Math.floor(a.currentSlide/a.options.slidesToScroll)).addClass(\"slick-active\").attr(\"aria-hidden\",\"false\"))},b.prototype.visibility=function(){var a=this;a.options.autoplay&&(document[a.hidden]?a.interrupted=!0:a.interrupted=!1)},a.fn.slick=function(){var f,g,a=this,c=arguments[0],d=Array.prototype.slice.call(arguments,1),e=a.length;for(f=0;e>f;f++)if(\"object\"==typeof c||\"undefined\"==typeof c?a[f].slick=new b(a[f],c):g=a[f].slick[c].apply(a[f].slick,d),\"undefined\"!=typeof g)return g;return a}});","MGS_Mpanel/js/jquery.jstree.js":"/*\n * jsTree 1.0-rc3\n * http://jstree.com/\n *\n * Copyright (c) 2010 Ivan Bozhanov (vakata.com)\n *\n * Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License\n * http://www.opensource.org/licenses/mit-license.php\n * http://www.gnu.org/licenses/gpl.html\n *\n * $Date: 2011-02-09 01:17:14 +0200 (\u0441\u0440, 09 \u0444\u0435\u0432\u0440 2011) $\n * $Revision: 236 $\n */\n\n/*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */\n/*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/\n(function (factory) {\n if (typeof define === 'function' && define.amd) {\n define([\n \"jquery\",\n \"jquery/jquery.cookie\",\n \"jquery/jstree/jquery.hotkeys\"\n ], factory);\n } else {\n factory(jQuery);\n }\n}(function ($) {\n\"use strict\";\n\n// top wrapper to prevent multiple inclusion (is this OK?)\n(function () { if(jQuery && jQuery.jstree) { return; }
2\n\tvar is_ie6 = false, is_ie7 = false, is_ff2 = false;\n\n/*\n * jsTree core\n */\n(function ($) {\n\t// Common functions not related to jsTree\n\t// decided to move them to a `vakata` \"namespace\"\n\t$.vakata = {};\n\t// CSS related functions\n\t$.vakata.css = {\n\t\tget_css : function(rule_name, delete_flag, sheet) {\n\t\t\trule_name = rule_name.toLowerCase();\n\t\t\tvar css_rules = sheet.cssRules || sheet.rules,\n\t\t\t\tj = 0;\n\t\t\tdo {\n\t\t\t\tif(css_rules.length && j > css_rules.length + 5) { return false; }\n\t\t\t\tif(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {\n\t\t\t\t\tif(delete_flag === true) {\n\t\t\t\t\t\tif(sheet.removeRule) { sheet.removeRule(j); }\n\t\t\t\t\t\tif(sheet.deleteRule) { sheet.deleteRule(j); }\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\telse { return css_rules[j]; }\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (css_rules[++j]);\n\t\t\treturn false;\n\t\t},\n\t\tadd_css : function(rule_name, sheet) {\n\t\t\tif($.jstree.css.get_css(rule_name, false, sheet)) { return false; }\n\t\t\tif(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }\n\t\t\treturn $.vakata.css.get_css(rule_name);\n\t\t},\n\t\tremove_css : function(rule_name, sheet) {\n\t\t\treturn $.vakata.css.get_css(rule_name, true, sheet);\n\t\t},\n\t\tadd_sheet : function(opts) {\n\t\t\tvar tmp = false, is_new = true;\n\t\t\tif(opts.str) {\n\t\t\t\tif(opts.title) { tmp = $(\"style[id='\" + opts.title + \"-stylesheet']\")[0]; }\n\t\t\t\tif(tmp) { is_new = false; }\n\t\t\t\telse {\n\t\t\t\t\ttmp = document.createElement(\"style\");\n\t\t\t\t\ttmp.setAttribute('type',\"text/css\");\n\t\t\t\t\tif(opts.title) { tmp.setAttribute(\"id\", opts.title + \"-stylesheet\"); }\n\t\t\t\t}\n\t\t\t\tif(tmp.styleSheet) {\n\t\t\t\t\tif(is_new) {\n\t\t\t\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(tmp);\n\t\t\t\t\t\ttmp.styleSheet.cssText = opts.str;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\ttmp.styleSheet.cssText = tmp.styleSheet.cssText + \" \" + opts.str;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttmp.appendChild(document.createTextNode(opts.str));\n\t\t\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(tmp);\n\t\t\t\t}\n\t\t\t\treturn tmp.sheet || tmp.styleSheet;\n\t\t\t}\n\t\t\tif(opts.url) {\n\t\t\t\tif(document.createStyleSheet) {\n\t\t\t\t\ttry { tmp = document.createStyleSheet(opts.url); } catch (e) { }\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttmp\t\t\t= document.createElement('link');\n\t\t\t\t\ttmp.rel\t\t= 'stylesheet';\n\t\t\t\t\ttmp.type\t= 'text/css';\n\t\t\t\t\ttmp.media\t= \"all\";\n\t\t\t\t\ttmp.href\t= opts.url;\n\t\t\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(tmp);\n\t\t\t\t\treturn tmp.styleSheet;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\t// private variables\n\tvar instances = [],\t\t\t// instance array (used by $.jstree.reference/create/focused)\n\t\tfocused_instance = -1,\t// the index in the instance array of the currently focused instance\n\t\tplugins = {},\t\t\t// list of included plugins\n\t\tprepared_move = {};\t\t// for the move_node function\n\n\t// jQuery plugin wrapper (thanks to jquery UI widget function)\n\t$.fn.jstree = function (settings) {\n\t\tvar isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree(\"open_node\")\n\t\t\targs = Array.prototype.slice.call(arguments, 1),\n\t\t\treturnValue = this;\n\n\t\t// if a method call execute the method on all selected instances\n\t\tif(isMethodCall) {\n\t\t\tif(settings.substring(0, 1) == '_') { return returnValue; }\n\t\t\tthis.each(function() {\n\t\t\t\tvar instance = instances[$.data(this, \"jstree_instance_id\")],\n\t\t\t\t\tmethodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
2\n\t\t\t\t\tif(typeof methodValue !== \"undefined\" && (settings.indexOf(\"is_\") === 0 || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis.each(function() {\n\t\t\t\t// extend settings and allow for multiple hashes and $.data\n\t\t\t\tvar instance_id = $.data(this, \"jstree_instance_id\"),\n\t\t\t\t\ta = [],\n\t\t\t\t\tb = settings ? $.extend({}, true, settings) : {},\n\t\t\t\t\tc = $(this),\n\t\t\t\t\ts = false,\n\t\t\t\t\tt = [];\n\t\t\t\ta = a.concat(args);\n\t\t\t\tif(c.data(\"jstree\")) { a.push(c.data(\"jstree\")); }\n\t\t\t\tb = a.length ? $.extend.apply(null, [true, b].concat(a)) : b;\n\n\t\t\t\t// if an instance already exists, destroy it first\n\t\t\t\tif(typeof instance_id !== \"undefined\" && instances[instance_id]) { instances[instance_id].destroy(); }\n\t\t\t\t// push a new empty object to the instances array\n\t\t\t\tinstance_id = parseInt(instances.push({}),10) - 1;\n\t\t\t\t// store the jstree instance id to the container element\n\t\t\t\t$.data(this, \"jstree_instance_id\", instance_id);\n\t\t\t\t// clean up all plugins\n\t\t\t\tb.plugins = $.isArray(b.plugins) ? b.plugins : $.jstree.defaults.plugins.slice();\n\t\t\t\tb.plugins.unshift(\"core\");\n\t\t\t\t// only unique plugins\n\t\t\t\tb.plugins = b.plugins.sort().join(\",,\").replace(/(,|^)([^,]+)(,,\\2)+(,|$)/g,\"$1$2$4\").replace(/,,+/g,\",\").replace(/,$/,\"\").split(\",\");\n\n\t\t\t\t// extend defaults with passed data\n\t\t\t\ts = $.extend(true, {}, $.jstree.defaults, b);\n\t\t\t\ts.plugins = b.plugins;\n\t\t\t\t$.each(plugins, function (i, val) {\n\t\t\t\t\tif($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; }\n\t\t\t\t\telse { t.push(i); }\n\t\t\t\t});\n\t\t\t\ts.plugins = t;\n\n\t\t\t\t// push the new object to the instances array (at the same time set the default classes to the container) and init\n\t\t\t\tinstances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass(\"jstree jstree-\" + instance_id), s);\n\t\t\t\t// init all activated plugins for this instance\n\t\t\t\t$.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });\n\t\t\t\t$.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });\n\t\t\t\t// initialize the instance\n\t\t\t\tsetTimeout(function() { if(instances[instance_id]) { instances[instance_id].init(); } }, 0);\n\t\t\t});\n\t\t}\n\t\t// return the jquery selection (or if it was a method call that returned a value - the returned value)\n\t\treturn returnValue;\n\t};\n\t// object to store exposed functions and objects\n\t$.jstree = {\n\t\tdefaults : {\n\t\t\tplugins : []\n\t\t},\n\t\t_focused : function () { return instances[focused_instance] || null; },\n\t\t_reference : function (needle) {\n\t\t\t// get by instance id\n\t\t\tif(instances[needle]) { return instances[needle]; }\n\t\t\t// get by DOM (if still no luck - return null\n\t\t\tvar o = $(needle);\n\t\t\tif(!o.length && typeof needle === \"string\") { o = $(\"#\" + needle); }\n\t\t\tif(!o.length) { return null; }\n\t\t\treturn instances[o.closest(\".jstree\").data(\"jstree_instance_id\")] || null;\n\t\t},\n\t\t_instance : function (index, container, settings) {\n\t\t\t// for plugins to store data in\n\t\t\tthis.data = { core : {} };\n\t\t\tthis.get_settings\t= function () { return $.extend(true, {}, settings); };\n\t\t\tthis._get_settings\t= function () { return settings; };\n\t\t\tthis.get_index\t\t= function () { return index; };\n\t\t\tthis.get_container\t= function () { return container; };\n\t\t\tthis.get_container_ul = function () { return container.children(\"ul:eq(0)\"); };\n\t\t\tthis._set_settings\t= function (s) {\n\t\t\t\tsettings = $.extend(true, {}, settings, s);\n\t\t\t};\n\t\t},\n\t\t_fn : { },\n\t\tplugin : function (pname, pdata) {\n\t\t\tpdata = $.extend({}, {\n\t\t\t\t__init\t\t: $.noop,\n\t\t\t\t__destroy\t: $.noop,\n\t\t\t\t_fn\t\t\t: {},\n\t\t\t\tdefaults\t: false\n\t\t\t}, pdata);\n\t\t\tplugins[pname] = pdata;\n\n\t\t\t$.jstree.defaults[pname] = pdata.defaults;\n\t\t\t$.each(pdata._fn, function (i, val) {\n\t\t\t\tval.plugin\t\t= pname;
2\n\t\t\t\tval.old\t\t\t= $.jstree._fn[i];\n\t\t\t\t$.jstree._fn[i] = function () {\n\t\t\t\t\tvar rslt,\n\t\t\t\t\t\tfunc = val,\n\t\t\t\t\t\targs = Array.prototype.slice.call(arguments),\n\t\t\t\t\t\tevnt = new $.Event(\"before.jstree\"),\n\t\t\t\t\t\trlbk = false;\n\n\t\t\t\t\tif(this.data.core.locked === true && i !== \"unlock\" && i !== \"is_locked\") { return; }\n\n\t\t\t\t\t// Check if function belongs to the included plugins of this instance\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }\n\t\t\t\t\t\tfunc = func.old;\n\t\t\t\t\t} while(func);\n\t\t\t\t\tif(!func) { return; }\n\n\t\t\t\t\t// context and function to trigger events, then finally call the function\n\t\t\t\t\tif(i.indexOf(\"_\") === 0) {\n\t\t\t\t\t\trslt = func.apply(this, args);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\trslt = this.get_container().triggerHandler(evnt, { \"func\" : i, \"inst\" : this, \"args\" : args, \"plugin\" : func.plugin });\n\t\t\t\t\t\tif(rslt === false) { return; }\n\t\t\t\t\t\tif(typeof rslt !== \"undefined\") { args = rslt; }\n\n\t\t\t\t\t\trslt = func.apply(\n\t\t\t\t\t\t\t$.extend({}
2, this, {\n\t\t\t\t\t\t\t\t__callback : function (data) {\n\t\t\t\t\t\t\t\t\tthis.get_container().triggerHandler( i + '.jstree', { \"inst\" : this, \"args\" : args, \"rslt\" : data, \"rlbk\" : rlbk });\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t__rollback : function () {\n\t\t\t\t\t\t\t\t\trlbk = this.get_rollback();\n\t\t\t\t\t\t\t\t\treturn rlbk;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t__call_old : function (replace_arguments) {\n\t\t\t\t\t\t\t\t\treturn func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}), args);\n\t\t\t\t\t}\n\n\t\t\t\t\t// return the result\n\t\t\t\t\treturn rslt;\n\t\t\t\t};\n\t\t\t\t$.jstree._fn[i].old = val.old;\n\t\t\t\t$.jstree._fn[i].plugin = pname;\n\t\t\t});\n\t\t},\n\t\trollback : function (rb) {\n\t\t\tif(rb) {\n\t\t\t\tif(!$.isArray(rb)) { rb = [ rb ]; }\n\t\t\t\t$.each(rb, function (i, val) {\n\t\t\t\t\tinstances[val.i].set_rollback(val.h, val.d);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\t// set the prototype for all instances\n\t$.jstree._fn = $.jstree._instance.prototype = {};\n\n\t// load the css when DOM is ready\n\t$(function() {\n\t\t// code is copied from jQuery ($.browser is deprecated + there is a bug in IE)\n\t\tvar u = navigator.userAgent.toLowerCase(),\n\t\t\tv = (u.match( /.+?(?:rv|it|ra|ie)[\\/: ]([\\d.]+)/ ) || [0,'0'])[1],\n\t\t\tcss_string = '' +\n\t\t\t\t'.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +\n\t\t\t\t'.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' +\n\t\t\t\t'.jstree-rtl li { margin-left:0; margin-right:18px; } ' +\n\t\t\t\t'.jstree > ul > li { margin-left:0px; } ' +\n\t\t\t\t'.jstree-rtl > ul > li { margin-right:0px; } ' +\n\t\t\t\t'.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +\n\t\t\t\t'.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +\n\t\t\t\t'.jstree a:focus { outline: none; } ' +\n\t\t\t\t'.jstree a > ins { height:16px; width:16px; } ' +\n\t\t\t\t'.jstree a > .jstree-icon { margin-right:3px; } ' +\n\t\t\t\t'.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +\n\t\t\t\t'li.jstree-open > ul { display:block; } ' +\n\t\t\t\t'li.jstree-closed > ul { display:none; } ';\n\t\t// Correct IE 6 (does not support the > CSS selector)\n\t\tif(/msie/.test(u) && parseInt(v, 10) == 6) {\n\t\t\tis_ie6 = true;\n\n\t\t\t// fix image flicker and lack of caching\n\t\t\ttry {\n\t\t\t\tdocument.execCommand(\"BackgroundImageCache\", false, true);\n\t\t\t} catch (err) { }\n\n\t\t\tcss_string += '' +\n\t\t\t\t'.jstree li { height:18px; margin-left:0; margin-right:0; } ' +\n\t\t\t\t'.jstree li li { margin-left:18px; } ' +\n\t\t\t\t'.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' +\n\t\t\t\t'li.jstree-open ul { display:block; } ' +\n\t\t\t\t'li.jstree-closed ul { display:none !important; } ' +\n\t\t\t\t'.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' +\n\t\t\t\t'.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' +\n\t\t\t\t'.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';\n\t\t}\n\t\t// Correct IE 7 (shifts anchor nodes onhover)\n\t\tif(/msie/.test(u) && parseInt(v, 10) == 7) {\n\t\t\tis_ie7 = true;\n\t\t\tcss_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';\n\t\t}\n\t\t// correct ff2 lack of display:inline-block\n\t\tif(!/compatible/.test(u) && /mozilla/.test(u) && parseFloat(v, 10) < 1.9) {\n\t\t\tis_ff2 = true;\n\t\t\tcss_string += '' +\n\t\t\t\t'.jstree ins { display:-moz-inline-box; } ' +\n\t\t\t\t'.jstree li { line-height:12px; } ' + // WHY??\n\t\t\t\t'.jstree a { display:-moz-inline-box; } ' +\n\t\t\t\t'.jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ';\n\t\t\t\t/* this shouldn't be here as it is theme specific */\n\t\t}\n\t\t// the default stylesheet\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"jstree\" });\n\t});\n\n\t// core functions (open, close, create, update, delete)\n\t$.jstree.plugin(\"core\", {\n\t\t__init : function () {\n\t\t\tthis.data.core.locked = false;\n\t\t\tthis.data.core.to_open = this.get_settings().core.initially_open;\n\t\t\tthis.data.core.to_load = this.get_settings().core.initially_load;\n\t\t},\n\t\tdefaults : {\n\t\t\thtml_titles\t: false,\n\t\t\tanimation\t: 500,\n\t\t\tinitially_open : [],\n\t\t\tinitially_load : [],\n\t\t\topen_parents : true,\n\t\t\tnotify_plugins : true,\n\t\t\trtl\t\t\t: false,\n\t\t\tload_open\t: false,\n\t\t\tstrings\t\t: {\n\t\t\t\tloading\t\t: \"Loading ...\",\n\t\t\t\tnew_node\t: \"New node\",\n\t\t\t\tmultiple_selection : \"Multiple selection\"\n\t\t\t}\n\t\t},\n\t\t_fn : {\n\t\t\tinit\t: function () {\n\t\t\t\tthis.set_focus();\n\t\t\t\tif(this._get_settings().core.rtl) {\n\t\t\t\t\tthis.get_container().addClass(\"jstree-rtl\").css(\"direction\", \"rtl\");\n\t\t\t\t}\n\t\t\t\tthis.get_container().html(\"<ul><li class='jstree-last jstree-leaf'><ins> </ins><a class='jstree-loading' href='#'><ins class='jstree-icon'> </ins>\" + this._get_string(\"loading\") + \"</a></li></ul>\");\n\t\t\t\tthis.data.core.li_height = this.get_container_ul().find(\"li.jstree-closed, li.jstree-leaf\").eq(0).height() || 18;\n\n\t\t\t\tthis.get_container()\n\t\t\t\t\t.delegate(\"li > ins\", \"click.jstree\", $.proxy(function (event) {\n\t\t\t\t\t\t\tvar trgt = $(event.target);\n\t\t\t\t\t\t\t// if(trgt.is(\"ins\") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }\n\t\t\t\t\t\t\tthis.toggle_node(trgt);\n\t\t\t\t\t\t}, this))\n\t\t\t\t\t.bind(\"mousedown.jstree\", $.proxy(function () {\n\t\t\t\t\t\t\tthis.set_focus(); // This used to be setTimeout(set_focus,0) - why?\n\t\t\t\t\t\t}, this))\n\t\t\t\t\t.bind(\"dblclick.jstree\", function (event) {\n\t\t\t\t\t\tvar sel;\n\t\t\t\t\t\tif(document.selection && document.selection.empty) { document.selection.empty(); }\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif(window.getSelection) {\n\t\t\t\t\t\t\t\tsel = window.getSelection();\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tsel.removeAllRanges();\n\t\t\t\t\t\t\t\t\tsel.collapse();\n\t\t\t\t\t\t\t\t} catch (err) { }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\tif(this._get_settings().core.notify_plugins) {\n\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t.bind(\"load_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\t\t\tvar o = this._get_node(data.rslt.obj),\n\t\t\t\t\t\t\t\t\tt = this;\n\t\t\t\t\t\t\t\tif(o === -1) { o = this.get_container_ul(); }\n\t\t\t\t\t\t\t\tif(!o.length) { return; }\n\t\t\t\t\t\t\t\to.find(\"li\").each(function () {\n\t\t\t\t\t\t\t\t\tvar th = $(this);\n\t\t\t\t\t\t\t\t\tif(th.data(\"jstree\")) {\n\t\t\t\t\t\t\t\t\t\t$.each(th.data(\"jstree\"), function (plugin, values) {\n\t\t\t\t\t\t\t\t\t\t\tif(t.data[plugin] && $.isFunction(t[\"_\" + plugin + \"_notify\"])) {\n\t\t\t\t\t\t\t\t\t\t\t\tt[\"_\" + plugin + \"_notify\"].call(t, th, values);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}, this));\n\t\t\t\t}\n\t\t\t\tif(this._get_settings().core.load_open) {\n\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t.bind(\"load_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\t\t\tvar o = this._get_node(data.rslt.obj),\n\t\t\t\t\t\t\t\t\tt = this;\n\t\t\t\t\t\t\t\tif(o === -1) { o = this.get_container_ul(); }\n\t\t\t\t\t\t\t\tif(!o.length) { return; }\n\t\t\t\t\t\t\t\to.find(\"li.jstree-open:not(:has(ul))\").each(function () {\n\t\t\t\t\t\t\t\t\tt.load_node(this, $.noop, $.noop);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}, this));\n\t\t\t\t}\n\t\t\t\tthis.__callback();\n\t\t\t\tthis.load_node(-1, function () { this.loaded(); this.reload_nodes(); });\n\t\t\t},\n\t\t\tdestroy\t: function () {\n\t\t\t\tvar i,\n\t\t\t\t\tn = this.get_index(),\n\t\t\t\t\ts = this._get_settings(),\n\t\t\t\t\t_this = this;\n\n\t\t\t\t$.each(s.plugins, function (i, val) {\n\t\t\t\t\ttry { plugins[val].__destroy.apply(_this); } catch(err) { }\n\t\t\t\t});\n\t\t\t\tthis.__callback();\n\t\t\t\t// set focus to another instance if this one is focused\n\t\t\t\tif(this.is_focused()) {\n\t\t\t\t\tfor(i in instances) {\n\t\t\t\t\t\tif(instances.hasOwnProperty(i) && i != n) {\n\t\t\t\t\t\t\tinstances[i].set_focus();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// if no other instance found\n\t\t\t\tif(n === focused_instance) { focused_instance = -1; }\n\t\t\t\t// remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events\n\t\t\t\tthis.get_container()\n\t\t\t\t\t.unbind(\".jstree\")\n\t\t\t\t\t.undelegate(\".jstree\")\n\t\t\t\t\t.removeData(\"jstree_instance_id\")\n\t\t\t\t\t.find(\"[class^='jstree']\")\n\t\t\t\t\t\t.addBack()\n\t\t\t\t\t\t.attr(\"class\", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });\n\t\t\t\t$(document)\n\t\t\t\t\t.unbind(\".jstree-\" + n)\n\t\t\t\t\t.undelegate(\".jstree-\" + n);\n\t\t\t\t// remove the actual data\n\t\t\t\tinstances[n] = null;\n\t\t\t\tdelete instances[n];\n\t\t\t},\n\n\t\t\t_core_notify : function (n, data) {\n\t\t\t\tif(data.opened) {\n\t\t\t\t\tthis.open_node(n, false, true);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tlock : function () {\n\t\t\t\tthis.data.core.locked = true;\n\t\t\t\tthis.get_container().children(\"ul\").addClass(\"jstree-locked\").css(\"opacity\",\"0.7\");\n\t\t\t\tthis.__callback({});\n\t\t\t},\n\t\t\tunlock : function () {\n\t\t\t\tthis.data.core.locked = false;\n\t\t\t\tthis.get_container().children(\"ul\").removeClass(\"jstree-locked\").css(\"opacity\",\"1\");\n\t\t\t\tthis.__callback({});\n\t\t\t},\n\t\t\tis_locked : function () { return this.data.core.locked; },\n\t\t\tsave_opened : function () {\n\t\t\t\tvar _this = this;\n\t\t\t\tthis.data.core.to_open = [];\n\t\t\t\tthis.get_container_ul().find(\"li.jstree-open\").each(function () {\n\t\t\t\t\tif(this.id
2) { _this.data.core.to_open.push(\"#\" + this.id.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\")); }\n\t\t\t\t});\n\t\t\t\tthis.__callback(_this.data.core.to_open);\n\t\t\t},\n\t\t\tsave_loaded : function () { },\n\t\t\treload_nodes : function (is_callback) {\n\t\t\t\tvar _this = this,\n\t\t\t\t\tdone = true,\n\t\t\t\t\tcurrent = [],\n\t\t\t\t\tremaining = [];\n\t\t\t\tif(!is_callback) {\n\t\t\t\t\tthis.data.core.reopen = false;\n\t\t\t\t\tthis.data.core.refreshing = true;\n\t\t\t\t\tthis.data.core.to_open = $.map($.makeArray(this.data.core.to_open), function (n) { return \"#\" + n.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\"); });\n\t\t\t\t\tthis.data.core.to_load = $.map($.makeArray(this.data.core.to_load), function (n) { return \"#\" + n.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\"); });\n\t\t\t\t\tif(this.data.core.to_open.length) {\n\t\t\t\t\t\tthis.data.core.to_load = this.data.core.to_load.concat(this.data.core.to_open);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(this.data.core.to_load.length) {\n\t\t\t\t\t$.each(this.data.core.to_load, function (i, val) {\n\t\t\t\t\t\tif(val == \"#\") { return true; }\n\t\t\t\t\t\tif($(val).length) { current.push(val); }\n\t\t\t\t\t\telse { remaining.push(val); }\n\t\t\t\t\t});\n\t\t\t\t\tif(current.length) {\n\t\t\t\t\t\tthis.data.core.to_load = remaining;\n\t\t\t\t\t\t$.each(current, function (i, val) {\n\t\t\t\t\t\t\tif(!_this._is_loaded(val)) {\n\t\t\t\t\t\t\t\t_this.load_node(val, function () { _this.reload_nodes(true); }, function () { _this.reload_nodes(true); });\n\t\t\t\t\t\t\t\tdone = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(this.data.core.to_open.length) {\n\t\t\t\t\t$.each(this.data.core.to_open, function (i, val) {\n\t\t\t\t\t\t_this.open_node(val, false, true);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(done) {\n\t\t\t\t\t// TODO: find a more elegant approach to syncronizing returning requests\n\t\t\t\t\tif(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }\n\t\t\t\t\tthis.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);\n\t\t\t\t\tthis.data.core.refreshing = false;\n\t\t\t\t\tthis.reopen();\n\t\t\t\t}\n\t\t\t},\n\t\t\treopen : function () {\n\t\t\t\tvar _this = this;\n\t\t\t\tif(this.data.core.to_open.length) {\n\t\t\t\t\t$.each(this.data.core.to_open, function (i, val) {\n\t\t\t\t\t\t_this.open_node(val, false, true);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.__callback({});\n\t\t\t},\n\t\t\trefresh : function (obj) {\n\t\t\t\tvar _this = this;\n\t\t\t\tthis.save_opened();\n\t\t\t\tif(!obj) { obj = -1; }\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj) { obj = -1; }\n\t\t\t\tif(obj !== -1) { obj.children(\"UL\").remove(); }\n\t\t\t\telse { this.get_container_ul().empty(); }\n\t\t\t\tthis.load_node(obj, function () { _this.__callback({ \"obj\" : obj}); _this.reload_nodes(); });\n\t\t\t},\n\t\t\t// Dummy function to fire after the first load (so that there is a jstree.loaded event)\n\t\t\tloaded\t: function () {\n\t\t\t\tthis.__callback();\n\t\t\t},\n\t\t\t// deal with focus\n\t\t\tset_focus\t: function () {\n\t\t\t\tif(this.is_focused()) { return; }\n\t\t\t\tvar f = $.jstree._focused();\n\t\t\t\tif(f) { f.unset_focus(); }\n\n\t\t\t\tthis.get_container().addClass(\"jstree-focused\");\n\t\t\t\tfocused_instance = this.get_index();\n\t\t\t\tthis.__callback();\n\t\t\t},\n\t\t\tis_focused\t: function () {\n\t\t\t\treturn focused_instance == this.get_index();\n\t\t\t},\n\t\t\tunset_focus\t: function () {\n\t\t\t\tif(this.is_focused()) {\n\t\t\t\t\tthis.get_container().removeClass(\"jstree-focused\");\n\t\t\t\t\tfocused_instance = -1;\n\t\t\t\t}\n\t\t\t\tthis.__callback();\n\t\t\t},\n\n\t\t\t// traverse\n\t\t\t_get_node\t\t: function (obj) {\n\t\t\t\tvar $obj = $(obj, this.get_container());\n\t\t\t\tif($obj.is(\".jstree\") || obj == -1) { return -1; }\n\t\t\t\t$obj = $obj.closest(\"li\", this.get_container());\n\t\t\t\treturn $obj.length ? $obj : false;\n\t\t\t}
2,\n\t\t\t_get_next\t\t: function (obj, strict) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj === -1) { return this.get_container().find(\"> ul > li:first-child\"); }\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tif(strict) { return (obj.nextAll(\"li\").size() > 0) ? obj.nextAll(\"li:eq(0)\") : false; }\n\n\t\t\t\tif(obj.hasClass(\"jstree-open\")) { return obj.find(\"li:eq(0)\"); }\n\t\t\t\telse if(obj.nextAll(\"li\").size() > 0) { return obj.nextAll(\"li:eq(0)\"); }\n\t\t\t\telse { return obj.parentsUntil(\".jstree\",\"li\").next(\"li\").eq(0); }\n\t\t\t},\n\t\t\t_get_prev\t\t: function (obj, strict) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj === -1) { return this.get_container().find(\"> ul > li:last-child\"); }\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tif(strict) { return (obj.prevAll(\"li\").length > 0) ? obj.prevAll(\"li:eq(0)\") : false; }\n\n\t\t\t\tif(obj.prev(\"li\").length) {\n\t\t\t\t\tobj = obj.prev(\"li\").eq(0);\n\t\t\t\t\twhile(obj.hasClass(\"jstree-open\")) { obj = obj.children(\"ul:eq(0)\").children(\"li:last\"); }\n\t\t\t\t\treturn obj;\n\t\t\t\t}\n\t\t\t\telse { var o = obj.parentsUntil(\".jstree\",\"li:eq(0)\"); return o.length ? o : false; }\n\t\t\t},\n\t\t\t_get_parent\t\t: function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj == -1 || !obj.length) { return false; }\n\t\t\t\tvar o = obj.parentsUntil(\".jstree\", \"li:eq(0)\");\n\t\t\t\treturn o.length ? o : -1;\n\t\t\t},\n\t\t\t_get_children\t: function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj === -1) { return this.get_container().children(\"ul:eq(0)\").children(\"li\"); }\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\treturn obj.children(\"ul:eq(0)\").children(\"li\");\n\t\t\t},\n\t\t\tget_path\t\t: function (obj, id_mode) {\n\t\t\t\tvar p = [],\n\t\t\t\t\t_this = this;\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj === -1 || !obj || !obj.length) { return false; }\n\t\t\t\tobj.parentsUntil(\".jstree\", \"li\").each(function () {\n\t\t\t\t\tp.push( id_mode ? this.id : _this.get_text(this) );\n\t\t\t\t});\n\t\t\t\tp.reverse();\n\t\t\t\tp.push( id_mode ? obj.attr(\"id\") : this.get_text(obj) );\n\t\t\t\treturn p;\n\t\t\t},\n\n\t\t\t// string functions\n\t\t\t_get_string : function (key) {\n\t\t\t\treturn this._get_settings().core.strings[key] || key;\n\t\t\t},\n\n\t\t\tis_open\t\t: function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass(\"jstree-open\"); },\n\t\t\tis_closed\t: function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass(\"jstree-closed\"); },\n\t\t\tis_leaf\t\t: function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass(\"jstree-leaf\"); },\n\t\t\tcorrect_state\t: function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj || obj === -1) { return false; }\n\t\t\t\tobj.removeClass(\"jstree-closed jstree-open\").addClass(\"jstree-leaf\").children(\"ul\").remove();\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\t// open/close\n\t\t\topen_node\t: function (obj, callback, skip_animation) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tif(!obj.hasClass(\"jstree-closed\")) { if(callback) { callback.call(); } return false; }\n\t\t\t\tvar s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,\n\t\t\t\t\tt = this;\n\t\t\t\tif(!this._is_loaded(obj)) {\n\t\t\t\t\tobj.children(\"a\").addClass(\"jstree-loading\");\n\t\t\t\t\tthis.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(this._get_settings().core.open_parents) {\n\t\t\t\t\t\tobj.parentsUntil(\".jstree\",\".jstree-closed\").each(function () {\n\t\t\t\t\t\t\tt.open_node(this, false, true);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif(s) { obj.children(\"ul\").css(\"display\",\"none\"); }\n\t\t\t\t\tobj.removeClass(\"jstree-closed\").addClass(\"jstree-open\").children(\"a\").removeClass(\"jstree-loading\");\n\t\t\t\t\tif(s) { obj.children(\"ul\").stop(true, true).slideDown(s, function () { this.style.display = \"\"; t.after_open(obj); }); }\n\t\t\t\t\telse { t.after_open(obj); }\n\t\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t\t\tif(callback) { callback.call(); }\n\t\t\t\t}\n\t\t\t},\n\t\t\tafter_open\t: function (obj) { this.__callback({ \"obj\" : obj }); },\n\t\t\tclose_node\t: function (obj, skip_animation) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,\n\t\t\t\t\tt = this;\n\t\t\t\tif(!obj.length || !obj.hasClass(\"jstree-open\")) { return false; }\n\t\t\t\tif(s) { obj.children(\"ul\").attr(\"style\",\"display:block !important\"); }\n\t\t\t\tobj.removeClass(\"jstree-open\").addClass(\"jstree-closed\");
2\n\t\t\t\tif(s) { obj.children(\"ul\").stop(true, true).slideUp(s, function () { this.style.display = \"\"; t.after_close(obj); }); }\n\t\t\t\telse { t.after_close(obj); }\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\tafter_close\t: function (obj) { this.__callback({ \"obj\" : obj }); },\n\t\t\ttoggle_node\t: function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj.hasClass(\"jstree-closed\")) { return this.open_node(obj); }\n\t\t\t\tif(obj.hasClass(\"jstree-open\")) { return this.close_node(obj); }\n\t\t\t},\n\t\t\topen_all\t: function (obj, do_animation, original_obj) {\n\t\t\t\tobj = obj ? this._get_node(obj) : -1;\n\t\t\t\tif(!obj || obj === -1) { obj = this.get_container_ul(); }\n\t\t\t\tif(original_obj) {\n\t\t\t\t\tobj = obj.find(\"li.jstree-closed\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toriginal_obj = obj;\n\t\t\t\t\tif(obj.is(\".jstree-closed\")) { obj = obj.find(\"li.jstree-closed\").addBack(); }\n\t\t\t\t\telse { obj = obj.find(\"li.jstree-closed\"); }\n\t\t\t\t}\n\t\t\t\tvar _this = this;\n\t\t\t\tobj.each(function () {\n\t\t\t\t\tvar __this = this;\n\t\t\t\t\tif(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, do_animation, original_obj); }, !do_animation); }\n\t\t\t\t\telse { _this.open_node(this, false, !do_animation); }\n\t\t\t\t});\n\t\t\t\t// so that callback is fired AFTER all nodes are open\n\t\t\t\tif(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ \"obj\" : original_obj }); }\n\t\t\t},\n\t\t\tclose_all\t: function (obj, do_animation) {\n\t\t\t\tvar _this = this;\n\t\t\t\tobj = obj ? this._get_node(obj) : this.get_container();\n\t\t\t\tif(!obj || obj === -1) { obj = this.get_container_ul(); }\n\t\t\t\tobj.find(\"li.jstree-open\").addBack().each(function () { _this.close_node(this, !do_animation); });\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\tclean_node\t: function (obj) {\n\t\t\t\tobj = obj && obj != -1 ? $(obj) : this.get_container_ul();\n\t\t\t\tobj = obj.is(\"li\") ? obj.find(\"li\").addBack() : obj.find(\"li\");\n\t\t\t\tobj.removeClass(\"jstree-last\")\n\t\t\t\t\t.filter(\"li:last-child\").addClass(\"jstree-last\").end()\n\t\t\t\t\t.filter(\":has(li)\")\n\t\t\t\t\t\t.not(\".jstree-open\").removeClass(\"jstree-leaf\").addClass(\"jstree-closed\");\n\t\t\t\tobj.not(\".jstree-open, .jstree-closed\").addClass(\"jstree-leaf\").children(\"ul\").remove();\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\t// rollback\n\t\t\tget_rollback : function () {\n\t\t\t\tthis.__callback();\n\t\t\t\treturn { i : this.get_index(), h : this.get_container().children(\"ul\").clone(true), d : this.data };\n\t\t\t},\n\t\t\tset_rollback : function (html, data) {\n\t\t\t\tthis.get_container().empty().append(html);\n\t\t\t\tthis.data = data;\n\t\t\t\tthis.__callback();\n\t\t\t},\n\t\t\t// Dummy functions to be overwritten by any datastore plugin included\n\t\t\tload_node\t: function (obj, s_call, e_call) { this.__callback({ \"obj\" : obj }); },\n\t\t\t_is_loaded\t: function (obj) { return true; },\n\n\t\t\t// Basic operations: create\n\t\t\tcreate_node\t: function (obj, position, js, callback, is_loaded) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tposition = typeof position === \"undefined\" ? \"last\" : position;\n\t\t\t\tvar d = $(\"<li />\"),\n\t\t\t\t\ts = this._get_settings().core,\n\t\t\t\t\ttmp;\n\n\t\t\t\tif(obj !== -1 && !obj.length) { return false; }\n\t\t\t\tif(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }\n\n\t\t\t\tthis.__rollback();\n\n\t\t\t\tif(typeof js === \"string\") { js = { \"data\" : js }; }\n\t\t\t\tif(!js) { js = {}; }\n\t\t\t\tif(js.attr) { d.attr(js.attr); }\n\t\t\t\tif(js.metadata) { d.data(js.metadata); }\n\t\t\t\tif(js.state) { d.addClass(\"jstree-\" + js.state); }\n\t\t\t\tif(!js.data) { js.data = this._get_string(\"new_node\"); }\n\t\t\t\tif(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }\n\t\t\t\t$.each(js.data, function (i, m) {\n\t\t\t\t\ttmp = $(\"<a />\");\n\t\t\t\t\tif($.isFunction(m)) { m = m.call(this, js); }\n\t\t\t\t\tif(typeof m == \"string\") { tmp.attr('href','#')[ s.html_titles ? \"html\" : \"text\" ](m); }\n\t\t\t\t\telse {\n\t\t\t\t\t\tif(!m.attr) { m.attr = {}; }\n\t\t\t\t\t\tif(!m.attr.href) { m.attr.href = '#'; }\n\t\t\t\t\t\ttmp.attr(m.attr)[ s.html_titles ? \"html\" : \"text\" ](m.title);\n\t\t\t\t\t\tif(m.language) { tmp.addClass(m.language); }\n\t\t\t\t\t}\n\t\t\t\t\ttmp.prepend(\"<ins class='jstree-icon'> </ins>\");\n\t\t\t\t\tif(!m.icon && js.icon) { m.icon = js.icon; }\n\t\t\t\t\tif(m.icon) {\n\t\t\t\t\t\tif(m.icon.indexOf(\"/\") === -1) { tmp.children(\"ins\").addClass(m.icon); }
2\n\t\t\t\t\t\telse { tmp.children(\"ins\").css(\"background\",\"url('\" + m.icon + \"') center center no-repeat\"); }\n\t\t\t\t\t}\n\t\t\t\t\td.append(tmp);\n\t\t\t\t});\n\t\t\t\td.prepend(\"<ins class='jstree-icon'> </ins>\");\n\t\t\t\tif(obj === -1) {\n\t\t\t\t\tobj = this.get_container();\n\t\t\t\t\tif(position === \"before\") { position = \"first\"; }\n\t\t\t\t\tif(position === \"after\") { position = \"last\"; }\n\t\t\t\t}\n\t\t\t\tswitch(position) {\n\t\t\t\t\tcase \"before\": obj.before(d); tmp = this._get_parent(obj); break;\n\t\t\t\t\tcase \"after\" : obj.after(d); tmp = this._get_parent(obj); break;\n\t\t\t\t\tcase \"inside\":\n\t\t\t\t\tcase \"first\" :\n\t\t\t\t\t\tif(!obj.children(\"ul\").length) { obj.append(\"<ul />\"); }\n\t\t\t\t\t\tobj.children(\"ul\").prepend(d);\n\t\t\t\t\t\ttmp = obj;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"last\":\n\t\t\t\t\t\tif(!obj.children(\"ul\").length) { obj.append(\"<ul />\"); }\n\t\t\t\t\t\tobj.children(\"ul\").append(d);\n\t\t\t\t\t\ttmp = obj;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif(!obj.children(\"ul\").length) { obj.append(\"<ul />\"); }\n\t\t\t\t\t\tif(!position) { position = 0; }\n\t\t\t\t\t\ttmp = obj.children(\"ul\").children(\"li\").eq(position);\n\t\t\t\t\t\tif(tmp.length) { tmp.before(d); }\n\t\t\t\t\t\telse { obj.children(\"ul\").append(d); }\n\t\t\t\t\t\ttmp = obj;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }\n\t\t\t\tthis.clean_node(tmp);\n\t\t\t\tthis.__callback({ \"obj\" : d, \"parent\" : tmp });\n\t\t\t\tif(callback) { callback.call(this, d); }\n\t\t\t\treturn d;\n\t\t\t},\n\t\t\t// Basic operations: rename (deal with text)\n\t\t\tget_text\t: function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tvar s = this._get_settings().core.html_titles;\n\t\t\t\tobj = obj.children(\"a:eq(0)\");\n\t\t\t\tif(s) {\n\t\t\t\t\tobj = obj.clone();\n\t\t\t\t\tobj.children(\"INS\").remove();\n\t\t\t\t\treturn obj.html();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tobj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\n\t\t\t\t\treturn obj.nodeValue;\n\t\t\t\t}\n\t\t\t},\n\t\t\tset_text\t: function (obj, val) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tobj = obj.children(\"a:eq(0)\");\n\t\t\t\tif(this._get_settings().core.html_titles) {\n\t\t\t\t\tvar tmp = obj.children(\"INS\").clone();\n\t\t\t\t\tobj.html(val).prepend(tmp);\n\t\t\t\t\tthis.__callback({ \"obj\" : obj, \"name\" : val });\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tobj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\n\t\t\t\t\tthis.__callback({ \"obj\" : obj, \"name\" : val });\n\t\t\t\t\treturn (obj.nodeValue = val);\n\t\t\t\t}\n\t\t\t},\n\t\t\trename_node : function (obj, val) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tthis.__rollback();\n\t\t\t\tif(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ \"obj\" : obj, \"name\" : val }); }\n\t\t\t},\n\t\t\t// Basic operations: deleting nodes\n\t\t\tdelete_node : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tthis.__rollback();\n\t\t\t\tvar p = this._get_parent(obj), prev = $([]), t = this;\n\t\t\t\tobj.each(function () {\n\t\t\t\t\tprev = prev.add(t._get_prev(this));\n\t\t\t\t});\n\t\t\t\tobj = obj.detach();\n\t\t\t\tif(p !== -1 && p.find(\"> ul > li\").length === 0) {\n\t\t\t\t\tp.removeClass(\"jstree-open jstree-closed\").addClass(\"jstree-leaf\");\n\t\t\t\t}\n\t\t\t\tthis.clean_node(p);\n\t\t\t\tthis.__callback({ \"obj\" : obj, \"prev\" : prev, \"parent\" : p });\n\t\t\t\treturn obj;\n\t\t\t},\n\t\t\tprepare_move : function (o, r, pos, cb, is_cb) {\n\t\t\t\tvar p = {};\n\n\t\t\t\tp.ot = $.jstree._reference(o) || this;\n\t\t\t\tp.o = p.ot._get_node(o);\n\t\t\t\tp.r = r === - 1 ? -1 : this._get_node(r);\n\t\t\t\tp.p = (typeof pos === \"undefined\" || pos === false) ? \"last\" : pos; // TODO: move to a setting\n\t\t\t\tif(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {\n\t\t\t\t\tthis.__callback(prepared_move);\n\t\t\t\t\tif(cb) { cb.call(this, prepared_move); }\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tp.ot = $.jstree._reference(p.o) || this;\n\t\t\t\tp.rt = $.jstree._reference(p.r) || this; // r === -1 ? p.ot : $.jstree._reference(p.r) || this\n\t\t\t\tif(p.r === -1 || !p.r) {\n\t\t\t\t\tp.cr = -1;\n\t\t\t\t\tswitch(p.p) {\n\t\t\t\t\t\tcase \"first\":\n\t\t\t\t\t\tcase \"before\":\n\t\t\t\t\t\tcase \"inside\":\n\t\t\t\t\t\t\tp.cp = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"after\":\n\t\t\t\t\t\tcase \"last\":\n\t\t\t\t\t\t\tp.cp = p.rt.get_container().find(\" > ul > li\").length;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tp.cp = p.p;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {\n\t\t\t\t\t\treturn this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });\n\t\t\t\t\t}\n\t\t\t\t\tswitch(p.p) {\n\t\t\t\t\t\tcase \"before\":\n\t\t\t\t\t\t\tp.cp = p.r.index();\n\t\t\t\t\t\t\tp.cr = p.rt._get_parent(p.r);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"after\":\n\t\t\t\t\t\t\tp.cp = p.r.index() + 1;\n\t\t\t\t\t\t\tp.cr = p.rt._get_parent(p.r);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"inside\":\n\t\t\t\t\t\tcase \"first\":\n\t\t\t\t\t\t\tp.cp = 0;\n\t\t\t\t\t\t\tp.cr = p.r;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"last\":\n\t\t\t\t\t\t\tp.cp = p.r.find(\" > ul > li\").length;\n\t\t\t\t\t\t\tp.cr = p.r;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tp.cp = p.p;\n\t\t\t\t\t\t\tp.cr = p.r;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp.np = p.cr == -1 ? p.rt.get_container() : p.cr;\n\t\t\t\tp.op = p.ot._get_parent(p.o);\n\t\t\t\tp.cop = p.o.index();\n\t\t\t\tif(p.op === -1) { p.op = p.ot ? p.ot.get_container() : this.get_container(); }\n\t\t\t\tif(!/^(before|after)$/.test(p.p) && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp++; }\n\t\t\t\t//if(p.p === \"before\" && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp--; }\n\t\t\t\tp.or = p.np.find(\" > ul > li:nth-child(\" + (p.cp + 1) + \")\");\n\t\t\t\tprepared_move = p;\n\t\t\t\tthis.__callback(prepared_move);\n\t\t\t\tif(cb) { cb.call(this, prepared_move); }\n\t\t\t},\n\t\t\tcheck_move : function () {\n\t\t\t\tvar obj = prepared_move, ret = true, r = obj.r === -1 ? this.get_container() : obj.r;\n\t\t\t\tif(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }\n\t\t\t\tif(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }\n\t\t\t\tobj.o.each(function () {\n\t\t\t\t\tif(r.parentsUntil(\".jstree\", \"li\").addBack().index(this) !== -1) { ret = false; return false; }\n\t\t\t\t});\n\t\t\t\treturn ret;\n\t\t\t},\n\t\t\tmove_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {\n\t\t\t\tif(!is_prepared) {\n\t\t\t\t\treturn this.prepare_move(obj, ref, position, function (p) {\n\t\t\t\t\t\tthis.move_node(p, false, false, is_copy, true, skip_check);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(is_copy) {\n\t\t\t\t\tprepared_move.cy = true;\n\t\t\t\t}\n\t\t\t\tif(!skip_check && !this.check_move()) { return false; }\n\n\t\t\t\tthis.__rollback();\n\t\t\t\tvar o = false;\n\t\t\t\tif(is_copy) {\n\t\t\t\t\to = obj.o.clone(true);\n\t\t\t\t\to.find(\"*[id]\").addBack().each(function () {\n\t\t\t\t\t\tif(this.id
2) { this.id = \"copy_\" + this.id; }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse { o = obj.o; }\n\n\t\t\t\tif(obj.or.length) { obj.or.before(o); }\n\t\t\t\telse {\n\t\t\t\t\tif(!obj.np.children(\"ul\").length) { $(\"<ul />\").appendTo(obj.np); }\n\t\t\t\t\tobj.np.children(\"ul:eq(0)\").append(o);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tobj.ot.clean_node(obj.op);\n\t\t\t\t\tobj.rt.clean_node(obj.np);\n\t\t\t\t\tif(!obj.op.find(\"> ul > li\").length) {\n\t\t\t\t\t\tobj.op.removeClass(\"jstree-open jstree-closed\").addClass(\"jstree-leaf\").children(\"ul\").remove();\n\t\t\t\t\t}\n\t\t\t\t} catch (e) { }\n\n\t\t\t\tif(is_copy) {\n\t\t\t\t\tprepared_move.cy = true;\n\t\t\t\t\tprepared_move.oc = o;\n\t\t\t\t}\n\t\t\t\tthis.__callback(prepared_move);\n\t\t\t\treturn prepared_move;\n\t\t\t},\n\t\t\t_get_move : function () { return prepared_move; }\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree ui plugin\n * This plugins handles selecting/deselecting/hovering/dehovering nodes\n */\n(function ($) {\n\tvar scrollbar_width, e1, e2;\n\t$(function() {\n\t\tif (/msie/.test(navigator.userAgent.toLowerCase())) {\n\t\t\te1 = $('<textarea cols=\"10\" rows=\"2\"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');\n\t\t\te2 = $('<textarea cols=\"10\" rows=\"2\" style=\"overflow: hidden;\"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');\n\t\t\tscrollbar_width = e1.width() - e2.width();\n\t\t\te1.add(e2).remove();\n\t\t}\n\t\telse {\n\t\t\te1 = $('<div />').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: 0 })\n\t\t\t\t\t.prependTo('body').append('<div />').find('div').css({ width: '100%', height: 200 });\n\t\t\tscrollbar_width = 100 - e1.width();\n\t\t\te1.parent().remove();\n\t\t}\n\t});\n\t$.jstree.plugin(\"ui\", {\n\t\t__init : function () {\n\t\t\tthis.data.ui.selected = $();\n\t\t\tthis.data.ui.last_selected = false;\n\t\t\tthis.data.ui.hovered = null;\n\t\t\tthis.data.ui.to_select = this.get_settings().ui.initially_select;\n\n\t\t\tthis.get_container()\n\t\t\t\t.delegate(\"a\", \"click.jstree\", $.proxy(function (event) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.currentTarget.blur();\n\t\t\t\t\t\tif(!$(event.currentTarget).hasClass(\"jstree-loading\")) {\n\t\t\t\t\t\t\tthis.select_node(event.currentTarget, true, event);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mouseenter.jstree\", $.proxy(function (event) {\n\t\t\t\t\t\tif(!$(event.currentTarget).hasClass(\"jstree-loading\")) {\n\t\t\t\t\t\t\tthis.hover_node(event.target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mouseleave.jstree\", $.proxy(function (event) {\n\t\t\t\t\t\tif(!$(event.currentTarget).hasClass(\"jstree-loading\")) {\n\t\t\t\t\t\t\tthis.dehover_node(event.target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"reopen.jstree\", $.proxy(function () {\n\t\t\t\t\t\tthis.reselect();\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"get_rollback.jstree\", $.proxy(function () {\n\t\t\t\t\t\tthis.dehover_node();\n\t\t\t\t\t\tthis.save_selected();\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"set_rollback.jstree\", $.proxy(function () {\n\t\t\t\t\t\tthis.reselect();\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"close_node.jstree\", $.proxy(function (event, data) {\n\t\t\t\t\t\tvar s = this._get_settings().ui,\n\t\t\t\t\t\t\tobj = this._get_node(data.rslt.obj),\n\t\t\t\t\t\t\tclk = (obj && obj.length) ? obj.children(\"ul\").find(\"a.jstree-clicked\") : $(),\n\t\t\t\t\t\t\t_this = this;\n\t\t\t\t\t\tif(s.selected_parent_close === false || !clk.length) { return; }\n\t\t\t\t\t\tclk.each(function () {\n\t\t\t\t\t\t\t_this.deselect_node(this);\n\t\t\t\t\t\t\tif(s.selected_parent_close === \"select_parent\") { _this.select_node(obj); }\n\t\t\t\t\t\t});\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"delete_node.jstree\", $.proxy(function (event, data) {\n\t\t\t\t\t\tvar s = this._get_settings().ui.select_prev_on_delete,\n\t\t\t\t\t\t\tobj = this._get_node(data.rslt.obj),\n\t\t\t\t\t\t\tclk = (obj && obj.length) ? obj.find(\"a.jstree-clicked\") : [],\n\t\t\t\t\t\t\t_this = this;\n\t\t\t\t\t\tclk.each(function () { _this.deselect_node(this); });\n\t\t\t\t\t\tif(s && clk.length) {\n\t\t\t\t\t\t\tdata.rslt.prev.each(function () {\n\t\t\t\t\t\t\t\tif(this.parentNode) { _this.select_node(this); return false; /* if return false is removed all prev nodes will be selected */}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"move_node.jstree\", $.proxy(function (event, data) {\n\t\t\t\t\t\tif(data.rslt.cy) {\n\t\t\t\t\t\t\tdata.rslt.oc.find(\"a.jstree-clicked\").removeClass(\"jstree-clicked\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : {\n\t\t\tselect_limit : -1, // 0, 1, 2 ... or -1 for unlimited\n\t\t\tselect_multiple_modifier : \"ctrl\", // on, or ctrl, shift, alt\n\t\t\tselect_range_modifier : \"shift\",\n\t\t\tselected_parent_close : \"select_parent\", // false, \"de
2select\", \"select_parent\"\n\t\t\tselected_parent_open : true,\n\t\t\tselect_prev_on_delete : true,\n\t\t\tdisable_selecting_children : false,\n\t\t\tinitially_select : []\n\t\t},\n\t\t_fn : {\n\t\t\t_get_node : function (obj, allow_multiple) {\n\t\t\t\tif(typeof obj === \"undefined\" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }\n\t\t\t\tvar $obj = $(obj, this.get_container());\n\t\t\t\tif($obj.is(\".jstree\") || obj == -1) { return -1; }\n\t\t\t\t$obj = $obj.closest(\"li\", this.get_container());\n\t\t\t\treturn $obj.length ? $obj : false;\n\t\t\t},\n\t\t\t_ui_notify : function (n, data) {\n\t\t\t\tif(data.selected) {\n\t\t\t\t\tthis.select_node(n, false);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsave_selected : function () {\n\t\t\t\tvar _this = this;\n\t\t\t\tthis.data.ui.to_select = [];\n\t\t\t\tthis.data.ui.selected.each(function () { if(this.id) { _this.data.ui.to_select.push(\"#\" + this.id.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\")); } });\n\t\t\t\tthis.__callback(this.data.ui.to_select);\n\t\t\t},\n\t\t\treselect : function () {\n\t\t\t\tvar _this = this,\n\t\t\t\t\ts = this.data.ui.to_select;\n\t\t\t\ts = $.map($.makeArray(s), function (n) { return \"#\" + n.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\"); });\n\t\t\t\t// this.deselect_all(); WHY deselect, breaks plugin state notifier?\n\t\t\t\t$.each(s, function (i, val) { if(val && val !== \"#\") { _this.select_node(val); } });\n\t\t\t\tthis.data.ui.selected = this.data.ui.selected.filter(function () { return this.parentNode; });\n\t\t\t\tthis.__callback();\n\t\t\t},\n\t\t\trefresh : function (obj) {\n\t\t\t\tthis.save_selected();\n\t\t\t\treturn this.__call_old();\n\t\t\t},\n\t\t\thover_node : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\t//if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }\n\t\t\t\tif(!obj.hasClass(\"jstree-hovered\")) { this.dehover_node(); }\n\t\t\t\tthis.data.ui.hovered = obj.children(\"a\").addClass(\"jstree-hovered\").parent();\n\t\t\t\tthis._fix_scroll(obj);\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\tdehover_node : function () {\n\t\t\t\tvar obj = this.data.ui.hovered, p;\n\t\t\t\tif(!obj || !obj.length) { return false; }\n\t\t\t\tp = obj.children(\"a\").removeClass(\"jstree-hovered\").parent();\n\t\t\t\tif(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\tselect_node : function (obj, check, e) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj == -1 || !obj || !obj.length) { return false; }\n\t\t\t\tvar s = this._get_settings().ui,\n\t\t\t\t\tis_multiple = (s.select_multiple_modifier == \"on\" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + \"Key\"])),\n\t\t\t\t\tis_range = (s.select_range_modifier !== false && e && e[s.select_range_modifier + \"Key\"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]),\n\t\t\t\t\tis_selected = this.is_selected(obj),\n\t\t\t\t\tproceed = true,\n\t\t\t\t\tt = this;\n\t\t\t\tif(check) {\n\t\t\t\t\tif(s.disable_selecting_children && is_multiple &&\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(obj.parentsUntil(\".jstree\",\"li\").children(\"a.jstree-clicked\").length) ||\n\t\t\t\t\t\t\t(obj.children(\"ul\").find(\"a.jstree-clicked:eq(0)\").length)\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tproceed = false;\n\t\t\t\t\tswitch(!0) {\n\t\t\t\t\t\tcase (is_range):\n\t\t\t\t\t\t\tthis.data.ui.last_selected.addClass(\"jstree-last-selected\");\n\t\t\t\t\t\t\tobj = obj[ obj.index() < this.data.ui.last_selected.index() ? \"nextUntil\" : \"prevUntil\" ](\".jstree-last-selected\").addBack();\n\t\t\t\t\t\t\tif(s.select_limit == -1 || obj.length < s.select_limit) {\n\t\t\t\t\t\t\t\tthis.data.ui.last_selected.removeClass(\"jstree-last-selected\");\n\t\t\t\t\t\t\t\tthis.data.ui.selected.each(function () {\n\t\t\t\t\t\t\t\t\tif(this !== t.data.ui.last_selected[0]) { t.deselect_node(this); }\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tis_selected = false;\n\t\t\t\t\t\t\t\tproceed = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tproceed = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase (is_selected && !is_multiple):\n\t\t\t\t\t\t\tthis.deselect_all();\n\t\t\t\t\t\t\tis_selected = false;\n\t\t\t\t\t\t\tproceed = true;\n\t\t\t\t\t\t\tbreak;
2\n\t\t\t\t\t\tcase (!is_selected && !is_multiple):\n\t\t\t\t\t\t\tif(s.select_limit == -1 || s.select_limit > 0) {\n\t\t\t\t\t\t\t\tthis.deselect_all();\n\t\t\t\t\t\t\t\tproceed = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase (is_selected && is_multiple):\n\t\t\t\t\t\t\tthis.deselect_node(obj);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase (!is_selected && is_multiple):\n\t\t\t\t\t\t\tif(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {\n\t\t\t\t\t\t\t\tproceed = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(proceed && !is_selected) {\n\t\t\t\t\tif(!is_range) { this.data.ui.last_selected = obj; }\n\t\t\t\t\tobj.children(\"a\").addClass(\"jstree-clicked\");\n\t\t\t\t\tif(s.selected_parent_open) {\n\t\t\t\t\t\tobj.parents(\".jstree-closed\").each(function () { t.open_node(this, false, true); });\n\t\t\t\t\t}\n\t\t\t\t\tthis.data.ui.selected = this.data.ui.selected.add(obj);\n\t\t\t\t\tthis._fix_scroll(obj.eq(0));\n\t\t\t\t\tthis.__callback({ \"obj\" : obj, \"e\" : e });\n\t\t\t\t}\n\t\t\t},\n\t\t\t_fix_scroll : function (obj) {\n\t\t\t\tvar c = this.get_container()[0], t;\n\t\t\t\tif(c.scrollHeight > c.offsetHeight) {\n\t\t\t\t\tobj = this._get_node(obj);\n\t\t\t\t\tif(!obj || obj === -1 || !obj.length || !obj.is(\":visible\")) { return; }\n\t\t\t\t\tt = obj.offset().top - this.get_container().offset().top;\n\t\t\t\t\tif(t < 0) {\n\t\t\t\t\t\tc.scrollTop = c.scrollTop + t - 1;\n\t\t\t\t\t}\n\t\t\t\t\tif(t + this.data.core.li_height + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0) > c.offsetHeight) {\n\t\t\t\t\t\tc.scrollTop = c.scrollTop + (t - c.offsetHeight + this.data.core.li_height + 1 + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeselect_node : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tif(this.is_selected(obj)) {\n\t\t\t\t\tobj.children(\"a\").removeClass(\"jstree-clicked\");\n\t\t\t\t\tthis.data.ui.selected = this.data.ui.selected.not(obj);\n\t\t\t\t\tif(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }\n\t\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t\t}\n\t\t\t},\n\t\t\ttoggle_select : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return false; }\n\t\t\t\tif(this.is_selected(obj)) { this.deselect_node(obj); }\n\t\t\t\telse { this.select_node(obj); }\n\t\t\t},\n\t\t\tis_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },\n\t\t\tget_selected : function (context) {\n\t\t\t\treturn context ? $(context).find(\"a.jstree-clicked\").parent() : this.data.ui.selected;\n\t\t\t},\n\t\t\tdeselect_all : function (context) {\n\t\t\t\tvar ret = context ? $(context).find(\"a.jstree-clicked\").parent() : this.get_container().find(\"a.jstree-clicked\").parent();\n\t\t\t\tret.children(\"a.jstree-clicked\").removeClass(\"jstree-clicked\");\n\t\t\t\tthis.data.ui.selected = $([]);\n\t\t\t\tthis.data.ui.last_selected = false;\n\t\t\t\tthis.__callback({ \"obj\" : ret });\n\t\t\t}\n\t\t}\n\t});\n\t// include the selection plugin by default\n\t$.jstree.defaults.plugins.push(\"ui\");\n})(jQuery);\n//*/\n\n/*\n * jsTree CRRM plugin\n * Handles creating/renaming/removing/moving nodes by user interaction.\n */\n(function ($) {\n\t$.jstree.plugin(\"crrm\", {\n\t\t__init : function () {\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"move_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\tif(this._get_settings().crrm.move.open_onmove) {\n\t\t\t\t\t\tvar t = this;\n\t\t\t\t\t\tdata.rslt.np.parentsUntil(\".jstree\").addBack().filter(\".jstree-closed\").each(function () {\n\t\t\t\t\t\t\tt.open_node(this, false, true);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : {\n\t\t\tinput_width_limit : 200,\n\t\t\tmove : {\n\t\t\t\talways_copy\t\t\t: false, // false, true or \"multitree\"\n\t\t\t\topen_onmove\t\t\t: true,\n\t\t\t\tdefault_position\t: \"last\",\n\t\t\t\tcheck_move\t\t\t: function (m) { return true; }\n\t\t\t}\n\t\t},\n\t\t_fn : {\n\t\t\t_show_input : function (obj, callback) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar rtl = this._get_settings().core.rtl,\n\t\t\t\t\tw = this._get_settings().crrm.input_width_limit,\n\t\t\t\t\tw1 = obj.children(\"ins\").width(),\n\t\t\t\t\tw2 = obj.find(\"> a:visible > ins\").width() * obj.find(\"> a:visible > ins\").length,\n\t\t\t\t\tt = this.get_text(obj),\n\t\t\t\t\th1 = $(\"<div />\", { css : { \"position\" : \"absolute\", \"top\" : \"-200px\", \"left\" : (rtl ? \"0px\" : \"-1000px\"), \"visibility\" : \"hidden\" } }).appendTo(\"body\"),\n\t\t\t\t\th2 = obj.css(\"position\",\"relative\").append(\n\t\t\t\t\t$(\"<input />\", {\n\t\t\t\t\t\t\"value\" : t,\n\t\t\t\t\t\t\"class\" : \"jstree-rename-input\",\n\t\t\t\t\t\t// \"size\" : t.length,\n\t\t\t\t\t\t\"css\" : {\n\t\t\t\t\t\t\t\"padding\" : \"0\",\n\t\t\t\t\t\t\t\"border\" : \"1px solid silver\",\n\t\t\t\t\t\t\t\"position\" : \"absolute\",\n\t\t\t\t\t\t\t\"left\" : (rtl ? \"auto\" : (w1 + w2 + 4) + \"px\"),\n\t\t\t\t\t\t\t\"right\" : (rtl ? (w1 + w2 + 4) + \"px\" : \"auto\"),\n\t\t\t\t\t\t\t\"top\" : \"0px\",\n\t\t\t\t\t\t\t\"height\" : (this.data.core.li_height - 2) + \"px\",\n\t\t\t\t\t\t\t\"lineHeight\" : (this.data.core.li_height - 2) + \"px\",\n\t\t\t\t\t\t\t\"width\" : \"150px\" // will be set a bit further down\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"blur\" : $.proxy(function () {\n\t\t\t\t\t\t\tvar i = obj.children(\".jstree-rename-input\"),\n\t\t\t\t\t\t\t\tv = i.val();\n\t\t\t\t\t\t\tif(v === \"\") { v = t; }\n\t\t\t\t\t\t\th1.remove();\n\t\t\t\t\t\t\ti.remove(); // rollback purposes\n\t\t\t\t\t\t\tthis.set_text(obj,t); // rollback purposes\n\t\t\t\t\t\t\tthis.rename_node(obj, v);\n\t\t\t\t\t\t\tcallback.call(this, obj, v, t);\n\t\t\t\t\t\t\tobj.css(\"position\",\"\");\n\t\t\t\t\t\t}, this),\n\t\t\t\t\t\t\"keyup\" : function (event) {\n\t\t\t\t\t\t\tvar key = event.keyCode || event.which;\n\t\t\t\t\t\t\tif(key == 27) { this.value = t; this.blur(); return; }\n\t\t\t\t\t\t\telse if(key == 13) { this.blur(); return; }\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\th2.width(Math.min(h1.text(\"pW\" + this.value).width(),w));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"keypress\" : function(event) {\n\t\t\t\t\t\t\tvar key = event.keyCode || event.which;\n\t\t\t\t\t\t\tif(key == 13) { return false; }\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t).children(\".jstree-rename-input\");\n\t\t\t\tthis.set_text(obj, \"\");\n\t\t\t\th1.css({\n\t\t\t\t\t\tfontFamily\t\t: h2.css('fontFamily')\t\t|| '',\n\t\t\t\t\t\tfontSize\t\t: h2.css('fontSize')\t\t|| '',\n\t\t\t\t\t\tfontWeight\t\t: h2.css('fontWeight')\t\t|| '',\n\t\t\t\t\t\tfontStyle\t\t: h2.css('fontStyle')\t\t|| '',\n\t\t\t\t\t\tfontStretch\t\t: h2.css('fontStretch')\t\t|| '',\n\t\t\t\t\t\tfontVariant\t\t: h2.css('fontVariant')\t\t|| '',\n\t\t\t\t\t\tletterSpacing\t: h2.css('letterSpacing')\t|| '',\n\t\t\t\t\t\twordSpacing\t\t: h2.css('wordSpacing')\t\t|| ''\n\t\t\t\t});\n\t\t\t\th2.width(Math.min(h1.text(\"pW\" + h2[0].value).width(),w))[0].select();\n\t\t\t},\n\t\t\trename : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tthis.__rollback();\n\t\t\t\tvar f = this.__callback;\n\t\t\t\tthis._show_input(obj, function (obj, new_name, old_name) {\n\t\t\t\t\tf.call(this, { \"obj\" : obj, \"new_name\" : new_name, \"old_name\" : old_name });\n\t\t\t\t});\n\t\t\t},\n\t\t\tcreate : function (obj, position, js, callback, skip_rename) {\n\t\t\t\tvar t, _this = this;\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj) { obj = -1; }\n\t\t\t\tthis.__rollback();\n\t\t\t\tt = this.create_node(obj, position, js, function (t) {\n\t\t\t\t\tvar p
2= this._get_parent(t),\n\t\t\t\t\t\tpos = $(t).index();\n\t\t\t\t\tif(callback) { callback.call(this, t); }\n\t\t\t\t\tif(p.length && p.hasClass(\"jstree-closed\")) { this.open_node(p, false, true); }\n\t\t\t\t\tif(!skip_rename) {\n\t\t\t\t\t\tthis._show_input(t, function (obj, new_name, old_name) {\n\t\t\t\t\t\t\t_this.__callback({ \"obj\" : obj, \"name\" : new_name, \"parent\" : p, \"position\" : pos });\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse { _this.__callback({ \"obj\" : t, \"name\" : this.get_text(t), \"parent\" : p, \"position\" : pos }); }\n\t\t\t\t});\n\t\t\t\treturn t;\n\t\t\t},\n\t\t\tremove : function (obj) {\n\t\t\t\tobj = this._get_node(obj, true);\n\t\t\t\tvar p = this._get_parent(obj), prev = this._get_prev(obj);\n\t\t\t\tthis.__rollback();\n\t\t\t\tobj = this.delete_node(obj);\n\t\t\t\tif(obj !== false) { this.__callback({ \"obj\" : obj, \"prev\" : prev, \"parent\" : p }); }\n\t\t\t},\n\t\t\tcheck_move : function () {\n\t\t\t\tif(!this.__call_old()) { return false; }\n\t\t\t\tvar s = this._get_settings().crrm.move;\n\t\t\t\tif(!s.check_move.call(this, this._get_move())) { return false; }\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tmove_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {\n\t\t\t\tvar s = this._get_settings().crrm.move;\n\t\t\t\tif(!is_prepared) {\n\t\t\t\t\tif(typeof position === \"undefined\") { position = s.default_position; }\n\t\t\t\t\tif(position === \"inside\" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }\n\t\t\t\t\treturn this.__call_old(true, obj, ref, position, is_copy, false, skip_check);\n\t\t\t\t}\n\t\t\t\t// if the move is already prepared\n\t\t\t\tif(s.always_copy === true || (s.always_copy === \"multitree\" && obj.rt.get_index() !== obj.ot.get_index() )) {\n\t\t\t\t\tis_copy = true;\n\t\t\t\t}\n\t\t\t\tthis.__call_old(true, obj, ref, position, is_copy, true, skip_check);\n\t\t\t},\n\n\t\t\tcut : function (obj) {\n\t\t\t\tobj = this._get_node(obj, true);\n\t\t\t\tif(!obj || !obj.length) { return false; }\n\t\t\t\tthis.data.crrm.cp_nodes = false;\n\t\t\t\tthis.data.crrm.ct_nodes = obj;\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\tcopy : function (obj) {\n\t\t\t\tobj = this._get_node(obj, true);\n\t\t\t\tif(!obj || !obj.length) { return false; }\n\t\t\t\tthis.data.crrm.ct_nodes = false;\n\t\t\t\tthis.data.crrm.cp_nodes = obj;\n\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t},\n\t\t\tpaste : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj || !obj.length) { return false; }\n\t\t\t\tvar nodes = this.data.crrm.ct_nodes ? this.data.crrm.ct_nodes : this.data.crrm.cp_nodes;\n\t\t\t\tif(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }\n\t\t\t\tif(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); this.data.crrm.ct_nodes = false; }\n\t\t\t\tif(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }\n\t\t\t\tthis.__callback({ \"obj\" : obj, \"nodes\" : nodes });\n\t\t\t}\n\t\t}\n\t});\n\t// include the crr plugin by default\n\t// $.jstree.defaults.plugins.push(\"crrm\");\n})(jQuery);\n//*/\n\n/*\n * jsTree themes plugin\n * Handles loading and setting themes, as well as detecting path to themes, etc.\n */\n(function ($) {\n\tvar themes_loaded = [];\n\t// this variable stores the path to the themes folder - if left as false - it will be autodetected\n\t$.jstree._themes = false;\n\t$.jstree.plugin(\"themes\", {\n\t\t__init : function () {\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"init.jstree\", $.proxy(function () {\n\t\t\t\t\t\tvar s = this._get_settings().themes;\n\t\t\t\t\t\tthis.data.themes.dots = s.dots;\n\t\t\t\t\t\tthis.data.themes.icons = s.icons;\n\t\t\t\t\t\tthis.set_theme(s.theme, s.url);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"loaded.jstree\", $.proxy(function () {\n\t\t\t\t\t\t// bound here too, as simple HTML tree's won't honor dots & icons otherwise\n\t\t\t\t\t\tif(!this.data.themes.dots) { this.hide_dots(); }\n\t\t\t\t\t\telse { this.show_dots(); }\n\t\t\t\t\t\tif(!this.data.themes.icons) { this.hide_icons(); }\n\t\t\t\t\t\telse { this.show_icons(); }\n\t\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : {\n\t\t\ttheme : \"default\",\n\t\t\turl : false,\n\t\t\tdots : false,\n\t\t\ticons : true\n\t\t},\n\t\t_fn : {\n\t\t\tset_theme : function (theme_name, theme_url) {\n\t\t\t\tif(!theme_name) { return false; }\n\t\t\t\tif(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }\n\t\t\t\tif($.inArray(theme_url, themes_loaded) == -1) {\n\t\t\t\t\t// $.vakata.css.add_sheet({ \"url\" : theme_url });\n\t\t\t\t\tthemes_loaded.push(theme_url);\n\t\t\t\t}\n\t\t\t\tif(this.data.themes.theme != theme_name) {\n\t\t\t\t\tthis.get_container().removeClass('jstree-' + this.data.themes.theme);\n\t\t\t\t\tthis.data.themes.theme = theme_name;\n\t\t\t\t}\n\t\t\t\tthis.get_container().addClass('jstree-' + theme_name);\n\t\t\t\tif(!this.data.themes.dots) { this.hide_dots(); }\n\t\t\t\telse { this.show_dots(); }\n\t\t\t\tif(!this.data.themes.icons) { this.hide_icons(); }\n\t\t\t\telse { this.show_icons(); }\n\t\t\t\tthis.__callback();\n\t\t\t},\n\t\t\tget_theme\t: function () { return this.data.themes.theme; },\n\n\t\t\tshow_dots\t: function () { this.data.themes.dots = true; this.get_container().children(\"ul\").removeClass(\"jstree-no-dots\"); },\n\t\t\thide_dots\t: function () { this.data.themes.dots = false; this.get_container().children(\"ul\").addClass(\"jstree-no-dots\"); },\n\t\t\ttoggle_dots\t: function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },\n\n\t\t\tshow_icons\t: function () { this.data.themes.icons = true; this.get_container().children(\"ul\").removeClass(\"jstree-no-icons\"); },\n\t\t\thide_icons\t: function () { this.data.themes.icons = false; this.get_container().children(\"ul\").addClass(\"jstree-no-icons\"); },\n\t\t\ttoggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }\n\t\t}\n\t});\n\t// autodetect themes path\n\t$(function () {\n\t\tif($.jstree._themes === false) {\n\t\t\t$(\"script\").each(function () {\n\t\t\t\tif(this.src.toString().match(/jquery\\.jstree[^\\/]*?\\.js(\\?.*)?$/)) {\n\t\t\t\t\t$.jstree._themes = this.src.toString().replace(/jquery\\.jstree[^\\/]*?\\.js(\\?.*)?$/, \"\") + 'themes/';\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif($.jstree._themes === false) { $.jstree._themes = \"themes/\"; }\n\t});\n\t// include the themes plugin by default\n\t$.jstree.defaults.plugins.push(\"themes\");\n})(jQuery);\n//*/\n\n/*\n * jsTree hotkeys plugin\n * Enables keyboard navigation for all tree instances\n * Depends on the jstree ui & jquery hotkeys plugins\n */\n(function ($) {\n\tvar bound = [];\n\tfunction exec(i, event) {\n\t\tvar f = $.jstree._focused(), tmp;\n\t\tif(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {\n\t\t\ttmp = f._get_settings().hotkeys[i];\n\t\t\tif(tmp) { return tmp.call(f, event); }\n\t\t}\n\t}\n\t$.jstree.plugin(\"hotkeys\", {\n\t\t__init : function () {\n\t\t\tif(typeof $.hotkeys === \"undefined\") { throw \"jsTree hotkeys: jQuery hotkeys plugin not included.\"; }\n\t\t\tif(!this.data.ui) { throw \"jsTree hotkeys: jsTree UI plugin not included.\"; }\n\t\t\t$.each(this._get_settings().hotkeys, function (i, v) {\n\t\t\t\tif(v !== false && $.inArray(i, bound) == -1) {\n\t\t\t\t\t$(document).bind(\"keydown\", i, function (event) { return exec(i, event); });
2\n\t\t\t\t\tbound.push(i);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"lock.jstree\", $.proxy(function () {\n\t\t\t\t\t\tif(this.data.hotkeys.enabled) { this.data.hotkeys.enabled = false; this.data.hotkeys.revert = true; }\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"unlock.jstree\", $.proxy(function () {\n\t\t\t\t\t\tif(this.data.hotkeys.revert) { this.data.hotkeys.enabled = true; }\n\t\t\t\t\t}, this));\n\t\t\tthis.enable_hotkeys();\n\t\t},\n\t\tdefaults : {\n\t\t\t\"up\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected || -1;\n\t\t\t\tthis.hover_node(this._get_prev(o));\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"ctrl+up\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected || -1;\n\t\t\t\tthis.hover_node(this._get_prev(o));\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"shift+up\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected || -1;\n\t\t\t\tthis.hover_node(this._get_prev(o));\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"down\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected || -1;\n\t\t\t\tthis.hover_node(this._get_next(o));\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"ctrl+down\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected || -1;\n\t\t\t\tthis.hover_node(this._get_next(o));\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"shift+down\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected || -1;\n\t\t\t\tthis.hover_node(this._get_next(o));\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"left\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected;\n\t\t\t\tif(o) {\n\t\t\t\t\tif(o.hasClass(\"jstree-open\")) { this.close_node(o); }\n\t\t\t\t\telse { this.hover_node(this._get_prev(o)); }\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"ctrl+left\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected;\n\t\t\t\tif(o) {\n\t\t\t\t\tif(o.hasClass(\"jstree-open\")) { this.close_node(o); }\n\t\t\t\t\telse { this.hover_node(this._get_prev(o)); }\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"shift+left\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected;\n\t\t\t\tif(o) {\n\t\t\t\t\tif(o.hasClass(\"jstree-open\")) { this.close_node(o); }\n\t\t\t\t\telse { this.hover_node(this._get_prev(o)); }\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"right\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected;\n\t\t\t\tif(o && o.length) {\n\t\t\t\t\tif(o.hasClass(\"jstree-closed\")) { this.open_node(o); }\n\t\t\t\t\telse { this.hover_node(this._get_next(o)); }\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"ctrl+right\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected;\n\t\t\t\tif(o && o.length) {\n\t\t\t\t\tif(o.hasClass(\"jstree-closed\")) { this.open_node(o); }\n\t\t\t\t\telse { this.hover_node(this._get_next(o)); }\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"shift+right\" : function () {\n\t\t\t\tvar o = this.data.ui.hovered || this.data.ui.last_selected;\n\t\t\t\tif(o && o.length) {\n\t\t\t\t\tif(o.hasClass(\"jstree-closed\")) { this.open_node(o); }\n\t\t\t\t\telse { this.hover_node(this._get_next(o)); }\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"space\" : function () {\n\t\t\t\tif(this.data.ui.hovered) { this.data.ui.hovered.children(\"a:eq(0)\").click(); }\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"ctrl+space\" : function (event) {\n\t\t\t\tevent.type = \"click\";\n\t\t\t\tif(this.data.ui.hovered) { this.data.ui.hovered.children(\"a:eq(0)\").trigger(event); }\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"shift+space\" : function (event) {\n\t\t\t\tevent.type = \"click\";\n\t\t\t\tif(this.data.ui.hovered) { this.data.ui.hovered.children(\"a:eq(0)\").trigger(event); }\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\"f2\" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },\n\t\t\t\"del\" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }\n\t\t},\n\t\t_fn : {\n\t\t\tenable_hotkeys : function () {\n\t\t\t\tthis.data.hotkeys.enabled = true;\n\t\t\t},\n\t\t\tdisable_hotkeys : function () {\n\t\t\t\tthis.data.hotkeys.enabled = false;\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree JSON plugin\n * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.\n */\n(function ($) {\n\t$.jstree.plugin(\"json_data\", {\n\t\t__init : function() {\
2n\t\t\tvar s = this._get_settings().json_data;\n\t\t\tif(s.progressive_unload) {\n\t\t\t\tthis.get_container().bind(\"after_close.jstree\", function (e, data) {\n\t\t\t\t\tdata.rslt.obj.children(\"ul\").remove();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdefaults : {\n\t\t\t// `data` can be a function:\n\t\t\t// * accepts two arguments - node being loaded and a callback to pass the result to\n\t\t\t// * will be executed in the current tree's scope & ajax won't be supported\n\t\t\tdata : false,\n\t\t\tajax : false,\n\t\t\tcorrect_state : true,\n\t\t\tprogressive_render : false,\n\t\t\tprogressive_unload : false\n\t\t},\n\t\t_fn : {\n\t\t\tload_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ \"obj\" : _this._get_node(obj) }); s_call.call(this); }, e_call); },\n\t\t\t_is_loaded : function (obj) {\n\t\t\t\tvar s = this._get_settings().json_data;\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\treturn obj == -1 || !obj || (!s.ajax && !s.progressive_render && !$.isFunction(s.data)) || obj.is(\".jstree-open, .jstree-leaf\") || obj.children(\"ul\").children(\"li\").length > 0;\n\t\t\t},\n\t\t\trefresh : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar s = this._get_settings().json_data;\n\t\t\t\tif(obj && obj !== -1 && s.progressive_unload && ($.isFunction(s.data) || !!s.ajax)) {\n\t\t\t\t\tobj.removeData(\"jstree_children\");\n\t\t\t\t}\n\t\t\t\treturn this.__call_old();\n\t\t\t},\n\t\t\tload_node_json : function (obj, s_call, e_call) {\n\t\t\t\tvar s = this.get_settings().json_data, d,\n\t\t\t\t\terror_func = function () {},\n\t\t\t\t\tsuccess_func = function () {};\n\t\t\t\tobj = this._get_node(obj);\n\n\t\t\t\tif(obj && obj !== -1 && (s.progressive_render || s.progressive_unload) && !obj.is(\".jstree-open, .jstree-leaf\") && obj.children(\"ul\").children(\"li\").length === 0 && obj.data(\"jstree_children\")) {\n\t\t\t\t\td = this._parse_json(obj.data(\"jstree_children\"), obj);\n\t\t\t\t\tif(d) {\n\t\t\t\t\t\tobj.append(d);\n\t\t\t\t\t\tif(!s.progressive_unload) { obj.removeData(\"jstree_children\"); }\n\t\t\t\t\t}\n\t\t\t\t\tthis.clean_node(obj);\n\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\tif(obj.data(\"jstree_is_loading\")) { return; }\n\t\t\t\t\telse { obj.data(\"jstree_is_loading\",true); }\n\t\t\t\t}\n\t\t\t\tswitch(!0) {\n\t\t\t\t\tcase (!s.data && !s.ajax): throw \"Neither data nor ajax settings supplied.\";\n\t\t\t\t\t// function option added here for easier model integration (also supporting async - see callback)\n\t\t\t\t\tcase ($.isFunction(s.data)):\n\t\t\t\t\t\ts.data.call(this, obj, $.proxy(function (d) {\n\t\t\t\t\t\t\td = this._parse_json(d, obj);\n\t\t\t\t\t\t\tif(!d) {\n\t\t\t\t\t\t\t\tif(obj === -1 || !obj) {\n\t\t\t\t\t\t\t\t\tif(s.correct_state) { this.get_container().children(\"ul\").empty(); }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\t\tif(s.correct_state) { this.correct_state(obj); }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(e_call) { e_call.call(this); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(obj === -1 || !obj) { this.get_container().children(\"ul\").empty().append(d.children()); }\n\t\t\t\t\t\t\t\telse { obj.append(d).children(\"a.jstree-loading\").removeClass(\"jstree-loading\"); obj.removeData(\"jstree_is_loading\"); }\n\t\t\t\t\t\t\t\tthis.clean_node(obj);\n\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, this));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):\n\t\t\t\t\t\tif(!obj || obj == -1) {\n\t\t\t\t\t\t\td = this._parse_json(s.data, obj);\n\t\t\t\t\t\t\tif(d) {\n\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty().append(d.children());\n\t\t\t\t\t\t\t\tthis.clean_node();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(s.correct_state) { this.get_container().children(\"ul\").empty(); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):\n\t\t\t\t\t\terror_func = function (x, t, e) {\n\t\t\t\t\t\t\tvar ef = this.get_settings().json_data.ajax.error;\n\t\t\t\t\t\t\tif(ef) { ef.call(this, x, t, e); }\n\t\t\t\t\t\t\tif(obj != -1 && obj.length) {\n\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\tif(t === \"success\" && s.correct_state) { this.correct_state(
2obj); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(t === \"success\" && s.correct_state) { this.get_container().children(\"ul\").empty(); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(e_call) { e_call.call(this); }\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsuccess_func = function (d, t, x) {\n\t\t\t\t\t\t\tvar sf = this.get_settings().json_data.ajax.success;\n\t\t\t\t\t\t\tif(sf) { d = sf.call(this,d,t,x) || d; }\n\t\t\t\t\t\t\tif(d === \"\" || (d && d.toString && d.toString().replace(/^[\\s\\n]+$/,\"\") === \"\") || (!$.isArray(d) && !$.isPlainObject(d))) {\n\t\t\t\t\t\t\t\treturn error_func.call(this, x, t, \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\td = this._parse_json(d, obj);\n\t\t\t\t\t\t\tif(d) {\n\t\t\t\t\t\t\t\tif(obj === -1 || !obj) { this.get_container().children(\"ul\").empty().append(d.children()); }\n\t\t\t\t\t\t\t\telse { obj.append(d).children(\"a.jstree-loading\").removeClass(\"jstree-loading\"); obj.removeData(\"jstree_is_loading\"); }\n\t\t\t\t\t\t\t\tthis.clean_node(obj);\n\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(obj === -1 || !obj) {\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty();\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.correct_state(obj);\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\ts.ajax.context = this;\n\t\t\t\t\t\ts.ajax.error = error_func;\n\t\t\t\t\t\ts.ajax.success = success_func;\n\t\t\t\t\t\tif(!s.ajax.dataType) { s.ajax.dataType = \"json\"; }\n\t\t\t\t\t\tif($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }\n\t\t\t\t\t\tif($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }\n\t\t\t\t\t\t$.ajax(s.ajax);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\t_parse_json : function (js, obj, is_callback) {\n\t\t\t\tvar d = false,\n\t\t\t\t\tp = this._get_settings(),\n\t\t\t\t\ts = p.json_data,\n\t\t\t\t\tt = p.core.html_titles,\n\t\t\t\t\ttmp, i, j, ul1, ul2;\n\n\t\t\t\tif(!js) { return d; }\n\t\t\t\tif(s.progressive_unload && obj && obj !== -1) {\n\t\t\t\t\tobj.data(\"jstree_children\", d);\n\t\t\t\t}\n\t\t\t\tif($.isArray(js)) {\n\t\t\t\t\td = $();\n\t\t\t\t\tif(!js.length) { return false; }\n\t\t\t\t\tfor(i = 0, j = js.length; i < j; i++) {\n\t\t\t\t\t\ttmp = this._parse_json(js[i], obj, true);\n\t\t\t\t\t\tif(tmp.length) { d = d.add(tmp); }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(typeof js == \"string\") { js = { data : js }; }\n\t\t\t\t\tif(!js.data && js.data !== \"\") { return d; }\n\t\t\t\t\td = $(\"<li />\");\n\t\t\t\t\tif(js.attr) { d.attr(js.attr); }\n\t\t\t\t\tif(js.metadata) { d.data(js.metadata); }\n\t\t\t\t\tif(js.state) { d.addClass(\"jstree-\" + js.state); }\n\t\t\t\t\tif(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }\n\t\t\t\t\t$.each(js.data, function (i, m) {\n\t\t\t\t\t\ttmp = $(\"<a />\");\n\t\t\t\t\t\tif($.isFunction(m)) { m = m.call(this, js); }\n\t\t\t\t\t\tif(typeof m == \"string\") { tmp.attr('href','#')[ t ? \"html\" : \"text\" ](m); }\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif(!m.attr) { m.attr = {}; }\n\t\t\t\t\t\t\tif(!m.attr.href) { m.attr.href = '#'; }\n\t\t\t\t\t\t\ttmp.attr(m.attr)[ t ? \"html\" : \"text\" ](m.title);\n\t\t\t\t\t\t\tif(m.language) { tmp.addClass(m.language); }\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttmp.prepend(\"<ins class='jstree-icon'> </ins>\");\n\t\t\t\t\t\tif(!m.icon && js.icon) { m.icon = js.icon; }\n\t\t\t\t\t\tif(m.icon) {\n\t\t\t\t\t\t\tif(m.icon.indexOf(\"/\") === -1) { tmp.children(\"ins\").addClass(m.icon); }\n\t\t\t\t\t\t\telse { tmp.children(\"ins\").css(\"background\",\"url('\" + m.icon + \"') center center no-repeat\"); }\n\t\t\t\t\t\t}\n\t\t\t\t\t\td.append(tmp);\n\t\t\t\t\t});\n\t\t\t\t\td.prepend(\"<ins class='jstree-icon'> </ins>\");\n\t\t\t\t\tif(js.children) {\n\t\t\t\t\t\tif(s.progressive_render && js.state !== \"open\") {\n\t\t\t\t\t\t\td.addClass(\"jstree-closed\").data(\"jstree_children\", js.children);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif(s.progressive_unload) { d.data(\"jstree_children\", js.children); }\n\t\t\t\t\t\t\tif($.isArray(js.children) && js.children.length) {\n\t\t\t\t\t\t\t\ttmp = this._parse_json(js.children, obj, true);\n\t\t\t\t\t\t\t\tif(tmp.length) {\n\t\t\t\t\t\t\t\t\tul2 = $(\"<ul />\");\n\t\t\t\t\t\t\t\t\tul2.append(tmp);\n\t\t\t\t\t\t\t\t\td.append(ul2);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!is_callback) {\n\t\t\t\t\tul1 = $(\"<ul />\");\n\t\t\t\t\tul1.append(d);\n\t\t\t\t\td = ul1;\n\t\t\t\t}\n\t\t\t\treturn d;\n\t\t\t},\n\t\t\tget_json : function (obj, li_attr, a_attr, is_callback) {\n\t\t\t\tvar result = [],\n\t\t\t\t\ts = this._get_settings(),\n\t\t\t\t\t_this = this,\n\t\t\t\t\ttmp1, tmp2, li, a, t, lang;\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj || obj === -1) { obj = this.get_container().find(\"> ul > li\"); }\n\t\t\t\tli_attr = $.isArray(li_attr) ? li_attr : [ \"id\", \"class\" ];\n\t\t\t\tif(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }\n\t\t\t\ta_attr = $.isArray(a_attr) ? a_attr : [ ];\n\n\t\t\t\tobj.each(function () {\n\t\t\t\t\tli = $(this);\n\t\t\t\t\ttmp1 = { data : [] };\n\t\t\t\t\tif(li_attr.length) { tmp1.attr = { }; }\n\t\t\t\t\t$.each(li_attr, function (i, v) {\n\t\t\t\t\t\ttmp2 = li.attr(v);\n\t\t\t\t\t\tif(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*/ig,'').length) {\n\t\t\t\t\t\t\ttmp1.attr[v] = (\" \" + tmp2).replace(/ jstree[^ ]*/ig,'').replace(/\\s+$/ig,\" \").replace(/^ /,\"\").replace(/ $/,\"\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif(li.hasClass(\"jstree-open\")) { tmp1.state = \"open\"; }\n\t\t\t\t\tif(li.hasClass(\"jstree-closed\")) { tmp1.state = \"closed\"; }\n\t\t\t\t\tif(li.data()) { tmp1.metadata = li.data(); }\n\t\t\t\t\ta = li.children(\"a\");\n\t\t\t\t\ta.each(function () {\n\t\t\t\t\t\tt = $(this);\n\t\t\t\t\t\tif(\n\t\t\t\t\t\t\ta_attr.length ||\n\t\t\t\t\t\t\t$.inArray(\"languages\", s.plugins) !== -1 ||\n\t\t\t\t\t\t\tt.children(\"ins\").get(0).style.backgroundImage.length ||\n\t\t\t\t\t\t\t(t.children(\"ins\").get(0).className && t.children(\"ins\").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tlang = false;\n\t\t\t\t\t\t\tif($.inArray(\"languages\", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {\n\t\t\t\t\t\t\t\t$.each(s.languages, function (l, lv) {\n\t\t\t\t\t\t\t\t\tif(t.hasClass(lv)) {\n\t\t\t\t\t\t\t\t\t\tlang = lv;\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttmp2 = { attr : { }, title : _this.get_text(t, lang) };\n\t\t\t\t\t\t\t$.each(a_attr, function (k, z) {\n\t\t\t\t\t\t\t\ttmp2.attr[z] = (\" \" + (t.attr(z) || \"\")).replace(/ jstree[^ ]*/ig,'').replace(/\\s+$/ig,\" \").replace(/^ /,\"\").replace(/ $/,\"\");\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif($.inArray(\"languages\", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {\n\t\t\t\t\t\t\t\t$.each(s.languages, function (k, z) {\n\t\t\t\t\t\t\t\t\tif(t.hasClass(z)) { tmp2.language = z; return true; }\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(t.children(\"ins\").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\\s+$/ig,\"\").length) {\n\t\t\t\t\t\t\t\ttmp2.icon = t.children(\"ins\").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\\s+$/ig,\" \").replace(/^ /,\"\").replace(/ $/,\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(t.children(\"ins\").get(0).style.backgroundImage.length) {\n\t\t\t\t\t\t\t\ttmp2.icon = t.children(\"ins\").get(0).style.backgroundImage.replace(\"url(\",\"\").replace(\")\",\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttmp2 = _this.get_text(t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a.length > 1) { tmp1.data.push(tmp2); }\n\t\t\t\t\t\telse { tmp1.data = tmp2; }\n\t\t\t\t\t});\n\t\t\t\t\tli = li.find(\"> ul > li\");\n\t\t\t\t\tif(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }\n\t\t\t\t\tresult.push(tmp1);\n\t\t\t\t});\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree languages plugin\n * Adds support for multiple language versions in one tree\n * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time\n * This is useful for maintaining the same structure in many languages (hence the name of the plugin)\n */\n(function ($) {\n\t$.jstree.plugin(\"languages\", {\n\t\t__init : function () { this._load_css(); },\n\t\tdefaults : [],\n\t\t_fn : {\n\t\t\tset_lang : function (i) {\n\t\t\t\tvar langs = this._get_settings().languages,\n\t\t\t\t\tst = false,\n\t\t\t\t\tselector = \".jstree-\" + this.get_index() + ' a';\n\t\t\t\tif(!$.isArray(langs) || langs.length === 0) { return false; }\n\t\t\t\tif($.inArray(i,langs) == -1) {\n\t\t\t\t\tif(!!langs[i]) { i = langs[i]; }\n\t\t\t\t\telse { return false; }\n\t\t\t\t}\n\t\t\t\tif(i == this.data.languages.current_language) { return true; }\n\t\t\t\tst = $.vakata.css.get_css(selector + \".\" + this.data.languages.current_language, false, this.data.languages.language_css);\n\t\t\t\tif(st !== false) { st.style.display = \"none\"; }\n\t\t\t\tst = $.vakata.css.get_css(selector + \".\" + i, false, this.data.languages.language_css);\n\t\t\t\tif(st !== false) { st.style.display = \"\"; }\n\t\t\t\tthis.data.languages.current_language = i;\n\t\t\t\tthis.__callback(i);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tget_lang : function () {\n\t\t\t\treturn this.data.languages.current_language;\n\t\t\t},\n\t\t\t_get_string : function (key, lang) {\n\t\t\t\tvar langs = this._get_settings().languages,\n\t\t\t\t\ts = this._get_settings().core.strings;\n\t\t\t\tif($.isArray(langs) && langs.length) {\n\t\t\t\t\tlang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;\n\t\t\t\t}\n\t\t\t\tif(s[lang] && s[lang][key]) { return s[lang][key]; }\n\t\t\t\tif(s[key]) { return s[key]; }\n\t\t\t\treturn key;\n\t\t\t},\n\t\t\tget_text : function (obj, lang) {\n\t\t\t\tobj = this._get_node(obj) || this.data.ui.last_selected;\n\t\t\t\tif(!obj.size()) { return false; }\n\t\t\t\tvar langs = this._get_settings().languages,\n\t\t\t\t\ts = this._get_settings().core.html_titles;\n\t\t\t\tif($.isArray(langs) && langs.length) {\n\t\t\t\t\tlang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;\n\t\t\t\t\tobj = obj.children(\"a.\" + lang);\n\t\t\t\t}\n\t\t\t\telse { obj = obj.children(\"a:eq(0)\"); }
2\n\t\t\t\tif(s) {\n\t\t\t\t\tobj = obj.clone();\n\t\t\t\t\tobj.children(\"INS\").remove();\n\t\t\t\t\treturn obj.html();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tobj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\n\t\t\t\t\treturn obj.nodeValue;\n\t\t\t\t}\n\t\t\t},\n\t\t\tset_text : function (obj, val, lang) {\n\t\t\t\tobj = this._get_node(obj) || this.data.ui.last_selected;\n\t\t\t\tif(!obj.size()) { return false; }\n\t\t\t\tvar langs = this._get_settings().languages,\n\t\t\t\t\ts = this._get_settings().core.html_titles,\n\t\t\t\t\ttmp;\n\t\t\t\tif($.isArray(langs) && langs.length) {\n\t\t\t\t\tlang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;\n\t\t\t\t\tobj = obj.children(\"a.\" + lang);\n\t\t\t\t}\n\t\t\t\telse { obj = obj.children(\"a:eq(0)\"); }\n\t\t\t\tif(s) {\n\t\t\t\t\ttmp = obj.children(\"INS\").clone();\n\t\t\t\t\tobj.html(val).prepend(tmp);\n\t\t\t\t\tthis.__callback({ \"obj\" : obj, \"name\" : val, \"lang\" : lang });\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tobj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\n\t\t\t\t\tthis.__callback({ \"obj\" : obj, \"name\" : val, \"lang\" : lang });\n\t\t\t\t\treturn (obj.nodeValue = val);\n\t\t\t\t}\n\t\t\t},\n\t\t\t_load_css : function () {\n\t\t\t\tvar langs = this._get_settings().languages,\n\t\t\t\t\tstr = \"/* languages css */\",\n\t\t\t\t\tselector = \".jstree-\" + this.get_index() + ' a',\n\t\t\t\t\tln;\n\t\t\t\tif($.isArray(langs) && langs.length) {\n\t\t\t\t\tthis.data.languages.current_language = langs[0];\n\t\t\t\t\tfor(ln = 0; ln < langs.length; ln++) {\n\t\t\t\t\t\tstr += selector + \".\" + langs[ln] + \" {\";\n\t\t\t\t\t\tif(langs[ln] != this.data.languages.current_language) { str += \" display:none; \"; }\n\t\t\t\t\t\tstr += \" } \";\n\t\t\t\t\t}\n\t\t\t\t\tthis.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str, 'title' : \"jstree-languages\" });\n\t\t\t\t}\n\t\t\t},\n\t\t\tcreate_node : function (obj, position, js, callback) {\n\t\t\t\tvar t = this.__call_old(true, obj, position, js, function (t) {\n\t\t\t\t\tvar langs = this._get_settings().languages,\n\t\t\t\t\t\ta = t.children(\"a\"),\n\t\t\t\t\t\tln;\n\t\t\t\t\tif($.isArray(langs) && langs.length) {\n\t\t\t\t\t\tfor(ln = 0; ln < langs.length; ln++) {\n\t\t\t\t\t\t\tif(!a.is(\".\" + langs[ln])) {\n\t\t\t\t\t\t\t\tt.append(a.eq(0).clone().removeClass(langs.join(\" \")).addClass(langs[ln]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\ta.not(\".\" + langs.join(\", .\")).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif(callback) { callback.call(this, t); }\n\t\t\t\t});\n\t\t\t\treturn t;\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree cookies plugin\n * Stores the currently opened/selected nodes in a cookie and then restores them\n * Depends on the jquery.cookie plugin\n */\n(function ($) {\n\t$.jstree.plugin(\"cookies\", {\n\t\t__init : function () {\n\t\t\tif(typeof $.cookie === \"undefined\") { throw \"jsTree cookie: jQuery cookie plugin not included.\"; }\n\n\t\t\tvar s = this._get_settings().cookies,\n\t\t\t\ttmp;\n\t\t\tif(!!s.save_loaded) {\n\t\t\t\ttmp = $.cookie(s.save_loaded);\n\t\t\t\tif(tmp && tmp.length) { this.data.core.to_load = tmp.split(\",\"); }\n\t\t\t}\n\t\t\tif(!!s.save_opened) {\n\t\t\t\ttmp = $.cookie(s.save_opened);\n\t\t\t\tif(tmp && tmp.length) { this.data.core.to_open = tmp.split(\",\"); }\n\t\t\t}\n\t\t\tif(!!s.save_selected) {\n\t\t\t\ttmp = $.cookie(s.save_selected);\n\t\t\t\tif(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(\",\"); }\n\t\t\t}\n\t\t\tthis.get_container()\n\t\t\t\t.one( ( this.data.ui ? \"reselect\" : \"reopen\" ) + \".jstree\", $.proxy(function () {\n\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t.bind(\"open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\t\t\tif(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace(\"jstree\",\"\")); }\n\t\t\t\t\t\t\t}, this));\n\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : {\n\t\t\tsave_loaded\t\t: \"jstree_load\",\n\t\t\tsave_opened\t\t: \"jstree_open\",\n\t\t\tsave_selected\t: \"jstree_select\",\n\t\t\tauto_save\t\t: true,\n\t\t\tcookie_options\t: {}\n\t\t},\n\t\t_fn : {\n\t\t\tsave_cookie : function (c) {\n\t\t\t\tif(this.data.core.refreshing) { return; }\n\t\t\t\tvar s = this._get_settings().cookies;\n\t\t\t\tif(!c) { // if called manually and not by event\n\t\t\t\t\tif(s.save_loaded) {\n\t\t\t\t\t\tthis.save_loaded();\n\t\t\t\t\t\t$.cookie(s.save_loaded, this.data.core.to_load.join(\",\"), s.cookie_options);\n\t\t\t\t\t}\n\t\t\t\t\tif(s.save_opened) {\n\t\t\t\t\t\tthis.save_opened();\n\t\t\t\t\t\t$.cookie(s.save_opened, this.data.core.to_open.join(\",\"), s.cookie_options);\n\t\t\t\t\t}\n\t\t\t\t\tif(s.save_selected && this.data.ui) {\n\t\t\t\t\t\tthis.save_selected();\n\t\t\t\t\t\t$.cookie(s.save_selected, this.data.ui.to_select.join(\",\"), s.cookie_options);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tswitch(c) {\n\t\t\t\t\tcase \"open_node\":\n\t\t\t\t\tcase \"close_node\":\n\t\t\t\t\t\tif(!!s.save_opened) {\n\t\t\t\t\t\t\tthis.save_opened();\n\t\t\t\t\t\t\t$.cookie(s.save_opened, this.data.core.to_open.join(\",\"), s.cookie_options);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!!s.save_loaded) {\n\t\t\t\t\t\t\tthis.save_loaded();\n\t\t\t\t\t\t\t$.cookie(s.save_loaded, this.data.core.to_load.join(\",\"), s.cookie_options);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"select_node\":\n\t\t\t\t\tcase \"deselect_node\":\n\t\t\t\t\t\tif(!!s.save_selected && this.data.ui) {\n\t\t\t\t\t\t\tthis.save_selected();\n\t\t\t\t\t\t\t$.cookie(s.save_selected, this.data.ui.to_select.join(\",\"), s.cookie_options);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t// include cookies by default\n\t// $.jstree.defaults.plugins.push(\"cookies\");\n})(jQuery);\n//*/\n\n/*\n * jsTree sort plugin\n * Sorts items alphabetically (or using any other function)\n */\n(function ($) {\n\t$.jstree.plugin(\"sort\", {\n\t\t__init : function () {\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"load_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tvar obj = this._get_node(data.rslt.obj);\n\t\t\t\t\t\tobj = obj === -1 ? this.get_container().children(\"ul\") : obj.children(\"ul\");\n\t\t\t\t\t\tthis.sort(obj);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"rename_node.jstree create_node.jstree create.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis.sort(data.rslt.obj.parent());\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"move_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tvar m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;\n\t\t\t\t\t\tthis.sort(m.children(\"ul\"));\n\t\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },\n\t\t_fn : {\n\t\t\tsort : function (obj) {\n\t\t\t\tvar s = this._get_settings().sort,\n\t\t\t\t\tt = this;\n\t\t\t\tobj.append($.makeArray(obj.children(\"li\")).sort($.proxy(s, t)));\n\t\t\t\tobj.find(\"> li > ul\").each(function() { t.sort($(this)); });\n\t\t\t\tthis.clean_node(obj);\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree DND plugin\n * Drag and drop plugin for moving/copying nodes\n */\n(function ($) {\n\tvar o = false,\n\t\tr = false,\n\t\tm = false,\n\t\tml = false,\n\t\tsli = false,\n\t\tsti = false,\n\t\tdir1 = false,\n\t\tdir2 = false,\n\t\tlast_pos = false;\n\t$.vakata.dnd = {\n\t\tis_down : false,\n\t\tis_drag : false,\n\t\thelper : false,\n\t\tscroll_spd : 10,\n\t\tinit_x : 0,\n\t\tinit_y : 0,\n\t\tthreshold : 5,\n\t\thelper_left : 5,\n\t\thelper_top : 10,\n\t\tuser_data : {},\n\n\t\tdrag_start : function (e, data, html) {\n\t\t\tif($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }\n\t\t\ttry {\n\t\t\t\te.currentTarget.unselectable = \"on\";\n\t\t\t\te.currentTarget.onselectstart = function() { return false; };\n\t\t\t\tif(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = \"none\"; }\n\t\t\t} catch(err) { }\n\t\t\t$.vakata.dnd.init_x = e.pageX;\n\t\t\t$.vakata.dnd.init_y = e.pageY;\n\t\t\t$.vakata.dnd.user_data = data;\n\t\t\t$.vakata.dnd.is_down = true;\n\t\t\t$.vakata.dnd.helper = $(\"<div id='vakata-dragged' />\").html(html);
2 //.fadeTo(10,0.25);\n\t\t\t$(document).bind(\"mousemove\", $.vakata.dnd.drag);\n\t\t\t$(document).bind(\"mouseup\", $.vakata.dnd.drag_stop);\n\t\t\treturn false;\n\t\t},\n\t\tdrag : function (e) {\n\t\t\tif(!$.vakata.dnd.is_down) { return; }\n\t\t\tif(!$.vakata.dnd.is_drag) {\n\t\t\t\tif(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {\n\t\t\t\t\t$.vakata.dnd.helper.appendTo(\"body\");\n\t\t\t\t\t$.vakata.dnd.is_drag = true;\n\t\t\t\t\t$(document).triggerHandler(\"drag_start.vakata\", { \"event\" : e, \"data\" : $.vakata.dnd.user_data });\n\t\t\t\t}\n\t\t\t\telse { return; }\n\t\t\t}\n\n\t\t\t// maybe use a scrolling parent element instead of document?\n\t\t\tif(e.type === \"mousemove\") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a\n\t\t\t\tvar d = $(document), t = d.scrollTop(), l = d.scrollLeft();\n\t\t\t\tif(e.pageY - t < 20) {\n\t\t\t\t\tif(sti && dir1 === \"down\") { clearInterval(sti); sti = false; }\n\t\t\t\t\tif(!sti) { dir1 = \"up\"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(sti && dir1 === \"up\") { clearInterval(sti); sti = false; }\n\t\t\t\t}\n\t\t\t\tif($(window).height() - (e.pageY - t) < 20) {\n\t\t\t\t\tif(sti && dir1 === \"up\") { clearInterval(sti); sti = false; }\n\t\t\t\t\tif(!sti) { dir1 = \"down\"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(sti && dir1 === \"down\") { clearInterval(sti); sti = false; }\n\t\t\t\t}\n\n\t\t\t\tif(e.pageX - l < 20) {\n\t\t\t\t\tif(sli && dir2 === \"right\") { clearInterval(sli); sli = false; }\n\t\t\t\t\tif(!sli) { dir2 = \"left\"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(sli && dir2 === \"left\") { clearInterval(sli); sli = false; }\n\t\t\t\t}\n\t\t\t\tif($(window).width() - (e.pageX - l) < 20) {\n\t\t\t\t\tif(sli && dir2 === \"left\") { clearInterval(sli); sli = false; }\n\t\t\t\t\tif(!sli) { dir2 = \"right\"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(sli && dir2 === \"right\") { clearInterval(sli); sli = false; }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$.vakata.dnd.helper.css({ left : (e.pageX + $.vakata.dnd.helper_left) + \"px\", top : (e.pageY + $.vakata.dnd.helper_top) + \"px\" });\n\t\t\t$(document).triggerHandler(\"drag.vakata\", { \"event\" : e, \"data\" : $.vakata.dnd.user_data });\n\t\t},\n\t\tdrag_stop : function (e) {\n\t\t\tif(sli) { clearInterval(sli); }\n\t\t\tif(sti) { clearInterval(sti); }\n\t\t\t$(document).unbind(\"mousemove\", $.vakata.dnd.drag);\n\t\t\t$(document).unbind(\"mouseup\", $.vakata.dnd.drag_stop);\n\t\t\t$(document).triggerHandler(\"drag_stop.vakata\", { \"event\" : e, \"data\" : $.vakata.dnd.user_data });\n\t\t\t$.vakata.dnd.helper.remove();\n\t\t\t$.vakata.dnd.init_x = 0;\n\t\t\t$.vakata.dnd.init_y = 0;\n\t\t\t$.vakata.dnd.user_data = {};\n\t\t\t$.vakata.dnd.is_down = false;\n\t\t\t$.vakata.dnd.is_drag = false;\n\t\t}\n\t};\n\t$(function() {\n\t\tvar css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"vakata\" });\n\t});\n\n\t$.jstree.plugin(\"dnd\", {\n\t\t__init : function () {\n\t\t\tthis.data.dnd = {\n\t\t\t\tactive : false,\n\t\t\t\tafter : false,\n\t\t\t\tinside : false,\n\t\t\t\tbefore : false,\n\t\t\t\toff : false,\n\t\t\t\tprepared : false,\n\t\t\t\tw : 0,\n\t\t\t\tto1 : false,\n\t\t\t\tto2 : false,\n\t\t\t\tcof : false,\n\t\t\t\tcw : false,\n\t\t\t\tch : false,\n\t\t\t\ti1 : false,\n\t\t\t\ti2 : false,\n\t\t\t\tmto : false\n\t\t\t};\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"mouseenter.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tif(this.data.themes) {\n\t\t\t\t\t\t\t\tm.attr(\"class\", \"jstree-\" + this.data.themes.theme);\n\t\t\t\t\t\t\t\tif(ml) { ml.attr(\"class\", \"jstree-\" + this.data.themes.theme); }\n\t\t\t\t\t\t\t\t$.vakata.dnd.helper.attr(\"class\", \"jstree-dnd-helper jstree-\" + this.data.themes.theme);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//if($(e.currentTarget).find(\"> ul > li\").length === 0) {\n\t\t\t\t\t\t\tif(e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(\".jstree:eq(0)\")[0] !== e.target) { // node should not be from the same tree\
2n\t\t\t\t\t\t\t\tvar tr = $.jstree._reference(e.target), dc;\n\t\t\t\t\t\t\t\tif(tr.data.dnd.foreign) {\n\t\t\t\t\t\t\t\t\tdc = tr._get_settings().dnd.drag_check.call(this, { \"o\" : o, \"r\" : tr.get_container(), is_root : true });\n\t\t\t\t\t\t\t\t\tif(dc === true || dc.inside === true || dc.before === true || dc.after === true) {\n\t\t\t\t\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-ok\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\ttr.prepare_move(o, tr.get_container(), \"last\");\n\t\t\t\t\t\t\t\t\tif(tr.check_move()) {\n\t\t\t\t\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-ok\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"mouseup.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\t//if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && $(e.currentTarget).find(\"> ul > li\").length === 0) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(\".jstree:eq(0)\")[0] !== e.target) { // node should not be from the same tree\n\t\t\t\t\t\t\tvar tr = $.jstree._reference(e.currentTarget), dc;\n\t\t\t\t\t\t\tif(tr.data.dnd.foreign) {\n\t\t\t\t\t\t\t\tdc = tr._get_settings().dnd.drag_check.call(this, { \"o\" : o, \"r\" : tr.get_container(), is_root : true });\n\t\t\t\t\t\t\t\tif(dc === true || dc.inside === true || dc.before === true || dc.after === true) {\n\t\t\t\t\t\t\t\t\ttr._get_settings().dnd.drag_finish.call(this, { \"o\" : o, \"r\" : tr.get_container(), is_root : true });\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\ttr.move_node(o, tr.get_container(), \"last\", e[tr._get_settings().dnd.copy_modifier + \"Key\"]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"mouseleave.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === \"jstree-marker-line\") {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tif(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\n\t\t\t\t\t\t\tif(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\n\t\t\t\t\t\t\tif(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }\n\t\t\t\t\t\t\tif(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }\n\t\t\t\t\t\t\tif($.vakata.dnd.helper.children(\"ins\").hasClass(\"jstree-ok\")) {\n\t\t\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-invalid\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"mousemove.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tvar cnt = this.get_container()[0];\n\n\t\t\t\t\t\t\t// Horizontal scroll\n\t\t\t\t\t\t\tif(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {\n\t\t\t\t\t\t\t\tif(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\n\t\t\t\t\t\t\t\tthis.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(e.pageX - 24 < this.data.dnd.cof.left) {\n\t\t\t\t\t\t\t\tif(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\n\t\t\t\t\t\t\t\tthis.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Vertical scroll\n\t\t\t\t\t\t\tif(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {\n\t\t\t\t\t\t\t\tif(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\n\t\t\t\t\t\t\t\tthis.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(e.pageY - 24 < this.data.dnd.cof.top) {\n\t\t\t\t\t\t\t\tif(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\n\t\t\t\t\t\t\t\tthis.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"scroll.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && m && ml) {\n\t\t\t\t\t\t\tm.hide();\n\t\t\t\t\t\t\tml.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mousedown.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif(e.which === 1) {\n\t\t\t\t\t\t\tthis.start_drag(e.currentTarget, e);\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mouseenter.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tthis.dnd_enter(e.currentTarget);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mousemove.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tif(!r || !r.length || r.children(\"a\")[0] !== e.currentTarget) {\n\t\t\t\t\t\t\t\tthis.dnd_enter(e.currentTarget);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(typeof this.data.dnd.off.top === \"undefined\") { this.data.dnd.off = $(e.target).offset(); }\n\t\t\t\t\t\t\tthis.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;\n\t\t\t\t\t\t\tif(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }\n\t\t\t\t\t\t\tthis.dnd_show();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mouseleave.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tif(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === \"jstree-marker-line\") {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(m) { m.hide(); }\n\t\t\t\t\t\t\t\tif(ml) { ml.hide(); }\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\tvar ec = $(e.currentTarget).closest(\"li\"),\n\t\t\t\t\t\t\t\ter = $(e.relatedTarget).closest(\"li\");\n\t\t\t\t\t\t\tif(er[0] !== ec.prev()[0] && er[0] !== ec.next()[0]) {\n\t\t\t\t\t\t\t\tif(m) { m.hide(); }\n\t\t\t\t\t\t\t\tif(ml) { ml.hide(); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tthis.data.dnd.mto = setTimeout(\n\t\t\t\t\t\t\t\t(function (t) { return function () { t.dnd_leave(e); }; })(this),\n\t\t\t\t\t\t\t0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"mouseup.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\n\t\t\t\t\t\t\tthis.dnd_finish(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\n\t\t\t$(document)\n\t\t\t\t.bind(\"drag_stop.vakata\", $.proxy(function () {\n\t\t\t\t\t\tif(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }\n\t\t\t\t\t\tif(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }\n\t\t\t\t\t\tif(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\n\t\t\t\t\t\tif(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\n\t\t\t\t\t\tthis.data.dnd.after\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.before\t= false;\n\t\t\t\t\t\tthis.data.dnd.inside\t= false;\n\t\t\t\t\t\tthis.data.dnd.off\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.prepared\t= false;\n\t\t\t\t\t\tthis.data.dnd.w\t\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.to1\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.to2\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.i1\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.i2\t\t= false;\n\t\t\t\t\t\tthis.data.dnd.active\t= false;\n\t\t\t\t\t\tthis.data.dnd.foreign\t= false;\n\t\t\t\t\t\tif(m) { m.css({ \"top\" : \"-2000px\" }); }\n\t\t\t\t\t\tif(ml) { ml.css({ \"top\" : \"-2000px\" }); }\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"drag_start.vakata\", $.proxy(function (e, data) {\n\t\t\t\t\t\tif(data.data.jstree) {\n\t\t\t\t\t\t\tvar et = $(data.event.target);\n\t\t\t\t\t\t\tif(et.closest(\".jstree\").hasClass(\"jstree-\" + this.get_index())) {\n\t\t\t\t\t\t\t\tthis.dnd_enter(et);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\t\t\t\t/*\n\t\t\t\t.bind(\"keydown.jstree-\" + this.get_index() + \" keyup.jstree-\" + this.get_index(), $.proxy(function(e) {\n\t\t\t\t\t\tif($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && !this.data.dnd.foreign) {\n\t\t\t\t\t\t\tvar h = $.vakata.dnd.helper.children(\"ins\");\n\t\t\t\t\t\t\tif(e[this._get_settings().dnd.copy_modifier + \"Key\"] && h.hasClass(\"jstree-ok\")) {\n\t\t\t\t\t\t\t\th.parent().html(h.parent().html().replace(/ \\(Copy\\)$/, \"\") + \" (Copy)\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\th.parent().html(h.parent().html().replace(/ \\(Copy\\)$/, \"\"));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this)); */\n\n\n\n\t\t\tvar s = this._get_settings().dnd;\n\t\t\tif(s.drag_target) {\n\t\t\t\t$(document)\n\t\t\t\t\t.delegate(s.drag_target, \"mousedown.jstree-\" + this.get_index(), $.proxy(function (e) {\n\t\t\t\t\t\to = e.target;\n\t\t\t\t\t\t$.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, \"<ins class='jstree-icon'></ins>\" + $(e.target).text() );\n\t\t\t\t\t\tif(this.data.themes) {\n\t\t\t\t\t\t\tif(m) { m.attr(\"class\", \"jstree-\" + this.data.themes.theme); }\n\t\t\t\t\t\t\tif(ml) { ml.attr(\"class\", \"jstree-\" + this.data.themes.theme); }\n\t\t\t\t\t\t\t$.vakata.dnd.helper.attr(\"class\", \"jstree-dnd-helper jstree-\" + this.data.themes.theme);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-invalid\");\n\t\t\t\t\t\tvar cnt = this.get_container();\n\t\t\t\t\t\tthis.data.dnd.cof = cnt.offset();\n\t\t\t\t\t\tthis.data.dnd.cw = parseInt(cnt.width(),10);\n\t\t\t\t\t\tthis.data.dnd.ch = parseInt(cnt.height(),10);\n\t\t\t\t\t\tthis.data.dnd.foreign = true;\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}, this));\n\t\t\t}\n\t\t\tif(s.drop_target) {\n\t\t\t\t$(document)\n\t\t\t\t\t.delegate(s.drop_target, \"mouseenter.jstree-\" + this.get_index(), $.proxy(function (e) {\n\t\t\t\t\t\t\tif(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { \"o\" : o, \"r\" : $(e.target), \"e\" : e })) {\n\t\t\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-ok\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, this))\n\t\t\t\t\t.delegate(s.drop_target, \"mouseleave.jstree-\" + this.get_index(), $.proxy(function (e) {\n\t\t\t\t\t\t\tif(this.data.dnd.active) {\n\t\t\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-invalid\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, this))\n\t\t\t\t\t.delegate(s.drop_target, \"mouseup.jstree-\" + this.get_index(), $.proxy(function (e) {\n\t\t\t\t\t\t\tif(this.data.dnd.active && $.vakata.dnd.helper.children(\"ins\").hasClass(\"jstree-ok\")) {\n\t\t\t\t\t\t\t\tthis._get_settings().dnd.drop_finish.call(this, { \"o\" : o, \"r\" : $(e.target), \"e\" : e });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, this));\n\t\t\t}\n\t\t},\n\t\tdefaults : {\n\t\t\tcopy_modifier\t: \"ctrl\",\n\t\t\tcheck_timeout\t: 100,\n\t\t\topen_timeout\t: 500,\n\t\t\tdrop_target\t\t: \".jstree-drop\",\n\t\t\tdrop_check\t\t: function (data) { return true; },\n\t\t\tdrop_finish\t\t: $.noop,\n\t\t\tdrag_target\t\t: \".jstree-draggable\",\n\t\t\tdrag_finish\t\t: $.noop,\n\t\t\tdrag_check\t\t: function (data) { return { after : false, before : false, inside : true }; }\n\t\t},\n\t\t_fn : {\n\t\t\tdnd_prepare : function () {\n\t\t\t\tif(!r || !r.length) { return; }\n\t\t\t\tthis.data.dnd.off = r.offset();\n\t\t\t\tif(this._get_settings().core.rtl) {\n\t\t\t\t\tthis.data.dnd.off.right = this.data.dnd.off.left + r.width();\n\t\t\t\t}\n\t\t\t\tif(this.data.dnd.foreign) {\n\t\t\t\t\tvar a = this._get_settings().dnd.drag_check.call(this, { \"o\" : o, \"r\" : r });\n\t\t\t\t\tthis.data.dnd.after = a.after;\n\t\t\t\t\tthis.data.dnd.before = a.before;\n\t\t\t\t\tthis.data.dnd.inside = a.inside;\n\t\t\t\t\tthis.data.dnd.prepared = true;\n\t\t\t\t\treturn this.dnd_show();\n\t\t\t\t}\n\t\t\t\tthis.prepare_move(o, r, \"before\");\n\t\t\t\tthis.data.dnd.before = this.check_move();\n\t\t\t\tthis.prepare_move(o, r, \"after\");\n\t\t\t\tthis.data.dnd.after = this.check_move();
2\n\t\t\t\tif(this._is_loaded(r)) {\n\t\t\t\t\tthis.prepare_move(o, r, \"inside\");\n\t\t\t\t\tthis.data.dnd.inside = this.check_move();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.data.dnd.inside = false;\n\t\t\t\t}\n\t\t\t\tthis.data.dnd.prepared = true;\n\t\t\t\treturn this.dnd_show();\n\t\t\t},\n\t\t\tdnd_show : function () {\n\t\t\t\tif(!this.data.dnd.prepared) { return; }\n\t\t\t\tvar o = [\"before\",\"inside\",\"after\"],\n\t\t\t\t\tr = false,\n\t\t\t\t\trtl = this._get_settings().core.rtl,\n\t\t\t\t\tpos;\n\t\t\t\tif(this.data.dnd.w < this.data.core.li_height/3) { o = [\"before\",\"inside\",\"after\"]; }\n\t\t\t\telse if(this.data.dnd.w <= this.data.core.li_height*2/3) {\n\t\t\t\t\to = this.data.dnd.w < this.data.core.li_height/2 ? [\"inside\",\"before\",\"after\"] : [\"inside\",\"after\",\"before\"];\n\t\t\t\t}\n\t\t\t\telse { o = [\"after\",\"inside\",\"before\"]; }\n\t\t\t\t$.each(o, $.proxy(function (i, val) {\n\t\t\t\t\tif(this.data.dnd[val]) {\n\t\t\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-ok\");\n\t\t\t\t\t\tr = val;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}, this));\n\t\t\t\tif(r === false) { $.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-invalid\"); }\n\n\t\t\t\tpos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);\n\t\t\t\tswitch(r) {\n\t\t\t\t\tcase \"before\":\n\t\t\t\t\t\tm.css({ \"left\" : pos + \"px\", \"top\" : (this.data.dnd.off.top - 6) + \"px\" }).show();\n\t\t\t\t\t\tif(ml) { ml.css({ \"left\" : (pos + 8) + \"px\", \"top\" : (this.data.dnd.off.top - 1) + \"px\" }).show(); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"after\":\n\t\t\t\t\t\tm.css({ \"left\" : pos + \"px\", \"top\" : (this.data.dnd.off.top + this.data.core.li_height - 6) + \"px\" }).show();\n\t\t\t\t\t\tif(ml) { ml.css({ \"left\" : (pos + 8) + \"px\", \"top\" : (this.data.dnd.off.top + this.data.core.li_height - 1) + \"px\" }).show(); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"inside\":\n\t\t\t\t\t\tm.css({ \"left\" : pos + ( rtl ? -4 : 4) + \"px\", \"top\" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + \"px\" }).show();\n\t\t\t\t\t\tif(ml) { ml.hide(); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tm.hide();\n\t\t\t\t\t\tif(ml) { ml.hide(); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlast_pos = r;\n\t\t\t\treturn r;\n\t\t\t},\n\t\t\tdnd_open : function () {\n\t\t\t\tthis.data.dnd.to2 = false;\n\t\t\t\tthis.open_node(r, $.proxy(this.dnd_prepare,this), true);\n\t\t\t},\n\t\t\tdnd_finish : function (e) {\n\t\t\t\tif(this.data.dnd.foreign) {\n\t\t\t\t\tif(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {\n\t\t\t\t\t\tthis._get_settings().dnd.drag_finish.call(this, { \"o\" : o, \"r\" : r, \"p\" : last_pos });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.dnd_prepare();\n\t\t\t\t\tthis.move_node(o, r, last_pos, e[this._get_settings().dnd.copy_modifier + \"Key\"]);\n\t\t\t\t}\n\t\t\t\to = false;\n\t\t\t\tr = false;\n\t\t\t\tm.hide();\n\t\t\t\tif(ml) { ml.hide(); }\n\t\t\t},\n\t\t\tdnd_enter : function (obj) {\n\t\t\t\tif(this.data.dnd.mto) {\n\t\t\t\t\tclearTimeout(this.data.dnd.mto);\n\t\t\t\t\tthis.data.dnd.mto = false;\n\t\t\t\t}\n\t\t\t\tvar s = this._get_settings().dnd;\n\t\t\t\tthis.data.dnd.prepared = false;\n\t\t\t\tr = this._get_node(obj);\n\t\t\t\tif(s.check_timeout) {\n\t\t\t\t\t// do the calculations after a minimal timeout (users tend to drag quickly to the desired location)\n\t\t\t\t\tif(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }\n\t\t\t\t\tthis.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.dnd_prepare();\n\t\t\t\t}\n\t\t\t\tif(s.open_timeout) {\n\t\t\t\t\tif(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }\n\t\t\t\t\tif(r && r.length && r.hasClass(\"jstree-closed\")) {\n\t\t\t\t\t\t// if the node is closed - open it, then recalculate\n\t\t\t\t\t\tthis.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(r && r.length && r.hasClass(\"jstree-closed\")) {\n\t\t\t\t\t\tthis.dnd_open();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tdnd_leave : function (e) {\n\t\t\t\tthis.data.dnd.after\t\t= false;\n\t\t\t\tthis.data.dnd.before\t= false;\n\t\t\t\tthis.data.dnd.inside\t= false;\n\t\t\t\t$.vakata.dnd.helper.children(\"ins\").attr(\"class\",\"jstree-invalid\");\n\t\t\t\tm.hide();\n\t\t\t\tif(ml) { ml.hide(); }\n\t\t\t\tif(r && r[0] === e.target.parentNode) {\n\t\t\t\t\tif(this.data.dnd.to1) {\n\t\t\t\t\t\tclearTimeout(this.data.dnd.to1);\n\t\t\t\t\t\tthis.data.dnd.to1 = false;\n\t\t\t\t\t}\n\t\t\t\t\tif(this.data.dnd.to2) {\n\t\t\t\t\t\tclearTimeout(this.data.dnd.to2);\n\t\t\t\t\t\tthis.data.dnd.to2 = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tstart_drag : function (obj, e) {\n\t\t\t\to = this._get_node(obj);\n\t\t\t\tif(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }\n\t\t\t\tvar dt = o.length > 1 ? this._get_string(\"multiple_selection\") : this.get_text(o),\n\t\t\t\t\tcnt = this.get_container();\n\t\t\t\tif(!this._get_settings().core.html_titles) { dt = dt.replace(/</ig,\"<\").replace(/>/ig,\">\"); }\n\t\t\t\t$.vakata.dnd.drag_start(e, { jstree : true, obj : o }, \"<ins class='jstree-icon'></ins>\" + dt );\n\t\t\t\tif(this.data.themes) {\n\t\t\t\t\tif(m) { m.attr(\"class\", \"jstree-\" + this.data.themes.theme); }\n\t\t\t\t\tif(ml) { ml.attr(\"class\", \"jstree-\" + this.data.themes.theme); }\n\t\t\t\t\t$.vakata.dnd.helper.attr(\"class\", \"jstree-dnd-helper jstree-\" + this.data.themes.theme);\n\t\t\t\t}\n\t\t\t\tthis.data.dnd.cof = cnt.offset();\n\t\t\t\tthis.data.dnd.cw = parseInt(cnt.width(),10);\n\t\t\t\tthis.data.dnd.ch = parseInt(cnt.height(),10);\n\t\t\t\tthis.data.dnd.active = true;\n\t\t\t}\n\t\t}\n\t});
2\n\t$(function() {\n\t\tvar css_string = '' +\n\t\t\t'#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; ' +\n\t\t\t' -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; ' +\n\t\t\t'} ' +\n\t\t\t'#vakata-dragged .jstree-ok { background:green; } ' +\n\t\t\t'#vakata-dragged .jstree-invalid { background:red; } ' +\n\t\t\t'#jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } ' +\n\t\t\t'#jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43; ' +\n\t\t\t' cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666; ' +\n\t\t\t' -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; ' +\n\t\t\t'}' +\n\t\t\t'';\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"jstree\" });\n\t\tm = $(\"<div />\").attr({ id : \"jstree-marker\" }).hide().html(\"»\")\n\t\t\t.bind(\"mouseleave mouseenter\", function (e) {\n\t\t\t\tm.hide();\n\t\t\t\tml.hide();\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopImmediatePropagation();\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.appendTo(\"body\");\n\t\tml = $(\"<div />\").attr({ id : \"jstree-marker-line\" }).hide()\n\t\t\t.bind(\"mouseup\", function (e) {\n\t\t\t\tif(r && r.length) {\n\t\t\t\t\tr.children(\"a\").trigger(e);\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.bind(\"mouseleave\", function (e) {\n\t\t\t\tvar rt = $(e.relatedTarget);\n\t\t\t\tif(rt.is(\".jstree\") || rt.closest(\".jstree\").length === 0) {\n\t\t\t\t\tif(r && r.length) {\n\t\t\t\t\t\tr.children(\"a\").trigger(e);\n\t\t\t\t\t\tm.hide();\n\t\t\t\t\t\tml.hide();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.appendTo(\"body\");\n\t\t$(document).bind(\"drag_start.vakata\", function (e, data) {\n\t\t\tif(data.data.jstree) { m.show(); if(ml) { ml.show(); } }\n\t\t});\n\t\t$(document).bind(\"drag_stop.vakata\", function (e, data) {\n\t\t\tif(data.data.jstree) { m.hide(); if(ml) { ml.hide(); } }\n\t\t});\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree checkbox plugin\n * Inserts checkboxes in front of every node\n * Depends on the ui plugin\n * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP\n */\n(function ($) {\n\t$.jstree.plugin(\"checkbox\", {\n\t\t__init : function () {\n\t\t\tthis.data.checkbox.noui = this._get_settings().checkbox.override_ui;\n\t\t\tif(this.data.ui && this.data.checkbox.noui) {\n\t\t\t\tthis.select_node = this.deselect_node = this.deselect_all = $.noop;\n\t\t\t\tthis.get_selected = this.get_checked;\n\t\t\t}\n\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"open_node.jstree create_node.jstree clean_node.jstree refresh.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._prepare_checkboxes(data.rslt.obj);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"loaded.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tthis._prepare_checkboxes();\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate( (this.data.ui && this.data.checkbox.noui ? \"a\" : \"ins.jstree-checkbox\") , \"click.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tif(this._get_node(e.target).hasClass(\"jstree-checked\")) { this.uncheck_node(e.target); }\n\t\t\t\t\t\telse { this.check_node(e.target); }\n\t\t\t\t\t\tif(this.data.ui && this.data.checkbox.noui) {\n\t\t\t\t\t\t\tthis.save_selected();\n\t\t\t\t\t\t\tif(this.data.cookies) { this.save_cookie(\"select_node\"); }\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : {\n\t\t\toverride_ui : false,\n\t\t\ttwo_state : false,\n\t\t\treal_checkboxes : false,\n\t\t\tchecked_parent_open : true,\n\t\t\treal_checkboxes_names : function (n) { return [ (\"check_\" + (n[0].id || Math.ceil(Math.random() * 10000))) , 1]; }\n\t\t},\n\t\t__destroy : function () {\n\t\t\tthis.get_container()\n\t\t\t\t.find(\"input.jstree-real-checkbox\").removeClass(\"jstree-real-checkbox\").end()\n\t\t\t\t.find(\"ins.jstree-checkbox\").remove();\n\t\t},\n\t\t_fn : {\n\t\t\t_checkbox_notify : function (n, data) {\n\t\t\t\tif(data.checked) {\n\t\t\t\t\tthis.check_node(n, false);\n\t\t\t\t}\n\t\t\t},\n\t\t\t_prepare_checkboxes : function (obj) {\n\t\t\t\tobj = !obj || obj == -1 ? this.get_container().find(\"> ul > li\") : this._get_node(obj);\n\t\t\t\tif(obj === false) { return; } // added for removing root nodes\n\t\t\t\tvar c, _this = this, t, ts = this._get_settings().checkbox.tw
2o_state, rc = this._get_settings().checkbox.real_checkboxes, rcn = this._get_settings().checkbox.real_checkboxes_names;\n\t\t\t\tobj.each(function () {\n\t\t\t\t\tt = $(this);\n\t\t\t\t\tc = t.is(\"li\") && (t.hasClass(\"jstree-checked\") || (rc && t.children(\":checked\").length)) ? \"jstree-checked\" : \"jstree-unchecked\";\n\t\t\t\t\tt.find(\"li\").addBack().each(function () {\n\t\t\t\t\t\tvar $t = $(this), nm;\n\t\t\t\t\t\t$t.children(\"a\" + (_this.data.languages ? \"\" : \":eq(0)\") ).not(\":has(.jstree-checkbox)\").prepend(\"<ins class='jstree-checkbox'> </ins>\").parent().not(\".jstree-checked, .jstree-unchecked\").addClass( ts ? \"jstree-unchecked\" : c );\n\t\t\t\t\t\tif(rc) {\n\t\t\t\t\t\t\tif(!$t.children(\":checkbox\").length) {\n\t\t\t\t\t\t\t\tnm = rcn.call(_this, $t);\n\t\t\t\t\t\t\t\t$t.prepend(\"<input type='checkbox' class='jstree-real-checkbox' id='\" + nm[0] + \"' name='\" + nm[0] + \"' value='\" + nm[1] + \"' />\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t$t.children(\":checkbox\").addClass(\"jstree-real-checkbox\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!ts) {\n\t\t\t\t\t\t\tif(c === \"jstree-checked\" || $t.hasClass(\"jstree-checked\") || $t.children(':checked').length) {\n\t\t\t\t\t\t\t\t$t.find(\"li\").addBack().addClass(\"jstree-checked\").children(\":checkbox\").prop(\"checked\", true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif($t.hasClass(\"jstree-checked\") || $t.children(':checked').length) {\n\t\t\t\t\t\t\t\t$t.addClass(\"jstree-checked\").children(\":checkbox\").prop(\"checked\", true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tif(!ts) {\n\t\t\t\t\tobj.find(\".jstree-checked\").parent().parent().each(function () { _this._repair_state(this); });\n\t\t\t\t}\n\t\t\t},\n\t\t\tchange_state : function (obj, state) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar coll = false, rc = this._get_settings().checkbox.real_checkboxes;\n\t\t\t\tif(!obj || obj === -1) { return false; }\n\t\t\t\tstate = (state === false || state === true) ? state : obj.hasClass(\"jstree-checked\");\n\t\t\t\tif(this._get_settings().checkbox.two_state) {\n\t\t\t\t\tif(state) {\n\t\t\t\t\t\tobj.removeClass(\"jstree-checked\").addClass(\"jstree-unchecked\");\n\t\t\t\t\t\tif(rc) { obj.children(\":checkbox\").prop(\"checked\", false); }\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tobj.removeClass(\"jstree-unchecked\").addClass(\"jstree-checked\");\n\t\t\t\t\t\tif(rc) { obj.children(\":checkbox\").prop(\"checked\", true); }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(state) {\n\t\t\t\t\t\tcoll = obj.find(\"li\").addBack();\n\t\t\t\t\t\tif(!coll.filter(\".jstree-checked, .jstree-undetermined\").length) { return false; }\n\t\t\t\t\t\tcoll.removeClass(\"jstree-checked jstree-undetermined\").addClass(\"jstree-unchecked\");\n\t\t\t\t\t\tif(rc) { coll.children(\":checkbox\").prop(\"checked\", false); }\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcoll = obj.find(\"li\").addBack();\n\t\t\t\t\t\tif(!coll.filter(\".jstree-unchecked, .jstree-undetermined\").length) { return false; }\n\t\t\t\t\t\tcoll.removeClass(\"jstree-unchecked jstree-undetermined\").addClass(\"jstree-checked\");\n\t\t\t\t\t\tif(rc) { coll.children(\":checkbox\").prop(\"checked\", true); }\n\t\t\t\t\t\tif(this.data.ui) { this.data.ui.last_selected = obj; }\n\t\t\t\t\t\tthis.data.checkbox.last_selected = obj;\n\t\t\t\t\t}\n\t\t\t\t\tobj.parentsUntil(\".jstree\", \"li\").each(function () {\n\t\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\t\tif(state) {\n\t\t\t\t\t\t\tif($this.children(\"ul\").children(\"li.jstree-checked, li.jstree-undetermined\").length) {\n\t\t\t\t\t\t\t\t$this.parentsUntil(\".jstree\", \"li\").addBack().removeClass(\"jstree-checked jstree-unchecked\").addClass(\"jstree-undetermined\");\n\t\t\t\t\t\t\t\tif(rc) { $this.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", false); }\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t$this.removeClass(\"jstree-checked jstree-undetermined\").addClass(\"jstree-unchecked\");\n\t\t\t\t\t\t\t\tif(rc) { $this.children(\":checkbox\").prop(\"checked\", false); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif($this.children(\"ul\").children(\"li.jstree-unchecked, li.jstree-undetermined\").length) {\n\t\t\t\t\t\t\t\t$this.parentsUntil(\".jstree\", \"li\").addBack().removeClass(\"jstree-checked jstree-unchecked\").addClass(\"jstree-undetermined\");\n\t\t\t\t\t\t\t\tif(rc) { $this.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", false); }\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t$this.removeClass(\"jstree-unchecked jstree-undetermined\").addClass(\"jstree-checked\");\n\t\t\t\t\t\t\t\tif(rc) { $this.children(\":checkbox\").prop(\"checked\", true); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(this.data.ui && this.data.checkbox.noui) { this.data.ui.selected = this.get_checked(); }\n\t\t\t\tthis.__callback(obj);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tcheck_node : function (obj) {\n\t\t\t\tif(this.change_state(
2obj, false)) {\n\t\t\t\t\tobj = this._get_node(obj);\n\t\t\t\t\tif(this._get_settings().checkbox.checked_parent_open) {\n\t\t\t\t\t\tvar t = this;\n\t\t\t\t\t\tobj.parents(\".jstree-closed\").each(function () { t.open_node(this, false, true); });\n\t\t\t\t\t}\n\t\t\t\t\tthis.__callback({ \"obj\" : obj });\n\t\t\t\t}\n\t\t\t},\n\t\t\tuncheck_node : function (obj) {\n\t\t\t\tif(this.change_state(obj, true)) { this.__callback({ \"obj\" : this._get_node(obj) }); }\n\t\t\t},\n\t\t\tcheck_all : function () {\n\t\t\t\tvar _this = this,\n\t\t\t\t\tcoll = this._get_settings().checkbox.two_state ? this.get_container_ul().find(\"li\") : this.get_container_ul().children(\"li\");\n\t\t\t\tcoll.each(function () {\n\t\t\t\t\t_this.change_state(this, false);\n\t\t\t\t});\n\t\t\t\tthis.__callback();\n\t\t\t},\n\t\t\tuncheck_all : function () {\n\t\t\t\tvar _this = this,\n\t\t\t\t\tcoll = this._get_settings().checkbox.two_state ? this.get_container_ul().find(\"li\") : this.get_container_ul().children(\"li\");\n\t\t\t\tcoll.each(function () {\n\t\t\t\t\t_this.change_state(this, true);\n\t\t\t\t});\n\t\t\t\tthis.__callback();\n\t\t\t},\n\n\t\t\tis_checked : function(obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\treturn obj.length ? obj.is(\".jstree-checked\") : false;\n\t\t\t},\n\t\t\tget_checked : function (obj, get_all) {\n\t\t\t\tobj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);\n\t\t\t\treturn get_all || this._get_settings().checkbox.two_state ? obj.find(\".jstree-checked\") : obj.find(\"> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked\");\n\t\t\t},\n\t\t\tget_unchecked : function (obj, get_all) {\n\t\t\t\tobj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);\n\t\t\t\treturn get_all || this._get_settings().checkbox.two_state ? obj.find(\".jstree-unchecked\") : obj.find(\"> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked\");\n\t\t\t},\n\n\t\t\tshow_checkboxes : function () { this.get_container().children(\"ul\").removeClass(\"jstree-no-checkboxes\"); },\n\t\t\thide_checkboxes : function () { this.get_container().children(\"ul\").addClass(\"jstree-no-checkboxes\"); },\n\n\t\t\t_repair_state : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj.length) { return; }\n\t\t\t\tif(this._get_settings().checkbox.two_state) {\n\t\t\t\t\tobj.find('li').addBack().not('.jstree-checked').removeClass('jstree-undetermined').addClass('jstree-unchecked').children(':checkbox').prop('checked', true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar rc = this._get_settings().checkbox.real_checkboxes,\n\t\t\t\t\ta = obj.find(\"> ul > .jstree-checked\").length,\n\t\t\t\t\tb = obj.find(\"> ul > .jstree-undetermined\").length,\n\t\t\t\t\tc = obj.find(\"> ul > li\").length;\n\t\t\t\tif(c === 0) { if(obj.hasClass(\"jstree-undetermined\")) { this.change_state(obj, false); } }\n\t\t\t\telse if(a === 0 && b === 0) { this.change_state(obj, true); }\n\t\t\t\telse if(a === c) { this.change_state(obj, false); }\n\t\t\t\telse {\n\t\t\t\t\tobj.parentsUntil(\".jstree\",\"li\").addBack().removeClass(\"jstree-checked jstree-unchecked\").addClass(\"jstree-undetermined\");\n\t\t\t\t\tif(rc) { obj.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", false); }\n\t\t\t\t}\n\t\t\t},\n\t\t\treselect : function () {\n\t\t\t\tif(this.data.ui && this.data.checkbox.noui) {\n\t\t\t\t\tvar _this = this,\n\t\t\t\t\t\ts = this.data.ui.to_select;\n\t\t\t\t\ts = $.map($.makeArray(s), function (n) { return \"#\" + n.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\"); });\n\t\t\t\t\tthis.deselect_all();\n\t\t\t\t\t$.each(s, function (i, val) { _this.check_node(val); });\n\t\t\t\t\tthis.__callback();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.__call_old();\n\t\t\t\t}\n\t\t\t},\n\t\t\tsave_loaded : function () {\n\t\t\t\tvar _this = this;\n\t\t\t\tthis.data.core.to_load = [];\n\t\t\t\tthis.get_container_ul().find(\"li.jstree-closed.jstree-undetermined\").each(function () {\n\t\t\t\t\tif(this.id
2) { _this.data.core.to_load.push(\"#\" + this.id); }\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\t$(function() {\n\t\tvar css_string = '.jstree .jstree-real-checkbox { display:none; } ';\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"jstree\" });\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree XML plugin\n * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.\n */\n(function ($) {\n\t$.vakata.xslt = function (xml, xsl, callback) {\n\t\tvar rs = \"\", xm, xs, processor, support;\n\t\t// TODO: IE9 no XSLTProcessor, no document.recalc\n\t\tif(document.recalc) {\n\t\t\txm = document.createElement('xml');\n\t\t\txs = document.createElement('xml');\n\t\t\txm.innerHTML = xml;\n\t\t\txs.innerHTML = xsl;\n\t\t\t$(\"body\").append(xm).append(xs);\n\t\t\tsetTimeout( (function (xm, xs, callback) {\n\t\t\t\treturn function () {\n\t\t\t\t\tcallback.call(null, xm.transformNode(xs.XMLDocument));\n\t\t\t\t\tsetTimeout( (function (xm, xs) { return function () { $(xm).remove(); $(xs).remove(); }; })(xm, xs), 200);\n\t\t\t\t};\n\t\t\t})(xm, xs, callback), 100);\n\t\t\treturn true;\n\t\t}\n\t\tif(typeof window.DOMParser !== \"undefined\" && typeof window.XMLHttpRequest !== \"undefined\" && typeof window.XSLTProcessor === \"undefined\") {\n\t\t\txml = new DOMParser().parseFromString(xml, \"text/xml\");\n\t\t\txsl = new DOMParser().parseFromString(xsl, \"text/xml\");\n\t\t\t// alert(xml.transformNode());\n\t\t\t// callback.call(null, new XMLSerializer().serializeToString(rs));\n\n\t\t}\n\t\tif(typeof window.DOMParser !== \"undefined\" && typeof window.XMLHttpRequest !== \"undefined\" && typeof window.XSLTProcessor !== \"undefined\") {\n\t\t\tprocessor = new XSLTProcessor();\n\t\t\tsupport = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== \"undefined\") : true;\n\t\t\tif(!support) { return false; }\n\t\t\txml = new DOMParser().parseFromString(xml, \"text/xml\");\n\t\t\txsl = new DOMParser().parseFromString(xsl, \"text/xml\");\n\t\t\tif($.isFunction(processor.transformDocument)) {\n\t\t\t\trs = document.implementation.createDocument(\"\", \"\", null);\n\t\t\t\tprocessor.transformDocument(xml, xsl, rs, null);\n\t\t\t\tcallback.call(null, new XMLSerializer().serializeToString(rs));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tprocessor.importStylesheet(xsl);\n\t\t\t\trs = processor.transformToFragment(xml, document);\n\t\t\t\tcallback.call(null, $(\"<div />\").append(rs).html());\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\tvar xsl = {\n\t\t'nest' : '<' + '?xml version=\"1.0\" encoding=\"utf-8\" ?>' +\n\t\t\t'<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" >' +\n\t\t\t'<xsl:output method=\"html\" encoding=\"utf-8\" omit-xml-declaration=\"yes\" standalone=\"no\" indent=\"no\" media-type=\"text/html\" />' +\n\t\t\t'<xsl:template match=\"/\">' +\n\t\t\t'\t<xsl:call-template name=\"nodes\">' +\n\t\t\t'\t\t<xsl:with-param name=\"node\" select=\"/root\" />' +\n\t\t\t'\t</xsl:call-template>' +\n\t\t\t'</xsl:template>' +\n\t\t\t'<xsl:template name=\"nodes\">' +\n\t\t\t'\t<xsl:param name=\"node\" />' +\n\t\t\t'\t<ul>' +\n\t\t\t'\t<xsl:for-each select=\"$node/item\">' +\n\t\t\t'\t\t<xsl:variable name=\"children\" select=\"count(./item) > 0\" />' +\n\t\t\t'\t\t<li>' +\n\t\t\t'\t\t\t<xsl:attribute name=\"class\">' +\n\t\t\t'\t\t\t\t<xsl:if test=\"position() = last()\">jstree-last </xsl:if>' +\n\t\t\t'\t\t\t\t<xsl:choose>' +\n\t\t\t'\t\t\t\t\t<xsl:when test=\"@state = \\'open\\'\">jstree-open </xsl:when>' +\n\t\t\t'\t\t\t\t\t<xsl:when test=\"$children or @hasChildren or @state = \\'closed\\'\">jstree-closed </xsl:when>' +\n\t\t\t'\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>' +\n\t\t\t'\t\t\t\t</xsl:choose>' +\n\t\t\t'\t\t\t\t<xsl:value-of select=\"@class\" />' +\n\t\t\t'\t\t\t</xsl:attribute>' +\n\t\t\t'\t\t\t<xsl:for-each select=\"@*\">' +\n\t\t\t'\t\t\t\t<xsl:if test=\"name() != \\'class\\' and name() != \\'state\\' and name() != \\'hasChildren\\'\">' +\n\t\t\t'\t\t\t\t\t<xsl:attribute name=\"{name()}\"><xsl:value-of select=\".\" /></xsl:attribute>' +\n\t\t\t'\t\t\t\t</xsl:if>' +\n\t\t\t'\t\t\t</xsl:for-each>' +\n\t\t\t'\t<ins class=\"jstree-icon\"><xsl:text> </xsl:text></ins>' +\n\t\t\t'\t\t\t<xsl:for-each select=\"content/name\">' +\n\t\t\t'\t\t\t\t<a>' +\n\t\t\t'\t\t\t\t<xsl:attribute name=\"href\">' +\n\t\t\t'\t\t\t\t\t<xsl:choose>' +\n\t\t\t'\t\t\t\t\t<xsl:when test=\"@href\"><xsl:value-of select=\"@href\" /></xsl:when>' +\n\t\t\t'\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>' +\n\t\t\t'\t\t\t\t\t</xsl:choose>' +\n\t\t\t'\t\t\t\t</xsl:attribute>' +\n\t\t\t'\t\t\t\t<xsl:attribute name=\"class\"><xsl:value-of select=\"@lang\" /> <xsl:value-of select=\"@class\" />
2</xsl:attribute>' +\n\t\t\t'\t\t\t\t<xsl:attribute name=\"style\"><xsl:value-of select=\"@style\" /></xsl:attribute>' +\n\t\t\t'\t\t\t\t<xsl:for-each select=\"@*\">' +\n\t\t\t'\t\t\t\t\t<xsl:if test=\"name() != \\'style\\' and name() != \\'class\\' and name() != \\'href\\'\">' +\n\t\t\t'\t\t\t\t\t\t<xsl:attribute name=\"{name()}\"><xsl:value-of select=\".\" /></xsl:attribute>' +\n\t\t\t'\t\t\t\t\t</xsl:if>' +\n\t\t\t'\t\t\t\t</xsl:for-each>' +\n\t\t\t'\t\t\t\t\t<ins>' +\n\t\t\t'\t\t\t\t\t\t<xsl:attribute name=\"class\">jstree-icon ' +\n\t\t\t'\t\t\t\t\t\t\t<xsl:if test=\"string-length(attribute::icon) > 0 and not(contains(@icon,\\'/\\'))\"><xsl:value-of select=\"@icon\" /></xsl:if>' +\n\t\t\t'\t\t\t\t\t\t</xsl:attribute>' +\n\t\t\t'\t\t\t\t\t\t<xsl:if test=\"string-length(attribute::icon) > 0 and contains(@icon,\\'/\\')\"><xsl:attribute name=\"style\">background:url(<xsl:value-of select=\"@icon\" />) center center no-repeat;</xsl:attribute></xsl:if>' +\n\t\t\t'\t\t\t\t\t\t<xsl:text> </xsl:text>' +\n\t\t\t'\t\t\t\t\t</ins>' +\n\t\t\t'\t\t\t\t\t<xsl:copy-of select=\"./child::node()\" />' +\n\t\t\t'\t\t\t\t</a>' +\n\t\t\t'\t\t\t</xsl:for-each>' +\n\t\t\t'\t\t\t<xsl:if test=\"$children or @hasChildren\"><xsl:call-template name=\"nodes\"><xsl:with-param name=\"node\" select=\"current()\" /></xsl:call-template></xsl:if>' +\n\t\t\t'\t\t</li>' +\n\t\t\t'\t</xsl:for-each>' +\n\t\t\t'\t</ul>' +\n\t\t\t'</xsl:template>' +\n\t\t\t'</xsl:stylesheet>',\n\n\t\t'flat' : '<' + '?xml version=\"1.0\" encoding=\"utf-8\" ?>' +\n\t\t\t'<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" >' +\n\t\t\t'<xsl:output method=\"html\" encoding=\"utf-8\" omit-xml-declaration=\"yes\" standalone=\"no\" indent=\"no\" media-type=\"text/xml\" />' +\n\t\t\t'<xsl:template match=\"/\">' +\n\t\t\t'\t<ul>' +\n\t\t\t'\t<xsl:for-each select=\"//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]\">' + /* the last `or` may be removed */\n\t\t\t'\t\t<xsl:call-template name=\"nodes\">' +\n\t\t\t'\t\t\t<xsl:with-param name=\"node\" select=\".\" />' +\n\t\t\t'\t\t\t<xsl:with-param name=\"is_last\" select=\"number(position() = last())\" />' +\n\t\t\t'\t\t</xsl:call-template>' +\n\t\t\t'\t</xsl:for-each>' +\n\t\t\t'\t</ul>' +\n\t\t\t'</xsl:template>' +\n\t\t\t'<xsl:template name=\"nodes\">' +\n\t\t\t'\t<xsl:param name=\"node\" />' +\n\t\t\t'\t<xsl:param name=\"is_last\" />' +\n\t\t\t'\t<xsl:variable name=\"children\" select=\"count(//item[@parent_id=$node/attribute::id]) > 0\" />' +\n\t\t\t'\t<li>' +\n\t\t\t'\t<xsl:attribute name=\"class\">' +\n\t\t\t'\t\t<xsl:if test=\"$is_last = true()\">jstree-last </xsl:if>' +\n\t\t\t'\t\t<xsl:choose>' +\n\t\t\t'\t\t\t<xsl:when test=\"@state = \\'open\\'\">jstree-open </xsl:when>' +\n\t\t\t'\t\t\t<xsl:when test=\"$children or @hasChildren or @state = \\'closed\\'\">jstree-closed </xsl:when>' +\n\t\t\t'\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>' +\n\t\t\t'\t\t</xsl:choose>' +\n\t\t\t'\t\t<xsl:value-of select=\"@class\" />' +\n\t\t\t'\t</xsl:attribute>' +\n\t\t\t'\t<xsl:for-each select=\"@*\">' +\n\t\t\t'\t\t<xsl:if test=\"name() != \\'parent_id\\' and name() != \\'hasChildren\\' and name() != \\'class\\' and name() != \\'state\\'\">' +\n\t\t\t'\t\t<xsl:attribute name=\"{name()}\"><xsl:value-of select=\".\" /></xsl:attribute>' +\n\t\t\t'\t\t</xsl:if>' +\n\t\t\t'\t</xsl:for-each>' +\n\t\t\t'\t<ins class=\"jstree-icon\"><xsl:text> </xsl:text></ins>' +\n\t\t\t'\t<xsl:for-each select=\"content/name\">' +\n\t\t\t'\t\t<a>' +\n\t\t\t'\t\t<xsl:attribute name=\"href\">' +\n\t\t\t'\t\t\t<xsl:choose>' +\n\t\t\t'\t\t\t<xsl:when test=\"@href\"><xsl:value-of select=\"@href\" /></xsl:when>' +\n\t\t\t'\t\t\t<xsl:otherwise>#</xsl:otherwise>' +\n\t\t\t'\t\t\t</xsl:choose>' +\n\t\t\t'\t\t</xsl:attribute>' +\n\t\t\t'\t\t<xsl:attribute name=\"class\"><xsl:value-of select=\"@lang\" /> <xsl:value-of select=\"@class\" />
2</xsl:attribute>' +\n\t\t\t'\t\t<xsl:attribute name=\"style\"><xsl:value-of select=\"@style\" /></xsl:attribute>' +\n\t\t\t'\t\t<xsl:for-each select=\"@*\">' +\n\t\t\t'\t\t\t<xsl:if test=\"name() != \\'style\\' and name() != \\'class\\' and name() != \\'href\\'\">' +\n\t\t\t'\t\t\t\t<xsl:attribute name=\"{name()}\"><xsl:value-of select=\".\" /></xsl:attribute>' +\n\t\t\t'\t\t\t</xsl:if>' +\n\t\t\t'\t\t</xsl:for-each>' +\n\t\t\t'\t\t\t<ins>' +\n\t\t\t'\t\t\t\t<xsl:attribute name=\"class\">jstree-icon ' +\n\t\t\t'\t\t\t\t\t<xsl:if test=\"string-length(attribute::icon) > 0 and not(contains(@icon,\\'/\\'))\"><xsl:value-of select=\"@icon\" /></xsl:if>' +\n\t\t\t'\t\t\t\t</xsl:attribute>' +\n\t\t\t'\t\t\t\t<xsl:if test=\"string-length(attribute::icon) > 0 and contains(@icon,\\'/\\')\"><xsl:attribute name=\"style\">background:url(<xsl:value-of select=\"@icon\" />) center center no-repeat;</xsl:attribute></xsl:if>' +\n\t\t\t'\t\t\t\t<xsl:text> </xsl:text>' +\n\t\t\t'\t\t\t</ins>' +\n\t\t\t'\t\t\t<xsl:copy-of select=\"./child::node()\" />' +\n\t\t\t'\t\t</a>' +\n\t\t\t'\t</xsl:for-each>' +\n\t\t\t'\t<xsl:if test=\"$children\">' +\n\t\t\t'\t\t<ul>' +\n\t\t\t'\t\t<xsl:for-each select=\"//item[@parent_id=$node/attribute::id]\">' +\n\t\t\t'\t\t\t<xsl:call-template name=\"nodes\">' +\n\t\t\t'\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />' +\n\t\t\t'\t\t\t\t<xsl:with-param name=\"is_last\" select=\"number(position() = last())\" />' +\n\t\t\t'\t\t\t</xsl:call-template>' +\n\t\t\t'\t\t</xsl:for-each>' +\n\t\t\t'\t\t</ul>' +\n\t\t\t'\t</xsl:if>' +\n\t\t\t'\t</li>' +\n\t\t\t'</xsl:template>' +\n\t\t\t'</xsl:stylesheet>'\n\t},\n\tescape_xml = function(string) {\n\t\treturn string\n\t\t\t.toString()\n\t\t\t.replace(/&/g, '&')\n\t\t\t.replace(/</g, '<')\n\t\t\t.replace(/>/g, '>')\n\t\t\t.replace(/\"/g, '"')\n\t\t\t.replace(/'/g, ''');\n\t};\n\t$.jstree.plugin(\"xml_data\", {\n\t\tdefaults : {\n\t\t\tdata : false,\n\t\t\tajax : false,\n\t\t\txsl : \"flat\",\n\t\t\tclean_node : false,\n\t\t\tcorrect_state : true,\n\t\t\tget_skip_empty : false,\n\t\t\tget_include_preamble : true\n\t\t},\n\t\t_fn : {\n\t\t\tload_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ \"obj\" : _this._get_node(obj) }); s_call.call(this); }, e_call); },\n\t\t\t_is_loaded : function (obj) {\n\t\t\t\tvar s = this._get_settings().xml_data;\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\treturn obj == -1 || !obj || (!s.ajax && !$.isFunction(s.data)) || obj.is(\".jstree-open, .jstree-leaf\") || obj.children(\"ul\").children(\"li\").size() > 0;\n\t\t\t},\n\t\t\tload_node_xml : function (obj, s_call, e_call) {\n\t\t\t\tvar s = this.get_settings().xml_data,\n\t\t\t\t\terror_func = function () {},\n\t\t\t\t\tsuccess_func = function () {};\n\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\tif(obj.data(\"jstree_is_loading\")) { return; }\n\t\t\t\t\telse { obj.data(\"jstree_is_loading\",true); }\n\t\t\t\t}\n\t\t\t\tswitch(!0) {\n\t\t\t\t\tcase (!s.data && !s.ajax): throw \"Neither data nor ajax settings supplied.\";\n\t\t\t\t\tcase ($.isFunction(s.data)):\n\t\t\t\t\t\ts.data.call(this, obj, $.proxy(function (d) {\n\t\t\t\t\t\t\tthis.parse_xml(d, $.proxy(function (d) {\n\t\t\t\t\t\t\t\tif(d) {\n\t\t\t\t\t\t\t\t\td = d.replace(/ ?xmlns=\"[^\"]*\"/ig, \"\");\n\t\t\t\t\t\t\t\t\tif(d.length > 10) {\n\t\t\t\t\t\t\t\t\t\td = $(d);\n\t\t\t\t\t\t\t\t\t\tif(obj === -1 || !obj) { this.get_container().children(\"ul\").empty().append(d.children()); }\n\t\t\t\t\t\t\t\t\t\telse { obj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\"); obj.append(d); obj.removeData(\"jstree_is_loading\"); }\n\t\t\t\t\t\t\t\t\t\tif(s.clean_node) { this.clean_node(obj); }\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\t\t\tthis.correct_state(
2obj);\n\t\t\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty();\n\t\t\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, this));\n\t\t\t\t\t\t}, this));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):\n\t\t\t\t\t\tif(!obj || obj == -1) {\n\t\t\t\t\t\t\tthis.parse_xml(s.data, $.proxy(function (d) {\n\t\t\t\t\t\t\t\tif(d) {\n\t\t\t\t\t\t\t\t\td = d.replace(/ ?xmlns=\"[^\"]*\"/ig, \"\");\n\t\t\t\t\t\t\t\t\tif(d.length > 10) {\n\t\t\t\t\t\t\t\t\t\td = $(d);\n\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty().append(d.children());\n\t\t\t\t\t\t\t\t\t\tif(s.clean_node) { this.clean_node(obj); }\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty();\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, this));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):\n\t\t\t\t\t\terror_func = function (x, t, e) {\n\t\t\t\t\t\t\tvar ef = this.get_settings().xml_data.ajax.error;\n\t\t\t\t\t\t\tif(ef) { ef.call(this, x, t, e); }\n\t\t\t\t\t\t\tif(obj !== -1 && obj.length) {\n\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\tif(t === \"success\" && s.correct_state) { this.correct_state(obj); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(t === \"success\" && s.correct_state) { this.get_container().children(\"ul\").empty(); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(e_call) { e_call.call(this); }\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsuccess_func = function (d, t, x) {\n\t\t\t\t\t\t\td = x.responseText;\n\t\t\t\t\t\t\tvar sf = this.get_settings().xml_data.ajax.success;\n\t\t\t\t\t\t\tif(sf) { d = sf.call(this,d,t,x) || d; }\n\t\t\t\t\t\t\tif(d === \"\" || (d && d.toString && d.toString().replace(/^[\\s\\n]+$/,\"\") === \"\")) {\n\t\t\t\t\t\t\t\treturn error_func.call(this, x, t, \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.parse_xml(d, $.proxy(function (d) {\n\t\t\t\t\t\t\t\tif(d) {\n\t\t\t\t\t\t\t\t\td = d.replace(/ ?xmlns=\"[^\"]*\"/ig, \"\");\n\t\t\t\t\t\t\t\t\tif(d.length > 10) {\n\t\t\t\t\t\t\t\t\t\td = $(d);\n\t\t\t\t\t\t\t\t\t\tif(obj === -1 || !obj) { this.get_container().children(\"ul\").empty().append(d.children()); }\n\t\t\t\t\t\t\t\t\t\telse { obj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\"); obj.append(d); obj.removeData(\"jstree_is_loading\"); }\n\t\t\t\t\t\t\t\t\t\tif(s.clean_node) { this.clean_node(obj); }\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\t\t\tthis.correct_state(obj);\n\t\t\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty();\n\t\t\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, this));\n\t\t\t\t\t\t};\n\t\t\t\t\t\ts.ajax.context = this;\n\t\t\t\t\t\ts.ajax.error = error_func;\n\t\t\t\t\t\ts.ajax.success = success_func;\n\t\t\t\t\t\tif(!s.ajax.dataType) { s.ajax.dataType = \"xml\"; }\n\t\t\t\t\t\tif($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }\n\t\t\t\t\t\tif($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }\n\t\t\t\t\t\t$.ajax(s.ajax);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tparse_xml : function (xml, callback) {\n\t\t\t\tvar s = this._get_settings().xml_data;\n\t\t\t\t$.vakata.xslt(xml, xsl[s.xsl], callback);\n\t\t\t},\n\t\t\tget_xml : function (tp, obj, li_attr, a_attr, is_callback) {\n\t\t\t\tvar result = \"\",\n\t\t\t\t\ts = this._get_settings(),\n\t\t\t\t\t_this = this,\n\t\t\t\t\ttmp1, tmp2, li, a, lang;\n\t\t\t\tif(!tp) { tp = \"flat\"; }\n\t\t\t\tif(!is_callback) { is_callback = 0; }\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(!obj || obj === -1) { obj = this.get_container().find(\"> ul > li\"); }\n\t\t\t\tli_attr = $.isArray(li_attr) ? li_attr : [ \"id\", \"class\" ];\n\t\t\t\tif(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }\n\n\t\t\t\ta_attr = $.isArray(a_attr) ? a_attr : [ ];\n\n\t\t\t\tif(!is_callback) {\n\t\t\t\t\tif(s.xml_data.get_include_preamble) {\n\t\t\t\t\t\tresult += '<' + '?xml version=\"1.0\" encoding=\"UTF-8\"?' + '>';\n\t\t\t\t\t}\n\t\t\t\t\tresult += \"<root>\";\n\t\t\t\t}\n\t\t\t\tobj.each(function () {\n\t\t\t\t\tresult += \"<item\";\n\t\t\t\t\tli = $(this);\n\t\t\t\t\t$.each(li_attr, function (i, v) {\n\t\t\t\t\t\tvar t = li.attr(v);\n\t\t\t\t\t\tif(!s.xml_data.get_skip_empty || typeof t !== \"undefined\") {\n\t\t\t\t\t\t\tresult += \" \" + v + \"=\\\"\" + escape_xml
2((\" \" + (t || \"\")).replace(/ jstree[^ ]*/ig,'').replace(/\\s+$/ig,\" \").replace(/^ /,\"\").replace(/ $/,\"\")) + \"\\\"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif(li.hasClass(\"jstree-open\")) { result += \" state=\\\"open\\\"\"; }\n\t\t\t\t\tif(li.hasClass(\"jstree-closed\")) { result += \" state=\\\"closed\\\"\"; }\n\t\t\t\t\tif(tp === \"flat\") { result += \" parent_id=\\\"\" + escape_xml(is_callback) + \"\\\"\"; }\n\t\t\t\t\tresult += \">\";\n\t\t\t\t\tresult += \"<content>\";\n\t\t\t\t\ta = li.children(\"a\");\n\t\t\t\t\ta.each(function () {\n\t\t\t\t\t\ttmp1 = $(this);\n\t\t\t\t\t\tlang = false;\n\t\t\t\t\t\tresult += \"<name\";\n\t\t\t\t\t\tif($.inArray(\"languages\", s.plugins) !== -1) {\n\t\t\t\t\t\t\t$.each(s.languages, function (k, z) {\n\t\t\t\t\t\t\t\tif(tmp1.hasClass(z)) { result += \" lang=\\\"\" + escape_xml(z) + \"\\\"\"; lang = z; return false; }\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a_attr.length) {\n\t\t\t\t\t\t\t$.each(a_attr, function (k, z) {\n\t\t\t\t\t\t\t\tvar t = tmp1.attr(z);\n\t\t\t\t\t\t\t\tif(!s.xml_data.get_skip_empty || typeof t !== \"undefined\") {\n\t\t\t\t\t\t\t\t\tresult += \" \" + z + \"=\\\"\" + escape_xml((\" \" + t || \"\").replace(/ jstree[^ ]*/ig,'').replace(/\\s+$/ig,\" \").replace(/^ /,\"\").replace(/ $/,\"\")) + \"\\\"\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(tmp1.children(\"ins\").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\\s+$/ig,\"\").length) {\n\t\t\t\t\t\t\tresult += ' icon=\"' + escape_xml(tmp1.children(\"ins\").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\\s+$/ig,\" \").replace(/^ /,\"\").replace(/ $/,\"\")) + '\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(tmp1.children(\"ins\").get(0).style.backgroundImage.length) {\n\t\t\t\t\t\t\tresult += ' icon=\"' + escape_xml(tmp1.children(\"ins\").get(0).style.backgroundImage.replace(\"url(\",\"\").replace(\")\",\"\").replace(/'/ig,\"\").replace(/\"/ig,\"\")) + '\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresult += \">\";\n\t\t\t\t\t\tresult += \"<![CDATA[\" + _this.get_text(tmp1, lang) + \"]]>\";\n\t\t\t\t\t\tresult += \"</name>\";\n\t\t\t\t\t});\n\t\t\t\t\tresult += \"</content>\";\n\t\t\t\t\ttmp2 = li[0].id || true;\n\t\t\t\t\tli = li.find(\"> ul > li\");\n\t\t\t\t\tif(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }\n\t\t\t\t\telse { tmp2 = \"\"; }\n\t\t\t\t\tif(tp == \"nest\") { result += tmp2; }\n\t\t\t\t\tresult += \"</item>\";\n\t\t\t\t\tif(tp == \"flat\") { result += tmp2; }\n\t\t\t\t});\n\t\t\t\tif(!is_callback) { result += \"</root>\"; }\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree search plugin\n * Enables both sync and async search on the tree\n * DOES NOT WORK WITH JSON PROGRESSIVE RENDER\n */\n(function ($) {\n\t$.expr[':'].jstree_contains = function(a,i,m){\n\t\treturn (a.textContent || a.innerText || \"\").toLowerCase().indexOf(m[3].toLowerCase())>=0;\n\t};\n\t$.expr[':'].jstree_title_contains = function(a,i,m) {\n\t\treturn (a.getAttribute(\"title\") || \"\").toLowerCase().indexOf(m[3].toLowerCase())>=0;\n\t};\n\t$.jstree.plugin(\"search\", {\n\t\t__init : function () {\n\t\t\tthis.data.search.str = \"\";\n\t\t\tthis.data.search.result = $();\n\t\t\tif(this._get_settings().search.show_only_matches) {\n\t\t\t\tthis.get_container()\n\t\t\t\t\t.bind(\"search.jstree\", function (e, data) {\n\t\t\t\t\t\t$(this).children(\"ul\").find(\"li\").hide().removeClass(\"jstree-last\");\n\t\t\t\t\t\tdata.rslt.nodes.parentsUntil(\".jstree\").addBack().show()\n\t\t\t\t\t\t\t.filter(\"ul\").each(function () { $(this).children(\"li:visible\").eq(-1).addClass(\"jstree-last\"); });\n\t\t\t\t\t})\n\t\t\t\t\t.bind(\"clear_search.jstree\", function () {\n\t\t\t\t\t\t$(this).children(\"ul\").find(\"li\").css(\"display\",\"\").end().end().jstree(\"clean_node\", -1);\n\t\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdefaults : {\n\t\t\tajax : false,\n\t\t\tsearch_method : \"jstree_contains\", // for case insensitive - jstree_contains\n\t\t\tshow_only_matches : false\n\t\t},\n\t\t_fn : {\n\t\t\tsearch : function (str, skip_async) {\n\t\t\t\tif($.trim(str) === \"\") { this.clear_search(); return; }\n\t\t\t\tvar s = this.get_settings().search,\n\t\t\t\t\tt = this,\n\t\t\t\t\terror_func = function () { },\n\t\t\t\t\tsuccess_func = function () { };\n\t\t\t\tthis.data.search.str = str;\n\n\t\t\t\tif(!skip_async && s.ajax !== false && this.get_container_ul().find(\"li.jstree-closed:not(:has(ul)):eq(0)\").length > 0) {\n\t\t\t\t\tthis.search.supress_callback = true;\n\t\t\t\t\terror_func = function () { };\n\t\t\t\t\tsuccess_func = function (d, t, x) {\n\t\t\t\t\t\tvar sf = this.get_settings().search.ajax.success;\n\t\t\t\t\t\tif(sf) { d = sf.call(this,d,t,x) || d; }\n\t\t\t\t\t\tthis.data.search.to_open = d;\n\t\t\t\t\t\tthis._search_open();\n\t\t\t\t\t};\n\t\t\t\t\ts.ajax.context = this;\n\t\t\t\t\ts.ajax.error = error_func;\n\t\t\t\t\ts.ajax.success = success_func;\n\t\t\t\t\tif($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }\n\t\t\t\t\tif($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }\n\t\t\t\t\tif(!s.ajax.data) { s.ajax.data = { \"search_string\" : str }; }\n\t\t\t\t\tif(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = \"json\"; }\n\t\t\t\t\t$.ajax(s.ajax);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(this.data.search.result.length) { this.clear_search(); }\n\t\t\t\tthis.data.search.result = this.get_container().find(\"a\" + (this.data.languages ? \".\" + this.get_lang() : \"\" ) + \":\" + (s.search_method) + \"(\" + this.data.search.str + \")\");\n\t\t\t\tthis.data.search.result.addClass(\"jstree-search\").parent().parents(\".jstree-closed\").each(function () {\n\t\t\t\t\tt.open_node(this, false, true);\n\t\t\t\t});\n\t\t\t\tthis.__callback({ nodes : this.data.search.result, str : str });\n\t\t\t},\n\t\t\tclear_search : function (str) {\n\t\t\t\tthis.data.search.result.removeClass(\"jstree-search\");\n\t\t\t\tthis.__callback(this.data.search.result);\n\t\t\t\tthis.data.search.result = $();\n\t\t\t},\n\t\t\t_search_open : function (is_callback) {\n\t\t\t\tvar _this = this,\n\t\t\t\t\tdone = true,\n\t\t\t\t\tcurrent = [],\n\t\t\t\t\tremaining = [];\n\t\t\t\tif(this.data.search.to_open.length) {\n\t\t\t\t\t$.each(this.data.search.to_open, function (i, val) {\n\t\t\t\t\t\tif(val == \"#\") { return true; }\n\t\t\t\t\t\tif($(val).length && $(val).is(\".jstree-closed\")) { current.push(val); }\n\t\t\t\t\t\telse { remaining.push(val); }\n\t\t\t\t\t});\n\t\t\t\t\tif(current.length) {\n\t\t\t\t\t\tthis.data.search.to_open = remaining;\n\t\t\t\t\t\t$.each(current, function (i, val) {\n\t\t\t\t\t\t\t_this.open_node(val, function () { _this._search_open(true); });\n\t\t\t\t\t\t});\n\t\t\t\t\t\tdone = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(done) { this.search(this.data.search.str, true); }\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree contextmenu plugin\n */\n(function ($) {\n\t$.vakata.context = {\n\t\thide_on_mouseleave : false,\n\n\t\tcnt\t\t: $(\"<div id='vakata-contextmenu' />\"),\n\t\tvis\t\t: false,\n\t\ttgt\t\t: false,\n\t\tpar\t\t: false,\n\t\tfunc\t: false,\n\t\tdata\t: false,\n\t\trtl\t\t: false,\n\t\tshow\t: function (s, t, x, y, d, p, rtl) {\n\t\t\t$.vakata.context.rtl = !!rtl;\n\t\t\tvar html = $.vakata.context.parse(s), h, w;\n\t\t\tif(!html) { return; }\n\t\t\t$.vakata.context.vis = true;\n\t\t\t$.vakata.context.tgt = t;\n\t\t\t$.vakata.context.par = p || t || null;\n\t\t\t$.vakata.context.data = d || null;\n\t\t\t$.vakata.context.cnt\n\t\t\t\t.html(html)\n\t\t\t\t.css({ \"visibility\" : \"hidden\", \"display\" : \"block\", \"left\" : 0, \"top\" : 0 });\n\n\t\t\tif($.vakata.context.hide_on_mouseleave) {\n\t\t\t\t$.vakata.context.cnt\n\t\t\t\t\t.one(\"mouseleave\", function(e) { $.vakata.context.hide(); });\n\t\t\t}\n\n\t\t\th = $.vakata.context.cnt.height();\n\t\t\tw = $.vakata.context.cnt.width();\n\t\t\tif(x + w >
2 $(document).width()) {\n\t\t\t\tx = $(document).width() - (w + 5);\n\t\t\t\t$.vakata.context.cnt.find(\"li > ul\").addClass(\"right\");\n\t\t\t}\n\t\t\tif(y + h > $(document).height()) {\n\t\t\t\ty = y - (h + t[0].offsetHeight);\n\t\t\t\t$.vakata.context.cnt.find(\"li > ul\").addClass(\"bottom\");\n\t\t\t}\n\n\t\t\t$.vakata.context.cnt\n\t\t\t\t.css({ \"left\" : x, \"top\" : y })\n\t\t\t\t.find(\"li:has(ul)\")\n\t\t\t\t\t.bind(\"mouseenter\", function (e) {\n\t\t\t\t\t\tvar w = $(document).width(),\n\t\t\t\t\t\t\th = $(document).height(),\n\t\t\t\t\t\t\tul = $(this).children(\"ul\").show();\n\t\t\t\t\t\tif(w !== $(document).width()) { ul.toggleClass(\"right\"); }\n\t\t\t\t\t\tif(h !== $(document).height()) { ul.toggleClass(\"bottom\"); }\n\t\t\t\t\t})\n\t\t\t\t\t.bind(\"mouseleave\", function (e) {\n\t\t\t\t\t\t$(this).children(\"ul\").hide();\n\t\t\t\t\t})\n\t\t\t\t\t.end()\n\t\t\t\t.css({ \"visibility\" : \"visible\" })\n\t\t\t\t.show();\n\t\t\t$(document).triggerHandler(\"context_show.vakata\");\n\t\t},\n\t\thide\t: function () {\n\t\t\t$.vakata.context.vis = false;\n\t\t\t$.vakata.context.cnt.attr(\"class\",\"\").css({ \"visibility\" : \"hidden\" });\n\t\t\t$(document).triggerHandler(\"context_hide.vakata\");\n\t\t},\n\t\tparse\t: function (s, is_callback) {\n\t\t\tif(!s) { return false; }\n\t\t\tvar str = \"\",\n\t\t\t\ttmp = false,\n\t\t\t\twas_sep = true;\n\t\t\tif(!is_callback) { $.vakata.context.func = {}; }\n\t\t\tstr += \"<ul>\";\n\t\t\t$.each(s, function (i, val) {\n\t\t\t\tif(!val) { return true; }\n\t\t\t\t$.vakata.context.func[i] = val.action;\n\t\t\t\tif(!was_sep && val.separator_before) {\n\t\t\t\t\tstr += \"<li class='vakata-separator vakata-separator-before'></li>\";\n\t\t\t\t}\n\t\t\t\twas_sep = false;\n\t\t\t\tstr += \"<li class='\" + (val._class || \"\") + (val._disabled ? \" jstree-contextmenu-disabled \" : \"\") + \"'><ins \";\n\t\t\t\tif(val.icon && val.icon.indexOf(\"/\") === -1) { str += \" class='\" + val.icon + \"' \"; }\n\t\t\t\tif(val.icon && val.icon.indexOf(\"/\") !== -1) { str += \" style='background:url(\" + val.icon + \") center center no-repeat;' \"; }\n\t\t\t\tstr += \"> </ins><a href='#' rel='\" + i + \"'>\";\n\t\t\t\tif(val.submenu) {\n\t\t\t\t\tstr += \"<span style='float:\" + ($.vakata.context.rtl ? \"left\" : \"right\") + \";'>»</span>\";\n\t\t\t\t}\n\t\t\t\tstr += val.label + \"</a>\";\n\t\t\t\tif(val.submenu) {\n\t\t\t\t\ttmp = $.vakata.context.parse(val.submenu, true);\n\t\t\t\t\tif(tmp) { str += tmp; }\n\t\t\t\t}\n\t\t\t\tstr += \"</li>\";\n\t\t\t\tif(val.separator_after) {\n\t\t\t\t\tstr += \"<li class='vakata-separator vakata-separator-after'></li>\";\n\t\t\t\t\twas_sep = true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tstr = str.replace(/<li class\\='vakata-separator vakata-separator-after'\\><\\/li\\>$/,\"\");\n\t\t\tstr += \"</ul>\";\n\t\t\t$(document).triggerHandler(\"context_parse.vakata\");\n\t\t\treturn str.length > 10 ? str : false;\n\t\t},\n\t\texec\t: function (i) {\n\t\t\tif($.isFunction($.vakata.context.func[i])) {\n\t\t\t\t// if is string - eval and call it!\n\t\t\t\t$.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse { return false; }\n\t\t}\n\t};\n\t$(function () {\n\t\tvar css_string = '' +\n\t\t\t'#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +\n\t\t\t'#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +\n\t\t\t'#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +\n\t\t\t'#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +\n\t\t\t'#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +\n\t\t\t'#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +\n\t\t\t'#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +\n\t\t\t'#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +\n\t\t\t'#vakata-contextmenu .right { right:100%; left:auto; } ' +\n\t\t\t'#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +\n\t\t\t'#vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ';\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"vakata\" });\n\t\t$.vakata.context.cnt\n\t\t\t.delegate(\"a\",\"click\", function (e) { e.preventDefault(); })\n\t\t\t.delegate(\"a\",\"mouseup\", function (e) {\n\t\t\t\tif(!$(this).parent().hasClass(\"jstree-contextmenu-disabled\") && $.vakata.context.exec($(this).attr(\"rel\"))) {\n\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t}\n\t\t\t\telse { $(this).blur(); }\n\t\t\t})\n\t\t\t.delegate(\"a\",\"mouseover\", function () {\n\t\t\t\t$.vakata.context.cnt.find(\".vakata-hover\").removeClass(\"vakata-hover\");\n\t\t\t})\n\t\t\t.appendTo(\"body\");\n\t\t$(document).bind(\"mousedown\", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });\n\t\tif(typeof $.hotkeys !== \"undefined\") {\n\t\t\t$(document)\n\t\t\t\t.bind(\"keydown\", \"up\", function (e) {\n\t\t\t\t\tif($.vakata.context.vis) {\n\t\t\t\t\t\tvar o = $.vakata.context.cnt.find(\"ul:visible\").last().children(\".vakata-hover\").removeClass(\"vakata-hover\").prevAll(\"li:not(.vakata-separator)\").first();\n\t\t\t\t\t\tif(!o.length) { o = $.vakata.context.cnt.find(\"ul:visible\").last().children(\"li:not(.vakata-separator)\").last(); }\n\t\t\t\t\t\to.addClass(\"vakata-hover\");\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.bind(\"keydown\", \"down\", function (e) {\n\t\t\t\t\tif($.vakata.context.vis) {\n\t\t\t\t\t\tvar o = $.vakata.context.cnt.find(\"ul:visible\").last().children(\".vakata-hover\").removeClass(\"vakata-hover\").nextAll(\"li:not(.vakata-separator)\").first();\n\t\t\t\t\t\tif(!o.length) { o = $.vakata.context.cnt.find(\"ul:visible\").last().children(\"li:not(.vakata-separator)\").first(); }\n\t\t\t\t\t\to.addClass(\"vakata-hover\");\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.bind(\"keydown\", \"right\", function (e) {\n\t\t\t\t\tif($.vakata.context.vis) {\n\t\t\t\t\t\t$.vakata.context.cnt.find(\".vakata-hover\").children(\"ul\").show().children(\"li:not(.vakata-separator)\").removeClass(\"vakata-hover\").first().addClass(\"vakata-hover\");\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.bind(\"keydown\", \"left\", function (e) {\n\t\t\t\t\tif($.vakata.context.vis) {\n\t\t\t\t\t\t$.vakata.context.cnt.find(\".vakata-hover\").children(\"ul\").hide().children(\".vakata-separator\").removeClass(\"vakata-hover\");\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.bind(\"keydown\", \"esc\", function (e) {\n\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\te.preventDefault();\n\t\t\t\t})\n\t\t\t\t.bind(\"keydown\", \"space\", function (e) {\n\t\t\t\t\t$.vakata.context.cnt.find(\".vakata-hover\").last().children(\"a\").click();\n\t\t\t\t\te.preventDefault();\n\t\t\t\t});\n\t\t}\n\t});\n\n\t$.jstree.plugin(\"contextmenu\", {\n\t\t__init : function () {\n\t\t\tthis.get_container()\n\t\t\t\t.delegate(\"a\", \"contextmenu.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tif(!$(e.currentTarget).hasClass(\"jstree-loading\")) {\n\t\t\t\t\t\t\tthis.show_contextmenu(e.currentTarget, e.pageX, e.pageY);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"a\", \"click.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif(this.data.contextmenu) {\n\t\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"destroy.jstree\", $.proxy(function () {\n\t\t\t\t\t\t// TODO: move this to descruct method\n\t\t\t\t\t\tif(this.data.contextmenu) {\n\t\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\t\t\t$(document).bind(\"context_hide.vakata\", $.proxy(function () { this.data.contextmenu = false; }, this));\n\t\t},\n\t\tdefaults : {\n\t\t\tselect_node : false, // requires UI plugin\n\t\t\tshow_at_node : true,\n\t\t\titems : { // Could be a function that should return an object like this one\n\t\t\t\t\"create\" : {\n\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\"separator_after\"\t: true,\n\t\t\t\t\t\"label\"\t\t\t\t: \"Create\",\n\t\t\t\t\t\"action\"\t\t\t: function (obj) { this.create(obj); }\n\t\t\t\t},\n\t\t\t\t\"rename\" : {\n\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\"label\"\t\t\t\t: \"Rename\",\n\t\t\t\t\t\"action\"\t\t\t: function (obj) { this.rename(obj); }\n\t\t\t\t},\n\t\t\t\t\"remove\" : {\n\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\"label\"\t\t\t\t: \"Delete\",\n\t\t\t\t\t\"action\"\t\t\t: function (obj) { if(this.is_selected(obj)) { this.remove(); } else { this.remove(obj); } }\n\t\t\t\t}
2,\n\t\t\t\t\"ccp\" : {\n\t\t\t\t\t\"separator_before\"\t: true,\n\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\"label\"\t\t\t\t: \"Edit\",\n\t\t\t\t\t\"action\"\t\t\t: false,\n\t\t\t\t\t\"submenu\" : {\n\t\t\t\t\t\t\"cut\" : {\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Cut\",\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (obj) { this.cut(obj); }\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"copy\" : {\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Copy\",\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (obj) { this.copy(obj); }\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"paste\" : {\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Paste\",\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (obj) { this.paste(obj); }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t_fn : {\n\t\t\tshow_contextmenu : function (obj, x, y) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar s = this.get_settings().contextmenu,\n\t\t\t\t\ta = obj.children(\"a:visible:eq(0)\"),\n\t\t\t\t\to = false,\n\t\t\t\t\ti = false;\n\t\t\t\tif(s.select_node && this.data.ui && !this.is_selected(obj)) {\n\t\t\t\t\tthis.deselect_all();\n\t\t\t\t\tthis.select_node(obj, true);\n\t\t\t\t}\n\t\t\t\tif(s.show_at_node || typeof x === \"undefined\" || typeof y === \"undefined\") {\n\t\t\t\t\to = a.offset();\n\t\t\t\t\tx = o.left;\n\t\t\t\t\ty = o.top + this.data.core.li_height;\n\t\t\t\t}\n\t\t\t\ti = obj.data(\"jstree\") && obj.data(\"jstree\").contextmenu ? obj.data(\"jstree\").contextmenu : s.items;\n\t\t\t\tif($.isFunction(i)) { i = i.call(this, obj); }\n\t\t\t\tthis.data.contextmenu = true;\n\t\t\t\t$.vakata.context.show(i, a, x, y, this, obj, this._get_settings().core.rtl);\n\t\t\t\tif(this.data.themes) { $.vakata.context.cnt.attr(\"class\", \"jstree-\" + this.data.themes.theme + \"-context\"); }\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree types plugin\n * Adds support types of nodes\n * You can set an attribute on each li node, that represents its type.\n * According to the type setting the node may get custom icon/validation rules\n */\n(function ($) {\n\t$.jstree.plugin(\"types\", {\n\t\t__init : function () {\n\t\t\tvar s = this._get_settings().types;\n\t\t\tthis.data.types.attach_to = [];\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"init.jstree\", $.proxy(function () {\n\t\t\t\t\t\tvar types = s.types,\n\t\t\t\t\t\t\tattr = s.type_attr,\n\t\t\t\t\t\t\ticons_css = \"\",\n\t\t\t\t\t\t\t_this = this;\n\n\t\t\t\t\t\t$.each(types, function (i, tp) {\n\t\t\t\t\t\t\t$.each(tp, function (k, v) {\n\t\t\t\t\t\t\t\tif(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif(!tp.icon) { return true; }\n\t\t\t\t\t\t\tif( tp.icon.image || tp.icon.position) {\n\t\t\t\t\t\t\t\tif(i == \"default\")\t{ icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }\n\t\t\t\t\t\t\t\telse\t\t\t\t{ icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '=\"' + i + '\"] > a > .jstree-icon { '; }\n\t\t\t\t\t\t\t\tif(tp.icon.image)\t{ icons_css += ' background-image:url(' + tp.icon.image + '); '; }\n\t\t\t\t\t\t\t\tif(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }\n\t\t\t\t\t\t\t\telse\t\t\t\t{ icons_css += ' background-position:0 0; '; }\n\t\t\t\t\t\t\t\ticons_css += '} ';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif(icons_css !== \"\") { $.vakata.css.add_sheet({ 'str' : icons_css, title : \"jstree-types\" }); }\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"before.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tvar s, t,\n\t\t\t\t\t\t\to = this._get_settings().types.use_data ? this._get_node(data.args[0]) : false,\n\t\t\t\t\t\t\td = o && o !== -1 && o.length ? o.data(\"jstree\") : false;\n\t\t\t\t\t\tif(d && d.types && d.types[data.func] === false) { e.stopImmediatePropagation(); return false; }\n\t\t\t\t\t\tif($.inArray(data.func, this.data.types.attach_to) !== -1) {\n\t\t\t\t\t\t\tif(!data.args[0] || (!data.args[0].tagName && !data.args[0].jquery)) { return; }\n\t\t\t\t\t\t\ts = this._get_settings().types.types;\n\t\t\t\t\t\t\tt = this._get_type(data.args[0]);\n\t\t\t\t\t\t\tif(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(s[t] && typeof s[t][data.func] !== \"undefined\") ||\n\t\t\t\t\t\t\t\t\t(s[\"default\"] && typeof s[\"default\"][data.func] !== \"undefined\")\n\t\t\t\t\t\t\t\t) && this._check(data.func, data.args[0]) === false\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\t\t\tif(is_ie6) {\n\t\t\t\tthis.get_container()\n\t\t\t\t\t.bind(\"load_node.jstree set_type.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\t\tvar r = data && data.rslt && data.rslt.obj && data.rslt.obj !== -1 ? this._get_node(data.rslt.obj).parent() : this.get_container_ul(),\n\t\t\t\t\t\t\t\tc = false,\n\t\t\t\t\t\t\t\ts = this._get_settings().types;\n\t\t\t\t\t\t\t$.each(s.types, function (i, tp) {\n\t\t\t\t\t\t\t\tif(tp.icon && (tp.icon.image || tp.icon.position)) {\n\t\t\t\t\t\t\t\t\tc = i === \"default\" ? r.find(\"li > a > .jstree-icon\") : r.find(\"li[\" + s.type_attr + \"='\" + i + \"'] > a > .jstree-icon\");\n\t\t\t\t\t\t\t\t\tif(tp.icon.image) { c.css(\"backgroundImage\",\"url(\" + tp.icon.image + \")\"); }\n\t\t\t\t\t\t\t\t\tc.css(\"backgroundPosition\", tp.icon.position || \"0 0\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}, this));\n\t\t\t}\n\t\t},\n\t\tdefaults : {\n\t\t\t// defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)\n\t\t\tmax_children\t\t: -1,\n\t\t\t// defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)\n\t\t\tmax_depth\t\t\t: -1,\n\t\t\t// defines valid node types for the root nodes\n\t\t\tvalid_children\t\t: \"all\",\n\n\t\t\t// whether to use $.data\n\t\t\tuse_data : false,\n\t\t\t// where is the type stores (the rel attribute of the LI element)\n\t\t\ttype_attr : \"rel\",\n\t\t\t// a list of types\n\t\t\ttypes : {\n\t\t\t\t// the default type\n\t\t\t\t\"default\" : {\n\t\t\t\t\t\"max_children\"\t: -1,\n\t\t\t\t\t\"max_depth\"\t\t: -1,\n\t\t\t\t\t\"valid_children\": \"all\"\n\n\t\t\t\t\t// Bound functions - you can bind any other function here (using boolean or function)\n\t\t\t\t\t//\"select_node\"\t: true\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t_fn : {\n\t\t\t_types_notify : function (n, data) {\n\t\t\t\tif(data.type && this._get_settings().types.use_data) {\n\t\t\t\t\tthis.set_type(data.type, n);\n\t\t\t\t}\n\t\t\t},\n\t\t\t_get_type : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\treturn (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || \"default\";\n\t\t\t},\n\t\t\tset_type : function (str, obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar ret = (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);\n\t\t\t\tif(ret) { this.__callback({ obj : obj, type : str}); }\n\t\t\t\treturn ret;\n\t\t\t},\n\t\t\t_check : function (rule, obj, opts) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tvar v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types, data = false;\n\t\t\t\tif(obj === -1) {\n\t\t\t\t\tif(!!s[rule]) { v = s[rule]; }\n\t\t\t\t\telse { return; }\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(t === false) { return; }\n\t\t\t\t\tdata = s.use_data ? obj.data(\"jstree\") : false;\n\t\t\t\t\tif(data && data.types && typeof data.types[rule] !== \"undefined\") { v = data.types[rule]; }\n\t\t\t\t\telse if(!!s.types[t] && typeof s.types[t][rule] !== \"undefined\") { v = s.types[t][rule]; }\n\t\t\t\t\telse if(!!s.types[\"default\"] && typeof s.types[\"default\"][rule] !== \"undefined\") { v = s.types[\"default\"][rule]; }\n\t\t\t\t}\n\t\t\t\tif($.isFunction(v)) { v = v.call(this, obj); }\n\t\t\t\tif(rule === \"max_depth\" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {\n\t\t\t\t\t// also include the node itself - otherwise if root node it is not checked\n\t\t\t\t\tobj.children(\"a:eq(0)\").parentsUntil(\".jstree\",\"li\").each(function (i) {\n\t\t\t\t\t\t// check if current depth already exceeds global tree depth\n\t\t\t\t\t\tif(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }\n\t\t\t\t\t\td = (i === 0) ? v : _this._check(rule, this, false);\n\t\t\t\t\t\t// check if current node max depth is already matched or exceeded\n\t\t\t\t\t\tif(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }\n\t\t\t\t\t\t// otherwise - set the max depth to the current value minus current depth\n\t\t\t\t\t\tif(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }\n\t\t\t\t\t\t// if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited\n\t\t\t\t\t\tif(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn v;
2\n\t\t\t},\n\t\t\tcheck_move : function () {\n\t\t\t\tif(!this.__call_old()) { return false; }\n\t\t\t\tvar m = this._get_move(),\n\t\t\t\t\ts = m.rt._get_settings().types,\n\t\t\t\t\tmc = m.rt._check(\"max_children\", m.cr),\n\t\t\t\t\tmd = m.rt._check(\"max_depth\", m.cr),\n\t\t\t\t\tvc = m.rt._check(\"valid_children\", m.cr),\n\t\t\t\t\tch = 0, d = 1, t;\n\n\t\t\t\tif(vc === \"none\") { return false; }\n\t\t\t\tif($.isArray(vc) && m.ot && m.ot._get_type) {\n\t\t\t\t\tm.o.each(function () {\n\t\t\t\t\t\tif($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }\n\t\t\t\t\t});\n\t\t\t\t\tif(d === false) { return false; }\n\t\t\t\t}\n\t\t\t\tif(s.max_children !== -2 && mc !== -1) {\n\t\t\t\t\tch = m.cr === -1 ? this.get_container().find(\"> ul > li\").not(m.o).length : m.cr.find(\"> ul > li\").not(m.o).length;\n\t\t\t\t\tif(ch + m.o.length > mc) { return false; }\n\t\t\t\t}\n\t\t\t\tif(s.max_depth !== -2 && md !== -1) {\n\t\t\t\t\td = 0;\n\t\t\t\t\tif(md === 0) { return false; }\n\t\t\t\t\tif(typeof m.o.d === \"undefined\") {\n\t\t\t\t\t\t// TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)\n\t\t\t\t\t\tt = m.o;\n\t\t\t\t\t\twhile(t.length > 0) {\n\t\t\t\t\t\t\tt = t.find(\"> ul > li\");\n\t\t\t\t\t\t\td ++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tm.o.d = d;\n\t\t\t\t\t}\n\t\t\t\t\tif(md - m.o.d < 0) { return false; }\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tcreate_node : function (obj, position, js, callback, is_loaded, skip_check) {\n\t\t\t\tif(!skip_check && (is_loaded || this._is_loaded(obj))) {\n\t\t\t\t\tvar p = (typeof position == \"string\" && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),\n\t\t\t\t\t\ts = this._get_settings().types,\n\t\t\t\t\t\tmc = this._check(\"max_children\", p),\n\t\t\t\t\t\tmd = this._check(\"max_depth\", p),\n\t\t\t\t\t\tvc = this._check(\"valid_children\", p),\n\t\t\t\t\t\tch;\n\t\t\t\t\tif(typeof js === \"string\") { js = { data : js }; }\n\t\t\t\t\tif(!js) { js = {}; }\n\t\t\t\t\tif(vc === \"none\") { return false; }\n\t\t\t\t\tif($.isArray(vc)) {\n\t\t\t\t\t\tif(!js.attr || !js.attr[s.type_attr]) {\n\t\t\t\t\t\t\tif(!js.attr) { js.attr = {}; }\n\t\t\t\t\t\t\tjs.attr[s.type_attr] = vc[0];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(s.max_children !== -2 && mc !== -1) {\n\t\t\t\t\t\tch = p === -1 ? this.get_container().find(\"> ul > li\").length : p.find(\"> ul > li\").length;\n\t\t\t\t\t\tif(ch + 1 > mc) { return false; }\n\t\t\t\t\t}\n\t\t\t\t\tif(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }\n\t\t\t\t}\n\t\t\t\treturn this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree HTML plugin\n * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.\n */\n(function ($) {\n\t$.jstree.plugin(\"html_data\", {\n\t\t__init : function () {\n\t\t\t// this used to use html() and clean the whitespace, but this way any attached data was lost\n\t\t\tthis.data.html_data.original_container_html = this.get_container().find(\" > ul > li\").clone(true);\n\t\t\t// remove white space from LI node - otherwise nodes appear a bit to the right\n\t\t\tthis.data.html_data.original_container_html.find(\"li\").addBack().contents().filter(function() { return this.nodeType == 3; }).remove();\n\t\t},\n\t\tdefaults : {\n\t\t\tdata : false,\n\t\t\tajax : false,\n\t\t\tcorrect_state : true\n\t\t},\n\t\t_fn : {\n\t\t\tload_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ \"obj\" : _this._get_node(obj) }); s_call.call(this); }, e_call); },\n\t\t\t_is_loaded : function (obj) {\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\treturn obj == -1 || !obj || (!this._get_settings().html_data.ajax && !$.isFunction(this._get_settings().html_data.data)) || obj.is(\".jstree-open, .jstree-leaf\") || obj.children(\"ul\").children(\"li\").size() > 0;\n\t\t\t},\n\t\t\tload_node_html : function (obj, s_call, e_call) {\n\t\t\t\tvar d,\n\t\t\t\t\ts = this.get_settings().html_data,\n\t\t\t\t\terror_func = function () {},\n\t\t\t\t\tsuccess_func = function () {};\n\t\t\t\tobj = this._get_node(obj);\n\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\tif(obj.data(\"jstree_is_loading\")) { return; }\n\t\t\t\t\telse { obj.data(\"jstree_is_loading\",true); }\n\t\t\t\t}
2\n\t\t\t\tswitch(!0) {\n\t\t\t\t\tcase ($.isFunction(s.data)):\n\t\t\t\t\t\ts.data.call(this, obj, $.proxy(function (d) {\n\t\t\t\t\t\t\tif(d && d !== \"\" && d.toString && d.toString().replace(/^[\\s\\n]+$/,\"\") !== \"\") {\n\t\t\t\t\t\t\t\td = $(d);\n\t\t\t\t\t\t\t\tif(!d.is(\"ul\")) { d = $(\"<ul />\").append(d); }\n\t\t\t\t\t\t\t\tif(obj == -1 || !obj) { this.get_container().children(\"ul\").empty().append(d.children()).find(\"li, a\").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== \"INS\"; }).prepend(\"<ins class='jstree-icon'> </ins>\").end().filter(\"a\").children(\"ins:first-child\").not(\".jstree-icon\").addClass(\"jstree-icon\"); }\n\t\t\t\t\t\t\t\telse { obj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\"); obj.append(d).children(\"ul\").find(\"li, a\").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== \"INS\"; }).prepend(\"<ins class='jstree-icon'> </ins>\").end().filter(\"a\").children(\"ins:first-child\").not(\".jstree-icon\").addClass(\"jstree-icon\"); obj.removeData(\"jstree_is_loading\"); }\n\t\t\t\t\t\t\t\tthis.clean_node(obj);\n\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.correct_state(obj);\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty();\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, this));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!s.data && !s.ajax):\n\t\t\t\t\t\tif(!obj || obj == -1) {\n\t\t\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t\t\t.children(\"ul\").empty()\n\t\t\t\t\t\t\t\t.append(this.data.html_data.original_container_html)\n\t\t\t\t\t\t\t\t.find(\"li, a\").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== \"INS\"; }).prepend(\"<ins class='jstree-icon'> </ins>\").end()\n\t\t\t\t\t\t\t\t.filter(\"a\").children(\"ins:first-child\").not(\".jstree-icon\").addClass(\"jstree-icon\");\n\t\t\t\t\t\t\tthis.clean_node();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):\n\t\t\t\t\t\tif(!obj || obj == -1) {\n\t\t\t\t\t\t\td = $(s.data);\n\t\t\t\t\t\t\tif(!d.is(\"ul\")) { d = $(\"<ul />\").append(d); }\n\t\t\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t\t\t.children(\"ul\").empty().append(d.children())\n\t\t\t\t\t\t\t\t.find(\"li, a\").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== \"INS\"; }).prepend(\"<ins class='jstree-icon'> </ins>\").end()\n\t\t\t\t\t\t\t\t.filter(\"a\").children(\"ins:first-child\").not(\".jstree-icon\").addClass(\"jstree-icon\");\n\t\t\t\t\t\t\tthis.clean_node();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):\n\t\t\t\t\t\tobj = this._get_node(obj);\n\t\t\t\t\t\terror_func = function (x, t, e) {\n\t\t\t\t\t\t\tvar ef = this.get_settings().html_data.ajax.error;\n\t\t\t\t\t\t\tif(ef) { ef.call(this, x, t, e); }\n\t\t\t\t\t\t\tif(obj != -1 && obj.length) {\n\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\tif(t === \"success\" && s.correct_state) { this.correct_state(obj); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(t === \"success\" && s.correct_state) { this.get_container().children(\"ul\").empty(); }\n\t\t\t\t\t\t\t}
2\n\t\t\t\t\t\t\tif(e_call) { e_call.call(this); }\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsuccess_func = function (d, t, x) {\n\t\t\t\t\t\t\tvar sf = this.get_settings().html_data.ajax.success;\n\t\t\t\t\t\t\tif(sf) { d = sf.call(this,d,t,x) || d; }\n\t\t\t\t\t\t\tif(d === \"\" || (d && d.toString && d.toString().replace(/^[\\s\\n]+$/,\"\") === \"\")) {\n\t\t\t\t\t\t\t\treturn error_func.call(this, x, t, \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d) {\n\t\t\t\t\t\t\t\td = $(d);\n\t\t\t\t\t\t\t\tif(!d.is(\"ul\")) { d = $(\"<ul />\").append(d); }\n\t\t\t\t\t\t\t\tif(obj == -1 || !obj) { this.get_container().children(\"ul\").empty().append(d.children()).find(\"li, a\").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== \"INS\"; }).prepend(\"<ins class='jstree-icon'> </ins>\").end().filter(\"a\").children(\"ins:first-child\").not(\".jstree-icon\").addClass(\"jstree-icon\"); }\n\t\t\t\t\t\t\t\telse { obj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\"); obj.append(d).children(\"ul\").find(\"li, a\").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== \"INS\"; }).prepend(\"<ins class='jstree-icon'> </ins>\").end().filter(\"a\").children(\"ins:first-child\").not(\".jstree-icon\").addClass(\"jstree-icon\"); obj.removeData(\"jstree_is_loading\"); }\n\t\t\t\t\t\t\t\tthis.clean_node(obj);\n\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tif(obj && obj !== -1) {\n\t\t\t\t\t\t\t\t\tobj.children(\"a.jstree-loading\").removeClass(\"jstree-loading\");\n\t\t\t\t\t\t\t\t\tobj.removeData(\"jstree_is_loading\");\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.correct_state(obj);\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif(s.correct_state) {\n\t\t\t\t\t\t\t\t\t\tthis.get_container().children(\"ul\").empty();\n\t\t\t\t\t\t\t\t\t\tif(s_call) { s_call.call(this); }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\ts.ajax.context = this;\n\t\t\t\t\t\ts.ajax.error = error_func;\n\t\t\t\t\t\ts.ajax.success = success_func;\n\t\t\t\t\t\tif(!s.ajax.dataType) { s.ajax.dataType = \"html\"; }\n\t\t\t\t\t\tif($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }\n\t\t\t\t\t\tif($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }\n\t\t\t\t\t\t$.ajax(s.ajax);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t// include the HTML data plugin by default\n\t$.jstree.defaults.plugins.push(\"html_data\");\n})(jQuery);\n//*/\n\n/*\n * jsTree themeroller plugin\n * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure \"themes\" is not included.\n */\n(function ($) {\n\t$.jstree.plugin(\"themeroller\", {\n\t\t__init : function () {\n\t\t\tvar s = this._get_settings().themeroller;\n\t\t\tthis.get_container()\n\t\t\t\t.addClass(\"ui-widget-content\")\n\t\t\t\t.addClass(\"jstree-themeroller\")\n\t\t\t\t.delegate(\"a\",\"mouseenter.jstree\", function (e) {\n\t\t\t\t\tif(!$(e.currentTarget).hasClass(\"jstree-loading\")) {\n\t\t\t\t\t\t$(this).addClass(s.item_h);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.delegate(\"a\",\"mouseleave.jstree\", function () {\n\t\t\t\t\t$(this).removeClass(s.item_h);\n\t\t\t\t})\n\t\t\t\t.bind(\"init.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tdata.inst.get_container().find(\"> ul > li > .jstree-loading > ins\").addClass(\"ui-icon-refresh\");\n\t\t\t\t\t\tthis._themeroller(data.inst.get_container().find(\"> ul > li\"));\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"open_node.jstree create_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._themeroller(data.rslt.obj);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"loaded.jstree refresh.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tthis._themeroller();\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"close_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._themeroller(data.rslt.obj);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"delete_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._themeroller(data.rslt.parent);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"correct_state.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tdata.rslt.obj\n\t\t\t\t\t\t\t.children(\"ins.jstree-icon\").removeClass(s.opened + \" \" + s.closed + \" ui-icon\").end()\n\t\t\t\t\t\t\t.find(\"> a >
2 ins.ui-icon\")\n\t\t\t\t\t\t\t\t.filter(function() {\n\t\t\t\t\t\t\t\t\treturn this.className.toString()\n\t\t\t\t\t\t\t\t\t\t.replace(s.item_clsd,\"\").replace(s.item_open,\"\").replace(s.item_leaf,\"\")\n\t\t\t\t\t\t\t\t\t\t.indexOf(\"ui-icon-\") === -1;\n\t\t\t\t\t\t\t\t}).removeClass(s.item_open + \" \" + s.item_clsd).addClass(s.item_leaf || \"jstree-no-icon\");\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"select_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tdata.rslt.obj.children(\"a\").addClass(s.item_a);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"deselect_node.jstree deselect_all.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t\t.find(\"a.\" + s.item_a).removeClass(s.item_a).end()\n\t\t\t\t\t\t\t.find(\"a.jstree-clicked\").addClass(s.item_a);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"dehover_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tdata.rslt.obj.children(\"a\").removeClass(s.item_h);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"hover_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis.get_container()\n\t\t\t\t\t\t\t.find(\"a.\" + s.item_h).not(data.rslt.obj).removeClass(s.item_h);\n\t\t\t\t\t\tdata.rslt.obj.children(\"a\").addClass(s.item_h);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"move_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._themeroller(data.rslt.o);\n\t\t\t\t\t\tthis._themeroller(data.rslt.op);\n\t\t\t\t\t}, this));\n\t\t},\n\t\t__destroy : function () {\n\t\t\tvar s = this._get_settings().themeroller,\n\t\t\t\tc = [ \"ui-icon\" ];\n\t\t\t$.each(s, function (i, v) {\n\t\t\t\tv = v.split(\" \");\n\t\t\t\tif(v.length) { c = c.concat(v); }\n\t\t\t});\n\t\t\tthis.get_container()\n\t\t\t\t.removeClass(\"ui-widget-content\")\n\t\t\t\t.find(\".\" + c.join(\", .\")).removeClass(c.join(\" \"));\n\t\t},\n\t\t_fn : {\n\t\t\t_themeroller : function (obj) {\n\t\t\t\tvar s = this._get_settings().themeroller;\n\t\t\t\tobj = !obj || obj == -1 ? this.get_container_ul() : this._get_node(obj).parent();\n\t\t\t\tobj\n\t\t\t\t\t.find(\"li.jstree-closed\")\n\t\t\t\t\t\t.children(\"ins.jstree-icon\").removeClass(s.opened).addClass(\"ui-icon \" + s.closed).end()\n\t\t\t\t\t\t.children(\"a\").addClass(s.item)\n\t\t\t\t\t\t\t.children(\"ins.jstree-icon\").addClass(\"ui-icon\")\n\t\t\t\t\t\t\t\t.filter(function() {\n\t\t\t\t\t\t\t\t\treturn this.className.toString()\n\t\t\t\t\t\t\t\t\t\t.replace(s.item_clsd,\"\").replace(s.item_open,\"\").replace(s.item_leaf,\"\")\n\t\t\t\t\t\t\t\t\t\t.indexOf(\"ui-icon-\") === -1;\n\t\t\t\t\t\t\t\t}).removeClass(s.item_leaf + \" \" + s.item_open).addClass(s.item_clsd || \"jstree-no-icon\")\n\t\t\t\t\t\t\t\t.end()\n\t\t\t\t\t\t\t.end()\n\t\t\t\t\t\t.end()\n\t\t\t\t\t.end()\n\t\t\t\t\t.find(\"li.jstree-open\")\n\t\t\t\t\t\t.children(\"ins.jstree-icon\").removeClass(s.closed).addClass(\"ui-icon \" + s.opened).end()\n\t\t\t\t\t\t.children(\"a\").addClass(s.item)\n\t\t\t\t\t\t\t.children(\"ins.jstree-icon\").addClass(\"ui-icon\")\n\t\t\t\t\t\t\t\t.filter(function() {\n\t\t\t\t\t\t\t\t\treturn this.className.toString()\n\t\t\t\t\t\t\t\t\t\t.replace(s.item_clsd,\"\").replace(s.item_open,\"\").replace(s.item_leaf,\"\")\n\t\t\t\t\t\t\t\t\t\t.indexOf(\"ui-icon-\") === -1;\n\t\t\t\t\t\t\t\t}).removeClass(s.item_leaf + \" \" + s.item_clsd).addClass(s.item_open || \"jstree-no-icon\")\n\t\t\t\t\t\t\t\t.end()\n\t\t\t\t\t\t\t.end()\n\t\t\t\t\t\t.end()\n\t\t\t\t\t.end()\n\t\t\t\t\t.find(\"li.jstree-leaf\")\n\t\t\t\t\t\t.children(\"ins.jstree-icon\").removeClass(s.closed + \" ui-icon \" + s.opened).end()\n\t\t\t\t\t\t.children(\"a\").addClass(s.item)\n\t\t\t\t\t\t\t.children(\"ins.jstree-icon\").addClass(\"ui-icon\")\n\t\t\t\t\t\t\t\t.filter(function() {\n\t\t\t\t\t\t\t\t\treturn this.className.toString()\n\t\t\t\t\t\t\t\t\t\t.replace(s.item_clsd,\"\").replace(s.item_open,\"\").replace(s.item_leaf,\"\")\n\t\t\t\t\t\t\t\t\t\t.indexOf(\"ui-icon-\") === -1;\n\t\t\t\t\t\t\t\t}).removeClass(s.item_clsd + \" \" + s.item_open).addClass(s.item_leaf || \"jstree-no-icon\");\n\t\t\t}\n\t\t},\n\t\tdefaults : {\n\t\t\t\"opened\"\t: \"ui-icon-triangle-1-se\",\n\t\t\t\"closed\"\t: \"ui-icon-triangle-1-e\",\n\t\t\t\"item\"\t\t: \"ui-state-default\",\n\t\t\t\"item_h\"\t: \"ui-state-hover\",\n\t\t\t\"item_a\"\t
2: \"ui-state-active\",\n\t\t\t\"item_open\"\t: \"ui-icon-folder-open\",\n\t\t\t\"item_clsd\"\t: \"ui-icon-folder-collapsed\",\n\t\t\t\"item_leaf\"\t: \"ui-icon-document\"\n\t\t}\n\t});\n\t$(function() {\n\t\tvar css_string = '' +\n\t\t\t'.jstree-themeroller .ui-icon { overflow:visible; } ' +\n\t\t\t'.jstree-themeroller a { padding:0 2px; } ' +\n\t\t\t'.jstree-themeroller .jstree-no-icon { display:none; }';\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"jstree\" });\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree unique plugin\n * Forces different names amongst siblings (still a bit experimental)\n * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)\n */\n(function ($) {\n\t$.jstree.plugin(\"unique\", {\n\t\t__init : function () {\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"before.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tvar nms = [], res = true, p, t;\n\t\t\t\t\t\tif(data.func == \"move_node\") {\n\t\t\t\t\t\t\t// obj, ref, position, is_copy, is_prepared, skip_check\n\t\t\t\t\t\t\tif(data.args[4] === true) {\n\t\t\t\t\t\t\t\tif(data.args[0].o && data.args[0].o.length) {\n\t\t\t\t\t\t\t\t\tdata.args[0].o.children(\"a\").each(function () { nms.push($(this).text().replace(/^\\s+/g,\"\")); });\n\t\t\t\t\t\t\t\t\tres = this._check_unique(nms, data.args[0].np.find(\"> ul > li\").not(data.args[0].o), \"move_node\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(data.func == \"create_node\") {\n\t\t\t\t\t\t\t// obj, position, js, callback, is_loaded\n\t\t\t\t\t\t\tif(data.args[4] || this._is_loaded(data.args[0])) {\n\t\t\t\t\t\t\t\tp = this._get_node(data.args[0]);\n\t\t\t\t\t\t\t\tif(data.args[1] && (data.args[1] === \"before\" || data.args[1] === \"after\")) {\n\t\t\t\t\t\t\t\t\tp = this._get_parent(data.args[0]);\n\t\t\t\t\t\t\t\t\tif(!p || p === -1) { p = this.get_container(); }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(typeof data.args[2] === \"string\") { nms.push(data.args[2]); }\n\t\t\t\t\t\t\t\telse if(!data.args[2] || !data.args[2].data) { nms.push(this._get_string(\"new_node\")); }\n\t\t\t\t\t\t\t\telse { nms.push(data.args[2].data); }\n\t\t\t\t\t\t\t\tres = this._check_unique(nms, p.find(\"> ul > li\"), \"create_node\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(data.func == \"rename_node\") {\n\t\t\t\t\t\t\t// obj, val\n\t\t\t\t\t\t\tnms.push(data.args[1]);\n\t\t\t\t\t\t\tt = this._get_node(data.args[0]);\n\t\t\t\t\t\t\tp = this._get_parent(t);\n\t\t\t\t\t\t\tif(!p || p === -1) { p = this.get_container(); }\n\t\t\t\t\t\t\tres = this._check_unique(nms, p.find(\"> ul > li\").not(t), \"rename_node\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!res) {\n\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this));\n\t\t},\n\t\tdefaults : {\n\t\t\terror_callback : $.noop\n\t\t},\n\t\t_fn : {\n\t\t\t_check_unique : function (nms, p, func) {\n\t\t\t\tvar cnms = [];\n\t\t\t\tp.children(\"a\").each(function () { cnms.push($(this).text().replace(/^\\s+/g,\"\")); });\n\t\t\t\tif(!cnms.length || !nms.length) { return true; }\n\t\t\t\tcnms = cnms.sort().join(\",,\").replace(/(,|^)([^,]+)(,,\\2)+(,|$)/g,\"$1$2$4\").replace(/,,+/g,\",\").replace(/,$/,\"\").split(\",\");\n\t\t\t\tif((cnms.length + nms.length) != cnms.concat(nms).sort().join(\",,\").replace(/(,|^)([^,]+)(,,\\2)+(,|$)/g,\"$1$2$4\").replace(/,,+/g,\",\").replace(/,$/,\"\").split(\",\").length) {\n\t\t\t\t\tthis._get_settings().unique.error_callback.call(null, nms, p, func);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tcheck_move : function () {\n\t\t\t\tif(!this.__call_old()) { return false; }\n\t\t\t\tvar p = this._get_move(), nms = [];\n\t\t\t\tif(p.o && p.o.length) {\n\t\t\t\t\tp.o.children(\"a\").each(function () { nms.push($(this).text().replace(/^\\s+/g,\"\")); });\n\t\t\t\t\treturn this._check_unique(nms, p.np.find(\"> ul > li\").not(p.o), \"check_move\");\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n/*\n * jsTree wholerow plugin\n * Makes select and hover work on the entire width of the node\n * MAY BE HEAVY IN LARGE DOM\n */\n(function ($) {\n\t$.jstree.plugin(\"wholerow\", {\n\t\t__init : function () {\n\t\t\tif(!this.data.ui) { throw \"jsTree wholerow: jsTree UI plugin not included.\"; }\n\t\t\tthis.data.wholerow.html = false;\n\t\t\tthis.data.wholerow.to = false;\n\t\t\tthis.get_container()\n\t\t\t\t.bind(\"init.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._get_settings().core.animation = 0;\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"open_node.jstree create_node.jstree clean_node.jstree loaded.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis._prepare_wholerow_span( data && data.rslt && data.rslt.obj ? data.rslt.obj : -1 );\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tif(this.data.to) { clearTimeout(this.data.to); }\n\t\t\t\t\t\tthis.data.to = setTimeout( (function (t, o) { return function() { t._prepare_wholerow_ul(o); }; })(this, data && data.rslt && data.rslt.obj ? data.rslt.obj : -1), 0);\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"deselect_all.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis.get_container().find(\" > .jstree-wholerow .jstree-clicked\").removeClass(\"jstree-clicked \" + (this.data.themeroller ? this._get_settings().themeroller.item_a : \"\" ));\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"select_node.jstree deselect_node.jstree \", $.proxy(function (e, data) {\n\t\t\t\t\t\tdata.rslt.obj.each(function () {\n\t\t\t\t\t\t\tvar ref = data.inst.get_container().find(\" > .jstree-wholerow li:visible:eq(\" + ( parseInt((($(this).offset().top - data.inst.get_container().offset().top + data.inst.get_container()[0].scrollTop) / data.inst.data.core.li_height),10)) + \")\");\n\t\t\t\t\t\t\t// ref.children(\"a\")[e.type === \"select_node\" ? \"addClass\" : \"removeClass\"](\"jstree-clicked\");\n\t\t\t\t\t\t\tref.children(\"a\").attr(\"class\",data.rslt.obj.children(\"a\").attr(\"class\"));\n\t\t\t\t\t\t});\n\t\t\t\t\t}, this))\n\t\t\t\t.bind(\"hover_node.jstree dehover_node.jstree\", $.proxy(function (e, data) {\n\t\t\t\t\t\tthis.get_container().find(\" > .jstree-wholerow .jstree-hovered\").removeClass(\"jstree-hovered \" + (this.data.themeroller ? this._get_settings().themeroller.item_h : \"\" ));\n\t\t\t\t\t\tif(e.type === \"hover_node\") {\n\t\t\t\t\t\t\tvar ref = this.get_container().find(\" > .jstree-wholerow li:visible:eq(\" + ( parseInt(((data.rslt.obj.offset().top - this.get_container().offset().top + this.get_container()[0].scrollTop) / this.data.core.li_height),10)) + \")\");\n\t\t\t\t\t\t\t// ref.children(\"a\").addClass(\"jstree-hovered\");\n\t\t\t\t\t\t\tref.children(\"a\").attr(\"class\",data.rslt.obj.children(\".jstree-hovered\").attr(\"class\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\".jstree-wholerow-span, ins.jstree-icon, li\", \"click.jstree\", function (e) {\n\t\t\t\t\t\tvar n = $(e.currentTarget);\n\t\t\t\t\t\tif(e.target.tagName === \"A\" || (e.target.tagName === \"INS\" && n.closest(\"li\").is(\".jstree-open, .jstree-closed\"))) { return; }\n\t\t\t\t\t\tn.closest(\"li\").children(\"a:visible:eq(0)\").click();\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t})\n\t\t\t\t.delegate(\"li\", \"mouseover.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\tif($(e.currentTarget).children(\".jstree-hovered, .jstree-clicked\").length) { return false; }\n\t\t\t\t\t\tthis.hover_node(e.currentTarget);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}, this))\n\t\t\t\t.delegate(\"li\", \"mouseleave.jstree\", $.proxy(function (e) {\n\t\t\t\t\t\tif($(e.currentTarget).children(\"a\").hasClass(\"jstree-hovered\").length) { return; }\n\t\t\t\t\t\tthis.dehover_node(e.currentTarget);\n\t\t\t\t\t}, this));\n\t\t\tif(is_ie7 || is_ie6) {\n\t\t\t\t$.vakata.css.add_sheet({ str : \".jstree-\" + this.get_index() + \" { position:relative; } \", title : \"jstree\" });\n\t\t\t}\n\t\t},\n\t\tdefaults : {\n\t\t},\n\t\t__destroy : function () {\n\t\t\tthis.get_container().children(\".jstree-wholerow\").remove();\n\t\t\tthis.get_container().find(\".jstree-wholerow-span\").remove();\n\t\t},\n\t\t_fn : {\n\t\t\t_prepare_wholerow_span : function (obj) {\n\t\t\t\tobj = !obj || obj == -1 ? this.get_container().find(\"> ul > li\") : this._get_node(obj);\n\t\t\t\tif(obj === false) { return; } // added for removing root nodes\n\t\t\t\tobj.each(function () {\n\t\t\t\t\t$(this).find(\"li\").addBack().each(function () {\n\t\t\t\t\t\tvar $t = $(this);\n\t\t\t\t\t\tif($t.children(\".jstree-wholerow-span\").length) { return true; }\n\t\t\t\t\t\t$t.prepend(\"<span class='jstree-wholerow-span' style='width:\" + ($t.parentsUntil(\".jstree\",\"li\").length * 18) + \"px;'> </span>\");\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t_prepare_wholerow_ul : function () {\n\t\t\t\tvar o = this.get_container().children(\"ul\").eq(0), h = o.html();\n\t\t\t\to.addClass(\"jstree-wholerow-real\");
2\n\t\t\t\tif(this.data.wholerow.last_html !== h) {\n\t\t\t\t\tthis.data.wholerow.last_html = h;\n\t\t\t\t\tthis.get_container().children(\".jstree-wholerow\").remove();\n\t\t\t\t\tthis.get_container().append(\n\t\t\t\t\t\to.clone().removeClass(\"jstree-wholerow-real\")\n\t\t\t\t\t\t\t.wrapAll(\"<div class='jstree-wholerow' />\").parent()\n\t\t\t\t\t\t\t.width(o.parent()[0].scrollWidth)\n\t\t\t\t\t\t\t.css(\"top\", (o.height() + ( is_ie7 ? 5 : 0)) * -1 )\n\t\t\t\t\t\t\t.find(\"li[id]\").each(function () { this.removeAttribute(\"id\"); }).end()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t$(function() {\n\t\tvar css_string = '' +\n\t\t\t'.jstree .jstree-wholerow-real { position:relative; z-index:1; } ' +\n\t\t\t'.jstree .jstree-wholerow-real li { cursor:pointer; } ' +\n\t\t\t'.jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } ' +\n\t\t\t'.jstree .jstree-wholerow { position:relative; z-index:0; height:0; } ' +\n\t\t\t'.jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } ' +\n\t\t\t'.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } ' +\n\t\t\t'.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }' +\n\t\t\t'.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }' +\n\t\t\t'.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } ' +\n\t\t\t'.jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }';\n\t\tif(is_ff2) {\n\t\t\tcss_string += '' +\n\t\t\t\t'.jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } ' +\n\t\t\t\t'.jstree .jstree-wholerow-real a { border-color:transparent !important; } ';\n\t\t}\n\t\tif(is_ie7 || is_ie6) {\n\t\t\tcss_string += '' +\n\t\t\t\t'.jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } ' +\n\t\t\t\t'.jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } ';\n\t\t}\n\t\t$.vakata.css.add_sheet({ str : css_string, title : \"jstree\" });\n\t});\n})(jQuery);\n//*/\n\n/*\n* jsTree model plugin\n* This plugin gets jstree to use a class model to retrieve data, creating great dynamism\n*/\n(function ($) {\n\tvar nodeInterface = [\"getChildren\",\"getChildrenCount\",\"getAttr\",\"getName\",\"getProps\"],\n\t\tvalidateInterface = function(obj, inter) {\n\t\t\tvar valid = true;\n\t\t\tobj = obj || {};\n\t\t\tinter = [].concat(inter);\n\t\t\t$.each(inter, function (i, v) {\n\t\t\t\tif(!$.isFunction(obj[v])) { valid = false; return false; }\n\t\t\t});\n\t\t\treturn valid;\n\t\t};\n\t$.jstree.plugin(\"model\", {\n\t\t__init : function () {\n\t\t\tif(!this.data.json_data) { throw \"jsTree model: jsTree json_data plugin not included.\"; }\n\t\t\tthis._get_settings().json_data.data = function (n, b) {\n\t\t\t\tvar obj = (n == -1) ? this._get_settings().model.object : n.data(\"jstree_model\");\n\t\t\t\tif(!validateInterface(obj, nodeInterface)) { return b.call(null, false); }\n\t\t\t\tif(this._get_settings().model.async) {\n\t\t\t\t\tobj.getChildren($.proxy(function (data) {\
2n\t\t\t\t\t\tthis.model_done(data, b);\n\t\t\t\t\t}, this));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.model_done(obj.getChildren(), b);\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tdefaults : {\n\t\t\tobject : false,\n\t\t\tid_prefix : false,\n\t\t\tasync : false\n\t\t},\n\t\t_fn : {\n\t\t\tmodel_done : function (data, callback) {\n\t\t\t\tvar ret = [],\n\t\t\t\t\ts = this._get_settings(),\n\t\t\t\t\t_this = this;\n\n\t\t\t\tif(!$.isArray(data)) { data = [data]; }\n\t\t\t\t$.each(data, function (i, nd) {\n\t\t\t\t\tvar r = nd.getProps() || {};\n\t\t\t\t\tr.attr = nd.getAttr() || {};\n\t\t\t\t\tif(nd.getChildrenCount()) { r.state = \"closed\"; }\n\t\t\t\t\tr.data = nd.getName();\n\t\t\t\t\tif(!$.isArray(r.data)) { r.data = [r.data]; }\n\t\t\t\t\tif(_this.data.types && $.isFunction(nd.getType)) {\n\t\t\t\t\t\tr.attr[s.types.type_attr] = nd.getType();\n\t\t\t\t\t}\n\t\t\t\t\tif(r.attr.id && s.model.id_prefix) { r.attr.id = s.model.id_prefix + r.attr.id; }\n\t\t\t\t\tif(!r.metadata) { r.metadata = { }; }\n\t\t\t\t\tr.metadata.jstree_model = nd;\n\t\t\t\t\tret.push(r);\n\t\t\t\t});\n\t\t\t\tcallback.call(null, ret);\n\t\t\t}\n\t\t}\n\t});\n})(jQuery);\n//*/\n\n\n/*\n * jsTree checkbox plugin copy-paste\n * change_state method was modified\n * refactoring is needed after update to a newer version of jstree, that supports plugin extending\n */\n(function ($) {\n $.jstree.plugin(\"vcheckbox\", {\n __init : function () {\n this.data.vcheckbox.noui = this._get_settings().vcheckbox.override_ui;\n if(this.data.ui && this.data.vcheckbox.noui) {\n this.select_node = this.deselect_node = this.deselect_all = $.noop;\n this.get_selected = this.get_checked;\n }\n\n this.get_container()\n .bind(\"open_node.jstree create_node.jstree clean_node.jstree refresh.jstree\", $.proxy(function (e, data) {\n this._prepare_checkboxes(data.rslt.obj);\n }, this))\n .bind(\"loaded.jstree\", $.proxy(function (e) {\n this._prepare_checkboxes();\n }, this))\n .delegate( (this.data.ui && this.data.vcheckbox.noui ? \"a\" : \"ins.jstree-checkbox\") , \"click.jstree\", $.proxy(function (e) {\n e.preventDefault();\n if(this._get_node(e.target).hasClass(\"jstree-checked\")) { this.uncheck_node(e.target); }\n else { this.check_node(e.target); }\n if(this.data.ui && this.data.vcheckbox.noui) {\n this.save_selected();\n if(this.data.cookies) { this.save_cookie(\"select_node\"); }\n }\n else {\n e.stopImmediatePropagation();\n return false;\n }\n }, this));\n },\n defaults : {\n override_ui : false,\n two_state : false,\n real_checkboxes : false,\n checked_parent_open : true,\n real_checkboxes_names : function (n) { return [ (\"check_\" + (n[0].id || Math.ceil(Math.random() * 10000))) , 1]; }\n },\n __destroy : function () {\n this.get_container()\n .find(\"input.jstree-real-checkbox\").removeClass(\"jstree-real-checkbox\").end()\n .find(\"ins.jstree-checkbox\").remove();\n },\n _fn : {\n _checkbox_notify : function (n, data) {\n if(data.checked) {\n this.check_node(n, false);\n }\n },\n _prepare_checkboxes : function (obj) {\n obj = !obj || obj == -1 ? this.get_container().find(\"> ul > li\") : this._get_node(obj);\n if(obj === false) { return; } // added for removing root nodes\n var c, _this = this, t, ts = this._get_settings().vcheckbox.two_state, rc = this._get_settings().vcheckbox.real_checkboxes, rcn = this._get_settings().vcheckbox.real_checkboxes_names;\n obj.each(function () {\n t = $(this);\n c = t.is(\"li\") && (t.hasClass(\"jstree-checked\") || (rc && t.children(\":checked\").length)) ? \"jstree-checked\" : \"jstree-unchecked\";\n t.find(\"li\").addBack().each(function () {\n var $t = $(this), nm;\n $t.children(\"a\" + (_this.data.languages ? \"\" : \":eq(0)\") ).not(\":has(.jstree-checkbox)\").prepend(\"<ins class='jstree-checkbox'> </ins>\").parent().not(\".jstree-checked, .jstree-unchecked\").addClass( ts ? \"jstree-unchecked\" : c );\n if(rc) {\n if(!$t.children(\":checkbox\").length) {\n nm = rcn.call(_this, $t);\n $t.prepend(\"<input type='checkbox' class='jstree-real-checkbox' id='\" + nm[0] + \"' name='\" + nm[0] + \"' value='\" + nm[1] + \"' />\");\n }\n else {\n $t.children(\":checkbox\").addClass(\"jstree-real-checkbox\");\n }\n }\n if(!ts) {\n if(c === \"jstree-checked\" || $t.hasClass(\"jstree-checked\") || $t.children(':checked').length) {\n $t.find(\"li\").addBack().addClass(\"jstree-checked\").children(\":checkbox\").prop(\"checked\", true);\n }\n }\n else {\n if($t.hasClass(\"jstree-checked\") || $t.children(':checked').length) {\n $t.addClass(\"jstree-checked\").children(\":checkbox\").prop(\"checked\", true);\n }\n }\n });\n });\n if(!ts) {\n obj.find(\".jstree-checked\").parent().parent().each(function () { _this._repair_state(this); });\n }\n },\n change_state : function (obj, state) {\n obj = this._get_node(obj);\n var coll = false, rc = this._get_settings().vcheckbox.real_checkboxes;\n if(!obj || obj === -1) { return false; }\n state = (state === false || state === true) ? state : obj.hasClass(\"jstree-checked\");
2\n if(this._get_settings().vcheckbox.two_state) {\n if(state) {\n coll = obj.find(\"li\").addBack();\n if(!coll.filter(\".jstree-checked\").length) { return false; }\n coll.removeClass(\"jstree-checked\").addClass(\"jstree-unchecked\");\n if(rc) { coll.children(\":checkbox\").prop(\"checked\", false); }\n }\n else {\n coll = obj.find(\"li\").addBack();\n if(!coll.filter(\".jstree-unchecked\").length) { return false; }\n coll.removeClass(\"jstree-unchecked\").addClass(\"jstree-checked\");\n if(rc) { coll.children(\":checkbox\").prop(\"checked\", true); }\n if(this.data.ui) { this.data.ui.last_selected = obj; }\n this.data.vcheckbox.last_selected = obj;\n }\n obj.parentsUntil(\".jstree\", \"li\").each(function () {\n var $this = $(this);\n if(state) {\n if($this.children(\"ul\").children(\"li.jstree-checked\").length) {\n $this.parentsUntil(\".jstree\", \"li\").addBack().removeClass(\"jstree-unchecked\").addClass(\"jstree-checked\");\n if(rc) { $this.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", true); }\n return false;\n }\n }\n else {\n if($this.children(\"ul\").children(\"li.jstree-unchecked\").length) {\n $this.parentsUntil(\".jstree\", \"li\").addBack().removeClass(\"jstree-unchecked\").addClass(\"jstree-checked\");\n if(rc) { $this.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", true); }\n return false;\n }\n else {\n $this.removeClass(\"jstree-unchecked\").addClass(\"jstree-checked\");\n if(rc) { $this.children(\":checkbox\").prop(\"checked\", true); }\n }\n }\n });\n }\n else {\n if(state) {\n coll = obj.find(\"li\").addBack();\n if(!coll.filter(\".jstree-checked, .jstree-undetermined\").length) { return false; }\n coll.removeClass(\"jstree-checked jstree-undetermined\").addClass(\"jstree-unchecked\");\n if(rc) { coll.children(\":checkbox\").prop(\"checked\", false); }\n }\n else {\n coll = obj.find(\"li\").addBack();\n if(!coll.filter(\".jstree-unchecked, .jstree-undetermined\").length) { return false; }\n coll.removeClass(\"jstree-unchecked jstree-undetermined\").addClass(\"jstree-checked\");\n if(rc) { coll.children(\":checkbox\").prop(\"checked\", true); }\n if(this.data.ui) { this.data.ui.last_selected = obj; }\n this.data.vcheckbox.last_selected = obj;\n }\n obj.parentsUntil(\".jstree\", \"li\").each(function () {\n var $this = $(this);\n if(state) {\n if($this.children(\"ul\").children(\"li.jstree-checked, li.jstree-undetermined\").length) {\n $this.parentsUntil(\".jstree\", \"li\").addBack().removeClass(\"jstree-checked jstree-unchecked\").addClass(\"jstree-undetermined\");\n if(rc) { $this.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", false); }\n return false;\n }\n else {\n $this.removeClass(\"jstree-checked jstree-undetermined\").addClass(\"jstree-unchecked\");\n if(rc) { $this.children(\":checkbox\").prop(\"checked\", false); }\n }\n }\n else {\n if($this.children(\"ul\").children(\"li.jstree-unchecked, li.jstree-undetermined\").length) {\n $this.parentsUntil(\".jstree\", \"li\").addBack().removeClass(\"jstree-checked jstree-unchecked\").addClass(\"jstree-undetermined\");\n if(rc) { $this.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", false); }\n return false;\n }\n else {\n $this.removeClass(\"jstree-unchecked jstree-undetermined\").addClass(\"jstree-checked\");\n if(rc) { $this.children(\":checkbox\").prop(\"checked\", true); }\n }\n }\n });\n }\n if(this.data.ui && this.data.vcheckbox.noui) { this.data.ui.selected = this.get_checked(); }\n this.__callback(obj);\n return true;\n },\n check_node : function (obj) {\n if(this.change_state(
2obj, false)) {\n obj = this._get_node(obj);\n if(this._get_settings().vcheckbox.checked_parent_open) {\n var t = this;\n obj.parents(\".jstree-closed\").each(function () { t.open_node(this, false, true); });\n }\n this.__callback({ \"obj\" : obj });\n }\n },\n uncheck_node : function (obj) {\n if(this.change_state(obj, true)) { this.__callback({ \"obj\" : this._get_node(obj) }); }\n },\n check_all : function () {\n var _this = this,\n coll = this._get_settings().vcheckbox.two_state ? this.get_container_ul().find(\"li\") : this.get_container_ul().children(\"li\");\n coll.each(function () {\n _this.change_state(this, false);\n });\n this.__callback();\n },\n uncheck_all : function () {\n var _this = this,\n coll = this._get_settings().vcheckbox.two_state ? this.get_container_ul().find(\"li\") : this.get_container_ul().children(\"li\");\n coll.each(function () {\n _this.change_state(this, true);\n });\n this.__callback();\n },\n\n is_checked : function(obj) {\n obj = this._get_node(obj);\n return obj.length ? obj.is(\".jstree-checked\") : false;\n },\n get_checked : function (obj, get_all) {\n obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);\n return get_all || this._get_settings().vcheckbox.two_state ? obj.find(\".jstree-checked\") : obj.find(\"> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked\");\n },\n get_unchecked : function (obj, get_all) {\n obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);\n return get_all || this._get_settings().vcheckbox.two_state ? obj.find(\".jstree-unchecked\") : obj.find(\"> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked\");\n },\n\n show_checkboxes : function () { this.get_container().children(\"ul\").removeClass(\"jstree-no-checkboxes\"); },\n hide_checkboxes : function () { this.get_container().children(\"ul\").addClass(\"jstree-no-checkboxes\"); },\n\n _repair_state : function (obj) {\n obj = this._get_node(obj);\n if(!obj.length) { return; }\n if(this._get_settings().vcheckbox.two_state) {\n obj.find('li').addBack().not('.jstree-checked').removeClass('jstree-undetermined').addClass('jstree-unchecked').children(':checkbox').prop('checked', true);\n return;\n }\n var rc = this._get_settings().vcheckbox.real_checkboxes,\n a = obj.find(\"> ul > .jstree-checked\").length,\n b = obj.find(\"> ul > .jstree-undetermined\").length,\n c = obj.find(\"> ul > li\").length;\n if(c === 0) { if(obj.hasClass(\"jstree-undetermined\")) { this.change_state(obj, false); } }\n else if(a === 0 && b === 0) { this.change_state(obj, true); }\n else if(a === c) { this.change_state(obj, false); }\n else {\n obj.parentsUntil(\".jstree\",\"li\").addBack().removeClass(\"jstree-checked jstree-unchecked\").addClass(\"jstree-undetermined\");\n if(rc) { obj.parentsUntil(\".jstree\", \"li\").addBack().children(\":checkbox\").prop(\"checked\", false); }\n }\n },\n reselect : function () {\n if(this.data.ui && this.data.vcheckbox.noui) {\n var _this = this,\n s = this.data.ui.to_select;\n s = $.map($.makeArray(s), function (n) { return \"#\" + n.toString().replace(/^#/,\"\").replace(/\\\\\\//g,\"/\").replace(/\\//g,\"\\\\\\/\").replace(/\\\\\\./g,\".\").replace(/\\./g,\"\\\\.\").replace(/\\:/g,\"\\\\:\"); });\n this.deselect_all();\n $.each(s, function (i, val) { _this.check_node(val); });\n this.__callback();\n }\n else {\n this.__call_old();\n }\n },\n save_loaded : function () {\n var _this = this;\n this.data.core.to_load = [];\n this.get_container_ul().find(\"li.jstree-closed.jstree-undetermined\").each(function () {\n if(this.id
2) { _this.data.core.to_load.push(\"#\" + this.id); }\n });\n }\n }\n });\n $(function() {\n var css_string = '.jstree .jstree-real-checkbox { display:none; } ';\n $.vakata.css.add_sheet({ str : css_string, title : \"jstree\" });\n });\n})(jQuery);\n\n\n})();\n\n}));","MGS_Mpanel/js/callbacks.js":"/**\n * IASCallbacks v2.2.2\n * http://infiniteajaxscroll.com\n *\n * This file is part of the Infinite AJAX Scroll package\n *\n * Copyright 2014-2016 Webcreate (Jeroen Fiege)\n */\n\nvar IASCallbacks = function ($) {\n this.list = [];\n this.fireStack = [];\n this.isFiring = false;\n this.isDisabled = false;\n\n /**\n * Calls all added callbacks\n *\n * @private\n * @param args\n */\n this.fire = function (args) {\n var context = args[0],\n deferred = args[1],\n callbackArguments = args[2];\n\n this.isFiring = true;\n\n for (var i = 0, l = this.list.length; i < l; i++) {\n if (this.list[i] != undefined) {\n if (false === this.list[i].fn.apply(context, callbackArguments)) {\n deferred.reject();\n\n break;\n }\n }\n }\n\n this.isFiring = false;\n\n deferred.resolve();\n\n if (this.fireStack.length) {\n this.fire(this.fireStack.shift());\n }\n };\n\n /**\n * Returns index of the callback in the list in a similar way as\n * the indexOf function.\n *\n * @param callback\n * @param {number} index index to start the search from\n * @returns {number}\n */\n this.inList = function (callback, index) {\n index = index || 0;\n\n for (var i = index, length = this.list.length; i < length; i++) {\n if (this.list[i].fn === callback || (callback.guid && this.list[i].fn.guid && callback.guid === this.list[i].fn.guid)) {\n return i;\n }\n }\n\n return -1;\n };\n\n return this;\n};\n\nIASCallbacks.prototype = {\n /**\n * Adds a callback\n *\n * @param callback\n * @returns {IASCallbacks}\n * @param priority\n */\n add: function (callback, priority) {\n var callbackObject = {fn: callback, priority: priority};\n\n priority = priority || 0;\n\n for (var i = 0, length = this.list.length; i < length; i++) {\n if (priority > this.list[i].priority) {\n this.list.splice(i, 0, callbackObject);\n\n return this;\n }\n }\n\n this.list.push(callbackObject);\n\n return this;\n },\n\n /**\n * Removes a callback\n *\n * @param callback\n * @returns {IASCallbacks}\n */\n remove: function (callback) {\n var index = 0;\n\n while (( index = this.inList(callback, index) ) > -1) {\n this.list.splice(index, 1);\n }\n\n return this;\n },\n\n /**\n * Checks if callback is added\n *\n * @param callback\n * @returns {*}\n */\n has: function (callback) {\n return (this.inList(callback) > -1);\n },\n\n\n /**\n * Calls callbacks with a context\n *\n * @param context\n * @param args\n * @returns {object|void}\n */\n fireWith: function (context, args) {\n var deferred = $.Deferred();\n\n if (this.isDisabled) {\n return deferred.reject();\n }\n\n args = args || [];\n args = [ context, deferred, args.slice ? args.slice() : args ];\n\n if (this.isFiring) {\n this.fireStack.push(args);\n } else {\n this.fire(args);\n }\n\n return deferred;\n },\n\n /**\n * Disable firing of new events\n */\n disable: function () {\n this.isDisabled = true;\n },\n\n /**\n * Enable firing of new events\n */\n enable: function () {\n this.isDisabled = false;\n }\n};","MGS_Mpanel/js/catalog-ajax.min.js":"if(CATALOG_AJAX){\n\tdefine([\n\t\t\"jquery\",\n\t\t\"jquery/ui\",\n\t\t\"mage/translate\",\n\t\t\"magnificPopup\",\n\t\t\"Magento_Catalog/js/product/list/toolbar\"\n\t], function($, ui) {\n\t\t/**\n\t\t * ProductListToolbarForm Widget - this widget is setting cookie and submitting form according to toolbar controls\n\t\t */\n\t\t$.widget('mage.productListToolbarForm', $.mage.productListToolbarForm, {\n\n\t\t\toptions:\n\t\t\t{\n\t\t\t\tmodeControl: '[data-role=\"mode-switcher\"]',\n\t\t\t\tdirectionControl: '[data-role=\"direction-switcher\"]',\n\t\t\t\torderControl: '[data-role=\"sorter\"]',\n\t\t\t\tlimitControl: '[data-role=\"limiter\"]',\n\t\t\t\tpagerControl: '[data-role=\"pager\"], .pages-items a',\n\t\t\t\tmode: 'product_list_mode',\n\t\t\t\tdirection: 'product_list_dir',\n\t\t\t\torder: 'product_list_order',\n\t\t\t\tlimit: 'product_list_limit',\n\t\t\t\tpager: 'p',\n\t\t\t\tmodeDefault: 'grid',\n\t\t\t\tdirectionDefault: 'asc',\n\t\t\t\torderDefault: 'position',\n\t\t\t\tlimitDefault: '9',\n\t\t\t\tpagerDefault: '1',\n\t\t\t\tproductsToolbarControl:'.toolbar.toolbar-products',\n\t\t\t\tproductsListBlock: '.products.wrapper',\n\t\t\t\tlayeredNavigationFilterBlock: '.block.filter',\n\t\t\t\tfilterItemControl: '.block.filter .item a, .block.filter .filter-clear,.block.filter .swatch-option-link-layered, .pagination .item a',\n\t\t\t\turl: ''\n\t\t\t},\n\n\t\t\t_create: function () {\n\t\t\t\tthis._super();\n\t\t\t\tthis._bind($(this.options.pagerControl), this.options.pager, this.options.pagerDefault);\n\t\t\t\t$(this.options.filterItemControl)\n\t\t\t\t\t.off('click.'+this.namespace+'productListToolbarForm')\n\t\t\t\t\t.on('click.'+this.namespace+'productListToolbarForm', {}, $.proxy(this.applyFilterToProductsList, this))\n\t\t\t\t;\n\t\t\t\t//console.log('toolbar');\n\t\t\t},\n\t\t\t_bind: function (element, paramName, defaultValue) {\n\t\t\t\t/**\n\t\t\t\t * Prevent double binding of these events because this component is being applied twice in the UI\n\t\t\t\t */\n\t\t\t\tif (element.is(\"select\")) {\n\t\t\t\t\telement\n\t\t\t\t\t\t.off('change.'+this.namespace+'productListToolbarForm')\n\t\t\t\t\t\t.on('change.'+this.namespace+'productListToolbarForm', {paramName: paramName, default: defaultValue}, $.proxy(this._processSelect, this));\n\t\t\t\t} else {\n\t\t\t\t\telement\n\t\t\t\t\t\t.off('click.'+this.namespace+'productListToolbarForm')\n\t\t\t\t\t\t.on('click.'+this.namespace+'productListToolbarForm', {paramName: paramName, default: defaultValue}, $.proxy(this._processLink, this));\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyFilterToProductsList: function (evt) {\n\t\t\t\tvar link = $(evt.currentTarget);\n\t\t\t\tvar urlParts = link.attr('href').split('?');\n\t\t\t\tthis.makeAjaxCall(urlParts[0], urlParts[1]);\n\t\t\t\tevt.preventDefault();\n\t\t\t},\n\t\t\tupdateUrl: function (url, paramData) {\n\t\t\t\tif (!url) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (paramData && paramData.length > 0) {\n\t\t\t\t\turl += '?' + paramData;\n\t\t\t\t}\n\t\t\t\tif (typeof history.replaceState === 'function') {\n\t\t\t\t\thistory.replaceState(null, null, url);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tgetParams: function (urlParams, paramName, paramValue, defaultValue) {\n\t\t\t\tvar paramData = {},\n\t\t\t\t\tparameters;\n\n\t\t\t\tfor (var i = 0;
2 i < urlParams.length; i++) {\n\t\t\t\t\tparameters = urlParams[i].split('=');\n\t\t\t\t\tif (parameters[1] !== undefined) {\n\t\t\t\t\t\tparamData[parameters[0]] = parameters[1];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparamData[parameters[0]] = '';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparamData[paramName] = paramValue;\n\t\t\t\tif (paramValue == defaultValue) {\n\t\t\t\t\tdelete paramData[paramName];\n\t\t\t\t}\n\t\t\t\treturn window.decodeURIComponent($.param(paramData).replace(/\\+/g, '%20'));\n\t\t\t},\n\t\t\t_updateContent: function (content, pageLayout) {\n\t\t\t\t$(this.options.productsToolbarControl).remove();\n\t\t\t\t\n\t\t\t\tif(content.products_list){\n\t\t\t\t\t$(this.options.productsListBlock)\n\t\t\t\t\t\t.replaceWith(content.products_list)\n\t\t\t\t\t;\n\t\t\t\t}\n\n\t\t\t\tif(content.filters){\n\t\t\t\t\t$(this.options.layeredNavigationFilterBlock).replaceWith(content.filters)\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(pageLayout=='1column'){\n\t\t\t\t\t$('.category-product-actions:first').remove();\n\t\t\t\t}\n\n\t\t\t\t$('body').trigger('contentUpdated');\n\t\t\t\t\n\t\t\t\tsetTimeout(this.reInitFunction(), 100);\n\t\t\t},\n\n\t\t\tupdateContent: function (content, pageLayout) {\n\t\t\t\t$('html, body').animate(\n\t\t\t\t\t{\n\t\t\t\t\t\tscrollTop: $(this.options.productsToolbarControl+\":first\").offset().top\n\t\t\t\t\t},\n\t\t\t\t\t100,\n\t\t\t\t\t'swing',\n\t\t\t\t\tthis._updateContent(content, pageLayout)\n\t\t\t\t);\n\t\t\t},\n\n\n\t\t\tchangeUrl: function (paramName, paramValue, defaultValue) {\n\t\t\t\tvar urlPaths = this.options.url.split('?'),\n\t\t\t\t\tbaseUrl = urlPaths[0],\n\t\t\t\t\turlParams = urlPaths[1] ? urlPaths[1].split('&') : [],\n\t\t\t\t\tparamData = this.getParams(urlParams, paramName, paramValue, defaultValue);\n\n\t\t\t\tthis.makeAjaxCall(baseUrl, paramData);\n\t\t\t},\n\n\t\t\tmakeAjaxCall: function (baseUrl, paramData) {\n\t\t\t\tvar self = this;\n\t\t\t\t$.ajax({\n\t\t\t\t\turl: baseUrl,\n\t\t\t\t\tdata: (paramData && paramData.length > 0 ? paramData + '&catalogajax=1' : 'catalogajax=1'),\n\t\t\t\t\ttype: 'get',\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tcache: true,\n\t\t\t\t\tshowLoader: true,\n\t\t\t\t\ttimeout: 10000\n\t\t\t\t}).done(function (response) {\n\t\t\t\t\tif (response.success) {\n\t\t\t\t\t\tself.updateUrl(baseUrl, paramData);\n\t\t\t\t\t\tself.updateContent(response.html, response.page_layout);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar msg = response.error_message;\n\t\t\t\t\t\talert(msg);\n\t\t\t\t\t}\n\t\t\t\t}).fail(function (error) {\n\t\t\t\t\talert($.mage.__('Sorry, something went wrong. Please try again later.'));\n\t\t\t\t});\n\t\t\t},\n\t\t\t\n\t\t\tinitAjaxAddToCart: function(tag, actionId, url, data){\n\t\t\t\t\n\t\t\t\t\tdata.push({\n\t\t\t\t\t\tname: 'action_url',\n\t\t\t\t\t\tvalue: tag.attr('action')\n\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t$addToCart = tag.find('.tocart').text();\n\t\t\t\t\t\t\n\t\t\t\t\tvar self = this;\n\t\t\t\t\tdata.push({\n\t\t\t\t\t\tname: 'ajax',\n\t\t\t\t\t\tvalue: 1\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: url,\n\t\t\t\t\t\tdata: $.param(data),\n\t\t\t\t\t\ttype: 'post',\n\t\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t\tbeforeSend: function(xhr, options) {\n\t\t\t\t\t\t\tif(ajaxCartConfig.animationType){\n\t\t\t\t\t\t\t\t$('#mgs-ajax-loading').show();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tif(tag.find('.tocart').length){\n\t\t\t\t\t\t\t\t\ttag.find('.tocart').addClass('disabled');\n\t\t\t\t\t\t\t\t\ttag.find('.tocart').text('Adding...');\n\t\t\t\t\t\t\t\t\ttag.find('.tocart').attr('title','Adding...');\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\ttag.addClass('disabled');\n\t\t\t\t\t\t\t\t\ttag.text('Adding...');\n\t\t\t\t\t\t\t\t\ttag.attr('title','Adding...');\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(response, status) {\n\t\t\t\t\t\t\tif (status == 'success') {\n\t\t\t\t\t\t\t\tif(response.backUrl){\n\t\t\t\t\t\t\t\t\tdata.push({\n\t\t\t\t\t\t\t\t\t\tname: 'action_url',\n\t\t\t\t\t\t\t\t\t\tvalue: response.backUrl\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tself.initAjaxAddToCart(tag, 'catalog-add-to-cart-' + $.now(), response.backUrl, data);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tif (response.ui) {\n\t\t\t\t\t\t\t\t\t\tif(response.productView){\n\t\t\t\t\t\t\t\t\t\t\t$('#mgs-ajax-loading').hide();\n\t\t\t\t\t\t\t\t\t\t\t\t$.magnificPopup.open({\n\t\t\t\t\t\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsrc: response.ui,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'iframe'\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tmainClass: 'success-ajax--popup',\n\t\t\t\t\t\t\t\t\t\t\t\t\tcloseOnBgClick: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpreloader: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttLoading: '',\n\t\t\t\t\t\t\t\t\t\t\t\t\tcallbacks: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topen: function() {\
2n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('#mgs-ajax-loading').hide();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('.mfp-preloader').css('display', 'block');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbeforeClose: function() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar url_cart_update = ajaxCartConfig.updateCartUrl;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('[data-block=\"minicart\"]').trigger('contentLoading');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl: url_cart_update,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmethod: \"POST\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclose: function() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('.mfp-preloader').css('display', 'none');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tafterClose: function() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(!response.animationType) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar $source = '';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(tag.find('.tocart').length){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttag.find('.tocart').removeClass('disabled');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttag.find('.tocart').text($addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttag.find('.tocart').attr('title',$addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(tag.closest('.product-item-info').length){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$source = tag.closest('.product-item-info');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar width = $source.outerWidth();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar height = $source.outerHeight();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$source = tag.find('.tocart');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar width = 300;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar height = 300;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttag.removeClass('disabled');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttag.text($addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttag.attr('title',$addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$source = tag.closest('.product-item-info');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar width = $source.outerWidth();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar height = $source.outerHeight();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('html, body').animate({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'scrollTop' : $(\".minicart-wrapper\").position().top\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},2000);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar $animatedObject = $('<div class=\"flycart-animated-add\" style=\"position: absolute;z-index: 99999;\">'+response.image+'</div>');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar left = $source.offset().left;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar top = $source.offset().top;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.css({top: top-1, left: left-1, width: width, height: height});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('html').append($animatedObject);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar divider = 3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar gotoX = $(\".minicart-wrapper\").offset().left + ($(\".minicart-wrapper\").width() / 2) - ($animatedObject.width()/divider)/2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar gotoY = $(\".minicart-wrapper\").offset().top + ($(\".minicart-wrapper\").height() / 2) - ($animatedObject.height()/divider)/2; \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.animate({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0.6,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tleft: gotoX,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttop: gotoY,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth: $animatedObject.width()/2,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\theight: $animatedObject.height()/2\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}, 2000,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfunction () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$(\".minicart-wrapper\").fadeOut('fast', function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$(\".minicart-wrapper\").fadeIn('fast', function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.fadeOut('fast', function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.remove();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\tvar $content = '<div class=\"popup__main popup--result\">'+response.ui + response.related + '</div>';\n\t\t\t\t\t\t\t\t\t\t\tif(response.animationType) {\n\t\t\t\t\t\t\t\t\t\t\t\t$('#mgs-ajax-loading').hide();\n\t\t\t\t\t\t\t\t\t\t\t\t$.magnificPopup.open({\n\t\t\t\t\t\t\t\t\t\t\t\t\tmainClass: 'success-ajax--popup',\n\t\t\t\t\t\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsrc: $content,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'inline'\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tcallbacks: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topen: function() {\
2n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('#mgs-ajax-loading').hide();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbeforeClose: function() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar url_cart_update = ajaxCartConfig.updateCartUrl;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$('[data-block=\"minicart\"]').trigger('contentLoading');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl: url_cart_update,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmethod: \"POST\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\tvar $source = '';\n\t\t\t\t\t\t\t\t\t\t\t\tif(tag.find('.tocart').length){\n\t\t\t\t\t\t\t\t\t\t\t\t\ttag.find('.tocart').removeClass('disabled');\n\t\t\t\t\t\t\t\t\t\t\t\t\ttag.find('.tocart').text($addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\ttag.find('.tocart').attr('title',$addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\tif(tag.closest('.product-item-info').length){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$source = tag.closest('.product-item-info');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar width = $source.outerWidth();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar height = $source.outerHeight();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$source = tag.find('.tocart');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar width = 300;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar height = 300;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttag.removeClass('disabled');\n\t\t\t\t\t\t\t\t\t\t\t\t\ttag.text($addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\ttag.attr('title',$addToCart);\n\t\t\t\t\t\t\t\t\t\t\t\t\t$source = tag.closest('.product-item-info');\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar width = $source.outerWidth();\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar height = $source.outerHeight();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t$('html, body').animate({\n\t\t\t\t\t\t\t\t\t\t\t\t\t'scrollTop' : $(\".minicart-wrapper\").position().top\n\t\t\t\t\t\t\t\t\t\t\t\t},2000);\n\t\t\t\t\t\t\t\t\t\t\t\tvar $animatedObject = $('<div class=\"flycart-animated-add\" style=\"position: absolute;z-index: 99999;\">'+response.image+'</div>');\n\t\t\t\t\t\t\t\t\t\t\t\tvar left = $source.offset().left;\n\t\t\t\t\t\t\t\t\t\t\t\tvar top = $source.offset().top;\n\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.css({top: top-1, left: left-1, width: width, height: height});\n\t\t\t\t\t\t\t\t\t\t\t\t$('html').append($animatedObject);\n\t\t\t\t\t\t\t\t\t\t\t\tvar divider = 3;\n\t\t\t\t\t\t\t\t\t\t\t\tvar gotoX = $(\".minicart-wrapper\").offset().left + ($(\".minicart-wrapper\").width() / 2) - ($animatedObject.width()/divider)/2;\n\t\t\t\t\t\t\t\t\t\t\t\tvar gotoY = $(\".minicart-wrapper\").offset().top + ($(\".minicart-wrapper\").height() / 2) - ($animatedObject.height()/divider)/2; \n\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.animate({\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0.6,\n\t\t\t\t\t\t\t\t\t\t\t\t\tleft: gotoX,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttop: gotoY,\n\t\t\t\t\t\t\t\t\t\t\t\t\twidth: $animatedObject.width()/2,\n\t\t\t\t\t\t\t\t\t\t\t\t\theight: $animatedObject.height()/2\n\t\t\t\t\t\t\t\t\t\t\t\t}, 2000,\n\t\t\t\t\t\t\t\t\t\t\t\tfunction () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$(\".minicart-wrapper\").fadeOut('fast', function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$(\".minicart-wrapper\").fadeIn('fast', function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.fadeOut('fast', function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$animatedObject.remove();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: function() {\n\t\t\t\t\t\t\t$('#mgs-ajax-loading').hide();\n\t\t\t\t\t\t\twindow.location.href = ajaxCartConfig.redirectCartUrl;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t},\n\t\t\t\n\t\t\treInitFunction: function(){\n\t\t\t\t$(\".mgs-quickview\").bind(\"click\", function() {\
2n\t\t\t\t\tvar b = $(this).attr(\"data-quickview-url\");\n\t\t\t\t\tb.length && reInitQuickview($, b)\n\t\t\t\t});\n \n $(\"img.lazy\").unveil(25, function(){\n var self = $(this);\n setTimeout(function(){\n self.removeClass('lazy');\n }, 0);\n });\n\t\t\t\t\n\t\t\t\tvar thisClass = this;\n\t\t\t\t\n\t\t\t\t$('button.tocart').click(function(event){\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\ttag = $(this).parents('form:first');\n\t\t\t\t\t\n\t\t\t\t\tvar data = tag.serializeArray();\n\t\t\t\t\tthisClass.initAjaxAddToCart(tag, 'catalog-add-to-cart-' + $.now(), tag.attr('action'), data);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tthis._create();\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t});\n\n\t\treturn $.mage.productListToolbarForm;\n\t});\n}else{\n\t/**\n\t * Copyright \u00a9 Magento, Inc. All rights reserved.\n\t * See COPYING.txt for license details.\n\t */\n\n\tdefine([\n\t\t'jquery',\n\t\t'jquery/ui'\n\t], function ($) {\n\t\t'use strict';\n\n\t\t/**\n\t\t * ProductListToolbarForm Widget - this widget is setting cookie and submitting form according to toolbar controls\n\t\t */\n\t\t$.widget('mage.productListToolbarForm', {\n\n\t\t\toptions: {\n\t\t\t\tmodeControl: '[data-role=\"mode-switcher\"]',\n\t\t\t\tdirectionControl: '[data-role=\"direction-switcher\"]',\n\t\t\t\torderControl: '[data-role=\"sorter\"]',\n\t\t\t\tlimitControl: '[data-role=\"limiter\"]',\n\t\t\t\tmode: 'product_list_mode',\n\t\t\t\tdirection: 'product_list_dir',\n\t\t\t\torder: 'product_list_order',\n\t\t\t\tlimit: 'product_list_limit',\n\t\t\t\tmodeDefault: 'grid',\n\t\t\t\tdirectionDefault: 'asc',\n\t\t\t\torderDefault: 'position',\n\t\t\t\tlimitDefault: '9',\n\t\t\t\turl: ''\n\t\t\t},\n\n\t\t\t/** @inheritdoc */\n\t\t\t_create: function () {\n\t\t\t\tthis._bind($(this.options.modeControl), this.options.mode, this.options.modeDefault);\n\t\t\t\tthis._bind($(this.options.directionControl), this.options.direction, this.options.directionDefault);\n\t\t\t\tthis._bind($(this.options.orderControl), this.options.order, this.options.orderDefault);\n\t\t\t\tthis._bind($(this.options.limitControl), this.options.limit, this.options.limitDefault);\n\t\t\t},\n\n\t\t\t/** @inheritdoc */\n\t\t\t_bind: function (element, paramName, defaultValue) {\n\t\t\t\tif (element.is('select')) {\n\t\t\t\t\telement.on('change', {\n\t\t\t\t\t\tparamName: paramName,\n\t\t\t\t\t\t'default': defaultValue\n\t\t\t\t\t}, $.proxy(this._processSelect, this));\n\t\t\t\t} else {\n\t\t\t\t\telement.on('click', {\n\t\t\t\t\t\tparamName: paramName,\n\t\t\t\t\t\t'default': defaultValue\n\t\t\t\t\t}, $.proxy(this._processLink, this));\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * @param {jQuery.Event} event\n\t\t\t * @private\n\t\t\t */\n\t\t\t_processLink: function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tthis.changeUrl(\n\t\t\t\t\tevent.data.paramName,\n\t\t\t\t\t$(event.currentTarget).data('value'),\n\t\t\t\t\tevent.data.default\n\t\t\t\t);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * @param {jQuery.Event} event\n\t\t\t * @private\n\t\t\t */\n\t\t\t_processSelect: function (event) {\n\t\t\t\tthis.changeUrl(\n\t\t\t\t\tevent.data.paramName,\n\t\t\t\t\tevent.currentTarget.options[event.currentTarget.selectedIndex].value,\n\t\t\t\t\tevent.data.default\n\t\t\t\t);\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * @param {String} paramName\n\t\t\t * @param {*} paramValue\n\t\t\t * @param {*} defaultValue\n\t\t\t */\n\t\t\tchangeUrl: function (paramName, paramValue, defaultValue) {\n\t\t\t\tvar decode = window.decodeURIComponent,\n\t\t\t\t\turlPaths = this.options.url.split('?'),\n\t\t\t\t\tbaseUrl = urlPaths[0],\n\t\t\t\t\turlParams = urlPaths[1] ? urlPaths[1].split('&') : [],\n\t\t\t\t\tparamData = {},\n\t\t\t\t\tparameters, i;\n\n\t\t\t\tfor (i = 0; i < urlParams.length; i++) {\n\t\t\t\t\tparameters = urlParams[i].split('=');\n\t\t\t\t\tparamData[decode(parameters[0])] = parameters[1] !== undefined ?\n\t\t\t\t\t\tdecode(parameters[1].replace(/\\+/g, '%20')) :\n\t\t\t\t\t\t'';\n\t\t\t\t}\n\t\t\t\tparamData[paramName] = paramValue;\n\n\t\t\t\tif (paramValue == defaultValue) { //eslint-disable-line eqeqeq\n\t\t\t\t\tdelete paramData[paramName];\n\t\t\t\t}\n\t\t\t\tparamData = $.param(paramData);\n\n\t\t\t\tlocation.href = baseUrl + (paramData.length ? '?' + paramData : '');\n\t\t\t}\n\t\t});\n\n\t\treturn $.mage.productListToolbarForm;\n\t});\n}
2","MGS_Mpanel/js/search-suggest.js":"/**\n * Copyright \u00a9 2015 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*jshint browser:true jquery:true*/\ndefine([\n 'jquery',\n 'underscore',\n 'mage/template',\n 'jquery/ui',\n 'mage/translate'\n], function ($, _, mageTemplate) {\n 'use strict';\n\n /**\n * Check wether the incoming string is not empty or if doesn't consist of spaces.\n *\n * @param {String} value - Value to check.\n * @returns {Boolean}\n */\n function isEmpty(value) {\n return (value.length === 0) || (value == null) || /^\\s+$/.test(value);\n }\n\n $.widget('mage.acmSearch', {\n options: {\n autocomplete: 'off',\n minSearchLength: 2,\n responseFieldElements: 'ul li',\n selectClass: 'selected',\n template:\n '<li class=\"<%- data.row_class %>\" id=\"qs-option-<%- data.index %>\" role=\"option\" data-name=\"<%- data.name %>\" data-id=\"<%- data.id %>\">' +\n '<span class=\"qs-option-name\" data-name=\"<%- data.name %>\" data-id=\"<%- data.id %>\">' +\n ' <%- data.name %>' +\n '</span>' +\n '</li>'\n },\n\n _create: function () {\n this.responseList = {\n indexList: null,\n selected: null\n };\n this.autoComplete = $(this.options.destinationSelector);\n this.searchForm = $(this.options.formSelector);\n\t\t\tthis.searchInput = $(this.options.destinationText);\n\t\t\tthis.resultHidden = $(this.options.destinationId);\n\n _.bindAll(this, '_onKeyDown', '_onPropertyChange');\n\n\n this.element.attr('autocomplete', this.options.autocomplete);\n\n this.element.on('blur', $.proxy(function () {\n setTimeout($.proxy(function () {\n this.autoComplete.hide();\n this._updateAriaHasPopup(false);\n }, this), 250);\n }, this));\n\n this.element.trigger('blur');\n this.element.on('keydown', this._onKeyDown);\n this.element.on('input propertychange', this._onPropertyChange);\n },\n /**\n * @private\n * @return {Element} The first element in the suggestion list.\n */\n _getFirstVisibleElement: function () {\n return this.responseList.indexList ? this.responseList.indexList.first() : false;\n },\n\n /**\n * @private\n * @return {Element} The last element in the suggestion list.\n */\n _getLastElement: function () {\n return this.responseList.indexList ? this.responseList.indexList.last() : false;\n },\n\n /**\n * @private\n * @param {Boolean} show Set attribute aria-haspopup to \"true/false\" for element.\n */\n _updateAriaHasPopup: function(show) {\n if (show) {\n this.element.attr('aria-haspopup', 'true');\n } else {\n this.element.attr('aria-haspopup', 'false');\n }\n },\n\n /**\n * Clears the item selected from the suggestion list and resets the suggestion list.\n * @private\n * @param {Boolean} all - Controls whether to clear the suggestion list.\n */\n _resetResponseList: function (all) {\n this.responseList.selected = null;\n\n if (all === true) {\n this.responseList.indexList = null;\n }\n\t\t\tthis.resultHidden.attr('value', '');\n },\n\t\t\n\t\t_updateNameAndId: function(selectedItem){\n\t\t\tif((selectedItem.length) && (selectedItem.attr('data-name')!='') && (selectedItem.attr('data-id')!='')){\n\t\t\t\tthis.searchInput.attr('value', selectedItem.attr('data-name'));\n\t\t\t\tthis.resultHidden.attr('value', selectedItem.attr('data-id'));\n\t\t\t}\n\t\t},\n\n /**\n * Executes when keys are pressed in the search input field. Performs specific actions\n * depending on which keys are pressed.\n * @private\n * @param {Event} e - The key down event\n * @return {Boolean} Default return type for any unhandled keys\n */\n _onKeyDown: function (e) {\n\t\t\t\n var keyCode = e.keyCode || e.which;\n\n switch (keyCode) {\n case $.ui.keyCode.HOME:\n this._getFirstVisibleElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getFirstVisibleElement();\n\t\t\t\t\tthis._updateNameAndId(this.responseList.selected);\n break;\n case $.ui.keyCode.END:\n this._getLastElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getLastElement();\n\t\t\t\t\tthis._updateNameAndId(this.responseList.selected);\n break;\n case $.ui.keyCode.ESCAPE:\n this._resetResponseList(true);\n this.autoComplete.hide();\n break;\n case $.ui.keyCode.ENTER:\n\t\t\t\t\tif (this.responseList.indexList) {\n if (this.responseList.selected) {\n this._updateNameAndId(this.responseList.selected);\n }\n }\n\t\t\t\t\t\n break;\n case $.ui.keyCode.DOWN:\n if (this.responseList.indexList) {\n if (!this.responseList.selected) {\n this._getFirstVisibleElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getFirstVisibleElement();\n }\n else if (!this._getLastElement().hasClass(this.options.selectClass)) {\n this.responseList.selected = this.responseList.selected.removeClass(this.options.selectClass).next().addClass(this.options.selectClass);\n } else {\n this.responseList.selected.removeClass(this.options.selectClass);\n this._getFirstVisibleElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getFirstVisibleElement();\n }\n this.element.val(this.responseList.selected.find('.qs-option-name').text());\n this.element.attr('aria-activedescendant', this.responseList.selected.attr('id'));\n\t\t\t\t\t\tthis._updateNameAndId(this.responseList.selected);\n }\n break;\n case $.ui.keyCode.UP:\n if (this.responseList.indexList !== null) {\n if (!this._getFirstVisibleElement().hasClass(this.options.selectClass)) {\n this.responseList.selected = this.responseList.selected.removeClass(this.options.selectClass).prev().addClass(this.options.selectClass);\n } else {\n this.responseList.selected.removeClass(this.options.selectClass);\n this._getLastElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getLastElement();\n }\n\t\t\t\t\t\tthis._updateNameAndId(this.responseList.selected);\n this.element.val(this.responseList.selected.find('.qs-option-name').text());\n this.element.attr('aria-activedescendant', this.responseList.selected.attr('id'));\n }\n break;\n default:\n return true;\n }\n },\n\n /**\n * Executes when the value of the search input field changes. Executes a GET request\n * to populate a suggestion list based on entered text. Handles click (select), hover,\n * and mouseout events on the populated suggestion list dropdown.\n * @private\n */\n _onPropertyChange: function () {\n var searchField = this.element,\n clonePosition = {\n position: 'absolute',\n // Removed to fix display issues\n // left: searchField.offset().left,\n // top: searchField.offset().top + searchField.outerHeight(),\
2n width: searchField.outerWidth()\n },\n source = this.options.template,\n template = mageTemplate(source),\n dropdown = $('<ul role=\"listbox\"></ul>'),\n value = this.element.val();\n\t\t\t\n if (value.length >= parseInt(this.options.minSearchLength, 10)) {\n\t\t\t\tvar parentDiv = this.searchInput.parent();\n\t\t\t\tparentDiv.addClass('mpanel-form-searching');\n $.get(this.options.url, {q: value}, $.proxy(function (data) {\n $.each(data, function(index, element) {\n element.index = index;\n var html = template({\n data: element\n });\n dropdown.append(html);\n\t\t\t\t\t\t\n });\n this.responseList.indexList = this.autoComplete.html(dropdown)\n .css(clonePosition)\n .show()\n .find(this.options.responseFieldElements + ':visible');\n\n this._resetResponseList(false);\n this.element.removeAttr('aria-activedescendant');\n\t\t\t\t\tparentDiv.removeClass('mpanel-form-searching');\n\n if (this.responseList.indexList.length) {\n this._updateAriaHasPopup(true);\n } else {\n this._updateAriaHasPopup(false);\n }\n\n this.responseList.indexList\n .on('click', function (e) {\n this.responseList.selected = $(e.target);\n\t\t\t\t\t\t\tthis._updateNameAndId(this.responseList.selected);\n }.bind(this))\n .on('mouseenter mouseleave', function (e) {\n this.responseList.indexList.removeClass(this.options.selectClass);\n $(e.target).addClass(this.options.selectClass);\n this.responseList.selected = $(e.target);\n this.element.attr('aria-activedescendant', $(e.target).attr('id'));\n }.bind(this))\n .on('mouseout', function (e) {\n if (!this._getLastElement() && this._getLastElement().hasClass(this.options.selectClass)) {\n $(e.target).removeClass(this.options.selectClass);\n this._resetResponseList(false);\n }\n }.bind(this));\n }, this));\n } else {\n\t\t\t\t\n this._resetResponseList(true);\n this.autoComplete.hide();\n this._updateAriaHasPopup(false);\n this.element.removeAttr('aria-activedescendant');\n }\n }\n });\n\n return $.mage.acmSearch;\n});\n"} 3}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.