99
1010'use strict' ;
1111
12- function _typeof ( o ) { "@babel/helpers - typeof" ; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , _typeof ( o ) ; }
13- Object . defineProperty ( exports , "__esModule" , {
14- value : true
15- } ) ;
16- exports [ "default" ] = void 0 ;
17- var _stimulus = require ( "@hotwired/stimulus" ) ;
18- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
19- function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , _toPropertyKey ( descriptor . key ) , descriptor ) ; } }
20- function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; Object . defineProperty ( Constructor , "prototype" , { writable : false } ) ; return Constructor ; }
21- function _toPropertyKey ( arg ) { var key = _toPrimitive ( arg , "string" ) ; return _typeof ( key ) === "symbol" ? key : String ( key ) ; }
22- function _toPrimitive ( input , hint ) { if ( _typeof ( input ) !== "object" || input === null ) return input ; var prim = input [ Symbol . toPrimitive ] ; if ( prim !== undefined ) { var res = prim . call ( input , hint || "default" ) ; if ( _typeof ( res ) !== "object" ) return res ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( hint === "string" ? String : Number ) ( input ) ; }
23- function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function" ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , writable : true , configurable : true } } ) ; Object . defineProperty ( subClass , "prototype" , { writable : false } ) ; if ( superClass ) _setPrototypeOf ( subClass , superClass ) ; }
24- function _setPrototypeOf ( o , p ) { _setPrototypeOf = Object . setPrototypeOf ? Object . setPrototypeOf . bind ( ) : function _setPrototypeOf ( o , p ) { o . __proto__ = p ; return o ; } ; return _setPrototypeOf ( o , p ) ; }
25- function _createSuper ( Derived ) { var hasNativeReflectConstruct = _isNativeReflectConstruct ( ) ; return function _createSuperInternal ( ) { var Super = _getPrototypeOf ( Derived ) , result ; if ( hasNativeReflectConstruct ) { var NewTarget = _getPrototypeOf ( this ) . constructor ; result = Reflect . construct ( Super , arguments , NewTarget ) ; } else { result = Super . apply ( this , arguments ) ; } return _possibleConstructorReturn ( this , result ) ; } ; }
26- function _possibleConstructorReturn ( self , call ) { if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) { return call ; } else if ( call !== void 0 ) { throw new TypeError ( "Derived constructors may only return object or undefined" ) ; } return _assertThisInitialized ( self ) ; }
12+ function _callSuper ( t , o , e ) { return o = _getPrototypeOf ( o ) , _possibleConstructorReturn ( t , _isNativeReflectConstruct ( ) ? Reflect . construct ( o , e || [ ] , _getPrototypeOf ( t ) . constructor ) : o . apply ( t , e ) ) ; }
13+ function _possibleConstructorReturn ( self , call ) { if ( call && ( typeof call === "object" || typeof call === "function" ) ) { return call ; } else if ( call !== void 0 ) { throw new TypeError ( "Derived constructors may only return object or undefined" ) ; } return _assertThisInitialized ( self ) ; }
2714function _assertThisInitialized ( self ) { if ( self === void 0 ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return self ; }
28- function _isNativeReflectConstruct ( ) { if ( typeof Reflect === "undefined" || ! Reflect . construct ) return false ; if ( Reflect . construct . sham ) return false ; if ( typeof Proxy === "function" ) return true ; try { Boolean . prototype . valueOf . call ( Reflect . construct ( Boolean , [ ] , function ( ) { } ) ) ; return true ; } catch ( e ) { return false ; } }
15+ function _isNativeReflectConstruct ( ) { try { var t = ! Boolean . prototype . valueOf . call ( Reflect . construct ( Boolean , [ ] , function ( ) { } ) ) ; } catch ( t ) { } return ( _isNativeReflectConstruct = function _isNativeReflectConstruct ( ) { return ! ! t ; } ) ( ) ; }
2916function _getPrototypeOf ( o ) { _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf . bind ( ) : function _getPrototypeOf ( o ) { return o . __proto__ || Object . getPrototypeOf ( o ) ; } ; return _getPrototypeOf ( o ) ; }
30- var _default = exports [ "default" ] = /*#__PURE__*/ function ( _Controller ) {
31- _inherits ( _default , _Controller ) ;
32- var _super = _createSuper ( _default ) ;
17+ function _inheritsLoose ( subClass , superClass ) { subClass . prototype = Object . create ( superClass . prototype ) ; subClass . prototype . constructor = subClass ; _setPrototypeOf ( subClass , superClass ) ; }
18+ function _setPrototypeOf ( o , p ) { _setPrototypeOf = Object . setPrototypeOf ? Object . setPrototypeOf . bind ( ) : function _setPrototypeOf ( o , p ) { o . __proto__ = p ; return o ; } ; return _setPrototypeOf ( o , p ) ; }
19+ import { Controller } from '@hotwired/stimulus' ;
20+ var _default = /*#__PURE__*/ function ( _Controller ) {
3321 function _default ( ) {
34- _classCallCheck ( this , _default ) ;
35- return _super . apply ( this , arguments ) ;
22+ return _callSuper ( this , _default , arguments ) ;
3623 }
37- _createClass ( _default , [ {
38- key : "connect" ,
39- value : function connect ( ) {
40- var element = this . element ;
41- var href = element . getAttribute ( 'href' ) ;
42- if ( ! href ) {
43- return ;
44- }
45- var url = new URL ( href , 'http://example.com/' ) ;
46- if ( ! url ) {
47- return ;
48- }
49- var expiration = parseInt ( url . searchParams . get ( 'expiration' ) ) ;
50- var secondsToExpiration = 1800 ;
51- if ( expiration ) {
52- var now = new Date ( ) . getTime ( ) / 1000 ;
53- secondsToExpiration = expiration - now ;
54- }
55- if ( secondsToExpiration < 0 ) {
56- secondsToExpiration = 1 ;
57- }
58- setTimeout ( function ( ) {
59- element . classList . add ( 'disabled' ) ;
60- element . setAttribute ( 'disabled' , 'disabled' ) ;
61- element . setAttribute ( 'tabindex' , '-1' ) ;
62- element . setAttribute ( 'aria-disabled' , 'true' ) ;
63- element . setAttribute ( 'title' , 'This link has expired. Please refresh the page, and try again.' ) ;
64- element . href = '#' ;
65- } , secondsToExpiration * 1000 ) ;
24+ _inheritsLoose ( _default , _Controller ) ;
25+ var _proto = _default . prototype ;
26+ _proto . connect = function connect ( ) {
27+ var element = this . element ;
28+ var href = element . getAttribute ( 'href' ) ;
29+ if ( ! href ) {
30+ return ;
31+ }
32+ var url = new URL ( href , 'http://example.com/' ) ;
33+ if ( ! url ) {
34+ return ;
35+ }
36+ var expiration = parseInt ( url . searchParams . get ( 'expiration' ) ) ;
37+ var secondsToExpiration = 1800 ;
38+ if ( expiration ) {
39+ var now = new Date ( ) . getTime ( ) / 1000 ;
40+ secondsToExpiration = expiration - now ;
41+ }
42+ if ( secondsToExpiration < 0 ) {
43+ secondsToExpiration = 1 ;
6644 }
67- } ] ) ;
45+ setTimeout ( function ( ) {
46+ element . classList . add ( 'disabled' ) ;
47+ element . setAttribute ( 'disabled' , 'disabled' ) ;
48+ element . setAttribute ( 'tabindex' , '-1' ) ;
49+ element . setAttribute ( 'aria-disabled' , 'true' ) ;
50+ element . setAttribute ( 'title' , 'This link has expired. Please refresh the page, and try again.' ) ;
51+ element . href = '#' ;
52+ } , secondsToExpiration * 1000 ) ;
53+ } ;
6854 return _default ;
69- } ( _stimulus . Controller ) ;
55+ } ( Controller ) ;
56+ export { _default as default } ;
0 commit comments