{"version":3,"sources":["tipi.component.form.unified-select/tipi.component.form.unified-select.js","tipi.component.tabs/tipi.component.tabs.js","tipi.component.top-bar/tipi.component.top-bar.js","tipi.component.viewport-toggler/tipi.component.viewport-toggler.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"tipi.js","sourcesContent":["(function (win, doc, $){\n\n\t$(window).on({\n\t\t// All function needed on the first init\n\t\t'tipi.unified-select.init': function (event, unified_select, unified_selects) {\n\t\t\tsetUnifiedSelectReadyState(unified_select)\n\t\t\tsetUnifiedSelectDisabledState(unified_select);\n\t\t\tsetUnifiedSelectEvents(unified_select);\n\t\t\tsetUnifiedSelectValue(unified_select);\n\t\t\tsetUnifiedSelectNativeState(unified_select);\n\t\t\tunsetUnifiedSelectDropdown(unified_select);\n\t\t\tsetUnifiedSelectDropdown(unified_select);\n\t\t\tsetUnifiedSelectFilter(unified_select);\n\t\t\tsetUnifiedSelectDropdownItemEvents(unified_select);\n\n\t\t\tsetUnifiedSelectDropdownEvents(unified_select, unified_selects);\n\t\t},\n\t\t'tipi.unified-select.focus': function (event, unified_select) {\n\t\t\tfocusUnifiedSelect(unified_select);\n\t\t},\n\t\t'tipi.unified-select.blur': function (event, unified_select) {\n\t\t\tblurUnifiedSelect(unified_select);\n\t\t},\n\t\t'tipi.unified-select.open': function (event, unified_select, unified_selects) {\n\t\t\topenUnifiedSelectDropdown(unified_select, unified_selects);\n\t\t\tfocusFilterUnifiedSelect(unified_select);\n\t\t},\n\t\t'tipi.unified-select.close': function (event, unified_select) {\n\t\t\tcloseUnifiedSelectDropdown(unified_select);\n\t\t\tblurFilterUnifiedSelect(unified_select);\n\t\t},\n\t\t// All function needed when we changed the value of the select\n\t\t'tipi.unified-select.change': function (event, unified_select, index) {\n\t\t\tsetUnifiedSelectSelectedIndex(unified_select, index);\n\t\t},\n\t\t// Function to init when we wan't to update our select\n\t\t'tipi.unified-select.setValue' : function(event, unified_select) {\n\t\t\tsetUnifiedSelectValue(unified_select);\n\t\t}\n\t});\n\n\twindow.setUnifiedSelect = function() {\n\t\tvar unified_selects = $('.select').not('js__select--ready');\n\n\t\tif (unified_selects.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tunified_selects.each(function() {\n\t\t\tvar unified_select = $(this);\n\t\t\tvar select = unified_select.find('select');\n\n\t\t\tif(select.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$(window).trigger('tipi.unified-select.init', [unified_select, unified_selects]);\n\t\t});\n\t}\n\n\t// Add the ready state and show it to the world\n\tfunction setUnifiedSelectReadyState(unified_select) {\n\t\tunified_select.addClass('js__select--ready');\n\t}\n\n\t// Add the disabled state if our select is disabled\n\tfunction setUnifiedSelectDisabledState(unified_select) {\n\t\tvar disabled = getUnifiedSelectDisabledState(unified_select);\n\n\t\tif (disabled) {\n\t\t\tunified_select.addClass('js__select--disabled');\n\t\t}\n\t\telse {\n\t\t\tunified_select.removeClass('js__select--disabled');\n\t\t}\n\t}\n\n\tfunction getUnifiedSelectDisabledState(unified_select) {\n\t\tvar select = unified_select.find('select');\n\n\t\t// Try to define the disabled from the disabled attribute\n\t\tvar disabled = select.attr('disabled');\n\n\t\t// Check if the disabled state has been set as DOM property\n\t\tif (typeof disabled === 'undefined') {\n\t\t\tdisabled = select.prop('disabled');\n\t\t} else {\n\t\t\tdisabled = true;\n\t\t}\n\n\t\treturn disabled;\n\t}\n\n\tfunction setUnifiedSelectEvents(unified_select) {\n\t\tvar select = unified_select.find('select');\n\t\tselect.off('focus blur keyup change').on({\n\t\t\tfocus: function () {\n\t\t\t\t$(document).trigger('tipi.unified-select.focus', [unified_select]);\n\t\t\t},\n\t\t\tblur: function () {\n\t\t\t\t$(document).trigger('tipi.unified-select.blur', [unified_select]);\n\t\t\t},\n\t\t\tkeyup: function () {\n\t\t\t\tselect.blur().focus();\n\t\t\t},\n\t\t\tchange: function () {\n\t\t\t\t$(document).trigger('tipi.unified-select.setValue', [unified_select]);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Append the dropdown and items for our select\n\tfunction setUnifiedSelectValue(unified_select) {\n\t\tvar unified_select_field_value = unified_select.find('.select-field-value');\n\n\t\tvar select = unified_select.find('select');\n\n\t\tvar selected_index = select.get(0).selectedIndex;\n\t\tvar option = select.find('option').eq(selected_index);\n\n\t\tif (option.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar label = getUnifiedSelectOptionLabelAttribute(option);\n\n\t\t// Set the actual selected value!\n\t\tunified_select_field_value.text(label);\n\t}\n\n\t// Setup our unified select so it uses the native browser controls\n\tfunction setUnifiedSelectNativeState(unified_select) {\n\t\tif(!unified_select.hasClass('select--native')) {\n\t\t\tunsetUnifiedSelectNativeState(unified_select);\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure our unified select has no tab-index so we can focus the select directly\n\t\tunified_select.removeAttr('tabindex');\n\n\t\t// Remove any events we've added in the native state\n\t\tunified_select.off('focus blur');\n\t}\n\n\tfunction unsetUnifiedSelectNativeState(unified_select) {\n\t\t// Enable support for tabbing the selectbox\n\t\tunified_select.attr('tabindex', '0');\n\n\t\tunified_select.off('focus blur').on({\n\t\t\tfocus: function () {\n\t\t\t\t$(document).trigger('tipi.unified-select.focus', [unified_select]);\n\t\t\t},\n\t\t\tblur: function () {\n\t\t\t\t$(document).trigger('tipi.unified-select.blur', [unified_select]);\n\t\t\t}\n\t\t});\n\n\t\tvar select = unified_select.find('select');\n\t\t// Disable support for tabbing in the actual select element\n\t\tselect.attr('tabindex', '-1');\n\n\t}\n\n\t// Remove the dropdown and items for our select\n\tfunction unsetUnifiedSelectDropdown(unified_select) {\n\t\tvar unified_select_dropdown = unified_select.find('.select-dropdown');\n\n\t\t// Cancel unset if we don't have a dropdown defined.\n\t\tif (unified_select_dropdown.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove the unified_select_dropdown\n\t\tunified_select_dropdown.remove();\n\t}\n\n\t// Append the dropdown and items for our select\n\tfunction setUnifiedSelectDropdown(unified_select) {\n\t\t// Don't append the dropdown if we wan't to use the native select\n\t\tif (unified_select.hasClass('select--native')) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar unified_select_dropdown = unified_select.find('.select-dropdown');\n\t\tvar unified_select_dropdown_items = unified_select_dropdown.find('.select-dropdown-items');\n\t\tvar unified_select_dropdown_item = unified_select_dropdown_items.find('.select-dropdown-item');\n\n\t\t// Cancel set if we have a dropdown defined\n\t\tif (unified_select_dropdown_item.length > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar select = unified_select.find('select');\n\t\tvar options = select.find('option');\n\n\t\t// Cancel set if we have no options defined.\n\t\tif(options.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Append the dropdown\n\t\tunified_select.append('
');\n\t\tunified_select_dropdown = unified_select.find('.select-dropdown');\n\n\t\t// Append the dropdown items\n\t\tunified_select_dropdown.append('
');\n\t\tunified_select_dropdown_items = unified_select_dropdown.find('.select-dropdown-items');\n\n\t\tvar json_data = [];\n\n\t\t// Loop through each select option and set it's attribute\n\t\toptions.each(function(index) {\n\t\t\tvar option = $(this);\n\n\t\t\tvar label = getUnifiedSelectOptionLabelAttribute(option);\n\t\t\tvar disabled = getUnifiedSelectOptionDisabledAttribute(option);\n\t\t\tif(disabled) {\n\t\t\t\tdisabled = ' js__select-dropdown-item--disabled';\n\t\t\t} else {\n\t\t\t\tdisabled = '';\n\t\t\t}\n\n\t\t\tjson_data.push(label);\n\n\t\t\tunified_select_dropdown_items.append('
' + label + '
');\n\t\t});\n\n\t\tunified_select.data('json_data', json_data);\n\t}\n\n\t// Append the Filter input\n\tfunction setUnifiedSelectFilter(unified_select) {\n\t\t// Don't append the dropdown if we wan't to use the native select\n\t\tif (unified_select.hasClass('select--native')) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Cancel if we have no json data to filter\n\t\tif (typeof unified_select.data('json_data') === 'undefined') {\n\t\t\treturn;\n\t\t}\n\n\t\tvar unified_select_dropdown = unified_select.find('.select-dropdown');\n\t\tif (unified_select_dropdown.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tunified_select_dropdown.prepend('
');\n\t\tvar unified_select_filter_input = unified_select_dropdown.find('.select-filter-input');\n\n\t\tvar select = unified_select.find('select');\n\t\tvar attributes = {\n\t\t\tplaceholder: unified_select.data('select-filter-placeholder')\n\t\t};\n\n\t\t// Append each attribute to the filter input\n\t\tfor (var key in attributes) {\n\t\t\tif (typeof attributes[key] === 'undefined' || attributes[key] === '') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tunified_select_filter_input.attr(key, attributes[key]);\n\t\t}\n\n\t\tvar timeout;\n\t\tunified_select_filter_input.on({\n\t\t\t'keyup keydown':function(event) {\n\t\t\t\tvar filter = $(this);\n\n\t\t\t\tif (event.keyCode == 13) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif(event.keyCode === 38 || event.keyCode === 40) {\n\t\t\t\t\tfilter.blur();\n\t\t\t\t\tfocusUnifiedSelectItem(unified_select, event.keyCode);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\ttimeout = setTimeout(function () {\n\t\t\t\t\tfilterUnifiedSelect(filter);\n\n\t\t\t\t}, 100);\n\t\t\t},\n\t\t\t'keyup': function (event) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction focusFilterUnifiedSelect(unified_select) {\n\t\tvar filter = unified_select.find('.select-filter-input');\n\n\t\tif (filter.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tfilter.focus();\n\t}\n\n\tfunction blurFilterUnifiedSelect(unified_select) {\n\t\tvar filter = unified_select.find('.select-filter-input');\n\n\t\tif (filter.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tfilter.blur();\n\t}\n\n\t// Filter the input\n\tfunction filterUnifiedSelect(input) {\n\t\tvar unified_select = input.closest('.select');\n\t\tif (unified_select.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar json_data = unified_select.data('json_data');\n\t\tif (typeof json_data === 'undefined') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (json_data.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar term = String(input.val());\n\t\tvar query = term.toUpperCase();\n\n\t\tvar found_indexes = [];\n\n\t\tvar results = $.grep(json_data, function (value, index) {\n\t\t\tif (String(value).toUpperCase().indexOf(query) >= 0 ) {\n\t\t\t\tfound_indexes.push(index);\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\n\t\tvar unified_select_dropdown_item = unified_select.find('.select-dropdown-item');\n\t\t//Hide all\n\t\tunified_select_dropdown_item.removeClass('js__select-dropdown-item--hide');\n\n\t\tif(found_indexes.length === 0){\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove the found items from the array\n\t\tfor (var i = found_indexes.length - 1; i >= 0; i--) {\n\t\t\tunified_select_dropdown_item.splice(found_indexes[i], 1);\n\t\t}\n\n\t\tunified_select_dropdown_item.addClass('js__select-dropdown-item--hide');\n\t}\n\n\tfunction focusUnifiedSelectItem(unified_select, key) {\n\t\t//@todo focus items with keyboard\n\t}\n\n\t// Define the label for our dropdown item\n\tfunction getUnifiedSelectOptionLabelAttribute(option) {\n\t\t// Try to define the label from the label attribute\n\t\tvar label = option.attr('label');\n\n\t\t// Fallback to the actual option text\n\t\tif (typeof label === 'undefined') {\n\t\t\tlabel = option.text();\n\t\t}\n\n\t\t// Escape the current label\n\t\tvar escaped_label = '';\n\t\tfor (var i = 0; i < label.length; i++) {\n\t\t\tif (label[i] === '<') {\n\t\t\t\tescaped_label += '&lt;';\n\t\t\t} else if (label[i] === '>') {\n\t\t\t\tescaped_label += '&gt;';\n\t\t\t} else if (label[i] === \"'\") {\n\t\t\t\tescaped_label += '&#39;';\n\t\t\t} else if (label[i] === '\"') {\n\t\t\t\tescaped_label += '&quot;';\n\t\t\t} else {\n\t\t\t\tescaped_label += label[i];\n\t\t\t}\n\t\t}\n\n\t\treturn escaped_label;\n\t}\n\n\t// Define the disabled state for our dropdown item\n\tfunction getUnifiedSelectOptionDisabledAttribute(option) {\n\t\t// Try to define the disabled from the disabled attribute\n\t\tvar disabled = option.attr('disabled');\n\n\t\t// Check if the disabled state has been set as DOM property\n\t\tif(typeof disabled === 'undefined') {\n\t\t\tdisabled = option.prop('disabled');\n\t\t} else {\n\t\t\tdisabled = true;\n\t\t}\n\n\t\treturn disabled;\n\t}\n\n\t// Bind the event needed to change the select\n\tfunction setUnifiedSelectDropdownItemEvents(unified_select) {\n\t\t// Don't append the dropdown if we wan't to use the native select\n\t\tif (unified_select.hasClass('select--native')) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar unified_select_dropdown_item = unified_select.find('.select-dropdown-item');\n\t\tvar select = unified_select.find('select');\n\n\t\tunified_select_dropdown_item.on({\n\t\t\tclick : function(event) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tvar item = $(this);\n\t\t\t\tvar index = item.index();\n\n\t\t\t\t// Fire the callback and update our select\n\t\t\t\t$(document).trigger('tipi.unified-select.change', [unified_select, index]);\n\t\t\t\t$(document).trigger('tipi.unified-select.close', [unified_select]);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Set the new selected index defined from our selected item\n\tfunction setUnifiedSelectSelectedIndex(unified_select, index) {\n\t\tvar select = unified_select.find('select');\n\n\t\t// Don't init any callbacks when our index is the same value as the selectedIndex\n\t\tif (select.get(0).selectedIndex === index) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar option = select.find('option').eq(index);\n\t\tvar disabled = getUnifiedSelectOptionDisabledAttribute(option)\n\t\tif(disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tselect.get(0).selectedIndex = index;\n\n\t\tselect.trigger('change');\n\t}\n\n\tfunction setUnifiedSelectDropdownEvents(unified_select, unified_selects) {\n\t\t// Don't append the dropdown if we wan't to use the native select\n\t\tif (unified_select.hasClass('select--native')) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar unified_select_field = unified_select.find('.select-field');\n\n\t\tunified_select_field.off('click').on({\n\t\t\tclick : function(event) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tvar dropdown_is_open = unified_select.hasClass('js__select--active');\n\t\t\t\tif (dropdown_is_open) {\n\t\t\t\t\t$(document).trigger('tipi.unified-select.close', [unified_select]);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$(document).trigger('tipi.unified-select.open', [unified_select, unified_selects]);\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\n\tfunction focusUnifiedSelect(unified_select) {\n\t\tvar disabled = getUnifiedSelectDisabledState(unified_select);\n\t\tif (disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tunified_select.addClass('js__select--focus');\n\t}\n\n\tfunction blurUnifiedSelect(unified_select) {\n\t\tunified_select.removeClass('js__select--focus');\n\t}\n\n\tfunction openUnifiedSelectDropdown(unified_select, unified_selects) {\n\t\tvar disabled = getUnifiedSelectDisabledState(unified_select);\n\t\tif(disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Prevent multiple active select dropdown's\n\t\tunified_selects.not(unified_select).removeClass('js__select--active');\n\n\t\tunified_select.addClass('js__select--active');\n\n\t\t// Bind body\n\t\tsetTimeout(function() {\n\t\t\t$('body').one('click', function (event) {\n\t\t\t\tif (isTarget($(event.target), '.select')) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$(document).trigger('tipi.unified-select.close', [unified_select])\n\t\t\t});\n\t\t}, 1)\n\t}\n\n\tfunction closeUnifiedSelectDropdown(unified_select) {\n\t\tunified_select.removeClass('js__select--active')\n\t}\n\n\tfunction isTarget(target, filter) {\n\t\tvar is_target = false;\n\n\t\tif (target.hasClass((filter.replace('.','')))) {\n\t\t\tis_target = true;\n\t\t}\n\n\t\tif (target.parents(filter).length > 0) {\n\t\t\tis_target = true;\n\t\t}\n\n\t\treturn is_target;\n\t}\n\n})(window.jQuery(window), window.jQuery(document), window.jQuery);","(function(win, doc, $) {\n\twindow.setTabs = function()\n\t{\n\t\tvar data = {\n\t\t\telements : {\n\t\t\t\troot : 'tabs',\n\t\t\t\ttoggles : 'tabs-toggles',\n\t\t\t\ttoggle : 'tabs-toggle',\n\t\t\t\titems : 'tabs-items',\n\t\t\t\titem : 'tabs-item'\n\t\t\t},\n\t\t\tstates : {\n\t\t\t\tready : '__tabs--ready',\n\t\t\t\titem_ready : '__tabs-item--ready',\n\t\t\t\titem_active : '__tabs-item--active',\n\t\t\t\ttoggle_active : '__tabs-toggle--active'\n\t\t\t},\n\t\t\tattributes : {\n\t\t\t\tstart_at : 'tabs-start-at',\n\t\t\t\ttoggle_index : 'tabs-toggle-index'\n\t\t\t}\n\t\t}\n\n\t\tvar tabs = $('.' + data.elements.root).not('.' + data.states.ready);\n\n\t\tif(tabs.length === 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tdoc.on({\n\t\t\t'tipi.tabs.toggle' : function(event, tabs, index, options) {\n\t\t\t\ttoggleTabsToggle(tabs, index, data, options);\n\t\t\t\ttoggleTabsItem(tabs, index, data, options);\n\t\t\t}\n\t\t});\n\n\t\ttabs.each(function() {\n\t\t\tvar tabs = $(this);\n\t\t\tvar toggles = getTabsElement(tabs, 'toggles', data);\n\t\t\tvar toggle = getTabsElement(tabs, 'toggle', data);\n\t\t\tvar items = getTabsElement(tabs, 'items', data);\n\t\t\tvar item = getTabsElement(tabs, 'item', data);\n\n\t\t\tif(toggle.length === 0 || item.length === 0)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//Set the options for each accordion\n\t\t\tvar options = getTabsOptions(tabs, data);\n\n\t\t\ttoggle.each(function(index) {\n\t\t\t\t$(this).data(data.attributes.toggle_index, index);\n\t\t\t});\n\n\t\t\ttoggle.on({\n\t\t\t\tclick : function(event)\n\t\t\t\t{\n\t\t\t\t\tvar toggle = $(this);\n\t\t\t\t\tvar tabs = getTabsElement(toggle, 'root', data);\n\n\t\t\t\t\t//Don't proceed if the accordion is not ready\n\t\t\t\t\tif(!tabs.hasClass(data.states.ready))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tvar index = toggle.data(data.attributes.toggle_index);\n\n\t\t\t\t\tdoc.trigger('tipi.tabs.toggle', [tabs, index, options]);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif(options.start_at >= 0) {\n\t\t\t\tdoc.trigger('tipi.tabs.toggle', [tabs, options.start_at, options]);\n\t\t\t}\n\n\t\t\t//Add the ready classes\n\t\t\ttabs.addClass(data.states.ready);\n\t\t\titems.addClass(data.states.items_ready);\n\t\t\titem.addClass(data.states.item_ready);\n\t\t});\n\t}\n\n\tfunction toggleTabsToggle(tabs, index, data, options)\n\t{\n\t\tvar toggle = getTabsElement(tabs, 'toggle', data);\n\n\t\tif(toggle.length === 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\ttoggle.removeClass(data.states.toggle_active).eq(index).addClass(data.states.toggle_active);\n\t}\n\n\tfunction toggleTabsItem(tabs, index, data, options)\n\t{\n\t\tvar item = getTabsElement(tabs, 'item', data);\n\n\t\tif(item.length === 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\titem.removeClass(data.states.item_active).eq(index).addClass(data.states.item_active);\n\t}\n\n\tfunction getTabsOptions(tabs, data)\n\t{\n\t\tvar options = {\n\t\t\tstart_at : 0\n\t\t}\n\n\t\tif(typeof tabs.data(data.attributes.start_at) != 'undefined')\n\t\t{\n\t\t\tvar starting_index = tabs.data(data.attributes.start_at);\n\n\t\t\tif(!isNaN(parseFloat(starting_index)))\n\t\t\t{\n\t\t\t\toptions.start_at = starting_index;\n\t\t\t}\n\t\t}\n\n\t\treturn options;\n\t}\n\n\tfunction getTabsElement(origin, type, data)\n\t{\n\t\tif(typeof origin == 'undefined' || typeof data.elements == 'undefined')\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tvar element = $();\n\n\t\tswitch(type) {\n\t\t\tcase 'root' :\n\t\t\t\telement = origin.parents('.' + data.elements.root).first();\n\t\t\t\tbreak;\n\t\t\tcase 'toggles' :\n\t\t\t\tvar toggles = origin.find('.' + data.elements.toggles);\n\n\t\t\t\ttoggles.each(function() {\n\t\t\t\t\tvar tabs = $(this).parents('.' + data.elements.root).first();\n\n\t\t\t\t\tif(!tabs.is(origin))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\telement = element.add($(this));\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\tcase 'toggle' :\n\t\t\t\tvar toggle = origin.find('.' + data.elements.toggle);\n\n\t\t\t\ttoggle.each(function() {\n\t\t\t\t\tvar tabs = $(this).parents('.' + data.elements.root).first();\n\n\t\t\t\t\tif(!tabs.is(origin))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\telement = element.add($(this));\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\tcase 'items' :\n\t\t\t\telement = origin.find('.' + data.elements.items).first();\n\n\t\t\t\tbreak;\n\t\t\tcase 'item' :\n\t\t\t\telement = origin.find('.' + data.elements.item).first().siblings().addBack();\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t}\n\n\t\treturn element;\n\t}\n\n})( window.jQuery(window), window.jQuery(document), window.jQuery);","(function(win, doc, $) {\n\tvar data = {\n\t\tclasses : {\n\t\t\ttop_bar : 'top-bar',\n\t\t\tpush_fallback : 'top-bar-push-fallback',\n\t\t\ttrigger_fallback : 'top-bar-trigger-fallback'\n\t\t},\n\t\tstates : {\n\t\t\tready : '__top-bar--ready',\n\t\t\tsmall : '__top-bar--small',\n\t\t\thidden : '__top-bar--hidden',\n\t\t\tpeek : '__top-bar--peek',\n\t\t\treset : '__top-bar--reset',\n\t\t\tupwards : '__top-bar-upwards'\n\t\t},\n\t\tattributes : {\n\t\t\tposition : 'top-bar-position',\n\t\t\toriginal_height : 'top-bar-original-height'\n\t\t},\n\t\telements : {}\n\t};\n\n\t/**\n\t * TopBar - Javascript function written with jQuery for creating a sticky top-bar\n\t * @param {[object]} push_element [Accepts any jQuery object to define a custom push_element (usefull if you need the height in multiple places)]\n\t * @param {[object]} trigger_element [Accepts any jQuery object to define a custom trigger_element position (usefull if you wan't to override the default trigger position)]\n\t */\n\n\twindow.setTopBar = function(push_element, trigger_element)\n\t{\n\t\tvar top_bar = $('.' + data.classes.top_bar).not('.' + data.states.ready);\n\n\t\tif(top_bar.length === 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t//Add top_bar element to the data collection\n\t\tdata.elements['top_bar'] = top_bar;\n\n\t\t//Define the top bar push\n\t\tvar top_bar_push = defineTopBarPush(data, push_element);\n\t\t//Add push element to the data collection\n\t\tdata.elements['push'] = top_bar_push;\n\n\t\t//Define the top bar trigger\n\t\tvar top_bar_trigger = defineTopBarTrigger(data, trigger_element);\n\t\t//Add trigger element to the data collection\n\t\tdata.elements['trigger'] = top_bar_trigger;\n\n\t\t//Define the events we need to use so they can be shared by other scripts\n\t\t$(document).on({\n\t\t\t'tipi.topBar.resize' : function(event) {\n\t\t\t\tresizeTopBarPush(data);\n\t\t\t},\n\t\t\t'tipi.topBar.toggle' : function(event) {\n\t\t\t\ttoggleTopBar(data);\n\t\t\t}\n\t\t});\n\n\t\t//Define our resize event so we can update the push and trigger\n\t\t//Define our document width so we only have to update if our document width changes\n\t\tvar resize;\n\t\tvar document_width = $(document).width();\n\t\t$(window).on({\n\t\t\t'resize' : function() {\n\t\t\t\tclearTimeout(resize);\n\t\t\t\tresize = setTimeout(function() {\n\t\t\t\t\tif(document_width != $(document).width()) {\n\t\t\t\t\t\ttop_bar.trigger('tipi.topBar.resize');\n\t\t\t\t\t\ttop_bar.trigger('tipi.topBar.toggle');\n\t\t\t\t\t}\n\n\t\t\t\t\tdocument_width = $(document).width();\n\t\t\t\t}, 250);\n\t\t\t},\n\t\t\t'scroll' : function() {\n\t\t\t\t$(document).trigger('tipi.topBar.toggle');\n\t\t\t}\n\t\t});\n\n\t\t//Define our ready class so we can add styling within the top_bar\n\t\ttop_bar.addClass(data.states.ready);\n\n\t\t//Define our ready class so we can add styling to the page outside the top_bar\n\t\t$('html').addClass(data.states.ready);\n\n\t\t\t\t//Set the default position to 0 since our document will be loaded\n\t\t\t\t// top_bar.data(topBarDataAttributes.position, $(window).scroll);\n\n\t\ttop_bar.trigger('tipi.topBar.resize');\n\t\ttop_bar.trigger('tipi.topBar.toggle');\n\t}\n\n\tfunction defineTopBarPush(data, push_element)\n\t{\n\t\t//Check if the push fallback has been defined or create one directly after the top bar.\n\t\tvar top_bar_push_fallback = $('.' + data.classes.push_fallback);\n\t\tif(top_bar_push_fallback.length === 0)\n\t\t{\n\t\t\tdata.elements.top_bar.after('
');\n\t\t\ttop_bar_push_fallback = $('.' + data.classes.push_fallback);\n\t\t}\n\n\t\t//Define the push element with our push fallback as default selector\n\t\tvar top_bar_push = top_bar_push_fallback;\n\n\t\t//Override the push if we have defined a push_element\n\t\tif(typeof push_element !== 'undefined')\n\t\t{\n\t\t\tif(push_element.length > 0)\n\t\t\t{\n\t\t\t\ttop_bar_push = push_element;\n\t\t\t}\n\t\t}\n\n\t\treturn top_bar_push;\n\t}\n\n\tfunction defineTopBarTrigger(data, trigger_element)\n\t{\n\t\t//Check if the trigger fallback has been defined or create one directly after the top bar.\n\t\tvar top_bar_trigger_fallback = $('.' + data.classes.trigger_fallback);\n\t\tif(top_bar_trigger_fallback.length === 0)\n\t\t{\n\t\t\tdata.elements.push.after('
');\n\t\t\ttop_bar_trigger_fallback = $('.' + data.classes.trigger_fallback);\n\t\t}\n\n\t\t//Define the push element with our push fallback as default selector\n\t\tvar top_bar_trigger = top_bar_trigger_fallback;\n\n\t\t//Override the push if we have defined a push_element\n\t\tif(typeof trigger_element !== 'undefined')\n\t\t{\n\t\t\tif(trigger_element.length > 0)\n\t\t\t{\n\t\t\t\ttop_bar_trigger = trigger_element;\n\t\t\t}\n\t\t}\n\n\t\treturn top_bar_trigger;\n\t}\n\n\tfunction resizeTopBarPush(data)\n\t{\n\t\tvar html = $('html');\n\n\t\t//Set our reset class so the height will be set without a css transition to prevent wrong calculations\n\t\tdata.elements.top_bar.addClass(data.states.reset);\n\t\thtml.addClass(data.states.reset);\n\n\t\t//Remove our small class so we can define the current height without class modifications\n\t\tdata.elements.top_bar.removeClass(data.states.small);\n\t\thtml.removeClass(data.states.small);\n\n\t\t//Define the original height and cache it so we can use it later\n\t\tvar top_bar_height = data.elements.top_bar.outerHeight();\n\t\tdata.elements.top_bar.data(data.attributes.original_height, top_bar_height);\n\n\t\t//Set our height value as an empty string if our height is 0\n\t\tif(top_bar_height <= 0)\n\t\t{\n\t\t\ttop_bar_height = '';\n\t\t}\n\n\t\t//Update our push height\n\t\tdata.elements.push.css({\n\t\t\t'height' : top_bar_height\n\t\t});\n\n\t\t//Remove our reset classes\n\t\tdata.elements.top_bar.removeClass(data.states.reset);\n\t\thtml.removeClass(data.states.reset);\n\t}\n\n\tfunction toggleTopBar(data)\n\t{\n\t\tvar html = $('html');\n\t\tvar scroll_top = Math.ceil($(window).scrollTop());\n\t\tvar trigger = Math.ceil(data.elements.trigger.position().top);\n\n\t\t//Get our previous position that has been set on our previous scroll\n\t\tvar previous_position = parseInt(Math.ceil(data.elements.top_bar.data(data.attributes.position)));\n\n\t\t//Set our current position by updating the data attribute\n\t\tdata.elements.top_bar.data(data.attributes.position, $(window).scrollTop());\n\n\t\t//When the scrollTop of the Window is higher than the position + height of the top bar then we can we make it smaller.\n\t\tif(scroll_top >= trigger)\n\t\t{\n\t\t\tdata.elements.top_bar.addClass(data.states.small);\n\t\t\thtml.addClass(data.states.small);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdata.elements.top_bar.removeClass(data.states.small);\n\t\t\thtml.removeClass(data.states.small);\n\t\t}\n\n\t\t//Hide our top_bar if our scrollTop 2 times higher than our trigger\n\t\tif(scroll_top >= (trigger + data.elements.top_bar.outerHeight()))\n\t\t{\n\t\t\tif(false === data.elements.top_bar.hasClass(data.states.upwards))\n\t\t\t{\n\t\t\t\tdata.elements.top_bar.addClass(data.states.hidden);\n\t\t\t\thtml.addClass(data.states.hidden);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdata.elements.top_bar.removeClass(data.states.hidden);\n\t\t\thtml.removeClass(data.states.hidden);\n\t\t}\n\n\t\t//Set the peek state on the top-bar when the user scrolls upwards\n\t\tif(scroll_top < previous_position)\n\t\t{\n\t\t\tdata.elements.top_bar.addClass(data.states.peek);\n\t\t\tdata.elements.top_bar.addClass(data.states.upwards);\n\n\t\t\thtml.addClass(data.states.peek);\n\t\t\thtml.addClass(data.states.upwards);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdata.elements.top_bar.removeClass(data.states.peek);\n\t\t\tdata.elements.top_bar.removeClass(data.states.upwards);\n\n\t\t\thtml.removeClass(data.states.peek);\n\t\t\thtml.removeClass(data.states.upwards);\n\t\t}\n\n\t\t//Reset the top bar when we've reached the top of the document\n\t\tif(scroll_top <= 0)\n\t\t{\n\t\t\tdata.elements.top_bar.data(data.attributes.position, 0).removeClass(data.states.upwards);\n\t\t}\n\t}\n\n})( window.jQuery(window), window.jQuery(document), window.jQuery);","(function(win, doc, $) {\n var viewportTogglerElements = {\n 'root' : 'viewport-toggler',\n 'toggle' : 'viewport-toggler-toggle',\n 'item' : 'viewport-toggler-item'\n };\n\n var viewportTogglerStates = {\n 'ready' : '__viewport-toggler--ready',\n 'active' : '__viewport-toggler--active'\n };\n\n window.setViewportToggler = function() {\n var viewportToggler = $('.' + viewportTogglerElements.root).not('.' + viewportTogglerStates.ready);\n if(viewportToggler.length > 0) {\n viewportToggler.each(function() {\n var viewportTogglerEach = $(this);\n var viewportTogglerToggle = getViewportTogglerElement(viewportTogglerEach, 'toggle', viewportTogglerElements);\n var viewportTogglerItem = getViewportTogglerElement(viewportTogglerEach, 'item', viewportTogglerElements);\n\n if(viewportTogglerToggle.length > 0 && viewportTogglerItem.length > 0) {\n viewportTogglerEach.addClass(viewportTogglerStates.ready);\n\n viewportTogglerEach.on({\n 'tipi.viewportToggler.toggle' : function(event, viewportToggler) {\n toggleViewportToggler(viewportToggler, viewportTogglerStates);\n }\n });\n\n viewportTogglerToggle.on({\n click : function(event) {\n event.preventDefault();\n\n var toggle = $(this);\n var viewportToggler = getViewportTogglerElement(toggle, 'root', viewportTogglerElements);\n\n if(typeof viewportToggler != 'undefined') {\n if(viewportToggler.length > 0) {\n viewportToggler.trigger('tipi.viewportToggler.toggle', [viewportToggler]);\n }\n }\n }\n })\n }\n });\n }\n }\n\n function toggleViewportToggler(viewportToggler, viewportTogglerStates) {\n viewportToggler.toggleClass(viewportTogglerStates.active);\n }\n\n function getViewportTogglerElement(origin, type, viewportTogglerElements) {\n if(typeof origin != 'undefined' && typeof type != 'undefined') {\n var element;\n\n switch(type) {\n case 'root' :\n element = origin.parents('.' + viewportTogglerElements.root).first();\n break;\n case 'toggle' :\n element = origin.find('.' + viewportTogglerElements.toggle);\n break;\n case 'item' :\n element = origin.find('.' + viewportTogglerElements.item).first();\n break;\n default:\n return;\n }\n\n return element;\n }\n }\n})( window.jQuery(window), window.jQuery(document), window.jQuery);"]}