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V,CAMAN,kBAAAA,GACI,MAAM,MAAEnH,EAAK,SAAEC,EAAQ,SAAE2E,GAAazF,KAGlC,CAACa,EAAOC,EAAU2E,GAAUY,MAAMmC,GAAmC,iBAAdA,KACvDC,QAAQC,MAAM,2EAGdjD,GAAY3E,GACZ2H,QAAQC,MAAM,2EAIlB,MAAMC,EAAsBrB,EAA6B9F,KAAKxB,MAE1DA,KAAKiB,mBAAqB0H,IAE1B3I,KAAKiB,iBAAmBqG,EAA6B9F,KAAKxB,MAE1DA,KAAKiI,eAEb,CAgDAA,YAAAA,GACIW,EAAAA,GAAkBpH,KAAKxB,KAC3B,EACJ6I,EA1HqBrJ,GAyEjBqH,EAAAA,EAAAA,GAAAgC,EAAA/B,UAAA,YAKCE,EAAAA,UAAO,kBACG,CAAK,KAAAH,EAAAA,EAAAA,GAAAgC,EAAA/B,UAAA,YAOfE,EAAAA,UAAO,kBACG,CAAC,KANZH,EAAAA,EAAAA,GAAAgC,EAAA/B,UAAA,YAaCE,EAAAA,UAAO,kBACG,GAAG,KANdH,EAAAA,EAAAA,GAAAgC,EAAA/B,UAAA,SAeCE,EAAAA,UAAO,kBACA,EAAE,KARVH,EAAAA,EAAAA,GAAAgC,EAAA/B,UAAA,oBAiBCE,EAAAA,S","sources":["src/components/slider-adc.hbs","src/components/slider-adc.ts","src/components/slider/base-slider.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! template-lint-disable no-inline-styles }}\\n{{! template-lint-disable require-presentational-children }}\\n{{! template-lint-disable no-pointer-down-event-binding }}\\n\\n {{yield}}\\n
\\n \\n {{#if @showValue}}\\n

{{this.sliderPercentage}}

\\n {{/if}}\\n
\\n\\n \\n\")","import { tracked } from '@glimmer/tracking';\nimport { isArrowDownCode, isArrowLeftCode, isArrowUpCode, isArrowRightCode } from '@adc/ember-utils/utils/a11y';\nimport { isRtl, DIR_CHANGED_EVENT_KEY } from '@adc/ember-utils/utils/html-dir-helpers';\nimport { computed, action } from '@ember/object';\nimport { guidFor } from '@ember/object/internals';\nimport { inject as service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { VALUE_CHANGE_ACTION } from './common/base-input.js';\nimport { default as BaseSlider, getValueFromSliderPercentage } from './slider/base-slider.js';\n\nimport type { Registry as ServiceRegistry } from '@ember/service';\nimport type { SafeString } from 'handlebars';\nimport type { Placement } from 'popper.js';\nimport type { BaseSliderSignature } from './slider/base-slider';\n\ntype OrientationType = [\n 'clientY' | 'clientX',\n 'pageY' | 'pageX',\n 'top' | 'left',\n 'scrollTop' | 'scrollLeft',\n 'height' | 'width'\n];\ntype EventType = MouseEvent | Touch | undefined;\ntype HandlerType = VoidFunction | ((e: MouseEvent | TouchEvent) => void);\ntype EventTouple = [string, T, HandlerType];\n\n// region Constants\n\n/**\n * The names used to cache event listeners.\n */\nconst SLIDER_RTL_LISTENER = 'SliderRtlObserver',\n MOVE_LISTENER = 'ClearMoveEvt',\n END_LISTENER = 'ClearEndEvt',\n OUTSIDE_LISTENER = 'ClearOutsideEvt';\n\n// endregion\n\nfunction isTouchEvent(e: MouseEvent | TouchEvent): e is TouchEvent {\n return typeof TouchEvent !== 'undefined' && e instanceof TouchEvent && !!e.touches;\n}\n\nexport interface SliderAdcSignature {\n Element: HTMLDivElement;\n Args: BaseSliderSignature['Args'] & {\n title: string;\n showValue?: boolean;\n showVertically?: boolean;\n };\n Blocks: {\n default: [];\n };\n}\n\n/**\n * @classdesc A slider control that allows a user to select values between a given range.\n */\nexport default class SliderAdc extends BaseSlider {\n @service declare dom: ServiceRegistry['dom'];\n\n /** @override */\n constructor(...args: any[]) {\n super(...args);\n\n this.id = guidFor(this);\n\n this.initRtlObserver();\n\n this.updateThumbStyle();\n }\n\n // region Style Properties\n id = '';\n @tracked\n showVertically = false;\n @tracked\n valueText = '';\n @tracked\n step = 0;\n\n /** Determines if the slider is currently being dragged. */\n @tracked\n isDragging = false;\n\n /** The style attribute value to be applied to the slider thumb element. */\n @tracked\n thumbStyle: SafeString = htmlSafe('');\n\n // region Error Handling\n\n /** @override */\n @tracked\n errorTooltipPlace: Placement = 'bottom';\n\n // endregion\n\n [SLIDER_RTL_LISTENER]?: string;\n\n private touchEventListeners = {\n [MOVE_LISTENER]: '',\n [END_LISTENER]: '',\n [OUTSIDE_LISTENER]: ''\n };\n\n [VALUE_CHANGE_ACTION]?: CallableFunction;\n\n /** The orientation of the slider.*/\n get orientation(): string {\n return this.showVertically ? 'vertical' : 'horizontal';\n }\n\n /**\n * The value of the aria-valuetext attribute.\n * The text read by the screen reader on value change.\n */\n get ariaValueText(): string {\n return this.ariaValueNow + this.valueText;\n }\n\n /** Computes the style attribute value to be applied to the slider range element.*/\n get rangeStyle(): SafeString {\n const rangeAxis = this.showVertically ? 'height' : 'width';\n // When the minValue is nonzero, the user is able to slide the thumb past 100%, so we need to cap the range to 100%.\n // Additionally, when the user slides the thumb past 0%, the thumb gets stuck on a nonzero value (i.e. 10%)\n // so we need to set the range to 0% if the current value is equal to the min value.\n const axisPercentage = this.value === this.minValue ? 0 : Math.min(this.sliderPercentage, 100);\n\n return htmlSafe(`${rangeAxis} : ${axisPercentage}%;`);\n }\n\n // endregion\n\n // region ARIA Properties\n\n /** The unit to move the slider with one key press. */\n @computed('step')\n get stepToMove(): number {\n return this.step ?? 1;\n }\n\n /** The current value of the slider for the ARIA attribute. */\n get ariaValueNow(): number {\n return getValueFromSliderPercentage.call(this);\n }\n\n // endregion\n\n // region Trigger Methods\n\n /**\n * Updates the sliderPercentage property to the given percentage and triggers the value-change action if defined.\n *\n * @param {number} percentage - The new value used to set the slider.\n * @param {boolean} [isFromSlider=false] - Determines if the change was from the slider itself or by another means.\n * @param {boolean} [isMouseUp=true] - Allows the application to know if the mouse is pressed/released (helpful for triggering debounced actions).\n */\n private updateSliderPercentage(percentage: number, isFromSlider = false, isMouseUp = true): void {\n // Set the internal slider percentage.\n this.sliderPercentage = Math.max(Math.min(percentage, 100), 0);\n\n // Send back the new value, along with a boolean indicating if the value was changed using the slider element.\n this[VALUE_CHANGE_ACTION]?.(getValueFromSliderPercentage.call(this), isFromSlider, isMouseUp);\n }\n\n // endregion\n\n // region Calculation Methods\n\n /**\n * There are two cases when we need to show the slider progress in reverse mode:\n * - When showing the slider vertically (the max slider value should at the top)\n * - When showing the slider horizontally and RTL is activated (the max slider value should be on the left side)\n */\n private shouldReverseSliderPercentage(): boolean {\n return this.showVertically || isRtl();\n }\n\n /**\n * Returns the location of the slider handle in terms of a percentage relative to the length of the slider.\n * (e.g. clicking on the very left of the slider will return 0, while the very right returns 100).\n */\n private getSliderPercentageFromEvent(e: MouseEvent | TouchEvent): number {\n // Was this a touch event?\n let event: EventType = e instanceof MouseEvent ? e : undefined;\n\n if (isTouchEvent(e)) {\n // Use the first touch event.\n event = Array.from(e.touches).pop();\n }\n\n if (event === undefined) {\n return 0;\n }\n\n // Get the screen position of the entire slider container so we can determine where the mouse was clicked inside the slider.\n const el: HTMLElement | null = document.querySelector(`#${this.id}`),\n sliderOffset: DOMRect | undefined = el?.getBoundingClientRect(),\n [clientMainAxis, pageMainAxis, scrollSide, scrollProp, dimensionProp]: OrientationType = this.showVertically\n ? ['clientY', 'pageY', 'top', 'scrollTop', 'height']\n : ['clientX', 'pageX', 'left', 'scrollLeft', 'width'],\n // Get the absolute coordinate of the event.\n // The generic name \"coordinate\" is used because it holds X or Y depending if the slider is showing horizontally or vertically.\n eventCoordinate = event[pageMainAxis] ?? event[clientMainAxis] ?? 0,\n bodyScroll = document.body[scrollProp],\n elementScroll = document.documentElement[scrollProp],\n scrollSideOffset: number = sliderOffset?.[scrollSide] ?? 0,\n scrollSideOffsetMainAxis: number = sliderOffset?.[dimensionProp] ?? 0,\n absoluteCoordinate = eventCoordinate + bodyScroll + elementScroll,\n // Get the coordinate relative to the slider.\n coordinateRelativeToTheSlider = absoluteCoordinate - scrollSideOffset,\n // Turn the coordinate into a percentage.\n percentage = Math.round((coordinateRelativeToTheSlider / scrollSideOffsetMainAxis) * 100);\n\n // Don't allow values less than 0 or more than 100.\n const validatedPercentageValue = Math.min(Math.max(percentage, 0), 100);\n\n if (this.shouldReverseSliderPercentage()) {\n return 100 - validatedPercentageValue;\n }\n\n return validatedPercentageValue;\n }\n\n // endregion\n\n // region Mouse and Touch Properties/Events\n\n /**\n * Handles mouseDown and touchStart events.\n */\n private processTouchEvent(e: MouseEvent | TouchEvent): boolean {\n // Stop event propagation.\n // Note: Not doing this causes the slider to be \"HTML draggable\" and can hinder the slider handle from moving properly.\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n\n // Is the slider disabled?\n if (this.disabled) {\n // Don't process any events.\n return false;\n }\n\n // Update the slider percentage to where they clicked.\n this.updateSliderPercentage(this.getSliderPercentageFromEvent(e), true, false);\n\n // type EventTouple = [string, keyof typeof this.touchEventListeners, HandlerType];\n\n const isTouch = isTouchEvent(e);\n // Add listeners for drag events and mouse/touch events.\n const listeners: EventTouple[] = [\n [isTouch ? 'touchmove' : 'mousemove', MOVE_LISTENER, this.mouseMove],\n [isTouch ? 'touchend' : 'mouseup', END_LISTENER, this.stopMouseInteraction],\n [isTouch ? 'touchcancel' : 'mouseleave', OUTSIDE_LISTENER, this.stopMouseInteraction]\n ];\n\n listeners.forEach(([event, listener, handler]) => {\n this.touchEventListeners[listener] = this.dom.addListener(\n this,\n window.document.body,\n event,\n handler.bind(this),\n false,\n false,\n isTouch\n );\n });\n\n return true;\n }\n\n /**\n * A helper function for mouseup and mouseleave\n * that removes the mouse dragging and mouse down\n * interactions and removes the touch event listeners.\n *\n * mouseup: Removes mouse functionality with\n * the slider when the mouse is no longer\n * pressed down.\n *\n * mouseleave: Removes mouse functionality\n * with the slider when a user exits\n * the browser window.\n */\n private stopMouseInteraction(): void {\n // Disable dragging on mouse move.\n this.isDragging = false;\n\n // Set the new percentage and trigger the value-change action (if defined).\n this.updateSliderPercentage(this.sliderPercentage, true);\n\n const listeners: (keyof typeof this.touchEventListeners)[] = [MOVE_LISTENER, END_LISTENER, OUTSIDE_LISTENER];\n\n // Remove the event listeners.\n listeners.forEach((name): void => {\n this.dom.removeListener(this, this.touchEventListeners[name]);\n });\n }\n\n /**\n * Updates the value of the slider based on the current position of the drag event.\n *\n * @param {MouseEvent} e\n */\n private mouseMove(e: MouseEvent | TouchEvent): void {\n // Is the slider disabled?\n if (this.disabled) {\n // Don't process any events.\n return;\n }\n\n // Tell the component we are dragging.\n this.isDragging = true;\n\n // Set the new percentage and trigger the value-change action if defined.\n this.updateSliderPercentage(this.getSliderPercentageFromEvent(e), true, false);\n }\n\n // endregion\n\n // region RTL Observer\n\n /**\n * Initializes the observer for watching changes to the HTML element's dir attribute.\n */\n private initRtlObserver(): void {\n const rtlListener = this.dom.addListener(\n this,\n document,\n DIR_CHANGED_EVENT_KEY,\n this.updateThumbStyle.bind(this)\n );\n\n this[SLIDER_RTL_LISTENER] = rtlListener;\n }\n\n // endregion\n\n // region Helper methods\n\n /**\n * Decreases the slider percentage with the value mentioned in step.\n */\n private decreasePercentage(): number {\n const percentage = this.sliderPercentage - this.stepToMove;\n\n return percentage >= this.minValue ? percentage : this.minValue;\n }\n\n /**\n * Increases the slider percentage with the value mentioned in step.\n */\n private increasePercentage(): number {\n const percentage = this.sliderPercentage + this.stepToMove;\n\n return percentage <= this.maxValue ? percentage : this.maxValue;\n }\n\n /**\n * Moves the slider horizontally when keyboard is used.\n */\n private moveHorizontally(code: string): void {\n const rtl = isRtl();\n let percentage = this.sliderPercentage;\n\n if (isArrowRightCode(code)) {\n percentage = rtl ? this.decreasePercentage() : this.increasePercentage();\n this.updateSliderPercentage(percentage, true, false);\n }\n\n if (isArrowLeftCode(code)) {\n percentage = rtl ? this.increasePercentage() : this.decreasePercentage();\n this.updateSliderPercentage(percentage, true, false);\n }\n }\n\n /**\n * Moves the slider vertically when keyboard is used.\n */\n private moveVertically(code: string): void {\n let percentage = this.sliderPercentage;\n\n if (isArrowUpCode(code)) {\n percentage = this.increasePercentage();\n this.updateSliderPercentage(percentage, true, true);\n }\n\n if (isArrowDownCode(code)) {\n percentage = this.decreasePercentage();\n this.updateSliderPercentage(percentage, true, true);\n }\n }\n\n // endregion\n\n // region Actions\n\n /** Updates the value of the slider based on the position of the left mouse click. */\n @action mouseClicked(e: MouseEvent | TouchEvent): boolean {\n // Was it NOT a main button (left) click?\n if (e instanceof MouseEvent && e.button !== 0) {\n // Do NOT process the event.\n return false;\n }\n\n this.processTouchEvent(e);\n\n return true;\n }\n\n /** Listener for keyDown events. */\n @action keyPressed(e: KeyboardEvent): boolean {\n if (this.disabled) {\n return false;\n }\n\n const { code } = e;\n\n if ([isArrowDownCode, isArrowUpCode, isArrowLeftCode, isArrowRightCode].some((fn) => fn(code))) {\n e.preventDefault();\n this.showVertically ? this.moveVertically(code) : this.moveHorizontally(code);\n }\n\n return true;\n }\n\n /** Listener for KeyUp events. */\n @action keyReleased(e: KeyboardEvent): boolean {\n if (this.disabled) {\n return false;\n }\n\n const { code } = e;\n\n if ([isArrowDownCode, isArrowUpCode, isArrowLeftCode, isArrowRightCode].some((fn) => fn(code))) {\n e.preventDefault();\n this.updateSliderPercentage(this.sliderPercentage, true, true);\n }\n\n return true;\n }\n\n /** Updates the value of the slider based on the position of the touch. */\n @action touchStarted(e: TouchEvent): void {\n this.processTouchEvent(e);\n }\n\n // endregion\n\n /** Updates the thumbStyle property when the slider percentage changes.*/\n @action updateThumbStyle(): void {\n let direction = isRtl() ? 'right' : 'left';\n // When the minValue is nonzero, the user is able to slide the thumb past 100%, so we need to cap the range to 100%.\n // Additionally, when the user slides the thumb past 0%, the thumb gets stuck on a nonzero value (i.e. 10%)\n // so we need to set the range to 0% if the current value is equal to the min value.\n const directionPercentage = this.value === this.minValue ? 0 : Math.min(this.sliderPercentage, 100);\n\n if (this.showVertically) {\n direction = 'bottom';\n }\n\n this.thumbStyle = htmlSafe(`${direction}: ${directionPercentage}%;`);\n }\n\n // endregion\n}\n","// Do not copy this deprecated usage. If you see this, please fix it\n/* eslint-disable ember/no-observers */\n\nimport { tracked } from '@glimmer/tracking';\nimport { addObserver, removeObserver } from '@ember/object/observers';\nimport { once } from '@ember/runloop';\nimport { default as BaseInput, clearErrorMessage } from '../common/base-input.js';\n\n// region Calculation Methods\n\n/**\n * Calculates the value corresponding to the position of the slider.\n *\n * @returns {number}\n */\nexport function getValueFromSliderPercentage() {\n const { minValue } = this,\n range = this.maxValue - minValue;\n\n return Math.round((this.sliderPercentage * range) / 100 + minValue);\n}\n\n/**\n * Calculates the position of the slider in terms of a percentage using the value, minValue, and maxValue values.\n *\n * @param {number} specifiedValue\n * @returns {number}\n */\nexport function getSliderPercentageFromValue(specifiedValue) {\n let { minValue, maxValue, value } = this;\n\n // Was there a specified value?\n if (specifiedValue !== undefined) {\n // Use the specified value.\n value = specifiedValue;\n }\n\n if (value <= minValue) {\n return 0;\n }\n\n if (value >= maxValue) {\n return 100;\n }\n\n return Math.round(((value - minValue) / (maxValue - minValue)) * 100);\n}\n\n// endregion\n\n/**\n * @classdesc The base class that is shared by the slider-adc, ticked-slider and dimmer-switch components.\n */\nexport default class BaseSlider extends BaseInput {\n tagName = '';\n // region Hooks\n\n /** @override */\n // Do not copy this deprecated usage. If you see this, please fix it\n // eslint-disable-next-line ember/classic-decorator-hooks\n init() {\n super.init(...arguments);\n\n addObserver(this, 'value', this, this.validateAttributes);\n addObserver(this, 'minValue', this, this.validateAttributes);\n addObserver(this, 'maxValue', this, this.validateAttributes);\n addObserver(this, 'sliderPercentage', this, this.clearTooltip);\n\n this.validateAttributes();\n }\n\n /** @override */\n didReceiveAttrs() {\n super.didReceiveAttrs(...arguments);\n\n let value = this.getAttr('value');\n\n // Was a value NOT provided?\n if (value === undefined || isNaN(value)) {\n // Set value to mid point between min and max values.\n const { minValue, maxValue } = this;\n value = minValue + maxValue / 2;\n }\n\n // Do not copy this deprecated usage. If you see this, please fix it\n // eslint-disable-next-line ember/no-runloop\n once(this, 'set', 'value', value);\n }\n\n /** @override */\n willDestroy() {\n removeObserver(this, 'value', this, this.validateAttributes);\n removeObserver(this, 'minValue', this, this.validateAttributes);\n removeObserver(this, 'maxValue', this, this.validateAttributes);\n removeObserver(this, 'sliderPercentage', this, this.clearTooltip);\n\n super.willDestroy();\n }\n // endregion\n\n /**\n * Add observer to validate data received by the component.\n */\n validateAttributes() {\n const { value, minValue, maxValue } = this;\n\n // Are any of the attribute values NOT numbers?\n if ([value, minValue, maxValue].some((attrValue) => typeof attrValue !== 'number')) {\n console.error('ADC Slider: value, minValue, and maxValue must all be of type \"number\".');\n }\n\n if (maxValue <= minValue) {\n console.error('ADC Slider: The maxValue value must be greater than the minValue value.');\n }\n\n // Set internal value based on the min, max, and current values.\n const newSliderPercentage = getSliderPercentageFromValue.call(this);\n\n if (this.sliderPercentage !== newSliderPercentage) {\n // Set internal value based on the min, max, and current values.\n this.sliderPercentage = getSliderPercentageFromValue.call(this);\n\n this.clearTooltip();\n }\n }\n\n /**\n * Determines if the slider is disabled and cannot be interacted with.\n *\n * @type {boolean}\n */\n @tracked\n disabled = false;\n\n /**\n * The value of the slider when the thumb is all the way off.\n *\n * @type {number}\n */\n @tracked\n minValue = 0;\n\n /**\n * The value of the slider when the thumb is all the way on.\n *\n * @type {number}\n */\n @tracked\n maxValue = 100;\n\n /**\n * The value of the slider, corresponding to the position of the thumb.\n *\n * @note If no value is specified, the default is the minimum value plus half of the maximum.\n *\n * @type {number}\n */\n @tracked\n value = 50;\n\n /**\n * The percentage value the slider uses to position the thumb.\n *\n * @note This property is internal and should NOT be altered from the component.\n *\n * @type {number}\n */\n @tracked sliderPercentage;\n\n /**\n * Clears the tooltip error message when the slider value is changed.\n */\n clearTooltip() {\n clearErrorMessage.call(this);\n }\n}\n"],"names":["TEMPLATE","createTemplateFactory","scope","on","didInsert_","didUpdate_","errorTooltip_","SLIDER_RTL_LISTENER","MOVE_LISTENER","END_LISTENER","OUTSIDE_LISTENER","isTouchEvent","e","TouchEvent","touches","_dom","WeakMap","_showVertically","_valueText","_step","_isDragging","_thumbStyle","_errorTooltipPlace","SliderAdc","BaseSlider","constructor","super","arguments","_classPrivateFieldInitSpec","i","_defineProperty","VALUE_CHANGE_ACTION","this","id","guidFor","initRtlObserver","updateThumbStyle","orientation","showVertically","ariaValueText","ariaValueNow","valueText","rangeStyle","rangeAxis","axisPercentage","value","minValue","Math","min","sliderPercentage","htmlSafe","concat","stepToMove","_this$step","step","getValueFromSliderPercentage","call","updateSliderPercentage","percentage","_this$VALUE_CHANGE_AC","isFromSlider","length","undefined","isMouseUp","max","shouldReverseSliderPercentage","isRtl","getSliderPercentageFromEvent","_ref","_event$pageMainAxis","_sliderOffset$scrollS","_sliderOffset$dimensi","event","MouseEvent","Array","from","pop","el","document","querySelector","sliderOffset","getBoundingClientRect","clientMainAxis","pageMainAxis","scrollSide","scrollProp","dimensionProp","eventCoordinate","bodyScroll","body","elementScroll","documentElement","scrollSideOffset","scrollSideOffsetMainAxis","coordinateRelativeToTheSlider","round","validatedPercentageValue","processTouchEvent","preventDefault","stopPropagation","stopImmediatePropagation","disabled","isTouch","mouseMove","stopMouseInteraction","forEach","_ref2","listener","handler","touchEventListeners","dom","addListener","window","bind","isDragging","name","removeListener","rtlListener","DIR_CHANGED_EVENT_KEY","decreasePercentage","increasePercentage","maxValue","moveHorizontally","code","rtl","isArrowRightCode","isArrowLeftCode","moveVertically","isArrowUpCode","isArrowDownCode","mouseClicked","button","keyPressed","some","fn","keyReleased","touchStarted","direction","directionPercentage","thumbStyle","_SliderAdc","g","prototype","inject","tracked","n","computed","action","setComponentTemplate","range","getSliderPercentageFromValue","specifiedValue","_disabled","_minValue","_maxValue","_value","_sliderPercentage","BaseInput","init","addObserver","validateAttributes","clearTooltip","didReceiveAttrs","getAttr","isNaN","once","willDestroy","removeObserver","attrValue","console","error","newSliderPercentage","clearErrorMessage","_BaseSlider"],"sourceRoot":""}