diff --git a/lib/ajax_asm.php b/lib/ajax_asm.php index a29e9dd..266d1e9 100644 --- a/lib/ajax_asm.php +++ b/lib/ajax_asm.php @@ -24,8 +24,7 @@ require_once('php/db/user_class.php'); require_once('php/auth/web.php'); require_once('php/db/language_class.php'); require_once('php/sys/r-goose_sys.php'); -//require_once('php/ui/UI_functions.php'); -//require_once('php/web/WEB_functions.php'); +require_once('php/argus/argus.php'); diff --git a/lib/controller/AddCameraNode.php b/lib/controller/AddCameraNode.php index c1a54fe..04cd0ba 100644 --- a/lib/controller/AddCameraNode.php +++ b/lib/controller/AddCameraNode.php @@ -1,60 +1,90 @@ Data['id'] > 1 ){ - $SiteID = intval($_POST['NID']); - $CamID = intval($_POST['CID']); - $PTZ = intval($_POST['PTZ']); - $UART = intval($_POST['UART']); - $FMIN = floatval($_POST['FMIN']); - $FMAX = floatval($_POST['FMAX']); - $IMSIZE = intval($_POST['IMSIZE']); - $TILTMODE = intval($_POST['TILTMODE']); - $PANMODE = intval($_POST['PANMODE']); - $PANANG = floatval( $_POST['PANANG']); - $TILTANG = floatval( $_POST['TILTANG']); - $PROTOID = intval( $_POST['PROTOID'] ); - $Data = array(); - if( $CamID ){ - if( $PTZ > 0 ){ - if( isset( $_POST['LAB'] ) ){ - $CAM_NAM = $DATABASE->escape( $_POST['LAB'] ); - } else { - $CAM_NAM = 'New PTZ IP Camera'; - }; - $CCTYPE = ARGUS_IP_PTZ_CAMERA; - } else { - if( isset( $_POST['LAB'] ) ){ - $CAM_NAM = $DATABASE->escape( $_POST['LAB'] ); - } else { - $CAM_NAM = 'New IP Camera'; - }; - $CCTYPE = ARGUS_IP_STATIC_CAMERA; - }; - $QS = "INSERT INTO nodes SET site_id={$SiteID},type={$CCTYPE},aux_id={$CamID},name='{$CAM_NAM}'"; - $DATABASE->Query( $QS, false ); - $NodeID = $DATABASE->getLastInsertID(); - if( $NodeID > 0 ){ - $QS = "SELECT * FROM media_streams WHERE source_id={$CamID}"; - $result = $DATABASE->Query( $QS, false ); - if( count( $result ) ){ - foreach( $result as $r ){ - $MD5 = md5( $NodeID . "_" . $r['id'] . "_DM" ); - $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$r['id']}, `type`=6, md5='{$MD5}', multidrop=0, mode=2, binded=0, `name`='IPV [{$r['img_width']}x{$r['img_height']}]'"; - $DATABASE->Query( $QS, false ); - }; - }; - if( intval($_POST['PTZ']) > 0 ){ - $MD5 = md5( $NodeID . "_" . $CamID . "_CTRL" ); - switch( $_POST['PTZ'] ){ - case 3: $TY = ARGUS_NODE_SOCK_TYPE_NETWORK; break; - default: $TY = ARGUS_NODE_SOCK_TYPE_SERIAL_PORT; break; + if( $CUser->Data['access'] > 5 ){ + $Data = array(); + if(isset($_POST['SITEID'])) $SiteID = intval($_POST['SITEID']); else $SiteID = 0; + if(isset($_POST['CID'])) $CamID = intval($_POST['CID']); else $CamID = 0; + if(isset($_POST['CTYPE'])) $CCTYPE = intval($_POST['CTYPE']); else $CCTYPE = 0; + if(isset($_POST['STREAM'])) $CSTR = intval($_POST['STREAM']); else $CSTR = 0; + if(isset($_POST['PTZ'])) $PTZ = intval($_POST['PTZ']); else $PTZ = 0; + if(isset($_POST['UART'])) $UART = intval($_POST['UART']); else $UART = 0; + if(isset($_POST['FMIN'])) $FMIN = floatval($_POST['FMIN']); else $FMIN = 0; + if(isset($_POST['FMAX'])) $FMAX = floatval($_POST['FMAX']); else $FMAX = 0; + if(isset($_POST['IMSIZE'])) $IMSIZE = intval($_POST['IMSIZE']); else $IMSIZE = 2; + if(isset($_POST['TILTMODE'])) $TILTMODE = intval($_POST['TILTMODE']); else $TILTMODE = 0; + if(isset($_POST['PANMODE'])) $PANMODE = intval($_POST['PANMODE']); else $PANMODE = 0; + if(isset($_POST['PANANG'])) $PANANG = floatval( $_POST['PANANG']); else $PANANG = 360.0; + if(isset($_POST['TILTANG'])) $TILTANG = floatval( $_POST['TILTANG']); else $TILTANG = 90.0; + if(isset($_POST['PROTOID'])) $PROTOID = intval( $_POST['PROTOID'] ); else $PROTOID = 0; + + if( $CSTR && ( $CCTYPE == ARGUS_ANALOG_STATIC_CAMERA || $CCTYPE == ARGUS_ANALOG_PTZ_CAMERA || $CCTYPE == ARGUS_IP_STATIC_CAMERA || $CCTYPE == ARGUS_IP_PTZ_CAMERA ) ){ + $QS = "SELECT * FROM `media_streams` WHERE `id`={$CSTR}"; + $T = $DATABASE->Query( $QS, false ); + $QS = "SELECT `id` FROM `nodes` WHERE `site_id`={$SiteID} AND `type`=0 LIMIT 1"; + $CC = $DATABASE->Query( $QS, false ); + $ServerNODE = $CC[0]['id']; + if( count( $T ) ){ + $STREAM = $T[0]; + if( $CCTYPE == ARGUS_ANALOG_STATIC_CAMERA || $CCTYPE == ARGUS_ANALOG_PTZ_CAMERA ){ + $CAMUUID = md5( $SiteID.$CUser->Data['selected_site'].$STRRAM['mrl'] ); + // Create Camera Object Based On Stream + $QS = "INSERT INTO `cameras` SET `site_id`={$SiteID}, `node_id`=0, `online`=1, `type`={$CCTYPE}, `hardware`='Local_Grabber', `status`=0, uuid='{$CAMUUID}'"; + $DATABASE->Query( $QS, false ); + $CamID = $DATABASE->getLastInsertID(); + }; + if( $CamID != 0 ){ + if(isset($_POST['LAB'])) $CAM_NAM = $DATABASE->escape( $_POST['LAB'] ); else $CAM_NAME = 'CAM_' . $CamID; + $QS = "INSERT INTO nodes SET site_id={$SiteID}, type={$CCTYPE}, aux_id={$CamID}, aux_parameter={$STREAM['id']}, name='{$CAM_NAM}'"; + $DATABASE->Query( $QS, false ); + $NodeID = $DATABASE->getLastInsertID(); + if( $NodeID > 0 ){ + $QS = "UPDATE cameras SET protocol_aux='{$PROTOID}', tilt_angles={$TILTANG}, tilt_model={$TILTMODE}, pan_angles={$PANANG}, pan_model={$PANMODE}, node_id={$NodeID}, type={$CCTYPE}, protocol={$PTZ}, uart_id={$UART}, imager_type={$IMSIZE}, min_f={$FMIN}, max_f={$FMAX}, status=2 WHERE id={$CamID}"; + $DATABASE->Query( $QS, false ); + $QS = "INSERT INTO `access_log` SET `ts`=NOW(), `user_id`={$CUser->Data['id']}, `cmd`=13, `dataset`='{$LOG_DATA}'"; + $DATABASE->Query( $QS, false ); + if( $CCTYPE == ARGUS_ANALOG_STATIC_CAMERA || $CCTYPE == ARGUS_ANALOG_PTZ_CAMERA ){ + $RMD5 = md5( $CamID.' 30 '.$SiteID ); + $QS = "INSERT INTO `resources` SET `node_id`={$NodeID}, `type`=30, `md5`='{$RMD5}', `aux_id`={$CamID}, `device`='Analog Video'"; + $DATABASE->Query( $QS, false ); + $AV_out_pin = $DATABASE->getLastInsertID(); + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NodeID}, `from_aux`={$AV_out_pin}, `to`={$ServerNODE}, `to_aux`=0, `type`=4"; + $DATABASE->Query( $QS, false ); + } else { + $RMD5 = md5( $CamID.' 130 '.$SiteID ); + $QS = "INSERT INTO `resources` SET `node_id`={$NodeID}, `type`=130, `md5`='{$RMD5}', `aux_id`={$CamID}, `device`='IP Video'"; + $DATABASE->Query( $QS, false ); + $DV_out_pin = $DATABASE->getLastInsertID(); + $RMD5 = md5( $CamID.' 100 '.$SiteID ); + $QS = "SELECT `ip` FROM `cameras` WHERE `id`={$CamID}"; + $CC = $DATABASE->Query( $QS, false ); + $IP = $CC[0]['ip']; + $QS = "INSERT INTO `resources` SET `node_id`={$NodeID}, `type`=100, `md5`='{$RMD5}', `aux_id`={$CamID}, `device`='{$IP}'"; + $DATABASE->Query( $QS, false ); + $NET_pin = $DATABASE->getLastInsertID(); + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NodeID}, `from_aux`={$DV_out_pin}, `to`={$ServerNODE}, `to_aux`=0, `type`=6"; + $DATABASE->Query( $QS, false ); + }; + if( $CCTYPE == ARGUS_ANALOG_PTZ_CAMERA || $CCTYPE == ARGUS_IP_PTZ_CAMERA ){ + if( $PTZ > 0 && $PTZ < 3 ){ + $RMD5 = md5( $CamID.' 1 '.$SiteID ); + $QS = "INSERT INTO `resources` SET`node_id`={$NodeID}, `type`=1, `md5`='{$RMD5}', `aux_id`={$CamID}, `device`='PTZ Uart'"; + $DATABASE->Query( $QS, false ); + $SERIAL_out_pin = $DATABASE->getLastInsertID(); + $QS = "SELECT `re`.`node_id` as `node`, `re`.`id` as `aux` FROM `cameras` `ca` LEFT JOIN `uart_settings` `us` ON `us`.`id`=`ca`.`uart_id` LEFT JOIN `resources` `re` ON `us`.`resource_id`=`re`.`id` WHERE `ca`.`id`={$CamID}"; + $CC = $DATABASE->Query( $QS, false ); + $SERIAL_in_NODE = $CC[0]['node']; + $SERIAL_in_PIN = $CC[0]['aux']; + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NodeID}, `from_aux`={$AV_out_pin}, `to`={$SERIAL_in_NODE}, `to_aux`={$SERIAL_in_PIN}, `type`=1"; + $DATABASE->Query( $QS, false ); + } else { + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NodeID}, `from_aux`={$NET_pin}, `to`={$ServerNODE}, `to_aux`=0, `type`=2"; + $DATABASE->Query( $QS, false ); + }; + }; + }; }; - $MO = COM_MODE_INOUT; - $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$CamID}, type={$TY}, mode={$MO}, md5='{$MD5}', name='PTZ Control'"; - $DATABASE->Query( $QS, false ); }; - $QS = "UPDATE cameras SET protocol_aux='{$PROTOID}', tilt_angles={$TILTANG}, tilt_model={$TILTMODE}, pan_angles={$PANANG}, pan_model={$PANMODE}, node_id={$NodeID}, type={$CCTYPE}, protocol={$PTZ}, uart_id={$UART}, imager_type={$IMSIZE}, min_f={$FMIN}, max_f={$FMAX}, status=2 WHERE id={$CamID}"; - $DATABASE->Query( $QS, false ); }; }; } else { diff --git a/lib/controller/addDetectionProfile.php b/lib/controller/addDetectionProfile.php new file mode 100644 index 0000000..0ef642a --- /dev/null +++ b/lib/controller/addDetectionProfile.php @@ -0,0 +1,46 @@ +Data['id'] ); + $ACCESS = intval($CUser->Data['access'] ); + if( $UID > 1 && $ACCESS > 4 ){ + $Z = $_POST['NID']; + if( $Z != '' ){ + $TArr = explode( ':', $Z ); + $NodeID = intval( $TArr[0] ); + $QS = "SELECT * FROM nodes WHERE id={$NodeID}"; + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + $T = $result[0]; + $AID = intval( $T['aux_id'] ); + $QS = "SELECT `profile_id` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} ORDER BY `profile_id`"; + $result = $DATABASE->Query( $QS, false ); + if( count($result) ) { + $LP = 0; + foreach( $result as $R ){ + $LP=intval($R['profile_id']); + }; + if( $LP < 3 ){ + $LP++; + $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=1, `profile_id`={$LP}"; + $DATABASE->Query( $QS ); + if( $T['type'] == 1 || $T['type'] == 5 ){ + $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=0, `profile_id`={$LP}"; + $DATABASE->Query( $QS ); + }; + }; + } else { + $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=1, `profile_id`=0"; + $DATABASE->Query( $QS ); + if( $T['type'] == 1 || $T['type'] == 5 ){ + $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=0, `profile_id`=0"; + $DATABASE->Query( $QS ); + }; + }; + $QS="INSERT INTO `access_log` SET ts=NOW(), `user_id`={$UID}, `cmd`=12, `dataset`='{}'"; + $DATABASE->Query( $QS ); + }; + exit(); + }; + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/addNetworkNode.php b/lib/controller/addNetworkNode.php index 9bbe9b1..66e6c95 100644 --- a/lib/controller/addNetworkNode.php +++ b/lib/controller/addNetworkNode.php @@ -8,7 +8,7 @@ switch( $NodeType ){ case 1://Als case 2://Lfs - case 3://Pls + case 3://Pls case 4://pls $QS = "INSERT INTO `lrf_sensors` SET `type_id`={$NodeType}, `site_id`={$SiteID}"; $DATABASE->Query( $QS, false ); @@ -37,26 +37,36 @@ $Data['success'] = true; break; case 20://IpUart - $SPD = intval( $_POST['UART_SPEED'] ); - $BITS = intval( $_POST['UART_BITS'] ); - $STOP = floatval( $_POST['UART_STOP'] ); - $PAR = strtoupper( substr($_POST['UART_PAR'],0,1) ); - $MODE = intval( $_POST['UART_MODE'] ); - $IP = $DATABASE->escape( $_POST['UART_IP'] ); - $PORT = intval( $_POST['UART_PORT'] ); - $QS = "INSERT INTO uart_settings SET `type`=2, `socket_id`=0, `mode`={$MODE}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}'"; - $DATABASE->Query( $QS, false ); - $DevID = $DATABASE->getLastInsertID(); - $QS = "INSERT INTO nodes SET `type`={$NodeType}, `aux_id`={$DevID}, `site_id`={$SiteID}"; - $DATABASE->Query( $QS, false ); - $NODEID = $DATABASE->getLastInsertID(); - $MM = md5(microtime()); - $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_INOUT . ", `type`=" . COM_TYPE_TCP . ", binded=0, md5='{$MM}', `name`='Network Connection'"; - $DATABASE->Query( $QS, false ); - $MM = md5(microtime()); - $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_INOUT . ", `type`=" . COM_TYPE_UART . ", binded=0, md5='{$MM}', `name`='UART Connection'"; - $DATABASE->Query( $QS, false ); - $Data['success'] = true; + $SPD = intval( $_POST['UART_SPEED'] ); + $BITS = intval( $_POST['UART_BITS'] ); + $STOP = floatval( $_POST['UART_STOP'] ); + $PAR = strtoupper( substr($_POST['UART_PAR'],0,1) ); + $MODE = intval( $_POST['UART_MODE'] ); + $IP = $DATABASE->escape( $_POST['UART_IP'] ); + $PORT = intval( $_POST['UART_PORT'] ); + $QS = "INSERT INTO `uart_settings` SET `type`=2, `resource_id`=0, `mode`={$MODE}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}'"; + $DATABASE->Query( $QS, false ); + $DevID = $DATABASE->getLastInsertID(); + $QS = "INSERT INTO nodes SET `type`={$NodeType}, `aux_id`={$DevID}, `site_id`={$SiteID}"; + $DATABASE->Query( $QS, false ); + $NODEID = $DATABASE->getLastInsertID(); + $DevICE = $IP .':'.$PORT; + $MM = md5( $DevICE ); + $QS = "INSERT INTO resources SET `type`=1, `site_id`={$SiteID}, `node_id`={$NODEID}, `aux_id`={$DevID}, `md5`='{$MM}', `device`='{$DevICE}'"; + $DATABASE->Query( $QS, false ); + $RES_UART = $DATABASE->getLastInsertID(); + $DevICE = $IP; + $MM = md5( $DevICE ); + $QS = "INSERT INTO resources SET `type`=100, `site_id`={$SiteID}, `node_id`={$NODEID}, `aux_id`={$DevID}, `md5`='{$MM}', `device`='{$DevICE}'"; + $DATABASE->Query( $QS, false ); + $RES_NET = $DATABASE->getLastInsertID(); + $QS = "UPDATE `uart_settings` SET `resource_id`={$RES_UART} WHERE `id`={$DevID}"; + $DATABASE->Query( $QS, false ); + $Server_NODE = 147; + $QS = "INSERT INTO connections SET `site_id`={$SiteID}, `from`={$NODEID}, `from_aux`={$RES_NET}, `to`={$Server_NODE}, `to_aux`=0, `type`=".COM_TYPE_TCP; + $DATABASE->Query( $QS, false ); + + $Data['success'] = true; break; }; }; diff --git a/lib/controller/camMakeMove.php b/lib/controller/camMakeMove.php new file mode 100644 index 0000000..1267bfa --- /dev/null +++ b/lib/controller/camMakeMove.php @@ -0,0 +1,38 @@ +Data['id'] > 1 ){ + $CMD = ''; + if(isset( $_POST['CMD'] )){ + $CMD = $_POST['CMD']; + } else { + $CMD = $_GET['CMD']; + }; + $TArr = explode( '_', $CMD ); + $CID = intval($TArr[3]); + $CCC = intval($TArr[2]); + if( $CID ){ + //$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$CID}"; + //$RR = $DATABASE->Query( $QS ); + //$CID = intval( $RR[0]['aux_id'] ); + //if( $CID == 0 ) exit(); + $ACMD = 0; + switch( $CCC ){ + case 10: $ACMD = 0x21; break; //Zoom In + case 11: $ACMD = 0x41; break; //Zoom Out + case 27: $ACMD = 0x03; break; // Right + case 28: $ACMD = 0x13; break; // RD + case 29: $ACMD = 0x11; break; // Down + case 30: $ACMD = 0x15; break; // LD + case 31: $ACMD = 0x05; break; // Left + case 32: $ACMD = 0x0d; break; // LU + case 33: $ACMD = 0x09; break; // Up + case 34: $ACMD = 0x0B; break; // RU + }; + echo $CID . " -> " .$ACMD; + if( $ACMD ){ + $QS = "INSERT `nodes_qcq` SET `cmd`={$ACMD}, `node_id`={$CID}, `status`=0"; + $DATABASE->Query( $QS ); + }; + }; + }; +?> \ No newline at end of file diff --git a/lib/controller/camStop.php b/lib/controller/camStop.php new file mode 100644 index 0000000..9f69dd6 --- /dev/null +++ b/lib/controller/camStop.php @@ -0,0 +1,22 @@ +Data['id'] > 1 ){ + $CMD = ''; + if(isset( $_POST['CMD'] )){ + $CMD = $_POST['CMD']; + } else { + $CMD = $_GET['CMD']; + }; + $TArr = explode( '_', $CMD ); + $CID = intval($TArr[3]); + if( $CID ){ + //$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$CID}"; + //$RR = $DATABASE->Query( $QS ); + //$CID = intval( $RR[0]['aux_id'] ); + //if( $CID == 0 ) exit(); + $QS = "INSERT `nodes_qcq` SET `cmd`=1, `node_id`={$CID}, `status`=0"; + $DATABASE->Query( $QS ); + }; + }; +?> + \ No newline at end of file diff --git a/lib/controller/dash/node_0.js b/lib/controller/dash/node_0.js index 7466c79..3dbff19 100644 --- a/lib/controller/dash/node_0.js +++ b/lib/controller/dash/node_0.js @@ -1,11 +1,34 @@ -{ - id: 'db_node_%%%NODEID%%%', - frame: false, - width: 258, - height: 200, - border: true, - title: 'R-Goose Server', - items:[{ - html: '

Server

' - }] +{ + id: 'db_node_%%%NODEID%%%', + tools: [{ + id:'gear', + handler: function(){ + //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + showServerToolBox(%%%NODEID%%%); + } + },{ + id:'close', + handler: function(e, target, panel){ + panel.ownerCt.remove(panel, true); + } + }], + frame: true, + width: 258, + height: 240, + border: false, + title: '%%%SYSSERVERNAME%%%', + items: [{ + xtype: 'panel', + html: '

%%%SERVERSTATUS%%%

' + },{ + xtype: 'panel', + html: '
0CPU0MEM0DISK
' + },{ + xtype: 'panel', + height: 80, + frame: true, + border: false, + autoScroll: true, + items: %%%MODULES%%% + }] } \ No newline at end of file diff --git a/lib/controller/dash/node_10.js b/lib/controller/dash/node_10.js new file mode 100644 index 0000000..618ea1c --- /dev/null +++ b/lib/controller/dash/node_10.js @@ -0,0 +1,28 @@ +{ + id: 'db_node_%%%NODEID%%%', + //xxtype: 'panel', + xtype: 'portlet', + //columnWidth:.33, + //layout: 'fit', + width: 258, + height: 240, + tools: [{ + id:'gear', + handler: function(){ + Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + } + },{ + id:'close', + handler: function(e, target, panel){ + panel.ownerCt.remove(panel, true); + } + }], + frame: true, + bodyStyle: 'padding: 0px;', + plr: null, + title: '%%%NODENAME%%%', + items:[{ + //html: '', + html: '', + }] +} \ No newline at end of file diff --git a/lib/controller/dash/node_13.js b/lib/controller/dash/node_13.js index 97f51ff..4b011ad 100644 --- a/lib/controller/dash/node_13.js +++ b/lib/controller/dash/node_13.js @@ -5,7 +5,7 @@ //columnWidth:.33, //layout: 'fit', width: 258, - height: 270, + height: 268, tools: [{ id:'gear', handler: function(){ @@ -22,44 +22,57 @@ plr: null, title: '%%%NODENAME%%%', items:[{ - html: '', + html: '', },{ xtype: 'spacer', height: 5 },{ - xtype: 'combo', - id: 'src_combo_%%%NODEID%%%', - typeAhead: false, - width: 244, - triggerAction: 'all', - listEmptyText: 'No Video Sources', - lazyRender:true, - mode: 'local', - %%%SELID%%% - listeners:{ - 'select': function( t, r, i ){ - var p = Ext.getCmp('db_node_%%%NODEID%%%'); - if( p != null ){ - if( p.plr!= null ){ - p.plr.src({type: 'application/x-mpegURL', src: r.data.src }); - }; - }; - } - }, - store: new Ext.data.ArrayStore({ - id: 0, - fields: [ - 'id', - 'label', - 'src' - ], - data: %%%URLS%%% - }), - valueField: 'id', - displayField: 'label' + xtype: 'button', + id: 'ptz_btn_%%%NODEID%%%', + width: '100%', + text: 'PTZ Control', + enableToggle: true, + handler: function(){ + var t = Ext.getCmp('db_node_%%%NODEID%%%'); + if( Ext.getCmp('ptz_btn_%%%NODEID%%%').pressed ){ + t.setSize( 258, 362 ); + document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop ); + } else { + t.setSize( 258, 268 ); + //Ext.Msg.alert('Message', 'The 270 tool was clicked.'); + }; + t.doLayout(); + } + },{ + xtype: 'spacer', + height: 3 + },{ + html: '
 
 
  
', + height: 90 }], listeners:{ afterrender: function( t ){ + /* t.plr = videojs.getPlayer('hls-%%%NODEID%%%'); if( t.plr == null ){ t.plr = videojs('hls-%%%NODEID%%%',{ @@ -73,6 +86,7 @@ }); }; t.plr.src({type: 'application/x-mpegURL', src: '%%%SELURL%%%'}); + */ return true; }, destroy: function( t ){ diff --git a/lib/controller/dash/node_3.js b/lib/controller/dash/node_3.js index 4bbe47c..bd323fb 100644 --- a/lib/controller/dash/node_3.js +++ b/lib/controller/dash/node_3.js @@ -3,6 +3,13 @@ width: 258, height: 320, title: '%%%NODENAME%%%', + tools: [{ + id:'gear', + handler: function(){ + //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + showDetectionProfile( %%%NODEID%%% ); + } + }], listeners:{ afterrender: function(){ cleanupDraw( %%%NODEID%%% ); diff --git a/lib/controller/doDeviceOperation.php b/lib/controller/doDeviceOperation.php new file mode 100644 index 0000000..caf6aef --- /dev/null +++ b/lib/controller/doDeviceOperation.php @@ -0,0 +1,36 @@ +Data['id'] > 1 ){ + $NodeID = intval($_POST['NID']); + $SiteID = intval($_POST['SITE']); + $OPID = intval( $_POST['CMD'] ); + $PARAM = $_POST['PARAM']; + $QS = "SELECT * FROM nodes WHERE id={$NodeID}"; + $Data = array(); + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + $T = $result[0]; + $TYP = intval( $T['type'] ); + $AID = intval( $T['aux_id'] ); + switch( $TYP ){ + case ARGUS_ALS_SENSOR: + case ARGUS_LFS_SENSOR: + case ARGUS_PLS_200_SENSOR: + case ARGUS_PLS_360_SENSOR: + case ARGUS_3D_SENSOR: + case ARGUS_NET_PLS_200:{ + //$QS = "SELECT * FROM lrf_sensors WHERE id={$AID}"; + //$result = $DATABASE->Query( $QS, false ); + //if( count($result)) { + // + //}; + $QS = "UPDATE `lrf_sensors` SET `pushed_cmd`={$OPID} WHERE id={$AID}"; + $DATABASE->Query( $QS ); + }; + }; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php index 5e9d27e..0af9fab 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/getDashBoardItems.php @@ -39,6 +39,35 @@ $TPL[$index] = str_replace('%%%NODENAME%%%', ''.$R['name'] , $TPL[$index] ); switch( $R['type'] ){ case ARGUS_SERVER:{ + $TPL[$index] = str_replace('%%%SYSSERVERNAME%%%', $Labels->getLabel( 'SYS_SERVNAME' ), $TPL[$index] ); + if( $R['online']== 1 ){ + $TPL[$index] = str_replace('%%%SERVERSTATUS%%%', $Labels->getLabel('SRV_STATUS_ON') , $TPL[$index]); + $TPL[$index] = str_replace('%%%SERVERSTATUSIMG%%%', 'accept.png' , $TPL[$index]); + } else { + $TPL[$index] = str_replace('%%%SERVERSTATUS%%%', $Labels->getLabel('SRV_STATUS_OFF') , $TPL[$index]); + $TPL[$index] = str_replace('%%%SERVERSTATUSIMG%%%', 'stop.png' , $TPL[$index]); + }; + $QS="SELECT * FROM `server_modules` WHERE `server_id`={$R['aux_id']}"; + $Z=$DATABASE->Query($QS); + $MODULES = array(); + if(count($Z)){ + foreach( $Z as $mod ){ + $QS="SELECT * FROM server_module_types WHERE id={$mod['type']}"; + $mtt=$DATABASE->Query( $QS ); + $CM['xtype'] = 'panel'; + if( $mod['enabled'] == 1 ){ + $CM['html'] = '

'.$Labels->getLabel( $mtt[0]['name'] ).'

'; + } else { + $CM['html'] = '

'.$Labels->getLabel( $mtt[0]['name'] ).'

'; + }; + $CM['height'] = 25; + $MODULES[] = $CM; + }; + } else { + $MODULES[] = '[{ html: \'No Modules Defined\'}]'; + }; + $MODULES_CNT = json_encode( $MODULES ); + $TPL[$index] = str_replace('%%%MODULES%%%', ''.$MODULES_CNT , $TPL[$index] ); break; }; case ARGUS_LFS_SENSOR: @@ -49,12 +78,25 @@ case ARGUS_3D_SENSOR:{ break; }; + case 10: + case 11: + case 12: case ARGUS_IP_PTZ_CAMERA:{ - $QS="SELECT * FROM cameras WHERE node_id={$R['id']}"; + //$QS="SELECT * FROM cameras WHERE node_id={$R['id']}"; + $QS="SELECT * FROM `nodes` WHERE `id`={$R['id']}"; $Z=$DATABASE->Query( $QS ); - $QS="SELECT mss.*, ms.name, ms.img_width, ms.img_height FROM media_server_streams mss LEFT JOIN media_streams ms ON ( mss.media_stream_id = ms.id ) WHERE ms.source_id={$Z[0]['id']} AND mss.valid=1 AND mss.online=1"; + $QS="SELECT * FROM `module_embed_video_settings` WHERE `id`=1"; $S=$DATABASE->Query( $QS ); $TPL[$index] = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL[$index] ); + $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $S[0]['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; + $TPL[$index] = str_replace( '%%%URLS%%%', '[' . $CS . ']' , $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELURL%%%', $FU, $TPL[$index] ); + /* + $QS="SELECT mss.*, ms.name, ms.img_width, ms.img_height FROM media_server_streams mss LEFT JOIN media_streams ms ON ( mss.media_stream_id = ms.id ) WHERE ms.source_id={$Z[0]['id']} AND mss.valid=1 AND mss.online=1"; + $S=$DATABASE->Query( $QS ); + if( count( $S ) ){ $CS = array(); $FID = 0; @@ -85,6 +127,7 @@ $TPL[$index] = str_replace( '%%%SELID%%%', 'value: \'No Video Sources\',', $TPL[$index] ); $TPL[$index] = str_replace( '%%%SELURL%%%','', $TPL[$index] ); }; + */ break; }; }; diff --git a/lib/controller/getDetectionProfile.php b/lib/controller/getDetectionProfile.php new file mode 100644 index 0000000..5c7c57e --- /dev/null +++ b/lib/controller/getDetectionProfile.php @@ -0,0 +1,30 @@ +Data['id'] > 1 ){ + $NodeID = intval($_POST['NID']); + $SiteID = intval($_POST['SITE']); + $QS = "SELECT * FROM nodes WHERE id={$NodeID}"; + $Data = array(); + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + $T = $result[0]; + $AID = $T['aux_id']; + $QS = "SELECT * FROM lrf_sensors WHERE id={$AID}"; + $result = $DATABASE->Query( $QS, false ); + if( count($result)) { + $R = $result[0]; + $K['name'] = $T['name']; + $K['data_status'] = intval( $R['data_status'] ); + $K['online'] = intval($T['online']); + $K['profile_id'] = intval($R['detection_profile_id']); + $K['profiles'] = array(); + $QS = "SELECT DISTINCT `profile_id` as `id` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} ORDER BY `profile_id`"; + foreach( $DATABASE->Query( $QS ) as $Z ) $K['profiles'][] = intval($Z['id']); + $Data = $K; + }; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getDeviceDraw.php b/lib/controller/getDeviceDraw.php index 7af2f99..a8e74e5 100644 --- a/lib/controller/getDeviceDraw.php +++ b/lib/controller/getDeviceDraw.php @@ -1,5 +1,8 @@ Data['id'] > 1 ){ header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); @@ -19,15 +22,196 @@ $QS = "SELECT * FROM lrf_draw WHERE node_id={$NID} ORDER BY ts DESC LIMIT 1"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ - if( $Result[0]['rendered'] == 'Y' ){ - if( $AUX ){ - $FN = "data/device_draws/{$Result[0]['md5']}_{$AUX}.png"; + if( $SAVE_AS_PICTURE ){ + if( $Result[0]['rendered'] == 'Y' ){ + if( $AUX ){ + $FN = "data/device_draws/{$Result[0]['md5']}_{$AUX}.png"; + } else { + $FN = "data/device_draws/{$Result[0]['md5']}_100.png"; + }; } else { - $FN = "data/device_draws/{$Result[0]['md5']}_100.png"; + $FF = "data/device_draws/{$Result[0]['md5']}.raw"; + $FN = "ddd"; + if( file_exists( $FF ) ) { + $FD = fopen( $FF, "rb" ); + if( $FD ){ + $CL = fread( $FD, 4 ); + $size = unpack( "V", $CL ); + $pts = array(); + $as = $size[1]; + for($i=0; $i< $as; $i++ ){ + $CL = fread( $FD, 4 ); + $T = unpack( "V", $CL ); + //print_r( $T ); + $pts[] = $T[1] >> 16; + }; + fclose( $FD ); + $QS = "SELECT ls.base_shift, ls.max_range FROM nodes ns LEFT JOIN lrf_sensors ls ON ( ls.id=ns.aux_id ) WHERE ns.id={$NID}"; + $PP = $DATABASE->Query( $QS ); + $stp = 2.0 * ( M_PI / $as ); + $MR = intval( $PP[0]['max_range'] ); + $S = ( M_PI / 3000.0 ) * intval( $PP[0]['base_shift'] ); + + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_100.png"); + imagesavealpha( $IM, true ); + $bg = imagecolorallocate($IM, 0, 0, 0); + $black = imagecolorallocate($IM, 255, 255, 0); + //$green = imagecolorallocate($IM, 0, 255, 0); + $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); + imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); + imagestring( $IM, 2, 6, 5, $MR . "m.", $black ); + $maxR = 98.0; + $rst = $maxR / 1025.0; + $x0 = 100; + $y0 = 100; + $ppA = array(); + $ppB = array(); + for( $i=0; $i< $as; $i++ ){ + if( $pts[$i] > 0 ){ + $cr = ($rst * $pts[$i]); + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $cr * cos( $ca ); + $ppA[] = $y0 + $cr * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + } else { + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $maxR * cos( $ca ); + $ppA[] = $y0 + $maxR * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + }; + }; + $ppB[] = $ppA[count($ppA)-2]; + $ppB[] = $ppA[count($ppA)-1]; + $popo = array_merge( $ppA, $ppB ); + imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_100.png" ); + imagedestroy( $IM ); + + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_50.png"); + imagesavealpha( $IM, true ); + $bg = imagecolorallocate($IM, 0, 0, 0); + $black = imagecolorallocate($IM, 255, 255, 0); + //$green = imagecolorallocate($IM, 0, 255, 0); + $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); + imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); + imagestring( $IM, 2, 6, 5, ( $MR / 2 ) . "m.", $black ); + $rst = $maxR / 513.0; + $ppA = array(); + $ppB = array(); + for( $i=0; $i< $as; $i++ ){ + if( $pts[$i] > 0 && $pts[$i] < 513 ){ + $cr = ($rst * $pts[$i]); + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $cr * cos( $ca ); + $ppA[] = $y0 + $cr * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + } else { + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $maxR * cos( $ca ); + $ppA[] = $y0 + $maxR * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + }; + }; + $ppB[] = $ppA[count($ppA)-2]; + $ppB[] = $ppA[count($ppA)-1]; + $popo = array_merge( $ppA, $ppB ); + imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_50.png" ); + imagedestroy( $IM ); + + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_25.png"); + imagesavealpha( $IM, true ); + $bg = imagecolorallocate($IM, 0, 0, 0); + $black = imagecolorallocate($IM, 255, 255, 0); + //$green = imagecolorallocate($IM, 0, 255, 0); + $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); + imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); + imagestring( $IM, 2, 6, 5, ( $MR / 4 ) . "m.", $black ); + $rst = $maxR / 257.0; + $ppA = array(); + $ppB = array(); + for( $i=0; $i< $as; $i++ ){ + if( $pts[$i] > 0 && $pts[$i] < 256 ){ + $cr = ($rst * $pts[$i]); + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $cr * cos( $ca ); + $ppA[] = $y0 + $cr * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + } else { + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $maxR * cos( $ca ); + $ppA[] = $y0 + $maxR * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + }; + }; + $ppB[] = $ppA[count($ppA)-2]; + $ppB[] = $ppA[count($ppA)-1]; + $popo = array_merge( $ppA, $ppB ); + imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_25.png" ); + imagedestroy( $IM ); + + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_12.png"); + imagesavealpha( $IM, true ); + $bg = imagecolorallocate($IM, 0, 0, 0); + $black = imagecolorallocate($IM, 255, 255, 0); + //$green = imagecolorallocate($IM, 0, 255, 0); + $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); + imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); + imagestring( $IM, 2, 6, 5, ( $MR / 8 ) . "m.", $black ); + $rst = $maxR / 129.0; + $ppA = array(); + $ppB = array(); + for( $i=0; $i< $as; $i++ ){ + if( $pts[$i] > 0 && $pts[$i] < 128 ){ + $cr = ($rst * $pts[$i]); + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $cr * cos( $ca ); + $ppA[] = $y0 + $cr * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + } else { + $ca = 0.0 - ( $S + $i * $stp ); + $ppA[] = $x0 + $maxR * cos( $ca ); + $ppA[] = $y0 + $maxR * sin( $ca ); + $ppB[] = $x0 + $maxR * cos( $ca ); + $ppB[] = $y0 + $maxR * sin( $ca ); + }; + }; + $ppB[] = $ppA[count($ppA)-2]; + $ppB[] = $ppA[count($ppA)-1]; + $popo = array_merge( $ppA, $ppB ); + imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_12.png" ); + imagedestroy( $IM ); + $QS = "UPDATE lrf_draw SET rendered='Y' WHERE id={$Result[0]['id']}"; + $DATABASE->Query( $QS ); + if( $AUX ){ + $FN = "data/device_draws/{$Result[0]['md5']}_{$AUX}.png"; + } else { + $FN = "data/device_draws/{$Result[0]['md5']}_100.png"; + }; + }; + } else { + echo "No Res"; exit(); + if( $AUX ){ + $FN = "../../style/assets/lfs_draw_empty_{$AUX}.png"; + } else { + $FN = "../../style/assets/lfs_draw_empty_100.png"; + }; + }; }; + if( !file_exists( $FN ) ) $FN = "../../style/assets/lfs_draw_empty_100.png"; + readfile( $FN ); } else { + //! $SAVE_AS_PICTURE $FF = "data/device_draws/{$Result[0]['md5']}.raw"; - $FN = "ddd"; if( file_exists( $FF ) ) { $FD = fopen( $FF, "rb" ); if( $FD ){ @@ -38,7 +222,6 @@ for($i=0; $i< $as; $i++ ){ $CL = fread( $FD, 4 ); $T = unpack( "V", $CL ); - //print_r( $T ); $pts[] = $T[1] >> 16; }; fclose( $FD ); @@ -47,125 +230,50 @@ $stp = 2.0 * ( M_PI / $as ); $MR = intval( $PP[0]['max_range'] ); $S = ( M_PI / 3000.0 ) * intval( $PP[0]['base_shift'] ); - - $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_100.png"); - imagesavealpha( $IM, true ); - $bg = imagecolorallocate($IM, 0, 0, 0); - $black = imagecolorallocate($IM, 255, 255, 0); - //$green = imagecolorallocate($IM, 0, 255, 0); - $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); - imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, $MR . "m.", $black ); - $maxR = 98.0; - $rst = $maxR / 1025.0; - $x0 = 100; - $y0 = 100; - $ppA = array(); - $ppB = array(); - for( $i=0; $i< $as; $i++ ){ - if( $pts[$i] > 0 ){ - $cr = ($rst * $pts[$i]); - $ca = 0.0 - ( $S + $i * $stp ); - $ppA[] = $x0 + $cr * cos( $ca ); - $ppA[] = $y0 + $cr * sin( $ca ); - $ppB[] = $x0 + $maxR * cos( $ca ); - $ppB[] = $y0 + $maxR * sin( $ca ); - } else { - $ca = 0.0 - ( $S + $i * $stp ); - $ppA[] = $x0 + $maxR * cos( $ca ); - $ppA[] = $y0 + $maxR * sin( $ca ); - $ppB[] = $x0 + $maxR * cos( $ca ); - $ppB[] = $y0 + $maxR * sin( $ca ); + switch( $AUX ){ + case 12: { + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_12.png"); + $RR = 129.0; + $MR = $MR / 8; + $MD = 128; + break; }; - }; - $ppB[] = $ppA[count($ppA)-2]; - $ppB[] = $ppA[count($ppA)-1]; - $popo = array_merge( $ppA, $ppB ); - imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); - imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_100.png" ); - imagedestroy( $IM ); - - $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_50.png"); - imagesavealpha( $IM, true ); - $bg = imagecolorallocate($IM, 0, 0, 0); - $black = imagecolorallocate($IM, 255, 255, 0); - //$green = imagecolorallocate($IM, 0, 255, 0); - $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); - imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, ( $MR / 2 ) . "m.", $black ); - $rst = $maxR / 513.0; - $ppA = array(); - $ppB = array(); - for( $i=0; $i< $as; $i++ ){ - if( $pts[$i] > 0 && $pts[$i] < 513 ){ - $cr = ($rst * $pts[$i]); - $ca = 0.0 - ( $S + $i * $stp ); - $ppA[] = $x0 + $cr * cos( $ca ); - $ppA[] = $y0 + $cr * sin( $ca ); - $ppB[] = $x0 + $maxR * cos( $ca ); - $ppB[] = $y0 + $maxR * sin( $ca ); - } else { - $ca = 0.0 - ( $S + $i * $stp ); - $ppA[] = $x0 + $maxR * cos( $ca ); - $ppA[] = $y0 + $maxR * sin( $ca ); - $ppB[] = $x0 + $maxR * cos( $ca ); - $ppB[] = $y0 + $maxR * sin( $ca ); + case 25: { + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_25.png"); + $RR = 257.0; + $MR = $MR / 4; + $MD = 256; + break; }; - }; - $ppB[] = $ppA[count($ppA)-2]; - $ppB[] = $ppA[count($ppA)-1]; - $popo = array_merge( $ppA, $ppB ); - imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); - imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_50.png" ); - imagedestroy( $IM ); - - $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_25.png"); - imagesavealpha( $IM, true ); - $bg = imagecolorallocate($IM, 0, 0, 0); - $black = imagecolorallocate($IM, 255, 255, 0); - //$green = imagecolorallocate($IM, 0, 255, 0); - $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); - imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, ( $MR / 4 ) . "m.", $black ); - $rst = $maxR / 257.0; - $ppA = array(); - $ppB = array(); - for( $i=0; $i< $as; $i++ ){ - if( $pts[$i] > 0 && $pts[$i] < 256 ){ - $cr = ($rst * $pts[$i]); - $ca = 0.0 - ( $S + $i * $stp ); - $ppA[] = $x0 + $cr * cos( $ca ); - $ppA[] = $y0 + $cr * sin( $ca ); - $ppB[] = $x0 + $maxR * cos( $ca ); - $ppB[] = $y0 + $maxR * sin( $ca ); - } else { - $ca = 0.0 - ( $S + $i * $stp ); - $ppA[] = $x0 + $maxR * cos( $ca ); - $ppA[] = $y0 + $maxR * sin( $ca ); - $ppB[] = $x0 + $maxR * cos( $ca ); - $ppB[] = $y0 + $maxR * sin( $ca ); + case 50: { + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_50.png"); + $RR = 513.0; + $MR = $MR / 2; + $MD = 512; + break; + }; + default:{ + $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_100.png"); + $RR = 1025.0; + $MD = 1025; + break; }; }; - $ppB[] = $ppA[count($ppA)-2]; - $ppB[] = $ppA[count($ppA)-1]; - $popo = array_merge( $ppA, $ppB ); - imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); - imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_25.png" ); - imagedestroy( $IM ); - - $IM = imagecreatefrompng("../../style/assets/lfs_draw_empty_12.png"); imagesavealpha( $IM, true ); $bg = imagecolorallocate($IM, 0, 0, 0); $black = imagecolorallocate($IM, 255, 255, 0); //$green = imagecolorallocate($IM, 0, 255, 0); $green = imagecolorallocatealpha( $IM, 0, 64, 0, 64 ); imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, ( $MR / 8 ) . "m.", $black ); - $rst = $maxR / 129.0; + imagestring( $IM, 2, 6, 5, $MR . "m.", $black ); + $maxR = 98.0; + $x0 = 100; + $y0 = 100; + $rst = $maxR / $RR; $ppA = array(); $ppB = array(); for( $i=0; $i< $as; $i++ ){ - if( $pts[$i] > 0 && $pts[$i] < 128 ){ + if( $pts[$i] > 0 && $pts[$i] < $MD ){ $cr = ($rst * $pts[$i]); $ca = 0.0 - ( $S + $i * $stp ); $ppA[] = $x0 + $cr * cos( $ca ); @@ -184,27 +292,27 @@ $ppB[] = $ppA[count($ppA)-1]; $popo = array_merge( $ppA, $ppB ); imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); - imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_12.png" ); + imagepng( $IM ); imagedestroy( $IM ); - $QS = "UPDATE lrf_draw SET rendered='Y' WHERE id={$Result[0]['id']}"; - $DATABASE->Query( $QS ); + } else { if( $AUX ){ - $FN = "data/device_draws/{$Result[0]['md5']}_{$AUX}.png"; + $FN = "../../style/assets/lfs_draw_empty_{$AUX}.png"; } else { - $FN = "data/device_draws/{$Result[0]['md5']}_100.png"; + $FN = "../../style/assets/lfs_draw_empty_100.png"; }; + if( !file_exists( $FN ) ) $FN = "../../style/assets/lfs_draw_empty_100.png"; + readfile( $FN ); }; } else { - echo "No Res"; exit(); if( $AUX ){ $FN = "../../style/assets/lfs_draw_empty_{$AUX}.png"; } else { $FN = "../../style/assets/lfs_draw_empty_100.png"; }; + if( !file_exists( $FN ) ) $FN = "../../style/assets/lfs_draw_empty_100.png"; + readfile( $FN ); }; }; - if( !file_exists( $FN ) ) $FN = "../../style/assets/lfs_draw_empty_100.png"; - readfile( $FN ); } else { if( $AUX ){ $FN = "../../style/assets/lfs_draw_empty_{$AUX}.png"; diff --git a/lib/controller/getNetwork.php b/lib/controller/getNetwork.php index 317387c..4b1193e 100644 --- a/lib/controller/getNetwork.php +++ b/lib/controller/getNetwork.php @@ -30,7 +30,7 @@ $index++; switch( $CD['type'] ){ case ARGUS_SERVER: - $cnode['label'] = 'R-Goose Server'; + $cnode['label'] = 'Argus Server'; $cnode['image'] = '/style/assets/0_node.png'; $cnode['role'] = 'server'; break; @@ -100,30 +100,35 @@ $cedge['id'] = $CD['id']; $cedge['from'] = $CD['from']; $cedge['to'] = $CD['to']; - $cedge['arrows'] = 'to'; + $cedge['arrows'] = 'to'; switch( $CD['type'] ){ - case COM_TYPE_UART: - $COL['color'] = '#00ff00'; - $COL['opacity']= 0.9; - $COL['highlight'] = '#00ffff'; - case COM_TYPE_TCP: - $COL['color'] = '#ff0000'; - $COL['opacity']= 0.9; - $COL['highlight'] = '#ff00ff'; - case COM_TYPE_DC_CTRL: - $COL['color'] = '#ffff00'; - $COL['opacity']= 0.9; - $COL['highlight'] = '#ffffff'; - case COM_TYPE_ANALOG_VIDEO: - case COM_TYPE_ANALOG_AUDIO: - $COL['color'] = '#00ffff'; - $COL['opacity']= 0.9; - $COL['highlight'] = '#ffffff'; - case COM_TYPE_DIGITAL_MEDIA: - $COL['color'] = '#ff00ff'; - $COL['opacity']= 0.9; - $COL['highlight'] = '#ffffff'; - break; + case COM_TYPE_UART: + $COL['color'] = '#e0e000'; + $COL['opacity']= 0.9; + $COL['highlight'] = '#ffff00'; + break; + case COM_TYPE_TCP: + $cedge['arrows'] = 'to, from'; + $COL['color'] = '#0000e0'; + $COL['opacity']= 0.9; + $COL['highlight'] = '#0000ff'; + break; + case COM_TYPE_DC_CTRL: + $COL['color'] = '#00e000'; + $COL['opacity']= 0.9; + $COL['highlight'] = '#00ff00'; + break; + case COM_TYPE_ANALOG_VIDEO: + case COM_TYPE_ANALOG_AUDIO: + $COL['color'] = '#00e0e0'; + $COL['opacity']= 0.9; + $COL['highlight'] = '#00ffff'; + break; + case COM_TYPE_DIGITAL_MEDIA: + $COL['color'] = '#e000e0'; + $COL['opacity']= 0.9; + $COL['highlight'] = '#ff00ff'; + break; }; $cedge['color'] = $COL; $Data['edges'][] = $cedge; diff --git a/lib/controller/getNetworkServerProps.php b/lib/controller/getNetworkServerProps.php index e70b436..531a20a 100644 --- a/lib/controller/getNetworkServerProps.php +++ b/lib/controller/getNetworkServerProps.php @@ -1,107 +1,118 @@ Data['id'] > 1 ){ - $Node = intval( $_POST['NODE'] ); - $QS = "SELECT * FROM nodes WHERE id = {$Node}"; - $Result = $DATABASE->Query( $QS, false ); - if( count( $Result ) ){ - $Props = $Result[0]; - $QS = "SELECT * FROM servers WHERE id = {$Props['aux_id']}"; - $Result = $DATABASE->Query( $QS, false ); - $Server = $Result[0]; + $Node = intval( $_POST['NODE'] ); + $QS = "SELECT * FROM nodes WHERE id = {$Node}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $Props = $Result[0]; + $QS = "SELECT * FROM servers WHERE id = {$Props['aux_id']}"; + $Result = $DATABASE->Query( $QS, false ); + $Server = $Result[0]; - $TName = 'props/0_node_prop.js'; - $Data = file_get_contents( $TName ); - $Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); - $Data = str_replace('%%%NODENAME%%%', $Props['name'] , $Data ); - //Info - $InfoData = ''; - $InfoParts = array(); - $InfoParts[] = '{ xtype: \'panel\', html: \'
'.$Server['identity'].'
\'}'; - if($Props['online']){ - $InfoParts[] = '{ xtype: \'panel\', html: \'
Online
\'}'; - }else{ - $InfoParts[] = '{ xtype: \'panel\', html: \'
Offline
\'}'; - }; - $InfoData = implode( ',', $InfoParts ); - $Data = str_replace('%%%INFO%%%', $InfoData, $Data ); - // Get Sockets - $SocketsData = ''; - $SockDataParts = array(); - $QS = "SELECT * FROM sockets WHERE `node_id`={$Node}"; - $Result = $DATABASE->Query( $QS, false ); - if( count( $Result ) ){ - foreach( $Result as $R ){ - switch( $R['type'] ){ - case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT: - //Uart - $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.$R['name'].'
\'}'; - break; - case ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER: - //Video Grabber - $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.$R['name'].'
\'}'; - break; - case ARGUS_NODE_SOCK_TYPE_NETWORK: - //Network Interface - $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.$R['name'].'
\'}'; - break; - default: - $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.$R['name'].'
\'}'; - }; - }; - $SocketsData = implode( ',', $SockDataParts ); - }; - $Data = str_replace('%%%SOCKETS%%%', $SocketsData, $Data ); - //Get Modules - $QS = "SELECT * FROM `server_modules` WHERE `server_id`={$Props['aux_id']}"; - $MDAT = $DATABASE->Query( $QS ); - if(count($MDAT)){ - $MODITEMS = array(); - foreach( $MDAT as $M ){ - switch( $M['type'] ){ - case 1:{ - //ZLMedia - $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Media Server\'}'; - break; - }; - case 2:{ - //DCB_USB - $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Dry Contacts\'}'; - break; - }; - case 3:{ - //Kafka - $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Kafka Proxy\'}'; - break; + $TName = 'props/0_node_prop.js'; + $Data = file_get_contents( $TName ); + $Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); + $Data = str_replace('%%%NODENAME%%%', $Props['name'] , $Data ); + //Info + $InfoData = ''; + $InfoParts = array(); + $InfoParts[] = '{ xtype: \'panel\', html: \'
'.$Server['identity'].'
\'}'; + if($Props['online']){ + $InfoParts[] = '{ xtype: \'panel\', html: \'
Online
\'}'; + }else{ + $InfoParts[] = '{ xtype: \'panel\', html: \'
Offline
\'}'; }; - case 4:{ - //GPS - $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'GPS Anchor\'}'; - break; + $InfoData = implode( ',', $InfoParts ); + $Data = str_replace('%%%INFO%%%', $InfoData, $Data ); + // Get Sockets + $SocketsData = ''; + $SockDataParts = array(); + $QS = "SELECT * FROM resources WHERE `node_id`={$Node}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + foreach( $Result as $R ){ + switch( $R['type'] ){ + case 1: + //Uart + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.'UART Line'.'
\'}'; + break; + case 31: + //Video Grabber + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.'Analog Video'.'
\'}'; + break; + case 100: + //Network Interface IPV4 + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.'Network IPV4'.'
\'}'; + break; + case 101: + //Network Interface IPV6 + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.'Network IPV6'.'
\'}'; + break; + //Media Encoder Sink + case 132: // Audio + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.'Audio Sink'.'
\'}'; + break; + case 131: // Vide + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.'Video Sink'.'
\'}'; + break; + default: + $SockDataParts[] = '{ xtype: \'panel\', html: \'
'.$R['device'].'
\'}'; + }; }; - case 5:{ - //Netvork - $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Network Proxy\'}'; - break; + $SocketsData = implode( ',', $SockDataParts ); }; - case 6:{ - //FlyHunter - $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Fly Hunter\', handler: function(){ module_prop_FlyHunter('.$M['id'].'); } }'; - break; + $Data = str_replace('%%%SOCKETS%%%', $SocketsData, $Data ); + //Get Modules + $QS = "SELECT * FROM `server_modules` WHERE `server_id`={$Props['aux_id']}"; + $MDAT = $DATABASE->Query( $QS ); + if(count($MDAT)){ + $MODITEMS = array(); + foreach( $MDAT as $M ){ + switch( $M['type'] ){ + case 1:{ + //ZLMedia + $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Media Server\'}'; + break; + }; + case 2:{ + //DCB_USB + $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Dry Contacts\'}'; + break; + }; + case 3:{ + //Kafka + $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Kafka Proxy\'}'; + break; + }; + case 4:{ + //GPS + $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'GPS Anchor\'}'; + break; + }; + case 5:{ + //Netvork + $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Network Proxy\'}'; + break; + }; + case 6:{ + //FlyHunter + $MODITEMS[] = '{ xtype:\'button\', width: \'100%\', text:\'Fly Hunter\', handler: function(){ module_prop_FlyHunter('.$M['id'].'); } }'; + break; + }; + }; + }; + $IMPL = implode( ',', $MODITEMS ); + $ModulesData = "{ items: [{$IMPL}]}"; + $Data = str_replace('%%%MODULES%%%', $ModulesData, $Data ); + } else { + $Data = str_replace('%%%MODULES%%%', '', $Data ); }; - }; + echo $Data; + } else { + echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}'; }; - $IMPL = implode( ',', $MODITEMS ); - $ModulesData = "{ items: [{$IMPL}]}"; - $Data = str_replace('%%%MODULES%%%', $ModulesData, $Data ); - } else { - $Data = str_replace('%%%MODULES%%%', '', $Data ); - }; - echo $Data; - } else { - echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}'; - }; } else { - header('location: /'); + header('location: /'); }; ?> \ No newline at end of file diff --git a/lib/controller/getNodeAdvancedNfo.php b/lib/controller/getNodeAdvancedNfo.php new file mode 100644 index 0000000..0ce9523 --- /dev/null +++ b/lib/controller/getNodeAdvancedNfo.php @@ -0,0 +1,33 @@ +Data['id'] > 1 ){ + $Z = $_POST['NID']; + if( $Z != '' ){ + $TArr = explode( ':', $Z ); + $NodeID = intval( $TArr[0] ); + $QS = "SELECT * FROM nodes WHERE id={$NodeID}"; + $Data = array(); + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + $T = $result[0]; + $AID = intval( $T['aux_id'] ); + $QS = "SELECT * FROM lrf_sensors WHERE id={$AID}"; + $result = $DATABASE->Query( $QS, false ); + if( count($result)) { + $R = $result[0]; + $K['name'] = $T['name']; + $K['dev_id'] = $AID; + //$K['data_status'] = intval( $R['data_status'] ); + $K['type'] = intval( $R['type_id'] ); + $K['range'] = floatval( $R['max_range'] ); + $QS="SELECT `profile_id` as `id`, `master`, `order`, `offset`, `delta`, `flip`, `width`, `sst`, `sun`, `gp`, `spikes` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} ORDER BY `profile_id`"; + $K['profiles'] = $DATABASE->Query( $QS, false ); + $Data = $K; + }; + }; + echo json_encode( $Data ); + exit(); + }; + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getNodeBasicNfo.php b/lib/controller/getNodeBasicNfo.php new file mode 100644 index 0000000..bb035a0 --- /dev/null +++ b/lib/controller/getNodeBasicNfo.php @@ -0,0 +1,31 @@ +Data['id'] > 1 ){ + $Z = $_POST['NID']; + if( $Z != '' ){ + $TArr = explode( ':', $Z ); + $NodeID = intval( $TArr[0] ); + $QS = "SELECT * FROM nodes WHERE id={$NodeID}"; + $Data = array(); + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + $T = $result[0]; + $AID = intval( $T['aux_id'] ); + $QS = "SELECT * FROM lrf_sensors WHERE id={$AID}"; + $result = $DATABASE->Query( $QS, false ); + if( count($result)) { + $R = $result[0]; + $K['name'] = $T['name']; + $K['dev_id'] = $AID; + //$K['data_status'] = intval( $R['data_status'] ); + $K['type'] = intval( $R['type_id'] ); + $K['range'] = floatval( $R['max_range'] ); + $Data = $K; + }; + }; + echo json_encode( $Data ); + exit(); + }; + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getResourceInfo.php b/lib/controller/getResourceInfo.php new file mode 100644 index 0000000..8d449a5 --- /dev/null +++ b/lib/controller/getResourceInfo.php @@ -0,0 +1,31 @@ +Data['id'] > 1 ){ + $EID = intval( $_POST['RID'] ); + $QS = "SELECT * FROM resources WHERE id = {$EID}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $CR = $Result[0]; + switch( $CR['type'] ){ + case 1: //https://bufferwall.com/posts/330881001ji1a/ + $QS = "SELECT * FROM uart_settings WHERE id={$CR['aux_id']}"; + $Result = $DATABASE->Query( $QS ); + $Z = $Result[0]; + $R_name = 'UART connected to a Server Appliance'; + $R_dev = $CR['device']; + $R_nfo = 'Speed: ' . $Z['speed'] . ', Bits: ' . $Z['bit'] . ', Parity: ' . $Z['parity'] . ', Stop Bit: '. $Z['stop_bit']; + break; + }; + echo "{ xtype: 'panel', html: '"; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "{$R_name}
{$R_dev}
{$R_nfo}
'}"; + } else { + echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; + }; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getSiteStatus.php b/lib/controller/getSiteStatus.php deleted file mode 100644 index 1456177..0000000 --- a/lib/controller/getSiteStatus.php +++ /dev/null @@ -1,16 +0,0 @@ -Data['id'] > 1 ){ - $Data['status'] = 'OK'; - $GID = intval($_POST['NID']); - $QS = "SELECT * FROM nodes WHERE site_id ={$GID}"; - $Result = $DATABASE->Query( $QS, false ); - foreach( $Result as $CD ){ - $cnode['id'] = $CD['id']; - $Data['nodes'][] = $cnode; - }; - } else { - $Data['status']='LOGOUT'; - }; - echo json_encode( $Data ); -?> \ No newline at end of file diff --git a/lib/controller/getStatus.php b/lib/controller/getStatus.php new file mode 100644 index 0000000..bb41df1 --- /dev/null +++ b/lib/controller/getStatus.php @@ -0,0 +1,140 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $SiteID = intval( $_POST['SITE'] ); + $LastNID = intval( $_POST['LNID'] ); + $LastServerPID = intval( $_POST['SPID'] ); + $Data = array(); + $ServerWasHuped = false; + $ServerIsOnLine = true; + $Data['status'] = 'OK'; + $CTS = time(); + $Data['nodes'] = array(); + $QS = "SELECT * FROM nodes WHERE site_id = {$SiteID} ORDER BY `type`"; + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) > 0 ){ + foreach( $result as $R ){ + $CN = array(); + $CN['id'] = $R['id']; + $CN['type'] = intval($R['type']); + if( $ServerIsOnLine ){ + $CN['status'] = intval($R['online']); + } else { + $CN['status'] = 0; + }; + if( $CN['status'] == 1 || $ServerIsOnLine ){ + switch( $R['type'] ){ + case ARGUS_SERVER:{ + $QS="SELECT * FROM `servers` WHERE `id`={$R['aux_id']}"; + $zult = $DATABASE->Query( $QS ); + if( $zult[0]['online'] == 1 ){ + $STS = intval( $zult[0]['ts'] ); + $CN['CTS'] = $CTS; + $CN['STS'] = $STS; + if( ( $CTS - $STS ) > 1 ){ //3 seconds offline + $ServerIsOnLine = false; + $CN['status'] = 0; + } else { + $CN['status'] = 1; + }; + } else { + $ServerIsOnLine = false; + $CN['status'] = 0; + }; + $CN['cpu1'] = intval( $zult[0]['stat_cpu1'] * 2.5 ); + $CN['cpu5'] = intval( $zult[0]['stat_cpu5'] ); + $CN['cpu15'] = intval( $zult[0]['stat_cpu15'] * 2.5 ); + $CN['mem'] = intval( $zult[0]['stat_mem']*100 ); + $CN['disk']= intval( $zult[0]['stat_disk']*100 ); + break; + }; + case ARGUS_ALS_SENSOR: + case ARGUS_LFS_SENSOR: + case ARGUS_PLS_200_SENSOR: + case ARGUS_PLS_360_SENSOR: + case ARGUS_NET_PLS_200:{ + // check Targets + $CN['targets'] = array(); + $QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY id DESC LIMIT 32"; + //$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) AND (UNIX_TIMESTAMP(NOW())-ts)<60 ORDER BY id DESC LIMIT 32"; + //$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY ts, ts_ms DESC LIMIT 32"; + //echo $QS . "\n\n"; + $zult = $DATABASE->Query( $QS ); + if( count( $zult ) ){ + $CN['status'] = 4; // Alarmed + $CT = array(); + foreach( $zult as $Z ){ + $CT['digital'] = $Z['range_digital']; + $CT['az'] = $Z['azimuth']; + $CN['targets'][] = $CT; + }; + }; + break; + }; + case ARGUS_3D_SENSOR:{ + break; + }; + case ARGUS_ANALOG_STATIC_CAMERA: + case ARGUS_ANALOG_PTZ_CAMERA: + case ARGUS_IP_STATIC_CAMERA: + case ARGUS_IP_PTZ_CAMERA:{ + if( $ServerIsOnLine ){ + $QS="SELECT * FROM `media_streams` WHERE `id`={$R['aux_parameter']}"; + $SR=$DATABASE->Query( $QS ); + if( count( $SR ) ) { + $ST = $SR[0]; + if( $ST['valid'] == 1 ){ + $CN['valid'] = true; + $QS="SELECT * FROM `module_embed_video_settings` WHERE `id`=1"; + $S=$DATABASE->Query( $QS ); + $CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].':' . $S[0]['web_port'] .'/stream?id='. $R['aux_parameter']; + break; + }; + }; + }; + $CN['valid'] = false; + $CN['src'] = "/style/assets/no-signal.png"; + break; + }; + }; + }; + $Data['nodes'][] = $CN; + }; + }; + // Notifications + $Data['notifications'] = array(); + $QS = "SELECT * FROM `notifications` WHERE `status`='A' AND `site_id`={$SiteID} AND `id` > {$LastNID}"; + $result = $DATABASE->Query( $QS ); + if( count( $result ) ){ + foreach( $result as $R ){ + $cn['id'] = intval( $R['id'] ); + $cn['react'] = false; + $cn['hide'] = true; + $cn['action']= ''; + switch( intval( $R['type'] ) ){ + case 0:{ + $cn['type']= 'info'; + $cn['msg'] = $Labels->GetLabel('SYS_WELCOME_MSG'); + break; + }; + case 1:{ + $cn['type']= 'error'; + $QS="SELECT `name` FROM `nodes` WHERE `id`={$R['obj_id']}"; + $RR = $DATABASE->Query( $QS ); + $cn['msg'] = $Labels->GetLabel('SYS_MSG_DEVINV') . ' ' . $RR[0]['name'] .''; + $cn['hide'] = false; + $cn['react'] = true; + $cn['action'] = $R['obj_id'].':'.$cn['id']; + }; + }; + $Data['notifications'][] = $cn; + }; + }; + } else { + $Data['notifications'] = array(); + $Data['status']='LOGOUT'; + }; + echo json_encode( $Data ); +?> \ No newline at end of file diff --git a/lib/controller/listServerLog.php b/lib/controller/listServerLog.php index b907901..550ada6 100644 --- a/lib/controller/listServerLog.php +++ b/lib/controller/listServerLog.php @@ -12,10 +12,11 @@ $cnode['id'] = $AID; $TArr = explode( ' ', $line ); if( count( $TArr ) > 2 ){ - $cnode['ts'] = $TArr[0] . ' ' . $TArr[1]; - $cnode['ptr'] = $TArr[2]; - $cnode['module'] = str_replace(':','', $TArr[3]); - $cnode['msg'] = substr( $line, strlen( $cnode['ts'] ) + strlen( $cnode['ptr'] ) + strlen( $cnode['module'] ) + 4 ); + $cnode['type']= $TArr[0]; + $cnode['ts'] = $TArr[1] . ' ' . $TArr[2]; + $cnode['ptr'] = $TArr[3]; + $cnode['module'] = str_replace(':','', $TArr[4]); + $cnode['msg'] = substr( $line, strlen($TArr[0]) + strlen( $cnode['ts'] ) + strlen( $cnode['ptr'] ) + strlen( $cnode['module'] ) + 5 ); if( $LID < 40 ) { $LID++; } else { diff --git a/lib/controller/props/0_node_prop.js b/lib/controller/props/0_node_prop.js index 716448d..a501fa1 100644 --- a/lib/controller/props/0_node_prop.js +++ b/lib/controller/props/0_node_prop.js @@ -8,14 +8,21 @@ //width: 190 //}, defaultType: 'textfield', - items: [{ - xtype: 'panel', - height: 100, - html: '


%%%NODENAME%%%

' - },{ - xtype:'fieldset', - title: 'Information', - collapsible: true, + items: [{ + xtype: 'panel', + height: 100, + html: '


%%%NODENAME%%%

' + },{ + xtype: 'button', + text: 'Settings', + width: '100%', + handler: function(){ + alert('Settings'); + } + },{ + xtype:'fieldset', + title: 'Information', + collapsible: true, autoHeight: true, defaults: { width: '100%' @@ -23,7 +30,7 @@ items :[ %%%INFO%%% ] },{ xtype:'fieldset', - title: 'Sockets', + title: 'Resources', collapsible: true, autoHeight:true, defaults: { @@ -39,18 +46,11 @@ width: '100%' }, items :[ %%%MODULES%%%,{ - xtype: 'button', - text: 'Add Module', - handler: function(){ + xtype: 'button', + text: 'Add Module', + handler: function(){ - } - }] - }], - - buttons: [{ - text: 'Refresh', - handler: function(){ - loadServerProperties(%%%NODEID%%%); - } + } + }] }] } \ No newline at end of file diff --git a/lib/controller/resetAllSettings.php b/lib/controller/resetAllSettings.php new file mode 100644 index 0000000..3a1d4ab --- /dev/null +++ b/lib/controller/resetAllSettings.php @@ -0,0 +1,137 @@ +Query( $QS ); + if( count( $Result ) ){ + $ND = $Result[0]; + switch( $ND['type'] ){ + // Server + case 0:{ + // Clear Resources + $QS = "SELECT * FROM `resources` WHERE `node_id`={$NodeID}"; + $RES = $DATABASE->Query( $QS ); + foreach( $RES as $R ){ + switch( $R['type'] ){ + // Handle UARTS + case 1:{ + $QS = "DELETE FROM `uart_settings` WHERE `id`={$R['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + // Handle Analog Video Grabber + case 31:{ + $QS = "DELETE FROM `media_streams` WHERE `id`={$R['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + }; + $QS = "DELETE FROM `resources` WHERE `id`={$R['id']}"; + $DATABASE->Query( $QS ); + }; + break; + }; + // Sensors + case 1: + case 2: + case 3: + case 4: + case 5: + case 6:{ + $QS = "DELETE FROM `lrf_sensors` WHERE `id`={$ND['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `lrf_detection_profiles` WHERE `aux_id`={$ND['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "SELECT * FROM `lrf_draw` WHERE `node_id`={$ND['id']}"; + $DR = $DATABASE->Query( $QS ); + if( count( $DR ) ){ + foreach( $DR as $R ){ + $FF = "data/device_draws/{$R['md5']}.raw"; + unlink($FF); + if( $R['rendered'] == 'Y' ){ + $FF = "data/device_draws/{$R['md5']}_100.png"; + unlink($FF); + $FF = "data/device_draws/{$R['md5']}_50.png"; + unlink($FF); + $FF = "data/device_draws/{$R['md5']}_25.png"; + unlink($FF); + $FF = "data/device_draws/{$R['md5']}_12.png"; + unlink($FF); + }; + }; + $QS = "DELETE FROM `lrf_draw` WHERE `node_id`={$ND['id']}"; + $DATABASE->Query( $QS ); + }; + break; + }; + // Cameras + case 10: + case 11: + case 12: + case 13:{ + $QS = "DELETE FROM `media_streams` WHERE `source_id`={$ND['aux_id']} OR `id`={$ND['aux_parameter']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `cameras` WHERE `id`={$ND['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + // IP UART + case 20:{ + + + break; + }; + default:{ + + }; + }; + $QS = "DELETE FROM `connections` WHERE `from`={$ND['id']} OR `to`={$ND['id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `resources` WHERE `node_id`={$ND['id']}"; + $DATABASE->Query( $QS ); + if( $ND['type'] != 0 ){ + $QS = "DELETE FROM `nodes` WHERE `id`={$ND['id']}"; + $DATABASE->Query( $QS ); + }; + }; + }; + + $UID = intval( $CUser->Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( isset( $_POST['SAID'] ) ){ + $SITE = intval( $_POST['SAID'] ); + } else $SITE = 0; + if( $UID > 1 ){ + if( $SITE == $CUser->Data['selected_site'] ){ + if( $ACCESS > 5 ){ + $QS = "SELECT `id` FROM `nodes` WHERE `site_id`={$SITE}"; + $Nodes = $DATABASE->Query( $QS ); + foreach( $Nodes as $Node ) deleteNode( $Node['id'] ); + $QS = "INSERT INTO `access_log` SET `ts`=NOW(), `user_id`={$UID}, `cmd`=255"; + $DATABASE->Query( $QS ); + // Restart Setver(s) + $QS = "SELECT * FROM `nodes` WHERE `site_id`={$SITE} AND `type`=0"; + $SR = $DATABASE->Query( $QS ); + foreach( $SR as $S ){ + $QS = "INSERT INTO `servers_queue` SET `server_id`={$S['aux_id']}, `ts`=NOW(), `cmd`=251"; + $DATABASE->Query( $QS ); + }; + } else { + // Log Security Treat! + $QS = "INSERT INTO `access_log` SET `ts`=NOW(), `user_id`={$UID}, `cmd`=13, `dataset`='{\"action\":255}'"; + $DATABASE->Query( $QS ); + $Data['notifications'] = array(); + $Data['status']='ACCESS'; + }; + } else { + $Data['notifications'] = array(); + $Data['status']='LOGOUT'; + }; + } else { + $Data['notifications'] = array(); + $Data['status']='LOGOUT'; + }; + echo json_encode( $Data ); +?> \ No newline at end of file diff --git a/lib/controller/validateNode.php b/lib/controller/validateNode.php new file mode 100644 index 0000000..5653f5f --- /dev/null +++ b/lib/controller/validateNode.php @@ -0,0 +1,37 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 && $ACCESS > 1 ){ + $INFO = $_POST['NID']; + if( $INFO != '' ){ + $TArr = explode( ':', $INFO ); + $NodeID = intval( $TArr[0]); + $NoteID = intval( $TArr[1]); + $METHOD = intval( $_POST['MET'] ); + $Data = array(); + $QS = "SELECT * FROM nodes WHERE id={$NodeID}"; + $result = $DATABASE->Query( $QS ); + if( count( $result ) ){ + $DevID = intval( $result[0]['aux_id'] ); + switch( $METHOD ){ + case 1:{ + $QS = "UPDATE lrf_sensors SET data_status = 1 WHERE id={$result[0]['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "UPDATE notifications SET status='D' WHERE id={$NoteID}"; + $DATABASE->Query( $QS ); + $QS = "INSERT INTO `access_log` SET `ts`=NOW(), `user_id`={$UID},`cmd`=10, `dataset`='{\"node\":{$NodeID},\"note\":{$NoteID},\"method\":1}'"; + $DATABASE->Query( $QS ); + break; + }; + }; + $Data['status'] = 'OK'; + } else { + $Data['status'] = 'NONODE'; + }; + }; + } else { + $Data['status']='NOACCESS'; + }; + echo json_encode( $Data ); +?> \ No newline at end of file diff --git a/lib/defines.php b/lib/defines.php index 9ea6877..091e35e 100644 --- a/lib/defines.php +++ b/lib/defines.php @@ -12,51 +12,6 @@ $DBCacheDir=$SYSPath . 'cache'; $MinimalSize=640000; - - -// Argus Defines - -define( "ARGUS_SERVER", 0 ); -define( "ARGUS_ALS_SENSOR", 1 ); -define( "ARGUS_LFS_SENSOR", 2 ); -define( "ARGUS_PLS_200_SENSOR", 3 ); -define( "ARGUS_PLS_360_SENSOR", 4 ); -define( "ARGUS_3D_SENSOR", 5 ); -define( "ARGUS_NET_PLS_200", 6 ); -define( "ARGUS_ANALOG_STATIC_CAMERA", 10 ); -define( "ARGUS_ANALOG_PTZ_CAMERA", 11 ); -define( "ARGUS_IP_STATIC_CAMERA", 12 ); -define( "ARGUS_IP_PTZ_CAMERA", 13 ); -define( "ARGUS_IP_UART_GATEWAY", 20 ); -define( "ARGUS_JAMER", 40 ); -define( "ARGUS_IP_VIDEO_SERVER", 50 ); -define( "ARGUS_DRONE_CONTROL", 60 ); -define( "ARGUS_UNKNOWN", 255 ); - -define( "ARGUS_NODE_SOCK_TYPE_SERIAL_PORT", 1 ); -define( "ARGUS_NODE_SOCK_TYPE_NETWORK", 2 ); -define( "ARGUS_NODE_SOCK_TYPE_DC", 3 ); -define( "ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER", 4 ); -define( "ARGUS_NODE_SOCK_TYPE_AUDIO_GRABBER", 5 ); -define( "ARGUS_NODE_SOCK_TYPE_VIDEO_DIGITAL", 6 ); - -define( "COM_MODE_IN", 1 ); -define( "COM_MODE_OUT", 2 ); -define( "COM_MODE_INOUT", 3 ); - -define( "COM_TYPE_UART", 1 ); -define( "COM_TYPE_TCP", 2 ); -define( "COM_TYPE_DC_CTRL", 3 ); -define( "COM_TYPE_ANALOG_VIDEO", 4 ); -define( "COM_TYPE_ANALOG_AUDIO", 5 ); -define( "COM_TYPE_DIGITAL_MEDIA", 6 ); - -define( "CAM_TYPE_ANALOG", 1 ); -define( "CAM_TYPE_DIGITAL", 2 ); - -define( "MOD_TYPE_MEDIASERVER", 1 ); -define( "MOD_TYPE_USB_DC", 2 ); - function microtime_float(){ list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); diff --git a/lib/javascript/howler/howler.core.min.js b/lib/javascript/howler/howler.core.min.js new file mode 100644 index 0000000..c260dc3 --- /dev/null +++ b/lib/javascript/howler/howler.core.min.js @@ -0,0 +1,2 @@ +/*! howler.js v2.2.3 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ +!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/([0-6].)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o?t._loadQueue():t._emit("play",d._id)}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id)),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){s&&t.play(o,!0),t._emit("seek",o)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); \ No newline at end of file diff --git a/lib/javascript/howler/howler.js b/lib/javascript/howler/howler.js new file mode 100644 index 0000000..a2758c7 --- /dev/null +++ b/lib/javascript/howler/howler.js @@ -0,0 +1,3242 @@ +/*! + * howler.js v2.2.3 + * howlerjs.com + * + * (c) 2013-2020, James Simpson of GoldFire Studios + * goldfirestudios.com + * + * MIT License + */ + +(function() { + + 'use strict'; + + /** Global Methods **/ + /***************************************************************************/ + + /** + * Create the global controller. All contained methods and properties apply + * to all sounds that are currently playing or will be in the future. + */ + var HowlerGlobal = function() { + this.init(); + }; + HowlerGlobal.prototype = { + /** + * Initialize the global Howler object. + * @return {Howler} + */ + init: function() { + var self = this || Howler; + + // Create a global ID counter. + self._counter = 1000; + + // Pool of unlocked HTML5 Audio objects. + self._html5AudioPool = []; + self.html5PoolSize = 10; + + // Internal properties. + self._codecs = {}; + self._howls = []; + self._muted = false; + self._volume = 1; + self._canPlayEvent = 'canplaythrough'; + self._navigator = (typeof window !== 'undefined' && window.navigator) ? window.navigator : null; + + // Public properties. + self.masterGain = null; + self.noAudio = false; + self.usingWebAudio = true; + self.autoSuspend = true; + self.ctx = null; + + // Set to false to disable the auto audio unlocker. + self.autoUnlock = true; + + // Setup the various state values for global tracking. + self._setup(); + + return self; + }, + + /** + * Get/set the global volume for all sounds. + * @param {Float} vol Volume from 0.0 to 1.0. + * @return {Howler/Float} Returns self or current volume. + */ + volume: function(vol) { + var self = this || Howler; + vol = parseFloat(vol); + + // If we don't have an AudioContext created yet, run the setup. + if (!self.ctx) { + setupAudioContext(); + } + + if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) { + self._volume = vol; + + // Don't update any of the nodes if we are muted. + if (self._muted) { + return self; + } + + // When using Web Audio, we just need to adjust the master gain. + if (self.usingWebAudio) { + self.masterGain.gain.setValueAtTime(vol, Howler.ctx.currentTime); + } + + // Loop through and change volume for all HTML5 audio nodes. + for (var i=0; i=0; i--) { + self._howls[i].unload(); + } + + // Create a new AudioContext to make sure it is fully reset. + if (self.usingWebAudio && self.ctx && typeof self.ctx.close !== 'undefined') { + self.ctx.close(); + self.ctx = null; + setupAudioContext(); + } + + return self; + }, + + /** + * Check for codec support of specific extension. + * @param {String} ext Audio file extention. + * @return {Boolean} + */ + codecs: function(ext) { + return (this || Howler)._codecs[ext.replace(/^x-/, '')]; + }, + + /** + * Setup various state values for global tracking. + * @return {Howler} + */ + _setup: function() { + var self = this || Howler; + + // Keeps track of the suspend/resume state of the AudioContext. + self.state = self.ctx ? self.ctx.state || 'suspended' : 'suspended'; + + // Automatically begin the 30-second suspend process + self._autoSuspend(); + + // Check if audio is available. + if (!self.usingWebAudio) { + // No audio is available on this system if noAudio is set to true. + if (typeof Audio !== 'undefined') { + try { + var test = new Audio(); + + // Check if the canplaythrough event is available. + if (typeof test.oncanplaythrough === 'undefined') { + self._canPlayEvent = 'canplay'; + } + } catch(e) { + self.noAudio = true; + } + } else { + self.noAudio = true; + } + } + + // Test to make sure audio isn't disabled in Internet Explorer. + try { + var test = new Audio(); + if (test.muted) { + self.noAudio = true; + } + } catch (e) {} + + // Check for supported codecs. + if (!self.noAudio) { + self._setupCodecs(); + } + + return self; + }, + + /** + * Check for browser support for various codecs and cache the results. + * @return {Howler} + */ + _setupCodecs: function() { + var self = this || Howler; + var audioTest = null; + + // Must wrap in a try/catch because IE11 in server mode throws an error. + try { + audioTest = (typeof Audio !== 'undefined') ? new Audio() : null; + } catch (err) { + return self; + } + + if (!audioTest || typeof audioTest.canPlayType !== 'function') { + return self; + } + + var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, ''); + + // Opera version <33 has mixed MP3 support, so we need to check for and block it. + var ua = self._navigator ? self._navigator.userAgent : ''; + var checkOpera = ua.match(/OPR\/([0-6].)/g); + var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33); + var checkSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1; + var safariVersion = ua.match(/Version\/(.*?) /); + var isOldSafari = (checkSafari && safariVersion && parseInt(safariVersion[1], 10) < 15); + + self._codecs = { + mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))), + mpeg: !!mpegTest, + opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''), + ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), + oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), + wav: !!(audioTest.canPlayType('audio/wav; codecs="1"') || audioTest.canPlayType('audio/wav')).replace(/^no$/, ''), + aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''), + caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''), + m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), + m4b: !!(audioTest.canPlayType('audio/x-m4b;') || audioTest.canPlayType('audio/m4b;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), + mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), + weba: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')), + webm: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')), + dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''), + flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '') + }; + + return self; + }, + + /** + * Some browsers/devices will only allow audio to be played after a user interaction. + * Attempt to automatically unlock audio on the first user interaction. + * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/ + * @return {Howler} + */ + _unlockAudio: function() { + var self = this || Howler; + + // Only run this if Web Audio is supported and it hasn't already been unlocked. + if (self._audioUnlocked || !self.ctx) { + return; + } + + self._audioUnlocked = false; + self.autoUnlock = false; + + // Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views. + // Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000. + // By calling Howler.unload(), we create a new AudioContext with the correct sampleRate. + if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) { + self._mobileUnloaded = true; + self.unload(); + } + + // Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per: + // http://stackoverflow.com/questions/24119684 + self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050); + + // Call this method on touch start to create and play a buffer, + // then check if the audio actually played to determine if + // audio has now been unlocked on iOS, Android, etc. + var unlock = function(e) { + // Create a pool of unlocked HTML5 Audio objects that can + // be used for playing sounds without user interaction. HTML5 + // Audio objects must be individually unlocked, as opposed + // to the WebAudio API which only needs a single activation. + // This must occur before WebAudio setup or the source.onended + // event will not fire. + while (self._html5AudioPool.length < self.html5PoolSize) { + try { + var audioNode = new Audio(); + + // Mark this Audio object as unlocked to ensure it can get returned + // to the unlocked pool when released. + audioNode._unlocked = true; + + // Add the audio node to the pool. + self._releaseHtml5Audio(audioNode); + } catch (e) { + self.noAudio = true; + break; + } + } + + // Loop through any assigned audio nodes and unlock them. + for (var i=0; i= 55. + if (typeof self.ctx.resume === 'function') { + self.ctx.resume(); + } + + // Setup a timeout to check that we are unlocked on the next event loop. + source.onended = function() { + source.disconnect(0); + + // Update the unlocked state and prevent this check from happening again. + self._audioUnlocked = true; + + // Remove the touch start listener. + document.removeEventListener('touchstart', unlock, true); + document.removeEventListener('touchend', unlock, true); + document.removeEventListener('click', unlock, true); + document.removeEventListener('keydown', unlock, true); + + // Let all sounds know that audio has been unlocked. + for (var i=0; i 0 ? sound._seek : self._sprite[sprite][0] / 1000); + var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek); + var timeout = (duration * 1000) / Math.abs(sound._rate); + var start = self._sprite[sprite][0] / 1000; + var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000; + sound._sprite = sprite; + + // Mark the sound as ended instantly so that this async playback + // doesn't get grabbed by another call to play while this one waits to start. + sound._ended = false; + + // Update the parameters of the sound. + var setParams = function() { + sound._paused = false; + sound._seek = seek; + sound._start = start; + sound._stop = stop; + sound._loop = !!(sound._loop || self._sprite[sprite][2]); + }; + + // End the sound instantly if seek is at the end. + if (seek >= stop) { + self._ended(sound); + return; + } + + // Begin the actual playback. + var node = sound._node; + if (self._webAudio) { + // Fire this when the sound is ready to play to begin Web Audio playback. + var playWebAudio = function() { + self._playLock = false; + setParams(); + self._refreshBuffer(sound); + + // Setup the playback params. + var vol = (sound._muted || self._muted) ? 0 : sound._volume; + node.gain.setValueAtTime(vol, Howler.ctx.currentTime); + sound._playStart = Howler.ctx.currentTime; + + // Play the sound using the supported method. + if (typeof node.bufferSource.start === 'undefined') { + sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration); + } else { + sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration); + } + + // Start a new timer if none is present. + if (timeout !== Infinity) { + self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout); + } + + if (!internal) { + setTimeout(function() { + self._emit('play', sound._id); + self._loadQueue(); + }, 0); + } + }; + + if (Howler.state === 'running' && Howler.ctx.state !== 'interrupted') { + playWebAudio(); + } else { + self._playLock = true; + + // Wait for the audio context to resume before playing. + self.once('resume', playWebAudio); + + // Cancel the end timer. + self._clearTimer(sound._id); + } + } else { + // Fire this when the sound is ready to play to begin HTML5 Audio playback. + var playHtml5 = function() { + node.currentTime = seek; + node.muted = sound._muted || self._muted || Howler._muted || node.muted; + node.volume = sound._volume * Howler.volume(); + node.playbackRate = sound._rate; + + // Some browsers will throw an error if this is called without user interaction. + try { + var play = node.play(); + + // Support older browsers that don't support promises, and thus don't have this issue. + if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) { + // Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause(). + self._playLock = true; + + // Set param values immediately. + setParams(); + + // Releases the lock and executes queued actions. + play + .then(function() { + self._playLock = false; + node._unlocked = true; + if (!internal) { + self._emit('play', sound._id); + } else { + self._loadQueue(); + } + }) + .catch(function() { + self._playLock = false; + self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' + + 'on mobile devices and Chrome where playback was not within a user interaction.'); + + // Reset the ended and paused values. + sound._ended = true; + sound._paused = true; + }); + } else if (!internal) { + self._playLock = false; + setParams(); + self._emit('play', sound._id); + } + + // Setting rate before playing won't work in IE, so we set it again here. + node.playbackRate = sound._rate; + + // If the node is still paused, then we can assume there was a playback issue. + if (node.paused) { + self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' + + 'on mobile devices and Chrome where playback was not within a user interaction.'); + return; + } + + // Setup the end timer on sprites or listen for the ended event. + if (sprite !== '__default' || sound._loop) { + self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout); + } else { + self._endTimers[sound._id] = function() { + // Fire ended on this audio node. + self._ended(sound); + + // Clear this listener. + node.removeEventListener('ended', self._endTimers[sound._id], false); + }; + node.addEventListener('ended', self._endTimers[sound._id], false); + } + } catch (err) { + self._emit('playerror', sound._id, err); + } + }; + + // If this is streaming audio, make sure the src is set and load again. + if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') { + node.src = self._src; + node.load(); + } + + // Play immediately if ready, or wait for the 'canplaythrough'e vent. + var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS); + if (node.readyState >= 3 || loadedNoReadyState) { + playHtml5(); + } else { + self._playLock = true; + self._state = 'loading'; + + var listener = function() { + self._state = 'loaded'; + + // Begin playback. + playHtml5(); + + // Clear this listener. + node.removeEventListener(Howler._canPlayEvent, listener, false); + }; + node.addEventListener(Howler._canPlayEvent, listener, false); + + // Cancel the end timer. + self._clearTimer(sound._id); + } + } + + return sound._id; + }, + + /** + * Pause playback and save current position. + * @param {Number} id The sound ID (empty to pause all in group). + * @return {Howl} + */ + pause: function(id) { + var self = this; + + // If the sound hasn't loaded or a play() promise is pending, add it to the load queue to pause when capable. + if (self._state !== 'loaded' || self._playLock) { + self._queue.push({ + event: 'pause', + action: function() { + self.pause(id); + } + }); + + return self; + } + + // If no id is passed, get all ID's to be paused. + var ids = self._getSoundIds(id); + + for (var i=0; i Returns the group's volume value. + * volume(id) -> Returns the sound id's current volume. + * volume(vol) -> Sets the volume of all sounds in this Howl group. + * volume(vol, id) -> Sets the volume of passed sound id. + * @return {Howl/Number} Returns self or current volume. + */ + volume: function() { + var self = this; + var args = arguments; + var vol, id; + + // Determine the values based on arguments. + if (args.length === 0) { + // Return the value of the groups' volume. + return self._volume; + } else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') { + // First check if this is an ID, and if not, assume it is a new volume. + var ids = self._getSoundIds(); + var index = ids.indexOf(args[0]); + if (index >= 0) { + id = parseInt(args[0], 10); + } else { + vol = parseFloat(args[0]); + } + } else if (args.length >= 2) { + vol = parseFloat(args[0]); + id = parseInt(args[1], 10); + } + + // Update the volume or return the current volume. + var sound; + if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) { + // If the sound hasn't loaded, add it to the load queue to change volume when capable. + if (self._state !== 'loaded'|| self._playLock) { + self._queue.push({ + event: 'volume', + action: function() { + self.volume.apply(self, args); + } + }); + + return self; + } + + // Set the group volume. + if (typeof id === 'undefined') { + self._volume = vol; + } + + // Update one or all volumes. + id = self._getSoundIds(id); + for (var i=0; i 0) ? len / steps : len); + var lastTick = Date.now(); + + // Store the value being faded to. + sound._fadeTo = to; + + // Update the volume value on each interval tick. + sound._interval = setInterval(function() { + // Update the volume based on the time since the last tick. + var tick = (Date.now() - lastTick) / len; + lastTick = Date.now(); + vol += diff * tick; + + // Round to within 2 decimal points. + vol = Math.round(vol * 100) / 100; + + // Make sure the volume is in the right bounds. + if (diff < 0) { + vol = Math.max(to, vol); + } else { + vol = Math.min(to, vol); + } + + // Change the volume. + if (self._webAudio) { + sound._volume = vol; + } else { + self.volume(vol, sound._id, true); + } + + // Set the group's volume. + if (isGroup) { + self._volume = vol; + } + + // When the fade is complete, stop it and fire event. + if ((to < from && vol <= to) || (to > from && vol >= to)) { + clearInterval(sound._interval); + sound._interval = null; + sound._fadeTo = null; + self.volume(to, sound._id); + self._emit('fade', sound._id); + } + }, stepLen); + }, + + /** + * Internal method that stops the currently playing fade when + * a new fade starts, volume is changed or the sound is stopped. + * @param {Number} id The sound id. + * @return {Howl} + */ + _stopFade: function(id) { + var self = this; + var sound = self._soundById(id); + + if (sound && sound._interval) { + if (self._webAudio) { + sound._node.gain.cancelScheduledValues(Howler.ctx.currentTime); + } + + clearInterval(sound._interval); + sound._interval = null; + self.volume(sound._fadeTo, id); + sound._fadeTo = null; + self._emit('fade', id); + } + + return self; + }, + + /** + * Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments. + * loop() -> Returns the group's loop value. + * loop(id) -> Returns the sound id's loop value. + * loop(loop) -> Sets the loop value for all sounds in this Howl group. + * loop(loop, id) -> Sets the loop value of passed sound id. + * @return {Howl/Boolean} Returns self or current loop value. + */ + loop: function() { + var self = this; + var args = arguments; + var loop, id, sound; + + // Determine the values for loop and id. + if (args.length === 0) { + // Return the grou's loop value. + return self._loop; + } else if (args.length === 1) { + if (typeof args[0] === 'boolean') { + loop = args[0]; + self._loop = loop; + } else { + // Return this sound's loop value. + sound = self._soundById(parseInt(args[0], 10)); + return sound ? sound._loop : false; + } + } else if (args.length === 2) { + loop = args[0]; + id = parseInt(args[1], 10); + } + + // If no id is passed, get all ID's to be looped. + var ids = self._getSoundIds(id); + for (var i=0; i Returns the first sound node's current playback rate. + * rate(id) -> Returns the sound id's current playback rate. + * rate(rate) -> Sets the playback rate of all sounds in this Howl group. + * rate(rate, id) -> Sets the playback rate of passed sound id. + * @return {Howl/Number} Returns self or the current playback rate. + */ + rate: function() { + var self = this; + var args = arguments; + var rate, id; + + // Determine the values based on arguments. + if (args.length === 0) { + // We will simply return the current rate of the first node. + id = self._sounds[0]._id; + } else if (args.length === 1) { + // First check if this is an ID, and if not, assume it is a new rate value. + var ids = self._getSoundIds(); + var index = ids.indexOf(args[0]); + if (index >= 0) { + id = parseInt(args[0], 10); + } else { + rate = parseFloat(args[0]); + } + } else if (args.length === 2) { + rate = parseFloat(args[0]); + id = parseInt(args[1], 10); + } + + // Update the playback rate or return the current value. + var sound; + if (typeof rate === 'number') { + // If the sound hasn't loaded, add it to the load queue to change playback rate when capable. + if (self._state !== 'loaded' || self._playLock) { + self._queue.push({ + event: 'rate', + action: function() { + self.rate.apply(self, args); + } + }); + + return self; + } + + // Set the group rate. + if (typeof id === 'undefined') { + self._rate = rate; + } + + // Update one or all volumes. + id = self._getSoundIds(id); + for (var i=0; i Returns the first sound node's current seek position. + * seek(id) -> Returns the sound id's current seek position. + * seek(seek) -> Sets the seek position of the first sound node. + * seek(seek, id) -> Sets the seek position of passed sound id. + * @return {Howl/Number} Returns self or the current seek position. + */ + seek: function() { + var self = this; + var args = arguments; + var seek, id; + + // Determine the values based on arguments. + if (args.length === 0) { + // We will simply return the current position of the first node. + if (self._sounds.length) { + id = self._sounds[0]._id; + } + } else if (args.length === 1) { + // First check if this is an ID, and if not, assume it is a new seek position. + var ids = self._getSoundIds(); + var index = ids.indexOf(args[0]); + if (index >= 0) { + id = parseInt(args[0], 10); + } else if (self._sounds.length) { + id = self._sounds[0]._id; + seek = parseFloat(args[0]); + } + } else if (args.length === 2) { + seek = parseFloat(args[0]); + id = parseInt(args[1], 10); + } + + // If there is no ID, bail out. + if (typeof id === 'undefined') { + return 0; + } + + // If the sound hasn't loaded, add it to the load queue to seek when capable. + if (typeof seek === 'number' && (self._state !== 'loaded' || self._playLock)) { + self._queue.push({ + event: 'seek', + action: function() { + self.seek.apply(self, args); + } + }); + + return self; + } + + // Get the sound. + var sound = self._soundById(id); + + if (sound) { + if (typeof seek === 'number' && seek >= 0) { + // Pause the sound and update position for restarting playback. + var playing = self.playing(id); + if (playing) { + self.pause(id, true); + } + + // Move the position of the track and cancel timer. + sound._seek = seek; + sound._ended = false; + self._clearTimer(id); + + // Update the seek position for HTML5 Audio. + if (!self._webAudio && sound._node && !isNaN(sound._node.duration)) { + sound._node.currentTime = seek; + } + + // Seek and emit when ready. + var seekAndEmit = function() { + // Restart the playback if the sound was playing. + if (playing) { + self.play(id, true); + } + + self._emit('seek', id); + }; + + // Wait for the play lock to be unset before emitting (HTML5 Audio). + if (playing && !self._webAudio) { + var emitSeek = function() { + if (!self._playLock) { + seekAndEmit(); + } else { + setTimeout(emitSeek, 0); + } + }; + setTimeout(emitSeek, 0); + } else { + seekAndEmit(); + } + } else { + if (self._webAudio) { + var realTime = self.playing(id) ? Howler.ctx.currentTime - sound._playStart : 0; + var rateSeek = sound._rateSeek ? sound._rateSeek - sound._seek : 0; + return sound._seek + (rateSeek + realTime * Math.abs(sound._rate)); + } else { + return sound._node.currentTime; + } + } + } + + return self; + }, + + /** + * Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not. + * @param {Number} id The sound id to check. If none is passed, the whole sound group is checked. + * @return {Boolean} True if playing and false if not. + */ + playing: function(id) { + var self = this; + + // Check the passed sound ID (if any). + if (typeof id === 'number') { + var sound = self._soundById(id); + return sound ? !sound._paused : false; + } + + // Otherwise, loop through all sounds and check if any are playing. + for (var i=0; i= 0) { + Howler._howls.splice(index, 1); + } + + // Delete this sound from the cache (if no other Howl is using it). + var remCache = true; + for (i=0; i= 0) { + remCache = false; + break; + } + } + + if (cache && remCache) { + delete cache[self._src]; + } + + // Clear global errors. + Howler.noAudio = false; + + // Clear out `self`. + self._state = 'unloaded'; + self._sounds = []; + self = null; + + return null; + }, + + /** + * Listen to a custom event. + * @param {String} event Event name. + * @param {Function} fn Listener to call. + * @param {Number} id (optional) Only listen to events for this sound. + * @param {Number} once (INTERNAL) Marks event to fire only once. + * @return {Howl} + */ + on: function(event, fn, id, once) { + var self = this; + var events = self['_on' + event]; + + if (typeof fn === 'function') { + events.push(once ? {id: id, fn: fn, once: once} : {id: id, fn: fn}); + } + + return self; + }, + + /** + * Remove a custom event. Call without parameters to remove all events. + * @param {String} event Event name. + * @param {Function} fn Listener to remove. Leave empty to remove all. + * @param {Number} id (optional) Only remove events for this sound. + * @return {Howl} + */ + off: function(event, fn, id) { + var self = this; + var events = self['_on' + event]; + var i = 0; + + // Allow passing just an event and ID. + if (typeof fn === 'number') { + id = fn; + fn = null; + } + + if (fn || id) { + // Loop through event store and remove the passed function. + for (i=0; i=0; i--) { + // Only fire the listener if the correct ID is used. + if (!events[i].id || events[i].id === id || event === 'load') { + setTimeout(function(fn) { + fn.call(this, id, msg); + }.bind(self, events[i].fn), 0); + + // If this event was setup with `once`, remove it. + if (events[i].once) { + self.off(event, events[i].fn, events[i].id); + } + } + } + + // Pass the event type into load queue so that it can continue stepping. + self._loadQueue(event); + + return self; + }, + + /** + * Queue of actions initiated before the sound has loaded. + * These will be called in sequence, with the next only firing + * after the previous has finished executing (even if async like play). + * @return {Howl} + */ + _loadQueue: function(event) { + var self = this; + + if (self._queue.length > 0) { + var task = self._queue[0]; + + // Remove this task if a matching event was passed. + if (task.event === event) { + self._queue.shift(); + self._loadQueue(); + } + + // Run the task if no event type is passed. + if (!event) { + task.action(); + } + } + + return self; + }, + + /** + * Fired when playback ends at the end of the duration. + * @param {Sound} sound The sound object to work with. + * @return {Howl} + */ + _ended: function(sound) { + var self = this; + var sprite = sound._sprite; + + // If we are using IE and there was network latency we may be clipping + // audio before it completes playing. Lets check the node to make sure it + // believes it has completed, before ending the playback. + if (!self._webAudio && sound._node && !sound._node.paused && !sound._node.ended && sound._node.currentTime < sound._stop) { + setTimeout(self._ended.bind(self, sound), 100); + return self; + } + + // Should this sound loop? + var loop = !!(sound._loop || self._sprite[sprite][2]); + + // Fire the ended event. + self._emit('end', sound._id); + + // Restart the playback for HTML5 Audio loop. + if (!self._webAudio && loop) { + self.stop(sound._id, true).play(sound._id); + } + + // Restart this timer if on a Web Audio loop. + if (self._webAudio && loop) { + self._emit('play', sound._id); + sound._seek = sound._start || 0; + sound._rateSeek = 0; + sound._playStart = Howler.ctx.currentTime; + + var timeout = ((sound._stop - sound._start) * 1000) / Math.abs(sound._rate); + self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout); + } + + // Mark the node as paused. + if (self._webAudio && !loop) { + sound._paused = true; + sound._ended = true; + sound._seek = sound._start || 0; + sound._rateSeek = 0; + self._clearTimer(sound._id); + + // Clean up the buffer source. + self._cleanBuffer(sound._node); + + // Attempt to auto-suspend AudioContext if no sounds are still playing. + Howler._autoSuspend(); + } + + // When using a sprite, end the track. + if (!self._webAudio && !loop) { + self.stop(sound._id, true); + } + + return self; + }, + + /** + * Clear the end timer for a sound playback. + * @param {Number} id The sound ID. + * @return {Howl} + */ + _clearTimer: function(id) { + var self = this; + + if (self._endTimers[id]) { + // Clear the timeout or remove the ended listener. + if (typeof self._endTimers[id] !== 'function') { + clearTimeout(self._endTimers[id]); + } else { + var sound = self._soundById(id); + if (sound && sound._node) { + sound._node.removeEventListener('ended', self._endTimers[id], false); + } + } + + delete self._endTimers[id]; + } + + return self; + }, + + /** + * Return the sound identified by this ID, or return null. + * @param {Number} id Sound ID + * @return {Object} Sound object or null. + */ + _soundById: function(id) { + var self = this; + + // Loop through all sounds and find the one with this ID. + for (var i=0; i=0; i--) { + if (cnt <= limit) { + return; + } + + if (self._sounds[i]._ended) { + // Disconnect the audio source when using Web Audio. + if (self._webAudio && self._sounds[i]._node) { + self._sounds[i]._node.disconnect(0); + } + + // Remove sounds until we have the pool size. + self._sounds.splice(i, 1); + cnt--; + } + } + }, + + /** + * Get all ID's from the sounds pool. + * @param {Number} id Only return one ID if one is passed. + * @return {Array} Array of IDs. + */ + _getSoundIds: function(id) { + var self = this; + + if (typeof id === 'undefined') { + var ids = []; + for (var i=0; i= 0; + + if (Howler._scratchBuffer && node.bufferSource) { + node.bufferSource.onended = null; + node.bufferSource.disconnect(0); + if (isIOS) { + try { node.bufferSource.buffer = Howler._scratchBuffer; } catch(e) {} + } + } + node.bufferSource = null; + + return self; + }, + + /** + * Set the source to a 0-second silence to stop any downloading (except in IE). + * @param {Object} node Audio node to clear. + */ + _clearSound: function(node) { + var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent); + if (!checkIE) { + node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA'; + } + } + }; + + /** Single Sound Methods **/ + /***************************************************************************/ + + /** + * Setup the sound object, which each node attached to a Howl group is contained in. + * @param {Object} howl The Howl parent group. + */ + var Sound = function(howl) { + this._parent = howl; + this.init(); + }; + Sound.prototype = { + /** + * Initialize a new Sound object. + * @return {Sound} + */ + init: function() { + var self = this; + var parent = self._parent; + + // Setup the default parameters. + self._muted = parent._muted; + self._loop = parent._loop; + self._volume = parent._volume; + self._rate = parent._rate; + self._seek = 0; + self._paused = true; + self._ended = true; + self._sprite = '__default'; + + // Generate a unique ID for this sound. + self._id = ++Howler._counter; + + // Add itself to the parent's pool. + parent._sounds.push(self); + + // Create the new node. + self.create(); + + return self; + }, + + /** + * Create and setup a new sound object, whether HTML5 Audio or Web Audio. + * @return {Sound} + */ + create: function() { + var self = this; + var parent = self._parent; + var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume; + + if (parent._webAudio) { + // Create the gain node for controlling volume (the source will connect to this). + self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain(); + self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime); + self._node.paused = true; + self._node.connect(Howler.masterGain); + } else if (!Howler.noAudio) { + // Get an unlocked Audio object from the pool. + self._node = Howler._obtainHtml5Audio(); + + // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror). + self._errorFn = self._errorListener.bind(self); + self._node.addEventListener('error', self._errorFn, false); + + // Listen for 'canplaythrough' event to let us know the sound is ready. + self._loadFn = self._loadListener.bind(self); + self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false); + + // Listen for the 'ended' event on the sound to account for edge-case where + // a finite sound has a duration of Infinity. + self._endFn = self._endListener.bind(self); + self._node.addEventListener('ended', self._endFn, false); + + // Setup the new audio node. + self._node.src = parent._src; + self._node.preload = parent._preload === true ? 'auto' : parent._preload; + self._node.volume = volume * Howler.volume(); + + // Begin loading the source. + self._node.load(); + } + + return self; + }, + + /** + * Reset the parameters of this sound to the original state (for recycle). + * @return {Sound} + */ + reset: function() { + var self = this; + var parent = self._parent; + + // Reset all of the parameters of this sound. + self._muted = parent._muted; + self._loop = parent._loop; + self._volume = parent._volume; + self._rate = parent._rate; + self._seek = 0; + self._rateSeek = 0; + self._paused = true; + self._ended = true; + self._sprite = '__default'; + + // Generate a new ID so that it isn't confused with the previous sound. + self._id = ++Howler._counter; + + return self; + }, + + /** + * HTML5 Audio error listener callback. + */ + _errorListener: function() { + var self = this; + + // Fire an error event and pass back the code. + self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0); + + // Clear the event listener. + self._node.removeEventListener('error', self._errorFn, false); + }, + + /** + * HTML5 Audio canplaythrough listener callback. + */ + _loadListener: function() { + var self = this; + var parent = self._parent; + + // Round up the duration to account for the lower precision in HTML5 Audio. + parent._duration = Math.ceil(self._node.duration * 10) / 10; + + // Setup a sprite if none is defined. + if (Object.keys(parent._sprite).length === 0) { + parent._sprite = {__default: [0, parent._duration * 1000]}; + } + + if (parent._state !== 'loaded') { + parent._state = 'loaded'; + parent._emit('load'); + parent._loadQueue(); + } + + // Clear the event listener. + self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false); + }, + + /** + * HTML5 Audio ended listener callback. + */ + _endListener: function() { + var self = this; + var parent = self._parent; + + // Only handle the `ended`` event if the duration is Infinity. + if (parent._duration === Infinity) { + // Update the parent duration to match the real audio duration. + // Round up the duration to account for the lower precision in HTML5 Audio. + parent._duration = Math.ceil(self._node.duration * 10) / 10; + + // Update the sprite that corresponds to the real duration. + if (parent._sprite.__default[1] === Infinity) { + parent._sprite.__default[1] = parent._duration * 1000; + } + + // Run the regular ended method. + parent._ended(self); + } + + // Clear the event listener since the duration is now correct. + self._node.removeEventListener('ended', self._endFn, false); + } + }; + + /** Helper Methods **/ + /***************************************************************************/ + + var cache = {}; + + /** + * Buffer a sound from URL, Data URI or cache and decode to audio source (Web Audio API). + * @param {Howl} self + */ + var loadBuffer = function(self) { + var url = self._src; + + // Check if the buffer has already been cached and use it instead. + if (cache[url]) { + // Set the duration from the cache. + self._duration = cache[url].duration; + + // Load the sound into this Howl. + loadSound(self); + + return; + } + + if (/^data:[^;]+;base64,/.test(url)) { + // Decode the base64 data URI without XHR, since some browsers don't support it. + var data = atob(url.split(',')[1]); + var dataView = new Uint8Array(data.length); + for (var i=0; i 0) { + cache[self._src] = buffer; + loadSound(self, buffer); + } else { + error(); + } + }; + + // Decode the buffer into an audio source. + if (typeof Promise !== 'undefined' && Howler.ctx.decodeAudioData.length === 1) { + Howler.ctx.decodeAudioData(arraybuffer).then(success).catch(error); + } else { + Howler.ctx.decodeAudioData(arraybuffer, success, error); + } + } + + /** + * Sound is now loaded, so finish setting everything up and fire the loaded event. + * @param {Howl} self + * @param {Object} buffer The decoded buffer sound source. + */ + var loadSound = function(self, buffer) { + // Set the duration. + if (buffer && !self._duration) { + self._duration = buffer.duration; + } + + // Setup a sprite if none is defined. + if (Object.keys(self._sprite).length === 0) { + self._sprite = {__default: [0, self._duration * 1000]}; + } + + // Fire the loaded event. + if (self._state !== 'loaded') { + self._state = 'loaded'; + self._emit('load'); + self._loadQueue(); + } + }; + + /** + * Setup the audio context when available, or switch to HTML5 Audio mode. + */ + var setupAudioContext = function() { + // If we have already detected that Web Audio isn't supported, don't run this step again. + if (!Howler.usingWebAudio) { + return; + } + + // Check if we are using Web Audio and setup the AudioContext if we are. + try { + if (typeof AudioContext !== 'undefined') { + Howler.ctx = new AudioContext(); + } else if (typeof webkitAudioContext !== 'undefined') { + Howler.ctx = new webkitAudioContext(); + } else { + Howler.usingWebAudio = false; + } + } catch(e) { + Howler.usingWebAudio = false; + } + + // If the audio context creation still failed, set using web audio to false. + if (!Howler.ctx) { + Howler.usingWebAudio = false; + } + + // Check if a webview is being used on iOS8 or earlier (rather than the browser). + // If it is, disable Web Audio as it causes crashing. + var iOS = (/iP(hone|od|ad)/.test(Howler._navigator && Howler._navigator.platform)); + var appVersion = Howler._navigator && Howler._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); + var version = appVersion ? parseInt(appVersion[1], 10) : null; + if (iOS && version && version < 9) { + var safari = /safari/.test(Howler._navigator && Howler._navigator.userAgent.toLowerCase()); + if (Howler._navigator && !safari) { + Howler.usingWebAudio = false; + } + } + + // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage). + if (Howler.usingWebAudio) { + Howler.masterGain = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain(); + Howler.masterGain.gain.setValueAtTime(Howler._muted ? 0 : Howler._volume, Howler.ctx.currentTime); + Howler.masterGain.connect(Howler.ctx.destination); + } + + // Re-run the setup on Howler. + Howler._setup(); + }; + + // Add support for AMD (Asynchronous Module Definition) libraries such as require.js. + if (typeof define === 'function' && define.amd) { + define([], function() { + return { + Howler: Howler, + Howl: Howl + }; + }); + } + + // Add support for CommonJS libraries such as browserify. + if (typeof exports !== 'undefined') { + exports.Howler = Howler; + exports.Howl = Howl; + } + + // Add to global in Node.js (for testing, etc). + if (typeof global !== 'undefined') { + global.HowlerGlobal = HowlerGlobal; + global.Howler = Howler; + global.Howl = Howl; + global.Sound = Sound; + } else if (typeof window !== 'undefined') { // Define globally in case AMD is not available or unused. + window.HowlerGlobal = HowlerGlobal; + window.Howler = Howler; + window.Howl = Howl; + window.Sound = Sound; + } +})(); + + +/*! + * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. + * + * howler.js v2.2.3 + * howlerjs.com + * + * (c) 2013-2020, James Simpson of GoldFire Studios + * goldfirestudios.com + * + * MIT License + */ + +(function() { + + 'use strict'; + + // Setup default properties. + HowlerGlobal.prototype._pos = [0, 0, 0]; + HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0]; + + /** Global Methods **/ + /***************************************************************************/ + + /** + * Helper method to update the stereo panning position of all current Howls. + * Future Howls will not use this value unless explicitly set. + * @param {Number} pan A value of -1.0 is all the way left and 1.0 is all the way right. + * @return {Howler/Number} Self or current stereo panning value. + */ + HowlerGlobal.prototype.stereo = function(pan) { + var self = this; + + // Stop right here if not using Web Audio. + if (!self.ctx || !self.ctx.listener) { + return self; + } + + // Loop through all Howls and update their stereo panning. + for (var i=self._howls.length-1; i>=0; i--) { + self._howls[i].stereo(pan); + } + + return self; + }; + + /** + * Get/set the position of the listener in 3D cartesian space. Sounds using + * 3D position will be relative to the listener's position. + * @param {Number} x The x-position of the listener. + * @param {Number} y The y-position of the listener. + * @param {Number} z The z-position of the listener. + * @return {Howler/Array} Self or current listener position. + */ + HowlerGlobal.prototype.pos = function(x, y, z) { + var self = this; + + // Stop right here if not using Web Audio. + if (!self.ctx || !self.ctx.listener) { + return self; + } + + // Set the defaults for optional 'y' & 'z'. + y = (typeof y !== 'number') ? self._pos[1] : y; + z = (typeof z !== 'number') ? self._pos[2] : z; + + if (typeof x === 'number') { + self._pos = [x, y, z]; + + if (typeof self.ctx.listener.positionX !== 'undefined') { + self.ctx.listener.positionX.setTargetAtTime(self._pos[0], Howler.ctx.currentTime, 0.1); + self.ctx.listener.positionY.setTargetAtTime(self._pos[1], Howler.ctx.currentTime, 0.1); + self.ctx.listener.positionZ.setTargetAtTime(self._pos[2], Howler.ctx.currentTime, 0.1); + } else { + self.ctx.listener.setPosition(self._pos[0], self._pos[1], self._pos[2]); + } + } else { + return self._pos; + } + + return self; + }; + + /** + * Get/set the direction the listener is pointing in the 3D cartesian space. + * A front and up vector must be provided. The front is the direction the + * face of the listener is pointing, and up is the direction the top of the + * listener is pointing. Thus, these values are expected to be at right angles + * from each other. + * @param {Number} x The x-orientation of the listener. + * @param {Number} y The y-orientation of the listener. + * @param {Number} z The z-orientation of the listener. + * @param {Number} xUp The x-orientation of the top of the listener. + * @param {Number} yUp The y-orientation of the top of the listener. + * @param {Number} zUp The z-orientation of the top of the listener. + * @return {Howler/Array} Returns self or the current orientation vectors. + */ + HowlerGlobal.prototype.orientation = function(x, y, z, xUp, yUp, zUp) { + var self = this; + + // Stop right here if not using Web Audio. + if (!self.ctx || !self.ctx.listener) { + return self; + } + + // Set the defaults for optional 'y' & 'z'. + var or = self._orientation; + y = (typeof y !== 'number') ? or[1] : y; + z = (typeof z !== 'number') ? or[2] : z; + xUp = (typeof xUp !== 'number') ? or[3] : xUp; + yUp = (typeof yUp !== 'number') ? or[4] : yUp; + zUp = (typeof zUp !== 'number') ? or[5] : zUp; + + if (typeof x === 'number') { + self._orientation = [x, y, z, xUp, yUp, zUp]; + + if (typeof self.ctx.listener.forwardX !== 'undefined') { + self.ctx.listener.forwardX.setTargetAtTime(x, Howler.ctx.currentTime, 0.1); + self.ctx.listener.forwardY.setTargetAtTime(y, Howler.ctx.currentTime, 0.1); + self.ctx.listener.forwardZ.setTargetAtTime(z, Howler.ctx.currentTime, 0.1); + self.ctx.listener.upX.setTargetAtTime(xUp, Howler.ctx.currentTime, 0.1); + self.ctx.listener.upY.setTargetAtTime(yUp, Howler.ctx.currentTime, 0.1); + self.ctx.listener.upZ.setTargetAtTime(zUp, Howler.ctx.currentTime, 0.1); + } else { + self.ctx.listener.setOrientation(x, y, z, xUp, yUp, zUp); + } + } else { + return or; + } + + return self; + }; + + /** Group Methods **/ + /***************************************************************************/ + + /** + * Add new properties to the core init. + * @param {Function} _super Core init method. + * @return {Howl} + */ + Howl.prototype.init = (function(_super) { + return function(o) { + var self = this; + + // Setup user-defined default properties. + self._orientation = o.orientation || [1, 0, 0]; + self._stereo = o.stereo || null; + self._pos = o.pos || null; + self._pannerAttr = { + coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : 360, + coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : 360, + coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : 0, + distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : 'inverse', + maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : 10000, + panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : 'HRTF', + refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : 1, + rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : 1 + }; + + // Setup event listeners. + self._onstereo = o.onstereo ? [{fn: o.onstereo}] : []; + self._onpos = o.onpos ? [{fn: o.onpos}] : []; + self._onorientation = o.onorientation ? [{fn: o.onorientation}] : []; + + // Complete initilization with howler.js core's init function. + return _super.call(this, o); + }; + })(Howl.prototype.init); + + /** + * Get/set the stereo panning of the audio source for this sound or all in the group. + * @param {Number} pan A value of -1.0 is all the way left and 1.0 is all the way right. + * @param {Number} id (optional) The sound ID. If none is passed, all in group will be updated. + * @return {Howl/Number} Returns self or the current stereo panning value. + */ + Howl.prototype.stereo = function(pan, id) { + var self = this; + + // Stop right here if not using Web Audio. + if (!self._webAudio) { + return self; + } + + // If the sound hasn't loaded, add it to the load queue to change stereo pan when capable. + if (self._state !== 'loaded') { + self._queue.push({ + event: 'stereo', + action: function() { + self.stereo(pan, id); + } + }); + + return self; + } + + // Check for PannerStereoNode support and fallback to PannerNode if it doesn't exist. + var pannerType = (typeof Howler.ctx.createStereoPanner === 'undefined') ? 'spatial' : 'stereo'; + + // Setup the group's stereo panning if no ID is passed. + if (typeof id === 'undefined') { + // Return the group's stereo panning if no parameters are passed. + if (typeof pan === 'number') { + self._stereo = pan; + self._pos = [pan, 0, 0]; + } else { + return self._stereo; + } + } + + // Change the streo panning of one or all sounds in group. + var ids = self._getSoundIds(id); + for (var i=0; i Returns the group's values. + * pannerAttr(id) -> Returns the sound id's values. + * pannerAttr(o) -> Set's the values of all sounds in this Howl group. + * pannerAttr(o, id) -> Set's the values of passed sound id. + * + * Attributes: + * coneInnerAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees, + * inside of which there will be no volume reduction. + * coneOuterAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees, + * outside of which the volume will be reduced to a constant value of `coneOuterGain`. + * coneOuterGain - (0 by default) A parameter for directional audio sources, this is the gain outside of the + * `coneOuterAngle`. It is a linear value in the range `[0, 1]`. + * distanceModel - ('inverse' by default) Determines algorithm used to reduce volume as audio moves away from + * listener. Can be `linear`, `inverse` or `exponential. + * maxDistance - (10000 by default) The maximum distance between source and listener, after which the volume + * will not be reduced any further. + * refDistance - (1 by default) A reference distance for reducing volume as source moves further from the listener. + * This is simply a variable of the distance model and has a different effect depending on which model + * is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance. + * rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. This is simply a + * variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]` + * with `inverse` and `exponential`. + * panningModel - ('HRTF' by default) Determines which spatialization algorithm is used to position audio. + * Can be `HRTF` or `equalpower`. + * + * @return {Howl/Object} Returns self or current panner attributes. + */ + Howl.prototype.pannerAttr = function() { + var self = this; + var args = arguments; + var o, id, sound; + + // Stop right here if not using Web Audio. + if (!self._webAudio) { + return self; + } + + // Determine the values based on arguments. + if (args.length === 0) { + // Return the group's panner attribute values. + return self._pannerAttr; + } else if (args.length === 1) { + if (typeof args[0] === 'object') { + o = args[0]; + + // Set the grou's panner attribute values. + if (typeof id === 'undefined') { + if (!o.pannerAttr) { + o.pannerAttr = { + coneInnerAngle: o.coneInnerAngle, + coneOuterAngle: o.coneOuterAngle, + coneOuterGain: o.coneOuterGain, + distanceModel: o.distanceModel, + maxDistance: o.maxDistance, + refDistance: o.refDistance, + rolloffFactor: o.rolloffFactor, + panningModel: o.panningModel + }; + } + + self._pannerAttr = { + coneInnerAngle: typeof o.pannerAttr.coneInnerAngle !== 'undefined' ? o.pannerAttr.coneInnerAngle : self._coneInnerAngle, + coneOuterAngle: typeof o.pannerAttr.coneOuterAngle !== 'undefined' ? o.pannerAttr.coneOuterAngle : self._coneOuterAngle, + coneOuterGain: typeof o.pannerAttr.coneOuterGain !== 'undefined' ? o.pannerAttr.coneOuterGain : self._coneOuterGain, + distanceModel: typeof o.pannerAttr.distanceModel !== 'undefined' ? o.pannerAttr.distanceModel : self._distanceModel, + maxDistance: typeof o.pannerAttr.maxDistance !== 'undefined' ? o.pannerAttr.maxDistance : self._maxDistance, + refDistance: typeof o.pannerAttr.refDistance !== 'undefined' ? o.pannerAttr.refDistance : self._refDistance, + rolloffFactor: typeof o.pannerAttr.rolloffFactor !== 'undefined' ? o.pannerAttr.rolloffFactor : self._rolloffFactor, + panningModel: typeof o.pannerAttr.panningModel !== 'undefined' ? o.pannerAttr.panningModel : self._panningModel + }; + } + } else { + // Return this sound's panner attribute values. + sound = self._soundById(parseInt(args[0], 10)); + return sound ? sound._pannerAttr : self._pannerAttr; + } + } else if (args.length === 2) { + o = args[0]; + id = parseInt(args[1], 10); + } + + // Update the values of the specified sounds. + var ids = self._getSoundIds(id); + for (var i=0; i=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/([0-6].)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o?t._loadQueue():t._emit("play",d._id)}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id)),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){s&&t.play(o,!0),t._emit("seek",o)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); +/*! Spatial Plugin */ +!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a' }, success: function( response, opts ){ - var data = Ext.decode( response.responseText ); + var data = Ext.decode( response.responseText ); if( data.success ){ Ext.getCmp('cam_login').setValue( data.login ); Ext.getCmp('cam_password').setValue( data.password ); @@ -213,6 +214,8 @@ function preloadOnvifCredentials( SC ){ Ext.getCmp('loc_tab').enable(); Ext.getCmp('coc_tabs').setActiveTab( 1 ); sourceListStore.loadData( data, false ); + var tpic = document.getElementById('pic_prev'); + if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=Data['id'];?>&SID&FID='+data.nodes[0].id; //document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=Data['id'];?>&SID&FID='+data.nodes[0].id; } else { Ext.getCmp('cam_login').setValue(''); @@ -264,9 +267,18 @@ function discoverOnvifProfiles( CamID, camUser, camPasswd ){ }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); + Ext.getCmp('cac_tab').getEl().unmask(); if( data['success'] == true ){ + Ext.getCmp('acm_btn').enable(); + Ext.getCmp('cac_tab').disable(); + Ext.getCmp('lens_tab').enable(); + Ext.getCmp('str_tab').enable(); + Ext.getCmp('ptz_tab').enable(); + Ext.getCmp('loc_tab').enable(); + Ext.getCmp('coc_tabs').setActiveTab( 1 ); sourceListStore.loadData( data, false ); - document.getElementById('pic_prev').src = '/lib/controller/getVideoFeed.php?UID=Data['id'];?>&SID&FID='+data.nodes[0].id; + var tpic = document.getElementById('pic_prev'); + if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=Data['id'];?>&SID&FID='+data.nodes[0].id; } else { Ext.Msg.show({ title:'GetLabel('Error_Message');?>', @@ -278,7 +290,6 @@ function discoverOnvifProfiles( CamID, camUser, camPasswd ){ icon: Ext.MessageBox.ERROR //QUESTION }); }; - Ext.getCmp('cac_tab').getEl().unmask(); }, failure: failureAJAXFunction }); @@ -582,17 +593,19 @@ function showCamPropDialog(){ disabled: true, store: new Ext.data.ArrayStore({ fields: ['uart','uart_txt'], - data: [ - Query( $QS ); - $P = array(); - foreach( $R as $RR ){ - $P[] = "[{$RR['aux_id']}, '{$RR['name']}']"; + data: [Query( $QS ); + if( count( $RR ) ){ + $RE=array(); + foreach( $RR as $R ){ + $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; }; - echo implode( ",", $P ); - ?> - ] + echo implode( ',', $RE ); + } else { + echo "[0, 'No UARTS DEFINED']"; + }; + ?>] }), valueField: 'uart', displayField: 'uart_txt' @@ -725,14 +738,66 @@ function showCamPropDialog(){ var CIMAGER = Ext.getCmp('sens_size').getValue(); var CMINF = Ext.getCmp('min_foc').getValue(); var CMAXF = Ext.getCmp('max_foc').getValue(); - if( CLAB != '' ){ + var AllOK = true; + if( CLAB == '' ) { + AllOK = false; + Ext.Msg.show({ + title:'Data Error!', + msg: 'Please Provide Camera Name!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + return; + }; + if( SelectedSource == 0 ){ + AllOK = false; + Ext.Msg.show({ + title:'Data Error!', + msg: 'Please Select Image Source!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + return; + }; + if( ( SelectedCamTYPE == 11 || SelectedCamTYPE == 13 ) && CPTZP == 0 ){ + AllOK = false; + Ext.Msg.show({ + title:'Data Error!', + msg: 'Please Provide PTZ Protocol type!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + return; + }; + if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZU == 0 ){ + AllOK = false; + Ext.Msg.show({ + title:'Data Error!', + msg: 'Please Provide UART Port!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + return; + }; + if( ( CPTZP == 1 || CPTZP == 2 ) && CPTZID == 0 ){ + AllOK = false; + Ext.Msg.show({ + title:'Data Error!', + msg: 'Please Provide Camera ID!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + return; + }; + if( AllOK ){ Ext.Ajax.request({ url: '/lib/controller/AddCameraNode.php', params: { - NID: , + SITEID: , UID: , SID: '', CID: SelectedCam, + STREAM: SelectedSource, LAB: CLAB, UART: CPTZU, PROTOID: CPTZID, @@ -743,7 +808,8 @@ function showCamPropDialog(){ IMSIZE: CIMAGER, FMIN: CMINF, FMAX: CMAXF, - PTZ: CPTZP + PTZ: CPTZP, + CTYPE: SelectedCamTYPE }, success: function( response, opts ){ addIpCamDialog.close(); @@ -753,13 +819,6 @@ function showCamPropDialog(){ }, failure: failureAJAXFunction }); - } else { - Ext.Msg.show({ - title:'Data Error!', - msg: 'Please Provide Camera Name!', - buttons: Ext.Msg.OK, - icon: Ext.MessageBox.INFO - }); }; } }] @@ -773,13 +832,12 @@ function showCamPropDialog(){ function connectToSeleced(){ CamPropType = 1; if( SelectedCam > 0 ){ - showCamPropDialog(); preloadOnvifCredentials( SelectedCam ); //loadCameraSettings( SelectedCam ); }; }; -function addIpCam(){ +function addIpCam(){ if( addIpCamDialog == null ){ addIpCamDialog = new Ext.Window({ modal: true, @@ -813,6 +871,40 @@ function addIpCam(){ addIpCamDialog.show(); cameraListStore.load({params:{start:0, limit:50}}); }; +var addAnalogCamDialog = null; +function addAnalogCam(){ + if( addAnalogCamDialog == null ){ + addAnalogCamDialog = new Ext.Window({ + modal: true, + title: 'GetLabel('_DET_IP_CAMERA_LST_');?>', + width: 800, + height: 600, + layout: 'fit', + closeAction: 'hide', + items:[{ + xtype: 'grid', + ds: cameraListStore, + cm: cameraListColModel, + sm: cameraListSelModel, + viewConfig: { + forceFit: true + } + }], + bbar: [{ + text: 'GetLabel('_CANCEL_');?>', + handler: function(){ + addIpCamDialog.hide(); + } + },'->',{ + id: 'con_to_src', + text: 'GetLabel('_CONNECT_2_SEL_');?>', + disabled: ( SelectedCam == 0 ), + handler: connectToSeleced + }] + }); + }; + addAnalogCamDialog.show(); +}; function addEthernet2Uart(){ if( addE2UDialog == null ){ diff --git a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js index e2d844d..742b216 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js +++ b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js @@ -1,6 +1,203 @@ // + + +function Pie(cx, cy, radius, data) { + + var decimals = 4; + var total = 0; + var offset = 0; + var offset2; + var arr = []; + var x; + var y; + var la; + var radians; + + for (var i = 0; i < data.length; i++) + total += data[i].value; + + for (var i = 0; i < data.length; i++) { + + var item = data[i]; + var tmp = {}; + + tmp.index = i; + tmp.value = item.value; + radians = ((((item.value / total) * 360) * Math.PI) / 180).floor(decimals); + offset2 = ((offset / total) * 360).floor(decimals); + tmp.data = item; + + x = (cx + Math.sin(radians) * radius).floor(decimals); + y = (cy - Math.cos(radians) * radius).floor(decimals); + la = radians > Math.PI ? 1 : 0; + + // Arc + tmp.d = 'M{0} {1},L{0} {2},A{3} {3},0 {4} 1,{5} {6}Z'.format(cx, cy, cy - radius, radius, la, x, y); + tmp.transform = 'rotate({0}, {1}, {2})'.format(offset2, cx, cy); + + // Text + x = (cx + Math.sin(radians / 2) * radius / 2).floor(decimals); + y = (cy - Math.cos(radians / 2) * radius / 2).floor(decimals); + tmp.text = 'x="{0}" y="{1}" transform="rotate({2},{0},{1})"'.format(x, y, -offset2); + + offset += item.value; + arr.push(tmp); + } + + return arr; +} + +function Donut(cx, cy, radius, data) { + function arcradius(cx, cy, radius, degrees) { + var radians = (degrees - 90) * Math.PI / 180.0; + return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) }; + } + + var decimals = 4; + var total = 0; + var arr = []; + var beg = 0; + var end = 0; + var count = 0; + + var half = radius / 2; + var midpoint = radius / 2.4; + + for (var i = 0; i < data.length; i++) + total += data[i].value; + + for (var i = 0; i < data.length; i++) { + var item = data[i]; + var tmp = {}; + + //var p = (((item.value + 1) / total) * 100).floor( 2 ); + var p = Math.floor(((item.value + 1) / total) * 100); + + count += p; + + if (i === length - 1 && count < 100) + p = p + (100 - count); + + end = beg + ((360 / 100) * p); + tmp.index = i; + tmp.value = item.value; + tmp.data = item; + + var b = arcradius(cx, cy, radius, end); + var e = arcradius(cx, cy, radius, beg); + var la = (end - beg) <= 180 ? 0 : 1; + + tmp.d = ['M', Math.floor( b.x ), Math.floor( b.y ), 'A', radius, radius, 0, la, 0, Math.floor( e.x ), Math.floor( e.y ) ].join(' '); + arr.push(tmp); + beg = end; + } + + return arr; +} + +//Pie Chart Usage +/* +var svg = $('#yoursvgelement'); +var data = [{ value: 33 }, { value: 20 }, { value: 80 }, { value: 48 }]; +var centerX = 300; +var centerY = 300; +var radius = 250; +var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453']; + +var arr = Pie(centerX, centerY, radius, data); +for (var i = 0; i < arr.length; i++) { + var item = arr[i]; + svg.asvg('{3}'.format(item.transform, item.d, item.text, item.value, color[i])); +} +*/ + +// Donut Chart Usage +/* +var svg = $('#yoursvgelement'); +var data = [{ value: 33 }, { value: 20 }, { value: 80 }, { value: 48 }]; +var centerX = 300; +var centerY = 300; +var radius = 250; +var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453']; + +var arr = Donut(centerX, centerY, radius, data); +for (var i = 0; i < arr.length; i++) { + var item = arr[i]; + svg.asvg(''.format(item.d, color[i])); +} +*/ + +function makePtzMove( me ){ + var name = me.target.id; + Ext.Ajax.request({ + url: '/lib/controller/camMakeMove.php', + params: { + SITE: , + UID: , + SID: '', + CMD: name + }, + //success: function( response, opts ){ + //}, + failure: failureAJAXFunction + }); +}; + +function ptzCtrl( a ){ + +}; + +function makePtzStop( me ){ + var name = me.target.id; + Ext.Ajax.request({ + url: '/lib/controller/camStop.php', + params: { + SITE: , + UID: , + SID: '', + CMD: name + }, + //success: function( response, opts ){ + //}, + failure: failureAJAXFunction + }); +}; + +function fullScreen( id ){ + // if already full screen; exit + // else go fullscreen + if( + document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement + ){ + if( document.exitFullscreen ){ + document.exitFullscreen(); + }else if( document.mozCancelFullScreen ){ + document.mozCancelFullScreen(); + }else if( document.webkitExitFullscreen ){ + document.webkitExitFullscreen(); + }else if( document.msExitFullscreen ){ + document.msExitFullscreen(); + }; + }else{ + //element = $('#container').get(0); + var element = document.getElementById( id ); //Ext.getCmp( id ); + if( element.requestFullscreen ){ + element.requestFullscreen(); + }else if( element.mozRequestFullScreen ){ + element.mozRequestFullScreen(); + }else if( element.webkitRequestFullscreen ){ + element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); + }else if( element.msRequestFullscreen ){ + element.msRequestFullscreen(); + }; + }; +}; + function updateDashBoardItemLayout( id, x, y ){ Ext.Ajax.request({ url: '/lib/controller/updateDashBoardItems.php', @@ -46,9 +243,10 @@ function DrawTargets( k, b ){ case 12:{ if( b[i].digital < 256 ){ var cc = 255 - i ;//* ( 255 / 33 ); - ctx.fillStyle = "#" + cc.toString(16) + "0000"; + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; //ctx.strokeStyle = "#FF0000"; - var r = (196 * b[i].digital)/ 256; + var r = (196 * b[i].digital)/ 512; var a = -1.0 * b[i].az * ( Math.PI / 180 ); var x = 100 + Math.cos( a ) * r; var y = 100 + Math.sin( a ) * r; @@ -59,9 +257,10 @@ function DrawTargets( k, b ){ case 25:{ if( b[i].digital < 512 ){ var cc = 255 - i ;//* ( 255 / 33 ); - ctx.fillStyle = "#" + cc.toString(16) + "0000"; + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; //ctx.strokeStyle = "#FF0000"; - var r = (196 * b[i].digital)/ 512; + var r = (196 * b[i].digital)/ 1024; var a = -1.0 * b[i].az * ( Math.PI / 180 ); var x = 100 + Math.cos( a ) * r; var y = 100 + Math.sin( a ) * r; @@ -72,9 +271,10 @@ function DrawTargets( k, b ){ case 50:{ if( b[i].digital < 1024 ){ var cc = 255 - i ;//* ( 255 / 33 ); - ctx.fillStyle = "#" + cc.toString(16) + "0000"; + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; //ctx.strokeStyle = "#FF0000"; - var r = (196 * b[i].digital) / 1024; + var r = (196 * b[i].digital) / 2048; var a = -1.0 * b[i].az * ( Math.PI / 180 ); var x = 100 + Math.cos( a ) * r; var y = 100 + Math.sin( a ) * r; @@ -84,9 +284,10 @@ function DrawTargets( k, b ){ }; case 100:{ var cc = 255 - i ;//* ( 255 / 33 ); - ctx.fillStyle = "#" + cc.toString(16) + "0000"; + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; //ctx.strokeStyle = "#FF0000"; - var r = (196 * b[i].digital)/ 2048; + var r = (196 * b[i].digital)/ 4096; var a = -1.0 * b[i].az * ( Math.PI / 180 ); var x = 100 + Math.cos( a ) * r; var y = 100 + Math.sin( a ) * r; @@ -97,18 +298,98 @@ function DrawTargets( k, b ){ }; }; +var lastNotificationID = 0; + +function setDonatStatus( id , value ){ + var val1D = document.getElementById('donut'+id+'-segment1'); + var val2D = document.getElementById('donut'+id+'-segment2'); + var val3D = document.getElementById('donut'+id+'-segment3'); + + var val1 = (value>-1)?value:0; + var val2 = (value>-1)?100 - val1:0;//data.nodes[i].cpu5 * 100; + var val3 = (value>-1)?0:100;//data.nodes[i].cpu15 * 100; + var totalValue = document.getElementById('totalValue'+id); + + var total = val1+val2+val3; + + var per1 = val1/total*100; + var per2 = val2/total*100; + var per3 = val3/total*100; + var offset = 25; + if( ( val1 != undefined ) && ( value > -1 ) ){ + totalValue.textContent = val1+'%'; + } else { + totalValue.textContent = 'No Data'; + }; + + val1D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out"; + val1D.style.strokeDasharray = per1+" "+(100-per1); + val1D.style.strokeDashoffset = offset; + + val2D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out"; + val2D.style.strokeDasharray = per2+" "+(100-per2); + val2D.style.strokeDashoffset = 100-per1+offset; + + val3D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out"; + val3D.style.strokeDasharray = per3+" "+(100-per3); + val3D.style.strokeDashoffset = 100-(per1+per2)+offset; +}; + function fetchSiteStatus(){ Ext.Ajax.request({ - url: '/lib/controller/getDashBoardStatus.php', + url: '/lib/controller/getStatus.php', params: { - SITE: , - UID: , - SID: '' + SITE: , + LNID: lastNotificationID, + SPID: ServerPID, + UID: , + SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( data.nodes.length > 0 ){ for( i=0; i < data.nodes.length; i++ ){ + if( data.nodes[i].type == 0 ){ + //Handle Server Status + if ( data.nodes[i].status ){ + setDonatStatus( '' , data.nodes[i].cpu5 ); + setDonatStatus( '1' , data.nodes[i].mem ); + setDonatStatus( '2' , data.nodes[i].disk ); + } else { + setDonatStatus( '' , -1 ); + setDonatStatus( '1' , -1 ); + setDonatStatus( '2' , -1 ); + }; + }; + if( data.nodes[i].type > 9 && data.nodes[i].type < 14 ){ + var iel = document.getElementById('img-'+data.nodes[i].id ); + if( !data.nodes[i].valid ){ + if( iel.src != "/style/assets/no-signal.png" ) iel.src = "/style/assets/no-signal.png"; + } else { + if( data.nodes[i].src != iel.src ) iel.src = data.nodes[i].src; + };//else { + //https://man7.org/linux/man-pages/man2/getrusage.2.html + //https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode + //https://stackoverflow.com/questions/13465073/how-to-catch-an-exception-from-image-onload + //if( data.nodes[i].valid && ServerIsOnline ){ + //iel.src = "/style/assets/no-signal.png"; + /* + iel.onerror = function(){ + //alert("IMG onerror!"); + iel.troubled = true; + }; + iel.decode() + .then(() => { + //document.body.appendChild(img); + }) + .catch((encodingError) => { + //alert('Stream Ended!'); + iel.troubled = true; + }) + */ + //}; + //}; + }; var tt = Ext.getCmp('status_'+data.nodes[i].id ); if( tt != undefined ){ switch( data.nodes[i].status ){ @@ -123,14 +404,87 @@ function fetchSiteStatus(){ break; }; case 2:{ + cleanupDraw( data.nodes[i].id ); + tt.update('
Initializing
'); + break; + }; + case 3:{ + cleanupDraw( data.nodes[i].id ); + tt.update('
Trouble
'); + break; + }; + case 4:{ DrawTargets( data.nodes[i].id, data.nodes[i].targets ); tt.update('
Alarm
'); break; }; + }; }; }; }; + if( data.notifications.length > 0 ){ + sndExcl.play(); + for( i=0; i < data.notifications.length; i++ ){ + /*const not = PNotify.alert({ + title: 'You Will Receive a Side', + text: 'You have no choice.', + icon: 'fas fa-info-circle', + hide: false, + closer: false, + sticker: false, + destroy: true, + modules: new Map([ + ...PNotify.defaultModules, + [PNotifyConfirm, { + confirm: true, + buttons: [{ + text: 'Ok', + primary: true, + click: notice => notice.close() + }] + }] + ]) + }); + */ + const l = PNotify.alert({ + type: data.notifications[i].type, + text: data.notifications[i].msg, + textTrusted: true, + stack: NotificationStack, + title: data.notifications[i].action, + hide: data.notifications[i].hide, + closer: data.notifications[i].hide, + sticker: data.notifications[i].hide, + destroy: true, + modules: (data.notifications[i].react )? new Map([ + ...PNotify.defaultModules, + [PNotifyConfirm, { + confirm: true, + buttons: [{ + text: 'Ok', + primary: true, + click: ( notice, value, evt ) => { + notice.close(); + if( notice.title!='' ){ + resolveDeviceMistmatch( notice.title ); + }; + } + }] + }] + ]): null + }); + /* + if( data.notifications[i].react ){ + l.on('click', (notice, value) => { + notice.close(); + resolveDeviceMistmatch( notice.title ); + }); + }; + */ + lastNotificationID = data.notifications[i].id; + }; + }; }, failure: failureAJAXFunction }); @@ -142,6 +496,7 @@ function loadDashBoard(){ tlInterval = null; timelineObj = null; }; + Ext.Ajax.request({ url: '/lib/controller/getDashBoardItems.php', params: { @@ -151,18 +506,257 @@ function loadDashBoard(){ }, success: function( response, opts ){ var data = Ext.decode(response.responseText); + Ext.getCmp('main_content').setTitle( 'GetLabel('_SYS_DASHBOARD_');?>' ); var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll(true); for( i=0; i < data.length; i++) tPanel.add( data[i] ); tPanel.doLayout(); + $('img[data-enlargeable]').addClass('img-enlargeable').click(function() { + var src = $(this).attr('src'); + var modal; + + function removeModal() { + modal.remove(); + $('body').off('keyup.modal-close'); + } + modal = $('
').css({ + background: 'RGBA(0,0,0,.5) url(' + src + ') no-repeat center', + backgroundSize: 'contain', + width: '100%', + height: '100%', + position: 'fixed', + zIndex: '10000', + top: '0', + left: '0', + cursor: 'zoom-out' + }).click(function() { + removeModal(); + }).appendTo('body'); + //handling ESC + $('body').on('keyup.modal-close', function(e) { + if (e.key === 'Escape') { + removeModal(); + } + }); + }); tlInterval = window.setInterval( fetchSiteStatus, 333, selectedSite ); }, - failure: function( response, opts ) { - var tPanel = Ext.getCmp('main_portal'); - tPanel.remove(0); - tPanel.add( { html: 'Failed to load dashboard!' } ); - tPanel.doLayout(); - } - }); + failure: failureAJAXFunction + }); +}; + +var serverToolBox = null; +function showServerToolBox( ServerNodeId ){ + if( serverToolBox == null ){ + serverToolBox = new Ext.Window({ + title: 'GetLabel('_SERV_CTLPANEL_SHRT_');?>', + modal: true, + width: 400, + height: 328, + closeAction: 'hide', + items:[{ + xtype: 'button', + text: 'Restart', + width: '100%', + textAlign: 'left', + iconCls: 'server_btn_restart', + scale: 'large', + iconAlign: 'left' + },{ + xtype: 'button', + text: 'Clear Site', + width: '100%', + textAlign: 'left', + iconCls: 'server_btn_restart', + scale: 'large', + iconAlign: 'left' + }] + }); + }; + serverToolBox.show(); +}; + +var detectionProfileWindow = null; +var deviceCtrlNode = ''; +function showDetectionProfile( NodeID ){ + deviceCtrlNode = NodeID + ':0'; +Data['access']>4 ) $ColSpan = 4; else $ColSpan = 3; ?> + if( detectionProfileWindow == null ){ + detectionProfileWindow = new Ext.Window({ + title: 'GetLabel('_DEV_CTLPANEL_SHRT_');?>', + modal: true, + width: , + height: 328, + closeAction: 'hide', + items:[] + }); + }; + Ext.Ajax.request({ + url: '/lib/controller/getDetectionProfile.php', + params: { + SITE: SelectedSite, + UID: , + SID: '', + NID: NodeID + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + detectionProfileWindow.setTitle( '['+data.name + '] GetLabel('_DEV_CTLPANEL_SHRT_');?>'); + detectionProfileWindow.removeAll( true ); + if( data.data_status == 3 ){ + detectionProfileWindow.add({ + xtype: 'panel', + layout: 'table', + layoutConfig: { + columns: + }, + items:[{ + xtype: 'spacer', + height: 30, + style: { + marginTop: '13px' + }, + html: '
GetLabel('_DET_SENSITIVITY_');?>
', + colspan: + },Data['access']>4 ){ + ?>{ + xtype: 'button', + text: 'Factory', + id: 'DDSPBTN0', + width: 80, + iconCls: 'detection_btn_factory', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + },{ + xtype: 'button', + text: 'Low', + id: 'DDSPBTN1', + width: 80, + iconCls: 'detection_btn_low', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + },{ + xtype: 'button', + text: 'Meduim', + id: 'DDSPBTN2', + width: 80, + iconCls: 'detection_btn_medium', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + },{ + xtype: 'button', + text: 'High', + id: 'DDSPBTN3', + width: 80, + iconCls: 'detection_btn_high', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + }] + }); + for( i=0; i < data.profiles.length; i++ ){ + Ext.getCmp('DDSPBTN'+data.profiles[i] ).enable(); + if( i == data.profile_id ) Ext.getCmp('DDSPBTN'+data.profiles[i] ).toggle(); + }; + } else if( data.data_status == 4 ){ + detectionProfileWindow.add({ + xtype: 'panel', + //layout: 'fit', + //layoutConfig: { + // columns: 3 + //}, + items:[{ + xtype: 'spacer', + height: 40, + //colspan: 3, + style: { + marginTop: '20px' + }, + html: '
GetLabel('_DET_SENSITIVITY_');?>
', + }Data['access']>4 ){ + ?>,{ + xtype: 'button', + text: 'Resolve Trouble', + width: '100%', + //colspan: 3, + iconCls: 'ctrl_panel_cog', + scale: 'large', + iconAlign: 'left', + handler: function(){ + detectionProfileWindow.hide(); + resolveDeviceMistmatch( deviceCtrlNode ); + } + }] + }); + }; + detectionProfileWindow.add({ + xtype: 'spacer', + height: 30, + style: { + marginTop: '13px' + }, + html: '
GetLabel('_DET_GENWORKS_');?>
', + }); + detectionProfileWindow.add({ + xtype: 'button', + width: '100%', + text: 'Clear Alarm', + scale: 'large', + iconCls: 'ctrl_panel_clean', + iconAlign: 'left' + }); + detectionProfileWindow.add({ + xtype: 'button', + width: '100%', + text: 'Draw Background', + scale: 'large', + iconCls: 'ctrl_panel_drawscan', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( deviceCtrlNode, 3 ); + } + }); + detectionProfileWindow.add({ + xtype: 'button', + width: '100%', + text: 'Force Study Background', + scale: 'large', + iconCls: 'ctrl_panel_study', + iconAlign: 'left' + }); + detectionProfileWindow.add({ + xtype: 'button', + width: '100%', + buttonAlign: 'left', + //text: '
Button 1
', + text: 'Force Reset Sensor', + scale: 'large', + iconCls: 'ctrl_panel_reset', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( deviceCtrlNode, 1 ); + } + }); + detectionProfileWindow.show(); + }, + failure: failureAJAXFunction + }); }; diff --git a/lib/javascript/jsapi_dynamic/rgoose_devices_module.js b/lib/javascript/jsapi_dynamic/rgoose_devices_module.js index 3f7bb6e..2b04f48 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_devices_module.js +++ b/lib/javascript/jsapi_dynamic/rgoose_devices_module.js @@ -39,6 +39,23 @@ var LRF1D2_st_win = null; var LRF2D2_st_win = null; var LRF16D3_st_win = null; + +function doDeviceOperation( NodeID, OpCode ){ + Ext.Ajax.request({ + url: '/lib/controller/doDeviceOperation.php', + params: { + NID: NodeID, + UID: 'Data['id'];?>', + CMD: OpCode, + SID: '' + }, + success: function( response, opts ){ + + }, + failure: failureAJAXFunction + }); +}; + function loadFullLRF1D2Data( NodeID ){ if( LRF1D2_st_win == null ) return; @@ -479,3 +496,357 @@ function LRF2D2_settings(){ function LRF16D3_settings(){ }; +var currentResolveDeviceNode = 0; +var ResolveDeviceNodeWin = null; + +function resolveDeviceMistmatch( NodeID ){ + currentResolveDeviceNode = NodeID; + if( ResolveDeviceNodeWin == null ){ + ResolveDeviceNodeWin = new Ext.Window({ + title: 'GetLabel('_WDEV_MISTMATCH_');?>', + modal: true, + width: 500, + height: 200, + closeAction: 'hide', + items:[{ + xtype: 'spacer', + style: { + marginTop: '13px' + }, + html: '
GetLabel('_DEV_MISTMATT1_');?>
', + height: 30 + },{ + xtype: 'button', + width: '100%', + text: 'Apply Existing Detection Profiles to Newly Connected Device', + handler: function(){ + Ext.Ajax.request({ + url: '/lib/controller/validateNode.php', + params: { + NID: currentResolveDeviceNode, + UID: 'Data['id'];?>', + SID: '', + MET: 1 + }, + success: function( response, opts ){ + ResolveDeviceNodeWin.hide(); + }, + failure: failureAJAXFunction + }); + } + },{ + xtype: 'button', + width: '100%', + text: 'Discard old Detection Profiles and Start Device Setup Wizard', + handler: function(){ + ResolveDeviceNodeWin.hide(); + startDeviceDetectionWizard( currentResolveDeviceNode ); + } + },{ + xtype: 'button', + width: '100%', + text: 'Discard old Detection Profiles and Load Factory Settings from Device' + },{ + xtype: 'button', + width: '100%', + text: 'Discard this Connection for NOW' + }] + }); + }; + ResolveDeviceNodeWin.show(); +}; + +var DeviceDetectionWizardWnd = null; +var DDWizardActiveDevice = ''; +var RangeSetBlocker = false; +function startDeviceDetectionWizard( NodeID ){ + DDWizardActiveDevice = NodeID + if( DeviceDetectionWizardWnd == null ){ + DeviceDetectionWizardWnd = new Ext.Window({ + title: 'GetLabel('_WDEV_DET_WIZT_');?>', + modal: true, + width: 500, + height: 208, + closeAction: 'hide', + items:[{ + xtype: 'tabpanel', + activeTab: 1, + items: [{ + title: 'GetLabel('_WDEV_DET_WIZ0_');?>', + frame: false, + xtype: 'form', + items:[{ + xtype: 'spacer', + height: 20 + },{ + xtype: 'combo', + id: 'DDWizST', + fieldLabel: 'GetLabel('_DEV_TYPE_FLD_');?>', + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'dtId', + 'dtText' + ], + data: [ + [1, 'GetLabel('_DEV_TYPE_ALS_');?>'], + [2, 'GetLabel('_DEV_TYPE_LFS_');?>'], + [3, 'GetLabel('_DEV_TYPE_PLS200_');?>'], + [4, 'GetLabel('_DEV_TYPE_PLS360_');?>'], + [5, 'GetLabel('_DEV_TYPE_3D_');?>'], + [6, 'GetLabel('_DEV_TYPE_NPLS200_');?>'] + ] + }), + valueField: 'dtId', + displayField: 'dtText' + },{ + xtype: 'numberfield', + id: 'DDWizSR', + fieldLabel: 'GetLabel('_DEV_RANGE_FLD_');?>', + minValue: 15.0, + maxValue: 300.0, + listeners:{ + change: function( m, nv, ov ){ + if( RangeSetBlocker ) return; + RangeSetBlocker = true; + Ext.getCmp('DDWizSRS').setValue( nv ); + RangeSetBlocker = false; + } + } + },{ + xtype: 'slider', + id: 'DDWizSRS', + fieldLabel: 'GetLabel('_DEV_RANGE_FLD_');?>', + minValue: 15.0, + maxValue: 300.0, + listeners:{ + change: function( m, nv, ov ){ + if( RangeSetBlocker ) return; + RangeSetBlocker = true; + Ext.getCmp('DDWizSR').setValue( nv ); + RangeSetBlocker = false; + } + } + },{ + xtype: 'spacer', + height: 10 + }] + },{ + title: 'GetLabel('_WDEV_DET_WIZ1_');?>', + frame: false, + xtype: 'form', + labelWidth: 120, + items:[{ + xtype: 'spacer', + height: 20 + },{ + xtype: 'combo', + id: 'DDWizIT', + fieldLabel: 'GetLabel('_DEV_ITYPE_FLD_');?>', + typeAhead: true, + triggerAction: 'all', + lazyRender:true, + mode: 'local', + value: 1, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'dpId', + 'dpText' + ], + data: [ + [1, 'GetLabel('_DEV_PL_HORI_');?>'], + [2, 'GetLabel('_DEV_PL_VERT_');?>'], + [3, 'GetLabel('_DEV_PL_ANG_');?>'] + ] + }), + valueField: 'dpId', + displayField: 'dpText' + }] + },{ + title: 'GetLabel('_WDEV_DET_WIZ2_');?>', + html: 'Another one' + },{ + title: 'GetLabel('_WDEV_DET_WIZ3_');?>', + html: 'Another one' + }] + }], + bbar:[{ + text: 'Create Profiles And Finish', + handler: function(){ + DeviceDetectionWizardWnd.hide(); + } + },{ + text: 'Advanced Config', + handler: function(){ + DeviceDetectionWizardWnd.hide(); + startAdvancedDeviceDetection( DDWizardActiveDevice ); + } + }] + }); + }; + Ext.Ajax.request({ + url: '/lib/controller/getNodeBasicNfo.php', + params: { + NID: DDWizardActiveDevice, + UID: 'Data['id'];?>', + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + DeviceDetectionWizardWnd.setTitle( 'GetLabel('_WDEV_DET_WIZT_');?> [' + data.name+']' ); + Ext.getCmp('DDWizST').setValue( data.type ); + RangeSetBlocker = true; + Ext.getCmp('DDWizSR').setValue( data.range ); + Ext.getCmp('DDWizSRS').setValue( data.range ); + RangeSetBlocker = false; + DeviceDetectionWizardWnd.show(); + }, + failure: failureAJAXFunction + }); +}; + +var DeviceDetectionAdvancedWnd = null; +var DeviceDetectionProfileNames = ['factory default', 'low sens', 'medium sens', 'high sens']; +function loadAdvancedDeviceDetectionSettings(){ + Ext.getCmp('ADD_TP').removeAll( false ); + Ext.Ajax.request({ + url: '/lib/controller/getNodeAdvancedNfo.php', + params: { + NID: DDWizardActiveDevice, + UID: 'Data['id'];?>', + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + DeviceDetectionAdvancedWnd.setTitle( 'GetLabel('_WDEV_DET_WIZT_');?> [' + data.name+']' ); + if( data.profiles.length > 0 ){ + if( data.profiles.length > 3 ) Ext.getCmp('ADD_PADD_BTN').disable(); + switch( data.type ){ + case 1: + case 5:{ + for( i = 0; i < data.profiles.length / 2; i++){ + }; + break; + }; + case 2: + case 3: + case 4: + case 6:{ + for( i = 0; i < data.profiles.length; i++){ + Ext.getCmp('ADD_TP').add({ + title: DeviceDetectionProfileNames[ data.profiles[i].id ], + xtype: 'form', + frame: false, + items:[{xtype: 'spacer', height: 10 },{ + xtype: 'numberfield', + id: 'OFFSET_P'+data.profiles[i].id, + fieldLabel: 'OFFSET', + minValue: 15.0, + maxValue: 300.0, + value: data.profiles[i].offset + },{ + xtype: 'numberfield', + id: 'DELTA_P'+data.profiles[i].id, + fieldLabel: 'DELTA', + minValue: 15.0, + maxValue: 300.0, + value: data.profiles[i].delta + },{ + xtype: 'numberfield', + id: 'WIDTH_P'+data.profiles[i].id, + fieldLabel: 'WIDTH', + minValue: 15.0, + maxValue: 300.0, + value: data.profiles[i].width + },{ + xtype: 'numberfield', + id: 'SST_P'+data.profiles[i].id, + fieldLabel: 'SST', + minValue: 15.0, + maxValue: 300.0, + value: data.profiles[i].sst + },{ + xtype: 'numberfield', + id: 'FLIP_P'+data.profiles[i].id, + fieldLabel: 'FLIP', + minValue: 15.0, + maxValue: 300.0, + value: data.profiles[i].flip + },{ + xtype: 'numberfield', + id: 'SUN_P'+data.profiles[i].id, + fieldLabel: 'SUN', + minValue: 15.0, + maxValue: 300.0, + value: data.profiles[i].sun + }] + }); + }; + break; + }; + }; + // + } else { + Ext.getCmp('ADD_TP').add({ + title: 'Error!', + html: 'No Profiles Defined' + }); + }; + DeviceDetectionAdvancedWnd.show(); + }, + failure: failureAJAXFunction + }); +}; + +function startAdvancedDeviceDetection( NodeID ){ + DDWizardActiveDevice = NodeID; + if( DeviceDetectionAdvancedWnd == null ){ + DeviceDetectionAdvancedWnd = new Ext.Window({ + title: 'GetLabel('_WDEV_DET_WIZT_');?>', + modal: true, + width: 500, + height: 300, + closeAction: 'hide', + items:[{ + xtype: 'tabpanel', + id: 'ADD_TP', + frame: false, + border: false, + activeTab: 0, + items: [] + }], + bbar:[{ + id: 'ADD_PADD_BTN', + text: 'Add Detection Profile', + handler: function(){ + Ext.Ajax.request({ + url: '/lib/controller/addDetectionProfile.php', + params: { + NID: DDWizardActiveDevice, + UID: 'Data['id'];?>', + SID: '' + }, + success: function( response, opts ){ + loadAdvancedDeviceDetectionSettings(); + }, + failure: failureAJAXFunction + }); + } + },{ + text: 'Apply And Finish' + },{ + text: 'Use Wizard' + }] + }); + }; + loadAdvancedDeviceDetectionSettings(); +}; + + + + diff --git a/lib/javascript/jsapi_dynamic/rgoose_logs.js b/lib/javascript/jsapi_dynamic/rgoose_logs.js index 77735c2..ebde7e0 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_logs.js +++ b/lib/javascript/jsapi_dynamic/rgoose_logs.js @@ -10,6 +10,9 @@ var um_server_log_store = new Ext.data.JsonStore({ fields: [{ name: 'id', type: 'int' + },{ + name: 'type', + type: 'string' },{ name: 'ts', type: 'string' @@ -36,7 +39,7 @@ var um_server_log_store = new Ext.data.JsonStore({ var um_server_log_col_model_opt = { columns: [ - {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "GetLabel("_ID_");?>", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, {header: "GetLabel("_DATETIME_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, {header: "GetLabel("_POINTER_");?>", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'ptr' }, {header: "GetLabel("_MODULE_");?>", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'module' }, @@ -95,6 +98,7 @@ var um_access_log_store = new Ext.data.JsonStore({ function um_action_renderer( val ){ switch( val ){ case 1: return 'login'; + case 13: return 'Access Denied'; case 145: return 'resize screen'; }; return 'unknown action'; @@ -102,7 +106,7 @@ function um_action_renderer( val ){ var um_access_log_col_model_opt = { columns: [ - {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "GetLabel("_ID_");?>", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, {header: "GetLabel("_USER_");?>",width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'user' }, {header: "GetLabel("_DATETIME_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, {header: "GetLabel("_ACTION_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', renderer: um_action_renderer, dataIndex: 'cmd' }, @@ -131,7 +135,7 @@ function loadAccessLog(){ }; var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll( true ); - Ext.getCmp('main_content').setTitle( 'GetLabel("_ACCESS_LOG_");?>' ); + Ext.getCmp('main_content').setTitle( 'GetLabel("_ACC_LOG_");?>' ); tPanel.add({ columnWidth: 1.0, frame: false, @@ -153,7 +157,17 @@ function loadAccessLog(){ xtype: 'grid', forceFit: true, viewConfig: { - forceFit: true + forceFit: true, + getRowClass: function( record, rowIndex, rowParams, store){ + switch( record.get('cmd') ){ + case 1: return 'row-level01'; + case 2: return 'row-level02'; + case 3: return 'row-level03'; + case 4: return 'row-level04'; + case 145: return 'row-level05'; + }; + return ''; + } }, ds: um_access_log_store, cm: new Ext.grid.ColumnModel( um_access_log_col_model_opt ), @@ -181,7 +195,7 @@ function loadServerLog(){ }; var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll( true ); - Ext.getCmp('main_content').setTitle( 'GetLabel("_SERVER_LOG_");?>' ); + Ext.getCmp('main_content').setTitle( 'GetLabel("_SERV_LOG_");?>' ); tPanel.add({ columnWidth: 1.0, frame: false, @@ -203,7 +217,17 @@ function loadServerLog(){ xtype: 'grid', forceFit: true, viewConfig: { - forceFit: true + forceFit: true, + getRowClass: function( record, rowIndex, rowParams, store){ + switch( record.get('type') ){ + case '01': return 'row-level01'; + case '02': return 'row-level02'; + case '03': return 'row-level03'; + case '04': return 'row-level04'; + case '05': return 'row-level05'; + }; + return ''; + } }, ds: um_server_log_store, cm: new Ext.grid.ColumnModel( um_server_log_col_model_opt ), diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index cfe43e2..62cde60 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -1,29 +1,81 @@ // -var winW = Data['width'];?>; -var winH = Data['height'];?>; - +var winW = Data['width']);?>; +var winH = Data['height']);?>; var PanelH = winH-90; +var SelectedSite = ; +var SettingsLidar3D = null; +var SelectedNodeID = 0; +var ServerPID = -1; +var SoundEnable = Data['sound_enable']);?>; + +var sndBeep = new Howl({ + src: [ + '/style/assets/audio/beep-07a.mp3', + '/style/assets/audio/beep-07a.wav' + ], + loop: false, + volume: 0.99, + onend: function() { + console.log('Finished!'); + } +}); +var sndExcl = new Howl({ + src: [ + '/style/assets/audio/button-42.mp3', + '/style/assets/audio/button-42.wav' + ], + loop: false, + volume: 0.99 +}); + +function playSound( t ){ + if( SoundEnable ){ + switch( t ){ + case 1:{ + sndBeep.play(); + break; + }; + default:{ + sndExcl.play(); + }; + }; + }; +}; -function Refresh(){ +function doRefresh(){ window.location="/?t="+123; }; +function doLogout(){ + //window.location = '/login.php?UID=1'; +}; +//https://www.javascripttutorial.net/web-apis/javascript-notification/ +//https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web + + function failureAJAXFunction( responce, opts ){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + //timelineObj = null; + }; + playSound(); Ext.Msg.show({ - title:'Request Failure!', - msg: 'Ajax Request failed!', + title:'GetLabel('_REQ_FAILURE_');?>', + msg: 'GetLabel('_AJX_REQFAILURE_');?>', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); + doLogout(); }; function updateUserScreenResolution( x, y ){ Ext.Ajax.request({ url: '/lib/controller/updateUserSettings.php', params: { - SAID: , + SAID: SelectedSite, UID: , SID: '', SSS: 15, @@ -31,42 +83,54 @@ function updateUserScreenResolution( x, y ){ HEI: y }, success: function( response, opts ){ - Refresh(); + doRefresh(); }, failure: failureAJAXFunction }); }; -function CheckWindowSize(delay){ +function removeAllFromSite(){ + Ext.Ajax.request({ + url: '/lib/controller/resetAllSettings.php', + params: { + SAID: SelectedSite, + UID: , + SID: '' + }, + success: function( response, opts ){ + doRefresh(); + }, + failure: failureAJAXFunction + }); +}; + +function doCheckWindowSize(){ if (parseInt(navigator.appVersion)>3) { - if (navigator.appName=="Netscape") { + if (navigator.appName=="Netscape") { winW2 = window.innerWidth; winH2 = window.innerHeight; - if ( winH2<700 ) winH2=700; - }; - if (navigator.appName.indexOf("Microsoft")!=-1) { + if ( winH2<700 ) winH2=700; + }; + if (navigator.appName.indexOf("Microsoft")!=-1) { winW2 = document.body.offsetWidth; winH2 = document.body.offsetHeight; - if ( winH2<700 ) winH2=700; - }; + if ( winH2<700 ) winH2=700; + }; }; - - //alert(winW2+':'+winW+' '+winH2+':'+winH); - if ( winW2 != winW || winH2!=winH ){ - updateUserScreenResolution( winW2, winH2 ); + updateUserScreenResolution( winW2, winH2 ); }; }; -Ext.onReady(function(){ - //Check Screen Size - //alert( winW + 'x' + winH ); - CheckWindowSize(); +var NotificationStack = null; +Ext.onReady(function(){ + doCheckWindowSize(); + NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25}); + //window.onresize = doCheckWindowSize; Ext.QuickTips.init(); - var viewport = new Ext.Viewport({ id: 'main_viewport', layout:'border', @@ -77,16 +141,16 @@ Ext.onReady(function(){ height: 50, items:[{ xtype: 'panel', - id:'top', + id:'top', baseCls: 'x-plain', - html: '

 R-Goose Security System

' + html: '

 GetLabel('_APP_TITLE_');?>

' }] },{ xtype: 'panel', id:'btns', region:'west', bsaseCls:'x-plain', - title: 'R-Goose System', + title: 'GetLabel('_SEC_SYSTEM_');?>', collapsible: true, split:true, width:150, @@ -99,7 +163,7 @@ Ext.onReady(function(){ animate:true }, items: [{ - title: 'Dashboard', + title: 'GetLabel('_DASHBOARD_');?>', layout: 'vbox', height: 120, pack: 'center', @@ -108,7 +172,7 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'go_home', - text: 'Go Home', + text: 'GetLabel('_GO_HOME_');?>', handler: function( b, e ){ loadDashBoard(); } @@ -116,7 +180,7 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'go_monitor', - text: 'Monitor Events', + text: 'GetLabel('_EVT_MONITOR_');?>', handler: function( b, e ){ loadTimeLine(); } @@ -124,13 +188,11 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'go_out', - text: 'Logout', - handler: function( b, e ){ - window.location = '/login.php?UID=1'; - } + text: 'GetLabel('_LOGOUT_');?>', + handler: doLogout }] },{ - title: 'System Settings', + title: 'GetLabel('_SYS_SETTINGS_');?>', layout: 'vbox', height: 120, pack: 'center', @@ -139,7 +201,7 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'sys_edit', - text: 'Edit Connections', + text: 'GetLabel('_EDT_CONNECTIONS_');?>', handler: function( b, e ){ loadSystemEditor(); } @@ -147,7 +209,7 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'map_edit', - text: 'Edit Locations', + text: 'GetLabel('_EDT_LOCATIONS_');?>', handler: function( b, e ){ loadLocationEditor(); } @@ -155,19 +217,17 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'logout', - text: 'Logout', - handler: function( b, e ){ - window.location = '/login.php?UID=1'; - } + text: 'GetLabel('_CLEAR_SITE_');?>', + handler: removeAllFromSite }] },{ - title: 'Profile Settings', + title: 'GetLabel('_PROF_SETTINGS_');?>', html: '

Panel content!

' } Data['access'] > 5 ){ ?>,{ - title: 'Admin Settings', + title: 'GetLabel('_ADM_SETTINGS_');?>', items:[{ xtype: 'button', width: '100%', @@ -180,7 +240,7 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'adm_acclog', - text: 'Access Log', + text: 'GetLabel('_ACC_LOG_');?>', handler: function( b, e ){ loadAccessLog(); } @@ -188,7 +248,7 @@ Ext.onReady(function(){ xtype: 'button', width: '100%', id:'adm_servlog', - text: 'Server Log', + text: 'GetLabel('_SERV_LOG_');?>', handler: function( b, e ){ loadServerLog(); } @@ -203,7 +263,7 @@ Ext.onReady(function(){ region:'center', margins: '5 5 5 0', id: 'main_content', - title: 'System Dashboard', + title: 'GetLabel('_SYS_DASHBOARD_');?>', items:[{ xtype: 'portal', id: 'main_portal', @@ -214,7 +274,7 @@ Ext.onReady(function(){ }, listeners:{ drop: function( a ){ - updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position ); + updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position ); } } }] diff --git a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js index e9255e5..dc95383 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js @@ -1,9 +1,42 @@ // -var selectedSite = ; -var SettingsLidar3D = null; -var SelectedNodeID = 0; + +var resourceInfoWindow = null; + +function showResourceInfo( rid ){ + Ext.Ajax.request({ + url: '/lib/controller/getResourceInfo.php', + params: { + RID: rid, + UID: , + SID: '', + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( resourceInfoWindow == null ){ + resourceInfoWindow = new Ext.Window({ + title: 'Resource Info', + modal: true, + width: 800, + height: 400, + layout: 'fit', + closeAction: 'hide', + items: [], + buttons:[{ + text: `close` + }] + }); + }; + resourceInfoWindow.removeAll( true ); + resourceInfoWindow.add( data ); + resourceInfoWindow.show(); + }, + failure: failureAJAXFunction + }); +}; + function loadSettingsLidar3D( NodeID, Master ){ SelectedNodeID = NodeID; Ext.Ajax.request({ @@ -197,7 +230,7 @@ function reloadNetworkData(){ Ext.Ajax.request({ url: '/lib/controller/getNetwork.php', params: { - NID: , + NID: SelectedSite,//, UID: , SID: '', }, @@ -413,12 +446,12 @@ function module_prop_FlyHunter( module_id ){ id: 0, fields: ['myId', 'displayText' ], data: [ Query( $QS ); if( count( $RR ) ){ $RE=array(); foreach( $RR as $R ){ - $RE[] = "[ {$R['id']}, '{$R['name']}']"; + $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; }; echo implode( ',', $RE ); } else { @@ -493,7 +526,7 @@ function loadSystemEditor(){ }; var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll( true ); - Ext.getCmp('main_content').setTitle( 'System Map' ); + Ext.getCmp('main_content').setTitle( 'GetLabel('_SYS_MAP_');?>' ); tPanel.add({ columnWidth: 0.83, frame: false, @@ -516,7 +549,7 @@ function loadSystemEditor(){ }, tbar: [{ xtype: 'splitbutton', - text: 'Add Laser Sensor', + text: 'GetLabel('_SMM_ADD_LSEN_');?>', split: true, enableToggle : undefined, menu : { @@ -554,28 +587,34 @@ function loadSystemEditor(){ } },{ xtype: 'splitbutton', - text: 'Add Additional Equipment', + text: 'GetLabel('_SMM_ADD_ADDIT_');?>', split: true, enableToggle : true, menu : { items: [{ text:'Static Analog Camera', - icon: '/style/assets/11_node.png' + icon: '/style/assets/11_node.png', + handler: function(){ + SelectedCamTYPE = 10; + } },{ text:'PTZ Analog Camera', - icon: '/style/assets/12_node.png' + icon: '/style/assets/12_node.png', + handler: function(){ + SelectedCamTYPE = 11; + } },{ text:'Static IP Camera', icon: '/style/assets/11_node.png', handler: function(){ - SelectedCamPTZ = false; + SelectedCamTYPE = 12; addIpCam(); } },{ text:'PTZ IP Camera', icon: '/style/assets/12_node.png', handler: function(){ - SelectedCamPTZ = true; + SelectedCamTYPE = 13; addIpCam(); } },{ @@ -598,10 +637,10 @@ function loadSystemEditor(){ icon: '/style/assets/adam-1.png', }] } - },{ + },/*{ xtype: 'button', id: 'connectstarterbutton', - text: 'Add Connection', + text: 'GetLabel('_ADD_CONNECTION_');?>', enableToggle : undefined, handler: function(){ if( InConnectEditMode ){ @@ -614,7 +653,7 @@ function loadSystemEditor(){ startCreateConnection(); }; } - },{ + }, */ { xtype: 'button', id: 'deletecomponentbutton', text: 'Remove Component', @@ -632,7 +671,7 @@ function loadSystemEditor(){ }] }); tPanel.add({ - title: 'Properties', + title: 'GetLabel('_PROPERTIES_');?>', xtype: 'panel', flex: 1, height: 700, @@ -650,7 +689,7 @@ function loadSystemEditor(){ Ext.Ajax.request({ url: '/lib/controller/getNetwork.php', params: { - NID: selectedSite, + NID: SelectedSite, UID: , SID: '' }, diff --git a/lib/javascript/jsapi_dynamic/rgoose_timeline.js b/lib/javascript/jsapi_dynamic/rgoose_timeline.js index ec68ffe..454e7b4 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_timeline.js +++ b/lib/javascript/jsapi_dynamic/rgoose_timeline.js @@ -139,9 +139,9 @@ function loadTimeLineGroups( NID ){ Ext.Ajax.request({ url: '/lib/controller/getTimeLineGroups.php', params: { - NID: NID, + NID: NID, UID: , - SID: '' + SID: '' }, success: function( response, opts ){ // If the response is JSON, you have to decode it @@ -149,9 +149,9 @@ function loadTimeLineGroups( NID ){ //for(var i = 0; i < data.length; i++) { //tlGroups.add(data[i]); //}; - tlGroups.update( data ); - loadTimeLineItems( selectedSite ); - tlInterval = window.setInterval( loadTimeLineItems, 333, selectedSite ); + tlGroups.update( data ); + loadTimeLineItems( SelectedSite ); + tlInterval = window.setInterval( loadTimeLineItems, 333, SelectedSite ); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!'); @@ -207,8 +207,8 @@ function loadMapZones( SID ){ }; //tlGroups.update( data ); //loadTimeLineItems( selectedSite ); - LoadMapEvents( selectedSite ); - tlInterval = window.setInterval( LoadMapEvents, 333, selectedSite ); + LoadMapEvents( SelectedSite ); + tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite ); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!'); @@ -222,10 +222,10 @@ function loadTimeLineItems( NID ){ Ext.Ajax.request({ url: '/lib/controller/getTimeLineEvents.php', params: { - NID: NID, + NID: NID, UID: , - SID: '', - LTS: tlLastTS + SID: '', + LTS: tlLastTS }, success: function( response, opts ){ // If the response is JSON, you have to decode it @@ -326,18 +326,18 @@ function loadEventProperties( EventID ){ Ext.Ajax.request({ url: '/lib/controller/getEventProps.php', params: { - NID: , + NID: , UID: , - SID: '', - EVENT: EventID + SID: '', + EVENT: EventID }, success: function( response, opts ){ // If the response is JSON, you have to decode it var data = Ext.decode(response.responseText); - var tPanel = Ext.getCmp('prop_content'); - tPanel.remove(0); - tPanel.add( data ); - tPanel.doLayout(); + var tPanel = Ext.getCmp('prop_content'); + tPanel.remove(0); + tPanel.add( data ); + tPanel.doLayout(); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!'); @@ -545,7 +545,7 @@ function loadTimeLine(){ maxZoom: 24, }).addTo(map); */ //loadTimeLineGroups( selectedSite ); - loadMapZones( selectedSite ); + loadMapZones( SelectedSite ); eventsListStore.load({params:{start:0, limit:50}}); }; diff --git a/style/images/layers-2x.png b/lib/javascript/leaflet/images/layers-2x.png similarity index 100% rename from style/images/layers-2x.png rename to lib/javascript/leaflet/images/layers-2x.png diff --git a/style/images/layers.png b/lib/javascript/leaflet/images/layers.png similarity index 100% rename from style/images/layers.png rename to lib/javascript/leaflet/images/layers.png diff --git a/style/images/marker-icon-2x.png b/lib/javascript/leaflet/images/marker-icon-2x.png similarity index 100% rename from style/images/marker-icon-2x.png rename to lib/javascript/leaflet/images/marker-icon-2x.png diff --git a/style/images/marker-icon.png b/lib/javascript/leaflet/images/marker-icon.png similarity index 100% rename from style/images/marker-icon.png rename to lib/javascript/leaflet/images/marker-icon.png diff --git a/style/images/marker-shadow.png b/lib/javascript/leaflet/images/marker-shadow.png similarity index 100% rename from style/images/marker-shadow.png rename to lib/javascript/leaflet/images/marker-shadow.png diff --git a/lib/javascript/pnotyfy/Angeler.css b/lib/javascript/pnotyfy/Angeler.css new file mode 100644 index 0000000..51640a4 --- /dev/null +++ b/lib/javascript/pnotyfy/Angeler.css @@ -0,0 +1,13 @@ +[data-pnotify].angeler-elem{border-radius:0;--ui-feature-color: #555}[data-pnotify].angeler-elem,[data-pnotify].angeler-elem.pnotify-mode-light{--notice-background-color: #a95aa1;--notice-border-color: #fff;--notice-text-color: #fff;--notice-text-border-color: #eee;--notice-icon-filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(240deg) + brightness(105%) contrast(101%);--info-background-color: #85c0f9;--info-border-color: #fff;--info-text-color: #fff;--info-text-border-color: #eee;--info-icon-filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(240deg) + brightness(105%) contrast(101%);--success-background-color: #0f2080;--success-border-color: #fff;--success-text-color: #fff;--success-text-border-color: #eee;--success-icon-filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(240deg) + brightness(105%) contrast(101%);--error-background-color: #f5793a;--error-border-color: #fff;--error-text-color: #fff;--error-text-border-color: #eee;--error-icon-filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(240deg) + brightness(105%) contrast(101%);--angeler-border-width: 0}@media(prefers-color-scheme:dark){[data-pnotify].angeler-elem.pnotify-mode-no-preference{--notice-background-color: #000;--notice-border-color: #a95aa1;--notice-text-color: #fff;--notice-text-border-color: #4c4c4c;--notice-icon-filter: invert(47%) sepia(19%) saturate(1430%) + hue-rotate(255deg) brightness(87%) contrast(85%);--info-background-color: #000;--info-border-color: #85c0f9;--info-text-color: #fff;--info-text-border-color: #4c4c4c;--info-icon-filter: invert(69%) sepia(15%) saturate(1110%) + hue-rotate(172deg) brightness(102%) contrast(95%);--success-background-color: #000;--success-border-color: #0f2080;--success-text-color: #fff;--success-text-border-color: #4c4c4c;--success-icon-filter: invert(9%) sepia(80%) saturate(3478%) + hue-rotate(231deg) brightness(105%) contrast(105%);--error-background-color: #000;--error-border-color: #f5793a;--error-text-color: #fff;--error-text-border-color: #4c4c4c;--error-icon-filter: invert(62%) sepia(63%) saturate(3591%) + hue-rotate(338deg) brightness(105%) contrast(92%);--angeler-border-width: 1px}}[data-pnotify].angeler-elem.pnotify-mode-dark{--notice-background-color: #000;--notice-border-color: #a95aa1;--notice-text-color: #fff;--notice-text-border-color: #4c4c4c;--notice-icon-filter: invert(47%) sepia(19%) saturate(1430%) + hue-rotate(255deg) brightness(87%) contrast(85%);--info-background-color: #000;--info-border-color: #85c0f9;--info-text-color: #fff;--info-text-border-color: #4c4c4c;--info-icon-filter: invert(69%) sepia(15%) saturate(1110%) hue-rotate(172deg) + brightness(102%) contrast(95%);--success-background-color: #000;--success-border-color: #0f2080;--success-text-color: #fff;--success-text-border-color: #4c4c4c;--success-icon-filter: invert(9%) sepia(80%) saturate(3478%) + hue-rotate(231deg) brightness(105%) contrast(105%);--error-background-color: #000;--error-border-color: #f5793a;--error-text-color: #fff;--error-text-border-color: #4c4c4c;--error-icon-filter: invert(62%) sepia(63%) saturate(3591%) hue-rotate(338deg) + brightness(105%) contrast(92%);--angeler-border-width: 1px}[data-pnotify] .angeler-notice{--angeler-background-color: var(--notice-background-color);--angeler-border-color: var(--notice-border-color);--angeler-text-color: var(--notice-text-color);--angeler-text-border-color: var(--notice-text-border-color);--angeler-icon-filter: var(--notice-icon-filter);--angeler-icon-container-filter: var(--notice-icon-container-filter);--angeler-primary-button-background-color: var(--notice-text-color);--angeler-primary-button-text-color: var(--notice-background-color)}[data-pnotify] .angeler-info{--angeler-background-color: var(--info-background-color);--angeler-border-color: var(--info-border-color);--angeler-text-color: var(--info-text-color);--angeler-text-border-color: var(--info-text-border-color);--angeler-icon-filter: var(--info-icon-filter);--angeler-icon-container-filter: var(--info-icon-container-filter);--angeler-primary-button-background-color: var(--info-text-color);--angeler-primary-button-text-color: var(--info-background-color)}[data-pnotify] .angeler-success{--angeler-background-color: var(--success-background-color);--angeler-border-color: var(--success-border-color);--angeler-text-color: var(--success-text-color);--angeler-text-border-color: var(--success-text-border-color);--angeler-icon-filter: var(--success-icon-filter);--angeler-icon-container-filter: var(--success-icon-container-filter);--angeler-primary-button-background-color: var(--success-text-color);--angeler-primary-button-text-color: var(--success-background-color)}[data-pnotify] .angeler-error{--angeler-background-color: var(--error-background-color);--angeler-border-color: var(--error-border-color);--angeler-text-color: var(--error-text-color);--angeler-text-border-color: var(--error-text-border-color);--angeler-icon-filter: var(--error-icon-filter);--angeler-icon-container-filter: var(--error-icon-container-filter);--angeler-primary-button-background-color: var(--error-text-color);--angeler-primary-button-text-color: var(--error-background-color)}[data-pnotify] .angeler-container{padding:1rem;border-radius:4px;background-color:var(--angeler-background-color);border:var(--angeler-border-width) solid var(--angeler-border-color);color:var(--angeler-text-color)}[data-pnotify] .angeler-content{margin-top:.5rem}[data-pnotify].pnotify-with-icon .angeler-content{margin-left:0;margin-right:0}[data-pnotify] .angeler-title{font-size:1rem;line-height:1.2rem;font-style:italic;font-weight:500;margin-bottom:0}[data-pnotify] .angeler-text{display:inline-block;font-size:1rem;line-height:1.2rem;margin-top:0}[data-pnotify] .angeler-title+.angeler-text{margin-top:.75rem;border-top:2px solid rgba(255,255,255,.2);padding-top:1rem;min-width:100%}[data-pnotify] .angeler-icon,[data-pnotify] .angeler-closer,[data-pnotify] .angeler-sticker{display:flex;justify-content:center;align-items:center}[data-pnotify] .angeler-icon{float:left;margin-right:1rem}[data-pnotify] .angeler-closer{position:absolute;right:-1rem;top:-1rem;background-color:var(--ui-feature-color);border-radius:50%}[data-pnotify] .angeler-sticker{position:absolute;right:.75rem;top:.75rem;transform:rotate(30deg) scale(.8)}[dir=rtl] [data-pnotify] .angeler-closer,[dir=rtl] [data-pnotify] .angeler-sticker{left:-1rem;right:auto}[dir=rtl] [data-pnotify] .angeler-closer+.angeler-sticker{left:1.5rem}[data-pnotify] .angeler-sticker{background:#000;background:radial-gradient( circle,rgba(0,0,0,0.15) 0%,rgba(0,0,0,0) 60% )}[data-pnotify] .angeler-closer,[data-pnotify] .angeler-sticker,[data-pnotify] .angeler-icon,[data-pnotify] .angeler-icon>span,[data-pnotify] .angeler-icon>span:after{width:2rem;height:2rem;line-height:2rem}[data-pnotify] .angeler-icon-closer,[data-pnotify] .angeler-icon-sticker,[data-pnotify] .angeler-icon-closer:after,[data-pnotify] .angeler-icon-sticker:after{width:1.5rem;height:1.5rem;line-height:1.5rem}[data-pnotify].angeler-extended .angeler-icon{float:none;margin-bottom:1.25rem;margin-right:0}[data-pnotify].angeler-extended .angeler-content{margin-top:0}[data-pnotify] .angeler-icon-notice:after{filter:var(--angeler-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTQuNDcgMjFoMTUuMDZjMS41NCAwIDIuNS0xLjY3IDEuNzMtM0wxMy43MyA0Ljk5Yy0uNzctMS4zMy0yLjY5LTEuMzMtMy40NiAwTDIuNzQgMThjLS43NyAxLjMzLjE5IDMgMS43MyAzek0xMiAxNGMtLjU1IDAtMS0uNDUtMS0xdi0yYzAtLjU1LjQ1LTEgMS0xczEgLjQ1IDEgMXYyYzAgLjU1LS40NSAxLTEgMXptMSA0aC0ydi0yaDJ2MnoiLz48L3N2Zz4=)}[data-pnotify] .angeler-icon-info:after{filter:var(--angeler-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDIzYzEuMSAwIDEuOTktLjg5IDEuOTktMS45OWgtMy45OGMwIDEuMS44OSAxLjk5IDEuOTkgMS45OXptOC4yOS00LjcxTDE5IDE3di02YzAtMy4zNS0yLjM2LTYuMTUtNS41LTYuODNWM2MwLS44My0uNjctMS41LTEuNS0xLjVzLTEuNS42Ny0xLjUgMS41djEuMTdDNy4zNiA0Ljg1IDUgNy42NSA1IDExdjZsLTEuMjkgMS4yOWMtLjYzLjYzLS4xOSAxLjcxLjcgMS43MWgxNS4xN2MuOSAwIDEuMzQtMS4wOC43MS0xLjcxek0xMyAxNmgtMnYtMmgydjJ6bTAtNWMwIC41NS0uNDUgMS0xIDFzLTEtLjQ1LTEtMVY5YzAtLjU1LjQ1LTEgMS0xczEgLjQ1IDEgMXYyeiIvPjwvc3ZnPg==)}[data-pnotify] .angeler-icon-success:after{filter:var(--angeler-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6TTkuMjkgMTYuMjlMNS43IDEyLjdjLS4zOS0uMzktLjM5LTEuMDIgMC0xLjQxLjM5LS4zOSAxLjAyLS4zOSAxLjQxIDBMMTAgMTQuMTdsNi44OC02Ljg4Yy4zOS0uMzkgMS4wMi0uMzkgMS40MSAwIC4zOS4zOS4zOSAxLjAyIDAgMS40MWwtNy41OSA3LjU5Yy0uMzguMzktMS4wMi4zOS0xLjQxIDB6Ii8+PC9zdmc+)}[data-pnotify] .angeler-icon-error:after{filter:var(--angeler-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6bTAgMTFjLS41NSAwLTEtLjQ1LTEtMVY4YzAtLjU1LjQ1LTEgMS0xczEgLjQ1IDEgMXY0YzAgLjU1LS40NSAxLTEgMXptMSA0aC0ydi0yaDJ2MnoiLz48L3N2Zz4=)}[data-pnotify] .angeler-icon-closer:after{filter:invert(100%) sepia(0%) saturate(7490%) hue-rotate(150deg) brightness(101%) contrast(101%);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTE4LjMgNS43MWMtLjM5LS4zOS0xLjAyLS4zOS0xLjQxIDBMMTIgMTAuNTkgNy4xMSA1LjdjLS4zOS0uMzktMS4wMi0uMzktMS40MSAwLS4zOS4zOS0uMzkgMS4wMiAwIDEuNDFMMTAuNTkgMTIgNS43IDE2Ljg5Yy0uMzkuMzktLjM5IDEuMDIgMCAxLjQxLjM5LjM5IDEuMDIuMzkgMS40MSAwTDEyIDEzLjQxbDQuODkgNC44OWMuMzkuMzkgMS4wMi4zOSAxLjQxIDAgLjM5LS4zOS4zOS0xLjAyIDAtMS40MUwxMy40MSAxMmw0Ljg5LTQuODljLjM4LS4zOC4zOC0xLjAyIDAtMS40eiIvPjwvc3ZnPg==)}[data-pnotify] .angeler-icon-sticker:after{filter:invert(100%) sepia(0%) saturate(7490%) hue-rotate(150deg) brightness(101%) contrast(101%);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGc+PHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+PHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+PC9nPjxnPjxwYXRoIGQ9Ik0xOSwxMi44N2MwLTAuNDctMC4zNC0wLjg1LTAuOC0wLjk4QzE2LjkzLDExLjU0LDE2LDEwLjM4LDE2LDlWNGwxLDAgYzAuNTUsMCwxLTAuNDUsMS0xYzAtMC41NS0wLjQ1LTEtMS0xSDdDNi40NSwyLDYsMi40NSw2LDNjMCwwLjU1LDAuNDUsMSwxLDFsMSwwdjVjMCwxLjM4LTAuOTMsMi41NC0yLjIsMi44OSBDNS4zNCwxMi4wMiw1LDEyLjQsNSwxMi44N1YxM2MwLDAuNTUsMC40NSwxLDEsMWg0Ljk4TDExLDIxYzAsMC41NSwwLjQ1LDEsMSwxYzAuNTUsMCwxLTAuNDUsMS0xbC0wLjAyLTdIMThjMC41NSwwLDEtMC40NSwxLTEgVjEyLjg3eiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9nPjwvc3ZnPg==)}[data-pnotify] .angeler-icon-sticker.angeler-icon-stuck:after{content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGc+PHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+PHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+PC9nPjxnPjxwYXRoIGQ9Ik0yLjk1NjQxMjE2LDEuODczMTI3NTkgTDMuMDUwNTcwNDMsMS45NTYzNzE3MyBMMy45ODYwNDY3OSwyLjg5MzA2MTQxIEw0LjAzOTUxNTQ2LDIuOTUzNzI5MDIgTDE2LjA4NDA0NjgsMTQuOTk4MDYxNCBMMTYuMDc4MDQ2OCwxNC45OTkwNjE0IEwyMS42NzYxMDU4LDIwLjYwMzg4NjcgQzIyLjA2NjM5OTgsMjAuOTk0NjQxMiAyMi4wNjYwMjY0LDIxLjYyNzgwNjEgMjEuNjc1MjcxOSwyMi4wMTgxIEMyMS4zMTQ1NzU0LDIyLjM3ODM3MTMgMjAuNzQ3MzI4MSwyMi40MDU3NjY0IDIwLjM1NTIxNjgsMjIuMTAwNTEwMiBMMjAuMjYxMDU4NiwyMi4wMTcyNjYxIEwxMy4yNTEwNDY4LDE0Ljk5OTA2MTQgTDEyLjk4LDE1IEwxMywyMiBDMTMsMjIuNTUgMTIuNTUsMjMgMTIsMjMgQzExLjQ4OTI4NTcsMjMgMTEuMDY0Nzk1OSwyMi42MTE5ODk4IDExLjAwNjc2MDIsMjIuMTE2MTk5IEwxMSwyMiBMMTAuOTgsMTUgTDYsMTUgQzUuNDg5Mjg1NzEsMTUgNS4wNjQ3OTU5MiwxNC42MTE5ODk4IDUuMDA2NzYwMiwxNC4xMTYxOTkgTDUsMTQgTDUsMTMuODcgQzUsMTMuNCA1LjM0LDEzLjAyIDUuOCwxMi44OSBDNy4wMTIyNzI3MywxMi41NTU5MDkxIDcuOTE0NzUyMDcsMTEuNDgzNzgxIDcuOTk0MjkwOTUsMTAuMTg2NzYyOCBMOCwxMCBMNy45OTkwNDY3OSw5Ljc0MTA2MTQxIEwxLjYzNTUyMzE2LDMuMzY5NzUxMSBDMS4yNDUyMjkyMywyLjk3ODk5NjU5IDEuMjQ1NjAyNiwyLjM0NTgzMTcyIDEuNjM2MzU3MTEsMS45NTU1Mzc3OCBDMS45OTcwNTM1OCwxLjU5NTI2NjQ2IDIuNTY0MzAwODksMS41Njc4NzE0MiAyLjk1NjQxMjE2LDEuODczMTI3NTkgWiBNMTcsMyBDMTcuNTUsMyAxOCwzLjQ1IDE4LDQgQzE4LDQuNTEwNzE0MjkgMTcuNjExOTg5OCw0LjkzNTIwNDA4IDE3LjExNjE5OSw0Ljk5MzIzOTggTDE3LDUgTDE2LDUgTDE2LDEwIEMxNiwxMS4zOCAxNi45MywxMi41NCAxOC4yLDEyLjg5IEMxOC42MjE2NjY3LDEzLjAwOTE2NjcgMTguOTQyNSwxMy4zMzg0MDI4IDE4Ljk5MzA0NCwxMy43NTQ0Njc2IEwxOSwxMy44NyBMMTksMTQgQzE5LDE0LjI5NzAzODMgMTguODY4NzQ2MSwxNC41NjQ5MDkxIDE4LjY2MTM3MjEsMTQuNzQ4NDc4NyBMNi45MTcwNDY3OSwzLjAwNDA2MTQxIEw3LDMgTDE3LDMgWiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9nPjwvc3ZnPg==)}[data-pnotify] .angeler-confirm{margin-top:calc(1rem - 5px);width:100%}[data-pnotify] .angeler-prompt-bar{margin-bottom:1rem}[data-pnotify] .angeler-prompt-bar,[data-pnotify] .angeler-action-bar{width:100%;box-sizing:border-box}[data-pnotify] .angeler-input{display:block;padding:.5rem;min-width:100%;font-size:1rem;line-height:1.2rem;margin-top:0;background-color:rgba(255,255,255,.2);color:var(--angeler-text-color);border:0;border-radius:2px}[data-pnotify] .angeler-btn{text-transform:uppercase;font-weight:700;padding:.4rem 1rem;border:none;background:0 0;cursor:pointer;color:var(--angeler-text-color);border-radius:2px}[data-pnotify] .angeler-btn-primary{background-color:var(--angeler-primary-button-background-color);color:var(--angeler-primary-button-text-color)}[data-pnotify].pnotify-with-countdown .angeler-container{border-radius:4px 4px 0 0}[data-pnotify].pnotify-with-countdown.pnotify-with-countdown-top .angeler-container{border-radius:0 0 4px 4px}[data-pnotify].pnotify-with-countdown.pnotify-with-countdown-left .angeler-container{border-radius:0 4px 4px 0}[data-pnotify].pnotify-with-countdown.pnotify-with-countdown-right .angeler-container{border-radius:4px 0 0 4px}[data-pnotify] .angeler-countdown{border-radius:0 0 4px 4px;z-index:-1}[data-pnotify] .angeler-countdown.pnotify-countdown-top{border-radius:4px 4px 0 0}[data-pnotify] .angeler-countdown.pnotify-countdown-left{border-radius:4px 0 0 4px}[data-pnotify] .angeler-countdown.pnotify-countdown-right{border-radius:0 4px 4px 0}[data-pnotify] .angeler-countdown-bar{border-radius:4px}[data-pnotify] .angeler-countdown{background-color:var(--angeler-background-color)}[data-pnotify] .angeler-countdown-bar{background-color:var(--ui-feature-color)}[data-pnotify] .angeler-paginate{margin-right:2em}[data-pnotify] .angeler-paginate-btn{width:1em;height:1em;line-height:1em;border:0;padding:0;background:0 0}[data-pnotify] .angeler-paginate-btn:disabled:after,[data-pnotify] .angeler-paginate-btn[aria-disabled=true]:after{opacity:.5}[data-pnotify] .angeler-paginate-previous:after{filter:var(--angeler-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTAgMGgyNHYyNEgwVjB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTE5IDExSDcuODNsNC44OC00Ljg4Yy4zOS0uMzkuMzktMS4wMyAwLTEuNDItLjM5LS4zOS0xLjAyLS4zOS0xLjQxIDBsLTYuNTkgNi41OWMtLjM5LjM5LS4zOSAxLjAyIDAgMS40MWw2LjU5IDYuNTljLjM5LjM5IDEuMDIuMzkgMS40MSAwIC4zOS0uMzkuMzktMS4wMiAwLTEuNDFMNy44MyAxM0gxOWMuNTUgMCAxLS40NSAxLTFzLS40NS0xLTEtMXoiLz48L3N2Zz4=)}[data-pnotify] .angeler-paginate-next:after{filter:var(--angeler-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTAgMGgyNHYyNEgwVjB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTUgMTNoMTEuMTdsLTQuODggNC44OGMtLjM5LjM5LS4zOSAxLjAzIDAgMS40Mi4zOS4zOSAxLjAyLjM5IDEuNDEgMGw2LjU5LTYuNTljLjM5LS4zOS4zOS0xLjAyIDAtMS40MWwtNi41OC02LjZjLS4zOS0uMzktMS4wMi0uMzktMS40MSAwLS4zOS4zOS0uMzkgMS4wMiAwIDEuNDFMMTYuMTcgMTFINWMtLjU1IDAtMSAuNDUtMSAxcy40NSAxIDEgMXoiLz48L3N2Zz4=)}[data-pnotify] .angeler-paginate-count-current,[data-pnotify] .angeler-paginate-count-total{border-radius:1em;padding:0 .5em;display:inline-block}[data-pnotify] .angeler-paginate-count-current,[data-pnotify].pnotify-mode-light .angeler-paginate-count-current{background:#1f1f1f;color:#fff}[data-pnotify] .angeler-paginate-count-total,[data-pnotify].pnotify-mode-light .angeler-paginate-count-total{background:var(--notice-text-color);color:#000}@media(prefers-color-scheme:dark){[data-pnotify] .angeler-paginate-count-current{background:#555}[data-pnotify] .angeler-paginate-count-total{background:var(--notice-border-color)}}[data-pnotify].pnotify-mode-dark .angeler-paginate-count-current{background:#555}[data-pnotify].pnotify-mode-dark .angeler-paginate-count-total{background:var(--notice-border-color)} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/BrightTheme.css b/lib/javascript/pnotyfy/BrightTheme.css new file mode 100644 index 0000000..c6975d1 --- /dev/null +++ b/lib/javascript/pnotyfy/BrightTheme.css @@ -0,0 +1,13 @@ +[data-pnotify].brighttheme-elem{border-radius:0}[data-pnotify].brighttheme-elem,[data-pnotify].brighttheme-elem.pnotify-mode-light{--notice-background-color: #ffffa2;--notice-border-color: #ffff00;--notice-text-color: #4f4f00;--notice-icon-filter: invert(25%) sepia(12%) saturate(7007%) hue-rotate(38deg) + brightness(99%) contrast(101%);--info-background-color: #8fcedd;--info-border-color: #0286a5;--info-text-color: #012831;--info-icon-filter: invert(11%) sepia(37%) saturate(1946%) hue-rotate(155deg) + brightness(95%) contrast(99%);--success-background-color: #aff29a;--success-border-color: #35db00;--success-text-color: #104300;--success-icon-filter: invert(17%) sepia(94%) saturate(1055%) + hue-rotate(70deg) brightness(90%) contrast(103%);--error-background-color: #ffaba2;--error-border-color: #ff1800;--error-text-color: #4f0800;--error-icon-filter: invert(9%) sepia(27%) saturate(7347%) hue-rotate(359deg) + brightness(96%) contrast(108%)}@media(prefers-color-scheme:dark){[data-pnotify].brighttheme-elem.pnotify-mode-no-preference{--notice-background-color: #4f4f00;--notice-border-color: #282814;--notice-text-color: #ffffa2;--notice-icon-filter: invert(92%) sepia(18%) saturate(781%) hue-rotate(6deg) + brightness(106%) contrast(107%);--info-background-color: #012831;--info-border-color: #0c1618;--info-text-color: #8fcedd;--info-icon-filter: invert(85%) sepia(14%) saturate(933%) hue-rotate(153deg) + brightness(92%) contrast(87%);--success-background-color: #104300;--success-border-color: #152111;--success-text-color: #aff29a;--success-icon-filter: invert(90%) sepia(9%) saturate(1647%) + hue-rotate(52deg) brightness(103%) contrast(90%);--error-background-color: #4f0800;--error-border-color: #281614;--error-text-color: #ffaba2;--error-icon-filter: invert(70%) sepia(24%) saturate(717%) + hue-rotate(315deg) brightness(103%) contrast(104%)}}[data-pnotify].brighttheme-elem.pnotify-mode-dark{--notice-background-color: #4f4f00;--notice-border-color: #282814;--notice-text-color: #ffffa2;--notice-icon-filter: invert(92%) sepia(18%) saturate(781%) hue-rotate(6deg) + brightness(106%) contrast(107%);--info-background-color: #012831;--info-border-color: #0c1618;--info-text-color: #8fcedd;--info-icon-filter: invert(85%) sepia(14%) saturate(933%) hue-rotate(153deg) + brightness(92%) contrast(87%);--success-background-color: #104300;--success-border-color: #152111;--success-text-color: #aff29a;--success-icon-filter: invert(90%) sepia(9%) saturate(1647%) hue-rotate(52deg) + brightness(103%) contrast(90%);--error-background-color: #4f0800;--error-border-color: #281614;--error-text-color: #ffaba2;--error-icon-filter: invert(70%) sepia(24%) saturate(717%) hue-rotate(315deg) + brightness(103%) contrast(104%)}[data-pnotify] .brighttheme-notice{--brighttheme-background-color: var(--notice-background-color);--brighttheme-border-color: var(--notice-border-color);--brighttheme-text-color: var(--notice-text-color);--brighttheme-icon-filter: var(--notice-icon-filter);--brighttheme-primary-button-background-color: var(--notice-border-color);--brighttheme-primary-button-text-color: var(--notice-text-color)}[data-pnotify] .brighttheme-info{--brighttheme-background-color: var(--info-background-color);--brighttheme-border-color: var(--info-border-color);--brighttheme-text-color: var(--info-text-color);--brighttheme-icon-filter: var(--info-icon-filter);--brighttheme-primary-button-background-color: var(--info-border-color);--brighttheme-primary-button-text-color: var(--info-text-color)}[data-pnotify] .brighttheme-success{--brighttheme-background-color: var(--success-background-color);--brighttheme-border-color: var(--success-border-color);--brighttheme-text-color: var(--success-text-color);--brighttheme-icon-filter: var(--success-icon-filter);--brighttheme-primary-button-background-color: var(--success-border-color);--brighttheme-primary-button-text-color: var(--success-text-color)}[data-pnotify] .brighttheme-error{--brighttheme-background-color: var(--error-background-color);--brighttheme-border-color: var(--error-border-color);--brighttheme-text-color: var(--error-text-color);--brighttheme-icon-filter: var(--error-icon-filter);--brighttheme-primary-button-background-color: var(--error-border-color);--brighttheme-primary-button-text-color: var(--error-text-color)}[data-pnotify] .brighttheme-container{padding:1.3rem;background-color:var(--brighttheme-background-color);border:0 solid var(--brighttheme-border-color);color:var(--brighttheme-text-color)}[data-pnotify] .brighttheme-error{background-image:repeating-linear-gradient( 135deg,transparent,transparent 35px,rgba(255,255,255,0.3) 35px,rgba(255,255,255,0.3) 70px )}[data-pnotify].pnotify-with-icon .brighttheme-content{margin-left:calc(1.3rem + 16px)}[dir=rtl] [data-pnotify].pnotify-with-icon .brighttheme-content{margin-right:calc(1.3rem + 16px);margin-left:0}[data-pnotify] .brighttheme-title{font-size:1.2rem;line-height:1.4rem;margin-top:-.1rem;margin-bottom:0}[data-pnotify] .brighttheme-text{font-size:1rem;line-height:1.2rem;margin-top:0}[data-pnotify] .brighttheme-title+.brighttheme-text,[data-pnotify] .brighttheme-confirm{margin-top:1rem}[data-pnotify] .brighttheme-icon,[data-pnotify] .brighttheme-closer,[data-pnotify] .brighttheme-sticker{display:flex;justify-content:center;align-items:center}[data-pnotify] .brighttheme-icon,[data-pnotify] .brighttheme-icon>span,[data-pnotify] .brighttheme-icon>span:after{width:1.2rem;height:1.2rem;line-height:1.2rem}[data-pnotify] .brighttheme-icon-closer,[data-pnotify] .brighttheme-icon-sticker,[data-pnotify] .brighttheme-icon-closer:after,[data-pnotify] .brighttheme-icon-sticker:after{width:1rem;height:1rem;line-height:1rem}[data-pnotify] .brighttheme-icon-notice:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTMsMTNIMTFWN0gxM00xMywxN0gxMVYxNUgxM00xMiwyQTEwLDEwIDAgMCwwIDIsMTJBMTAsMTAgMCAwLDAgMTIsMjJBMTAsMTAgMCAwLDAgMjIsMTJBMTAsMTAgMCAwLDAgMTIsMloiLz48L3N2Zz4=)}[data-pnotify] .brighttheme-icon-info:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTMsOUgxMVY3SDEzTTEzLDE3SDExVjExSDEzTTEyLDJBMTAsMTAgMCAwLDAgMiwxMkExMCwxMCAwIDAsMCAxMiwyMkExMCwxMCAwIDAsMCAyMiwxMkExMCwxMCAwIDAsMCAxMiwyWiIvPjwvc3ZnPg==)}[data-pnotify] .brighttheme-icon-success:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTIgMkM2LjUgMiAyIDYuNSAyIDEyUzYuNSAyMiAxMiAyMiAyMiAxNy41IDIyIDEyIDE3LjUgMiAxMiAyTTEwIDE3TDUgMTJMNi40MSAxMC41OUwxMCAxNC4xN0wxNy41OSA2LjU4TDE5IDhMMTAgMTdaIi8+PC9zdmc+)}[data-pnotify] .brighttheme-icon-error:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTMsMTRIMTFWMTBIMTNNMTMsMThIMTFWMTZIMTNNMSwyMUgyM0wxMiwyTDEsMjFaIi8+PC9zdmc+)}[data-pnotify] .brighttheme-icon-closer:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTksNi40MUwxNy41OSw1TDEyLDEwLjU5TDYuNDEsNUw1LDYuNDFMMTAuNTksMTJMNSwxNy41OUw2LjQxLDE5TDEyLDEzLjQxTDE3LjU5LDE5TDE5LDE3LjU5TDEzLjQxLDEyTDE5LDYuNDFaIi8+PC9zdmc+)}[data-pnotify] .brighttheme-icon-sticker:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTYsMTJWNEgxN1YySDdWNEg4VjEyTDYsMTRWMTZIMTEuMlYyMkgxMi44VjE2SDE4VjE0TDE2LDEyWiIvPjwvc3ZnPg==)}[data-pnotify] .brighttheme-icon-sticker.brighttheme-icon-stuck:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMiw1LjI3TDMuMjgsNEwyMCwyMC43MkwxOC43MywyMkwxMi44LDE2LjA3VjIySDExLjJWMTZINlYxNEw4LDEyVjExLjI3TDIsNS4yN00xNiwxMkwxOCwxNFYxNkgxNy44Mkw4LDYuMThWNEg3VjJIMTdWNEgxNlYxMloiLz48L3N2Zz4=)}[data-pnotify] .brighttheme-prompt-bar{margin-bottom:1rem}[data-pnotify] .brighttheme-prompt-bar,[data-pnotify] .brighttheme-action-bar{width:100%;box-sizing:border-box}[data-pnotify] .brighttheme-btn{text-transform:uppercase;font-weight:700;padding:.4rem 1rem;border:none;background:0 0;cursor:pointer;color:var(--brighttheme-text-color)}[data-pnotify] .brighttheme-btn-primary{background-color:var(--brighttheme-primary-button-background-color);color:var(--brighttheme-primary-button-text-color)}[data-pnotify] .brighttheme-countdown{background-color:var(--brighttheme-background-color)}[data-pnotify] .brighttheme-countdown-bar{background-color:var(--brighttheme-border-color)}[data-pnotify] .brighttheme-paginate{display:inline-flex;flex-direction:column}[data-pnotify] .brighttheme-paginate-btn{width:1em;height:1em;line-height:.5em;border:0;padding:0;background:0 0}[data-pnotify] .brighttheme-paginate-previous{margin-right:0}[data-pnotify] .brighttheme-paginate-next{margin-left:0}[data-pnotify] .brighttheme-paginate-btn:disabled:after,[data-pnotify] .brighttheme-paginate-btn[aria-disabled=true]:after{opacity:.5}[data-pnotify] .brighttheme-paginate-previous:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik0xMS42NyAzLjg3TDkuOSAyLjEgMCAxMmw5LjkgOS45IDEuNzctMS43N0wzLjU0IDEyeiIvPjwvc3ZnPg==)}[data-pnotify] .brighttheme-paginate-next:after{filter:var(--brighttheme-icon-filter);content:url(data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik01Ljg4IDQuMTJMMTMuNzYgMTJsLTcuODggNy44OEw4IDIybDEwLTEwTDggMnoiLz48L3N2Zz4=)}[data-pnotify] .brighttheme-paginate-count-of{opacity:.8} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/Material.css b/lib/javascript/pnotyfy/Material.css new file mode 100644 index 0000000..5cb8003 --- /dev/null +++ b/lib/javascript/pnotyfy/Material.css @@ -0,0 +1 @@ +[data-pnotify].material-elem,[data-pnotify].material-elem.pnotify-mode-light{--notice-background-color: #fff59d;--notice-text-color: #000;--info-background-color: #9dfff5;--info-text-color: #000;--success-background-color: #a7ff9d;--success-text-color: #000;--error-background-color: #ffc49d;--error-text-color: #000;--primary-button-text-color: #3f51b5;--primary-button-text-focus-color: #303f9f;--input-focus-underline-color: #3f51b5;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;font-size:14px}@media(prefers-color-scheme:dark){[data-pnotify].material-elem.pnotify-mode-no-preference{--notice-background-color: #ff8f00;--notice-text-color: #fff;--info-background-color: #006eff;--info-text-color: #fff;--success-background-color: #00c000;--success-text-color: #fff;--error-background-color: #ff1100;--error-text-color: #fff;--primary-button-text-color: #e1f5fe;--primary-button-text-focus-color: #e0f7fa;--input-focus-underline-color: #e1f5fe}}[data-pnotify].material-elem.pnotify-mode-dark{--notice-background-color: #ff8f00;--notice-text-color: #fff;--info-background-color: #006eff;--info-text-color: #fff;--success-background-color: #00c000;--success-text-color: #fff;--error-background-color: #ff1100;--error-text-color: #fff;--primary-button-text-color: #e1f5fe;--primary-button-text-focus-color: #e0f7fa;--input-focus-underline-color: #e1f5fe}[data-pnotify] .material-notice{--material-background-color: var(--notice-background-color);--material-text-color: var(--notice-text-color)}[data-pnotify] .material-info{--material-background-color: var(--info-background-color);--material-text-color: var(--info-text-color)}[data-pnotify] .material-success{--material-background-color: var(--success-background-color);--material-text-color: var(--success-text-color)}[data-pnotify] .material-error{--material-background-color: var(--error-background-color);--material-text-color: var(--error-text-color)}[data-pnotify].material-elem.pnotify-shadow{-webkit-box-shadow:0 6px 24px 0 rgba(0,0,0,.2);-moz-box-shadow:0 6px 24px 0 rgba(0,0,0,.2);box-shadow:0 6px 24px 0 rgba(0,0,0,.2)}[data-pnotify] .material-container{padding:24px;background-color:var(--material-background-color);border:none;color:var(--material-text-color)}[data-pnotify] .material-title{font-family:roboto,sans-serif;font-weight:500;font-size:20px;letter-spacing:.15px;margin-bottom:20px;line-height:24px}[data-pnotify] .material-title:last-child{margin-bottom:0}[data-pnotify] .material-text{font-family:roboto,sans-serif;font-weight:400;font-size:16px;letter-spacing:.5px;line-height:24px}[data-pnotify].pnotify-with-icon .material-content{margin-left:32px}[dir=rtl] [data-pnotify].pnotify-with-icon .material-content{margin-right:32px;margin-left:0}[data-pnotify] .material-icon,[data-pnotify] .material-closer,[data-pnotify] .material-sticker,[data-pnotify] .material-icon>span:after,[data-pnotify] .material-icon-closer:after,[data-pnotify] .material-icon-sticker:after{font-family:material icons;height:20px;width:20px;font-size:20px;line-height:24px;position:relative}[data-pnotify] .material-action-bar{margin-top:20px;margin-right:-16px;margin-bottom:-16px}[dir=rtl] [data-pnotify] .material-action-bar{margin-left:-16px;margin-right:0}[data-pnotify] .material-icon-notice:after{content:'priority_high'}[data-pnotify] .material-icon-info:after{content:'info'}[data-pnotify] .material-icon-success:after{content:'done'}[data-pnotify] .material-icon-error:after{content:'error'}[data-pnotify] .material-icon-closer:after{content:'close'}[data-pnotify] .material-icon-unstuck:after{content:'pause'}[data-pnotify] .material-icon-stuck:after{content:'play_arrow'}[data-pnotify] .material-input{display:block;width:100%;margin-bottom:8px;padding:15px 0 8px;background-color:transparent;color:inherit;border-radius:0;border-top:none;border-left:none;border-right:none;border-bottom-style:solid;border-bottom-color:inherit;border-bottom-width:1px}[data-pnotify] .material-input:focus{outline:none;border-bottom-color:var(--input-focus-underline-color);border-bottom-width:2px}[data-pnotify] .material-btn{position:relative;padding:0 16px;overflow:hidden;border-width:0;outline:none;border-radius:2px;background-color:transparent;color:inherit;transition:background-color .3s;font-family:roboto,sans-serif;font-weight:500;font-size:14px;letter-spacing:1.25px;text-transform:uppercase;height:36px;margin:6px;min-width:64px}[data-pnotify] .material-btn.material-btn-primary{color:var(--primary-button-text-color)}[data-pnotify] .material-btn:hover,[data-pnotify] .material-btn:focus{background-color:rgba(0,0,0,.12);color:inherit}[data-pnotify] .material-btn.material-btn-primary:hover,[data-pnotify] .material-btn.material-btn-primary:focus{color:var(--primary-button-text-focus-color)}[data-pnotify] .material-btn:before{content:'';position:absolute;top:50%;left:50%;display:block;width:0;padding-top:0;border-radius:100%;background-color:rgba(153,153,153,.4);-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}[data-pnotify] .material-btn:active:before{width:120%;padding-top:120%;transition:width .2s ease-out,padding-top .2s ease-out}[data-pnotify] .material-countdown{background-color:var(--material-background-color)}[data-pnotify] .material-countdown-bar{background-color:var(--material-text-color)}[data-pnotify] .material-paginate{display:inline-flex;flex-direction:column}[data-pnotify] .material-paginate-buttons{margin-right:6px}[data-pnotify] .material-paginate-btn{margin:0 0 0 6px;border:0;padding:0}[data-pnotify] .material-paginate-btn,[data-pnotify] .material-paginate-btn:after{display:inline-block;font-family:material icons;height:20px;width:20px;font-size:20px;line-height:24px;position:relative}[data-pnotify] .material-paginate-btn:disabled:after,[data-pnotify] .material-paginate-btn[aria-disabled=true]:after{opacity:.5}[data-pnotify] .material-paginate-previous:after{content:'arrow_back'}[data-pnotify] .material-paginate-next:after{content:'arrow_forward'}[data-pnotify] .material-paginate-count{font-family:roboto,sans-serif;font-weight:400;font-size:14px;letter-spacing:.25px} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotify.css b/lib/javascript/pnotyfy/PNotify.css new file mode 100644 index 0000000..1d160a7 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotify.css @@ -0,0 +1 @@ +body>.pnotify.pnotify-positioned{position:fixed;z-index:100040}body>.pnotify.pnotify-modal{z-index:100042}.pnotify{height:auto;display:none;transition:opacity .1s linear;opacity:0}.pnotify.pnotify-positioned{position:absolute;z-index:1}.pnotify.pnotify-modal{z-index:3}.pnotify.pnotify-in{display:block;opacity:1}.pnotify.pnotify-initial{display:block}.pnotify-hidden{visibility:hidden}.pnotify.pnotify-move{transition:left .4s ease,top .4s ease,right .4s ease,bottom .4s ease}.pnotify.pnotify-fade-slow{transition:opacity .4s linear;opacity:0}.pnotify.pnotify-fade-slow.pnotify.pnotify-move{transition:opacity .4s linear,left .4s ease,top .4s ease,right .4s ease,bottom .4s ease}.pnotify.pnotify-fade-normal{transition:opacity .25s linear;opacity:0}.pnotify.pnotify-fade-normal.pnotify.pnotify-move{transition:opacity .25s linear,left .4s ease,top .4s ease,right .4s ease,bottom .4s ease}.pnotify.pnotify-fade-fast{transition:opacity .1s linear;opacity:0}.pnotify.pnotify-fade-fast.pnotify.pnotify-move{transition:opacity .1s linear,left .4s ease,top .4s ease,right .4s ease,bottom .4s ease}.pnotify.pnotify-masking{display:block;-webkit-mask-image:linear-gradient( to bottom,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) );mask-image:linear-gradient( to bottom,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) )}.pnotify.pnotify-masking.pnotify-stack-up{-webkit-mask-image:linear-gradient( to top,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) );mask-image:linear-gradient( to top,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) )}.pnotify.pnotify-masking.pnotify-stack-left{-webkit-mask-image:linear-gradient( to left,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) );mask-image:linear-gradient( to left,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) )}.pnotify.pnotify-masking.pnotify-stack-right{-webkit-mask-image:linear-gradient( to right,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) );mask-image:linear-gradient( to right,rgba(0,0,0,0.8),rgba(0,0,0,0) 30px,rgba(0,0,0,0) )}.pnotify.pnotify-fade-in,.pnotify.pnotify-masking-in{opacity:1}.pnotify .pnotify-shadow{-webkit-box-shadow:0 6px 28px 0 rgba(0,0,0,.1);-moz-box-shadow:0 6px 28px 0 rgba(0,0,0,.1);box-shadow:0 6px 28px 0 rgba(0,0,0,.1)}.pnotify-container{position:relative;background-position:0 0;padding:.8em;height:100%;margin:0}.pnotify-container:after{content:' ';visibility:hidden;display:block;height:0;clear:both}.pnotify-closer,.pnotify-sticker{float:right;margin-left:.5em;cursor:pointer}[dir=rtl] .pnotify-closer,[dir=rtl] .pnotify-sticker{float:left;margin-right:.5em;margin-left:0}.pnotify-title{display:block;white-space:pre-line;margin-bottom:.4em;margin-top:0}.pnotify-text-with-max-height{overflow-y:auto;overscroll-behavior:contain;padding-bottom:.03em}.pnotify.pnotify-with-icon .pnotify-content{margin-left:24px}[dir=rtl] .pnotify.pnotify-with-icon .pnotify-content{margin-right:24px;margin-left:0}.pnotify-pre-line{white-space:pre-line}.pnotify-icon,.pnotify-icon span{display:block;float:left}[dir=rtl] .pnotify-icon,[dir=rtl] .pnotify-icon span{float:right}.pnotify-modal-overlay{background-color:rgba(0,0,0,.6);top:0;left:0;position:absolute;height:100%;width:100%;z-index:2;transition:opacity .25s linear;opacity:0;padding:0;display:flex;justify-content:center;align-items:flex-end}.pnotify-modal-overlay-up{align-items:flex-start}.pnotify-modal-overlay-left{justify-content:flex-start;align-items:center}.pnotify-modal-overlay-right{justify-content:flex-end;align-items:center}.pnotify-modal-overlay.pnotify-modal-overlay-in{opacity:1}.pnotify-modal-overlay-closes:after{content:'×';font-family:Arial;font-size:3rem;color:#fff;text-shadow:0 0 .4rem #fff}body>.pnotify-modal-overlay{position:fixed;z-index:100041} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotify.js b/lib/javascript/pnotyfy/PNotify.js new file mode 100644 index 0000000..3da4bc4 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotify.js @@ -0,0 +1,5269 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotify = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function assign(tar, src) { + // @ts-ignore + for (var k in src) { + tar[k] = src[k]; + } + + return tar; + } + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function action_destroyer(action_result) { + return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; + } + + function append(target, node) { + target.appendChild(node); + } + + function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function element(name) { + return document.createElement(name); + } + + function text(data) { + return document.createTextNode(data); + } + + function space() { + return text(' '); + } + + function empty() { + return text(''); + } + + function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return function () { + return node.removeEventListener(event, handler, options); + }; + } + + function attr(node, attribute, value) { + if (value == null) node.removeAttribute(attribute);else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); + } + + function children(element) { + return Array.from(element.childNodes); + } + + function set_data(text, data) { + data = '' + data; + if (text.wholeText !== data) text.data = data; + } + + function custom_event(type, detail) { + var e = document.createEvent('CustomEvent'); + e.initCustomEvent(type, false, false, detail); + return e; + } + + var HtmlTag = /*#__PURE__*/function () { + function HtmlTag() { + var anchor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + + _classCallCheck(this, HtmlTag); + + this.a = anchor; + this.e = this.n = null; + } + + _createClass(HtmlTag, [{ + key: "m", + value: function m(html, target) { + var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + if (!this.e) { + this.e = element(target.nodeName); + this.t = target; + this.h(html); + } + + this.i(anchor); + } + }, { + key: "h", + value: function h(html) { + this.e.innerHTML = html; + this.n = Array.from(this.e.childNodes); + } + }, { + key: "i", + value: function i(anchor) { + for (var i = 0; i < this.n.length; i += 1) { + insert(this.t, this.n[i], anchor); + } + } + }, { + key: "p", + value: function p(html) { + this.d(); + this.h(html); + this.i(this.a); + } + }, { + key: "d", + value: function d() { + this.n.forEach(detach); + } + }]); + + return HtmlTag; + }(); + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + function get_current_component() { + if (!current_component) throw new Error('Function called outside component initialization'); + return current_component; + } + + function beforeUpdate(fn) { + get_current_component().$$.before_update.push(fn); + } + + function onMount(fn) { + get_current_component().$$.on_mount.push(fn); + } + + function createEventDispatcher() { + var component = get_current_component(); + return function (type, detail) { + var callbacks = component.$$.callbacks[type]; + + if (callbacks) { + // TODO are there situations where events could be dispatched + // in a server (non-DOM) environment? + var event = custom_event(type, detail); + callbacks.slice().forEach(function (fn) { + fn.call(component, event); + }); + } + }; + } + // shorthand events, or if we want to implement + // a real bubbling mechanism + + + function bubble(component, event) { + var callbacks = component.$$.callbacks[event.type]; + + if (callbacks) { + callbacks.slice().forEach(function (fn) { + return fn(event); + }); + } + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function tick() { + schedule_update(); + return resolved_promise; + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + var outros; + + function group_outros() { + outros = { + r: 0, + c: [], + p: outros // parent group + + }; + } + + function check_outros() { + if (!outros.r) { + run_all(outros.c); + } + + outros = outros.p; + } + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function transition_out(block, local, detach, callback) { + if (block && block.o) { + if (outroing.has(block)) return; + outroing.add(block); + outros.c.push(function () { + outroing["delete"](block); + + if (callback) { + if (detach) block.d(1); + callback(); + } + }); + block.o(local); + } + } + + var globals = typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : global; + + function outro_and_destroy_block(block, lookup) { + transition_out(block, 1, 1, function () { + lookup["delete"](block.key); + }); + } + + function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) { + var o = old_blocks.length; + var n = list.length; + var i = o; + var old_indexes = {}; + + while (i--) { + old_indexes[old_blocks[i].key] = i; + } + + var new_blocks = []; + var new_lookup = new Map(); + var deltas = new Map(); + i = n; + + while (i--) { + var child_ctx = get_context(ctx, list, i); + var key = get_key(child_ctx); + var block = lookup.get(key); + + if (!block) { + block = create_each_block(key, child_ctx); + block.c(); + } else if (dynamic) { + block.p(child_ctx, dirty); + } + + new_lookup.set(key, new_blocks[i] = block); + if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); + } + + var will_move = new Set(); + var did_move = new Set(); + + function insert(block) { + transition_in(block, 1); + block.m(node, next); + lookup.set(block.key, block); + next = block.first; + n--; + } + + while (o && n) { + var new_block = new_blocks[n - 1]; + var old_block = old_blocks[o - 1]; + var new_key = new_block.key; + var old_key = old_block.key; + + if (new_block === old_block) { + // do nothing + next = new_block.first; + o--; + n--; + } else if (!new_lookup.has(old_key)) { + // remove old block + destroy(old_block, lookup); + o--; + } else if (!lookup.has(new_key) || will_move.has(new_key)) { + insert(new_block); + } else if (did_move.has(old_key)) { + o--; + } else if (deltas.get(new_key) > deltas.get(old_key)) { + did_move.add(new_key); + insert(new_block); + } else { + will_move.add(old_key); + o--; + } + } + + while (o--) { + var _old_block = old_blocks[o]; + if (!new_lookup.has(_old_block.key)) destroy(_old_block, lookup); + } + + while (n) { + insert(new_blocks[n - 1]); + } + + return new_blocks; + } + + function get_spread_update(levels, updates) { + var update = {}; + var to_null_out = {}; + var accounted_for = { + $$scope: 1 + }; + var i = levels.length; + + while (i--) { + var o = levels[i]; + var n = updates[i]; + + if (n) { + for (var key in o) { + if (!(key in n)) to_null_out[key] = 1; + } + + for (var _key3 in n) { + if (!accounted_for[_key3]) { + update[_key3] = n[_key3]; + accounted_for[_key3] = 1; + } + } + + levels[i] = n; + } else { + for (var _key4 in o) { + accounted_for[_key4] = 1; + } + } + } + + for (var _key5 in to_null_out) { + if (!(_key5 in update)) update[_key5] = undefined; + } + + return update; + } + + function get_spread_object(spread_props) { + return _typeof(spread_props) === 'object' && spread_props !== null ? spread_props : {}; + } // source: https://html.spec.whatwg.org/multipage/indices.html + + function create_component(block) { + block && block.c(); + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var Stack = /*#__PURE__*/function () { + function Stack(options) { + _classCallCheck(this, Stack); + + // TODO: label for close all button + Object.assign(this, { + dir1: null, + dir2: null, + firstpos1: null, + firstpos2: null, + spacing1: 25, + spacing2: 25, + push: 'bottom', + maxOpen: 1, + maxStrategy: 'wait', + maxClosureCausesWait: true, + modal: 'ish', + modalishFlash: true, + overlayClose: true, + overlayClosesPinned: false, + positioned: true, + context: window && document.body || null + }, options); // Validate the options. + + if (this.modal === 'ish' && this.maxOpen !== 1) { + throw new Error('A modalish stack must have a maxOpen value of 1.'); + } + + if (this.modal === 'ish' && !this.dir1) { + throw new Error('A modalish stack must have a direction.'); + } + + if (this.push === 'top' && this.modal === 'ish' && this.maxStrategy !== 'close') { + throw new Error('A modalish stack that pushes to the top must use the close maxStrategy.'); + } // -- Private properties. + // The head of the notice double linked list. + + + this._noticeHead = { + notice: null, + prev: null, + next: null + }; // The tail of the notice double linked list. + + this._noticeTail = { + notice: null, + prev: this._noticeHead, + next: null + }; + this._noticeHead.next = this._noticeTail; // The map of notices to nodes. + + this._noticeMap = new WeakMap(); // The number of notices in the stack. + + this._length = 0; // How much space to add along the secondary axis when moving notices to the + // next column/row. + + this._addpos2 = 0; // Whether the stack's notices should animate while moving. + + this._animation = true; // A timer to debounce positioning. + + this._posTimer = null; // The number of open notices. + + this._openNotices = 0; // A listener for positioning events. + + this._listener = null; // Whether the overlay is currently open. + + this._overlayOpen = false; // Whether the overlay is currently inserted into the DOM. + + this._overlayInserted = false; // Whether the modal state is collapsing. (Notices go back to waiting and + // shouldn't resposition.) + + this._collapsingModalState = false; // The leader is the first open notice in a modalish stack. + + this._leader = null; + this._leaderOff = null; // The next waiting notice that is masking. + + this._masking = null; + this._maskingOff = null; // Swapping notices, so don't open a new one. Set to the opening notice on + // swap. + + this._swapping = false; // Event listener callbacks. + + this._callbacks = {}; + } + + _createClass(Stack, [{ + key: "forEach", + value: function forEach(callback) { + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$start = _ref.start, + start = _ref$start === void 0 ? 'oldest' : _ref$start, + _ref$dir = _ref.dir, + dir = _ref$dir === void 0 ? 'newer' : _ref$dir, + _ref$skipModuleHandle = _ref.skipModuleHandled, + skipModuleHandled = _ref$skipModuleHandle === void 0 ? false : _ref$skipModuleHandle; + + var node; + + if (start === 'head' || start === 'newest' && this.push === 'top' || start === 'oldest' && this.push === 'bottom') { + node = this._noticeHead.next; + } else if (start === 'tail' || start === 'newest' && this.push === 'bottom' || start === 'oldest' && this.push === 'top') { + node = this._noticeTail.prev; + } else if (this._noticeMap.has(start)) { + node = this._noticeMap.get(start); + } else { + throw new Error('Invalid start param.'); + } + + while (node.notice) { + var _notice = node.notice; // Get the next node first. + + if (dir === 'prev' || this.push === 'top' && dir === 'newer' || this.push === 'bottom' && dir === 'older') { + node = node.prev; + } else if (dir === 'next' || this.push === 'top' && dir === 'older' || this.push === 'bottom' && dir === 'newer') { + node = node.next; + } else { + throw new Error('Invalid dir param.'); + } // Call the callback last, just in case the callback removes the notice. + + + if ((!skipModuleHandled || !_notice.getModuleHandled()) && callback(_notice) === false) { + break; + } + } + } + }, { + key: "close", + value: function close(immediate) { + this.forEach(function (notice) { + return notice.close(immediate, false, false); + }); + } + }, { + key: "open", + value: function open(immediate) { + this.forEach(function (notice) { + return notice.open(immediate); + }); + } + }, { + key: "openLast", + value: function openLast() { + // Look up the last notice, and display it. + this.forEach(function (notice) { + if (['opening', 'open', 'waiting'].indexOf(notice.getState()) === -1) { + notice.open(); + return false; + } + }, { + start: 'newest', + dir: 'older' + }); + } + }, { + key: "swap", + value: function swap(one, theOther) { + var _this = this; + + var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var waitAfter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + if (['open', 'opening', 'closing'].indexOf(one.getState()) === -1) { + // One is closed. Return rejected promise. + return Promise.reject(); + } + + this._swapping = theOther; + return one.close(immediate, false, waitAfter).then(function () { + return theOther.open(immediate); + })["finally"](function () { + _this._swapping = false; + }); + } + }, { + key: "on", + value: function on(event, callback) { + var _this2 = this; + + if (!(event in this._callbacks)) { + this._callbacks[event] = []; + } + + this._callbacks[event].push(callback); + + return function () { + _this2._callbacks[event].splice(_this2._callbacks[event].indexOf(callback), 1); + }; + } + }, { + key: "fire", + value: function fire(event) { + var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + detail.stack = this; + + if (event in this._callbacks) { + this._callbacks[event].forEach(function (cb) { + return cb(detail); + }); + } + } + }, { + key: "position", + value: function position() { + var _this3 = this; + + // Reset the next position data. + if (this.positioned && this._length > 0) { + this.fire('beforePosition'); + + this._resetPositionData(); + + this.forEach(function (notice) { + _this3._positionNotice(notice); + }, { + start: 'head', + dir: 'next', + skipModuleHandled: true + }); + this.fire('afterPosition'); + } else { + delete this._nextpos1; + delete this._nextpos2; + } + } // Queue the position so it doesn't run repeatedly and use up resources. + + }, { + key: "queuePosition", + value: function queuePosition() { + var _this4 = this; + + var milliseconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10; + + if (this._posTimer) { + clearTimeout(this._posTimer); + } + + this._posTimer = setTimeout(function () { + return _this4.position(); + }, milliseconds); + } + }, { + key: "_resetPositionData", + value: function _resetPositionData() { + this._nextpos1 = this.firstpos1; + this._nextpos2 = this.firstpos2; + this._addpos2 = 0; + } // Position the notice. + + }, { + key: "_positionNotice", + value: function _positionNotice(notice) { + var masking = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : notice === this._masking; + + if (!this.positioned) { + return; + } // Get the notice's element. + + + var elem = notice.refs.elem; + + if (!elem) { + return; + } // Skip this notice if it's not shown. + + + if (!elem.classList.contains('pnotify-in') && !elem.classList.contains('pnotify-initial') && !masking) { + return; + } // Use local variables, since a masking notice position shouldn't update the + // stack. + + + var _ref2 = [this.firstpos1, this.firstpos2, this._nextpos1, this._nextpos2, this._addpos2], + firstpos1 = _ref2[0], + firstpos2 = _ref2[1], + _nextpos1 = _ref2[2], + _nextpos2 = _ref2[3], + _addpos2 = _ref2[4]; // Read from the DOM to cause refresh. + + elem.getBoundingClientRect(); + + if (this._animation && !masking && !this._collapsingModalState) { + // Add animate class. + notice._setMoveClass('pnotify-move'); + } else { + notice._setMoveClass(''); + } + + var spaceY = this.context === document.body ? window.innerHeight : this.context.scrollHeight; + var spaceX = this.context === document.body ? window.innerWidth : this.context.scrollWidth; + var csspos1; + + if (this.dir1) { + csspos1 = { + down: 'top', + up: 'bottom', + left: 'right', + right: 'left' + }[this.dir1]; // Calculate the current pos1 value. + + var curpos1; + + switch (this.dir1) { + case 'down': + curpos1 = elem.offsetTop; + break; + + case 'up': + curpos1 = spaceY - elem.scrollHeight - elem.offsetTop; + break; + + case 'left': + curpos1 = spaceX - elem.scrollWidth - elem.offsetLeft; + break; + + case 'right': + curpos1 = elem.offsetLeft; + break; + } // Remember the first pos1, so the first notice goes there. + + + if (firstpos1 == null) { + firstpos1 = curpos1; + _nextpos1 = firstpos1; + } + } + + if (this.dir1 && this.dir2) { + var csspos2 = { + down: 'top', + up: 'bottom', + left: 'right', + right: 'left' + }[this.dir2]; // Calculate the current pos2 value. + + var curpos2; + + switch (this.dir2) { + case 'down': + curpos2 = elem.offsetTop; + break; + + case 'up': + curpos2 = spaceY - elem.scrollHeight - elem.offsetTop; + break; + + case 'left': + curpos2 = spaceX - elem.scrollWidth - elem.offsetLeft; + break; + + case 'right': + curpos2 = elem.offsetLeft; + break; + } // Remember the first pos2, so the first notice goes there. + + + if (firstpos2 == null) { + firstpos2 = curpos2; + _nextpos2 = firstpos2; + } // Don't move masking notices along dir2. They should always be beside the + // leader along dir1. + + + if (!masking) { + // Check that it's not beyond the viewport edge. + var endY = _nextpos1 + elem.offsetHeight + this.spacing1; + var endX = _nextpos1 + elem.offsetWidth + this.spacing1; + + if ((this.dir1 === 'down' || this.dir1 === 'up') && endY > spaceY || (this.dir1 === 'left' || this.dir1 === 'right') && endX > spaceX) { + // If it is, it needs to go back to the first pos1, and over on pos2. + _nextpos1 = firstpos1; + _nextpos2 += _addpos2 + this.spacing2; + _addpos2 = 0; + } + } // Move the notice on dir2. + + + if (_nextpos2 != null) { + elem.style[csspos2] = "".concat(_nextpos2, "px"); + + if (!this._animation) { + elem.style[csspos2]; // Read from the DOM for update. + } + } // Keep track of the widest/tallest notice in the column/row, so we can push the next column/row. + + + switch (this.dir2) { + case 'down': + case 'up': + if (elem.offsetHeight + (parseFloat(elem.style.marginTop, 10) || 0) + (parseFloat(elem.style.marginBottom, 10) || 0) > _addpos2) { + _addpos2 = elem.offsetHeight; + } + + break; + + case 'left': + case 'right': + if (elem.offsetWidth + (parseFloat(elem.style.marginLeft, 10) || 0) + (parseFloat(elem.style.marginRight, 10) || 0) > _addpos2) { + _addpos2 = elem.offsetWidth; + } + + break; + } + } else if (this.dir1) { + // Center the notice along dir1 axis, because the stack has no dir2. + var cssMiddle, cssposCross; + + switch (this.dir1) { + case 'down': + case 'up': + cssposCross = ['left', 'right']; + cssMiddle = this.context.scrollWidth / 2 - elem.offsetWidth / 2; + break; + + case 'left': + case 'right': + cssposCross = ['top', 'bottom']; + cssMiddle = spaceY / 2 - elem.offsetHeight / 2; + break; + } + + elem.style[cssposCross[0]] = "".concat(cssMiddle, "px"); + elem.style[cssposCross[1]] = 'auto'; + + if (!this._animation) { + elem.style[cssposCross[0]]; // Read from the DOM for update. + } + } + + if (this.dir1) { + // Move the notice on dir1. + if (_nextpos1 != null) { + elem.style[csspos1] = "".concat(_nextpos1, "px"); + + if (!this._animation) { + elem.style[csspos1]; // Read from the DOM for update. + } + } // Calculate the next dir1 position. + + + switch (this.dir1) { + case 'down': + case 'up': + _nextpos1 += elem.offsetHeight + this.spacing1; + break; + + case 'left': + case 'right': + _nextpos1 += elem.offsetWidth + this.spacing1; + break; + } + } else { + // Center the notice on the screen, because the stack has no dir1. + var cssMiddleLeft = spaceX / 2 - elem.offsetWidth / 2; + var cssMiddleTop = spaceY / 2 - elem.offsetHeight / 2; + elem.style.left = "".concat(cssMiddleLeft, "px"); + elem.style.top = "".concat(cssMiddleTop, "px"); + + if (!this._animation) { + elem.style.left; // Read from the DOM for update. + } + } // If we're not positioning the masking notice, update the stack properties. + + + if (!masking) { + this.firstpos1 = firstpos1; + this.firstpos2 = firstpos2; + this._nextpos1 = _nextpos1; + this._nextpos2 = _nextpos2; + this._addpos2 = _addpos2; + } + } + }, { + key: "_addNotice", + value: function _addNotice(notice) { + var _this5 = this; + + this.fire('beforeAddNotice', { + notice: notice + }); + + var handleNoticeOpen = function handleNoticeOpen() { + _this5.fire('beforeOpenNotice', { + notice: notice + }); + + if (notice.getModuleHandled()) { + // We don't deal with notices that are handled by a module. + _this5.fire('afterOpenNotice', { + notice: notice + }); + + return; + } + + _this5._openNotices++; // Check the max in stack. + + if (!(_this5.modal === 'ish' && _this5._overlayOpen) && _this5.maxOpen !== Infinity && _this5._openNotices > _this5.maxOpen && _this5.maxStrategy === 'close') { + var toClose = _this5._openNotices - _this5.maxOpen; + + _this5.forEach(function (notice) { + if (['opening', 'open'].indexOf(notice.getState()) !== -1) { + // Close oldest notices, leaving only stack.maxOpen from the stack. + notice.close(false, false, _this5.maxClosureCausesWait); + + if (notice === _this5._leader) { + _this5._setLeader(null); + } + + toClose--; + return !!toClose; + } + }); + } + + if (_this5.modal === true) { + _this5._insertOverlay(); + } + + if (_this5.modal === 'ish' && (!_this5._leader || ['opening', 'open', 'closing'].indexOf(_this5._leader.getState()) === -1)) { + _this5._setLeader(notice); + } + + if (_this5.modal === 'ish' && _this5._overlayOpen) { + notice._preventTimerClose(true); + } // this.queuePosition(0); + + + _this5.fire('afterOpenNotice', { + notice: notice + }); + }; + + var handleNoticeClosed = function handleNoticeClosed() { + _this5.fire('beforeCloseNotice', { + notice: notice + }); + + if (notice.getModuleHandled()) { + // We don't deal with notices that are handled by a module. + _this5.fire('afterCloseNotice', { + notice: notice + }); + + return; + } + + _this5._openNotices--; + + if (_this5.modal === 'ish' && notice === _this5._leader) { + _this5._setLeader(null); + + if (_this5._masking) { + _this5._setMasking(null); + } + } + + if (!_this5._swapping && _this5.maxOpen !== Infinity && _this5._openNotices < _this5.maxOpen) { + var done = false; + + var open = function open(contender) { + if (contender !== notice && contender.getState() === 'waiting') { + contender.open()["catch"](function () {}); + + if (_this5._openNotices >= _this5.maxOpen) { + done = true; + return false; + } + } + }; + + if (_this5.maxStrategy === 'wait') { + // Check for the next waiting notice and open it. + _this5.forEach(open, { + start: notice, + dir: 'next' + }); + + if (!done) { + _this5.forEach(open, { + start: notice, + dir: 'prev' + }); + } + } else if (_this5.maxStrategy === 'close' && _this5.maxClosureCausesWait) { + // Check for the last closed notice and re-open it. + _this5.forEach(open, { + start: notice, + dir: 'older' + }); + + if (!done) { + _this5.forEach(open, { + start: notice, + dir: 'newer' + }); + } + } + } + + if (_this5._openNotices <= 0) { + _this5._openNotices = 0; + + _this5._resetPositionData(); + + if (_this5._overlayOpen && !_this5._swapping) { + _this5._removeOverlay(); + } + } else if (!_this5._collapsingModalState) { + _this5.queuePosition(0); + } + + _this5.fire('afterCloseNotice', { + notice: notice + }); + }; // This is the linked list node. + + + var node = { + notice: notice, + prev: null, + next: null, + beforeOpenOff: notice.on('pnotify:beforeOpen', handleNoticeOpen), + afterCloseOff: notice.on('pnotify:afterClose', handleNoticeClosed) + }; // Push to the correct side of the linked list. + + if (this.push === 'top') { + node.next = this._noticeHead.next; + node.prev = this._noticeHead; + node.next.prev = node; + node.prev.next = node; + } else { + node.prev = this._noticeTail.prev; + node.next = this._noticeTail; + node.prev.next = node; + node.next.prev = node; + } // Add to the map. + + + this._noticeMap.set(notice, node); // Increment the length to match. + + + this._length++; + + if (!this._listener) { + this._listener = function () { + return _this5.position(); + }; + + this.context.addEventListener('pnotify:position', this._listener); + } + + if (['open', 'opening', 'closing'].indexOf(notice.getState()) !== -1) { + // If the notice is already open, handle it immediately. + handleNoticeOpen(); + } else if (this.modal === 'ish' && this.modalishFlash && this._shouldNoticeWait(notice)) { + // If it's not open, and it's going to be a waiting notice, flash it. + var off = notice.on('pnotify:mount', function () { + off(); + + notice._setMasking(true, false, function () { + notice._setMasking(false); + }); + + _this5._resetPositionData(); + + _this5._positionNotice(_this5._leader); + + window.requestAnimationFrame(function () { + _this5._positionNotice(notice, true); + }); + }); + } + + this.fire('afterAddNotice', { + notice: notice + }); + } + }, { + key: "_removeNotice", + value: function _removeNotice(notice) { + if (!this._noticeMap.has(notice)) { + return; + } + + this.fire('beforeRemoveNotice', { + notice: notice + }); + + var node = this._noticeMap.get(notice); + + if (this._leader === notice) { + // Clear the leader. + this._setLeader(null); + } + + if (this._masking === notice) { + // Clear masking. + this._setMasking(null); + } // Remove the notice from the linked list. + + + node.prev.next = node.next; + node.next.prev = node.prev; + node.prev = null; + node.next = null; + node.beforeOpenOff(); + node.beforeOpenOff = null; + node.afterCloseOff(); + node.afterCloseOff = null; // Remove the notice from the map. + + this._noticeMap["delete"](notice); // Reduce the length to match. + + + this._length--; + + if (!this._length && this._listener) { + // Remove the listener. + this.context.removeEventListener('pnotify:position', this._listener); + this._listener = null; + } + + if (!this._length && this._overlayOpen) { + this._removeOverlay(); + } // If the notice is open, handle it as if it had closed. + + + if (['open', 'opening', 'closing'].indexOf(notice.getState()) !== -1) { + this._handleNoticeClosed(notice); + } + + this.fire('afterRemoveNotice', { + notice: notice + }); + } + }, { + key: "_setLeader", + value: function _setLeader(leader) { + var _this6 = this; + + this.fire('beforeSetLeader', { + leader: leader + }); + + if (this._leaderOff) { + this._leaderOff(); + + this._leaderOff = null; + } + + this._leader = leader; + + if (!this._leader) { + this.fire('afterSetLeader', { + leader: leader + }); + return; + } // If the mouse enters this notice while it's the leader, then the next + // waiting notice should start masking. + + + var leaderInteraction = function leaderInteraction() { + // This is a workaround for leaving the modal state. + var nextNoticeFromModalState = null; // If the leader is moused over: + + if (_this6._overlayOpen) { + _this6._collapsingModalState = true; + + _this6.forEach(function (notice) { + // Allow the notices to timed close. + notice._preventTimerClose(false); // Close and set to wait any open notices other than the leader. + + + if (notice !== _this6._leader && ['opening', 'open'].indexOf(notice.getState()) !== -1) { + if (!nextNoticeFromModalState) { + nextNoticeFromModalState = notice; + } + + notice.close(notice === nextNoticeFromModalState, false, true); + } + }, { + start: _this6._leader, + dir: 'next', + skipModuleHandled: true + }); // Remove the modal state overlay. + + + _this6._removeOverlay(); + } // Turn off any masking off timer that may still be running. + + + if (maskingOffTimer) { + clearTimeout(maskingOffTimer); + maskingOffTimer = null; + } // Set the next waiting notice to be masking. + + + _this6.forEach(function (notice) { + if (notice === _this6._leader) { + // Skip the leader, and start with the next one. + return; + } // The next notice that is "waiting" is usually fine, but if we're + // leaving the modal state, it will still be "closing" here, so we have + // to work around that. :P + // Also, when coming back from modal state, the notice should + // immediately be masking instead of fading in. + + + if (notice.getState() === 'waiting' || notice === nextNoticeFromModalState) { + _this6._setMasking(notice, !!nextNoticeFromModalState); + + return false; + } + }, { + start: _this6._leader, + dir: 'next', + skipModuleHandled: true + }); + }; // If the mouse leaves this notice while it's the leader, then the next + // waiting notice should stop masking. + + + var maskingOffTimer = null; + + var leaderLeaveInteraction = function leaderLeaveInteraction() { + if (maskingOffTimer) { + clearTimeout(maskingOffTimer); + maskingOffTimer = null; + } // TODO: Something wrong here when you come right back from the modal state. + + + maskingOffTimer = setTimeout(function () { + maskingOffTimer = null; + + _this6._setMasking(null); + }, 750); + }; + + this._leaderOff = function (offs) { + return function () { + return offs.map(function (off) { + return off(); + }); + }; + }([this._leader.on('mouseenter', leaderInteraction), this._leader.on('focusin', leaderInteraction), this._leader.on('mouseleave', leaderLeaveInteraction), this._leader.on('focusout', leaderLeaveInteraction)]); + + this.fire('afterSetLeader', { + leader: leader + }); + } + }, { + key: "_setMasking", + value: function _setMasking(masking, immediate) { + var _this7 = this; + + if (this._masking) { + if (this._masking === masking) { + // Nothing to do. + return; + } + + this._masking._setMasking(false, immediate); + } + + if (this._maskingOff) { + this._maskingOff(); + + this._maskingOff = null; + } + + this._masking = masking; + + if (!this._masking) { + return; + } // Reset the position data and position the leader. + + + this._resetPositionData(); + + if (this._leader) { + this._positionNotice(this._leader); + } // Get this notice ready for positioning. + + + this._masking._setMasking(true, immediate); // Wait for the DOM to update. + + + window.requestAnimationFrame(function () { + if (_this7._masking) { + _this7._positionNotice(_this7._masking); + } + }); + + var maskingInteraction = function maskingInteraction() { + // If the masked notice is moused over or focused, the stack enters the + // modal state, and the notices appear. + if (_this7.modal === 'ish') { + _this7._insertOverlay(); + + _this7._setMasking(null, true); + + _this7.forEach(function (notice) { + // Prevent the notices from timed closing. + notice._preventTimerClose(true); + + if (notice.getState() === 'waiting') { + notice.open(); + } + }, { + start: _this7._leader, + dir: 'next', + skipModuleHandled: true + }); + } + }; + + this._maskingOff = function (offs) { + return function () { + return offs.map(function (off) { + return off(); + }); + }; + }([this._masking.on('mouseenter', maskingInteraction), this._masking.on('focusin', maskingInteraction)]); + } + }, { + key: "_shouldNoticeWait", + value: function _shouldNoticeWait(notice) { + return this._swapping !== notice && !(this.modal === 'ish' && this._overlayOpen) && this.maxOpen !== Infinity && this._openNotices >= this.maxOpen && this.maxStrategy === 'wait'; + } + }, { + key: "_insertOverlay", + value: function _insertOverlay() { + var _this8 = this; + + if (!this._overlay) { + this._overlay = document.createElement('div'); + + this._overlay.classList.add('pnotify-modal-overlay'); + + if (this.dir1) { + this._overlay.classList.add("pnotify-modal-overlay-".concat(this.dir1)); + } + + if (this.overlayClose) { + this._overlay.classList.add('pnotify-modal-overlay-closes'); + } + + if (this.context !== document.body) { + this._overlay.style.height = "".concat(this.context.scrollHeight, "px"); + this._overlay.style.width = "".concat(this.context.scrollWidth, "px"); + } // Close the notices on overlay click. + + + this._overlay.addEventListener('click', function (clickEvent) { + if (_this8.overlayClose) { + _this8.fire('overlayClose', { + clickEvent: clickEvent + }); + + if (clickEvent.defaultPrevented) { + return; + } + + if (_this8._leader) { + // Clear the leader. A new one will be found while closing. + _this8._setLeader(null); + } + + _this8.forEach(function (notice) { + if (['closed', 'closing', 'waiting'].indexOf(notice.getState()) !== -1) { + return; + } + + if (notice.hide || _this8.overlayClosesPinned) { + notice.close(); + } else if (!notice.hide && _this8.modal === 'ish') { + if (_this8._leader) { + notice.close(false, false, true); + } else { + _this8._setLeader(notice); + } + } + }, { + skipModuleHandled: true + }); + + if (_this8._overlayOpen) { + _this8._removeOverlay(); + } + } + }); + } + + if (this._overlay.parentNode !== this.context) { + this.fire('beforeAddOverlay'); + + this._overlay.classList.remove('pnotify-modal-overlay-in'); + + this._overlay = this.context.insertBefore(this._overlay, this.context.firstChild); + this._overlayOpen = true; + this._overlayInserted = true; + window.requestAnimationFrame(function () { + _this8._overlay.classList.add('pnotify-modal-overlay-in'); + + _this8.fire('afterAddOverlay'); + }); + } + + this._collapsingModalState = false; + } + }, { + key: "_removeOverlay", + value: function _removeOverlay() { + var _this9 = this; + + if (this._overlay.parentNode) { + this.fire('beforeRemoveOverlay'); + + this._overlay.classList.remove('pnotify-modal-overlay-in'); + + this._overlayOpen = false; + setTimeout(function () { + _this9._overlayInserted = false; + + if (_this9._overlay.parentNode) { + _this9._overlay.parentNode.removeChild(_this9._overlay); + + _this9.fire('afterRemoveOverlay'); + } + }, 250); + setTimeout(function () { + _this9._collapsingModalState = false; + }, 400); + } + } + }, { + key: "notices", + get: function get() { + var notices = []; + this.forEach(function (notice) { + return notices.push(notice); + }); + return notices; + } + }, { + key: "length", + get: function get() { + return this._length; + } + }, { + key: "leader", + get: function get() { + return this._leader; + } + }]); + + return Stack; + }(); + + var component = function component() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _construct(Core, args); + }; + + function forwardEventsBuilder(component) { + var additionalEvents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + // prettier-ignore + var events = ['focus', 'blur', 'fullscreenchange', 'fullscreenerror', 'scroll', 'cut', 'copy', 'paste', 'keydown', 'keypress', 'keyup', 'auxclick', 'click', 'contextmenu', 'dblclick', 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseover', 'mouseout', 'mouseup', 'pointerlockchange', 'pointerlockerror', 'select', 'wheel', 'drag', 'dragend', 'dragenter', 'dragstart', 'dragleave', 'dragover', 'drop', 'touchcancel', 'touchend', 'touchmove', 'touchstart', 'pointerover', 'pointerenter', 'pointerdown', 'pointermove', 'pointerup', 'pointercancel', 'pointerout', 'pointerleave', 'gotpointercapture', 'lostpointercapture'].concat(_toConsumableArray(additionalEvents)); + + function forward(e) { + bubble(component, e); + } + + return function (node) { + var destructors = []; + + for (var i = 0; i < events.length; i++) { + destructors.push(listen(node, events[i], forward)); + } + + return { + destroy: function destroy() { + for (var _i = 0; _i < destructors.length; _i++) { + destructors[_i](); + } + } + }; + }; + } + + var Map_1 = globals.Map; + + function get_each_context(ctx, list, i) { + var child_ctx = ctx.slice(); + child_ctx[109] = list[i][0]; + child_ctx[110] = list[i][1]; + return child_ctx; + } + + function get_each_context_1(ctx, list, i) { + var child_ctx = ctx.slice(); + child_ctx[109] = list[i][0]; + child_ctx[110] = list[i][1]; + return child_ctx; + } + + function get_each_context_2(ctx, list, i) { + var child_ctx = ctx.slice(); + child_ctx[109] = list[i][0]; + child_ctx[110] = list[i][1]; + return child_ctx; + } + + function get_each_context_3(ctx, list, i) { + var child_ctx = ctx.slice(); + child_ctx[109] = list[i][0]; + child_ctx[110] = list[i][1]; + return child_ctx; + } // (931:4) {#each modulesPrependContainer as [module, options] (module)} + + + function create_each_block_3(key_1, ctx) { + var first; + var switch_instance; + var switch_instance_anchor; + var current; + var switch_instance_spread_levels = [{ + self: + /*self*/ + ctx[42] + }, + /*options*/ + ctx[110]]; + var switch_value = + /*module*/ + ctx[109]["default"]; + + function switch_props(ctx) { + var switch_instance_props = {}; + + for (var i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + + return { + props: switch_instance_props + }; + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + } + + return { + key: key_1, + first: null, + c: function c() { + first = empty(); + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + this.first = first; + }, + m: function m(target, anchor) { + insert(target, first, anchor); + + if (switch_instance) { + mount_component(switch_instance, target, anchor); + } + + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p: function p(ctx, dirty) { + var switch_instance_changes = dirty[1] & + /*self, modulesPrependContainer*/ + 2176 ? get_spread_update(switch_instance_spread_levels, [dirty[1] & + /*self*/ + 2048 && { + self: + /*self*/ + ctx[42] + }, dirty[1] & + /*modulesPrependContainer*/ + 128 && get_spread_object( + /*options*/ + ctx[110])]) : {}; + + if (switch_value !== (switch_value = + /*module*/ + ctx[109]["default"])) { + if (switch_instance) { + group_outros(); + var old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, function () { + destroy_component(old_component, 1); + }); + check_outros(); + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + switch_instance.$set(switch_instance_changes); + } + }, + i: function i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o: function o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d: function d(detaching) { + if (detaching) detach(first); + if (detaching) detach(switch_instance_anchor); + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; + } // (934:4) {#if closer && !_nonBlock} + + + function create_if_block_8(ctx) { + var div; + var span; + var span_class_value; + var div_class_value; + var div_title_value; + var mounted; + var dispose; + return { + c: function c() { + div = element("div"); + span = element("span"); + attr(span, "class", span_class_value = + /*getIcon*/ + ctx[22]("closer")); + attr(div, "class", div_class_value = "pnotify-closer ".concat( + /*getStyle*/ + ctx[21]("closer"), " ").concat((! + /*closerHover*/ + ctx[17] || + /*_interacting*/ + ctx[26]) && ! + /*_masking*/ + ctx[28] ? "" : "pnotify-hidden")); + attr(div, "role", "button"); + attr(div, "tabindex", "0"); + attr(div, "title", div_title_value = + /*labels*/ + ctx[20].close); + }, + m: function m(target, anchor) { + insert(target, div, anchor); + append(div, span); + + if (!mounted) { + dispose = listen(div, "click", + /*click_handler*/ + ctx[81]); + mounted = true; + } + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*closerHover, _interacting, _masking*/ + 335675392 && div_class_value !== (div_class_value = "pnotify-closer ".concat( + /*getStyle*/ + ctx[21]("closer"), " ").concat((! + /*closerHover*/ + ctx[17] || + /*_interacting*/ + ctx[26]) && ! + /*_masking*/ + ctx[28] ? "" : "pnotify-hidden"))) { + attr(div, "class", div_class_value); + } + + if (dirty[0] & + /*labels*/ + 1048576 && div_title_value !== (div_title_value = + /*labels*/ + ctx[20].close)) { + attr(div, "title", div_title_value); + } + }, + d: function d(detaching) { + if (detaching) detach(div); + mounted = false; + dispose(); + } + }; + } // (945:4) {#if sticker && !_nonBlock} + + + function create_if_block_7(ctx) { + var div; + var span; + var span_class_value; + var div_class_value; + var div_aria_pressed_value; + var div_title_value; + var mounted; + var dispose; + return { + c: function c() { + div = element("div"); + span = element("span"); + attr(span, "class", span_class_value = "".concat( + /*getIcon*/ + ctx[22]("sticker"), " ").concat( + /*hide*/ + ctx[3] ? + /*getIcon*/ + ctx[22]("unstuck") : + /*getIcon*/ + ctx[22]("stuck"))); + attr(div, "class", div_class_value = "pnotify-sticker ".concat( + /*getStyle*/ + ctx[21]("sticker"), " ").concat((! + /*stickerHover*/ + ctx[19] || + /*_interacting*/ + ctx[26]) && ! + /*_masking*/ + ctx[28] ? "" : "pnotify-hidden")); + attr(div, "role", "button"); + attr(div, "aria-pressed", div_aria_pressed_value = ! + /*hide*/ + ctx[3]); + attr(div, "tabindex", "0"); + attr(div, "title", div_title_value = + /*hide*/ + ctx[3] ? + /*labels*/ + ctx[20].stick : + /*labels*/ + ctx[20].unstick); + }, + m: function m(target, anchor) { + insert(target, div, anchor); + append(div, span); + + if (!mounted) { + dispose = listen(div, "click", + /*click_handler_1*/ + ctx[82]); + mounted = true; + } + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*hide*/ + 8 && span_class_value !== (span_class_value = "".concat( + /*getIcon*/ + ctx[22]("sticker"), " ").concat( + /*hide*/ + ctx[3] ? + /*getIcon*/ + ctx[22]("unstuck") : + /*getIcon*/ + ctx[22]("stuck")))) { + attr(span, "class", span_class_value); + } + + if (dirty[0] & + /*stickerHover, _interacting, _masking*/ + 336068608 && div_class_value !== (div_class_value = "pnotify-sticker ".concat( + /*getStyle*/ + ctx[21]("sticker"), " ").concat((! + /*stickerHover*/ + ctx[19] || + /*_interacting*/ + ctx[26]) && ! + /*_masking*/ + ctx[28] ? "" : "pnotify-hidden"))) { + attr(div, "class", div_class_value); + } + + if (dirty[0] & + /*hide*/ + 8 && div_aria_pressed_value !== (div_aria_pressed_value = ! + /*hide*/ + ctx[3])) { + attr(div, "aria-pressed", div_aria_pressed_value); + } + + if (dirty[0] & + /*hide, labels*/ + 1048584 && div_title_value !== (div_title_value = + /*hide*/ + ctx[3] ? + /*labels*/ + ctx[20].stick : + /*labels*/ + ctx[20].unstick)) { + attr(div, "title", div_title_value); + } + }, + d: function d(detaching) { + if (detaching) detach(div); + mounted = false; + dispose(); + } + }; + } // (959:4) {#if icon !== false} + + + function create_if_block_6(ctx) { + var div; + var span; + var span_class_value; + var div_class_value; + return { + c: function c() { + div = element("div"); + span = element("span"); + attr(span, "class", span_class_value = + /*icon*/ + ctx[13] === true ? + /*getIcon*/ + ctx[22]( + /*type*/ + ctx[4]) : + /*icon*/ + ctx[13]); + attr(div, "class", div_class_value = "pnotify-icon ".concat( + /*getStyle*/ + ctx[21]("icon"))); + }, + m: function m(target, anchor) { + insert(target, div, anchor); + append(div, span); + /*div_binding*/ + + ctx[83](div); + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*icon, type*/ + 8208 && span_class_value !== (span_class_value = + /*icon*/ + ctx[13] === true ? + /*getIcon*/ + ctx[22]( + /*type*/ + ctx[4]) : + /*icon*/ + ctx[13])) { + attr(span, "class", span_class_value); + } + }, + d: function d(detaching) { + if (detaching) detach(div); + /*div_binding*/ + + ctx[83](null); + } + }; + } // (971:6) {#each modulesPrependContent as [module, options] (module)} + + + function create_each_block_2(key_1, ctx) { + var first; + var switch_instance; + var switch_instance_anchor; + var current; + var switch_instance_spread_levels = [{ + self: + /*self*/ + ctx[42] + }, + /*options*/ + ctx[110]]; + var switch_value = + /*module*/ + ctx[109]["default"]; + + function switch_props(ctx) { + var switch_instance_props = {}; + + for (var i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + + return { + props: switch_instance_props + }; + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + } + + return { + key: key_1, + first: null, + c: function c() { + first = empty(); + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + this.first = first; + }, + m: function m(target, anchor) { + insert(target, first, anchor); + + if (switch_instance) { + mount_component(switch_instance, target, anchor); + } + + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p: function p(ctx, dirty) { + var switch_instance_changes = dirty[1] & + /*self, modulesPrependContent*/ + 2304 ? get_spread_update(switch_instance_spread_levels, [dirty[1] & + /*self*/ + 2048 && { + self: + /*self*/ + ctx[42] + }, dirty[1] & + /*modulesPrependContent*/ + 256 && get_spread_object( + /*options*/ + ctx[110])]) : {}; + + if (switch_value !== (switch_value = + /*module*/ + ctx[109]["default"])) { + if (switch_instance) { + group_outros(); + var old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, function () { + destroy_component(old_component, 1); + }); + check_outros(); + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + switch_instance.$set(switch_instance_changes); + } + }, + i: function i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o: function o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d: function d(detaching) { + if (detaching) detach(first); + if (detaching) detach(switch_instance_anchor); + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; + } // (974:6) {#if title !== false} + + + function create_if_block_3(ctx) { + var div; + var div_class_value; + var if_block = ! + /*_titleElement*/ + ctx[34] && create_if_block_4(ctx); + return { + c: function c() { + div = element("div"); + if (if_block) if_block.c(); + attr(div, "class", div_class_value = "pnotify-title ".concat( + /*getStyle*/ + ctx[21]("title"))); + }, + m: function m(target, anchor) { + insert(target, div, anchor); + if (if_block) if_block.m(div, null); + /*div_binding_1*/ + + ctx[84](div); + }, + p: function p(ctx, dirty) { + if (! + /*_titleElement*/ + ctx[34]) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block_4(ctx); + if_block.c(); + if_block.m(div, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d: function d(detaching) { + if (detaching) detach(div); + if (if_block) if_block.d(); + /*div_binding_1*/ + + ctx[84](null); + } + }; + } // (979:10) {#if !_titleElement} + + + function create_if_block_4(ctx) { + var if_block_anchor; + + function select_block_type(ctx, dirty) { + if ( + /*titleTrusted*/ + ctx[6]) return create_if_block_5; + return create_else_block_1; + } + + var current_block_type = select_block_type(ctx); + var if_block = current_block_type(ctx); + return { + c: function c() { + if_block.c(); + if_block_anchor = empty(); + }, + m: function m(target, anchor) { + if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p: function p(ctx, dirty) { + if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { + if_block.p(ctx, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx); + + if (if_block) { + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } + }, + d: function d(detaching) { + if_block.d(detaching); + if (detaching) detach(if_block_anchor); + } + }; + } // (982:12) {:else} + + + function create_else_block_1(ctx) { + var span; + var t; + return { + c: function c() { + span = element("span"); + t = text( + /*title*/ + ctx[5]); + attr(span, "class", "pnotify-pre-line"); + }, + m: function m(target, anchor) { + insert(target, span, anchor); + append(span, t); + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*title*/ + 32) set_data(t, + /*title*/ + ctx[5]); + }, + d: function d(detaching) { + if (detaching) detach(span); + } + }; + } // (980:12) {#if titleTrusted} + + + function create_if_block_5(ctx) { + var html_tag; + var html_anchor; + return { + c: function c() { + html_anchor = empty(); + html_tag = new HtmlTag(html_anchor); + }, + m: function m(target, anchor) { + html_tag.m( + /*title*/ + ctx[5], target, anchor); + insert(target, html_anchor, anchor); + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*title*/ + 32) html_tag.p( + /*title*/ + ctx[5]); + }, + d: function d(detaching) { + if (detaching) detach(html_anchor); + if (detaching) html_tag.d(); + } + }; + } // (988:6) {#if text !== false} + + + function create_if_block(ctx) { + var div; + var div_class_value; + var if_block = ! + /*_textElement*/ + ctx[35] && create_if_block_1(ctx); + return { + c: function c() { + div = element("div"); + if (if_block) if_block.c(); + attr(div, "class", div_class_value = "pnotify-text ".concat( + /*getStyle*/ + ctx[21]("text"), " ").concat( + /*_maxTextHeightStyle*/ + ctx[33] === "" ? "" : "pnotify-text-with-max-height")); + attr(div, "style", + /*_maxTextHeightStyle*/ + ctx[33]); + attr(div, "role", "alert"); + }, + m: function m(target, anchor) { + insert(target, div, anchor); + if (if_block) if_block.m(div, null); + /*div_binding_2*/ + + ctx[85](div); + }, + p: function p(ctx, dirty) { + if (! + /*_textElement*/ + ctx[35]) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block_1(ctx); + if_block.c(); + if_block.m(div, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + + if (dirty[1] & + /*_maxTextHeightStyle*/ + 4 && div_class_value !== (div_class_value = "pnotify-text ".concat( + /*getStyle*/ + ctx[21]("text"), " ").concat( + /*_maxTextHeightStyle*/ + ctx[33] === "" ? "" : "pnotify-text-with-max-height"))) { + attr(div, "class", div_class_value); + } + + if (dirty[1] & + /*_maxTextHeightStyle*/ + 4) { + attr(div, "style", + /*_maxTextHeightStyle*/ + ctx[33]); + } + }, + d: function d(detaching) { + if (detaching) detach(div); + if (if_block) if_block.d(); + /*div_binding_2*/ + + ctx[85](null); + } + }; + } // (995:10) {#if !_textElement} + + + function create_if_block_1(ctx) { + var if_block_anchor; + + function select_block_type_1(ctx, dirty) { + if ( + /*textTrusted*/ + ctx[8]) return create_if_block_2; + return create_else_block; + } + + var current_block_type = select_block_type_1(ctx); + var if_block = current_block_type(ctx); + return { + c: function c() { + if_block.c(); + if_block_anchor = empty(); + }, + m: function m(target, anchor) { + if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p: function p(ctx, dirty) { + if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block) { + if_block.p(ctx, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx); + + if (if_block) { + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } + }, + d: function d(detaching) { + if_block.d(detaching); + if (detaching) detach(if_block_anchor); + } + }; + } // (998:12) {:else} + + + function create_else_block(ctx) { + var span; + var t; + return { + c: function c() { + span = element("span"); + t = text( + /*text*/ + ctx[7]); + attr(span, "class", "pnotify-pre-line"); + }, + m: function m(target, anchor) { + insert(target, span, anchor); + append(span, t); + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*text*/ + 128) set_data(t, + /*text*/ + ctx[7]); + }, + d: function d(detaching) { + if (detaching) detach(span); + } + }; + } // (996:12) {#if textTrusted} + + + function create_if_block_2(ctx) { + var html_tag; + var html_anchor; + return { + c: function c() { + html_anchor = empty(); + html_tag = new HtmlTag(html_anchor); + }, + m: function m(target, anchor) { + html_tag.m( + /*text*/ + ctx[7], target, anchor); + insert(target, html_anchor, anchor); + }, + p: function p(ctx, dirty) { + if (dirty[0] & + /*text*/ + 128) html_tag.p( + /*text*/ + ctx[7]); + }, + d: function d(detaching) { + if (detaching) detach(html_anchor); + if (detaching) html_tag.d(); + } + }; + } // (1004:6) {#each modulesAppendContent as [module, options] (module)} + + + function create_each_block_1(key_1, ctx) { + var first; + var switch_instance; + var switch_instance_anchor; + var current; + var switch_instance_spread_levels = [{ + self: + /*self*/ + ctx[42] + }, + /*options*/ + ctx[110]]; + var switch_value = + /*module*/ + ctx[109]["default"]; + + function switch_props(ctx) { + var switch_instance_props = {}; + + for (var i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + + return { + props: switch_instance_props + }; + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + } + + return { + key: key_1, + first: null, + c: function c() { + first = empty(); + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + this.first = first; + }, + m: function m(target, anchor) { + insert(target, first, anchor); + + if (switch_instance) { + mount_component(switch_instance, target, anchor); + } + + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p: function p(ctx, dirty) { + var switch_instance_changes = dirty[1] & + /*self, modulesAppendContent*/ + 2560 ? get_spread_update(switch_instance_spread_levels, [dirty[1] & + /*self*/ + 2048 && { + self: + /*self*/ + ctx[42] + }, dirty[1] & + /*modulesAppendContent*/ + 512 && get_spread_object( + /*options*/ + ctx[110])]) : {}; + + if (switch_value !== (switch_value = + /*module*/ + ctx[109]["default"])) { + if (switch_instance) { + group_outros(); + var old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, function () { + destroy_component(old_component, 1); + }); + check_outros(); + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + switch_instance.$set(switch_instance_changes); + } + }, + i: function i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o: function o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d: function d(detaching) { + if (detaching) detach(first); + if (detaching) detach(switch_instance_anchor); + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; + } // (1008:4) {#each modulesAppendContainer as [module, options] (module)} + + + function create_each_block(key_1, ctx) { + var first; + var switch_instance; + var switch_instance_anchor; + var current; + var switch_instance_spread_levels = [{ + self: + /*self*/ + ctx[42] + }, + /*options*/ + ctx[110]]; + var switch_value = + /*module*/ + ctx[109]["default"]; + + function switch_props(ctx) { + var switch_instance_props = {}; + + for (var i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + + return { + props: switch_instance_props + }; + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + } + + return { + key: key_1, + first: null, + c: function c() { + first = empty(); + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + this.first = first; + }, + m: function m(target, anchor) { + insert(target, first, anchor); + + if (switch_instance) { + mount_component(switch_instance, target, anchor); + } + + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p: function p(ctx, dirty) { + var switch_instance_changes = dirty[1] & + /*self, modulesAppendContainer*/ + 3072 ? get_spread_update(switch_instance_spread_levels, [dirty[1] & + /*self*/ + 2048 && { + self: + /*self*/ + ctx[42] + }, dirty[1] & + /*modulesAppendContainer*/ + 1024 && get_spread_object( + /*options*/ + ctx[110])]) : {}; + + if (switch_value !== (switch_value = + /*module*/ + ctx[109]["default"])) { + if (switch_instance) { + group_outros(); + var old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, function () { + destroy_component(old_component, 1); + }); + check_outros(); + } + + if (switch_value) { + switch_instance = new switch_value(switch_props()); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + switch_instance.$set(switch_instance_changes); + } + }, + i: function i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o: function o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d: function d(detaching) { + if (detaching) detach(first); + if (detaching) detach(switch_instance_anchor); + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; + } + + function create_fragment(ctx) { + var div2; + var div1; + var each_blocks_3 = []; + var each0_lookup = new Map_1(); + var t0; + var t1; + var t2; + var t3; + var div0; + var each_blocks_2 = []; + var each1_lookup = new Map_1(); + var t4; + var t5; + var t6; + var each_blocks_1 = []; + var each2_lookup = new Map_1(); + var div0_class_value; + var t7; + var each_blocks = []; + var each3_lookup = new Map_1(); + var div1_class_value; + var div1_style_value; + var div2_class_value; + var forwardEvents_action; + var current; + var mounted; + var dispose; + var each_value_3 = + /*modulesPrependContainer*/ + ctx[38]; + + var get_key = function get_key(ctx) { + return ( + /*module*/ + ctx[109] + ); + }; + + for (var i = 0; i < each_value_3.length; i += 1) { + var child_ctx = get_each_context_3(ctx, each_value_3, i); + var key = get_key(child_ctx); + each0_lookup.set(key, each_blocks_3[i] = create_each_block_3(key, child_ctx)); + } + + var if_block0 = + /*closer*/ + ctx[16] && ! + /*_nonBlock*/ + ctx[36] && create_if_block_8(ctx); + var if_block1 = + /*sticker*/ + ctx[18] && ! + /*_nonBlock*/ + ctx[36] && create_if_block_7(ctx); + var if_block2 = + /*icon*/ + ctx[13] !== false && create_if_block_6(ctx); + var each_value_2 = + /*modulesPrependContent*/ + ctx[39]; + + var get_key_1 = function get_key_1(ctx) { + return ( + /*module*/ + ctx[109] + ); + }; + + for (var _i = 0; _i < each_value_2.length; _i += 1) { + var _child_ctx = get_each_context_2(ctx, each_value_2, _i); + + var _key = get_key_1(_child_ctx); + + each1_lookup.set(_key, each_blocks_2[_i] = create_each_block_2(_key, _child_ctx)); + } + + var if_block3 = + /*title*/ + ctx[5] !== false && create_if_block_3(ctx); + var if_block4 = + /*text*/ + ctx[7] !== false && create_if_block(ctx); + var each_value_1 = + /*modulesAppendContent*/ + ctx[40]; + + var get_key_2 = function get_key_2(ctx) { + return ( + /*module*/ + ctx[109] + ); + }; + + for (var _i2 = 0; _i2 < each_value_1.length; _i2 += 1) { + var _child_ctx2 = get_each_context_1(ctx, each_value_1, _i2); + + var _key2 = get_key_2(_child_ctx2); + + each2_lookup.set(_key2, each_blocks_1[_i2] = create_each_block_1(_key2, _child_ctx2)); + } + + var each_value = + /*modulesAppendContainer*/ + ctx[41]; + + var get_key_3 = function get_key_3(ctx) { + return ( + /*module*/ + ctx[109] + ); + }; + + for (var _i3 = 0; _i3 < each_value.length; _i3 += 1) { + var _child_ctx3 = get_each_context(ctx, each_value, _i3); + + var _key3 = get_key_3(_child_ctx3); + + each3_lookup.set(_key3, each_blocks[_i3] = create_each_block(_key3, _child_ctx3)); + } + + return { + c: function c() { + div2 = element("div"); + div1 = element("div"); + + for (var _i4 = 0; _i4 < each_blocks_3.length; _i4 += 1) { + each_blocks_3[_i4].c(); + } + + t0 = space(); + if (if_block0) if_block0.c(); + t1 = space(); + if (if_block1) if_block1.c(); + t2 = space(); + if (if_block2) if_block2.c(); + t3 = space(); + div0 = element("div"); + + for (var _i5 = 0; _i5 < each_blocks_2.length; _i5 += 1) { + each_blocks_2[_i5].c(); + } + + t4 = space(); + if (if_block3) if_block3.c(); + t5 = space(); + if (if_block4) if_block4.c(); + t6 = space(); + + for (var _i6 = 0; _i6 < each_blocks_1.length; _i6 += 1) { + each_blocks_1[_i6].c(); + } + + t7 = space(); + + for (var _i7 = 0; _i7 < each_blocks.length; _i7 += 1) { + each_blocks[_i7].c(); + } + + attr(div0, "class", div0_class_value = "pnotify-content ".concat( + /*getStyle*/ + ctx[21]("content"))); + attr(div1, "class", div1_class_value = "pnotify-container ".concat( + /*getStyle*/ + ctx[21]("container"), " ").concat( + /*getStyle*/ + ctx[21]( + /*type*/ + ctx[4]), " ").concat( + /*shadow*/ + ctx[15] ? "pnotify-shadow" : "", " ").concat( + /*_moduleClasses*/ + ctx[27].container.join(" "))); + attr(div1, "style", div1_style_value = "".concat( + /*_widthStyle*/ + ctx[31], " ").concat( + /*_minHeightStyle*/ + ctx[32])); + attr(div1, "role", "alert"); + attr(div2, "data-pnotify", ""); + attr(div2, "class", div2_class_value = "pnotify ".concat(! + /*stack*/ + ctx[0] || + /*stack*/ + ctx[0].positioned ? "pnotify-positioned" : "", " ").concat( + /*icon*/ + ctx[13] !== false ? "pnotify-with-icon" : "", " ").concat( + /*getStyle*/ + ctx[21]("elem"), " pnotify-mode-").concat( + /*mode*/ + ctx[9], " ").concat( + /*addClass*/ + ctx[10], " ").concat( + /*_animatingClass*/ + ctx[24], " ").concat( + /*_moveClass*/ + ctx[25], " ").concat( + /*_stackDirClass*/ + ctx[37], " ").concat( + /*animation*/ + ctx[2] === "fade" ? "pnotify-fade-".concat( + /*animateSpeed*/ + ctx[14]) : "", " ").concat( + /*_modal*/ + ctx[30] ? "pnotify-modal ".concat( + /*addModalClass*/ + ctx[11]) : + /*addModelessClass*/ + ctx[12], " ").concat( + /*_masking*/ + ctx[28] ? "pnotify-masking" : "", " ").concat( + /*_maskingIn*/ + ctx[29] ? "pnotify-masking-in" : "", " ").concat( + /*_moduleClasses*/ + ctx[27].elem.join(" "))); + attr(div2, "aria-live", "assertive"); + attr(div2, "role", "alertdialog"); + }, + m: function m(target, anchor) { + insert(target, div2, anchor); + append(div2, div1); + + for (var _i8 = 0; _i8 < each_blocks_3.length; _i8 += 1) { + each_blocks_3[_i8].m(div1, null); + } + + append(div1, t0); + if (if_block0) if_block0.m(div1, null); + append(div1, t1); + if (if_block1) if_block1.m(div1, null); + append(div1, t2); + if (if_block2) if_block2.m(div1, null); + append(div1, t3); + append(div1, div0); + + for (var _i9 = 0; _i9 < each_blocks_2.length; _i9 += 1) { + each_blocks_2[_i9].m(div0, null); + } + + append(div0, t4); + if (if_block3) if_block3.m(div0, null); + append(div0, t5); + if (if_block4) if_block4.m(div0, null); + append(div0, t6); + + for (var _i10 = 0; _i10 < each_blocks_1.length; _i10 += 1) { + each_blocks_1[_i10].m(div0, null); + } + /*div0_binding*/ + + + ctx[86](div0); + append(div1, t7); + + for (var _i11 = 0; _i11 < each_blocks.length; _i11 += 1) { + each_blocks[_i11].m(div1, null); + } + /*div1_binding*/ + + + ctx[87](div1); + /*div2_binding*/ + + ctx[88](div2); + current = true; + + if (!mounted) { + dispose = [action_destroyer(forwardEvents_action = + /*forwardEvents*/ + ctx[43].call(null, div2)), listen(div2, "mouseenter", + /*handleInteraction*/ + ctx[44]), listen(div2, "mouseleave", + /*handleLeaveInteraction*/ + ctx[45]), listen(div2, "focusin", + /*handleInteraction*/ + ctx[44]), listen(div2, "focusout", + /*handleLeaveInteraction*/ + ctx[45])]; + mounted = true; + } + }, + p: function p(ctx, dirty) { + if (dirty[1] & + /*modulesPrependContainer, self*/ + 2176) { + var _each_value_ = + /*modulesPrependContainer*/ + ctx[38]; + group_outros(); + each_blocks_3 = update_keyed_each(each_blocks_3, dirty, get_key, 1, ctx, _each_value_, each0_lookup, div1, outro_and_destroy_block, create_each_block_3, t0, get_each_context_3); + check_outros(); + } + + if ( + /*closer*/ + ctx[16] && ! + /*_nonBlock*/ + ctx[36]) { + if (if_block0) { + if_block0.p(ctx, dirty); + } else { + if_block0 = create_if_block_8(ctx); + if_block0.c(); + if_block0.m(div1, t1); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if ( + /*sticker*/ + ctx[18] && ! + /*_nonBlock*/ + ctx[36]) { + if (if_block1) { + if_block1.p(ctx, dirty); + } else { + if_block1 = create_if_block_7(ctx); + if_block1.c(); + if_block1.m(div1, t2); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + + if ( + /*icon*/ + ctx[13] !== false) { + if (if_block2) { + if_block2.p(ctx, dirty); + } else { + if_block2 = create_if_block_6(ctx); + if_block2.c(); + if_block2.m(div1, t3); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + + if (dirty[1] & + /*modulesPrependContent, self*/ + 2304) { + var _each_value_2 = + /*modulesPrependContent*/ + ctx[39]; + group_outros(); + each_blocks_2 = update_keyed_each(each_blocks_2, dirty, get_key_1, 1, ctx, _each_value_2, each1_lookup, div0, outro_and_destroy_block, create_each_block_2, t4, get_each_context_2); + check_outros(); + } + + if ( + /*title*/ + ctx[5] !== false) { + if (if_block3) { + if_block3.p(ctx, dirty); + } else { + if_block3 = create_if_block_3(ctx); + if_block3.c(); + if_block3.m(div0, t5); + } + } else if (if_block3) { + if_block3.d(1); + if_block3 = null; + } + + if ( + /*text*/ + ctx[7] !== false) { + if (if_block4) { + if_block4.p(ctx, dirty); + } else { + if_block4 = create_if_block(ctx); + if_block4.c(); + if_block4.m(div0, t6); + } + } else if (if_block4) { + if_block4.d(1); + if_block4 = null; + } + + if (dirty[1] & + /*modulesAppendContent, self*/ + 2560) { + var _each_value_3 = + /*modulesAppendContent*/ + ctx[40]; + group_outros(); + each_blocks_1 = update_keyed_each(each_blocks_1, dirty, get_key_2, 1, ctx, _each_value_3, each2_lookup, div0, outro_and_destroy_block, create_each_block_1, null, get_each_context_1); + check_outros(); + } + + if (dirty[1] & + /*modulesAppendContainer, self*/ + 3072) { + var _each_value = + /*modulesAppendContainer*/ + ctx[41]; + group_outros(); + each_blocks = update_keyed_each(each_blocks, dirty, get_key_3, 1, ctx, _each_value, each3_lookup, div1, outro_and_destroy_block, create_each_block, null, get_each_context); + check_outros(); + } + + if (!current || dirty[0] & + /*type, shadow, _moduleClasses*/ + 134250512 && div1_class_value !== (div1_class_value = "pnotify-container ".concat( + /*getStyle*/ + ctx[21]("container"), " ").concat( + /*getStyle*/ + ctx[21]( + /*type*/ + ctx[4]), " ").concat( + /*shadow*/ + ctx[15] ? "pnotify-shadow" : "", " ").concat( + /*_moduleClasses*/ + ctx[27].container.join(" ")))) { + attr(div1, "class", div1_class_value); + } + + if (!current || dirty[1] & + /*_widthStyle, _minHeightStyle*/ + 3 && div1_style_value !== (div1_style_value = "".concat( + /*_widthStyle*/ + ctx[31], " ").concat( + /*_minHeightStyle*/ + ctx[32]))) { + attr(div1, "style", div1_style_value); + } + + if (!current || dirty[0] & + /*stack, icon, mode, addClass, _animatingClass, _moveClass, animation, animateSpeed, _modal, addModalClass, addModelessClass, _masking, _maskingIn, _moduleClasses*/ + 2063629829 | dirty[1] & + /*_stackDirClass*/ + 64 && div2_class_value !== (div2_class_value = "pnotify ".concat(! + /*stack*/ + ctx[0] || + /*stack*/ + ctx[0].positioned ? "pnotify-positioned" : "", " ").concat( + /*icon*/ + ctx[13] !== false ? "pnotify-with-icon" : "", " ").concat( + /*getStyle*/ + ctx[21]("elem"), " pnotify-mode-").concat( + /*mode*/ + ctx[9], " ").concat( + /*addClass*/ + ctx[10], " ").concat( + /*_animatingClass*/ + ctx[24], " ").concat( + /*_moveClass*/ + ctx[25], " ").concat( + /*_stackDirClass*/ + ctx[37], " ").concat( + /*animation*/ + ctx[2] === "fade" ? "pnotify-fade-".concat( + /*animateSpeed*/ + ctx[14]) : "", " ").concat( + /*_modal*/ + ctx[30] ? "pnotify-modal ".concat( + /*addModalClass*/ + ctx[11]) : + /*addModelessClass*/ + ctx[12], " ").concat( + /*_masking*/ + ctx[28] ? "pnotify-masking" : "", " ").concat( + /*_maskingIn*/ + ctx[29] ? "pnotify-masking-in" : "", " ").concat( + /*_moduleClasses*/ + ctx[27].elem.join(" ")))) { + attr(div2, "class", div2_class_value); + } + }, + i: function i(local) { + if (current) return; + + for (var _i12 = 0; _i12 < each_value_3.length; _i12 += 1) { + transition_in(each_blocks_3[_i12]); + } + + for (var _i13 = 0; _i13 < each_value_2.length; _i13 += 1) { + transition_in(each_blocks_2[_i13]); + } + + for (var _i14 = 0; _i14 < each_value_1.length; _i14 += 1) { + transition_in(each_blocks_1[_i14]); + } + + for (var _i15 = 0; _i15 < each_value.length; _i15 += 1) { + transition_in(each_blocks[_i15]); + } + + current = true; + }, + o: function o(local) { + for (var _i16 = 0; _i16 < each_blocks_3.length; _i16 += 1) { + transition_out(each_blocks_3[_i16]); + } + + for (var _i17 = 0; _i17 < each_blocks_2.length; _i17 += 1) { + transition_out(each_blocks_2[_i17]); + } + + for (var _i18 = 0; _i18 < each_blocks_1.length; _i18 += 1) { + transition_out(each_blocks_1[_i18]); + } + + for (var _i19 = 0; _i19 < each_blocks.length; _i19 += 1) { + transition_out(each_blocks[_i19]); + } + + current = false; + }, + d: function d(detaching) { + if (detaching) detach(div2); + + for (var _i20 = 0; _i20 < each_blocks_3.length; _i20 += 1) { + each_blocks_3[_i20].d(); + } + + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + if (if_block2) if_block2.d(); + + for (var _i21 = 0; _i21 < each_blocks_2.length; _i21 += 1) { + each_blocks_2[_i21].d(); + } + + if (if_block3) if_block3.d(); + if (if_block4) if_block4.d(); + + for (var _i22 = 0; _i22 < each_blocks_1.length; _i22 += 1) { + each_blocks_1[_i22].d(); + } + /*div0_binding*/ + + + ctx[86](null); + + for (var _i23 = 0; _i23 < each_blocks.length; _i23 += 1) { + each_blocks[_i23].d(); + } + /*div1_binding*/ + + + ctx[87](null); + /*div2_binding*/ + + ctx[88](null); + mounted = false; + run_all(dispose); + } + }; + } + + var alert = function alert(options) { + return component(getDefaultArgs(options)); + }; + + var notice = function notice(options) { + return component(getDefaultArgs(options, "notice")); + }; + + var info = function info(options) { + return component(getDefaultArgs(options, "info")); + }; + + var success = function success(options) { + return component(getDefaultArgs(options, "success")); + }; + + var error = function error(options) { + return component(getDefaultArgs(options, "error")); + }; // Default arguments for the new notice helper functions. + + + function getDefaultArgs(options, type) { + if (_typeof(options) !== "object") { + options = { + text: options + }; + } // Only assign the type if it was requested, so we don't overwrite + // options.type if it has something assigned. + + + if (type) { + options.type = type; + } + + var target = document.body; + + if ("stack" in options && options.stack && options.stack.context) { + target = options.stack.context; + } + + return { + target: target, + props: options + }; + } + + var defaultStack = new Stack({ + dir1: "down", + dir2: "left", + firstpos1: 25, + firstpos2: 25, + spacing1: 36, + spacing2: 36, + push: "bottom" + }); + var defaultModules = new Map(); + var defaults = { + type: "notice", + title: false, + titleTrusted: false, + text: false, + textTrusted: false, + styling: "brighttheme", + icons: "brighttheme", + mode: "no-preference", + addClass: "", + addModalClass: "", + addModelessClass: "", + autoOpen: true, + width: "360px", + minHeight: "16px", + maxTextHeight: "200px", + icon: true, + animation: "fade", + animateSpeed: "normal", + shadow: true, + hide: true, + delay: 8000, + mouseReset: true, + closer: true, + closerHover: true, + sticker: true, + stickerHover: true, + labels: { + close: "Close", + stick: "Pin", + unstick: "Unpin" + }, + remove: true, + destroy: true, + stack: defaultStack, + modules: defaultModules + }; + var posTimer; // These actions need to be done once the DOM is ready. + + function onDocumentLoaded() { + if (!defaultStack.context) { + defaultStack.context = document.body; + } // Reposition the notices when the window resizes. + + + window.addEventListener("resize", function () { + // This timer is used for queueing the position event so it doesn't run + // repeatedly. + if (posTimer) { + clearTimeout(posTimer); + } + + posTimer = setTimeout(function () { + var event = new Event("pnotify:position"); + document.body.dispatchEvent(event); + posTimer = null; + }, 10); + }); + } // Run the deferred actions once the DOM is ready. + + + if (window && document.body) { + onDocumentLoaded(); + } else { + document.addEventListener("DOMContentLoaded", onDocumentLoaded); + } + + function instance($$self, $$props, $$invalidate) { + var self = get_current_component(); + var dispatch = createEventDispatcher(); + var forwardEvents = forwardEventsBuilder(self, ["pnotify:init", "pnotify:mount", "pnotify:update", "pnotify:beforeOpen", "pnotify:afterOpen", "pnotify:enterModal", "pnotify:leaveModal", "pnotify:beforeClose", "pnotify:afterClose", "pnotify:beforeDestroy", "pnotify:afterDestroy", "focusin", "focusout", "animationend", "transitionend"]); + var _$$props$modules = $$props.modules, + modules = _$$props$modules === void 0 ? new Map(defaults.modules) : _$$props$modules; + var _$$props$stack = $$props.stack, + stack = _$$props$stack === void 0 ? defaults.stack : _$$props$stack; + var refs = { + elem: null, + container: null, + content: null, + iconContainer: null, + titleContainer: null, + textContainer: null + }; // Run init to give a chance for modules to override defaults. + + var selfDefaults = _objectSpread2({}, defaults); + + dispatchLifecycleEvent("init", { + notice: self, + defaults: selfDefaults + }); + var _$$props$type = $$props.type, + type = _$$props$type === void 0 ? selfDefaults.type : _$$props$type; + var _$$props$title = $$props.title, + title = _$$props$title === void 0 ? selfDefaults.title : _$$props$title; + var _$$props$titleTrusted = $$props.titleTrusted, + titleTrusted = _$$props$titleTrusted === void 0 ? selfDefaults.titleTrusted : _$$props$titleTrusted; + var _$$props$text = $$props.text, + text = _$$props$text === void 0 ? selfDefaults.text : _$$props$text; + var _$$props$textTrusted = $$props.textTrusted, + textTrusted = _$$props$textTrusted === void 0 ? selfDefaults.textTrusted : _$$props$textTrusted; + var _$$props$styling = $$props.styling, + styling = _$$props$styling === void 0 ? selfDefaults.styling : _$$props$styling; + var _$$props$icons = $$props.icons, + icons = _$$props$icons === void 0 ? selfDefaults.icons : _$$props$icons; + var _$$props$mode = $$props.mode, + mode = _$$props$mode === void 0 ? selfDefaults.mode : _$$props$mode; + var _$$props$addClass = $$props.addClass, + addClass = _$$props$addClass === void 0 ? selfDefaults.addClass : _$$props$addClass; + var _$$props$addModalClas = $$props.addModalClass, + addModalClass = _$$props$addModalClas === void 0 ? selfDefaults.addModalClass : _$$props$addModalClas; + var _$$props$addModelessC = $$props.addModelessClass, + addModelessClass = _$$props$addModelessC === void 0 ? selfDefaults.addModelessClass : _$$props$addModelessC; + var _$$props$autoOpen = $$props.autoOpen, + autoOpen = _$$props$autoOpen === void 0 ? selfDefaults.autoOpen : _$$props$autoOpen; + var _$$props$width = $$props.width, + width = _$$props$width === void 0 ? selfDefaults.width : _$$props$width; + var _$$props$minHeight = $$props.minHeight, + minHeight = _$$props$minHeight === void 0 ? selfDefaults.minHeight : _$$props$minHeight; + var _$$props$maxTextHeigh = $$props.maxTextHeight, + maxTextHeight = _$$props$maxTextHeigh === void 0 ? selfDefaults.maxTextHeight : _$$props$maxTextHeigh; + var _$$props$icon = $$props.icon, + icon = _$$props$icon === void 0 ? selfDefaults.icon : _$$props$icon; + var _$$props$animation = $$props.animation, + animation = _$$props$animation === void 0 ? selfDefaults.animation : _$$props$animation; + var _$$props$animateSpeed = $$props.animateSpeed, + animateSpeed = _$$props$animateSpeed === void 0 ? selfDefaults.animateSpeed : _$$props$animateSpeed; + var _$$props$shadow = $$props.shadow, + shadow = _$$props$shadow === void 0 ? selfDefaults.shadow : _$$props$shadow; + var _$$props$hide = $$props.hide, + hide = _$$props$hide === void 0 ? selfDefaults.hide : _$$props$hide; + var _$$props$delay = $$props.delay, + delay = _$$props$delay === void 0 ? selfDefaults.delay : _$$props$delay; + var _$$props$mouseReset = $$props.mouseReset, + mouseReset = _$$props$mouseReset === void 0 ? selfDefaults.mouseReset : _$$props$mouseReset; + var _$$props$closer = $$props.closer, + closer = _$$props$closer === void 0 ? selfDefaults.closer : _$$props$closer; + var _$$props$closerHover = $$props.closerHover, + closerHover = _$$props$closerHover === void 0 ? selfDefaults.closerHover : _$$props$closerHover; + var _$$props$sticker = $$props.sticker, + sticker = _$$props$sticker === void 0 ? selfDefaults.sticker : _$$props$sticker; + var _$$props$stickerHover = $$props.stickerHover, + stickerHover = _$$props$stickerHover === void 0 ? selfDefaults.stickerHover : _$$props$stickerHover; + var _$$props$labels = $$props.labels, + labels = _$$props$labels === void 0 ? selfDefaults.labels : _$$props$labels; + var _$$props$remove = $$props.remove, + remove = _$$props$remove === void 0 ? selfDefaults.remove : _$$props$remove; + var _$$props$destroy = $$props.destroy, + destroy = _$$props$destroy === void 0 ? selfDefaults.destroy : _$$props$destroy; // The state can be 'waiting', 'opening', 'open', 'closing', or 'closed'. + + var _state = "closed"; // Auto close timer. + + var _timer = null; // Animation timers. + + var _animInTimer = null; + var _animOutTimer = null; // Stores what is currently being animated (in or out). + + var _animating = false; // Stores the class that adds entry/exit animation effects. + + var _animatingClass = ""; // Stores the class that adds movement animation effects. + + var _moveClass = ""; // Stores whether the notice was hidden by a timer. + + var _timerHide = false; // Whether the mouse is over the notice or the notice is focused. + + var _interacting = false; // Holds classes that modules add for the notice element or container element. + + var _moduleClasses = { + elem: [], + container: [] + }; // Modules that change how the notice displays (causing the notice element to + // not appear) can set these to true to make PNotify handle it correctly. + + var _moduleHandled = false; + var _moduleOpen = false; // The masking control for the second notice in a modalish stack when the + // first notice is hovered. + + var _masking = false; + var _maskingIn = false; + var _maskingTimer = null; // Save the old value of hide, so we can reset the timer if it changes. + + var _oldHide = hide; // Promise that resolves when the notice has opened. + + var _openPromise = null; // Promise that resolved when the notice closes. + + var _closePromise = null; + + var getState = function getState() { + return _state; + }; + + var getTimer = function getTimer() { + return _timer; + }; + + var getStyle = function getStyle(name) { + return typeof styling === "string" ? "".concat(styling, "-").concat(name) : name in styling ? styling[name] : "".concat(styling.prefix, "-").concat(name); + }; + + var getIcon = function getIcon(name) { + return typeof icons === "string" ? "".concat(icons, "-icon-").concat(name) : name in icons ? icons[name] : "".concat(icons.prefix, "-icon-").concat(name); + }; // Whether the notification is in a modal stack (or a modalish stack in modal + // state). + + + var _modal = stack && (stack.modal === true || stack.modal === "ish" && _timer === "prevented"); + + var _oldStack = NaN; + var _stackBeforeAddOverlayOff = null; + var _stackAfterRemoveOverlayOff = null; + onMount(function () { + dispatchLifecycleEvent("mount"); // Display the notice. + + if (autoOpen) { + open()["catch"](function () {}); + } + }); + beforeUpdate(function () { + dispatchLifecycleEvent("update"); // Update the timed hiding. + + if (_state !== "closed" && _state !== "waiting" && hide !== _oldHide) { + if (!hide) { + cancelClose(); + } else if (!_oldHide) { + queueClose(); + } + } // Queue a position + + + if (_state !== "closed" && _state !== "closing" && stack && !stack._collapsingModalState) { + stack.queuePosition(); + } // Save old options. + + + _oldHide = hide; + }); + + function handleInteraction(e) { + $$invalidate(26, _interacting = true); // Stop animation, reset the removal timer when the user interacts. + + if (mouseReset && _state === "closing") { + if (!_timerHide) { + return; + } + + cancelClose(); + } // Stop the close timer. + + + if (hide && mouseReset) { + cancelClose(); + } + } + + function handleLeaveInteraction(e) { + $$invalidate(26, _interacting = false); // Start the close timer. + + if (hide && mouseReset && _animating !== "out" && ["open", "opening"].indexOf(_state) !== -1) { + queueClose(); + } + } // This runs an event on all the modules. + + + function dispatchLifecycleEvent(event) { + var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var eventDetail = _objectSpread2({ + notice: self + }, detail); + + if (event === "init") { + Array.from(modules).forEach(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + module = _ref2[0], + options = _ref2[1]; + + return "init" in module && module.init(eventDetail); + }); + } + + var target = refs.elem || stack && stack.context || document.body; + + if (!target) { + dispatch("pnotify:".concat(event), eventDetail); + return true; + } + + var eventObj = new Event("pnotify:".concat(event), { + bubbles: event === "init" || event === "mount", + cancelable: event.startsWith("before") + }); + eventObj.detail = eventDetail; + target.dispatchEvent(eventObj); + return !eventObj.defaultPrevented; + } + + function insertIntoDOM() { + // If the notice is not in the DOM, or in the wrong context, append it. + var target = stack && stack.context || document.body; + + if (!target) { + throw new Error("No context to insert this notice into."); + } + + if (!refs.elem) { + throw new Error("Trying to insert notice before element is available."); + } + + if (refs.elem.parentNode !== target) { + target.appendChild(refs.elem); + } + } + + function removeFromDOM() { + refs.elem && refs.elem.parentNode.removeChild(refs.elem); + } + + var _$$props$open = $$props.open, + open = _$$props$open === void 0 ? function (immediate) { + if (_state === "opening") { + return _openPromise; + } + + if (_state === "open") { + if (hide) { + queueClose(); + } + + return Promise.resolve(); + } + + if (!_moduleHandled && stack && stack._shouldNoticeWait(self)) { + _state = "waiting"; + return Promise.reject(); + } + + if (!dispatchLifecycleEvent("beforeOpen", { + immediate: immediate + })) { + return Promise.reject(); + } + + _state = "opening"; + $$invalidate(28, _masking = false); // This makes the notice visibity: hidden; so its dimensions can be + // determined. + + $$invalidate(24, _animatingClass = "pnotify-initial pnotify-hidden"); + var resolve; + var reject; + var promise = new Promise(function (res, rej) { + resolve = res; + reject = rej; + }); + _openPromise = promise; + + var afterOpenCallback = function afterOpenCallback() { + // Now set it to hide. + if (hide) { + queueClose(); + } + + _state = "open"; + dispatchLifecycleEvent("afterOpen", { + immediate: immediate + }); + _openPromise = null; + resolve(); + }; + + if (_moduleOpen) { + afterOpenCallback(); + return Promise.resolve(); + } + + insertIntoDOM(); // Wait until the DOM is updated. + + window.requestAnimationFrame(function () { + if (_state !== "opening") { + reject(); + _openPromise = null; + return; + } + + if (stack) { + // Mark the stack so it won't animate the new notice. + $$invalidate(0, stack._animation = false, stack); + + if (stack.push === "top") { + // Reset the position data so the notice is positioned as the first + // notice. + stack._resetPositionData(); + } // Now position the stack's the notices. + + + stack._positionNotice(self); + + stack.queuePosition(0); // Reset animation. + + $$invalidate(0, stack._animation = true, stack); + } + + animateIn(afterOpenCallback, immediate); + }); + return promise; + } : _$$props$open; + var _$$props$close = $$props.close, + close = _$$props$close === void 0 ? function (immediate, timerHide, waitAfterward) { + if (_state === "closing") { + return _closePromise; + } + + if (_state === "closed") { + return Promise.resolve(); + } + + var runDestroy = function runDestroy() { + if (!dispatchLifecycleEvent("beforeDestroy")) { + return; + } + + if (stack) { + stack._removeNotice(self); + } + + self.$destroy(); + dispatchLifecycleEvent("afterDestroy"); + }; + + if (_state === "waiting") { + if (waitAfterward) { + return Promise.resolve(); + } + + _state = "closed"; // It's debatable whether the notice should be destroyed in this case, but + // I'm going to go ahead and say yes. + + if (destroy && !waitAfterward) { + runDestroy(); + } + + return Promise.resolve(); + } + + if (!dispatchLifecycleEvent("beforeClose", { + immediate: immediate, + timerHide: timerHide, + waitAfterward: waitAfterward + })) { + return Promise.reject(); + } + + _state = "closing"; + _timerHide = !!timerHide; // Make sure it's a boolean. + + if (_timer && _timer !== "prevented" && clearTimeout) { + clearTimeout(_timer); + } + + _timer = null; + var resolve; + var promise = new Promise(function (res, rej) { + resolve = res; + }); + _closePromise = promise; + animateOut(function () { + $$invalidate(26, _interacting = false); + _timerHide = false; + _state = waitAfterward ? "waiting" : "closed"; + dispatchLifecycleEvent("afterClose", { + immediate: immediate, + timerHide: timerHide, + waitAfterward: waitAfterward + }); + _closePromise = null; + resolve(); + + if (!waitAfterward) { + if (destroy) { + // If we're supposed to destroy the notice, run the destroy module + // events, remove from stack, and let Svelte handle DOM removal. + runDestroy(); + } else if (remove) { + // If we're supposed to remove the notice from the DOM, do it. + removeFromDOM(); + } + } + }, immediate); + return promise; + } : _$$props$close; + var _$$props$animateIn = $$props.animateIn, + animateIn = _$$props$animateIn === void 0 ? function (callback, immediate) { + // Declare that the notice is animating in. + _animating = "in"; + + var finished = function finished(event) { + if (event && refs.elem && event.target !== refs.elem) { + return; + } + + refs.elem && refs.elem.removeEventListener("transitionend", finished); + + if (_animInTimer) { + clearTimeout(_animInTimer); + } + + if (_animating !== "in") { + return; + } + + var visible = _moduleOpen; + + if (!visible && refs.elem) { + var domRect = refs.elem.getBoundingClientRect(); + + for (var prop in domRect) { + if (domRect[prop] > 0) { + visible = true; + break; + } + } + } + + if (visible) { + if (callback) { + callback.call(); + } // Declare that the notice has completed animating. + + + _animating = false; + } else { + _animInTimer = setTimeout(finished, 40); + } + }; + + if (animation === "fade" && !immediate) { + refs.elem && refs.elem.addEventListener("transitionend", finished); + $$invalidate(24, _animatingClass = "pnotify-in"); + tick().then(function () { + $$invalidate(24, _animatingClass = "pnotify-in pnotify-fade-in"); // Just in case the event doesn't fire, call it after 650 ms. + + _animInTimer = setTimeout(finished, 650); + }); + } else { + var _animation = animation; + $$invalidate(2, animation = "none"); + $$invalidate(24, _animatingClass = "pnotify-in ".concat(_animation === "fade" ? "pnotify-fade-in" : "")); + tick().then(function () { + $$invalidate(2, animation = _animation); + finished(); + }); + } + } : _$$props$animateIn; + var _$$props$animateOut = $$props.animateOut, + animateOut = _$$props$animateOut === void 0 ? function (callback, immediate) { + // Declare that the notice is animating out. + _animating = "out"; + + var finished = function finished(event) { + if (event && refs.elem && event.target !== refs.elem) { + return; + } + + refs.elem && refs.elem.removeEventListener("transitionend", finished); + + if (_animOutTimer) { + clearTimeout(_animOutTimer); + } + + if (_animating !== "out") { + return; + } + + var visible = _moduleOpen; + + if (!visible && refs.elem) { + var domRect = refs.elem.getBoundingClientRect(); + + for (var prop in domRect) { + if (domRect[prop] > 0) { + visible = true; + break; + } + } + } + + if (!refs.elem || !refs.elem.style.opacity || refs.elem.style.opacity === "0" || !visible) { + $$invalidate(24, _animatingClass = ""); + + if (callback) { + callback.call(); + } // Declare that the notice has completed animating. + + + _animating = false; + } else { + // In case this was called before the notice finished animating. + _animOutTimer = setTimeout(finished, 40); + } + }; + + if (animation === "fade" && !immediate) { + refs.elem && refs.elem.addEventListener("transitionend", finished); + $$invalidate(24, _animatingClass = "pnotify-in"); // Just in case the event doesn't fire, call it after 650 ms. + + _animOutTimer = setTimeout(finished, 650); + } else { + $$invalidate(24, _animatingClass = ""); + tick().then(function () { + finished(); + }); + } + } : _$$props$animateOut; + + function cancelClose() { + if (_timer && _timer !== "prevented") { + clearTimeout(_timer); + _timer = null; + } + + if (_animOutTimer) { + clearTimeout(_animOutTimer); + } + + if (_state === "closing") { + // If it's animating out, stop it. + _state = "open"; + _animating = false; + $$invalidate(24, _animatingClass = animation === "fade" ? "pnotify-in pnotify-fade-in" : "pnotify-in"); + } + } + + function queueClose() { + if (_timer === "prevented") { + return; + } // Cancel any current close timer. + + + cancelClose(); + + if (delay !== Infinity) { + _timer = setTimeout(function () { + return close(false, true); + }, isNaN(delay) ? 0 : delay); + } + } + + function _preventTimerClose(prevent) { + if (prevent) { + cancelClose(); + _timer = "prevented"; + } else if (_timer === "prevented") { + _timer = null; + + if (_state === "open" && hide) { + queueClose(); + } + } + } + + function on() { + return self.$on.apply(self, arguments); + } + + function update() { + return self.$set.apply(self, arguments); + } + + function fire(name, detail) { + dispatch(name, detail); + } + + function addModuleClass(element) { + for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) { + var className = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1]; + + if (_moduleClasses[element].indexOf(className) === -1) { + _moduleClasses[element].push(className); + } + } + + $$invalidate(27, _moduleClasses); + } + + function removeModuleClass(element) { + for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) { + var className = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1]; + + var idx = _moduleClasses[element].indexOf(className); + + if (idx !== -1) { + _moduleClasses[element].splice(idx, 1); + } + } + + $$invalidate(27, _moduleClasses); + } + + function hasModuleClass(element) { + for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) { + var className = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1]; + + if (_moduleClasses[element].indexOf(className) === -1) { + return false; + } + } + + return true; + } + + function getModuleHandled() { + return _moduleHandled; + } + + function setModuleHandled(value) { + return _moduleHandled = value; + } + + function getModuleOpen() { + return _moduleOpen; + } + + function setModuleOpen(value) { + return _moduleOpen = value; + } + + function setAnimating(value) { + return _animating = value; + } + + function getAnimatingClass() { + return _animatingClass; + } + + function setAnimatingClass(value) { + return $$invalidate(24, _animatingClass = value); + } + + function _getMoveClass() { + return _moveClass; + } + + function _setMoveClass(value) { + return $$invalidate(25, _moveClass = value); + } + + function _setMasking(value, immediate, callback) { + if (_maskingTimer) { + clearTimeout(_maskingTimer); + } + + if (_masking === value) { + return; + } + + if (value) { + $$invalidate(28, _masking = true); + $$invalidate(29, _maskingIn = !!immediate); + insertIntoDOM(); + tick().then(function () { + window.requestAnimationFrame(function () { + if (_masking) { + if (immediate && callback) { + callback(); + } else { + $$invalidate(29, _maskingIn = true); + + var finished = function finished() { + refs.elem && refs.elem.removeEventListener("transitionend", finished); + + if (_maskingTimer) { + clearTimeout(_maskingTimer); + } + + if (_maskingIn && callback) { + callback(); + } + }; + + refs.elem && refs.elem.addEventListener("transitionend", finished); + _maskingTimer = setTimeout(finished, 650); + } + } + }); + }); + } else if (immediate) { + $$invalidate(28, _masking = false); + $$invalidate(29, _maskingIn = false); + + if (remove && ["open", "opening", "closing"].indexOf(_state) === -1) { + removeFromDOM(); + } + + if (callback) { + callback(); + } + } else { + var finished = function finished() { + refs.elem && refs.elem.removeEventListener("transitionend", finished); + + if (_maskingTimer) { + clearTimeout(_maskingTimer); + } + + if (!_maskingIn) { + $$invalidate(28, _masking = false); + + if (remove && ["open", "opening", "closing"].indexOf(_state) === -1) { + removeFromDOM(); + } + + if (callback) { + callback(); + } + } + }; + + $$invalidate(29, _maskingIn = false); + refs.elem && refs.elem.addEventListener("transitionend", finished); + refs.elem && refs.elem.style.opacity; // This line is necessary for some reason. Some notices don't fade without it. + // Just in case the event doesn't fire, call it after 650 ms. + + _maskingTimer = setTimeout(finished, 650); + } + } + + var click_handler = function click_handler() { + return close(false); + }; + + var click_handler_1 = function click_handler_1() { + return $$invalidate(3, hide = !hide); + }; + + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + refs.iconContainer = $$value; + $$invalidate(1, refs); + }); + } + + function div_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + refs.titleContainer = $$value; + $$invalidate(1, refs); + }); + } + + function div_binding_2($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + refs.textContainer = $$value; + $$invalidate(1, refs); + }); + } + + function div0_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + refs.content = $$value; + $$invalidate(1, refs); + }); + } + + function div1_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + refs.container = $$value; + $$invalidate(1, refs); + }); + } + + function div2_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + refs.elem = $$value; + $$invalidate(1, refs); + }); + } + + $$self.$$set = function ($$props) { + if ("modules" in $$props) $$invalidate(46, modules = $$props.modules); + if ("stack" in $$props) $$invalidate(0, stack = $$props.stack); + if ("type" in $$props) $$invalidate(4, type = $$props.type); + if ("title" in $$props) $$invalidate(5, title = $$props.title); + if ("titleTrusted" in $$props) $$invalidate(6, titleTrusted = $$props.titleTrusted); + if ("text" in $$props) $$invalidate(7, text = $$props.text); + if ("textTrusted" in $$props) $$invalidate(8, textTrusted = $$props.textTrusted); + if ("styling" in $$props) $$invalidate(47, styling = $$props.styling); + if ("icons" in $$props) $$invalidate(48, icons = $$props.icons); + if ("mode" in $$props) $$invalidate(9, mode = $$props.mode); + if ("addClass" in $$props) $$invalidate(10, addClass = $$props.addClass); + if ("addModalClass" in $$props) $$invalidate(11, addModalClass = $$props.addModalClass); + if ("addModelessClass" in $$props) $$invalidate(12, addModelessClass = $$props.addModelessClass); + if ("autoOpen" in $$props) $$invalidate(49, autoOpen = $$props.autoOpen); + if ("width" in $$props) $$invalidate(50, width = $$props.width); + if ("minHeight" in $$props) $$invalidate(51, minHeight = $$props.minHeight); + if ("maxTextHeight" in $$props) $$invalidate(52, maxTextHeight = $$props.maxTextHeight); + if ("icon" in $$props) $$invalidate(13, icon = $$props.icon); + if ("animation" in $$props) $$invalidate(2, animation = $$props.animation); + if ("animateSpeed" in $$props) $$invalidate(14, animateSpeed = $$props.animateSpeed); + if ("shadow" in $$props) $$invalidate(15, shadow = $$props.shadow); + if ("hide" in $$props) $$invalidate(3, hide = $$props.hide); + if ("delay" in $$props) $$invalidate(53, delay = $$props.delay); + if ("mouseReset" in $$props) $$invalidate(54, mouseReset = $$props.mouseReset); + if ("closer" in $$props) $$invalidate(16, closer = $$props.closer); + if ("closerHover" in $$props) $$invalidate(17, closerHover = $$props.closerHover); + if ("sticker" in $$props) $$invalidate(18, sticker = $$props.sticker); + if ("stickerHover" in $$props) $$invalidate(19, stickerHover = $$props.stickerHover); + if ("labels" in $$props) $$invalidate(20, labels = $$props.labels); + if ("remove" in $$props) $$invalidate(55, remove = $$props.remove); + if ("destroy" in $$props) $$invalidate(56, destroy = $$props.destroy); + if ("open" in $$props) $$invalidate(59, open = $$props.open); + if ("close" in $$props) $$invalidate(23, close = $$props.close); + if ("animateIn" in $$props) $$invalidate(60, animateIn = $$props.animateIn); + if ("animateOut" in $$props) $$invalidate(61, animateOut = $$props.animateOut); + }; + + var _widthStyle; + + var _minHeightStyle; + + var _maxTextHeightStyle; + + var _titleElement; + + var _textElement; + + var _nonBlock; + + var _stackDirClass; + + var modulesPrependContainer; + var modulesPrependContent; + var modulesAppendContent; + var modulesAppendContainer; + + $$self.$$.update = function () { + if ($$self.$$.dirty[1] & + /*width*/ + 524288) { + // Grab the icons from the icons object or use provided icons + $$invalidate(31, _widthStyle = typeof width === "string" ? "width: ".concat(width, ";") : ""); + } + + if ($$self.$$.dirty[1] & + /*minHeight*/ + 1048576) { + $$invalidate(32, _minHeightStyle = typeof minHeight === "string" ? "min-height: ".concat(minHeight, ";") : ""); + } + + if ($$self.$$.dirty[1] & + /*maxTextHeight*/ + 2097152) { + $$invalidate(33, _maxTextHeightStyle = typeof maxTextHeight === "string" ? "max-height: ".concat(maxTextHeight, ";") : ""); + } + + if ($$self.$$.dirty[0] & + /*title*/ + 32) { + $$invalidate(34, _titleElement = title instanceof HTMLElement); + } + + if ($$self.$$.dirty[0] & + /*text*/ + 128) { + $$invalidate(35, _textElement = text instanceof HTMLElement); + } + + if ($$self.$$.dirty[0] & + /*stack*/ + 1 | $$self.$$.dirty[3] & + /*_oldStack, _stackBeforeAddOverlayOff, _stackAfterRemoveOverlayOff*/ + 1792) { + if (_oldStack !== stack) { + if (_oldStack) { + // Remove the notice from the old stack. + _oldStack._removeNotice(self); // Remove the listeners. + + + $$invalidate(30, _modal = false); + + _stackBeforeAddOverlayOff(); + + _stackAfterRemoveOverlayOff(); + } + + if (stack) { + // Add the notice to the stack. + stack._addNotice(self); // Add listeners for modal state. + + + $$invalidate(102, _stackBeforeAddOverlayOff = stack.on("beforeAddOverlay", function () { + $$invalidate(30, _modal = true); + dispatchLifecycleEvent("enterModal"); + })); + $$invalidate(103, _stackAfterRemoveOverlayOff = stack.on("afterRemoveOverlay", function () { + $$invalidate(30, _modal = false); + dispatchLifecycleEvent("leaveModal"); + })); + } + + $$invalidate(101, _oldStack = stack); + } + } + + if ($$self.$$.dirty[0] & + /*addClass, addModalClass, _modal, addModelessClass*/ + 1073748992) { + $$invalidate(36, _nonBlock = addClass.match(/\bnonblock\b/) || addModalClass.match(/\bnonblock\b/) && _modal || addModelessClass.match(/\bnonblock\b/) && !_modal); + } + + if ($$self.$$.dirty[0] & + /*stack*/ + 1) { + // This is for specific styling for how notices stack. + $$invalidate(37, _stackDirClass = stack && stack.dir1 ? "pnotify-stack-".concat(stack.dir1) : ""); + } + + if ($$self.$$.dirty[1] & + /*modules*/ + 32768) { + // Filter through the module objects, getting an array for each position. + $$invalidate(38, modulesPrependContainer = Array.from(modules).filter(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + module = _ref4[0], + options = _ref4[1]; + + return module.position === "PrependContainer"; + })); + } + + if ($$self.$$.dirty[1] & + /*modules*/ + 32768) { + $$invalidate(39, modulesPrependContent = Array.from(modules).filter(function (_ref5) { + var _ref6 = _slicedToArray(_ref5, 2), + module = _ref6[0], + options = _ref6[1]; + + return module.position === "PrependContent"; + })); + } + + if ($$self.$$.dirty[1] & + /*modules*/ + 32768) { + $$invalidate(40, modulesAppendContent = Array.from(modules).filter(function (_ref7) { + var _ref8 = _slicedToArray(_ref7, 2), + module = _ref8[0], + options = _ref8[1]; + + return module.position === "AppendContent"; + })); + } + + if ($$self.$$.dirty[1] & + /*modules*/ + 32768) { + $$invalidate(41, modulesAppendContainer = Array.from(modules).filter(function (_ref9) { + var _ref10 = _slicedToArray(_ref9, 2), + module = _ref10[0], + options = _ref10[1]; + + return module.position === "AppendContainer"; + })); + } + + if ($$self.$$.dirty[0] & + /*refs, title*/ + 34 | $$self.$$.dirty[1] & + /*_titleElement*/ + 8) { + if (_titleElement && refs.titleContainer) { + refs.titleContainer.appendChild(title); + } + } + + if ($$self.$$.dirty[0] & + /*refs, text*/ + 130 | $$self.$$.dirty[1] & + /*_textElement*/ + 16) { + if (_textElement && refs.textContainer) { + refs.textContainer.appendChild(text); + } + } + }; + + return [stack, refs, animation, hide, type, title, titleTrusted, text, textTrusted, mode, addClass, addModalClass, addModelessClass, icon, animateSpeed, shadow, closer, closerHover, sticker, stickerHover, labels, getStyle, getIcon, close, _animatingClass, _moveClass, _interacting, _moduleClasses, _masking, _maskingIn, _modal, _widthStyle, _minHeightStyle, _maxTextHeightStyle, _titleElement, _textElement, _nonBlock, _stackDirClass, modulesPrependContainer, modulesPrependContent, modulesAppendContent, modulesAppendContainer, self, forwardEvents, handleInteraction, handleLeaveInteraction, modules, styling, icons, autoOpen, width, minHeight, maxTextHeight, delay, mouseReset, remove, destroy, getState, getTimer, open, animateIn, animateOut, cancelClose, queueClose, _preventTimerClose, on, update, fire, addModuleClass, removeModuleClass, hasModuleClass, getModuleHandled, setModuleHandled, getModuleOpen, setModuleOpen, setAnimating, getAnimatingClass, setAnimatingClass, _getMoveClass, _setMoveClass, _setMasking, click_handler, click_handler_1, div_binding, div_binding_1, div_binding_2, div0_binding, div1_binding, div2_binding]; + } + + var Core = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Core, _SvelteComponent); + + var _super = _createSuper(Core); + + function Core(options) { + var _this; + + _classCallCheck(this, Core); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, instance, create_fragment, safe_not_equal, { + modules: 46, + stack: 0, + refs: 1, + type: 4, + title: 5, + titleTrusted: 6, + text: 7, + textTrusted: 8, + styling: 47, + icons: 48, + mode: 9, + addClass: 10, + addModalClass: 11, + addModelessClass: 12, + autoOpen: 49, + width: 50, + minHeight: 51, + maxTextHeight: 52, + icon: 13, + animation: 2, + animateSpeed: 14, + shadow: 15, + hide: 3, + delay: 53, + mouseReset: 54, + closer: 16, + closerHover: 17, + sticker: 18, + stickerHover: 19, + labels: 20, + remove: 55, + destroy: 56, + getState: 57, + getTimer: 58, + getStyle: 21, + getIcon: 22, + open: 59, + close: 23, + animateIn: 60, + animateOut: 61, + cancelClose: 62, + queueClose: 63, + _preventTimerClose: 64, + on: 65, + update: 66, + fire: 67, + addModuleClass: 68, + removeModuleClass: 69, + hasModuleClass: 70, + getModuleHandled: 71, + setModuleHandled: 72, + getModuleOpen: 73, + setModuleOpen: 74, + setAnimating: 75, + getAnimatingClass: 76, + setAnimatingClass: 77, + _getMoveClass: 78, + _setMoveClass: 79, + _setMasking: 80 + }, [-1, -1, -1, -1]); + return _this; + } + + _createClass(Core, [{ + key: "modules", + get: function get() { + return this.$$.ctx[46]; + }, + set: function set(modules) { + this.$set({ + modules: modules + }); + flush(); + } + }, { + key: "stack", + get: function get() { + return this.$$.ctx[0]; + }, + set: function set(stack) { + this.$set({ + stack: stack + }); + flush(); + } + }, { + key: "refs", + get: function get() { + return this.$$.ctx[1]; + } + }, { + key: "type", + get: function get() { + return this.$$.ctx[4]; + }, + set: function set(type) { + this.$set({ + type: type + }); + flush(); + } + }, { + key: "title", + get: function get() { + return this.$$.ctx[5]; + }, + set: function set(title) { + this.$set({ + title: title + }); + flush(); + } + }, { + key: "titleTrusted", + get: function get() { + return this.$$.ctx[6]; + }, + set: function set(titleTrusted) { + this.$set({ + titleTrusted: titleTrusted + }); + flush(); + } + }, { + key: "text", + get: function get() { + return this.$$.ctx[7]; + }, + set: function set(text) { + this.$set({ + text: text + }); + flush(); + } + }, { + key: "textTrusted", + get: function get() { + return this.$$.ctx[8]; + }, + set: function set(textTrusted) { + this.$set({ + textTrusted: textTrusted + }); + flush(); + } + }, { + key: "styling", + get: function get() { + return this.$$.ctx[47]; + }, + set: function set(styling) { + this.$set({ + styling: styling + }); + flush(); + } + }, { + key: "icons", + get: function get() { + return this.$$.ctx[48]; + }, + set: function set(icons) { + this.$set({ + icons: icons + }); + flush(); + } + }, { + key: "mode", + get: function get() { + return this.$$.ctx[9]; + }, + set: function set(mode) { + this.$set({ + mode: mode + }); + flush(); + } + }, { + key: "addClass", + get: function get() { + return this.$$.ctx[10]; + }, + set: function set(addClass) { + this.$set({ + addClass: addClass + }); + flush(); + } + }, { + key: "addModalClass", + get: function get() { + return this.$$.ctx[11]; + }, + set: function set(addModalClass) { + this.$set({ + addModalClass: addModalClass + }); + flush(); + } + }, { + key: "addModelessClass", + get: function get() { + return this.$$.ctx[12]; + }, + set: function set(addModelessClass) { + this.$set({ + addModelessClass: addModelessClass + }); + flush(); + } + }, { + key: "autoOpen", + get: function get() { + return this.$$.ctx[49]; + }, + set: function set(autoOpen) { + this.$set({ + autoOpen: autoOpen + }); + flush(); + } + }, { + key: "width", + get: function get() { + return this.$$.ctx[50]; + }, + set: function set(width) { + this.$set({ + width: width + }); + flush(); + } + }, { + key: "minHeight", + get: function get() { + return this.$$.ctx[51]; + }, + set: function set(minHeight) { + this.$set({ + minHeight: minHeight + }); + flush(); + } + }, { + key: "maxTextHeight", + get: function get() { + return this.$$.ctx[52]; + }, + set: function set(maxTextHeight) { + this.$set({ + maxTextHeight: maxTextHeight + }); + flush(); + } + }, { + key: "icon", + get: function get() { + return this.$$.ctx[13]; + }, + set: function set(icon) { + this.$set({ + icon: icon + }); + flush(); + } + }, { + key: "animation", + get: function get() { + return this.$$.ctx[2]; + }, + set: function set(animation) { + this.$set({ + animation: animation + }); + flush(); + } + }, { + key: "animateSpeed", + get: function get() { + return this.$$.ctx[14]; + }, + set: function set(animateSpeed) { + this.$set({ + animateSpeed: animateSpeed + }); + flush(); + } + }, { + key: "shadow", + get: function get() { + return this.$$.ctx[15]; + }, + set: function set(shadow) { + this.$set({ + shadow: shadow + }); + flush(); + } + }, { + key: "hide", + get: function get() { + return this.$$.ctx[3]; + }, + set: function set(hide) { + this.$set({ + hide: hide + }); + flush(); + } + }, { + key: "delay", + get: function get() { + return this.$$.ctx[53]; + }, + set: function set(delay) { + this.$set({ + delay: delay + }); + flush(); + } + }, { + key: "mouseReset", + get: function get() { + return this.$$.ctx[54]; + }, + set: function set(mouseReset) { + this.$set({ + mouseReset: mouseReset + }); + flush(); + } + }, { + key: "closer", + get: function get() { + return this.$$.ctx[16]; + }, + set: function set(closer) { + this.$set({ + closer: closer + }); + flush(); + } + }, { + key: "closerHover", + get: function get() { + return this.$$.ctx[17]; + }, + set: function set(closerHover) { + this.$set({ + closerHover: closerHover + }); + flush(); + } + }, { + key: "sticker", + get: function get() { + return this.$$.ctx[18]; + }, + set: function set(sticker) { + this.$set({ + sticker: sticker + }); + flush(); + } + }, { + key: "stickerHover", + get: function get() { + return this.$$.ctx[19]; + }, + set: function set(stickerHover) { + this.$set({ + stickerHover: stickerHover + }); + flush(); + } + }, { + key: "labels", + get: function get() { + return this.$$.ctx[20]; + }, + set: function set(labels) { + this.$set({ + labels: labels + }); + flush(); + } + }, { + key: "remove", + get: function get() { + return this.$$.ctx[55]; + }, + set: function set(remove) { + this.$set({ + remove: remove + }); + flush(); + } + }, { + key: "destroy", + get: function get() { + return this.$$.ctx[56]; + }, + set: function set(destroy) { + this.$set({ + destroy: destroy + }); + flush(); + } + }, { + key: "getState", + get: function get() { + return this.$$.ctx[57]; + } + }, { + key: "getTimer", + get: function get() { + return this.$$.ctx[58]; + } + }, { + key: "getStyle", + get: function get() { + return this.$$.ctx[21]; + } + }, { + key: "getIcon", + get: function get() { + return this.$$.ctx[22]; + } + }, { + key: "open", + get: function get() { + return this.$$.ctx[59]; + }, + set: function set(open) { + this.$set({ + open: open + }); + flush(); + } + }, { + key: "close", + get: function get() { + return this.$$.ctx[23]; + }, + set: function set(close) { + this.$set({ + close: close + }); + flush(); + } + }, { + key: "animateIn", + get: function get() { + return this.$$.ctx[60]; + }, + set: function set(animateIn) { + this.$set({ + animateIn: animateIn + }); + flush(); + } + }, { + key: "animateOut", + get: function get() { + return this.$$.ctx[61]; + }, + set: function set(animateOut) { + this.$set({ + animateOut: animateOut + }); + flush(); + } + }, { + key: "cancelClose", + get: function get() { + return this.$$.ctx[62]; + } + }, { + key: "queueClose", + get: function get() { + return this.$$.ctx[63]; + } + }, { + key: "_preventTimerClose", + get: function get() { + return this.$$.ctx[64]; + } + }, { + key: "on", + get: function get() { + return this.$$.ctx[65]; + } + }, { + key: "update", + get: function get() { + return this.$$.ctx[66]; + } + }, { + key: "fire", + get: function get() { + return this.$$.ctx[67]; + } + }, { + key: "addModuleClass", + get: function get() { + return this.$$.ctx[68]; + } + }, { + key: "removeModuleClass", + get: function get() { + return this.$$.ctx[69]; + } + }, { + key: "hasModuleClass", + get: function get() { + return this.$$.ctx[70]; + } + }, { + key: "getModuleHandled", + get: function get() { + return this.$$.ctx[71]; + } + }, { + key: "setModuleHandled", + get: function get() { + return this.$$.ctx[72]; + } + }, { + key: "getModuleOpen", + get: function get() { + return this.$$.ctx[73]; + } + }, { + key: "setModuleOpen", + get: function get() { + return this.$$.ctx[74]; + } + }, { + key: "setAnimating", + get: function get() { + return this.$$.ctx[75]; + } + }, { + key: "getAnimatingClass", + get: function get() { + return this.$$.ctx[76]; + } + }, { + key: "setAnimatingClass", + get: function get() { + return this.$$.ctx[77]; + } + }, { + key: "_getMoveClass", + get: function get() { + return this.$$.ctx[78]; + } + }, { + key: "_setMoveClass", + get: function get() { + return this.$$.ctx[79]; + } + }, { + key: "_setMasking", + get: function get() { + return this.$$.ctx[80]; + } + }]); + + return Core; + }(SvelteComponent); + + exports.Stack = Stack; + exports.alert = alert; + exports.default = Core; + exports.defaultModules = defaultModules; + exports.defaultStack = defaultStack; + exports.defaults = defaults; + exports.error = error; + exports.info = info; + exports.notice = notice; + exports.success = success; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyAnimate.js b/lib/javascript/pnotyfy/PNotifyAnimate.js new file mode 100644 index 0000000..72dc8ed --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyAnimate.js @@ -0,0 +1,612 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyAnimate = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function children(element) { + return Array.from(element.childNodes); + } + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + function get_current_component() { + if (!current_component) throw new Error('Function called outside component initialization'); + return current_component; + } + + function onDestroy(fn) { + get_current_component().$$.on_destroy.push(fn); + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var position = "PrependContainer"; + var defaults = { + inClass: null, + outClass: null + }; + + function instance($$self, $$props, $$invalidate) { + var _$$props$self = $$props.self, + self = _$$props$self === void 0 ? null : _$$props$self; + var _$$props$inClass = $$props.inClass, + inClass = _$$props$inClass === void 0 ? defaults.inClass : _$$props$inClass; + var _$$props$outClass = $$props.outClass, + outClass = _$$props$outClass === void 0 ? defaults.outClass : _$$props$outClass; + var _animation = self.animation; + var _animateIn = self.animateIn; + var _animateOut = self.animateOut; + onDestroy(function () { + self.$set({ + animation: _animation, + animateIn: _animateIn, + animateOut: _animateOut + }); + }); + self.on("pnotify:update", function () { + if (self.refs.elem) { + var animSpeed = 250; + + if (self.animateSpeed === "slow") { + animSpeed = 400; + } else if (self.animateSpeed === "fast") { + animSpeed = 100; + } else if (self.animateSpeed > 0) { + animSpeed = self.animateSpeed; + } + + animSpeed = animSpeed / 1000; + + if (self.refs.elem.style.animationDuration !== "".concat(animSpeed, "s")) { + $$invalidate(0, self.refs.elem.style.animationDuration = "".concat(animSpeed, "s"), self); + } + } + }); + + function animateIn(callback, immediate) { + // Declare that the notice is animating in. + self.setAnimating("in"); + var off; + + var finished = function finished(event) { + if (event && self.refs.elem && event.target !== self.refs.elem) { + return; + } + + off(); + self.setAnimatingClass("pnotify-in animated"); + + if (callback) { + callback.call(); + } // Declare that the notice has completed animating. + + + self.setAnimating(false); + }; + + off = self.on("animationend", finished); + + if (immediate) { + finished(); + } else { + self.setAnimatingClass("pnotify-in animated ".concat(inClass || outClass)); + } + } + + function animateOut(callback, immediate) { + // Declare that the notice is animating out. + self.setAnimating("out"); + var off; + + var finished = function finished(event) { + if (event && self.refs.elem && event.target !== self.refs.elem) { + return; + } + + off(); + self.setAnimatingClass("animated"); + + if (callback) { + callback.call(); + } // Declare that the notice has completed animating. + + + if (self.setAnimating) { + self.setAnimating(false); + } + }; + + off = self.on("animationend", finished); + + if (immediate) { + finished(); + } else { + self.setAnimatingClass("pnotify-in animated ".concat(outClass || inClass)); + } + } + + self.attention = function (aniClass, callback) { + var off; + + var cb = function cb() { + off(); + self.removeModuleClass("container", "animated", aniClass); + + if (callback) { + callback.call(self); + } + }; + + off = self.on("animationend", cb); + self.addModuleClass("container", "animated", aniClass); + }; + + $$self.$$set = function ($$props) { + if ("self" in $$props) $$invalidate(0, self = $$props.self); + if ("inClass" in $$props) $$invalidate(1, inClass = $$props.inClass); + if ("outClass" in $$props) $$invalidate(2, outClass = $$props.outClass); + }; + + $$self.$$.update = function () { + if ($$self.$$.dirty & + /*inClass, outClass, self*/ + 7) { + if (inClass || outClass) { + self.$set({ + animation: "none", + animateIn: animateIn, + animateOut: animateOut + }); + } else { + self.$set({ + animation: _animation, + animateIn: _animateIn, + animateOut: _animateOut + }); + } + } + }; + + return [self, inClass, outClass]; + } + + var Animate = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Animate, _SvelteComponent); + + var _super = _createSuper(Animate); + + function Animate(options) { + var _this; + + _classCallCheck(this, Animate); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, instance, null, safe_not_equal, { + self: 0, + inClass: 1, + outClass: 2 + }); + return _this; + } + + return Animate; + }(SvelteComponent); + + exports.default = Animate; + exports.defaults = defaults; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyBootstrap4.css b/lib/javascript/pnotyfy/PNotifyBootstrap4.css new file mode 100644 index 0000000..7002f9f --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyBootstrap4.css @@ -0,0 +1 @@ +.pnotify .bootstrap4-title{font-size:1.2rem}.pnotify .bootstrap4-icon>*{position:relative;line-height:1.2rem}.pnotify.pnotify-with-icon .bootstrap4-ml{margin-left:24px}[dir=rtl] .pnotify.pnotify-with-icon .bootstrap4-ml{margin-right:24px;margin-left:0} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyBootstrap4.js b/lib/javascript/pnotyfy/PNotifyBootstrap4.js new file mode 100644 index 0000000..4cc342a --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyBootstrap4.js @@ -0,0 +1,471 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyBootstrap4 = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function children(element) { + return Array.from(element.childNodes); + } + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var position = "PrependContainer"; + var defaults = {}; + + function init$1(eventDetail) { + eventDetail.defaults.styling = { + prefix: "bootstrap4", + container: "alert", + notice: "alert-warning", + info: "alert-info", + success: "alert-success", + error: "alert-danger", + // Confirm Module + "action-bar": "bootstrap4-ml", + "prompt-bar": "bootstrap4-ml", + btn: "btn mx-1", + "btn-primary": "btn-primary", + "btn-secondary": "btn-secondary", + input: "form-control" + }; + } + + var Bootstrap4 = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Bootstrap4, _SvelteComponent); + + var _super = _createSuper(Bootstrap4); + + function Bootstrap4(options) { + var _this; + + _classCallCheck(this, Bootstrap4); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, null, null, safe_not_equal, {}); + return _this; + } + + return Bootstrap4; + }(SvelteComponent); + + exports.default = Bootstrap4; + exports.defaults = defaults; + exports.init = init$1; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyConfirm.css b/lib/javascript/pnotyfy/PNotifyConfirm.css new file mode 100644 index 0000000..4305afd --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyConfirm.css @@ -0,0 +1 @@ +.pnotify-action-bar,.pnotify-prompt-bar{margin-top:5px;clear:both}.pnotify-action-bar{display:flex;flex-wrap:wrap;justify-content:flex-end}.pnotify-prompt-input{margin-bottom:5px;display:block;width:100%} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyConfirm.js b/lib/javascript/pnotyfy/PNotifyConfirm.js new file mode 100644 index 0000000..be5f023 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyConfirm.js @@ -0,0 +1,1306 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyConfirm = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function append(target, node) { + target.appendChild(node); + } + + function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function destroy_each(iterations, detaching) { + for (var i = 0; i < iterations.length; i += 1) { + if (iterations[i]) iterations[i].d(detaching); + } + } + + function element(name) { + return document.createElement(name); + } + + function text(data) { + return document.createTextNode(data); + } + + function space() { + return text(' '); + } + + function empty() { + return text(''); + } + + function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return function () { + return node.removeEventListener(event, handler, options); + }; + } + + function attr(node, attribute, value) { + if (value == null) node.removeAttribute(attribute);else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); + } + + function children(element) { + return Array.from(element.childNodes); + } + + function set_data(text, data) { + data = '' + data; + if (text.wholeText !== data) text.data = data; + } + + function set_input_value(input, value) { + input.value = value == null ? '' : value; + } + + var HtmlTag = /*#__PURE__*/function () { + function HtmlTag() { + var anchor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + + _classCallCheck(this, HtmlTag); + + this.a = anchor; + this.e = this.n = null; + } + + _createClass(HtmlTag, [{ + key: "m", + value: function m(html, target) { + var anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + + if (!this.e) { + this.e = element(target.nodeName); + this.t = target; + this.h(html); + } + + this.i(anchor); + } + }, { + key: "h", + value: function h(html) { + this.e.innerHTML = html; + this.n = Array.from(this.e.childNodes); + } + }, { + key: "i", + value: function i(anchor) { + for (var i = 0; i < this.n.length; i += 1) { + insert(this.t, this.n[i], anchor); + } + } + }, { + key: "p", + value: function p(html) { + this.d(); + this.h(html); + this.i(this.a); + } + }, { + key: "d", + value: function d() { + this.n.forEach(detach); + } + }]); + + return HtmlTag; + }(); + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + function get_each_context(ctx, list, i) { + var child_ctx = ctx.slice(); + child_ctx[21] = list[i]; + return child_ctx; + } // (107:0) {#if confirm || prompt} + + + function create_if_block(ctx) { + var div1; + var t; + var div0; + var div0_class_value; + var div0_style_value; + var div1_class_value; + var if_block = + /*prompt*/ + ctx[3] && create_if_block_2(ctx); + var each_value = + /*buttons*/ + ctx[7]; + var each_blocks = []; + + for (var i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + + return { + c: function c() { + div1 = element("div"); + if (if_block) if_block.c(); + t = space(); + div0 = element("div"); + + for (var _i = 0; _i < each_blocks.length; _i += 1) { + each_blocks[_i].c(); + } + + attr(div0, "class", div0_class_value = "pnotify-action-bar ".concat( + /*self*/ + ctx[1].getStyle("action-bar"))); + attr(div0, "style", div0_style_value = "justify-content: ".concat( + /*align*/ + ctx[6], ";")); + attr(div1, "class", div1_class_value = "pnotify-confirm ".concat( + /*self*/ + ctx[1].getStyle("text"), " ").concat( + /*self*/ + ctx[1].getStyle("confirm"))); + }, + m: function m(target, anchor) { + insert(target, div1, anchor); + if (if_block) if_block.m(div1, null); + append(div1, t); + append(div1, div0); + + for (var _i2 = 0; _i2 < each_blocks.length; _i2 += 1) { + each_blocks[_i2].m(div0, null); + } + /*div0_binding*/ + + + ctx[19](div0); + }, + p: function p(ctx, dirty) { + if ( + /*prompt*/ + ctx[3]) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block_2(ctx); + if_block.c(); + if_block.m(div1, t); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + + if (dirty & + /*self, buttons, handleClick*/ + 2178) { + each_value = + /*buttons*/ + ctx[7]; + + var _i3; + + for (_i3 = 0; _i3 < each_value.length; _i3 += 1) { + var child_ctx = get_each_context(ctx, each_value, _i3); + + if (each_blocks[_i3]) { + each_blocks[_i3].p(child_ctx, dirty); + } else { + each_blocks[_i3] = create_each_block(child_ctx); + + each_blocks[_i3].c(); + + each_blocks[_i3].m(div0, null); + } + } + + for (; _i3 < each_blocks.length; _i3 += 1) { + each_blocks[_i3].d(1); + } + + each_blocks.length = each_value.length; + } + + if (dirty & + /*self*/ + 2 && div0_class_value !== (div0_class_value = "pnotify-action-bar ".concat( + /*self*/ + ctx[1].getStyle("action-bar")))) { + attr(div0, "class", div0_class_value); + } + + if (dirty & + /*align*/ + 64 && div0_style_value !== (div0_style_value = "justify-content: ".concat( + /*align*/ + ctx[6], ";"))) { + attr(div0, "style", div0_style_value); + } + + if (dirty & + /*self*/ + 2 && div1_class_value !== (div1_class_value = "pnotify-confirm ".concat( + /*self*/ + ctx[1].getStyle("text"), " ").concat( + /*self*/ + ctx[1].getStyle("confirm")))) { + attr(div1, "class", div1_class_value); + } + }, + d: function d(detaching) { + if (detaching) detach(div1); + if (if_block) if_block.d(); + destroy_each(each_blocks, detaching); + /*div0_binding*/ + + ctx[19](null); + } + }; + } // (111:4) {#if prompt} + + + function create_if_block_2(ctx) { + var div; + var div_class_value; + + function select_block_type(ctx, dirty) { + if ( + /*promptMultiLine*/ + ctx[5]) return create_if_block_3; + return create_else_block_1; + } + + var current_block_type = select_block_type(ctx); + var if_block = current_block_type(ctx); + return { + c: function c() { + div = element("div"); + if_block.c(); + attr(div, "class", div_class_value = "pnotify-prompt-bar ".concat( + /*self*/ + ctx[1].getStyle("prompt-bar"))); + }, + m: function m(target, anchor) { + insert(target, div, anchor); + if_block.m(div, null); + }, + p: function p(ctx, dirty) { + if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { + if_block.p(ctx, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx); + + if (if_block) { + if_block.c(); + if_block.m(div, null); + } + } + + if (dirty & + /*self*/ + 2 && div_class_value !== (div_class_value = "pnotify-prompt-bar ".concat( + /*self*/ + ctx[1].getStyle("prompt-bar")))) { + attr(div, "class", div_class_value); + } + }, + d: function d(detaching) { + if (detaching) detach(div); + if_block.d(); + } + }; + } // (121:8) {:else} + + + function create_else_block_1(ctx) { + var input; + var input_class_value; + var mounted; + var dispose; + return { + c: function c() { + input = element("input"); + attr(input, "type", "text"); + attr(input, "class", input_class_value = "pnotify-prompt-input ".concat( + /*self*/ + ctx[1].getStyle("input"), " ").concat( + /*promptClass*/ + ctx[4])); + }, + m: function m(target, anchor) { + insert(target, input, anchor); + /*input_binding*/ + + ctx[16](input); + set_input_value(input, + /*promptValue*/ + ctx[0]); + + if (!mounted) { + dispose = [listen(input, "keypress", + /*handleKeyPress*/ + ctx[12]), listen(input, "input", + /*input_input_handler*/ + ctx[17])]; + mounted = true; + } + }, + p: function p(ctx, dirty) { + if (dirty & + /*self, promptClass*/ + 18 && input_class_value !== (input_class_value = "pnotify-prompt-input ".concat( + /*self*/ + ctx[1].getStyle("input"), " ").concat( + /*promptClass*/ + ctx[4]))) { + attr(input, "class", input_class_value); + } + + if (dirty & + /*promptValue*/ + 1 && input.value !== + /*promptValue*/ + ctx[0]) { + set_input_value(input, + /*promptValue*/ + ctx[0]); + } + }, + d: function d(detaching) { + if (detaching) detach(input); + /*input_binding*/ + + ctx[16](null); + mounted = false; + run_all(dispose); + } + }; + } // (113:8) {#if promptMultiLine} + + + function create_if_block_3(ctx) { + var textarea; + var textarea_class_value; + var mounted; + var dispose; + return { + c: function c() { + textarea = element("textarea"); + attr(textarea, "rows", "5"); + attr(textarea, "class", textarea_class_value = "pnotify-prompt-input ".concat( + /*self*/ + ctx[1].getStyle("input"), " ").concat( + /*promptClass*/ + ctx[4])); + }, + m: function m(target, anchor) { + insert(target, textarea, anchor); + /*textarea_binding*/ + + ctx[14](textarea); + set_input_value(textarea, + /*promptValue*/ + ctx[0]); + + if (!mounted) { + dispose = [listen(textarea, "keypress", + /*handleKeyPress*/ + ctx[12]), listen(textarea, "input", + /*textarea_input_handler*/ + ctx[15])]; + mounted = true; + } + }, + p: function p(ctx, dirty) { + if (dirty & + /*self, promptClass*/ + 18 && textarea_class_value !== (textarea_class_value = "pnotify-prompt-input ".concat( + /*self*/ + ctx[1].getStyle("input"), " ").concat( + /*promptClass*/ + ctx[4]))) { + attr(textarea, "class", textarea_class_value); + } + + if (dirty & + /*promptValue*/ + 1) { + set_input_value(textarea, + /*promptValue*/ + ctx[0]); + } + }, + d: function d(detaching) { + if (detaching) detach(textarea); + /*textarea_binding*/ + + ctx[14](null); + mounted = false; + run_all(dispose); + } + }; + } // (145:10) {:else} + + + function create_else_block(ctx) { + var t_value = + /*button*/ + ctx[21].text + ""; + var t; + return { + c: function c() { + t = text(t_value); + }, + m: function m(target, anchor) { + insert(target, t, anchor); + }, + p: function p(ctx, dirty) { + if (dirty & + /*buttons*/ + 128 && t_value !== (t_value = + /*button*/ + ctx[21].text + "")) set_data(t, t_value); + }, + d: function d(detaching) { + if (detaching) detach(t); + } + }; + } // (143:10) {#if button.textTrusted} + + + function create_if_block_1(ctx) { + var html_tag; + var raw_value = + /*button*/ + ctx[21].text + ""; + var html_anchor; + return { + c: function c() { + html_anchor = empty(); + html_tag = new HtmlTag(html_anchor); + }, + m: function m(target, anchor) { + html_tag.m(raw_value, target, anchor); + insert(target, html_anchor, anchor); + }, + p: function p(ctx, dirty) { + if (dirty & + /*buttons*/ + 128 && raw_value !== (raw_value = + /*button*/ + ctx[21].text + "")) html_tag.p(raw_value); + }, + d: function d(detaching) { + if (detaching) detach(html_anchor); + if (detaching) html_tag.d(); + } + }; + } // (137:6) {#each buttons as button} + + + function create_each_block(ctx) { + var button; + var t; + var button_class_value; + var mounted; + var dispose; + + function select_block_type_1(ctx, dirty) { + if ( + /*button*/ + ctx[21].textTrusted) return create_if_block_1; + return create_else_block; + } + + var current_block_type = select_block_type_1(ctx); + var if_block = current_block_type(ctx); + + function click_handler() { + var _ctx; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return ( + /*click_handler*/ + (_ctx = ctx)[18].apply(_ctx, [ + /*button*/ + ctx[21]].concat(args)) + ); + } + + return { + c: function c() { + button = element("button"); + if_block.c(); + t = space(); + attr(button, "type", "button"); + attr(button, "class", button_class_value = "pnotify-action-button ".concat( + /*self*/ + ctx[1].getStyle("btn"), " ").concat( + /*button*/ + ctx[21].primary ? + /*self*/ + ctx[1].getStyle("btn-primary") : + /*self*/ + ctx[1].getStyle("btn-secondary"), " ").concat( + /*button*/ + ctx[21].addClass ? + /*button*/ + ctx[21].addClass : "")); + }, + m: function m(target, anchor) { + insert(target, button, anchor); + if_block.m(button, null); + append(button, t); + + if (!mounted) { + dispose = listen(button, "click", click_handler); + mounted = true; + } + }, + p: function p(new_ctx, dirty) { + ctx = new_ctx; + + if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block) { + if_block.p(ctx, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx); + + if (if_block) { + if_block.c(); + if_block.m(button, t); + } + } + + if (dirty & + /*self, buttons*/ + 130 && button_class_value !== (button_class_value = "pnotify-action-button ".concat( + /*self*/ + ctx[1].getStyle("btn"), " ").concat( + /*button*/ + ctx[21].primary ? + /*self*/ + ctx[1].getStyle("btn-primary") : + /*self*/ + ctx[1].getStyle("btn-secondary"), " ").concat( + /*button*/ + ctx[21].addClass ? + /*button*/ + ctx[21].addClass : ""))) { + attr(button, "class", button_class_value); + } + }, + d: function d(detaching) { + if (detaching) detach(button); + if_block.d(); + mounted = false; + dispose(); + } + }; + } + + function create_fragment(ctx) { + var if_block_anchor; + var if_block = ( + /*confirm*/ + ctx[2] || + /*prompt*/ + ctx[3]) && create_if_block(ctx); + return { + c: function c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m: function m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p: function p(ctx, _ref) { + var _ref2 = _slicedToArray(_ref, 1), + dirty = _ref2[0]; + + if ( + /*confirm*/ + ctx[2] || + /*prompt*/ + ctx[3]) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + i: noop, + o: noop, + d: function d(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach(if_block_anchor); + } + }; + } + + var position = "AppendContent"; + var defaults = { + confirm: false, + prompt: false, + promptClass: "", + promptValue: "", + promptMultiLine: false, + focus: null, + align: "flex-end", + buttons: [{ + text: "Ok", + primary: true, + promptTrigger: true, + click: function click(notice, value) { + notice.close(); + notice.fire("pnotify:confirm", { + notice: notice, + value: value + }); + } + }, { + text: "Cancel", + click: function click(notice) { + notice.close(); + notice.fire("pnotify:cancel", { + notice: notice + }); + } + }] + }; + + function instance($$self, $$props, $$invalidate) { + var _$$props$self = $$props.self, + self = _$$props$self === void 0 ? null : _$$props$self; + var _$$props$confirm = $$props.confirm, + confirm = _$$props$confirm === void 0 ? defaults.confirm : _$$props$confirm; + var _$$props$prompt = $$props.prompt, + prompt = _$$props$prompt === void 0 ? defaults.prompt : _$$props$prompt; + var _$$props$promptClass = $$props.promptClass, + promptClass = _$$props$promptClass === void 0 ? defaults.promptClass : _$$props$promptClass; + var _$$props$promptValue = $$props.promptValue, + promptValue = _$$props$promptValue === void 0 ? defaults.promptValue : _$$props$promptValue; + var _$$props$promptMultiL = $$props.promptMultiLine, + promptMultiLine = _$$props$promptMultiL === void 0 ? defaults.promptMultiLine : _$$props$promptMultiL; + var _$$props$focus = $$props.focus, + focus = _$$props$focus === void 0 ? defaults.focus : _$$props$focus; + var _$$props$align = $$props.align, + align = _$$props$align === void 0 ? defaults.align : _$$props$align; + var _$$props$buttons = $$props.buttons, + buttons = _$$props$buttons === void 0 ? defaults.buttons : _$$props$buttons; + var promptMultiElem; + var promptSingleElem; + var buttonsElem; + var focusNextChange = false; + self.on("pnotify:afterOpen", function () { + $$invalidate(20, focusNextChange = true); + }); + + function handleClick(button, event) { + if (button.click) { + button.click(self, prompt ? promptValue : null, event); + } + } + + function handleKeyPress(event) { + if (event.keyCode === 13 && !event.shiftKey) { + event.preventDefault(); + + var _this$get = this.get(), + _buttons = _this$get.buttons; + + for (var i = 0; i < _buttons.length; i++) { + if (_buttons[i].promptTrigger && _buttons[i].click) { + _buttons[i].click(self, prompt ? promptValue : null, event); + } + } + } + } + + function textarea_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + promptMultiElem = $$value; + $$invalidate(8, promptMultiElem); + }); + } + + function textarea_input_handler() { + promptValue = this.value; + $$invalidate(0, promptValue); + } + + function input_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + promptSingleElem = $$value; + $$invalidate(9, promptSingleElem); + }); + } + + function input_input_handler() { + promptValue = this.value; + $$invalidate(0, promptValue); + } + + var click_handler = function click_handler(button, event) { + return handleClick(button, event); + }; + + function div0_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](function () { + buttonsElem = $$value; + $$invalidate(10, buttonsElem); + }); + } + + $$self.$$set = function ($$props) { + if ("self" in $$props) $$invalidate(1, self = $$props.self); + if ("confirm" in $$props) $$invalidate(2, confirm = $$props.confirm); + if ("prompt" in $$props) $$invalidate(3, prompt = $$props.prompt); + if ("promptClass" in $$props) $$invalidate(4, promptClass = $$props.promptClass); + if ("promptValue" in $$props) $$invalidate(0, promptValue = $$props.promptValue); + if ("promptMultiLine" in $$props) $$invalidate(5, promptMultiLine = $$props.promptMultiLine); + if ("focus" in $$props) $$invalidate(13, focus = $$props.focus); + if ("align" in $$props) $$invalidate(6, align = $$props.align); + if ("buttons" in $$props) $$invalidate(7, buttons = $$props.buttons); + }; + + $$self.$$.update = function () { + if ($$self.$$.dirty & + /*focusNextChange, prompt, focus, promptMultiLine, promptMultiElem, promptSingleElem, confirm, self, buttons, buttonsElem*/ + 1058734) { + { + if (focusNextChange) { + if (prompt && focus !== false) { + if (promptMultiLine) { + if (promptMultiElem) { + promptMultiElem.focus(); + $$invalidate(20, focusNextChange = false); + } + } else { + if (promptSingleElem) { + promptSingleElem.focus(); + $$invalidate(20, focusNextChange = false); + } + } + } else if (confirm && (focus === true || focus === null && self.stack.modal === true)) { + if (buttons.length && buttonsElem) { + var i = buttons.length - 1; + + while (i > 0) { + if (buttons[i].promptTrigger) { + break; + } + + i--; + } + + buttonsElem.children[i].focus(); + $$invalidate(20, focusNextChange = false); + } + } + } + } + } + }; + + return [promptValue, self, confirm, prompt, promptClass, promptMultiLine, align, buttons, promptMultiElem, promptSingleElem, buttonsElem, handleClick, handleKeyPress, focus, textarea_binding, textarea_input_handler, input_binding, input_input_handler, click_handler, div0_binding]; + } + + var Confirm = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Confirm, _SvelteComponent); + + var _super = _createSuper(Confirm); + + function Confirm(options) { + var _this; + + _classCallCheck(this, Confirm); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, instance, create_fragment, safe_not_equal, { + self: 1, + confirm: 2, + prompt: 3, + promptClass: 4, + promptValue: 0, + promptMultiLine: 5, + focus: 13, + align: 6, + buttons: 7 + }); + return _this; + } + + return Confirm; + }(SvelteComponent); + + exports.default = Confirm; + exports.defaults = defaults; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyCountdown.css b/lib/javascript/pnotyfy/PNotifyCountdown.css new file mode 100644 index 0000000..46ea7e1 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyCountdown.css @@ -0,0 +1 @@ +.pnotify-countdown{position:absolute;top:100%;left:0;width:100%;height:.5em;display:flex;justify-content:center;align-items:center}.pnotify-countdown-top{top:auto;bottom:100%}.pnotify-countdown-left{top:0;right:100%;left:auto;height:100%;width:.5em}.pnotify-countdown-right{top:0;left:100%;height:100%;width:.5em}.pnotify-countdown-bar{position:absolute;top:0;left:0;transition:width .1s linear}.pnotify-countdown-reverse .pnotify-countdown-bar{top:auto;left:auto;right:0;bottom:0} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyCountdown.js b/lib/javascript/pnotyfy/PNotifyCountdown.js new file mode 100644 index 0000000..c7664e3 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyCountdown.js @@ -0,0 +1,74 @@ +(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?factory(exports):typeof define==='function'&&define.amd?define(['exports'],factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,factory(global.PNotifyCountdown={}));}(this,(function(exports){'use strict';function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj;};}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};} +return _typeof(obj);} +function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}} +function _defineProperties(target,props){for(var i=0;iarr.length)len=arr.length;for(var i=0,arr2=new Array(len);i6&&arguments[6]!==undefined?arguments[6]:[-1];var parent_component=current_component;set_current_component(component);var prop_values=options.props||{};var $$=component.$$={fragment:null,ctx:null,props:props,update:noop,not_equal:not_equal,bound:blank_object(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(parent_component?parent_component.$$.context:[]),callbacks:blank_object(),dirty:dirty,skip_bound:false};var ready=false;$$.ctx=instance?instance(component,prop_values,function(i,ret){var value=(arguments.length<=2?0:arguments.length-2)?arguments.length<=2?undefined:arguments[2]:ret;if($$.ctx&¬_equal($$.ctx[i],$$.ctx[i]=value)){if(!$$.skip_bound&&$$.bound[i])$$.bound[i](value);if(ready)make_dirty(component,i);} +return ret;}):[];$$.update();ready=true;run_all($$.before_update);$$.fragment=create_fragment?create_fragment($$.ctx):false;if(options.target){if(options.hydrate){var nodes=children(options.target);$$.fragment&&$$.fragment.l(nodes);nodes.forEach(detach);}else{$$.fragment&&$$.fragment.c();} +if(options.intro)transition_in(component.$$.fragment);mount_component(component,options.target,options.anchor);flush();} +set_current_component(parent_component);} +var SvelteComponent=function(){function SvelteComponent(){_classCallCheck(this,SvelteComponent);} +_createClass(SvelteComponent,[{key:"$destroy",value:function $destroy(){destroy_component(this,1);this.$destroy=noop;}},{key:"$on",value:function $on(type,callback){var callbacks=this.$$.callbacks[type]||(this.$$.callbacks[type]=[]);callbacks.push(callback);return function(){var index=callbacks.indexOf(callback);if(index!==-1)callbacks.splice(index,1);};}},{key:"$set",value:function $set($$props){if(this.$$set&&!is_empty($$props)){this.$$.skip_bound=true;this.$$set($$props);this.$$.skip_bound=false;}}}]);return SvelteComponent;}();function create_if_block(ctx){var div1;var div0;var div0_class_value;var div0_style_value;var div1_class_value;return{c:function c(){div1=element("div");div0=element("div");attr(div0,"class",div0_class_value="pnotify-countdown-bar ".concat(ctx[0].getStyle("countdown-bar")));attr(div0,"style",div0_style_value="height: ".concat(ctx[1]==="right"||ctx[1]==="left"?ctx[3]:"100","%; width: ").concat(ctx[1]==="top"||ctx[1]==="bottom"?ctx[3]:"100","%;"));attr(div1,"class",div1_class_value="pnotify-countdown pnotify-countdown-".concat(ctx[1]," ").concat(ctx[2]?"pnotify-countdown-reverse":""," ").concat(ctx[0].getStyle("countdown")));},m:function m(target,anchor){insert(target,div1,anchor);append(div1,div0);},p:function p(ctx,dirty){if(dirty&1&&div0_class_value!==(div0_class_value="pnotify-countdown-bar ".concat(ctx[0].getStyle("countdown-bar")))){attr(div0,"class",div0_class_value);} +if(dirty&10&&div0_style_value!==(div0_style_value="height: ".concat(ctx[1]==="right"||ctx[1]==="left"?ctx[3]:"100","%; width: ").concat(ctx[1]==="top"||ctx[1]==="bottom"?ctx[3]:"100","%;"))){attr(div0,"style",div0_style_value);} +if(dirty&7&&div1_class_value!==(div1_class_value="pnotify-countdown pnotify-countdown-".concat(ctx[1]," ").concat(ctx[2]?"pnotify-countdown-reverse":""," ").concat(ctx[0].getStyle("countdown")))){attr(div1,"class",div1_class_value);}},d:function d(detaching){if(detaching)detach(div1);}};} +function create_fragment(ctx){var if_block_anchor;var if_block=ctx[4]&&create_if_block(ctx);return{c:function c(){if(if_block)if_block.c();if_block_anchor=empty();},m:function m(target,anchor){if(if_block)if_block.m(target,anchor);insert(target,if_block_anchor,anchor);},p:function p(ctx,_ref){var _ref2=_slicedToArray(_ref,1),dirty=_ref2[0];if(ctx[4]){if(if_block){if_block.p(ctx,dirty);}else{if_block=create_if_block(ctx);if_block.c();if_block.m(if_block_anchor.parentNode,if_block_anchor);}}else if(if_block){if_block.d(1);if_block=null;}},i:noop,o:noop,d:function d(detaching){if(if_block)if_block.d(detaching);if(detaching)detach(if_block_anchor);}};} +var position="AppendContainer";var defaults={anchor:"bottom",reverse:false};function instance($$self,$$props,$$invalidate){var _$$props$self=$$props.self,self=_$$props$self===void 0?null:_$$props$self;var _$$props$anchor=$$props.anchor,anchor=_$$props$anchor===void 0?defaults.anchor:_$$props$anchor;var _$$props$reverse=$$props.reverse,reverse=_$$props$reverse===void 0?defaults.reverse:_$$props$reverse;var _state=self.getState();var _timer=self.getTimer();var _msLeft=0;var _percent=100;var ival;var offUpdate;var offAfterOpen;var getValues=function getValues(){$$invalidate(5,_state=self.getState());$$invalidate(6,_timer=self.getTimer());};onMount(function(){offUpdate=self.on("pnotify:update",getValues);offAfterOpen=self.on("pnotify:afterOpen",getValues);ival=setInterval(function(){if(showCountdown){if(timeStart){_msLeft=self.delay-(new Date()-timeStart);$$invalidate(3,_percent=_msLeft/self.delay*100);}else{$$invalidate(3,_percent=_state==="closing"?0:100);}}},100);});onDestroy(function(){offUpdate&&offUpdate();offAfterOpen&&offAfterOpen();clearInterval(ival);});$$self.$$set=function($$props){if("self"in $$props)$$invalidate(0,self=$$props.self);if("anchor"in $$props)$$invalidate(1,anchor=$$props.anchor);if("reverse"in $$props)$$invalidate(2,reverse=$$props.reverse);};var showCountdown;var timeStart;$$self.$$.update=function(){if($$self.$$.dirty&33){$$invalidate(4,showCountdown=["opening","open","closing"].indexOf(_state)!==-1&&self.hide&&self.delay!==Infinity);} +if($$self.$$.dirty&80){timeStart=showCountdown&&_timer&&_timer!=="prevented"?new Date():null;} +if($$self.$$.dirty&19){{self.removeModuleClass("elem","pnotify-with-countdown","pnotify-with-countdown-bottom","pnotify-with-countdown-top","pnotify-with-countdown-left","pnotify-with-countdown-right");if(showCountdown){self.addModuleClass("elem","pnotify-with-countdown","pnotify-with-countdown-".concat(anchor));}}}};return[self,anchor,reverse,_percent,showCountdown];} +var Countdown=function(_SvelteComponent){_inherits(Countdown,_SvelteComponent);var _super=_createSuper(Countdown);function Countdown(options){var _this;_classCallCheck(this,Countdown);_this=_super.call(this);init(_assertThisInitialized(_this),options,instance,create_fragment,safe_not_equal,{self:0,anchor:1,reverse:2});return _this;} +return Countdown;}(SvelteComponent);exports.default=Countdown;exports.defaults=defaults;exports.position=position;Object.defineProperty(exports,'__esModule',{value:true});}))); \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyDesktop.css b/lib/javascript/pnotyfy/PNotifyDesktop.css new file mode 100644 index 0000000..db5689b --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyDesktop.css @@ -0,0 +1 @@ +[data-pnotify].pnotify-desktop-hide{left:-10000px!important;display:none!important} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyDesktop.js b/lib/javascript/pnotyfy/PNotifyDesktop.js new file mode 100644 index 0000000..5fcbc77 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyDesktop.js @@ -0,0 +1,700 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyDesktop = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function children(element) { + return Array.from(element.childNodes); + } + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var position = "PrependContainer"; + var defaults = { + fallback: true, + icon: null, + tag: null, + title: null, + text: null, + options: {} + }; + + function requestPermission() { + if (typeof Notification !== "undefined" && "requestPermission" in Notification) { + Notification.requestPermission(); + } else if ("webkitNotifications" in window) { + window.webkitNotifications.requestPermission(); + } + } + + var Notification = window.Notification; + + var _notify = function notify(title, options, onclick, onclose) { + // Memoize based on feature detection. + if ("Notification" in window) { + _notify = function notify(title, options, onclick, onclose) { + var notice = new Notification(title, options); + + if ("NotificationEvent" in window) { + notice.addEventListener("notificationclick", onclick); + notice.addEventListener("close", onclose); + } else if ("addEventListener" in notice) { + notice.addEventListener("click", onclick); + notice.addEventListener("close", onclose); + } else { + notice.onclick = onclick; + notice.onclose = onclose; + } + + return notice; + }; + } else if ("mozNotification" in navigator) { + _notify = function notify(title, options, onclick, onclose) { + // Gecko < 22 + var notice = navigator.mozNotification.createNotification(title, options.body, options.icon).show(); + notice.onclick = onclick; + notice.onclose = onclose; + return notice; + }; + } else if ("webkitNotifications" in window) { + _notify = function notify(title, options, onclick, onclose) { + var notice = window.webkitNotifications.createNotification(options.icon, title, options.body); + notice.onclick = onclick; + notice.onclose = onclose; + return notice; + }; + } else { + _notify = function notify(title, options, onclick, onclose) { + return null; + }; + } + + return _notify(title, options, onclick, onclose); + }; + + function checkPermission() { + if (typeof Notification !== "undefined" && "permission" in Notification) { + return Notification.permission === "granted"; + } else if ("webkitNotifications" in window) { + return window.webkitNotifications.checkPermission() == 0; + } + + return false; + } + + var _permission = checkPermission(); + + function instance($$self, $$props, $$invalidate) { + var _$$props$self = $$props.self, + self = _$$props$self === void 0 ? null : _$$props$self; + var _$$props$fallback = $$props.fallback, + fallback = _$$props$fallback === void 0 ? defaults.fallback : _$$props$fallback; + var _$$props$icon = $$props.icon, + icon = _$$props$icon === void 0 ? defaults.icon : _$$props$icon; + var _$$props$tag = $$props.tag, + tag = _$$props$tag === void 0 ? defaults.tag : _$$props$tag; + var _$$props$title = $$props.title, + title = _$$props$title === void 0 ? defaults.title : _$$props$title; + var _$$props$text = $$props.text, + text = _$$props$text === void 0 ? defaults.text : _$$props$text; + var _$$props$options = $$props.options, + options = _$$props$options === void 0 ? defaults.options : _$$props$options; + + var _desktop; // Animation should always be 'none' for desktop notices, but remember + // the old animation so it can be recovered. + + + var _oldAnimation = "none"; + + var _icon; + + var _tag; + + self.on("pnotify:beforeOpen", function () { + if (!_permission) { + requestPermission(); + return; + } + + if (_desktop && "show" in _desktop) { + self.setModuleOpen(true); + + _desktop.show(); + } + }); + self.on("pnotify:beforeClose", function () { + if (!_permission) { + return; + } + + if (_desktop && "close" in _desktop) { + _desktop.close(); + + self.setModuleOpen(false); + } + }); + _permission = checkPermission(); + + if (_permission) { + self.addModuleClass("elem", "pnotify-desktop-hide"); + self.animation = "none"; + genNotice(); + } else if (!fallback) { + // Keep the notice from opening if fallback is false. + self.autoOpen = false; + } + + function genNotice() { + if (icon === null) { + switch (self.type) { + case "error": + _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQg7e6HvQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABr0lEQVRYw8WXu0oDQRSGv7hRSFYrLTTWKihaqUgUJO+gphBLL1jYpPSCVcAggpWthYhC7Ows9An0IbSPkMRCw8ZmFuI6yczs9cAPuzNz5v92brtrESxGARtokkCcAg2hk7jNl4G2R/m4zFPAiwTgWdRFHnmJuaulOAAaPQDqUZvv9DB3tR0lwIcGwHtU5uca5q4qYZvngJbHpAZ8CtU8dS1gLEyAisegBGTFKWiL65KnzVlY5uOSId6VtNuTtMupOu/TAHiQlNmSskHNXCOAGWBeUp7VhFoApoMAXAOWJoCszBJ9+ALY6vL0JiPgjsKmKUAaOOoBZwIAcNxlJLsCrAOTIQJMAWu62y4LOIqT7lGS96TIcYCMDkBZ46h1gB+PHI28ssq8X/G6DaqG8Piz2DrjVjGXbtSBy46F5QAHwJAizwZugKKscs7gSaqS/KpB/qxsFxwafhf6Odb/eblJi8BGwJdW26BtURxQpMU83hmaDQsNiPtvYMSwj3tgAqDgYzU7wJdHjo9+CgBvEW47lV5Tgj5DMtG0xIfESkIAF+522gdWxTzGEX3i9+6KpOMXF5UBt0NKJCAAAAAASUVORK5CYII="; + break; + + case "success": + _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQPRj+65AAAAdBJREFUWMPtlzsvRFEQx3+7HmEjoiYKolVJJDRqnS8ggvVIVEQhCIUsEYJGCEH2E4h4FPREaLTbEo1IEJXHrmY2GTf33nPuY7ud5OTenTMz//89Z86ZWShLWf5LB3AOfACFiOMF2AkC3qOc88BXxFEAxlX8ftGdaNCEen8H6oFHYBR4FocwkpTngzzHgF01fwL0aYcp9fVtMW/rsMcWXWijK1Hexgye9smRT6CxaHgjytMYwccNSXqoja9FeVbiZS+OVaeDiUBLAPAJA/i2m5MXgRSQk7llC/DBMOBeBGqAe0eAjQhfvurH3EmgQk6EW6CVEHt+ZFo6J4EU8OoTcF35jhnAl2wSx20LFgyB1yyOWtY2c72ScMAAkPeZy6g4zUBdGAIAcyEq4Z7y7xbdTFgCACMBwPVJqVDHeNqvaplkH5i0sNuUwmaNkQxww20ZSOy7gFvX7SAk0i76jPQQlJoAwAEwq35ngfmwVatSdUMArZZ+K9JQ1Bp6iGqgSt7f/AIOqSzujLEn6AV+JG6zm4HuCZ+AJuAbWAQu5aIJu7JDck0ngDugC/j1c2qPqR13jpxuvWyS8liY/kQcean/lX6ACQ99DdAQYe+Lf0zylMUgf7qDKgzv284QAAAAAElFTkSuQmCC"; + break; + + case "info": + _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQ09zRTwAAAAdxJREFUWMPtl88rRFEUxz8zBolRCgsrpOym8TMSO2WplLKwUrKi/B0W7JSFmhVLNlhSlLKx8CtRGpEsJpofpZk3Nkc9b968e++8mdlw6vTeu/edc773nl/3wl+ngOH/zUAf0AN0AmEgB7wCD8AtcFMJoM3ADpAHLHk62RIwL8B0uQwHgXVRnDfkS2DSj/EW4K0Ew05eLMV4O/CuUJwEUvJUgdgwMd4IpBUKl13kVG6aL+ZjJ20DDQqQXy5jKYVMDBhVrb5f069LLrKfGnInqh040HRTvsTAHgei9oGQ7X0YaNNUNCdFKChgQvKtQ1vAkNvEahlSToez9oXad2BCA30ceHZxRxMQMShuvZLmv+hOA32/h+KUwS7MugVhqwb6Go+5nEEwht0ABDUEzyXdFsrQYwqMJjTbdxio9Qkg6QbgvkpnkLw0uQIAZ1UCYNkXawdw4qPCmVBcuADAMZCpAoCVYr3AKtYyHZSWauakjMx50TWwrzJw6lFARjQOt3se8jM6W9TloSCqIb9bRHbN5Fg+KkEZcow/Ak+KFBsD6h3jR8CUabAMlqn7xfxEbAdwWKLhhO3sGPCbOsNSvSyF0Z/5TaCuEleziLhmAOiWG1NWrmZXwIVU1A/+SZO+AcgLC4wt0zD3AAAAAElFTkSuQmCC"; + break; + + case "notice": + default: + _icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATM4scOJLAAAAcxJREFUWMPtljtLA0EQx3+J0QRfnYqCiCA+MERBrIwgFtoFbMTOR61i5QcQBdEihZWNoEWwsNAvkMJeBLHRQtHC0iIP4utOmw2cx97d7l2SRgcGbufmv/Pf2dmdhb8uIR+YJqAPaBff30AeeAHuxLgqMgRkgS/AAEybGuLfEdBcycCTwKVYmY5mgO6gwdd8BLaqAST9Bs8EDG7VTd3gex4TbgEjwKjQOHDugZlRDb7sMZEJpCS4bYVMJOygsG1cB+wqHN0Gib1RYXFpLwL74nx7Sb3EFlXATQNjTgRagA3FbZIRiCliT5wITGgUaRACA0CPjMC4xtUcDUAgDAzLCCQ0MhALQCAE9MoIdGkQCJIBgE4ZgWiNMvDL10qgUMMMFGQEnjQmkLXbVg38s8y4qtFcTCAnHiJ5oKiJnSoHjVgIXAmHkGIl5yy+YcWruIy9dvqpupIDCfZWEXvh1gsWFVfxIbG9a3RbRwJnYiuqJYfAqxsBgBWFiQyJzfTAlIB1uzEicbwBFoBTl8lSwINoSuXKjrv4F4FBh61zlKUKvgn7/e5ZEngMEDgLdFSieHaAT42LpgTMVbqC24B54Bi4twV9E6cnDcw6PFj+RSo/l6rlSlldhx4AAAAASUVORK5CYII="; + break; + } + } else if (icon === false) { + _icon = null; + } else { + _icon = icon; + } + + if (!_tag || tag !== null) { + _tag = tag === null ? "PNotify-".concat(Math.round(Math.random() * 1000000)) : tag; + } + + var desktopOptions = { + body: text || self.text, + tag: _tag + }; + + if (!self.hide) { + desktopOptions.requireInteraction = true; + } + + if (_icon !== null) { + desktopOptions.icon = _icon; + } + + Object.apply(desktopOptions, options); + _desktop = _notify(title || self.title, desktopOptions, function () { + self.fire && self.fire("click", { + target: _desktop + }); + }, function () { + self.close && self.close(); + }); + + if (!("close" in _desktop) && "cancel" in _desktop) { + _desktop.close = function () { + _desktop.cancel(); + }; + } + } + + $$self.$$set = function ($$props) { + if ("self" in $$props) $$invalidate(0, self = $$props.self); + if ("fallback" in $$props) $$invalidate(1, fallback = $$props.fallback); + if ("icon" in $$props) $$invalidate(2, icon = $$props.icon); + if ("tag" in $$props) $$invalidate(3, tag = $$props.tag); + if ("title" in $$props) $$invalidate(4, title = $$props.title); + if ("text" in $$props) $$invalidate(5, text = $$props.text); + if ("options" in $$props) $$invalidate(6, options = $$props.options); + }; + + $$self.$$.update = function () { + if ($$self.$$.dirty & + /*self, _permission, _oldAnimation*/ + 257) { + { + if (self.animation !== "none") { + $$invalidate(8, _oldAnimation = self.animation); + } // This is necessary so desktop notices don't cause spacing problems + // when positioning. + + + if (self.getAnimatingClass() !== "" && _permission) { + self.setAnimatingClass(""); + } + + if (!_permission && self.hasModuleClass("elem", "pnotify-desktop-hide")) { + self.removeModuleClass("elem", "pnotify-desktop-hide"); + $$invalidate(0, self.animation = _oldAnimation, self); + } else if (_permission && !self.hasModuleClass("elem", "pnotify-desktop-hide")) { + self.addModuleClass("elem", "pnotify-desktop-hide"); + $$invalidate(0, self.animation = "none", self); + genNotice(); + } + } + } + + if ($$self.$$.dirty & + /*self, _permission*/ + 1) { + { + self.setModuleHandled(_permission); + } + } + }; + + return [self, fallback, icon, tag, title, text, options]; + } + + var Desktop = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Desktop, _SvelteComponent); + + var _super = _createSuper(Desktop); + + function Desktop(options) { + var _this; + + _classCallCheck(this, Desktop); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, instance, null, safe_not_equal, { + self: 0, + fallback: 1, + icon: 2, + tag: 3, + title: 4, + text: 5, + options: 6 + }); + return _this; + } + + return Desktop; + }(SvelteComponent); + + exports.default = Desktop; + exports.defaults = defaults; + exports.permission = requestPermission; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyFontAwesome5.js b/lib/javascript/pnotyfy/PNotifyFontAwesome5.js new file mode 100644 index 0000000..c2ca60f --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyFontAwesome5.js @@ -0,0 +1,471 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyFontAwesome5 = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function children(element) { + return Array.from(element.childNodes); + } + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var position = "PrependContainer"; + var defaults = {}; + + function init$1(eventDetail) { + // You must have Font Awesome v5.0+ + eventDetail.defaults.icons = { + prefix: "fontawesome5", + notice: "fas fa-exclamation-circle", + info: "fas fa-info-circle", + success: "fas fa-check-circle", + error: "fas fa-exclamation-triangle", + // Buttons Module + closer: "fas fa-times", + sticker: "fas", + stuck: "fa-play", + unstuck: "fa-pause", + // Reference Module (Useful for other modules.) + refresh: "fas fa-sync" + }; + } + + var Font_awesome5 = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Font_awesome5, _SvelteComponent); + + var _super = _createSuper(Font_awesome5); + + function Font_awesome5(options) { + var _this; + + _classCallCheck(this, Font_awesome5); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, null, null, safe_not_equal, {}); + return _this; + } + + return Font_awesome5; + }(SvelteComponent); + + exports.default = Font_awesome5; + exports.defaults = defaults; + exports.init = init$1; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyFontAwesome5Fix.js b/lib/javascript/pnotyfy/PNotifyFontAwesome5Fix.js new file mode 100644 index 0000000..aeb159b --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyFontAwesome5Fix.js @@ -0,0 +1,548 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyFontAwesome5Fix = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function children(element) { + return Array.from(element.childNodes); + } + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + function get_current_component() { + if (!current_component) throw new Error('Function called outside component initialization'); + return current_component; + } + + function onDestroy(fn) { + get_current_component().$$.on_destroy.push(fn); + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function tick() { + schedule_update(); + return resolved_promise; + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var position = "PrependContainer"; + var defaults = {}; + + function instance($$self, $$props, $$invalidate) { + var _$$props$self = $$props.self, + self = _$$props$self === void 0 ? null : _$$props$self; // This keeps the beforeUpdate handler from going into a loop when we're + // taming Font Awesome's magic. + + var _updatingIcon = false; + var _updatingSticker = false; // Save the old value of icon, so we can do our magic. + + var _oldIconProp = self.icon; + + var _oldIconValue = self.icon === true ? self.getIcon(self.type) : self.icon; + + var _oldSticker = "".concat(self.getIcon("sticker"), " ").concat(self.hide ? self.getIcon("unstuck") : self.getIcon("stuck")); + + var newIconProp; + var newIconValue; + var newSticker; + var removeIconHandler = self.on("pnotify:update", function () { + if (_updatingIcon) { + return; + } // Font Awesome 5 uses dark magic by replacing the icon element with an SVG. + // In order to make it play nice with Svelte, we have to clear the element + // and make it again. + + + newIconProp = self.icon; + newIconValue = self.icon === true ? self.getIcon(self.type) : self.icon; + + if (newIconValue !== _oldIconValue && (typeof newIconValue === "string" && newIconValue.match(/(^| )fa[srlb]($| )/) || typeof _oldIconValue === "string" && _oldIconValue.match(/(^| )fa[srlb]($| )/))) { + $$invalidate(0, self.icon = false, self); + _updatingIcon = true; + tick().then(function () { + $$invalidate(0, self.icon = newIconProp, self); + _updatingIcon = false; // Update seved icon. + + _oldIconProp = newIconProp; + _oldIconValue = newIconValue; + }); + } else { + // Update seved icon. + _oldIconProp = newIconProp; + _oldIconValue = newIconValue; + } + }); + var removeStickerHandler = self.on("pnotify:update", function () { + if (_updatingSticker) { + return; + } // Font Awesome 5 uses dark magic by replacing the icon element with an SVG. + // In order to make it play nice with Svelte, we have to clear the element + // and make it again. + + + newSticker = "".concat(self.getIcon("sticker"), " ").concat(self.hide ? self.getIcon("unstuck") : self.getIcon("stuck")); + + if (self.sticker && newSticker !== _oldSticker && typeof newSticker === "string" && newSticker.match(/(^| )fa[srlb]($| )/)) { + $$invalidate(0, self.sticker = false, self); + _updatingSticker = true; + tick().then(function () { + $$invalidate(0, self.sticker = true, self); + _updatingSticker = false; // Update seved icon. + + _oldSticker = newSticker; + }); + } else { + // Update seved icon. + _oldSticker = newSticker; + } + }); + onDestroy(function () { + removeIconHandler && removeIconHandler(); + removeStickerHandler && removeStickerHandler(); + }); + + $$self.$$set = function ($$props) { + if ("self" in $$props) $$invalidate(0, self = $$props.self); + }; + + return [self]; + } + + var Font_awesome5_fix = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Font_awesome5_fix, _SvelteComponent); + + var _super = _createSuper(Font_awesome5_fix); + + function Font_awesome5_fix(options) { + var _this; + + _classCallCheck(this, Font_awesome5_fix); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, instance, null, safe_not_equal, { + self: 0 + }); + return _this; + } + + return Font_awesome5_fix; + }(SvelteComponent); + + exports.default = Font_awesome5_fix; + exports.defaults = defaults; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyMobile.css b/lib/javascript/pnotyfy/PNotifyMobile.css new file mode 100644 index 0000000..7be395f --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyMobile.css @@ -0,0 +1 @@ +[data-pnotify] .pnotify-container{position:relative}[data-pnotify] .pnotify-mobile-animate-left{transition:left .1s ease}[data-pnotify] .pnotify-mobile-animate-top{transition:top .1s ease}@media(max-width:480px){[data-pnotify].pnotify{font-size:1.2em;-webkit-font-smoothing:antialiased;-moz-font-smoothing:antialiased;-ms-font-smoothing:antialiased;font-smoothing:antialiased}body>[data-pnotify].pnotify{position:fixed}[data-pnotify].pnotify.pnotify-stack-down,[data-pnotify].pnotify.pnotify-stack-up{width:100%!important}[data-pnotify].pnotify.pnotify-stack-right,[data-pnotify].pnotify.pnotify-stack-left{height:100%!important}[data-pnotify].pnotify .pnotify-shadow{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}[data-pnotify].pnotify.pnotify-stack-down .pnotify-shadow{border-bottom-width:5px}[data-pnotify].pnotify.pnotify-stack-up .pnotify-shadow{border-top-width:5px}[data-pnotify].pnotify.pnotify-stack-right .pnotify-shadow{border-right-width:5px}[data-pnotify].pnotify.pnotify-stack-left .pnotify-shadow{border-left-width:5px}[data-pnotify].pnotify .pnotify-container{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}[data-pnotify].pnotify.pnotify-stack-down .pnotify-container,[data-pnotify].pnotify.pnotify-stack-up .pnotify-container{width:auto!important}[data-pnotify].pnotify.pnotify-stack-right .pnotify-container,[data-pnotify].pnotify.pnotify-stack-left .pnotify-container{height:100%!important}} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyMobile.js b/lib/javascript/pnotyfy/PNotifyMobile.js new file mode 100644 index 0000000..89e61f4 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyMobile.js @@ -0,0 +1,657 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyMobile = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + 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 + } + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } + + return _assertThisInitialized(self); + } + + 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); + }; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function noop() {} + + function run(fn) { + return fn(); + } + + function blank_object() { + return Object.create(null); + } + + function run_all(fns) { + fns.forEach(run); + } + + function is_function(thing) { + return typeof thing === 'function'; + } + + function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function'; + } + + function is_empty(obj) { + return Object.keys(obj).length === 0; + } + + function detach(node) { + node.parentNode.removeChild(node); + } + + function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return function () { + return node.removeEventListener(event, handler, options); + }; + } + + function children(element) { + return Array.from(element.childNodes); + } + + var current_component; + + function set_current_component(component) { + current_component = component; + } + + function get_current_component() { + if (!current_component) throw new Error('Function called outside component initialization'); + return current_component; + } + + function onMount(fn) { + get_current_component().$$.on_mount.push(fn); + } + + function onDestroy(fn) { + get_current_component().$$.on_destroy.push(fn); + } + + var dirty_components = []; + var binding_callbacks = []; + var render_callbacks = []; + var flush_callbacks = []; + var resolved_promise = Promise.resolve(); + var update_scheduled = false; + + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + + function add_render_callback(fn) { + render_callbacks.push(fn); + } + + var flushing = false; + var seen_callbacks = new Set(); + + function flush() { + if (flushing) return; + flushing = true; + + do { + // first, call beforeUpdate functions + // and update components + for (var i = 0; i < dirty_components.length; i += 1) { + var component = dirty_components[i]; + set_current_component(component); + update(component.$$); + } + + set_current_component(null); + dirty_components.length = 0; + + while (binding_callbacks.length) { + binding_callbacks.pop()(); + } // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + + + for (var _i = 0; _i < render_callbacks.length; _i += 1) { + var callback = render_callbacks[_i]; + + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + + render_callbacks.length = 0; + } while (dirty_components.length); + + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + + update_scheduled = false; + flushing = false; + seen_callbacks.clear(); + } + + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + var dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + var outroing = new Set(); + + function transition_in(block, local) { + if (block && block.i) { + outroing["delete"](block); + block.i(local); + } + } + + var globals = typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : global; + + function mount_component(component, target, anchor) { + var _component$$$ = component.$$, + fragment = _component$$$.fragment, + on_mount = _component$$$.on_mount, + on_destroy = _component$$$.on_destroy, + after_update = _component$$$.after_update; + fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate + + add_render_callback(function () { + var new_on_destroy = on_mount.map(run).filter(is_function); + + if (on_destroy) { + on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy)); + } else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); + } + + function destroy_component(component, detaching) { + var $$ = component.$$; + + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } + } + + function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; + } + + function init(component, options, instance, create_fragment, not_equal, props) { + var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1]; + var parent_component = current_component; + set_current_component(component); + var prop_values = options.props || {}; + var $$ = component.$$ = { + fragment: null, + ctx: null, + // state + props: props, + update: noop, + not_equal: not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + before_update: [], + after_update: [], + context: new Map(parent_component ? parent_component.$$.context : []), + // everything else + callbacks: blank_object(), + dirty: dirty, + skip_bound: false + }; + var ready = false; + $$.ctx = instance ? instance(component, prop_values, function (i, ret) { + var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret; + + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); // `false` as a special case of no DOM component + + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + + if (options.target) { + if (options.hydrate) { + var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + + set_current_component(parent_component); + } + + var SvelteComponent = /*#__PURE__*/function () { + function SvelteComponent() { + _classCallCheck(this, SvelteComponent); + } + + _createClass(SvelteComponent, [{ + key: "$destroy", + value: function $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + }, { + key: "$on", + value: function $on(type, callback) { + var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); + callbacks.push(callback); + return function () { + var index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + }, { + key: "$set", + value: function $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }]); + + return SvelteComponent; + }(); + + var window_1 = globals.window; + + function create_fragment(ctx) { + var mounted; + var dispose; + return { + c: noop, + m: function m(target, anchor) { + if (!mounted) { + dispose = listen(window_1, "resize", + /*resize_handler*/ + ctx[3]); + mounted = true; + } + }, + p: noop, + i: noop, + o: noop, + d: function d(detaching) { + mounted = false; + dispose(); + } + }; + } + + var position = "PrependContainer"; + var defaults = { + swipeDismiss: true + }; + + function instance($$self, $$props, $$invalidate) { + var _$$props$self = $$props.self, + self = _$$props$self === void 0 ? null : _$$props$self; + var _$$props$swipeDismiss = $$props.swipeDismiss, + swipeDismiss = _$$props$swipeDismiss === void 0 ? defaults.swipeDismiss : _$$props$swipeDismiss; + var origXY = null; + var diffXY = null; + var noticeWidthHeight = null; + var noticeOpacity = null; + var csspos = "left"; + var direction = "X"; + var span = "Width"; + var windowInnerWidth = window.innerWidth; + var offs = []; + onMount(function () { + offs = [self.on("touchstart", function (e) { + if (!swipeDismiss) { + return; + } + + var stack = self.stack; + + if (stack) { + switch (stack.dir1) { + case "up": + case "down": + csspos = "left"; + direction = "X"; + span = "Width"; + break; + + case "left": + case "right": + csspos = "top"; + direction = "Y"; + span = "Height"; + break; + } + } + + origXY = e.touches[0]["screen".concat(direction)]; + noticeWidthHeight = self.refs.elem["scroll".concat(span)]; + noticeOpacity = window.getComputedStyle(self.refs.elem)["opacity"]; + $$invalidate(1, self.refs.container.style[csspos] = 0, self); + }), self.on("touchmove", function (e) { + if (!origXY || !swipeDismiss) { + return; + } + + var curXY = e.touches[0]["screen".concat(direction)]; + diffXY = curXY - origXY; + var opacity = (1 - Math.abs(diffXY) / noticeWidthHeight) * noticeOpacity; + $$invalidate(1, self.refs.elem.style.opacity = opacity, self); + $$invalidate(1, self.refs.container.style[csspos] = "".concat(diffXY, "px"), self); + }), self.on("touchend", function () { + if (!origXY || !swipeDismiss) { + return; + } + + self.refs.container.classList.add("pnotify-mobile-animate-left"); + + if (Math.abs(diffXY) > 40) { + var goLeft = diffXY < 0 ? noticeWidthHeight * -2 : noticeWidthHeight * 2; + $$invalidate(1, self.refs.elem.style.opacity = 0, self); + $$invalidate(1, self.refs.container.style[csspos] = "".concat(goLeft, "px"), self); + self.close(); + } else { + self.refs.elem.style.removeProperty("opacity"); + self.refs.container.style.removeProperty(csspos); + } + + origXY = null; + diffXY = null; + noticeWidthHeight = null; + noticeOpacity = null; + }), self.on("touchcancel", function () { + if (!origXY || !swipeDismiss) { + return; + } + + self.refs.elem.style.removeProperty("opacity"); + self.refs.container.style.removeProperty(csspos); + origXY = null; + diffXY = null; + noticeWidthHeight = null; + noticeOpacity = null; + }), self.on("pnotify:afterClose", function () { + // Remove any styling we added to close it. + if (!swipeDismiss) { + return; + } + + self.refs.elem.style.removeProperty("opacity"); + self.refs.container.style.removeProperty("left"); + self.refs.container.style.removeProperty("top"); + })]; + }); + onDestroy(function () { + offs.forEach(function (off) { + return off(); + }); + }); + + var resize_handler = function resize_handler() { + return $$invalidate(0, windowInnerWidth = window.innerWidth); + }; + + $$self.$$set = function ($$props) { + if ("self" in $$props) $$invalidate(1, self = $$props.self); + if ("swipeDismiss" in $$props) $$invalidate(2, swipeDismiss = $$props.swipeDismiss); + }; + + $$self.$$.update = function () { + if ($$self.$$.dirty & + /*self, windowInnerWidth*/ + 3) { + { + var stack = self.stack; + + if (stack) { + if (windowInnerWidth <= 480) { + if (!("_m_spacing1" in stack)) { + stack._m_spacing1 = stack.spacing1; + stack._m_firstpos1 = stack.firstpos1; + stack._m_spacing2 = stack.spacing2; + stack._m_firstpos2 = stack.firstpos2; + stack.spacing1 = 0; + stack.firstpos1 = 0; + stack.spacing2 = 0; + stack.firstpos2 = 0; + stack.queuePosition(); + } + } else { + if ("_m_spacing1" in stack) { + stack.spacing1 = stack._m_spacing1; + delete stack._m_spacing1; + stack.firstpos1 = stack._m_firstpos1; + delete stack._m_firstpos1; + stack.spacing2 = stack._m_spacing2; + delete stack._m_spacing2; + stack.firstpos2 = stack._m_firstpos2; + delete stack._m_firstpos2; + stack.queuePosition(); + } + } + } + } + } + }; + + return [windowInnerWidth, self, swipeDismiss, resize_handler]; + } + + var Mobile = /*#__PURE__*/function (_SvelteComponent) { + _inherits(Mobile, _SvelteComponent); + + var _super = _createSuper(Mobile); + + function Mobile(options) { + var _this; + + _classCallCheck(this, Mobile); + + _this = _super.call(this); + init(_assertThisInitialized(_this), options, instance, create_fragment, safe_not_equal, { + self: 1, + swipeDismiss: 2 + }); + return _this; + } + + return Mobile; + }(SvelteComponent); + + exports.default = Mobile; + exports.defaults = defaults; + exports.position = position; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/lib/javascript/pnotyfy/PNotifyPaginate.css b/lib/javascript/pnotyfy/PNotifyPaginate.css new file mode 100644 index 0000000..bcb662b --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyPaginate.css @@ -0,0 +1 @@ +.pnotify-paginate{float:right;display:flex;align-items:center;justify-content:center}.pnotify-paginate-buttons{display:flex}.pnotify-paginate-button{display:inline-block;margin:0 .5em;cursor:pointer}.pnotify-paginate-button:disabled,.pnotify-paginate-button[aria-disabled=true]{cursor:initial}.pnotify-paginate-count{font-size:.9em} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyPaginate.js b/lib/javascript/pnotyfy/PNotifyPaginate.js new file mode 100644 index 0000000..1649e29 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyPaginate.js @@ -0,0 +1,89 @@ +(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?factory(exports):typeof define==='function'&&define.amd?define(['exports'],factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,factory(global.PNotifyPaginate={}));}(this,(function(exports){'use strict';function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj;};}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};} +return _typeof(obj);} +function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}} +function _defineProperties(target,props){for(var i=0;iarr.length)len=arr.length;for(var i=0,arr2=new Array(len);i6&&arguments[6]!==undefined?arguments[6]:[-1];var parent_component=current_component;set_current_component(component);var prop_values=options.props||{};var $$=component.$$={fragment:null,ctx:null,props:props,update:noop,not_equal:not_equal,bound:blank_object(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(parent_component?parent_component.$$.context:[]),callbacks:blank_object(),dirty:dirty,skip_bound:false};var ready=false;$$.ctx=instance?instance(component,prop_values,function(i,ret){var value=(arguments.length<=2?0:arguments.length-2)?arguments.length<=2?undefined:arguments[2]:ret;if($$.ctx&¬_equal($$.ctx[i],$$.ctx[i]=value)){if(!$$.skip_bound&&$$.bound[i])$$.bound[i](value);if(ready)make_dirty(component,i);} +return ret;}):[];$$.update();ready=true;run_all($$.before_update);$$.fragment=create_fragment?create_fragment($$.ctx):false;if(options.target){if(options.hydrate){var nodes=children(options.target);$$.fragment&&$$.fragment.l(nodes);nodes.forEach(detach);}else{$$.fragment&&$$.fragment.c();} +if(options.intro)transition_in(component.$$.fragment);mount_component(component,options.target,options.anchor);flush();} +set_current_component(parent_component);} +var SvelteComponent=function(){function SvelteComponent(){_classCallCheck(this,SvelteComponent);} +_createClass(SvelteComponent,[{key:"$destroy",value:function $destroy(){destroy_component(this,1);this.$destroy=noop;}},{key:"$on",value:function $on(type,callback){var callbacks=this.$$.callbacks[type]||(this.$$.callbacks[type]=[]);callbacks.push(callback);return function(){var index=callbacks.indexOf(callback);if(index!==-1)callbacks.splice(index,1);};}},{key:"$set",value:function $set($$props){if(this.$$set&&!is_empty($$props)){this.$$.skip_bound=true;this.$$set($$props);this.$$.skip_bound=false;}}}]);return SvelteComponent;}();function create_if_block_1(ctx){var div2;var div0;var div0_tabindex_value;var div0_aria_disabled_value;var div0_class_value;var div0_title_value;var t;var div1;var div1_tabindex_value;var div1_aria_disabled_value;var div1_class_value;var div1_title_value;var div2_class_value;var mounted;var dispose;return{c:function c(){div2=element("div");div0=element("div");t=space();div1=element("div");attr(div0,"role","button");attr(div0,"tabindex",div0_tabindex_value=ctx[4]===1?"-1":"0");attr(div0,"aria-disabled",div0_aria_disabled_value=ctx[4]===1);attr(div0,"class",div0_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-previous")));attr(div0,"title",div0_title_value=ctx[3].previous);attr(div1,"role","button");attr(div1,"tabindex",div1_tabindex_value=ctx[4]===ctx[5]?"-1":"0");attr(div1,"aria-disabled",div1_aria_disabled_value=ctx[4]===ctx[5]);attr(div1,"class",div1_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-next")));attr(div1,"title",div1_title_value=ctx[3].next);attr(div2,"class",div2_class_value="pnotify-paginate-buttons ".concat(ctx[0].getStyle("paginate-buttons")));},m:function m(target,anchor){insert(target,div2,anchor);append(div2,div0);append(div2,t);append(div2,div1);if(!mounted){dispose=[listen(div0,"click",ctx[10]),listen(div1,"click",ctx[11])];mounted=true;}},p:function p(ctx,dirty){if(dirty&16&&div0_tabindex_value!==(div0_tabindex_value=ctx[4]===1?"-1":"0")){attr(div0,"tabindex",div0_tabindex_value);} +if(dirty&16&&div0_aria_disabled_value!==(div0_aria_disabled_value=ctx[4]===1)){attr(div0,"aria-disabled",div0_aria_disabled_value);} +if(dirty&1&&div0_class_value!==(div0_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-previous")))){attr(div0,"class",div0_class_value);} +if(dirty&8&&div0_title_value!==(div0_title_value=ctx[3].previous)){attr(div0,"title",div0_title_value);} +if(dirty&48&&div1_tabindex_value!==(div1_tabindex_value=ctx[4]===ctx[5]?"-1":"0")){attr(div1,"tabindex",div1_tabindex_value);} +if(dirty&48&&div1_aria_disabled_value!==(div1_aria_disabled_value=ctx[4]===ctx[5])){attr(div1,"aria-disabled",div1_aria_disabled_value);} +if(dirty&1&&div1_class_value!==(div1_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-next")))){attr(div1,"class",div1_class_value);} +if(dirty&8&&div1_title_value!==(div1_title_value=ctx[3].next)){attr(div1,"title",div1_title_value);} +if(dirty&1&&div2_class_value!==(div2_class_value="pnotify-paginate-buttons ".concat(ctx[0].getStyle("paginate-buttons")))){attr(div2,"class",div2_class_value);}},d:function d(detaching){if(detaching)detach(div2);mounted=false;run_all(dispose);}};} +function create_if_block(ctx){var div;var span0;var t0;var span0_class_value;var t1;var span1;var t2_value=ctx[3].of+"";var t2;var span1_class_value;var t3;var span2;var t4;var span2_class_value;var div_class_value;return{c:function c(){div=element("div");span0=element("span");t0=text(ctx[4]);t1=space();span1=element("span");t2=text(t2_value);t3=space();span2=element("span");t4=text(ctx[5]);attr(span0,"class",span0_class_value="pnotify-paginate-count-current ".concat(ctx[0].getStyle("paginate-count-current")));attr(span1,"class",span1_class_value="pnotify-paginate-count-of ".concat(ctx[0].getStyle("paginate-count-of")));attr(span2,"class",span2_class_value="pnotify-paginate-count-total ".concat(ctx[0].getStyle("paginate-count-total")));attr(div,"class",div_class_value="pnotify-paginate-count ".concat(ctx[0].getStyle("paginate-count")));},m:function m(target,anchor){insert(target,div,anchor);append(div,span0);append(span0,t0);append(div,t1);append(div,span1);append(span1,t2);append(div,t3);append(div,span2);append(span2,t4);},p:function p(ctx,dirty){if(dirty&16)set_data(t0,ctx[4]);if(dirty&1&&span0_class_value!==(span0_class_value="pnotify-paginate-count-current ".concat(ctx[0].getStyle("paginate-count-current")))){attr(span0,"class",span0_class_value);} +if(dirty&8&&t2_value!==(t2_value=ctx[3].of+""))set_data(t2,t2_value);if(dirty&1&&span1_class_value!==(span1_class_value="pnotify-paginate-count-of ".concat(ctx[0].getStyle("paginate-count-of")))){attr(span1,"class",span1_class_value);} +if(dirty&32)set_data(t4,ctx[5]);if(dirty&1&&span2_class_value!==(span2_class_value="pnotify-paginate-count-total ".concat(ctx[0].getStyle("paginate-count-total")))){attr(span2,"class",span2_class_value);} +if(dirty&1&&div_class_value!==(div_class_value="pnotify-paginate-count ".concat(ctx[0].getStyle("paginate-count")))){attr(div,"class",div_class_value);}},d:function d(detaching){if(detaching)detach(div);}};} +function create_fragment(ctx){var div;var t;var div_class_value;var if_block0=ctx[1]&&create_if_block_1(ctx);var if_block1=ctx[2]&&create_if_block(ctx);return{c:function c(){div=element("div");if(if_block0)if_block0.c();t=space();if(if_block1)if_block1.c();attr(div,"class",div_class_value="pnotify-paginate ".concat(ctx[0].getStyle("paginate")));},m:function m(target,anchor){insert(target,div,anchor);if(if_block0)if_block0.m(div,null);append(div,t);if(if_block1)if_block1.m(div,null);},p:function p(ctx,_ref){var _ref2=_slicedToArray(_ref,1),dirty=_ref2[0];if(ctx[1]){if(if_block0){if_block0.p(ctx,dirty);}else{if_block0=create_if_block_1(ctx);if_block0.c();if_block0.m(div,t);}}else if(if_block0){if_block0.d(1);if_block0=null;} +if(ctx[2]){if(if_block1){if_block1.p(ctx,dirty);}else{if_block1=create_if_block(ctx);if_block1.c();if_block1.m(div,null);}}else if(if_block1){if_block1.d(1);if_block1=null;} +if(dirty&1&&div_class_value!==(div_class_value="pnotify-paginate ".concat(ctx[0].getStyle("paginate")))){attr(div,"class",div_class_value);}},i:noop,o:noop,d:function d(detaching){if(detaching)detach(div);if(if_block0)if_block0.d();if(if_block1)if_block1.d();}};} +var position="PrependContainer";var defaults={buttons:true,count:true,immediateTransition:true,waiting:true,labels:{previous:"Previous",next:"Next",of:"of"}};function instance($$self,$$props,$$invalidate){var _$$props$self=$$props.self,self=_$$props$self===void 0?null:_$$props$self;var _$$props$buttons=$$props.buttons,buttons=_$$props$buttons===void 0?defaults.buttons:_$$props$buttons;var _$$props$count=$$props.count,count=_$$props$count===void 0?defaults.count:_$$props$count;var _$$props$immediateTra=$$props.immediateTransition,immediateTransition=_$$props$immediateTra===void 0?defaults.immediateTransition:_$$props$immediateTra;var _$$props$waiting=$$props.waiting,waiting=_$$props$waiting===void 0?defaults.waiting:_$$props$waiting;var _$$props$labels=$$props.labels,labels=_$$props$labels===void 0?defaults.labels:_$$props$labels;var currentIndex;var stackLength;var handlerCallback=function handlerCallback(){$$invalidate(4,currentIndex=0);try{self.stack.forEach(function(notice){return $$invalidate(4,currentIndex++,currentIndex);},{start:self,dir:"prev"});}catch(e){if(e.message!=="Invalid start param."){throw e;}} +$$invalidate(5,stackLength=self.stack.length);};var addHandlerOff;var removeHandlerOff;var beforeOpenHandlerOff;onMount(function(){handlerCallback();addHandlerOff=self.stack.on("afterAddNotice",handlerCallback);removeHandlerOff=self.stack.on("afterRemoveNotice",handlerCallback);beforeOpenHandlerOff=self.on("beforeOpen",handlerCallback);});onDestroy(function(){addHandlerOff();removeHandlerOff();beforeOpenHandlerOff();});function handleNext(){self.stack.forEach(function(notice){if(notice!==self&&(notice.getState()==="waiting"||!waiting&¬ice.getState()==="closed")){self.stack.swap(self,notice,immediateTransition,waiting);return false;}},{start:self,dir:"next"});} +function handlePrevious(){self.stack.forEach(function(notice){if(notice!==self&¬ice.getState()==="waiting"){self.stack.swap(self,notice,immediateTransition,true);return false;}},{start:self,dir:"prev"});} +var click_handler=function click_handler(event){return handlePrevious();};var click_handler_1=function click_handler_1(event){return handleNext();};$$self.$$set=function($$props){if("self"in $$props)$$invalidate(0,self=$$props.self);if("buttons"in $$props)$$invalidate(1,buttons=$$props.buttons);if("count"in $$props)$$invalidate(2,count=$$props.count);if("immediateTransition"in $$props)$$invalidate(8,immediateTransition=$$props.immediateTransition);if("waiting"in $$props)$$invalidate(9,waiting=$$props.waiting);if("labels"in $$props)$$invalidate(3,labels=$$props.labels);};return[self,buttons,count,labels,currentIndex,stackLength,handleNext,handlePrevious,immediateTransition,waiting,click_handler,click_handler_1];} +var Paginate=function(_SvelteComponent){_inherits(Paginate,_SvelteComponent);var _super=_createSuper(Paginate);function Paginate(options){var _this;_classCallCheck(this,Paginate);_this=_super.call(this);init(_assertThisInitialized(_this),options,instance,create_fragment,safe_not_equal,{self:0,buttons:1,count:2,immediateTransition:8,waiting:9,labels:3});return _this;} +return Paginate;}(SvelteComponent);exports.default=Paginate;exports.defaults=defaults;exports.position=position;Object.defineProperty(exports,'__esModule',{value:true});}))); \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyReference.css b/lib/javascript/pnotyfy/PNotifyReference.css new file mode 100644 index 0000000..4e283bd --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyReference.css @@ -0,0 +1 @@ +.pnotify-reference-button.svelte-1tn3i34{float:right;margin-top:1em}.pnotify-reference-clearing.svelte-1tn3i34{clear:right;line-height:0} \ No newline at end of file diff --git a/lib/javascript/pnotyfy/PNotifyReference.js b/lib/javascript/pnotyfy/PNotifyReference.js new file mode 100644 index 0000000..eef0c32 --- /dev/null +++ b/lib/javascript/pnotyfy/PNotifyReference.js @@ -0,0 +1,75 @@ +(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?factory(exports):typeof define==='function'&&define.amd?define(['exports'],factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,factory(global.PNotifyReference={}));}(this,(function(exports){'use strict';function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj;};}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};} +return _typeof(obj);} +function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}} +function _defineProperties(target,props){for(var i=0;iarr.length)len=arr.length;for(var i=0,arr2=new Array(len);i6&&arguments[6]!==undefined?arguments[6]:[-1];var parent_component=current_component;set_current_component(component);var prop_values=options.props||{};var $$=component.$$={fragment:null,ctx:null,props:props,update:noop,not_equal:not_equal,bound:blank_object(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(parent_component?parent_component.$$.context:[]),callbacks:blank_object(),dirty:dirty,skip_bound:false};var ready=false;$$.ctx=instance?instance(component,prop_values,function(i,ret){var value=(arguments.length<=2?0:arguments.length-2)?arguments.length<=2?undefined:arguments[2]:ret;if($$.ctx&¬_equal($$.ctx[i],$$.ctx[i]=value)){if(!$$.skip_bound&&$$.bound[i])$$.bound[i](value);if(ready)make_dirty(component,i);} +return ret;}):[];$$.update();ready=true;run_all($$.before_update);$$.fragment=create_fragment?create_fragment($$.ctx):false;if(options.target){if(options.hydrate){var nodes=children(options.target);$$.fragment&&$$.fragment.l(nodes);nodes.forEach(detach);}else{$$.fragment&&$$.fragment.c();} +if(options.intro)transition_in(component.$$.fragment);mount_component(component,options.target,options.anchor);flush();} +set_current_component(parent_component);} +var SvelteComponent=function(){function SvelteComponent(){_classCallCheck(this,SvelteComponent);} +_createClass(SvelteComponent,[{key:"$destroy",value:function $destroy(){destroy_component(this,1);this.$destroy=noop;}},{key:"$on",value:function $on(type,callback){var callbacks=this.$$.callbacks[type]||(this.$$.callbacks[type]=[]);callbacks.push(callback);return function(){var index=callbacks.indexOf(callback);if(index!==-1)callbacks.splice(index,1);};}},{key:"$set",value:function $set($$props){if(this.$$set&&!is_empty($$props)){this.$$.skip_bound=true;this.$$set($$props);this.$$.skip_bound=false;}}}]);return SvelteComponent;}();function create_fragment(ctx){var button;var i;var i_class_value;var t0;var t1_value=ctx[1].text+"";var t1;var button_class_value;var button_disabled_value;var t2;var div;var mounted;var dispose;return{c:function c(){button=element("button");i=element("i");t0=text("\n  ");t1=text(t1_value);t2=space();div=element("div");attr(i,"class",i_class_value=""+(null_to_empty(ctx[0].getIcon("refresh"))+" svelte-1tn3i34"));attr(button,"class",button_class_value=""+(null_to_empty("pnotify-action-button pnotify-reference-button ".concat(ctx[0].getStyle("btn")," ").concat(ctx[0].getStyle("btn-secondary")))+" svelte-1tn3i34"));attr(button,"type","button");button.disabled=button_disabled_value=!ctx[2];attr(div,"class","pnotify-reference-clearing svelte-1tn3i34");},m:function m(target,anchor){insert(target,button,anchor);append(button,i);append(button,t0);append(button,t1);insert(target,t2,anchor);insert(target,div,anchor);if(!mounted){dispose=listen(button,"click",ctx[3]);mounted=true;}},p:function p(ctx,_ref){var _ref2=_slicedToArray(_ref,1),dirty=_ref2[0];if(dirty&1&&i_class_value!==(i_class_value=""+(null_to_empty(ctx[0].getIcon("refresh"))+" svelte-1tn3i34"))){attr(i,"class",i_class_value);} +if(dirty&2&&t1_value!==(t1_value=ctx[1].text+""))set_data(t1,t1_value);if(dirty&1&&button_class_value!==(button_class_value=""+(null_to_empty("pnotify-action-button pnotify-reference-button ".concat(ctx[0].getStyle("btn")," ").concat(ctx[0].getStyle("btn-secondary")))+" svelte-1tn3i34"))){attr(button,"class",button_class_value);} +if(dirty&4&&button_disabled_value!==(button_disabled_value=!ctx[2])){button.disabled=button_disabled_value;}},i:noop,o:noop,d:function d(detaching){if(detaching)detach(button);if(detaching)detach(t2);if(detaching)detach(div);mounted=false;dispose();}};} +var position="AppendContent";var defaults={labels:{text:"Spin Around"}};function instance($$self,$$props,$$invalidate){var _$$props$self=$$props.self,self=_$$props$self===void 0?null:_$$props$self;var _$$props$labels=$$props.labels,labels=_$$props$labels===void 0?defaults.labels:_$$props$labels;var mouseIsIn=false;var removeMouseEnter=self.on("mouseenter",function(){return $$invalidate(2,mouseIsIn=true);});var removeMouseLeave=self.on("mouseleave",function(){return $$invalidate(2,mouseIsIn=false);});onDestroy(function(){removeMouseEnter&&removeMouseEnter();removeMouseLeave&&removeMouseLeave();});function doSomething(){var curAngle=0;var timer=setInterval(function(){curAngle+=10;if(curAngle===360){curAngle=0;clearInterval(timer);} +$$invalidate(0,self.refs.elem.style.transform="rotate(".concat(curAngle,"deg)"),self);},20);} +$$self.$$set=function($$props){if("self"in $$props)$$invalidate(0,self=$$props.self);if("labels"in $$props)$$invalidate(1,labels=$$props.labels);};return[self,labels,mouseIsIn,doSomething];} +var Reference=function(_SvelteComponent){_inherits(Reference,_SvelteComponent);var _super=_createSuper(Reference);function Reference(options){var _this;_classCallCheck(this,Reference);_this=_super.call(this);init(_assertThisInitialized(_this),options,instance,create_fragment,safe_not_equal,{self:0,labels:1});return _this;} +return Reference;}(SvelteComponent);exports.default=Reference;exports.defaults=defaults;exports.position=position;Object.defineProperty(exports,'__esModule',{value:true});}))); \ No newline at end of file diff --git a/lib/php/argus/argus.php b/lib/php/argus/argus.php new file mode 100644 index 0000000..676ee07 --- /dev/null +++ b/lib/php/argus/argus.php @@ -0,0 +1,57 @@ +Query( $QS, false ); + }; + +?> \ No newline at end of file diff --git a/lib/php/onvif/test_v11.php b/lib/php/onvif/test_v11.php index 123aa94..7502cf9 100644 --- a/lib/php/onvif/test_v11.php +++ b/lib/php/onvif/test_v11.php @@ -7,10 +7,11 @@ //var_dump($result); //exit(); $test=new ponvif(); - $test->setUsername('gagua'); - $test->setPassword('4GetMyID'); - $test->setIPAddress('192.168.0.109'); - + //$test->setUsername('gagua'); + $test->setUsername('admin'); + $test->setPassword('4GetMyID');//109 + //$test->setIPAddress('192.168.0.109'); + $test->setIPAddress('192.168.200.106'); try { $test->initialize(); @@ -21,8 +22,9 @@ //echo "Media: " . $test->media_GetStreamUri($profileToken) . "\n\n"; //echo "Snapshot: " . $test->media_GetSnapshotUri('Profile_2') . "\n\n"; //$PAPA = $test->media_GetVideoSources(); - $test->ptz_AbsoluteMove( "Profile_1", 1, -1, 0); - $test->ptz_GetStatus("Profile_1"); + //$test->ptz_AbsoluteMove($profileToken, -1, -1, 0); + //$PAPA = $test->ptz_GetStatus($profileToken); + $test->ptz_ContinuousMove( $profileToken, -0.2, 0 ); //var_dump( $PAPA ); } catch (Exception $e) { diff --git a/lib/php/onvif/toto.php b/lib/php/onvif/toto.php index 3881ebf..c8b818f 100644 --- a/lib/php/onvif/toto.php +++ b/lib/php/onvif/toto.php @@ -554,8 +554,8 @@ class Ponvif { $velocity_pantilt_x, $velocity_pantilt_y), $post_string); - if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { - if ($this->intransingent) throw new Exception('ContinuousMove: Communication error'); + if ( $this->isFault($this->_send_request($this->ptzuri,$post_string))) { + if( $this->intransingent ) throw new Exception('ContinuousMove: Communication error'); } } @@ -721,19 +721,25 @@ class Ponvif { if ($this->proxyusername!='' && $this->proxypassword!='') curl_setopt($soap_do, CURLOPT_PROXYUSERPWD, $this->proxyusername.':'.$this->proxypassword); } - curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); - curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); + curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 2 ); + curl_setopt($soap_do, CURLOPT_TIMEOUT, 2 ); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($soap_do, CURLOPT_VERBOSE, true); + //curl_setopt($soap_do, CURLOPT_DEBUG, true); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $post_string); - curl_setopt($soap_do, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($post_string) )); + curl_setopt($soap_do, CURLOPT_HTTPHEADER, array('Expect:', 'Content-Type: application/soap+xml; charset=utf-8', 'Content-Length: '.strlen($post_string) )); curl_setopt($soap_do, CURLOPT_USERPWD, $this->username . ":" . $this->password); // HTTP authentication if ( ($result = curl_exec($soap_do)) === false) { $err = curl_error($soap_do); $this->lastresponse=array("Fault"=>$err); } else { + //echo "QU: {$url}\n"; + //echo "\n------------------\n"; + //var_dump( $post_string ); + //echo "\n~~~~~~~~~~~~~~~~~~\n"; //var_dump( $result ); $this->lastresponse=$this->_xml2array($result); } diff --git a/lib/php/ui/UI_functions.php b/lib/php/ui/UI_functions.php index 6b89cf8..7cb064b 100644 --- a/lib/php/ui/UI_functions.php +++ b/lib/php/ui/UI_functions.php @@ -173,7 +173,6 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){ - @@ -218,7 +217,31 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){ - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -293,6 +316,7 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){ }; }; ?> +