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B,OAAOd,KAGX,IAAM4B,EAAe5B,KAAKa,QAAQe,aAAe5B,KAAKa,QAAQe,aAAaC,MAAO,KAAQzB,EAEtFO,GAASlB,EAAAA,EAAAA,GAAGO,MACZkB,EAAc,YACVzB,EAAAA,EAAAA,GAAGO,MAAOoB,SAAU,cACfX,YAAa,WAAYT,KAAKqB,UAC9BZ,YAAa,UAAWT,KAAKsB,QACtC,EAYJ,OAVAX,EACKY,SAAU,UACVC,KAAM,kCACNC,MAAM,uBAADC,OAAyB1B,KAAK2B,UAAS,sBAAAD,OAAqBE,EAAa,GAAE,qBAAAF,OAAoBE,EAAa,GAAE,cACnHrB,GAAI,gBAAgB,SAAWC,GAC5BU,EAAYC,KAAMnB,KACtB,IAEJkB,EAAYC,KAAMnB,MAEXW,CACX,EAasBQ,KAAMnB,MAElBW,EAAOC,GAAI,SAlGA,WACjB,IAAID,GAASlB,EAAAA,EAAAA,GAAGO,MAehB,SAAS8B,IACL,IAAIC,EAAM/B,KAAKgC,MAAMH,MAAO,MAC5B,OAAOE,EAAIA,EAAIE,OAAS,EAC5B,CAGA,OAnBAtB,EACKY,SAAU,UACVC,KAAM,oCACNU,QAAQ,WACL,IAAIH,EAAMD,EAAcX,KAAMnB,MAC1BmC,GAAS1C,EAAAA,EAAAA,GAAGO,KAAKoC,YAAaC,KAAM,UAExCF,GAAUA,EAAOG,KAAMP,GACvB/B,KAAKuC,MACT,KAEJ9C,EAAAA,EAAAA,GAAG,uBAAyBqC,EAAcX,KAAMnB,MAAS,WAAYwC,aAAcxC,MAOnFK,EAAgBM,EAAO8B,QAAS,sBACzB9B,CACX,EA4E0BQ,KAAMnB,WAD3B,CAIT,C","sources":["webpack://@ultradent/upi-dev-frontend/./src/scripts/modules/jquery-import.js","webpack://@ultradent/upi-dev-frontend/./src/scripts/plugins/jquery.customfields.js"],"sourcesContent":["// NOte -> This file is an Singleton Module that exposes the jQuery vars as globals\n// Note -> then returning the instance on window anywhere this module gets imported\n\nimport $ from 'jquery';\nimport jQuery from 'jquery';\n\nif ( !window.$ ) {\n window.$ = $;\n window.jQuery = jQuery;\n // patch pre v1.7 jquery events ($.event.handle removed) to resolve errors in jquery.validate\n // note -> jquery-migrate plugin is supposed to resolve this but does not seem to help so patched instead\n // resource - https://stackoverflow.com/questions/16527658/jquery-error-typeerror-event-handle-is-undefined#answer-16527841\n $.event.handle = $.event.dispatch;\n}\n\nexport default window.$;\n","import $ from '@modules/jquery-import';\n\n$.fn.toCustomFields = function ( o ) {\n return this.filter( 'input, select:not(\".cs-select\")' ).each( this.toCustomField );\n}\n\n$.fn.toCustomField = function ( o ) {\n const defaultSwitchLabels = ['off', 'on'];\n\n function updatePlaceholder ( $selOption, $sel ) {\n $sel.toggleClass( 'placeholder', !$selOption.val() );\n }\n\n function handleFocusFor ( $el ) {\n $el.on( 'focusin focusout', function ( e ) {\n $el.toggleClass( 'focus', 'focusin' === e.type );\n } );\n }\n\n var makeSelect = function () {\n var $sel = $( this ),\n $selOption = $( 'option:selected', this ),\n val = $selOption.text();\n\n $sel\n .addClass( 'custom' )\n .wrap( '' )\n .change( function () {\n var $selOption = $( 'option:selected', this ),\n val = $selOption.text(),\n target = $( this.parentNode ).find( '.value' );\n\n updatePlaceholder( $selOption, $sel );\n target && target.text( val );\n this.blur(); // trigger validation\n } );\n\n $sel = $sel.parents( '.select:first' );\n $sel.$field = $( this );\n updatePlaceholder( $selOption, $sel );\n $( '' + val + '' ).insertBefore( this );\n\n handleFocusFor( $sel );\n\n return $sel;\n }\n\n var makeFileSelect = function () {\n var $field = $( this );\n\n $field\n .addClass( 'custom' )\n .wrap( '' )\n .change( function () {\n var val = parseFilePath.call( this ),\n target = $( this.parentNode ).find( '.value' );\n\n target && target.text( val );\n this.blur(); // trigger validation\n } );\n\n $( '' + parseFilePath.call( this ) + '' ).insertBefore( this );\n\n function parseFilePath () {\n var val = this.value.split( '\\\\' );\n return val[val.length - 1];\n };\n\n handleFocusFor( $field.parents( '.input-file:first' ) );\n return $field;\n }\n\n var makeCheckOrRadio = function () {\n if ( typeof this.dataset.useownstyle !== 'undefined' ) {\n return this;\n }\n var $field = $( this ),\n type = this.getAttribute( 'type' ),\n clearRadioList = function () {\n $( ':radio[name=\"' + this.name + '\"]' ).each( function () {\n toggleField.call( this );\n } );\n },\n toggleField = function () {\n $( this ).siblings( 'span:first' )\n .toggleClass( 'disabled', this.disabled )\n .toggleClass( 'checked', this.checked );\n };\n\n $field\n .addClass( 'custom' )\n .wrap( '' )\n .after( `` )\n .on( 'click change', function ( e ) {\n if ( 'radio' === this.type ) {\n clearRadioList.call( this );\n }\n toggleField.call( this );\n } );\n\n toggleField.call( this );\n\n return $field;\n };\n\n var makeSwitch = function () {\n if ( typeof this.dataset.useownstyle !== 'undefined' ) {\n return this;\n }\n\n const switchLabels = this.dataset.switchLabels ? this.dataset.switchLabels.split( ',' ) : defaultSwitchLabels;\n\n var $field = $( this ),\n toggleField = function () {\n $( this ).siblings( 'span:first' )\n .toggleClass( 'disabled', this.disabled )\n .toggleClass( 'checked', this.checked );\n };\n\n $field\n .addClass( 'custom' )\n .wrap( '' )\n .after( `` )\n .on( 'click change', function ( e ) {\n toggleField.call( this );\n } );\n\n toggleField.call( this );\n\n return $field;\n }\n\n var $field = $( this );\n\n // note - disabled custom .select component in favor of css styling\n // if ( $field.is( 'select' ) ) {\n // return makeSelect.call( this );\n // }\n\n if ( $field.is( ':radio, :checkbox:not(.toggle)' ) ) {\n return makeCheckOrRadio.call( this );\n }\n if ( $field.is( ':checkbox.toggle' ) ) {\n return makeSwitch.call( this );\n }\n else if ( $field.is( ':file' ) ) {\n return makeFileSelect.call( this );\n }\n\n};\n"],"names":["window","$","jQuery","handle","dispatch","fn","toCustomFields","o","this","filter","each","toCustomField","defaultSwitchLabels","handleFocusFor","$el","on","e","toggleClass","type","$field","is","dataset","useownstyle","getAttribute","clearRadioList","name","toggleField","call","siblings","disabled","checked","addClass","wrap","after","concat","classList","switchLabels","split","parseFilePath","val","value","length","change","target","parentNode","find","text","blur","insertBefore","parents"],"sourceRoot":""}