diff --git a/lib/controller/addNetworkNode.php b/lib/controller/addNetworkNode.php index a3a040e..938f16a 100644 --- a/lib/controller/addNetworkNode.php +++ b/lib/controller/addNetworkNode.php @@ -1,5 +1,6 @@ Data['id'] > 1 ){ $Data['success'] = false; if( $CUser->Data['access'] > 5 ){ @@ -7,10 +8,8 @@ if( isset($_POST['TYPE']) ) $NodeType = intval($_POST['TYPE']); else $NodeType = 0; if( $SiteID ){ if( $NodeType ){ - $QS = "SELECT `id` FROM `nodes` WHERE `site_id`={$SiteID} AND `type`=0"; - $SS = $DATABASE->Query( $QS, false ); - if( count( $SS ) ){ - $ServerNODE = intval($SS[0]['id']); + $ServerNODE = getServerNode( $SiteID ); + if( $ServerNODE ){ switch( $NodeType ){ case ARGUS_ALS_SENSOR: case ARGUS_LFS_SENSOR: @@ -22,6 +21,9 @@ if(isset($_POST['DEVID'])) $DEVID = intval($_POST['DEVID']); else $DEVID = 0; if( $CNAME != '' && $CRANGE > 0 && $CUART > 0 ){ $Data['success'] = addSerialSensor( $SiteID, $NodeType, $CRANGE, $CNAME, $CUART, $DEVID ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; } else { $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); }; @@ -33,6 +35,9 @@ if(isset($_POST['SERVER'])) $ServerNODE = intval($_POST['SERVER']); else $ServerNODE = 0; if( $CNAME != '' && $CPORT !== false && $CADDR!==false && $ServerNODE > 0 ){ $Data['success'] = add3DSensor( $SiteID, $ServerNODE, $CNAME, $CADDR, $CPORT ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; } else { $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); }; @@ -44,6 +49,9 @@ if(isset($_POST['LAB'])) $CNAME = $DATABASE->escape($_POST['LAB']); else $CNAME = ''; if( $CSTR && $CNAME!='' ){ $Data['success'] = addAnalogStaticCamera( $SiteID, $ServerNODE, $CNAME, $CSTR, $IMSIZE, $FMIN ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; } else { $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); }; @@ -63,6 +71,9 @@ if(isset($_POST['LAB'])) $CNAME = $DATABASE->escape($_POST['LAB']); else $CNAME = ''; if( $CSTR && $CNAME!='' ){ $Data['success'] = addAnalogPtzCamera( $SiteID, $ServerNODE, $CNAME, $CSTR, $IMSIZE, $FMIN, $FMAX, $PANMODE, $PANANG, $TILTMODE, $TILTANG, $PTZ, $PROTOID, $UART ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; } else { $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); }; @@ -70,11 +81,14 @@ case ARGUS_IP_STATIC_CAMERA: if(isset($_POST['CID'])) $CamID = intval($_POST['CID']); else $CamID = 0; if(isset($_POST['STREAM'])) $CSTR = intval($_POST['STREAM']); else $CSTR = 0; - if(isset($_POST['FMIN'])) $FMIN = floatval($_POST['FMIN']); else $FMIN = 0; + if(isset($_POST['LFL'])) $LFL = intval($_POST['LFL']); else $LFL = 0; if(isset($_POST['IMSIZE'])) $IMSIZE = intval($_POST['IMSIZE']); else $IMSIZE = 2; if(isset($_POST['LAB'])) $CNAME = $DATABASE->escape($_POST['LAB']); else $CNAME = ''; if( $CSTR && $CNAME!='' ){ - $Data['success'] = addAnalogStaticCamera( $SiteID, $ServerNODE, $CNAME, $CamID, $CSTR, $IMSIZE, $FMIN ); + $Data['success'] = addIpStaticCamera( $SiteID, $ServerNODE, $CNAME, $CamID, $CSTR, $IMSIZE, $LFL ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; } else { $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); }; @@ -84,8 +98,8 @@ 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['LFL'])) $LFL = intval($_POST['LFL']); else $LFL = 0; + if(isset($_POST['ZOOM'])) $ZOOM = intval($_POST['ZOOM']); else $ZOOM = 1; 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; @@ -93,43 +107,33 @@ if(isset($_POST['TILTANG'])) $TILTANG = floatval( $_POST['TILTANG']); else $TILTANG = 90.0; if(isset($_POST['PROTOID'])) $PROTOID = intval( $_POST['PROTOID'] ); else $PROTOID = 0; if(isset($_POST['LAB'])) $CNAME = $DATABASE->escape($_POST['LAB']); else $CNAME = ''; - if( $CSTR && $CNAME!='' ){ - $Data['success'] = addAnalogPtzCamera( $SiteID, $ServerNODE, $CNAME, $CamID, $CSTR, $IMSIZE, $FMIN, $FMAX, $PANMODE, $PANANG, $TILTMODE, $TILTANG, $PTZ, $PROTOID ); + if( $CamID && $CSTR && $CNAME!='' ){ + $Data['success'] = addIpPtzCamera( $SiteID, $ServerNODE, $CNAME, $CamID, $CSTR, $IMSIZE, $LFL, $ZOOM, $PANMODE, $PANANG, $TILTMODE, $TILTANG, $PTZ, $PROTOID, $UART ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; } else { $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); }; break; case ARGUS_IP_UART_GATEWAY://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, `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; + if(isset($_POST['UART_NAME'])) $NAME = $DATABASE->escape( $_POST['UART_NAME'] ); + if(isset($_POST['UART_SPEED'])) $SPD = intval( $_POST['UART_SPEED'] ); + if(isset($_POST['UART_BITS'])) $BITS = intval( $_POST['UART_BITS'] ); + if(isset($_POST['UART_STOP'])) $STOP = floatval( $_POST['UART_STOP'] ); + if(isset($_POST['UART_PAR'])) $PAR = strtoupper( substr($_POST['UART_PAR'],0,1) ); + if(isset($_POST['UART_MODE'])) $MODE = intval( $_POST['UART_MODE'] ); + if(isset($_POST['UART_PORT'])) $PORT = intval( $_POST['UART_PORT'] ); + if(isset($_POST['UART_IP'])) $IP = $DATABASE->escape( $_POST['UART_IP'] ); + if(isset($_POST['UART_MAC'])) $MAC = $DATABASE->escape( $_POST['UART_MAC'] ); + if( $PORT && $IP != '' ){ + $Data['success'] = addEthernet2Serial( $SiteID, $ServerNODE, $NAME, $MAC, $IP, $PORT, $MODE, $SPD, $BITS, $STOP, $PAR ); + if( !$Data['success'] ){ + $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); + }; + } else { + $Data['msg'] = $Labels->GetLabel('PARAM_ERROR'); + }; break; }; } else { diff --git a/lib/controller/clearEventCloud.php b/lib/controller/clearEventCloud.php index ebae2ae..3578da3 100644 --- a/lib/controller/clearEventCloud.php +++ b/lib/controller/clearEventCloud.php @@ -1,11 +1,11 @@ Data['id'] > 1 ){ - $QS = "INSERT INTO `events_archive` (`id`, `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`ref_id`,`ref_uuid`) SELECT `id`, `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`ref_id`,`ref_uuid` FROM `events_cloud`"; - $DATABASE->Query( $QS, false ); - $QS = "DELETE FROM events_cloud"; - $DATABASE->Query( $QS, false ); + //$QS = "INSERT INTO `events_archive` (`id`, `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`ref_id`,`ref_uuid`) SELECT `id`, `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`ref_id`,`ref_uuid` FROM `events_cloud`"; + //$DATABASE->Query( $QS, false ); + $QS = "DELETE FROM events_cloud"; + $DATABASE->Query( $QS, false ); } else { - header('location: /'); + header('location: /'); }; ?> \ No newline at end of file diff --git a/lib/controller/dash/node_2.js b/lib/controller/dash/node_2.js index 4bbe47c..4f1790f 100644 --- a/lib/controller/dash/node_2.js +++ b/lib/controller/dash/node_2.js @@ -5,7 +5,7 @@ title: '%%%NODENAME%%%', listeners:{ afterrender: function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); drawZoomLevels[%%%NODEID%%%]=100; } }, @@ -31,7 +31,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } @@ -47,7 +47,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } @@ -63,7 +63,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } @@ -80,7 +80,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } diff --git a/lib/controller/dash/node_3.js b/lib/controller/dash/node_3.js index cdc6872..fd8ac9c 100644 --- a/lib/controller/dash/node_3.js +++ b/lib/controller/dash/node_3.js @@ -12,7 +12,7 @@ }], listeners:{ afterrender: function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); drawZoomLevels[%%%NODEID%%%]=100; } }, @@ -38,7 +38,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } @@ -54,7 +54,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } @@ -70,7 +70,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } @@ -87,7 +87,7 @@ var img = document.getElementById('draw_img_%%%NODEID%%%'); img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"; img.onload = function(){ - cleanupDraw( %%%NODEID%%% ); + cleanup2DDraw( %%%NODEID%%% ); }; }; } diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php index 8a80114..812ef60 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/getDashBoardItems.php @@ -90,7 +90,7 @@ $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( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL[$index] ); $TPL[$index] = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL[$index] ); $TPL[$index] = str_replace( '%%%SELURL%%%', $FU, $TPL[$index] ); $TPL[$index] = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL[$index] ); diff --git a/lib/controller/getDeviceDraw.php b/lib/controller/getDeviceDraw.php index eb281ae..aae6e5e 100644 --- a/lib/controller/getDeviceDraw.php +++ b/lib/controller/getDeviceDraw.php @@ -18,16 +18,26 @@ } elseif( isset($_GET['AUX']) ) { $AUX = intval($_GET['AUX']); } else $AUX = 0; + + if( isset( $_POST['MAP'] ) ){ + $TYPE = 2; + } elseif( isset($_GET['MAP']) ) { + $TYPE = 2; + } else $TYPE = 1; $QS = "SELECT * FROM lrf_draw WHERE node_id={$NID} ORDER BY ts DESC LIMIT 1"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ if( $SAVE_AS_PICTURE ){ if( $Result[0]['rendered'] == 'Y' ){ - if( $AUX ){ - $FN = "data/device_draws/{$Result[0]['md5']}_{$AUX}.png"; + if( $TYPE == 1 ){ + 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"; + $FN = "data/device_draws/{$Result[0]['md5']}_map.png"; }; } else { $FF = "data/device_draws/{$Result[0]['md5']}.raw"; @@ -72,8 +82,8 @@ 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 ); + $gray = imagecolorallocatealpha( $IM, 99, 111, 135, 0 ); imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); imagestring( $IM, 2, 6, 5, $MR . "m.", $black ); $maxR = 98.0; @@ -82,6 +92,8 @@ $y0 = 100; $ppA = array(); $ppB = array(); + $nnA = array(); + $nnB = array(); for( $i=0; $i< $as; $i++ ){ if( $pts[$i] > 0 ){ $cr = ($rst * $pts[$i]); @@ -96,12 +108,19 @@ $ppA[] = $y0 + $maxR * sin( $ca ); $ppB[] = $x0 + $maxR * cos( $ca ); $ppB[] = $y0 + $maxR * sin( $ca ); + + $nnA[] = $x0; + $nnA[] = $y0; + $nnB[] = $x0 + $maxR * cos( $ca ); + $nnB[] = $y0 + $maxR * sin( $ca ); }; }; $ppB[] = $ppA[count($ppA)-2]; $ppB[] = $ppA[count($ppA)-1]; $popo = array_merge( $ppA, $ppB ); + $nodra = array_merge( $nnA, $nnB ); imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagefilledpolygon( $IM, $nodra, count( $nodra ) / 2, $gray ); imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_100.png" ); imagedestroy( $IM ); @@ -109,13 +128,16 @@ 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 ); + $gray = imagecolorallocatealpha( $IM, 99, 111, 135, 0 ); imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, ( $MR / 2 ) . "m.", $black ); + $NMR = sprintf( "%.2f", ( $MR / 2 ) ); + imagestring( $IM, 2, 6, 5, $NMR . "m.", $black ); $rst = $maxR / 513.0; $ppA = array(); $ppB = array(); + $nnA = array(); + $nnB = array(); for( $i=0; $i< $as; $i++ ){ if( $pts[$i] > 0 && $pts[$i] < 513 ){ $cr = ($rst * $pts[$i]); @@ -130,12 +152,18 @@ $ppA[] = $y0 + $maxR * sin( $ca ); $ppB[] = $x0 + $maxR * cos( $ca ); $ppB[] = $y0 + $maxR * sin( $ca ); + $nnA[] = $x0; + $nnA[] = $y0; + $nnB[] = $x0 + $maxR * cos( $ca ); + $nnB[] = $y0 + $maxR * sin( $ca ); }; }; $ppB[] = $ppA[count($ppA)-2]; $ppB[] = $ppA[count($ppA)-1]; $popo = array_merge( $ppA, $ppB ); + $nodra = array_merge( $nnA, $nnB ); imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagefilledpolygon( $IM, $nodra, count( $nodra ) / 2, $gray ); imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_50.png" ); imagedestroy( $IM ); @@ -143,13 +171,16 @@ 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 ); + $gray = imagecolorallocatealpha( $IM, 99, 111, 135, 0 ); imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, ( $MR / 4 ) . "m.", $black ); + $NMR = sprintf( "%.2f", ( $MR / 4 ) ); + imagestring( $IM, 2, 6, 5, $NMR . "m.", $black ); $rst = $maxR / 257.0; $ppA = array(); $ppB = array(); + $nnA = array(); + $nnB = array(); for( $i=0; $i< $as; $i++ ){ if( $pts[$i] > 0 && $pts[$i] < 256 ){ $cr = ($rst * $pts[$i]); @@ -164,12 +195,18 @@ $ppA[] = $y0 + $maxR * sin( $ca ); $ppB[] = $x0 + $maxR * cos( $ca ); $ppB[] = $y0 + $maxR * sin( $ca ); + $nnA[] = $x0; + $nnA[] = $y0; + $nnB[] = $x0 + $maxR * cos( $ca ); + $nnB[] = $y0 + $maxR * sin( $ca ); }; }; $ppB[] = $ppA[count($ppA)-2]; $ppB[] = $ppA[count($ppA)-1]; $popo = array_merge( $ppA, $ppB ); + $nodra = array_merge( $nnA, $nnB ); imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagefilledpolygon( $IM, $nodra, count( $nodra ) / 2, $gray ); imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_25.png" ); imagedestroy( $IM ); @@ -177,13 +214,16 @@ 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 ); + $gray = imagecolorallocatealpha( $IM, 99, 111, 135, 0 ); imagefilledrectangle( $IM, 5, 5, 36, 18, $bg ); - imagestring( $IM, 2, 6, 5, ( $MR / 8 ) . "m.", $black ); + $NMR = sprintf( "%.2f", ( $MR / 8 ) ); + imagestring( $IM, 2, 6, 5, $NMR . "m.", $black ); $rst = $maxR / 129.0; $ppA = array(); $ppB = array(); + $nnA = array(); + $nnB = array(); for( $i=0; $i< $as; $i++ ){ if( $pts[$i] > 0 && $pts[$i] < 128 ){ $cr = ($rst * $pts[$i]); @@ -198,12 +238,18 @@ $ppA[] = $y0 + $maxR * sin( $ca ); $ppB[] = $x0 + $maxR * cos( $ca ); $ppB[] = $y0 + $maxR * sin( $ca ); + $nnA[] = $x0; + $nnA[] = $y0; + $nnB[] = $x0 + $maxR * cos( $ca ); + $nnB[] = $y0 + $maxR * sin( $ca ); }; }; $ppB[] = $ppA[count($ppA)-2]; $ppB[] = $ppA[count($ppA)-1]; $popo = array_merge( $ppA, $ppB ); + $nodra = array_merge( $nnA, $nnB ); imagefilledpolygon( $IM, $popo, count( $popo ) / 2, $green ); + imagefilledpolygon( $IM, $nodra, count( $nodra ) / 2, $gray ); imagepng( $IM, "data/device_draws/{$Result[0]['md5']}_12.png" ); imagedestroy( $IM ); $QS = "UPDATE lrf_draw SET rendered='Y' WHERE id={$Result[0]['id']}"; diff --git a/lib/controller/getEventDates.php b/lib/controller/getEventDates.php new file mode 100644 index 0000000..7e26f4d --- /dev/null +++ b/lib/controller/getEventDates.php @@ -0,0 +1,22 @@ +Data['id'] > 1 ){ + if( isset( $_POST['NID'] ) ) $FID = intval( $_POST['NID'] ); else $FID = 0; + if( isset( $_POST['SYE'] ) ) $SYE = intval( $_POST['SYE'] ); else $SYE = intval(date("Y")); //Current Year + if( isset( $_POST['SMO'] ) ) $SMO = intval( $_POST['SMO'] ); else $SMO = intval(date("m")); //Current Month + $Data = array(); + if( $FID ){ + $QS = "SELECT DISTINCT DAY(FROM_UNIXTIME(ts)) as d FROM events_archive WHERE node_id={$FID} AND YEAR(FROM_UNIXTIME(ts))={$SYE} AND MONTH(FROM_UNIXTIME(ts))={$SMO}"; + } else { + $QS = "SELECT DISTINCT DAY(FROM_UNIXTIME(ts)) as d FROM events_archive WHERE YEAR(FROM_UNIXTIME(ts))={$SYE} AND MONTH(FROM_UNIXTIME(ts))={$SMO}"; + }; + $Data['status'] = 'ok'; + $Data['days'] = array(); + $RR = $DATABASE->Query( $QS ); + foreach( $RR as $R ) $Data['days'][] = intval( $R['d'] ); + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getEventRecords.php b/lib/controller/getEventRecords.php index e5d511d..51aad4d 100644 --- a/lib/controller/getEventRecords.php +++ b/lib/controller/getEventRecords.php @@ -1,94 +1,142 @@ Query( $QS ); - if( count( $RV ) ){ - return $RV[0]['name']; - }; - return '-NoName-'; - } else { - return 'Argus Server'; - }; + global $DATABASE; + $EID = intval( $NID ); + if( $EID ){ + $QS = "SELECT name FROM nodes WHERE id={$EID}"; + $RV = $DATABASE->Query( $QS ); + if( count( $RV ) ){ + return $RV[0]['name']; + }; + return '-NoName-'; + } else { + return 'Argus Server'; + }; }; - if( $CUser->Data['id'] > 1 ){ - $Data = array(); - $GID = intval($_POST['SITE']); - $QS = "SELECT * FROM events_cloud ORDER BY id DESC LIMIT 20"; - $Result = $DATABASE->Query( $QS, false ); - date_default_timezone_set('UTC'); - //foreach( array_reverse ( $Result ) as $CD ){ - foreach( $Result as $CD ){ - $cnode['has_target'] = false; - $cnode['has_geo'] = false; - switch( intval( $CD['evt_type'] ) ){ - case 0:// NoInit - case 1:// Ready - case 2:// Alarm - case 3:// Command - case 4:// Key - case 5:// Joystick - continue; break; - case 6:// STUDY - $cnode['event']='Device Enters Into Study Mode'; - break; - case 7:// BUSY - $cnode['event']='Device Is BUSY'; - break; - case 8:// FLIP - $cnode['event']='Flip Complete'; - break; - case 9:// SCAN - $cnode['event']='Scan Complete'; - break; - case 10:// Target 1D - case 11:// Target 3DW - case 12:// Target 3DB - case 13:// Target 2DW - case 14:// Target 2DB - $cnode['event']='Target'; - $cnode['data'] = sprintf("AZ: %0.2f El: %0.2f R: %0.2f", floatval($CD['azimuth']), floatval($CD['elevation']), floatval($CD['range'])); - $cnode['has_target'] = true; - $cnode['has_geo'] = true; - break; - case 15:// Capture Start - case 16:// Capture End - case 17:// Capture Done - case 18:// Mission Begin - case 19:// Cancel Action - case 20:// Fly To - case 21:// WayPoint - case 22:// Dest Reached - case 23:// Jaming Begin - case 24:// Jamer On - case 25:// Jamer Off - case 26:// Target Locked - case 27:// Intercept Begin - case 28:// Intercept OK - case 29:// Intercept NOK - case 20:// Mission End - case 31:// Landed - case 32:// FH Busy - case 33:// Camera DM - case 34:// Error - default: - continue; - break; - }; - $cnode['id'] = intval( $CD['id'] ); - $uts = intval($CD['ts']); - $cnode['date'] = date( "m.d.y", $uts ); - $cnode['time'] = date( "H:m:s", $uts ); - $cnode['device'] = getNodeName( $CD['node_id'] ); - $Data[] = $cnode; + function getEventImages( $eid ){ + global $DATABASE; + $QS = "SELECT pic.md5 AS md5 FROM events_2_pictures ep LEFT JOIN pictures pic ON ( pic.id = ep.picture_id ) WHERE ep.evt_id={$eid}"; + $r = $DATABASE->Query( $QS ); + $rv = array(); + foreach( $r as $t ) $rv[] = $r['md5']; + return $rv; }; - $RA['log']=$Data; - $RA['totalCount'] = count( $Data ); - echo json_encode( $RA ); + + if( $CUser->Data['id'] > 1 ){ + $Data = array(); + //$GID = intval($_POST['']); + if( isset( $_POST['SITE'] ) ) $SITE = intval( $_POST['SITE'] ); else $SITE = 1; + if( isset( $_POST['MODE'] ) ) if( $_POST['MODE'] == 'live' ) $Mode = 1; else $Mode = 0; + if( isset( $_POST['FIL'] ) ) $FIL = intval( $_POST['FIL'] ); else $FIL = 0; + if( $Mode ){ + if( $FIL ){ + $QS = "SELECT * FROM events_cloud WHERE node_id={$FIL} ORDER BY id DESC LIMIT 20"; + } else { + $QS = "SELECT * FROM events_cloud ORDER BY id DESC LIMIT 20"; + }; + } else { + if( isset( $_POST['SDA'] ) ) $SDA = intval( $_POST['SDA'] ); else $SDA = 0; + if( $SDA ){ + if( isset( $_POST['SMO'] ) ) $SMO = intval( $_POST['SMO'] ); + if( isset( $_POST['SYE'] ) ) $SYE = intval( $_POST['SYE'] ); + if( isset( $_POST['STM'] ) ) $STM = intval( $_POST['STM'] ); + if( isset( $_POST['ETM'] ) ) $ETM = intval( $_POST['ETM'] ); + date_default_timezone_set('UTC'); + $T = sprintf( "%04d-%02d-%02d", $SYE, $SMO, $SDA ); + $CTS = strtotime( $T ); + if( $STM && $ETM ){ + $STS = $CTS + $STM; + $ETS = $CTS + $ETM; + } else { + $STS = $CTS; + $ETS = $CTS + 86400; + }; + if( $FIL ){ + $QS = "SELECT * FROM events_archive WHERE node_id={$FIL} AND ts >= {$STS} AND ts <= {$ETS} ORDER BY id DESC LIMIT 20"; + } else { + $QS = "SELECT * FROM events_archive WHERE ts >= {$STS} AND ts <= {$ETS} ORDER BY id DESC LIMIT 20"; + }; + } else { + if( $FIL ){ + $QS = "SELECT * FROM events_archive WHERE node_id={$FIL} ORDER BY id DESC LIMIT 20"; + } else { + $QS = "SELECT * FROM events_archive ORDER BY id DESC LIMIT 20"; + }; + }; + }; + $Result = $DATABASE->Query( $QS, false ); + date_default_timezone_set('UTC'); + //foreach( array_reverse ( $Result ) as $CD ){ + foreach( $Result as $CD ){ + $cnode['has_target'] = false; + $cnode['has_geo'] = false; + $cnode['images'] = getEventImages( $CD['id'] ); + $cnode['has_images'] = count( $cnode['images'] ) > 0; + switch( intval( $CD['evt_type'] ) ){ + case 0:// NoInit + case 1:// Ready + case 2:// Alarm + case 3:// Command + case 4:// Key + case 5:// Joystick + continue; + case 6:// STUDY + $cnode['event']='Device Enters Into Study Mode'; + break; + case 7:// BUSY + $cnode['event']='Device Is BUSY'; + break; + case 8:// FLIP + $cnode['event']='Flip Complete'; + break; + case 9:// SCAN + $cnode['event']='Scan Complete'; + break; + case 10:// Target 1D + case 11:// Target 3DW + case 12:// Target 3DB + case 13:// Target 2DW + case 14:// Target 2DB + $cnode['event']='Target'; + $cnode['data'] = sprintf("AZ: %0.2f El: %0.2f R: %0.2f", floatval($CD['azimuth']), floatval($CD['elevation']), floatval($CD['range'])); + $cnode['has_target'] = true; + $cnode['has_geo'] = true; + break; + case 15:// Capture Start + case 16:// Capture End + case 17:// Capture Done + case 18:// Mission Begin + case 19:// Cancel Action + case 20:// Fly To + case 21:// WayPoint + case 22:// Dest Reached + case 23:// Jaming Begin + case 24:// Jamer On + case 25:// Jamer Off + case 26:// Target Locked + case 27:// Intercept Begin + case 28:// Intercept OK + case 29:// Intercept NOK + case 20:// Mission End + case 31:// Landed + case 32:// FH Busy + case 33:// Camera DM + case 34:// Error + default: + continue; + }; + $cnode['id'] = intval( $CD['id'] ); + $uts = intval($CD['ts']); + $cnode['date'] = date( "m.d.y", $uts ); + $cnode['time'] = date( "H:m:s", $uts ); + $cnode['device'] = getNodeName( $CD['node_id'] ); + $Data[] = $cnode; + }; + $RA['log']=$Data; + $RA['totalCount'] = count( $Data ); + echo json_encode( $RA ); } else { - header('location: /'); + header('location: /'); }; ?> \ No newline at end of file diff --git a/lib/controller/getGeoAlerts.php b/lib/controller/getGeoAlerts.php index a66c9ab..4bb413c 100644 --- a/lib/controller/getGeoAlerts.php +++ b/lib/controller/getGeoAlerts.php @@ -3,60 +3,61 @@ require_once('../php/utm/gPoint.php'); if( $CUser->Data['id'] > 1 ){ - $Data = array(); - $Data['evt'] = array(); - $Data['other'] = array(); - $SID = intval($_POST['SITE']); - //$QS = "SELECT ec.id, ec.lon, ec.lat, ls.lon as src_lon, ls.lat as src_lat, ls.max_range as max_range FROM events_cloud ec LEFT JOIN nodes nd ON ( nd.id = ec.node_id ) LEFT JOIN lrf_sensors ls ON ( ls.id = nd.aux_id ) WHERE ec.lat IS NOT NULL AND ec.lon IS NOT NULL ORDER BY ec.ts DESC, ec.ts_ms DESC LIMIT 20"; - $QS = "SELECT ec.id, ec.lon, ec.lat FROM events_cloud ec WHERE ec.lat IS NOT NULL AND ec.lon IS NOT NULL ORDER BY ec.ts DESC, ec.ts_ms DESC LIMIT 20"; - $Result = $DATABASE->Query( $QS, false ); - date_default_timezone_set('UTC'); - //foreach( array_reverse ( $Result ) as $CD ){ - foreach( $Result as $CD ){ - $Data['evt'][] = $CD; - }; - $QS = "SELECT * FROM target_filters WHERE site_id={$SID}"; - $Result = $DATABASE->Query( $QS, false ); - foreach( $Result as $R ){ - switch( $R['type'] ){ - case 1:{ - //APF - $QS = "SELECT * FROM `target_filter_apf` WHERE `id`={$R['aux_id']}"; - $Juno = $DATABASE->Query( $QS, false ); - if( count( $Juno ) ){ - $CC = $Juno[0]; - $A = new gPoint(); - $A->setLongLat($CC['lon'],$CC['lat']); - $A->convertLLtoTM(); - $XC = $A->E(); - $YC = $A->N(); - $Z = $A->Z(); - $ANG = (pi()/180)*floatval( $CC['yaw'] ); - $QS = "SELECT * FROM `target_filter_apf_boxes` WHERE `filter_id`={$R['aux_id']}"; - $Obubu = $DATABASE->Query( $QS, false ); - foreach( $Obubu as $G ){ - $P['type']='circle'; - $P['color']='#00FF00'; - $TX = floatval($G['x']); - $TY = floatval($G['y']); - $CR = sqrt($TX*$TX+$TY*$TY); - if( $TX != 0 ){ - $CA = atan( $TY/$TX ); - } else { - $CA = 0; - }; - $A->setUTM($XC+$CR*cos($CA+$ANG),$YC+$CR*sin($CA+$ANG),$Z); - $A->convertTMtoLL(); - $P['loc']=array('lat'=>$A->Lat(),'lon'=>$A->Long()); - $Data['other'][] = $P; + $Data = array(); + $Data['evt'] = array(); + $Data['other'] = array(); + $SID = intval($_POST['SITE']); + //$QS = "SELECT ec.id, ec.lon, ec.lat, ls.lon as src_lon, ls.lat as src_lat, ls.max_range as max_range FROM events_cloud ec LEFT JOIN nodes nd ON ( nd.id = ec.node_id ) LEFT JOIN lrf_sensors ls ON ( ls.id = nd.aux_id ) WHERE ec.lat IS NOT NULL AND ec.lon IS NOT NULL ORDER BY ec.ts DESC, ec.ts_ms DESC LIMIT 20"; + $QS = "SELECT ec.id, ec.lon, ec.lat FROM events_cloud ec WHERE ec.lat IS NOT NULL AND ec.lon IS NOT NULL ORDER BY ec.ts DESC, ec.ts_ms DESC LIMIT 20"; + $Result = $DATABASE->Query( $QS, false ); + date_default_timezone_set('UTC'); + //foreach( array_reverse ( $Result ) as $CD ){ + foreach( $Result as $CD ){ + $Data['evt'][] = $CD; + }; + $SSD = getServerNode( $SID ); + $QS="SELECT * FROM target_filters WHERE server_id={$SSD}"; + $Result = $DATABASE->Query( $QS, false ); + foreach( $Result as $R ){ + switch( $R['type'] ){ + case 1:{ + //APF + $QS = "SELECT * FROM `target_filter_apf` WHERE `id`={$R['aux_id']}"; + $Juno = $DATABASE->Query( $QS, false ); + if( count( $Juno ) ){ + $CC = $Juno[0]; + $A = new gPoint(); + $A->setLongLat($CC['lon'],$CC['lat']); + $A->convertLLtoTM(); + $XC = $A->E(); + $YC = $A->N(); + $Z = $A->Z(); + $ANG = (pi()/180)*floatval( $CC['yaw'] ); + $QS = "SELECT * FROM `target_filter_apf_boxes` WHERE `filter_id`={$R['aux_id']}"; + $Obubu = $DATABASE->Query( $QS, false ); + foreach( $Obubu as $G ){ + $P['type']='circle'; + $P['color']='#00FF00'; + $TX = floatval($G['x']); + $TY = floatval($G['y']); + $CR = sqrt($TX*$TX+$TY*$TY); + if( $TX != 0 ){ + $CA = atan( $TY/$TX ); + } else { + $CA = 0; + }; + $A->setUTM($XC+$CR*cos($CA+$ANG),$YC+$CR*sin($CA+$ANG),$Z); + $A->convertTMtoLL(); + $P['loc']=array('lat'=>$A->Lat(),'lon'=>$A->Long()); + $Data['other'][] = $P; + }; + }; + break; + }; }; - }; - break; }; - }; - }; - echo json_encode( $Data ); + echo json_encode( $Data ); } else { - header('location: /'); + header('location: /'); }; ?> \ No newline at end of file diff --git a/lib/controller/getGeoZones.php b/lib/controller/getGeoZones.php index 2a1ec12..bd36782 100644 --- a/lib/controller/getGeoZones.php +++ b/lib/controller/getGeoZones.php @@ -90,367 +90,412 @@ function ToLL($north, $east, $utmZone){ */ if( $CUser->Data['id'] > 1 ){ - $Data = array(); - $SID = intval( $_POST['SITE'] ); - if( $SID ){ - $QS = "SELECT * FROM nodes WHERE site_id={$SID} AND NOT ((type=0)OR(type=20))"; - $Result = $DATABASE->Query( $QS, false ); - date_default_timezone_set('UTC'); - foreach( $Result as $R ){ - switch( $R['type'] ){ - case 2:{ - // Lfs - MND - $QS = "SELECT lat, lon, yaw, roll, pitch, max_range FROM lrf_sensors WHERE id={$R['aux_id']}"; - $D = $DATABASE->Query( $QS, false ); - if( count( $D ) ){ - $CC = $D[0]; - $A = new gPoint(); - $A->setLongLat($CC['lon'],$CC['lat']); - $A->convertLLtoTM(); - $XC = $A->E(); - $YC = $A->N(); - $Z = $A->Z(); - $RAN = floatval( $CC['max_range'] ); - if( 1 ){ - $K = pi()/18.0;//10 deg - $Points = array(); - $Points[] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $SANG = ( pi() / 180 ) * floatval( $CC['yaw'] ); - for( $i = 0; $i < 11; $i++ ){ - $CA = $i * $K; - $B = new gPoint(); - $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z ); - $B->convertTMtoLL(); - $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Data = array(); + $SID = intval( $_POST['SITE'] ); + if( $SID ){ + $QS = "SELECT * FROM `sites` WHERE `id`={$SID}"; + $SR = $DATABASE->Query( $QS, false ); + if( count( $SR ) ){ + $SS = $SR[0]; + $ANCHOR = new gPoint(); + $ANCHOR->setLongLat( floatval( $SS['anchor_lon'] ), floatval( $SS['anchor_lat'] ) ); + $ANCHOR->convertLLtoTM(); + $BASE_X = $ANCHOR->E(); + $BASE_Y = $ANCHOR->N(); + $BASE_Z = floatval( $SS['anchor_alt'] ); + $BASE_ZONE = $ANCHOR->Z(); + $QS = "SELECT * FROM nodes WHERE site_id={$SID} AND NOT ((type=0)OR(type=20))"; + $Result = $DATABASE->Query( $QS, false ); + date_default_timezone_set('UTC'); + //print_r( $Result ); + foreach( $Result as $R ){ + $Zone = array(); + switch( $R['type'] ){ + case 2:{ + break; + // Lfs - MND + $QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range FROM lrf_sensors WHERE id={$R['aux_id']}"; + $D = $DATABASE->Query( $QS, false ); + if( count( $D ) ){ + $CC = $D[0]; + $A = new gPoint(); + $A->setUTM( $CC['x'], $CC['y'] ); + $A->convertTMtoLL(); + $LAT = $A->Lat(); + $LON = $A->Long(); + //$A->setLongLat($CC['lon'],$CC['lat']); + //$A->convertLLtoTM(); + $XC = $A->E(); + $YC = $A->N(); + $Z = $A->Z(); + $RAN = floatval( $CC['max_range'] ); + if( 1 ){ + $K = pi()/18.0;//10 deg + $Points = array(); + $Points[] = array( 'lat'=>$LAT, 'lon'=>$LON ); + $SANG = ( pi() / 180 ) * floatval( $CC['yaw'] ); + for( $i = 0; $i < 11; $i++ ){ + $CA = $i * $K; + $B = new gPoint(); + $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z ); + $B->convertTMtoLL(); + $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + }; + + if(1){ + $ZMARK = array(); + $B = new gPoint(); + + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + + //$SANG = $SANG - ( pi() / 180 ); + //$RAN = $RAN + 0.5; + //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + //$B->convertTMtoLL(); + //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + + //$SANG = $SANG + ( pi() / 180 ); + //$RAN = $RAN + 0.5; + //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + //$B->convertTMtoLL(); + //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + + //$SANG = $SANG + ( pi() / 180 ); + //$RAN = $RAN - 0.5; + //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + //$B->convertTMtoLL(); + //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + } + + $Zone['type']='poly'; + $Zone['points']=$Points; + $Zone['color'] = '#880000'; + $Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON ); + } else { + /* + $A->setUTM( $XC-$RAN, $YC+$RAN, $Z ); + $A->convertTMtoLL(); + $LTLAT = $A->Lat(); + $LTLON = $A->Long(); + $A->setUTM( $XC+$RAN, $YC-$RAN, $Z ); + $A->convertTMtoLL(); + $RBLAT = $A->Lat(); + $RBLON = $A->Long(); + $Zone['type']='image'; + $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; + $Zone['bounds']=array(array($LTLAT,$LTLON),array($RBLAT,$RBLON)); + //*/ + //* + $RA = sqrt( $RAN * $RAN * 2 ); + $CA = ( pi() / 180 ) * floatval( $CC['yaw'] ); + $SANG = pi()/4*3; + $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); + $A->convertTMtoLL(); + $Zone['type']='image_rot'; + $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; + $Zone['topleft']=array($A->Lat(),$A->Long()); + $SANG = pi() / 4; + $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); + $A->convertTMtoLL(); + $Zone['topright']=array($A->Lat(),$A->Long()); + $SANG = pi() / 4*5; + $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); + $A->convertTMtoLL(); + $Zone['bottomleft']=array($A->Lat(),$A->Long()); + + $ZMARK = array(); + $B = new gPoint(); + + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + //*/ + }; + $Zone['name'] = $R['name']; + $Data[] = $Zone; + }; + break; + }; + case 3:{ + // PLS 200 + $QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range, base_shift FROM lrf_sensors WHERE id={$R['aux_id']}"; + $D = $DATABASE->Query( $QS, false ); + $Zone['dev_is_source'] = true; + $Zone['dev_type'] = 3; + $Zone['dev_id'] = intval( $R['id'] ); + $Zone['dev_name'] = $R['name']; + if( count( $D ) ){ + $CC = $D[0]; + $A = new gPoint(); + $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE ); + $A->convertTMtoLL(); + $LAT = $A->Lat(); + $LON = $A->Long(); + + //$A = new gPoint(); + //$A->setLongLat($CC['lon'],$CC['lat']); + //$A->convertLLtoTM(); + $XC = $A->E(); + $YC = $A->N(); + $Z = $A->Z(); + $RAN = floatval( $CC['max_range'] ); + if(1){ + $K = pi()/ 36; // 10 deg// + $Points = array(); + $Points[] = array( 'lat'=>$LAT, 'lon'=>$LON ); + $SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ) + ( pi()/3000.0 * floatval( $CC['base_shift'] ) ); + for( $i = 0; $i < 42; $i++ ){ + $CA = $i * $K; + $B = new gPoint(); + $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z ); + $B->convertTMtoLL(); + $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + }; + + if(1){ + $ZMARK = array(); + $B = new gPoint(); + // PLS + $SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) ); + + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + + //$SANG = $SANG - ( pi() / 180 ); + //$RAN = $RAN + 0.5; + //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + //$B->convertTMtoLL(); + //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + + //$SANG = $SANG + ( pi() / 180 ); + //$RAN = $RAN + 0.5; + //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + //$B->convertTMtoLL(); + //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + + //$SANG = $SANG + ( pi() / 180 ); + //$RAN = $RAN - 0.5; + //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + //$B->convertTMtoLL(); + //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + } + $Zone['type']='poly'; + $Zone['points']=$Points; + $Zone['color'] = '#880000'; + $Zone['center'] = array( 'lat'=>$LAT,'lon'=>$LON ); + } else { + /* + $A->setUTM( $XC-$RAN, $YC+$RAN, $Z ); + $A->convertTMtoLL(); + $LTLAT = $A->Lat(); + $LTLON = $A->Long(); + $A->setUTM( $XC+$RAN, $YC-$RAN, $Z ); + $A->convertTMtoLL(); + $RBLAT = $A->Lat(); + $RBLON = $A->Long(); + $Zone['type']='image'; + $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; + $Zone['bounds']=array(array($LTLAT,$LTLON),array($RBLAT,$RBLON)); + //*/ + //* + $RA = sqrt( $RAN * $RAN * 2 ); + $CA = ( pi() / 180 ) * floatval( $CC['yaw'] ); + $SANG = pi()/4*3; + $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); + $A->convertTMtoLL(); + $Zone['type']='image_rot'; + $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; + $Zone['topleft']=array($A->Lat(),$A->Long()); + $SANG = pi() / 4; + $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); + $A->convertTMtoLL(); + $Zone['topright']=array($A->Lat(),$A->Long()); + $SANG = pi() / 4*5; + $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); + $A->convertTMtoLL(); + $Zone['bottomleft']=array($A->Lat(),$A->Long()); + //*/ + $ZMARK = array(); + $B = new gPoint(); + + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + }; + $Zone['name'] = $R['name']; + $Data[] = $Zone; + }; + break; + }; + case 5:{ + // 3D + $QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range FROM lrf_sensors WHERE id={$R['aux_id']}"; + $D = $DATABASE->Query( $QS, false ); + $Zone['dev_is_source'] = true; + $Zone['dev_type'] = 5; + $Zone['dev_id'] = intval( $R['id'] ); + $Zone['dev_name'] = $R['name']; + if( count( $D ) ){ + $CC = $D[0]; + $A = new gPoint(); + $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE ); + $A->convertTMtoLL(); + $LAT = $A->Lat(); + $LON = $A->Long(); + + //$A = new gPoint(); + //$A->setLongLat($CC['lon'],$CC['lat']); + //$A->convertLLtoTM(); + $YC = $A->N(); + $XC = $A->E(); + $Z = $A->Z(); + + $Zone['type']='circle'; + $Zone['radius'] = floatval( $CC['max_range'] ); + $Zone['color'] = '#8800FF'; + $Zone['center'] = array('lat'=>$LAT,'lon'=>$LON); + + $SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ); + $RAN = floatval( $CC['max_range'] ); + $ZMARK = array(); + $B = new gPoint(); + + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + $Zone['name'] = $R['name']; + $Data[] = $Zone; + }; + break; + }; + case 13:{ + // Camera PTZ; + $QS = "SELECT x, y, x_rot, y_rot, z_rot, max_range, pan_angles FROM cameras WHERE id={$R['aux_id']}"; + $D = $DATABASE->Query( $QS, false ); + if( count( $D ) ){ + $CC = $D[0]; + + $A = new gPoint(); + $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE ); + $A->convertTMtoLL(); + $LAT = $A->Lat(); + $LON = $A->Long(); + $YC = $A->N(); + $XC = $A->E(); + $Z = $A->Z(); + if( intval( $CC['pan_angles'] ) < 360 ){ + $Points = array(); + $A = new gPoint(); + $Points[] = array( 'lat'=>$LAT, 'lon'=>$LON ); + $K = ( pi()/180.0 ) * floatval($CC['pan_angles']) / 40; + $SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ); + $RAN = floatval( $CC['max_range'] ); + for( $i = 0; $i < 41; $i++ ){ + $CA = $i * $K; + $B = new gPoint(); + $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z ); + $B->convertTMtoLL(); + $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + }; + $Zone['type']='poly'; + $Zone['points']=$Points; + $Zone['color'] = '#000088'; + $Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON ); + $ZMARK = array(); + $B = new gPoint(); + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + } else { + $Zone['type']='circle'; + $Zone['radius'] = floatval( $CC['max_range'] ); + $Zone['color'] = '#000088'; + $Zone['center'] = array('lat'=>$LAT,'lon'=>$LON); + $SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ); + $RAN = floatval( $CC['max_range'] ); + $ZMARK = array(); + $B = new gPoint(); + //$RAN = $RAN - 0.5; + $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); + $B->convertTMtoLL(); + $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); + $Zone['zang'] = $ZMARK; + }; + $Zone['name'] = $R['name']; + $Data[] = $Zone; + }; + break; + }; + }; }; - - if(1){ - $ZMARK = array(); - $B = new gPoint(); - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - - //$SANG = $SANG - ( pi() / 180 ); - //$RAN = $RAN + 0.5; - //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - //$B->convertTMtoLL(); - //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - - //$SANG = $SANG + ( pi() / 180 ); - //$RAN = $RAN + 0.5; - //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - //$B->convertTMtoLL(); - //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - - //$SANG = $SANG + ( pi() / 180 ); - //$RAN = $RAN - 0.5; - //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - //$B->convertTMtoLL(); - //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - } - - $Zone['type']='poly'; - $Zone['points']=$Points; - $Zone['color'] = '#880000'; - $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $Data[] = $Zone; - } else { - /* - $A->setUTM( $XC-$RAN, $YC+$RAN, $Z ); - $A->convertTMtoLL(); - $LTLAT = $A->Lat(); - $LTLON = $A->Long(); - $A->setUTM( $XC+$RAN, $YC-$RAN, $Z ); - $A->convertTMtoLL(); - $RBLAT = $A->Lat(); - $RBLON = $A->Long(); - $Zone['type']='image'; - $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; - $Zone['bounds']=array(array($LTLAT,$LTLON),array($RBLAT,$RBLON)); - //*/ - //* - $RA = sqrt( $RAN * $RAN * 2 ); - $CA = ( pi() / 180 ) * floatval( $CC['yaw'] ); - $SANG = pi()/4*3; - $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); - $A->convertTMtoLL(); - $Zone['type']='image_rot'; - $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; - $Zone['topleft']=array($A->Lat(),$A->Long()); - $SANG = pi() / 4; - $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); - $A->convertTMtoLL(); - $Zone['topright']=array($A->Lat(),$A->Long()); - $SANG = pi() / 4*5; - $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); - $A->convertTMtoLL(); - $Zone['bottomleft']=array($A->Lat(),$A->Long()); - - $ZMARK = array(); - $B = new gPoint(); - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - //*/ - }; - $Data[] = $Zone; - }; - break; - }; - case 3:{ - // PLS 200 - $QS = "SELECT lat, lon, yaw, roll, pitch, max_range FROM lrf_sensors WHERE id={$R['aux_id']}"; - $D = $DATABASE->Query( $QS, false ); - if( count( $D ) ){ - $CC = $D[0]; - $A = new gPoint(); - $A->setLongLat($CC['lon'],$CC['lat']); - $A->convertLLtoTM(); - $XC = $A->E(); - $YC = $A->N(); - $Z = $A->Z(); - $RAN = floatval( $CC['max_range'] ); - if(1){ - $K = pi()/18.0;//10 deg - $Points = array(); - $Points[] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $SANG = ( pi() / 180 ) * floatval( $CC['yaw'] ) - $K; - for( $i = 0; $i < 21; $i++ ){ - $CA = $i * $K; - $B = new gPoint(); - $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z ); - $B->convertTMtoLL(); - $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - }; - - if(1){ - $ZMARK = array(); - $B = new gPoint(); - // PLS - $SANG = $SANG + $K; - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - - //$SANG = $SANG - ( pi() / 180 ); - //$RAN = $RAN + 0.5; - //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - //$B->convertTMtoLL(); - //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - - //$SANG = $SANG + ( pi() / 180 ); - //$RAN = $RAN + 0.5; - //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - //$B->convertTMtoLL(); - //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - - //$SANG = $SANG + ( pi() / 180 ); - //$RAN = $RAN - 0.5; - //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - //$B->convertTMtoLL(); - //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - } - $Zone['type']='poly'; - $Zone['points']=$Points; - $Zone['color'] = '#880000'; - $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $Data[] = $Zone; - } else { /* - $A->setUTM( $XC-$RAN, $YC+$RAN, $Z ); - $A->convertTMtoLL(); - $LTLAT = $A->Lat(); - $LTLON = $A->Long(); - $A->setUTM( $XC+$RAN, $YC-$RAN, $Z ); - $A->convertTMtoLL(); - $RBLAT = $A->Lat(); - $RBLON = $A->Long(); - $Zone['type']='image'; - $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; - $Zone['bounds']=array(array($LTLAT,$LTLON),array($RBLAT,$RBLON)); - //*/ - //* - $RA = sqrt( $RAN * $RAN * 2 ); - $CA = ( pi() / 180 ) * floatval( $CC['yaw'] ); - $SANG = pi()/4*3; - $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); - $A->convertTMtoLL(); - $Zone['type']='image_rot'; - $Zone['url']='/lib/controller/getDeviceDraw.php?NID='.$R['id']; - $Zone['topleft']=array($A->Lat(),$A->Long()); - $SANG = pi() / 4; - $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); - $A->convertTMtoLL(); - $Zone['topright']=array($A->Lat(),$A->Long()); - $SANG = pi() / 4*5; - $A->setUTM( $XC + $RA * cos( $SANG + $CA ), $YC + $RA * sin( $SANG + $CA ), $Z ); - $A->convertTMtoLL(); - $Zone['bottomleft']=array($A->Lat(),$A->Long()); - //*/ - $ZMARK = array(); - $B = new gPoint(); - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - }; - $Data[] = $Zone; - }; - break; - }; - case 5:{ - // 3D - $QS = "SELECT lat, lon, yaw, roll, pitch, max_range FROM lrf_sensors WHERE id={$R['aux_id']}"; - $D = $DATABASE->Query( $QS, false ); - if( count( $D ) ){ - $CC = $D[0]; - $A->setLongLat($CC['lon'],$CC['lat']); - $A->convertLLtoTM(); - $YC = $A->N(); - $XC = $A->E(); - $Z = $A->Z(); - - $Zone['type']='circle'; - $Zone['radius'] = floatval( $CC['max_range'] ); - $Zone['color'] = '#880000'; - $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - - $SANG = ( pi() / 180 ) * floatval( $CC['yaw'] ); - $RAN = floatval( $CC['max_range'] ); - $ZMARK = array(); - $B = new gPoint(); - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - $Data[] = $Zone; - - }; - break; - }; - case 13:{ - // Camera PTZ; - $QS = "SELECT lat, lon, yaw, roll, pitch, max_range, pan_angles FROM cameras WHERE id={$R['aux_id']}"; - $D = $DATABASE->Query( $QS, false ); - if( count( $D ) ){ - $CC = $D[0]; - $A->setLongLat($CC['lon'],$CC['lat']); - $A->convertLLtoTM(); - $YC = $A->N(); - $XC = $A->E(); - $Z = $A->Z(); - if( intval( $CC['pan_angles'] ) < 360 ){ - $Points = array(); - $A = new gPoint(); - $Points[] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $K = ( pi()/180.0 ) * floatval($CC['pan_angles']) / 40; - $SANG = ( pi() / 180 ) * floatval( $CC['yaw'] ); - $RAN = floatval( $CC['max_range'] ); - for( $i = 0; $i < 41; $i++ ){ - $CA = $i * $K; - $B = new gPoint(); - $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z ); - $B->convertTMtoLL(); - $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - }; - $Zone['type']='poly'; - $Zone['points']=$Points; - $Zone['color'] = '#000088'; - $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $ZMARK = array(); - $B = new gPoint(); - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - } else { - $Zone['type']='circle'; - $Zone['radius'] = floatval( $CC['max_range'] ); - $Zone['color'] = '#000088'; - $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - $SANG = ( pi() / 180 ) * floatval( $CC['yaw'] ); - $RAN = floatval( $CC['max_range'] ); - $ZMARK = array(); - $B = new gPoint(); - - //$RAN = $RAN - 0.5; - $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z ); - $B->convertTMtoLL(); - $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long()); - $Zone['zang'] = $ZMARK; - }; - $Data[] = $Zone; - }; - break; - }; - }; - - }; - $QS="SELECT * FROM target_filters WHERE site_id={$SID}"; - $RF=$DATABASE->Query( $QS, false ); - foreach( $RF as $F ){ - switch( intval($F['type']) ){ - case 1:{ - $QS="SELECT * FROM target_filter_apf WHERE id={$F['aux_id']}"; - $SD=$DATABASE->Query( $QS, false ); - $CC=$SD[0]; - if( count($SD) ){ - $Zone['type']='poly'; - $Zone['color'] = '#FF00FF'; - $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); - - $QS="SELECT * FROM target_filter_apf_anchors WHERE filter_id={$F['aux_id']}"; - $RA=$DATABASE->Query( $QS, false ); - - $Points = array(); - $A = new gPoint(); - $A->setLongLat($CC['lon'],$CC['lat']); - $A->convertLLtoTM(); - $YC = $A->N(); - $XC = $A->E(); - $Z = $A->Z(); - $ANG = (pi()/180)*floatval( $CC['yaw'] ); - foreach( $RA as $G ){ - $TX = floatval($G['x']); - $TY = floatval($G['y']); - $CR = sqrt($TX*$TX+$TY*$TY); - if( $TX != 0 ){ - $CA = atan( $TY/$TX ); - } else { - $CA = 0; + $SSD = getServerNode( $SID ); + $QS="SELECT * FROM target_filters WHERE server_id={$SSD}"; + $RF=array();//$DATABASE->Query( $QS, false ); + foreach( $RF as $F ){ + switch( intval($F['type']) ){ + case 1:{ + $QS="SELECT * FROM target_filter_apf WHERE id={$F['aux_id']}"; + $SD=$DATABASE->Query( $QS, false ); + $CC=$SD[0]; + if( count($SD) ){ + $Zone['type']='poly'; + $Zone['color'] = '#FF00FF'; + $Zone['center'] = array('lat'=>$CC['lat'],'lon'=>$CC['lon']); + + $QS="SELECT * FROM target_filter_apf_anchors WHERE filter_id={$F['aux_id']}"; + $RA=$DATABASE->Query( $QS, false ); + + $Points = array(); + $A = new gPoint(); + $A->setLongLat($CC['lon'],$CC['lat']); + $A->convertLLtoTM(); + $YC = $A->N(); + $XC = $A->E(); + $Z = $A->Z(); + $ANG = (pi()/180)*floatval( $CC['yaw'] ); + foreach( $RA as $G ){ + $TX = floatval($G['x']); + $TY = floatval($G['y']); + $CR = sqrt($TX*$TX+$TY*$TY); + if( $TX != 0 ){ + $CA = atan( $TY/$TX ); + } else { + $CA = 0; + }; + $A->setUTM($XC+$CR*cos($CA+$ANG),$YC+$CR*sin($CA+$ANG),$Z); + $A->convertTMtoLL(); + $Points[]=array('lat'=>$A->Lat(),'lon'=>$A->Long()); + }; + $Zone['points']=$Points; + $Data[] = $Zone; + }; + break; + }; + }; }; - $A->setUTM($XC+$CR*cos($CA+$ANG),$YC+$CR*sin($CA+$ANG),$Z); - $A->convertTMtoLL(); - $Points[]=array('lat'=>$A->Lat(),'lon'=>$A->Long()); - }; - $Zone['points']=$Points; - $Data[] = $Zone; + */ }; - break; - }; }; - }; - }; - $ZZ['zones']=$Data; - $ZZ['totalCount'] = count( $Data ); - echo json_encode( $ZZ ); + $ZZ['zones']=$Data; + $ZZ['totalCount'] = count( $Data ); + echo json_encode( $ZZ ); } else { - header('location: /'); + header('location: /'); }; ?> \ No newline at end of file diff --git a/lib/controller/getLocationItems.php b/lib/controller/getLocationItems.php index b693b4f..403e175 100644 --- a/lib/controller/getLocationItems.php +++ b/lib/controller/getLocationItems.php @@ -1,57 +1,72 @@ Data['id'] > 1 ){ - $GID = intval($_POST['SITE']); - $QS = "SELECT * FROM sites WHERE id ={$GID}"; - $R = $DATABASE->Query( $QS, false ); + $GID = intval($_POST['SITE']); + $QS = "SELECT * FROM sites WHERE id ={$GID}"; + $R = $DATABASE->Query( $QS, false ); - $SLAT = $R[0]['anchor_lat']; - $SLON = $R[0]['anchor_lon']; - $SALT = $R[0]['anchor_alt']; - - $QS = "SELECT * FROM nodes WHERE site_id ={$GID}"; - $Result = $DATABASE->Query( $QS, false ); - foreach( $Result as $CD ){ - $cnode['id'] = intval($CD['id']); - $cnode['type'] = intval($CD['type']); - $index++; - $PUPA = false; - switch( $CD['type'] ){ - 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 lat, lon FROM lrf_sensors WHERE id={$CD['aux_id']}"; - $RV = $DATABASE->Query( $QS ); - $cnode['lat']=floatval($RV[0]['lat']); - $cnode['lon']=floatval($RV[0]['lon']); - if( $cnode['lat'] == 0 && $cnode['lon'] == 0 ){ - $cnode['lat'] = $SLAT; - $cnode['lon'] = $SLON; - }; - $PUPA = true; - break; - case ARGUS_ANALOG_STATIC_CAMERA: - case ARGUS_ANALOG_PTZ_CAMERA: - case ARGUS_IP_STATIC_CAMERA: - case ARGUS_IP_PTZ_CAMERA: - $QS="SELECT lat, lon FROM cameras WHERE id={$CD['aux_id']}"; - $RV = $DATABASE->Query( $QS ); - $cnode['lat']=floatval($RV[0]['lat']); - $cnode['lon']=floatval($RV[0]['lon']); - if( $cnode['lat'] == 0 && $cnode['lon'] == 0 ){ - $cnode['lat'] = $SLAT; - $cnode['lon'] = $SLON; - }; - $PUPA = true; - break; - }; - if( $PUPA ) $Data[] = $cnode; - }; - echo json_encode( $Data ); - } else { - echo "[]"; + $SLAT = $R[0]['anchor_lat']; + $SLON = $R[0]['anchor_lon']; + $SALT = $R[0]['anchor_alt']; + $A = new gPoint(); + $A->setLongLat( $SLON, $SLAT ); + $A->convertLLtoTM(); + $XC = $A->E(); + $YC = $A->N(); + $ZC = $A->Z(); + + $QS = "SELECT * FROM nodes WHERE site_id ={$GID}"; + $Result = $DATABASE->Query( $QS, false ); + foreach( $Result as $CD ){ + $cnode['id'] = intval($CD['id']); + $cnode['type'] = intval($CD['type']); + $index++; + $PUPA = false; + $CC = new gPoint(); + switch( $CD['type'] ){ + 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 x, y FROM lrf_sensors WHERE id={$CD['aux_id']}"; + $RV = $DATABASE->Query( $QS ); + if( floatval($RV[0]['x']) == 0 && floatval($RV[0]['y']) == 0 ){ + $cnode['lat'] = $SLAT; + $cnode['lon'] = $SLON; + } else { + $CC->setUTM( floatval($RV[0]['x']), floatval($RV[0]['y']), $ZC ); + $CC->convertTMtoLL(); + $cnode['lat']= $CC->Lat(); + $cnode['lon']= $CC->Long(); + }; + $PUPA = true; + break; + case ARGUS_ANALOG_STATIC_CAMERA: + case ARGUS_ANALOG_PTZ_CAMERA: + case ARGUS_IP_STATIC_CAMERA: + case ARGUS_IP_PTZ_CAMERA: + $QS="SELECT x, y FROM cameras WHERE id={$CD['aux_id']}"; + $RV = $DATABASE->Query( $QS ); + if( floatval($RV[0]['x']) == 0 && floatval($RV[0]['y']) == 0 ){ + $cnode['lat'] = $SLAT; + $cnode['lon'] = $SLON; + } else { + $CC->setUTM( floatval($RV[0]['x']), floatval($RV[0]['y']), $ZC ); + $CC->convertTMtoLL(); + $cnode['lat']= $CC->Lat(); + $cnode['lon']= $CC->Long(); + }; + $PUPA = true; + break; + }; + if( $PUPA ) $Data[] = $cnode; + }; + echo json_encode( $Data ); + } else { + echo "[]"; }; ?> \ No newline at end of file diff --git a/lib/controller/getLocationNodeProps.php b/lib/controller/getLocationNodeProps.php index a51d0df..4b02cd4 100644 --- a/lib/controller/getLocationNodeProps.php +++ b/lib/controller/getLocationNodeProps.php @@ -51,6 +51,7 @@ $Data = str_replace('%%%INFO%%%', $InfoData, $Data ); break; }; + case 10: case 13:{ $QS="SELECT * FROM cameras WHERE id={$Props['aux_id']}"; $RR = $DATABASE->Query( $QS ); diff --git a/lib/controller/getLocationNodes.php b/lib/controller/getLocationNodes.php index 8fd3553..923d134 100644 --- a/lib/controller/getLocationNodes.php +++ b/lib/controller/getLocationNodes.php @@ -8,8 +8,8 @@ foreach( $Result as $CD ){ $cid = intval($CD['id']); $ct = intval($CD['type']); - if( in_array( $ct, array( 2, 3, 5, 13 ) ) ){ - $Data .= "{ xtype: 'button', text: '{$CD['name']}', width: '100%', handler: function(){ locationSelectedNode={$cid}; loadNodeLocationProps({$cid}); } },"; + if( in_array( $ct, array( 2, 3, 5, 10, 13 ) ) ){ + $Data .= "{ xtype: 'button', text: '{$CD['name']}', width: '100%', handler: function(){ locationSelectedNode={$cid}; loadNodeLocationProps({$cid}); } },"; }; }; echo $Data . "{}] }"; diff --git a/lib/controller/resetAllSettings.php b/lib/controller/resetAllSettings.php index fe4053e..d594bcc 100644 --- a/lib/controller/resetAllSettings.php +++ b/lib/controller/resetAllSettings.php @@ -1,144 +1,29 @@ 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; - }; - // Handle Network Interfaces - case 100: - case 101: - case 102: - case 103: - case 104: - case 105:{ - $QS = "DELETE FROM `network_interfaces` WHERE `id`={$R['aux_id']}"; - $DATABASE->Query( $QS ); - $QS = "DELETE FROM `networks` WHERE `nif_id`={$R['aux_id']}"; - $DATABASE->Query( $QS ); - $QS = "DELETE FROM `network_infrastructure` WHERE `nif_id`={$R['aux_id']}"; - $DATABASE->Query( $QS ); - $QS = "DELETE FROM `wifis` WHERE `nif_id`={$R['aux_id']}"; - $DATABASE->Query( $QS ); - break; - }; - // Handle Access Point - case 125:{ - 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'] ); + //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 `nodes_qcq` SET `node_id`={$S['id']}, `cmd`=251"; + $QS = "INSERT INTO `nodes_qcq` SET `node_id`={$S['id']}, `cmd`=245";//251"; $DATABASE->Query( $QS ); }; + $Data['notifications'] = array(); + $Data['status']='OK'; } else { // Log Security Treat! $QS = "INSERT INTO `access_log` SET `ts`=NOW(), `user_id`={$UID}, `cmd`=13, `dataset`='{\"action\":255}'"; diff --git a/lib/javascript/cal/calendar-en.js b/lib/javascript/cal/calendar-en.js new file mode 100644 index 0000000..0dbde79 --- /dev/null +++ b/lib/javascript/cal/calendar-en.js @@ -0,0 +1,127 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + "Sun"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 0; + +// full month names +Calendar._MN = new Array +("January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "About the calendar"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Date selection:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + +"- Hold mouse button on any of the above buttons for faster selection."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- Click on any of the time parts to increase it\n" + +"- or Shift-click to decrease it\n" + +"- or click and drag for faster selection."; + +Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; +Calendar._TT["GO_TODAY"] = "Go Today"; +Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Select date"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; +Calendar._TT["PART_TODAY"] = " (today)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Display %s first"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; +Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Time:"; diff --git a/lib/javascript/cal/calendar-setup.js b/lib/javascript/cal/calendar-setup.js new file mode 100644 index 0000000..88c6933 --- /dev/null +++ b/lib/javascript/cal/calendar-setup.js @@ -0,0 +1,200 @@ +/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ + * --------------------------------------------------------------------------- + * + * The DHTML Calendar + * + * Details and latest version at: + * http://dynarch.com/mishoo/calendar.epl + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + * + * This file defines helper functions for setting up the calendar. They are + * intended to help non-programmers get a working calendar on their site + * quickly. This script should not be seen as part of the calendar. It just + * shows you what one can do with the calendar, while in the same time + * providing a quick and simple method for setting it up. If you need + * exhaustive customization of the calendar creation process feel free to + * modify this code to suit your needs (this is recommended and much better + * than modifying calendar.js itself). + */ + +// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $ + +/** + * This function "patches" an input field (or other element) to use a calendar + * widget for date selection. + * + * The "params" is a single object that can have the following properties: + * + * prop. name | description + * ------------------------------------------------------------------------------------------------- + * inputField | the ID of an input field to store the date + * displayArea | the ID of a DIV or other element to show the date + * button | ID of a button or other element that will trigger the calendar + * eventName | event that will trigger the calendar, without the "on" prefix (default: "click") + * ifFormat | date format that will be stored in the input field + * daFormat | the date format that will be used to display the date in displayArea + * singleClick | (true/false) wether the calendar is in single click mode or not (default: true) + * firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc. + * align | alignment (default: "Br"); if you don't know what's this see the calendar documentation + * range | array with 2 elements. Default: [1900, 2999] -- the range of years available + * weekNumbers | (true/false) if it's true (default) the calendar will display week numbers + * flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID + * flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar) + * disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar + * onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay) + * onClose | function that gets called when the calendar is closed. [default] + * onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar. + * date | the date that the calendar will be initially displayed to + * showsTime | default: false; if true the calendar will include a time selector + * timeFormat | the time format; can be "12" or "24", default is "12" + * electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close + * step | configures the step of the years in drop-down boxes; default: 2 + * position | configures the calendar absolute position; default: null + * cache | if "true" (but default: "false") it will reuse the same calendar object, where possible + * showOthers | if "true" (but default: "false") it will show days from other months too + * + * None of them is required, they all have default values. However, if you + * pass none of "inputField", "displayArea" or "button" you'll get a warning + * saying "nothing to setup". + */ +Calendar.setup = function (params) { + function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } }; + + param_default("inputField", null); + param_default("displayArea", null); + param_default("button", null); + param_default("eventName", "click"); + param_default("ifFormat", "%Y/%m/%d"); + param_default("daFormat", "%Y/%m/%d"); + param_default("singleClick", true); + param_default("disableFunc", null); + param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined + param_default("dateText", null); + param_default("firstDay", null); + param_default("align", "Br"); + param_default("range", [1900, 2999]); + param_default("weekNumbers", false); + param_default("flat", null); + param_default("flatCallback", null); + param_default("onSelect", null); + param_default("onClose", null); + param_default("onUpdate", null); + param_default("date", null); + param_default("showsTime", true); + param_default("timeFormat", "24"); + param_default("electric", true); + param_default("step", 2); + param_default("position", null); + param_default("cache", false); + param_default("showOthers", false); + param_default("multiple", null); + + var tmp = ["inputField", "displayArea", "button"]; + for (var i in tmp) { + if (typeof params[tmp[i]] == "string") { + params[tmp[i]] = document.getElementById(params[tmp[i]]); + } + } + if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { + alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code"); + return false; + } + + function onSelect(cal) { + var p = cal.params; + var update = (cal.dateClicked || p.electric); + if (update && p.inputField) { + p.inputField.value = cal.date.print(p.ifFormat); + if (typeof p.inputField.onchange == "function") + p.inputField.onchange(); + } + if (update && p.displayArea) + p.displayArea.innerHTML = cal.date.print(p.daFormat); + if (update && typeof p.onUpdate == "function") + p.onUpdate(cal); + if (update && p.flat) { + if (typeof p.flatCallback == "function") + p.flatCallback(cal); + } + if (update && p.singleClick && cal.dateClicked) + cal.callCloseHandler(); + }; + + if (params.flat != null) { + if (typeof params.flat == "string") + params.flat = document.getElementById(params.flat); + if (!params.flat) { + alert("Calendar.setup:\n Flat specified but can't find parent."); + return false; + } + var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); + cal.showsOtherMonths = params.showOthers; + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.params = params; + cal.weekNumbers = params.weekNumbers; + cal.setRange(params.range[0], params.range[1]); + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + if (params.ifFormat) { + cal.setDateFormat(params.ifFormat); + } + if (params.inputField && typeof params.inputField.value == "string") { + cal.parseDate(params.inputField.value); + } + cal.create(params.flat); + cal.show(); + return false; + } + + var triggerEl = params.button || params.displayArea || params.inputField; + triggerEl["on" + params.eventName] = function() { + var dateEl = params.inputField || params.displayArea; + var dateFmt = params.inputField ? params.ifFormat : params.daFormat; + var mustCreate = false; + var cal = window.calendar; + if (dateEl) + params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); + if (!(cal && params.cache)) { + window.calendar = cal = new Calendar(params.firstDay, + params.date, + params.onSelect || onSelect, + params.onClose || function(cal) { cal.hide(); }); + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.weekNumbers = params.weekNumbers; + mustCreate = true; + } else { + if (params.date) + cal.setDate(params.date); + cal.hide(); + } + if (params.multiple) { + cal.multiple = {}; + for (var i = params.multiple.length; --i >= 0;) { + var d = params.multiple[i]; + var ds = d.print("%Y%m%d"); + cal.multiple[ds] = d; + } + } + cal.showsOtherMonths = params.showOthers; + cal.yearStep = params.step; + cal.setRange(params.range[0], params.range[1]); + cal.params = params; + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + cal.setDateFormat(dateFmt); + if (mustCreate) + cal.create(); + cal.refresh(); + if (!params.position) + cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); + else + cal.showAt(params.position[0], params.position[1]); + return false; + }; + + return cal; +}; diff --git a/lib/javascript/cal/calendar-setup_stripped.js b/lib/javascript/cal/calendar-setup_stripped.js new file mode 100644 index 0000000..91c927f --- /dev/null +++ b/lib/javascript/cal/calendar-setup_stripped.js @@ -0,0 +1,21 @@ +/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ + * --------------------------------------------------------------------------- + * + * The DHTML Calendar + * + * Details and latest version at: + * http://dynarch.com/mishoo/calendar.epl + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + * + * This file defines helper functions for setting up the calendar. They are + * intended to help non-programmers get a working calendar on their site + * quickly. This script should not be seen as part of the calendar. It just + * shows you what one can do with the calendar, while in the same time + * providing a quick and simple method for setting it up. If you need + * exhaustive customization of the calendar creation process feel free to + * modify this code to suit your needs (this is recommended and much better + * than modifying calendar.js itself). + */ + Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&¶ms.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;}; \ No newline at end of file diff --git a/lib/javascript/cal/calendar.js b/lib/javascript/cal/calendar.js new file mode 100644 index 0000000..ac90842 --- /dev/null +++ b/lib/javascript/cal/calendar.js @@ -0,0 +1,1871 @@ +/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo + * ----------------------------------------------------------- + * + * The DHTML Calendar, version 1.0 "It is happening again" + * + * Details and latest version at: + * www.dynarch.com/projects/calendar + * + * This script is developed by Dynarch.com. Visit us at www.dynarch.com. + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + */ + +// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $ + +/** The Calendar object constructor. */ +Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { + // member variables + this.activeDiv = null; + this.currentDateEl = null; + this.getDateStatus = null; + this.getDateToolTip = null; + this.getDateText = null; + this.timeout = null; + this.onSelected = onSelected || null; + this.onClose = onClose || null; + this.dragging = false; + this.hidden = false; + this.minYear = 1970; + this.maxYear = 2050; + this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; + this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; + this.isPopup = true; + this.weekNumbers = false; + this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. + this.showsOtherMonths = false; + this.dateStr = dateStr; + this.ar_days = null; + this.showsTime = true; + this.time24 = true; + this.yearStep = 2; + this.hiliteToday = true; + this.multiple = null; + // HTML elements + this.table = null; + this.element = null; + this.tbody = null; + this.firstdayname = null; + // Combo boxes + this.monthsCombo = null; + this.yearsCombo = null; + this.hilitedMonth = null; + this.activeMonth = null; + this.hilitedYear = null; + this.activeYear = null; + // Information + this.dateClicked = false; + + // one-time initializations + if (typeof Calendar._SDN == "undefined") { + // table of short day names + if (typeof Calendar._SDN_len == "undefined") + Calendar._SDN_len = 3; + var ar = new Array(); + for (var i = 8; i > 0;) { + ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); + } + Calendar._SDN = ar; + // table of short month names + if (typeof Calendar._SMN_len == "undefined") + Calendar._SMN_len = 3; + ar = new Array(); + for (var i = 12; i > 0;) { + ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); + } + Calendar._SMN = ar; + } +}; + +// ** constants + +/// "static", needed for event handlers. +Calendar._C = null; + +/// detect a special case of "web browser" +Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && + !/opera/i.test(navigator.userAgent) ); + +Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); + +/// detect Opera browser +Calendar.is_opera = /opera/i.test(navigator.userAgent); + +/// detect KHTML-based browsers +Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); + +// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate +// library, at some point. + +Calendar.getAbsolutePos = function(el) { + var SL = 0, ST = 0; + var is_div = /^div$/i.test(el.tagName); + if (is_div && el.scrollLeft) + SL = el.scrollLeft; + if (is_div && el.scrollTop) + ST = el.scrollTop; + var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; + if (el.offsetParent) { + var tmp = this.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; +Calendar.date1=null; +Calendar.isRelated = function (el, evt) { + var related = evt.relatedTarget; + if (!related) { + var type = evt.type; + if (type == "mouseover") { + related = evt.fromElement; + } else if (type == "mouseout") { + related = evt.toElement; + } + } + while (related) { + if (related == el) { + return true; + } + related = related.parentNode; + } + return false; +}; + +Calendar.removeClass = function(el, className) { + if (!(el && el.className)) { + return; + } + var cls = el.className.split(" "); + var ar = new Array(); + for (var i = cls.length; i > 0;) { + if (cls[--i] != className) { + ar[ar.length] = cls[i]; + } + } + el.className = ar.join(" "); +}; + +Calendar.addClass = function(el, className) { + Calendar.removeClass(el, className); + el.className += " " + className; +}; + +// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. +Calendar.getElement = function(ev) { + var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; + while (f.nodeType != 1 || /^div$/i.test(f.tagName)) + f = f.parentNode; + return f; +}; + +Calendar.getTargetElement = function(ev) { + var f = Calendar.is_ie ? window.event.srcElement : ev.target; + while (f.nodeType != 1) + f = f.parentNode; + return f; +}; + +Calendar.stopEvent = function(ev) { + ev || (ev = window.event); + if (Calendar.is_ie) { + ev.cancelBubble = true; + ev.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } + return false; +}; + +Calendar.addEvent = function(el, evname, func) { + if (el.attachEvent) { // IE + el.attachEvent("on" + evname, func); + } else if (el.addEventListener) { // Gecko / W3C + el.addEventListener(evname, func, true); + } else { + el["on" + evname] = func; + } +}; + +Calendar.removeEvent = function(el, evname, func) { + if (el.detachEvent) { // IE + el.detachEvent("on" + evname, func); + } else if (el.removeEventListener) { // Gecko / W3C + el.removeEventListener(evname, func, true); + } else { + el["on" + evname] = null; + } +}; + +Calendar.createElement = function(type, parent) { + var el = null; + if (document.createElementNS) { + // use the XHTML namespace; IE won't normally get here unless + // _they_ "fix" the DOM2 implementation. + el = document.createElementNS("http://www.w3.org/1999/xhtml", type); + } else { + el = document.createElement(type); + } + if (typeof parent != "undefined") { + parent.appendChild(el); + } + return el; +}; + +// END: UTILITY FUNCTIONS + +// BEGIN: CALENDAR STATIC FUNCTIONS + +/** Internal -- adds a set of events to make some element behave like a button. */ +Calendar._add_evs = function(el) { + with (Calendar) { + addEvent(el, "mouseover", dayMouseOver); + addEvent(el, "mousedown", dayMouseDown); + addEvent(el, "mouseout", dayMouseOut); + if (is_ie) { + addEvent(el, "dblclick", dayMouseDblClick); + el.setAttribute("unselectable", true); + } + } +}; + +Calendar.findMonth = function(el) { + if (typeof el.month != "undefined") { + return el; + } else if (typeof el.parentNode.month != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.findYear = function(el) { + if (typeof el.year != "undefined") { + return el; + } else if (typeof el.parentNode.year != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.showMonthsCombo = function () { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var mc = cal.monthsCombo; + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + if (cal.activeMonth) { + Calendar.removeClass(cal.activeMonth, "active"); + } + var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; + Calendar.addClass(mon, "active"); + cal.activeMonth = mon; + var s = mc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var mcw = mc.offsetWidth; + if (typeof mcw == "undefined") + // Konqueror brain-dead techniques + mcw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; +}; + +Calendar.showYearsCombo = function (fwd) { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var yc = cal.yearsCombo; + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + if (cal.activeYear) { + Calendar.removeClass(cal.activeYear, "active"); + } + cal.activeYear = null; + var Y = cal.date.getFullYear() + (fwd ? 1 : -1); + var yr = yc.firstChild; + var show = false; + for (var i = 12; i > 0; --i) { + if (Y >= cal.minYear && Y <= cal.maxYear) { + yr.innerHTML = Y; + yr.year = Y; + yr.style.display = "block"; + show = true; + } else { + yr.style.display = "none"; + } + yr = yr.nextSibling; + Y += fwd ? cal.yearStep : -cal.yearStep; + } + if (show) { + var s = yc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var ycw = yc.offsetWidth; + if (typeof ycw == "undefined") + // Konqueror brain-dead techniques + ycw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; + } +}; + +// event handlers + +Calendar.tableMouseUp = function(ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + if (cal.timeout) { + clearTimeout(cal.timeout); + } + var el = cal.activeDiv; + if (!el) { + return false; + } + var target = Calendar.getTargetElement(ev); + ev || (ev = window.event); + Calendar.removeClass(el, "active"); + if (target == el || target.parentNode == el) { + Calendar.cellClick(el, ev); + } + var mon = Calendar.findMonth(target); + var date = null; + var date1 = null; + if (mon) { + date = new Date(cal.date); + if (mon.month != date.getMonth()) { + date.setMonth(mon.month); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } else { + var year = Calendar.findYear(target); + if (year) { + date = new Date(cal.date); + if (year.year != date.getFullYear()) { + date.setFullYear(year.year); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } + } + with (Calendar) { + removeEvent(document, "mouseup", tableMouseUp); + removeEvent(document, "mouseover", tableMouseOver); + removeEvent(document, "mousemove", tableMouseOver); + cal._hideCombos(); + _C = null; + return stopEvent(ev); + } +}; + +Calendar.tableMouseOver = function (ev) { + var cal = Calendar._C; + if (!cal) { + return; + } + var el = cal.activeDiv; + var target = Calendar.getTargetElement(ev); + if (target == el || target.parentNode == el) { + Calendar.addClass(el, "hilite active"); + Calendar.addClass(el.parentNode, "rowhilite"); + } else { + if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) + Calendar.removeClass(el, "active"); + Calendar.removeClass(el, "hilite"); + Calendar.removeClass(el.parentNode, "rowhilite"); + } + ev || (ev = window.event); + if (el.navtype == 50 && target != el) { + var pos = Calendar.getAbsolutePos(el); + var w = el.offsetWidth; + var x = ev.clientX; + var dx; + var decrease = true; + if (x > pos.x + w) { + dx = x - pos.x - w; + decrease = false; + } else + dx = pos.x - x; + + if (dx < 0) dx = 0; + var range = el._range; + var current = el._current; + var count = Math.floor(dx / 10) % range.length; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + while (count-- > 0) + if (decrease) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + + cal.onUpdateTime(); + } + var mon = Calendar.findMonth(target); + if (mon) { + if (mon.month != cal.date.getMonth()) { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + Calendar.addClass(mon, "hilite"); + cal.hilitedMonth = mon; + } else if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + } else { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + var year = Calendar.findYear(target); + if (year) { + if (year.year != cal.date.getFullYear()) { + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + Calendar.addClass(year, "hilite"); + cal.hilitedYear = year; + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } + return Calendar.stopEvent(ev); +}; + +Calendar.tableMouseDown = function (ev) { + if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { + return Calendar.stopEvent(ev); + } +}; + +Calendar.calDragIt = function (ev) { + var cal = Calendar._C; + if (!(cal && cal.dragging)) { + return false; + } + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posX = ev.pageX; + posY = ev.pageY; + } + cal.hideShowCovered(); + var st = cal.element.style; + st.left = (posX - cal.xOffs) + "px"; + st.top = (posY - cal.yOffs) + "px"; + return Calendar.stopEvent(ev); +}; + +Calendar.calDragEnd = function (ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + cal.dragging = false; + with (Calendar) { + removeEvent(document, "mousemove", calDragIt); + removeEvent(document, "mouseup", calDragEnd); + tableMouseUp(ev); + } + cal.hideShowCovered(); +}; + +Calendar.dayMouseDown = function(ev) { + var el = Calendar.getElement(ev); + if (el.disabled) { + return false; + } + var cal = el.calendar; + cal.activeDiv = el; + Calendar._C = cal; + if (el.navtype != 300) with (Calendar) { + if (el.navtype == 50) { + el._current = el.innerHTML; + addEvent(document, "mousemove", tableMouseOver); + } else + addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); + addClass(el, "hilite active"); + addEvent(document, "mouseup", tableMouseUp); + } else if (cal.isPopup) { + cal._dragStart(ev); + } + if (el.navtype == -1 || el.navtype == 1) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); + } else if (el.navtype == -2 || el.navtype == 2) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); + } else { + cal.timeout = null; + } + return Calendar.stopEvent(ev); +}; + +Calendar.dayMouseDblClick = function(ev) { + Calendar.cellClick(Calendar.getElement(ev), ev || window.event); + if (Calendar.is_ie) { + document.selection.empty(); + } +}; + +Calendar.dayMouseOver = function(ev) { + var el = Calendar.getElement(ev); + if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { + return false; + } + if (el.ttip) { + if (el.ttip.substr(0, 1) == "_") { + el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); + } + el.calendar.tooltips.innerHTML = el.ttip; + } + if (el.navtype != 300) { + Calendar.addClass(el, "hilite"); + if (el.caldate) { + Calendar.addClass(el.parentNode, "rowhilite"); + } + } + return Calendar.stopEvent(ev); +}; + +Calendar.dayMouseOut = function(ev) { + with (Calendar) { + var el = getElement(ev); + if (isRelated(el, ev) || _C || el.disabled) + return false; + removeClass(el, "hilite"); + if (el.caldate) + removeClass(el.parentNode, "rowhilite"); + if (el.calendar) + el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; + return stopEvent(ev); + } +}; + +/** + * A generic "click" handler :) handles all types of buttons defined in this + * calendar. + */ +Calendar.cellClick = function(el, ev) { + var cal = el.calendar; + var closing = false; + var newdate = false; + var date = null; + var date1 = null; + if (typeof el.navtype == "undefined") { + if (cal.currentDateEl) { + Calendar.removeClass(cal.currentDateEl, "selected"); + Calendar.addClass(el, "selected"); + closing = (cal.currentDateEl == el); + if (!closing) { + cal.currentDateEl = el; + } + } + cal.date.setDateOnly(el.caldate); + date = cal.date; + date1 = cal.date1; + var other_month = !(cal.dateClicked = !el.otherMonth); + if (!other_month && !cal.currentDateEl) + cal._toggleMultipleDate(new Date(date)); + else + newdate = !el.disabled; + // a date was clicked + if (other_month) + cal._init(cal.firstDayOfWeek, date); + } else { + if (el.navtype == 200) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + return; + } + date = new Date(cal.date); + date1 = new Date(cal.date); + if (el.navtype == 0) + date.setDateOnly(new Date()); // TODAY + // unless "today" was clicked, we assume no date was clicked so + // the selected handler will know not to close the calenar when + // in single-click mode. + // cal.dateClicked = (el.navtype == 0); + cal.dateClicked = false; + var year = date.getFullYear(); + var mon = date.getMonth(); + function setMonth(m) { + var day = date.getDate(); + var max = date.getMonthDays(m); + if (day > max) { + date.setDate(max); + } + date.setMonth(m); + }; + switch (el.navtype) { + case 400: + Calendar.removeClass(el, "hilite"); + var text = Calendar._TT["ABOUT"]; + if (typeof text != "undefined") { + text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; + } else { + // FIXME: this should be removed as soon as lang files get updated! + text = "Help and about box text is not translated into this language.\n" + + "If you know this language and you feel generous please update\n" + + "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + + "and send it back to to get it into the distribution ;-)\n\n" + + "Thank you!\n" + + "http://dynarch.com/mishoo/calendar.epl\n"; + } + //alert(text); + return; + case -2: + if (year > cal.minYear) { + date.setFullYear(year - 1); + } + break; + case -1: + if (mon > 0) { + setMonth(mon - 1); + } else if (year-- > cal.minYear) { + date.setFullYear(year); + setMonth(11); + } + break; + case 1: + if (mon < 11) { + setMonth(mon + 1); + } else if (year < cal.maxYear) { + date.setFullYear(year + 1); + setMonth(0); + } + break; + case 2: + if (year < cal.maxYear) { + date.setFullYear(year + 1); + } + break; + case 100: + cal.setFirstDayOfWeek(el.fdow); + return; + case 50: + var range = el._range; + var current = el.innerHTML; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + if (ev && ev.shiftKey) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + cal.onUpdateTime(); + return; + case 0: + // TODAY will bring us here + if ((typeof cal.getDateStatus == "function") && + cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { + return false; + } + break; + } + if (!date.equalsTo(cal.date)) { + cal.setDate(date); + newdate = true; + } else if (el.navtype == 0) + newdate = closing = true; + } + if (newdate) { + ev && cal.callHandler(); + } + if (closing) { + Calendar.removeClass(el, "hilite"); + ev && cal.callCloseHandler(); + } +}; + +// END: CALENDAR STATIC FUNCTIONS + +// BEGIN: CALENDAR OBJECT FUNCTIONS + +/** + * This function creates the calendar inside the given parent. If _par is + * null than it creates a popup calendar inside the BODY element. If _par is + * an element, be it BODY, then it creates a non-popup calendar (still + * hidden). Some properties need to be set before calling this function. + */ +Calendar.prototype.create = function (_par) { + var parent = null; + if (! _par) { + // default parent is the document body, in which case we create + // a popup calendar. + parent = document.getElementsByTagName("body")[0]; + this.isPopup = true; + } else { + parent = _par; + this.isPopup = false; + } + this.date = this.dateStr ? new Date(this.dateStr) : new Date(); + this.date1 = this.dateStr ? new Date(this.dateStr) : new Date(); + var table = Calendar.createElement("table"); + this.table = table; + table.cellSpacing = 0; + table.cellPadding = 0; + table.calendar = this; + Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); + + var div = Calendar.createElement("div"); + this.element = div; + div.className = "calendar"; + if (this.isPopup) { + div.style.position = "absolute"; + div.style.display = "none"; + } + div.appendChild(table); + + var thead = Calendar.createElement("thead", table); + var cell = null; + var row = null; + + var cal = this; + var hh = function (text, cs, navtype) { + cell = Calendar.createElement("td", row); + cell.colSpan = cs; + cell.className = "button"; + if (navtype != 0 && Math.abs(navtype) <= 2) + cell.className += " nav"; + Calendar._add_evs(cell); + cell.calendar = cal; + cell.navtype = navtype; + cell.innerHTML = "
" + text + "
"; + return cell; + }; + + row = Calendar.createElement("tr", thead); + var title_length = 7; + (this.isPopup) && --title_length; + (this.weekNumbers) && ++title_length; + + //hh("?", 1, 400).ttip = Calendar._TT["INFO"]; + this.title = hh("", title_length, 300); + this.title.className = "title"; + if (this.isPopup) { + this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; + this.title.style.cursor = "move"; + hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; + } + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + this._nav_py = hh("«", 1, -2); + this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; + + this._nav_pm = hh("‹", 1, -1); + this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; + + this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); + this._nav_now.ttip = Calendar._TT["GO_TODAY"]; + + this._nav_nm = hh("›", 1, 1); + this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; + + this._nav_ny = hh("»", 1, 2); + this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; + + // day names + row = Calendar.createElement("tr", thead); + row.className = "daynames"; + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + cell.className = "name wn"; + cell.innerHTML = Calendar._TT["WK"]; + } + for (var i = 7; i > 0; --i) { + cell = Calendar.createElement("td", row); + if (!i) { + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + } + this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; + this._displayWeekdays(); + + var tbody = Calendar.createElement("tbody", table); + this.tbody = tbody; + + for (i = 6; i > 0; --i) { + row = Calendar.createElement("tr", tbody); + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + } + for (var j = 7; j > 0; --j) { + cell = Calendar.createElement("td", row); + cell.calendar = this; + Calendar._add_evs(cell); + } + } + + if (this.showsTime ) { + row = Calendar.createElement("tr", tbody); + row.className = "time"; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + cell.innerHTML = "From "+ Calendar._TT["TIME"] || " "; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = this.weekNumbers ? 4 : 3; + + //(function(){ + function makeTimePart(className, init, range_start, range_end) { + var part = Calendar.createElement("span", cell); + part.className = className; + part.innerHTML = init; + part.calendar = cal; + part.ttip = Calendar._TT["TIME_PART"]; + part.navtype = 50; + part._range = []; + if (typeof range_start != "number") + part._range = range_start; + else { + for (var i = range_start; i <= range_end; ++i) { + var txt; + if (i < 10 && range_end >= 10) txt = '0' + i; + else txt = '' + i; + part._range[part._range.length] = txt; + } + } + Calendar._add_evs(part); + return part; + }; + var hrs = cal.date.getHours(); + var mins = cal.date.getMinutes(); + var hrs1 = cal.date1.getHours(); + var mins1 = cal.date1.getMinutes(); + + var t12 = !cal.time24; + var pm = (hrs > 12); + var pm1 = (hrs1 > 12); + if (t12 && pm) hrs -= 12; + if (t12 && pm1) hrs1 -= 12; + var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); + var span = Calendar.createElement("span", cell); + span.innerHTML = ":"; + span.className = "colon"; + var M = makeTimePart("minute", mins, 0, 59); + var AP = null; + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + + if (t12) + AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); + else + cell.innerHTML = " "; + + row = Calendar.createElement("tr", tbody); + row.className = "time"; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + cell.innerHTML = "Till "+ Calendar._TT["TIME"] || " "; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = this.weekNumbers ? 4 : 3; + + + + var H1 = makeTimePart("hour", hrs1, t12 ? 1 : 0, t12 ? 12 : 23); + var span1 = Calendar.createElement("span", cell); + span1.innerHTML = ":"; + span1.className = "colon"; + var M1 = makeTimePart("minute", mins1, 0, 59); + var AP1 = null; + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + + if (t12) + AP1 = makeTimePart("ampm", pm1 ? "pm" : "am", ["am", "pm"]); + else + cell.innerHTML = " "; + + cal.onSetTime = function() { + var pm, + pm1, + hrs = this.date.getHours(), + mins = this.date.getMinutes(), + hrs1 = this.date1.getHours(), + mins1 = this.date1.getMinutes(); + if (t12) { + pm = (hrs >= 12); + pm1 = (hrs1 >= 12); + if (pm) hrs -= 12; + if (pm1) hrs1 -= 12; + if (hrs == 0) hrs = 12; + if (hrs1 == 0) hrs1 = 12; + AP.innerHTML = pm ? "pm" : "am"; + AP1.innerHTML = pm1 ? "pm" : "am"; + } + H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; + H1.innerHTML = (hrs1 < 10) ? ("0" + hrs1) : hrs1; + M.innerHTML = (mins < 10) ? ("0" + mins) : mins; + M1.innerHTML = (mins1 < 10) ? ("0" + mins1) : mins1; + }; + + cal.onUpdateTime = function() { + var date = this.date, + date1 = this.date1, + h = parseInt(H.innerHTML, 10), + h1 = parseInt(H1.innerHTML, 10); + if (t12) { + if (/pm/i.test(AP.innerHTML) && h < 12) + h += 12; + else if (/am/i.test(AP.innerHTML) && h == 12) + h = 0; + if (/pm/i.test(AP1.innerHTML) && h1 < 12) + h1 += 12; + else if (/am/i.test(AP1.innerHTML) && h1 == 12) + h1 = 0; + } + var d = date.getDate(); + var m = date.getMonth(); + var y = date.getFullYear(); + var d1 = date1.getDate(); + var m1 = date1.getMonth(); + var y1 = date1.getFullYear(); + date.setHours(h); + date.setMinutes(parseInt(M.innerHTML, 10)); + date.setFullYear(y); + date.setMonth(m); + date.setDate(d); + + date1.setHours(h1); + date1.setMinutes(parseInt(M1.innerHTML, 10)); + date1.setFullYear(y1); + date1.setMonth(m1); + date1.setDate(d1); + this.dateClicked = false; + this.callHandler(); + }; + //})(); + } else { + this.onSetTime = this.onUpdateTime = function() {}; + } + + var tfoot = Calendar.createElement("tfoot", table); + + row = Calendar.createElement("tr", tfoot); + row.className = "footrow"; + + cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); + cell.className = "ttip"; + if (this.isPopup) { + cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; + cell.style.cursor = "move"; + } + this.tooltips = cell; + + div = Calendar.createElement("div", this.element); + this.monthsCombo = div; + div.className = "combo"; + for (i = 0; i < Calendar._MN.length; ++i) { + var mn = Calendar.createElement("div"); + mn.className = Calendar.is_ie ? "label-IEfix" : "label"; + mn.month = i; + mn.innerHTML = Calendar._SMN[i]; + div.appendChild(mn); + } + + div = Calendar.createElement("div", this.element); + this.yearsCombo = div; + div.className = "combo"; + for (i = 12; i > 0; --i) { + var yr = Calendar.createElement("div"); + yr.className = Calendar.is_ie ? "label-IEfix" : "label"; + div.appendChild(yr); + } + + this._init(this.firstDayOfWeek, this.date); + parent.appendChild(this.element); +}; + +/** keyboard navigation, only for popup calendars */ +Calendar._keyEvent = function(ev) { + var cal = window._dynarch_popupCalendar; + if (!cal || cal.multiple) + return false; + (Calendar.is_ie) && (ev = window.event); + var act = (Calendar.is_ie || ev.type == "keypress"), + K = ev.keyCode; + if (ev.ctrlKey) { + switch (K) { + case 37: // KEY left + act && Calendar.cellClick(cal._nav_pm); + break; + case 38: // KEY up + act && Calendar.cellClick(cal._nav_py); + break; + case 39: // KEY right + act && Calendar.cellClick(cal._nav_nm); + break; + case 40: // KEY down + act && Calendar.cellClick(cal._nav_ny); + break; + default: + return false; + } + } else switch (K) { + case 32: // KEY space (now) + Calendar.cellClick(cal._nav_now); + break; + case 27: // KEY esc + act && cal.callCloseHandler(); + break; + case 37: // KEY left + case 38: // KEY up + case 39: // KEY right + case 40: // KEY down + if (act) { + var prev, x, y, ne, el, step; + prev = K == 37 || K == 38; + step = (K == 37 || K == 39) ? 1 : 7; + function setVars() { + el = cal.currentDateEl; + var p = el.pos; + x = p & 15; + y = p >> 4; + ne = cal.ar_days[y][x]; + };setVars(); + function prevMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() - step); + cal.setDate(date); + }; + function nextMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() + step); + cal.setDate(date); + }; + while (1) { + switch (K) { + case 37: // KEY left + if (--x >= 0) + ne = cal.ar_days[y][x]; + else { + x = 6; + K = 38; + continue; + } + break; + case 38: // KEY up + if (--y >= 0) + ne = cal.ar_days[y][x]; + else { + prevMonth(); + setVars(); + } + break; + case 39: // KEY right + if (++x < 7) + ne = cal.ar_days[y][x]; + else { + x = 0; + K = 40; + continue; + } + break; + case 40: // KEY down + if (++y < cal.ar_days.length) + ne = cal.ar_days[y][x]; + else { + nextMonth(); + setVars(); + } + break; + } + break; + } + if (ne) { + if (!ne.disabled) + Calendar.cellClick(ne); + else if (prev) + prevMonth(); + else + nextMonth(); + } + } + break; + case 13: // KEY enter + if (act) + Calendar.cellClick(cal.currentDateEl, ev); + break; + default: + return false; + } + return Calendar.stopEvent(ev); +}; + +/** + * (RE)Initializes the calendar to the given date and firstDayOfWeek + */ +Calendar.prototype._init = function (firstDayOfWeek, date) { + var today = new Date(), + TY = today.getFullYear(), + TM = today.getMonth(), + TD = today.getDate(); + this.table.style.visibility = "hidden"; + var year = date.getFullYear(); + if (year < this.minYear) { + year = this.minYear; + date.setFullYear(year); + } else if (year > this.maxYear) { + year = this.maxYear; + date.setFullYear(year); + } + this.firstDayOfWeek = firstDayOfWeek; + this.date = new Date(date); + this.date1 = new Date(date); + var month = date.getMonth(); + var mday = date.getDate(); + var no_days = date.getMonthDays(); + + // calendar voodoo for computing the first day that would actually be + // displayed in the calendar, even if it's from the previous month. + // WARNING: this is magic. ;-) + date.setDate(1); + var day1 = (date.getDay() - this.firstDayOfWeek) % 7; + if (day1 < 0) + day1 += 7; + date.setDate(-day1); + date.setDate(date.getDate() + 1); + + var row = this.tbody.firstChild; + var MN = Calendar._SMN[month]; + var ar_days = this.ar_days = new Array(); + var weekend = Calendar._TT["WEEKEND"]; + var dates = this.multiple ? (this.datesCells = {}) : null; + for (var i = 0; i < 6; ++i, row = row.nextSibling) { + var cell = row.firstChild; + if (this.weekNumbers) { + cell.className = "day wn"; + cell.innerHTML = date.getWeekNumber(); + cell = cell.nextSibling; + } + row.className = "daysrow"; + var hasdays = false, iday, dpos = ar_days[i] = []; + for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { + iday = date.getDate(); + var wday = date.getDay(); + cell.className = "day"; + cell.pos = i << 4 | j; + dpos[j] = cell; + var current_month = (date.getMonth() == month); + if (!current_month) { + if (this.showsOtherMonths) { + cell.className += " othermonth"; + cell.otherMonth = true; + } else { + cell.className = "emptycell"; + cell.innerHTML = " "; + cell.disabled = true; + continue; + } + } else { + cell.otherMonth = false; + hasdays = true; + } + cell.disabled = false; + cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; + if (dates) + dates[date.print("%Y%m%d")] = cell; + if (this.getDateStatus) { + var status = this.getDateStatus(date, year, month, iday); + if (this.getDateToolTip) { + var toolTip = this.getDateToolTip(date, year, month, iday); + if (toolTip) + cell.title = toolTip; + } + if (status === true) { + cell.className += " disabled"; + cell.disabled = true; + } else { + if (/disabled/i.test(status)) + cell.disabled = true; + cell.className += " " + status; + } + } + if (!cell.disabled) { + cell.caldate = new Date(date); + cell.ttip = "_"; + if (!this.multiple && current_month + && iday == mday && this.hiliteToday) { + cell.className += " selected"; + this.currentDateEl = cell; + } + if (date.getFullYear() == TY && + date.getMonth() == TM && + iday == TD) { + cell.className += " today"; + cell.ttip += Calendar._TT["PART_TODAY"]; + } + if (weekend.indexOf(wday.toString()) != -1) + cell.className += cell.otherMonth ? " oweekend" : " weekend"; + } + } + if (!(hasdays || this.showsOtherMonths)) + row.className = "emptyrow"; + } + this.title.innerHTML = Calendar._MN[month] + ", " + year; + this.onSetTime(); + this.table.style.visibility = "visible"; + this._initMultipleDates(); + // PROFILE + // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; +}; + +Calendar.prototype._initMultipleDates = function() { + if (this.multiple) { + for (var i in this.multiple) { + var cell = this.datesCells[i]; + var d = this.multiple[i]; + if (!d) + continue; + if (cell) + cell.className += " selected"; + } + } +}; + +Calendar.prototype._toggleMultipleDate = function(date) { + if (this.multiple) { + var ds = date.print("%Y%m%d"); + var cell = this.datesCells[ds]; + if (cell) { + var d = this.multiple[ds]; + if (!d) { + Calendar.addClass(cell, "selected"); + this.multiple[ds] = date; + } else { + Calendar.removeClass(cell, "selected"); + delete this.multiple[ds]; + } + } + } +}; + +Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { + this.getDateToolTip = unaryFunction; +}; + +/** + * Calls _init function above for going to a certain date (but only if the + * date is different than the currently selected one). + */ +Calendar.prototype.setDate = function (date) { + if (!date.equalsTo(this.date)) { + this._init(this.firstDayOfWeek, date); + } +}; + +/** + * Refreshes the calendar. Useful if the "disabledHandler" function is + * dynamic, meaning that the list of disabled date can change at runtime. + * Just * call this function if you think that the list of disabled dates + * should * change. + */ +Calendar.prototype.refresh = function () { + this._init(this.firstDayOfWeek, this.date); +}; + +/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ +Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { + this._init(firstDayOfWeek, this.date); + this._displayWeekdays(); +}; + +/** + * Allows customization of what dates are enabled. The "unaryFunction" + * parameter must be a function object that receives the date (as a JS Date + * object) and returns a boolean value. If the returned value is true then + * the passed date will be marked as disabled. + */ +Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { + this.getDateStatus = unaryFunction; +}; + +/** Customization of allowed year range for the calendar. */ +Calendar.prototype.setRange = function (a, z) { + this.minYear = a; + this.maxYear = z; +}; + +/** Calls the first user handler (selectedHandler). */ +Calendar.prototype.callHandler = function () { + if (this.onSelected) { + this.onSelected(this, this.date.print(this.dateFormat)); + } +}; + +/** Calls the second user handler (closeHandler). */ +Calendar.prototype.callCloseHandler = function () { + if (this.onClose) { + this.onClose(this); + } + this.hideShowCovered(); +}; + +/** Removes the calendar object from the DOM tree and destroys it. */ +Calendar.prototype.destroy = function () { + var el = this.element.parentNode; + el.removeChild(this.element); + Calendar._C = null; + window._dynarch_popupCalendar = null; +}; + +/** + * Moves the calendar element to a different section in the DOM tree (changes + * its parent). + */ +Calendar.prototype.reparent = function (new_parent) { + var el = this.element; + el.parentNode.removeChild(el); + new_parent.appendChild(el); +}; + +// This gets called when the user presses a mouse button anywhere in the +// document, if the calendar is shown. If the click was outside the open +// calendar this function closes it. +Calendar._checkCalendar = function(ev) { + var calendar = window._dynarch_popupCalendar; + if (!calendar) { + return false; + } + var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); + for (; el != null && el != calendar.element; el = el.parentNode); + if (el == null) { + // calls closeHandler which should hide the calendar. + window._dynarch_popupCalendar.callCloseHandler(); + return Calendar.stopEvent(ev); + } +}; + +/** Shows the calendar. */ +Calendar.prototype.show = function () { + var rows = this.table.getElementsByTagName("tr"); + for (var i = rows.length; i > 0;) { + var row = rows[--i]; + Calendar.removeClass(row, "rowhilite"); + var cells = row.getElementsByTagName("td"); + for (var j = cells.length; j > 0;) { + var cell = cells[--j]; + Calendar.removeClass(cell, "hilite"); + Calendar.removeClass(cell, "active"); + } + } + this.element.style.display = "block"; + this.hidden = false; + if (this.isPopup) { + window._dynarch_popupCalendar = this; + Calendar.addEvent(document, "keydown", Calendar._keyEvent); + Calendar.addEvent(document, "keypress", Calendar._keyEvent); + Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); + } + this.hideShowCovered(); +}; + +/** + * Hides the calendar. Also removes any "hilite" from the class of any TD + * element. + */ +Calendar.prototype.hide = function () { + if (this.isPopup) { + Calendar.removeEvent(document, "keydown", Calendar._keyEvent); + Calendar.removeEvent(document, "keypress", Calendar._keyEvent); + Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); + } + this.element.style.display = "none"; + this.hidden = true; + this.hideShowCovered(); +}; + +/** + * Shows the calendar at a given absolute position (beware that, depending on + * the calendar element style -- position property -- this might be relative + * to the parent's containing rectangle). + */ +Calendar.prototype.showAt = function (x, y) { + var s = this.element.style; + s.left = x + "px"; + s.top = y + "px"; + this.show(); +}; + +/** Shows the calendar near a given element. */ +Calendar.prototype.showAtElement = function (el, opts) { + var self = this; + var p = Calendar.getAbsolutePos(el); + if (!opts || typeof opts != "string") { + this.showAt(p.x, p.y + el.offsetHeight); + return true; + } + function fixPosition(box) { + if (box.x < 0) + box.x = 0; + if (box.y < 0) + box.y = 0; + var cp = document.createElement("div"); + var s = cp.style; + s.position = "absolute"; + s.right = s.bottom = s.width = s.height = "0px"; + document.body.appendChild(cp); + var br = Calendar.getAbsolutePos(cp); + document.body.removeChild(cp); + if (Calendar.is_ie) { + br.y += document.body.scrollTop; + br.x += document.body.scrollLeft; + } else { + br.y += window.scrollY; + br.x += window.scrollX; + } + var tmp = box.x + box.width - br.x; + if (tmp > 0) box.x -= tmp; + tmp = box.y + box.height - br.y; + if (tmp > 0) box.y -= tmp; + }; + this.element.style.display = "block"; + Calendar.continuation_for_the_fucking_khtml_browser = function() { + var w = self.element.offsetWidth; + var h = self.element.offsetHeight; + self.element.style.display = "none"; + var valign = opts.substr(0, 1); + var halign = "l"; + if (opts.length > 1) { + halign = opts.substr(1, 1); + } + // vertical alignment + switch (valign) { + case "T": p.y -= h; break; + case "B": p.y += el.offsetHeight; break; + case "C": p.y += (el.offsetHeight - h) / 2; break; + case "t": p.y += el.offsetHeight - h; break; + case "b": break; // already there + } + // horizontal alignment + switch (halign) { + case "L": p.x -= w; break; + case "R": p.x += el.offsetWidth; break; + case "C": p.x += (el.offsetWidth - w) / 2; break; + case "l": p.x += el.offsetWidth - w; break; + case "r": break; // already there + } + p.width = w; + p.height = h + 40; + self.monthsCombo.style.display = "none"; + fixPosition(p); + self.showAt(p.x, p.y); + }; + if (Calendar.is_khtml) + setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); + else + Calendar.continuation_for_the_fucking_khtml_browser(); +}; + +/** Customizes the date format. */ +Calendar.prototype.setDateFormat = function (str) { + this.dateFormat = str; +}; + +/** Customizes the tooltip date format. */ +Calendar.prototype.setTtDateFormat = function (str) { + this.ttDateFormat = str; +}; + +/** + * Tries to identify the date represented in a string. If successful it also + * calls this.setDate which moves the calendar to the given date. + */ +Calendar.prototype.parseDate = function(str, fmt) { + if (!fmt) + fmt = this.dateFormat; + this.setDate(Date.parseDate(str, fmt)); +}; + +Calendar.prototype.hideShowCovered = function () { + if (!Calendar.is_ie && !Calendar.is_opera) + return; + function getVisib(obj){ + var value = obj.style.visibility; + if (!value) { + if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C + if (!Calendar.is_khtml) + value = document.defaultView. + getComputedStyle(obj, "").getPropertyValue("visibility"); + else + value = ''; + } else if (obj.currentStyle) { // IE + value = obj.currentStyle.visibility; + } else + value = ''; + } + return value; + }; + + var tags = new Array("applet", "iframe", "select"); + var el = this.element; + + var p = Calendar.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + for (var k = tags.length; k > 0; ) { + var ar = document.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + + p = Calendar.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = cc.__msh_save_visibility; + } else { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = "hidden"; + } + } + } +}; + +/** Internal function; it displays the bar with the names of the weekday. */ +Calendar.prototype._displayWeekdays = function () { + var fdow = this.firstDayOfWeek; + var cell = this.firstdayname; + var weekend = Calendar._TT["WEEKEND"]; + for (var i = 0; i < 7; ++i) { + cell.className = "day name"; + var realday = (i + fdow) % 7; + if (i) { + cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); + cell.navtype = 100; + cell.calendar = this; + cell.fdow = realday; + Calendar._add_evs(cell); + } + if (weekend.indexOf(realday.toString()) != -1) { + Calendar.addClass(cell, "weekend"); + } + cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; + cell = cell.nextSibling; + } +}; + +/** Internal function. Hides all combo boxes that might be displayed. */ +Calendar.prototype._hideCombos = function () { + this.monthsCombo.style.display = "none"; + this.yearsCombo.style.display = "none"; +}; + +/** Internal function. Starts dragging the element. */ +Calendar.prototype._dragStart = function (ev) { + if (this.dragging) { + return; + } + this.dragging = true; + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posY = ev.clientY + window.scrollY; + posX = ev.clientX + window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + with (Calendar) { + addEvent(document, "mousemove", calDragIt); + addEvent(document, "mouseup", calDragEnd); + } +}; + +// BEGIN: DATE OBJECT PATCHES + +/** Adds the number of days array to the Date object. */ +Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); + +/** Constants used for time computations */ +Date.SECOND = 1000 /* milliseconds */; +Date.MINUTE = 60 * Date.SECOND; +Date.HOUR = 60 * Date.MINUTE; +Date.DAY = 24 * Date.HOUR; +Date.WEEK = 7 * Date.DAY; + +Date.parseDate = function(str, fmt) { + var today = new Date(); + var y = 0; + var m = -1; + var d = 0; + var a = str.split(/\W+/); + var b = fmt.match(/%./g); + var i = 0, j = 0; + var hr = 0; + var min = 0; + for (i = 0; i < a.length; ++i) { + if (!a[i]) + continue; + switch (b[i]) { + case "%d": + case "%e": + d = parseInt(a[i], 10); + break; + + case "%m": + m = parseInt(a[i], 10) - 1; + break; + + case "%Y": + case "%y": + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + break; + + case "%b": + case "%B": + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } + } + break; + + case "%H": + case "%I": + case "%k": + case "%l": + hr = parseInt(a[i], 10); + break; + + case "%P": + case "%p": + if (/pm/i.test(a[i]) && hr < 12) + hr += 12; + else if (/am/i.test(a[i]) && hr >= 12) + hr -= 12; + break; + + case "%M": + min = parseInt(a[i], 10); + break; + } + } + if (isNaN(y)) y = today.getFullYear(); + if (isNaN(m)) m = today.getMonth(); + if (isNaN(d)) d = today.getDate(); + if (isNaN(hr)) hr = today.getHours(); + if (isNaN(min)) min = today.getMinutes(); + if (y != 0 && m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + y = 0; m = -1; d = 0; + for (i = 0; i < a.length; ++i) { + if (a[i].search(/[a-zA-Z]+/) != -1) { + var t = -1; + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } + } + if (t != -1) { + if (m != -1) { + d = m+1; + } + m = t; + } + } else if (parseInt(a[i], 10) <= 12 && m == -1) { + m = a[i]-1; + } else if (parseInt(a[i], 10) > 31 && y == 0) { + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + } else if (d == 0) { + d = a[i]; + } + } + if (y == 0) + y = today.getFullYear(); + if (m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + return today; +}; + +/** Returns the number of days in the current month */ +Date.prototype.getMonthDays = function(month) { + var year = this.getFullYear(); + if (typeof month == "undefined") { + month = this.getMonth(); + } + if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { + return 29; + } else { + return Date._MD[month]; + } +}; + +/** Returns the number of day in the year. */ +Date.prototype.getDayOfYear = function() { + var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); + var time = now - then; + return Math.floor(time / Date.DAY); +}; + +/** Returns the number of the week in year, as defined in ISO 8601. */ +Date.prototype.getWeekNumber = function() { + var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var DoW = d.getDay(); + d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu + var ms = d.valueOf(); // GMT + d.setMonth(0); + d.setDate(4); // Thu in Week 1 + return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; +}; + +/** Checks date and time equality */ +Date.prototype.equalsTo = function(date) { + return ((this.getFullYear() == date.getFullYear()) && + (this.getMonth() == date.getMonth()) && + (this.getDate() == date.getDate()) && + (this.getHours() == date.getHours()) && + (this.getMinutes() == date.getMinutes())); +}; + +/** Set only the year, month, date parts (keep existing time) */ +Date.prototype.setDateOnly = function(date) { + var tmp = new Date(date); + this.setDate(1); + this.setFullYear(tmp.getFullYear()); + this.setMonth(tmp.getMonth()); + this.setDate(tmp.getDate()); +}; + +/** Prints the date in a string according to the given format. */ +Date.prototype.print = function (str) { + var m = this.getMonth(); + var d = this.getDate(); + var y = this.getFullYear(); + var wn = this.getWeekNumber(); + var w = this.getDay(); + var s = {}; + var hr = this.getHours(); + var pm = (hr >= 12); + var ir = (pm) ? (hr - 12) : hr; + var dy = this.getDayOfYear(); + if (ir == 0) + ir = 12; + var min = this.getMinutes(); + var sec = this.getSeconds(); + s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] + s["%A"] = Calendar._DN[w]; // full weekday name + s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] + s["%B"] = Calendar._MN[m]; // full month name + // FIXME: %c : preferred date and time representation for the current locale + s["%C"] = 1 + Math.floor(y / 100); // the century number + s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) + s["%e"] = d; // the day of the month (range 1 to 31) + // FIXME: %D : american date style: %m/%d/%y + // FIXME: %E, %F, %G, %g, %h (man strftime) + s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) + s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) + s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) + s["%k"] = hr; // hour, range 0 to 23 (24h format) + s["%l"] = ir; // hour, range 1 to 12 (12h format) + s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 + s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 + s["%n"] = "\n"; // a newline character + s["%p"] = pm ? "PM" : "AM"; + s["%P"] = pm ? "pm" : "am"; + // FIXME: %r : the time in am/pm notation %I:%M:%S %p + // FIXME: %R : the time in 24-hour notation %H:%M + s["%s"] = Math.floor(this.getTime() / 1000); + s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 + s["%t"] = "\t"; // a tab character + // FIXME: %T : the time in 24-hour notation (%H:%M:%S) + s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; + s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) + s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) + // FIXME: %x : preferred date representation for the current locale without the time + // FIXME: %X : preferred time representation for the current locale without the date + s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) + s["%Y"] = y; // year with the century + s["%%"] = "%"; // a literal '%' character + + var re = /%./g; + if (!Calendar.is_ie5 && !Calendar.is_khtml) + return str.replace(re, function (par) { return s[par] || par; }); + + var a = str.match(re); + for (var i = 0; i < a.length; i++) { + var tmp = s[a[i]]; + if (tmp) { + re = new RegExp(a[i], 'g'); + str = str.replace(re, tmp); + } + } + + return str; +}; + +Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; +Date.prototype.setFullYear = function(y) { + var d = new Date(this); + d.__msh_oldSetFullYear(y); + if (d.getMonth() != this.getMonth()) + this.setDate(28); + this.__msh_oldSetFullYear(y); +}; + +// END: DATE OBJECT PATCHES + + +// global object that remembers the calendar +window._dynarch_popupCalendar = null; diff --git a/lib/javascript/cal/calendar/1.gif b/lib/javascript/cal/calendar/1.gif new file mode 100644 index 0000000..cfc2528 Binary files /dev/null and b/lib/javascript/cal/calendar/1.gif differ diff --git a/lib/javascript/cal/calendar/2.gif b/lib/javascript/cal/calendar/2.gif new file mode 100644 index 0000000..b1c1ee5 Binary files /dev/null and b/lib/javascript/cal/calendar/2.gif differ diff --git a/lib/javascript/cal/calendar/3.gif b/lib/javascript/cal/calendar/3.gif new file mode 100644 index 0000000..4a6e577 Binary files /dev/null and b/lib/javascript/cal/calendar/3.gif differ diff --git a/lib/javascript/cal/calendar/4.gif b/lib/javascript/cal/calendar/4.gif new file mode 100644 index 0000000..ce8e6c9 Binary files /dev/null and b/lib/javascript/cal/calendar/4.gif differ diff --git a/lib/javascript/cal/calendar/5.gif b/lib/javascript/cal/calendar/5.gif new file mode 100644 index 0000000..0d3de57 Binary files /dev/null and b/lib/javascript/cal/calendar/5.gif differ diff --git a/lib/javascript/cal/calendar/6.gif b/lib/javascript/cal/calendar/6.gif new file mode 100644 index 0000000..fcec01f Binary files /dev/null and b/lib/javascript/cal/calendar/6.gif differ diff --git a/lib/javascript/cal/calendar/Thumbs.db b/lib/javascript/cal/calendar/Thumbs.db new file mode 100644 index 0000000..0eb8320 Binary files /dev/null and b/lib/javascript/cal/calendar/Thumbs.db differ diff --git a/lib/javascript/cal/calendar/calen_cbg.psd b/lib/javascript/cal/calendar/calen_cbg.psd new file mode 100644 index 0000000..d493b84 Binary files /dev/null and b/lib/javascript/cal/calendar/calen_cbg.psd differ diff --git a/lib/javascript/cal/calendar_stripped.js b/lib/javascript/cal/calendar_stripped.js new file mode 100644 index 0000000..4fe03f1 --- /dev/null +++ b/lib/javascript/cal/calendar_stripped.js @@ -0,0 +1,14 @@ +/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo + * ----------------------------------------------------------- + * + * The DHTML Calendar, version 1.0 "It is happening again" + * + * Details and latest version at: + * www.dynarch.com/projects/calendar + * + * This script is developed by Dynarch.com. Visit us at www.dynarch.com. + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + */ + Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.innerHTML=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)return false;removeClass(el,"hilite");if(el.caldate)removeClass(el.parentNode,"rowhilite");if(el.calendar)el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)cal._toggleMultipleDate(new Date(date));else newdate=!el.disabled;if(other_month)cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=new Date(cal.date);if(el.navtype==0)date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to to get it into the distribution ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}break;case 1:if(mon<11){setMonth(mon+1);}else if(year=0;)if(range[i]==current)break;if(ev&&ev.shiftKey){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}break;}if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)newdate=closing=true;}if(newdate){ev&&cal.callHandler();}if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="
"+text+"
";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("×",1,200).ttip=Calendar._TT["CLOSE"];}row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("«",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("‹",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("›",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("»",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||" ";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else cell.innerHTML=" ";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)h=0;}var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)ne=cal.ar_days[y][x];else{x=6;K=38;continue;}break;case 38:if(--y>=0)ne=cal.ar_days[y][x];else{prevMonth();setVars();}break;case 39:if(++x<7)ne=cal.ar_days[y][x];else{x=0;K=40;continue;}break;case 40:if(++ythis.maxYear){year=this.maxYear;date.setFullYear(year);}this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML=" ";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)cell.title=toolTip;}if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))cell.disabled=true;cell.className+=" "+status;}}if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&¤t_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}if(weekend.indexOf(wday.toString())!=-1)cell.className+=cell.otherMonth?" oweekend":" weekend";}}if(!(hasdays||this.showsOtherMonths))row.className="emptyrow";}this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)continue;if(cell)cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}function fixPosition(box){if(box.x<0)box.x=0;if(box.y<0)box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)value=document.defaultView. getComputedStyle(obj,"").getPropertyValue("visibility");else value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else value='';}return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2EY2)||(CY229)?1900:2000);break;case "%b":case "%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}break;case "%H":case "%I":case "%k":case "%l":hr=parseInt(a[i],10);break;case "%P":case "%p":if(/pm/i.test(a[i])&&hr<12)hr+=12;else if(/am/i.test(a[i])&&hr>=12)hr-=12;break;case "%M":min=parseInt(a[i],10);break;}}if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}if(y==0)y=today.getFullYear();if(m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i + + * skins/aqua/theme.css: *** empty log message *** + + * release-notes.html: updated release notes + + * calendar-setup.js: + use a better approach to initialize the calendar--don't call _init twice, + it's the most time consuming function in the calendar. Instead, determine + the date beforehand if possible and pass it to the calendar at constructor. + + * calendar.js: + avoid keyboard operation when 'multiple dates' is set (very buggy for now) + + * calendar.js: + fixed keyboard handling problems: now it works fine when "showsOtherMonths" + is passed; it also seems to be fine with disabled dates (won't normally + allow selection)--however this area is still likely to be buggy, i.e. in a + month that has all the dates disabled. + + * calendar.js: + some trivial performance improvements in the _init function + Added Date.parseDate (old Calendar.prototype.parseDate now calls this one) + +2005-03-05 Mihai Bazon + + * release-notes.html: updated release notes + + * dayinfo.html: *** empty log message *** + + * calendar-setup.js: + bugfix--update an inputField even if flat calendar is selected + + * calendar.js: + fixed bugs in parseDate function (if for some reason the input string is + totally broken, then check numbers for NaN and use values from the current + date instead) + + * make-release.pl: copy the skins subdirectory and all skins + + * index.html: added Aqua skin + + * skins/aqua/active-bg.gif, skins/aqua/dark-bg.gif, skins/aqua/hover-bg.gif, skins/aqua/menuarrow.gif, skins/aqua/normal-bg.gif, skins/aqua/rowhover-bg.gif, skins/aqua/status-bg.gif, skins/aqua/theme.css, skins/aqua/title-bg.gif, skins/aqua/today-bg.gif: + in the future, skins will go to this directory, each in a separate subdir; for now there's only Aqua, an excellent new skin + + * calendar.js: workaround IE bug, needed in the Aqua theme + don't hide select elements unless browser is IE or Opera + + * lang/calendar-bg.js, lang/calendar-big5-utf8.js, lang/calendar-big5.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-utf8.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-de.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fi.js, lang/calendar-fr.js, lang/calendar-he-utf8.js, lang/calendar-hu.js, lang/calendar-it.js, lang/calendar-ko-utf8.js, lang/calendar-ko.js, lang/calendar-lt-utf8.js, lang/calendar-lt.js, lang/calendar-lv.js, lang/calendar-nl.js, lang/calendar-no.js, lang/calendar-pl-utf8.js, lang/calendar-pl.js, lang/calendar-pt.js, lang/calendar-ro.js, lang/calendar-ru.js, lang/calendar-ru_win_.js, lang/calendar-si.js, lang/calendar-sk.js, lang/calendar-sp.js, lang/calendar-sv.js, lang/calendar-zh.js, lang/cn_utf8.js: + updated urls, copyright notices + + * doc/reference.tex: updated documentation + + * calendar.js, index.html: + renamed the global variable to _dynarch_popupCalendar to avoid name clashes + + * multiple-dates.html: start with an empty array + + * calendar.js: + fixed bugs in the time selector (12:XX pm was wrongfully understood as 12:XX am) + + * calendar.js: + using innerHTML instead of text nodes; works better in Safari and also makes + a smaller, cleaner code + +2005-03-04 Mihai Bazon + + * calendar.js: + fixed a performance regression that occurred after adding support for multiple dates + fixed the time selection bug (now it keeps time correctly) + clicking today will close the calendar if "today" is already selected + + * lang/cn_utf8.js: new translation + +2005-02-17 Mihai Bazon + + * lang/calendar-ar-utf8.zip: Added arabic translation + +2004-10-19 Mihai Bazon + + * lang/calendar-zh.js: updated + +2004-09-20 Mihai Bazon + + * lang/calendar-no.js: updated (Daniel Holmen) + +2004-09-20 Mihai Bazon + + * lang/calendar-no.js: updated (Daniel Holmen) + +2004-08-11 Mihai Bazon + + * lang/calendar-nl.js: updated language file (thanks to Arjen Duursma) + + * lang/calendar-sp.js: updated (thanks to Rafael Velasco) + +2004-07-21 Mihai Bazon + + * lang/calendar-br.js: updated + + * calendar-setup.js: fixed bug (dateText) + +2004-07-21 Mihai Bazon + + * lang/calendar-br.js: updated + + * calendar-setup.js: fixed bug (dateText) + +2004-07-04 Mihai Bazon + + * lang/calendar-lv.js: + added LV translation (thanks to Juris Valdovskis) + +2004-06-25 Mihai Bazon + + * calendar.js: + fixed bug in IE (el.calendar.tooltips is null or not an object) + +2004-06-24 Mihai Bazon + + * doc/reference.tex: fixed latex compilation + + * index.html: linking other sample files + + * calendar-setup.js, calendar.js, dayinfo.html: + ability to display day info (dateText parameter) + sample file + +2004-06-23 Mihai Bazon + + * doc/reference.tex, lang/calendar-bg.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-ko-utf8.js, lang/calendar-ko.js, lang/calendar-nl.js, lang/calendar-sv.js, README, calendar.js, index.html: + email address changed + +2004-06-14 Mihai Bazon + + * lang/calendar-cs-utf8.js, lang/calendar-cs-win.js: + updated translations + + * calendar-system.css: added z-index to drop downs + + * lang/calendar-en.js: + first day of week can now be part of the language file + + * lang/calendar-es.js: + updated language file (thanks to Servilio Afre Puentes) + + * calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar-blue.css: + added z-index property to drop downs (fixes bug) + +2004-06-13 Mihai Bazon + + * calendar-setup.js: fixed bug (apply showOthers to flat calendars too) + +2004-06-06 Mihai Bazon + + * calendar-setup.js: + firstDay defaults to "null", in which case the value in the language file + will be used + + * calendar.js: + firstDayOfWeek can now default to a value specified in the language definition file + + * index.html: first day of week is now numeric + +2004-06-02 Mihai Bazon + + * calendar.js: added date tooltip function + +2004-05-28 Mihai Bazon + + * lang/calendar-br.js: updated (thanks to Marcos Pont) + + * calendar-setup.js: fixed small bug + +2004-05-01 Mihai Bazon + + * calendar-setup.js: returns the calendar object + +2004-04-28 Mihai Bazon + + * calendar-setup.js: + patch to read the date value from the inputField, according to ifFormat (if + both are passed), for flat calendars. (thanks Colin T. Hill) + +2004-04-20 Mihai Bazon + + * calendar-setup.js, calendar.js, multiple-dates.html: + added support for multiple dates selection + + * lang/calendar-nl.js: + updated Dutch translation, thanks to Jeroen Wolsink + + * lang/calendar-big5-utf8.js, lang/calendar-big5.js: + Traditional Chinese language (thanks GaryFu) + +2004-03-26 Mihai Bazon + + * lang/calendar-fr.js, lang/calendar-pt.js: updated + + * lang/calendar-ru_win_.js, lang/calendar-ru.js: + updated, thanks to Sly Golovanov + +2004-03-25 Mihai Bazon + + * lang/calendar-fr.js: updated (thanks to David Duret) + +2004-03-24 Mihai Bazon + + * lang/calendar-da.js: updated (thanks to Michael Thingmand Henriksen) + +2004-03-21 Mihai Bazon + + * lang/calendar-ca.js: updated (thanks to David Valls) + +2004-03-17 Mihai Bazon + + * lang/calendar-de.js: updated to UTF8 (thanks to Jack (tR)) + +2004-03-09 Mihai Bazon + + * lang/calendar-bg.js: Bulgarian translation + +2004-03-08 Mihai Bazon + + * lang/calendar-he-utf8.js: Hebrew translation (thanks to Idan Sofer) + + * lang/calendar-hu.js: updated (thanks to Istvan Karaszi) + +2004-02-27 Mihai Bazon + + * lang/calendar-it.js: updated (thanks to Fabio Di Bernardini) + +2004-02-25 Mihai Bazon + + * calendar.js: fix for Safari (thanks to Olivier Chirouze / XPWeb) + +2004-02-22 Mihai Bazon + + * lang/calendar-al.js: Albanian language file + +2004-02-17 Mihai Bazon + + * lang/calendar-fr.js: fixed + + * lang/calendar-fr.js: + FR translation updated (thanks to SIMON Alexandre) + + * lang/calendar-es.js: ES translation updated, thanks to David Gonzales + +2004-02-10 Mihai Bazon + + * lang/calendar-pt.js: + updated Portugese translation, thanks to Elcio Ferreira + +2004-02-09 Mihai Bazon + + * TODO: updated + +2004-02-06 Mihai Bazon + + * README: describe the PHP files + + * make-release.pl: includes php files + + * make-release.pl: ChangeLog included in the distribution (if found) + + * calendar.js, doc/reference.tex, index.html: switched to version 0.9.6 + + * doc/Calendar.setup.tex, doc/reference.tex: updated documentation + + * release-notes.html: updated release notes + + * calendar.js: Fixed bug: Feb/29 and year change now keeps Feb in view + + * calendar.js: fixed the "ESC" problem (call the close handler) + + * calendar.js: fixed day of year range (1 to 366 instead of 0 to 365) + + * calendar.js: fixed week number calculations + + * doc/reference.tex: fixed (date input format) + + * calendar.php: removed comment + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js: + workaround for IE bug (you can't normally specify through CSS the style for + an element having two classes or more; we had to change a classname) + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + smaller fonts on days that are in neighbor months + +2004-02-04 Mihai Bazon + + * index.html: first demo shows the "showOtherMonths" capability + + * calendar-setup.js: support new parameters in the calendar. + added: firstDay, showOthers, cache. + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js, lang/calendar-en.js, lang/calendar-ro.js: + new parameters: firstDayOfWeek, showsOtherMonths; removed mondayFirst. + This adds support for setting any day to be the first day of week (by just + clicking the day name in the display); also, if showsOtherMonths is enabled + then dates belonging to adjacent months that are in the current view will be + displayed and the calendar will have a fixed height. + + all themes updated. + + * test.php: test for calendar.php + + * calendar.php: fixed bug (pass numeric values as numbers) + +2004-02-01 Mihai Bazon + + * calendar.php: added PHP wrapper + + * img.gif: icon updated + + * TODO: updated TODO list + +2004-01-27 Mihai Bazon + + * calendar.js: + Janusz Piwowarski sent over a patch for IE5 compatibility which is much more + elegant than the atrocities that I had wrote :-D I'm gettin' old.. Thanks Janusz! + + * lang/calendar-fi.js: updated + +2004-01-15 Mihai Bazon + + * TODO: updated TODO list + + * calendar-setup.js: default align changed to "Br" + + * doc/reference.tex: changed default value for "align" + + * calendar-setup.js: calling onchange event handler, if available + + * calendar-setup.js: added "position" option + + * simple-1.html: demonstrates "step" option + + * calendar-setup.js: added "step" option + + * calendar.js: added yearStep config parameter + + * calendar.js: + fixed parseDate routine (the NaN bug which occurred when there was a space + after the date and no time) + +2004-01-14 Mihai Bazon + + * lang/calendar-en.js: added "Time:" + + * test-position.html: test for the new position algorithm + + * index.html: do not destroy() the calendar + avoid bug in parseDate (%p must be separated by non-word characters) + + * menuarrow2.gif: for calendar-blue2.css + + * calendar-setup.js: honor "date" parameter if passed + + * calendar.js: IE5 support is back + performance improvements in IE6 (mouseover combo boxes) + display "Time:" beside the clock area, if defined in the language file + new positioning algorithm (try to keep the calendar in page) + rewrote parseDate a little cleaner + + * lang/calendar-el.js: + updated Greek translation (thanks Alexandros Pappas) + +2004-01-13 Mihai Bazon + + * index.html: added style blue2, using utf-8 instead of iso-8859-2 + + * calendar.js: performance under IE (which sucks, by the way) + + * doc/reference.tex: Sunny added to sponsor list + + * doc/Calendar.setup.tex: documenting parameter 'electric' + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + fixed IE text size problems + +2004-01-08 Mihai Bazon + + * lang/calendar-pl.js: + Polish translation updated to UTF-8 (thanks to Artur Filipiak) + +2004-01-07 Mihai Bazon + + * lang/calendar-si.js: updated (David Milost) + + * lang/calendar-si.js: Slovenian translation (thanks to David Milost) + +2003-12-21 Mihai Bazon + + * TODO: updated TODO list + + * lang/calendar-de.js: German translation (thanks to Peter Strotmann) + +2003-12-19 Mihai Bazon + + * doc/reference.tex: Thank you, Ian Barrak + +2003-12-18 Mihai Bazon + + * doc/reference.tex: fixed documentation bug (thanks Mike) + +2003-12-05 Mihai Bazon + + * lang/calendar-ko-utf8.js: + UTF8 version of the Korean language (hopefully correct) + + * lang/calendar-pl-utf8.js, lang/calendar-pl.js: + updated Polish translation (thanks to Janusz Piwowarski) + +2003-12-04 Mihai Bazon + + * lang/calendar-fr.js: + French translation updated (thanks to Angiras Rama) + +2003-11-22 Mihai Bazon + + * lang/calendar-da.js: updated (thanks to Jesper M. Christensen) + +2003-11-20 Mihai Bazon + + * calendar-blue2.css, calendar-tas.css: + new styles (thanks to Wendall Mosemann for blue2, Mark Lynch for tas) + + * lang/calendar-lt-utf8.js, lang/calendar-lt.js: + Lithuanian translation (thanks to Martynas Majeris) + + * lang/calendar-sp.js: updated + +2003-11-17 Mihai Bazon + + * TODO: added TODO list + +2003-11-14 Mihai Bazon + + * lang/calendar-ko.js: Korean translation (thanks to Yourim Yi) + +2003-11-12 Mihai Bazon + + * lang/calendar-jp.js: small bug fixed (thanks to TAHARA Yusei) + +2003-11-10 Mihai Bazon + + * lang/calendar-fr.js: translation updated, thanks to Florent Ramiere + + * calendar-setup.js: + added new parameter: electric (if false then the field will not get updated on each move) + + * index.html: fixed DOCTYPE + +2003-11-07 Mihai Bazon + + * calendar-setup.js: + fixed minor problem (maybe we're passing object reference instead of ID for + the flat calendar parent) + +2003-11-06 Mihai Bazon + + * lang/calendar-fi.js: + added Finnish translation (thanks to Antti Tuppurainen) + +2003-11-05 Mihai Bazon + + * release-notes.html: fixed typo + + * doc/reference.tex, index.html, calendar.js: 0.9.5 + + * README: fixed license statement + + * release-notes.html: updated release notes (0.9.5) + +2003-11-03 Mihai Bazon + + * lang/calendar-de.js: + updated German translation (thanks to Gerhard Neiner) + + * calendar-setup.js: fixed license statement + + * calendar.js: whitespace + + * calendar.js: fixed license statement + + * calendar.js: + fixed positioning problem when input field is inside scrolled divs + +2003-11-01 Mihai Bazon + + * lang/calendar-af.js: Afrikaan language (thanks to Derick Olivier) + +2003-10-31 Mihai Bazon + + * lang/calendar-it.js: + updated IT translation (thanks to Christian Blaser) + + * lang/calendar-es.js: updated ES translation, thanks to Raul + +2003-10-30 Mihai Bazon + + * lang/calendar-hu.js: updated thanks to Istvan Karaszi + + * index.html, simple-1.html, simple-2.html, simple-3.html: + switched to utf-8 all encodings + + * lang/calendar-sk.js: + added Slovak translation (thanks to Peter Valach) + + * lang/calendar-ro.js: switched to utf-8 + +2003-10-29 Mihai Bazon + + * lang/calendar-es.js: + updated translation, thanks to Jose Ma. Martinez Miralles + + * doc/reference.tex: + fixed the footnote problem (thanks Dominique de Waleffe for the tip) + + * lang/calendar-ro.js: fixed typo + + * lang/calendar-sv.js: oops, license should be LGPL + + * lang/calendar-sw.js: new swedish translation is calendar-sv.js + + * menuarrow.gif, menuarrow.png: + oops, forgot little drop-down menu arrows + + * lang/calendar-sv.js: swedish translation thanks to Leonard Norrgard + + * index.html: oops, some other minor changes + + * index.html, release-notes.html: + latest changes in release-notes and index page for 0.9.4 + + * doc/reference.tex, calendar.js: + added %s date format (# of seconds since Epoch) + + * calendar.js: + A click on TODAY will not close the calendar, even in single-click mode + +2003-10-28 Mihai Bazon + + * index.html: previous cal.html + + * cal.html: moved to index.html + + * README, cal.html, doc/reference.tex, lang/calendar-de.js, lang/calendar-en.js, lang/calendar-ro.js, release-notes.html: + LGPL license, forever. + + * doc/Calendar.setup.tex, simple-1.html: + doc updated for the onUpdate parameter to Calendar.setup + +2003-10-26 Mihai Bazon + + * calendar.js: fixed bug (correct display of the dropdown menus) + + * doc/Calendar.setup.tex, doc/reference.tex, lang/calendar-de.js, lang/calendar-en.js, lang/calendar-ro.js, README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-setup.js, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js, release-notes.html, simple-1.html, simple-3.html: + lots of changes for the 0.9.4 release (see the release-notes.html) + +2003-10-15 Mihai Bazon + + * doc/reference.tex: + documentation updated for 0.9.4 (not yet finished though) + +2003-10-07 Mihai Bazon + + * calendar.js, doc/reference.tex, release-notes.html, README, cal.html, calendar-setup.js: + modified project website + +2003-10-06 Mihai Bazon + + * calendar-setup.js: + added some properties (onSelect, onClose, date) (thanks altblue) + +2003-09-24 Mihai Bazon + + * simple-3.html: dateIsSpecial does not need the "date" argument ;-) + +2003-09-24 fsoft + + * calendar.js, simple-3.html: + added year, month, day to getDateStatus() function + +2003-09-24 Mihai Bazon + + * simple-3.html: example on how to use special dates + + * calendar-setup.js, calendar.js, simple-1.html: + support for special dates (thanks fabio) + +2003-09-17 Mihai Bazon + + * doc/reference.tex: fixed error in section 3. + +2003-08-01 Mihai Bazon + + * lang/calendar-jp.js: added Japanese translation + +2003-07-16 Mihai Bazon + + * simple-1.html: fixed problem with first example [IE,Opera] + +2003-07-09 Mihai Bazon + + * doc/Calendar.setup.tex: fixed typo (closing parenthesis) + + * lang/calendar-de.js: + added German translation, thanks to Hartwig Weinkauf + +2003-07-08 Mihai Bazon + + * cal.html: added link to release-notes + + * release-notes.html: 0.9.3 release notes + + * make-release.pl: + Script to create distribution archive. It needs some additional packages: + + - LaTeX + - tex2page + - jscrunch (JS compressor) + + * doc/html/makedoc.sh, doc/html/reference.css, doc/reference.tex, doc/makedoc.sh: + documentation updates... + + * calendar.js: added semicolon to make the code "compressible" + +2003-07-06 Mihai Bazon + + * doc/reference.tex: spell checked + + * doc/reference.tex: [minor] changed credits order + + * doc/reference.tex: various improvements and additions + + * doc/html/reference.css: minor eye-candy tweaks + +2003-07-05 Mihai Bazon + + * doc/html/Calendar.setup.html.tex, doc/html/makedoc.sh, doc/html/reference.css, doc/html/reference.t2p, doc/hyperref.cfg, doc/makedoc.sh, doc/reference.tex, doc/Calendar.setup.tex, doc/Calendar.setup.pdf.tex: + full documentation in LaTeX, for PDF and HTML formats + + * simple-2.html: + added demonstration of flat calendar with Calendar.setup + + * simple-1.html: + modified some links, added link to documentation, added demonstration of + disableFunc property + + * calendar-setup.js: added the ability to create flat calendar too + + * cal.html: added links to documentation and simple-[12].html pages + + * README: up-to-date... + + * calendar-setup.html: removed: the documentation is unified + +2003-07-03 Mihai Bazon + + * cal.html: some links to newly added files + + * calendar-setup.html, calendar-setup.js, img.gif, simple-1.html: + added some files to simplify calendar creation for non-(JS)-programmers + + * lang/calendar-zh.js: added simplified chinese (thanks ATang) + +2003-07-02 Mihai Bazon + + * calendar.js: * "yy"-related... [small fix] + + * calendar.js: + * #721833 fixed (yy format will understand years prior to 29 as 20xx) + + * calendar.js: * added refresh() function + + * calendar.js: * fixed bug when in single click mode + * added alignment options to "showAtElement" member function + +2003-06-25 Mihai Bazon + + * lang/calendar-pt.js: + added portugese translation (thanks Nuno Barreto) + +2003-06-24 Mihai Bazon + + * calendar.js: + call user handler when the date was changed using the keyboard + + * bugtest-hidden-selects.html: + file to test bug with hidden select-s (thanks Ying Zhang for reporting and for this test file) + + * lang/calendar-hr-utf8.js: + added croatian translation in utf8 (thanks Krunoslav Zubrinic) + +2003-06-23 Mihai Bazon + + * lang/calendar-hu.js: added hungarian translation + + * lang/calendar-hr.js: + added croatian translation (thanks to Krunoslav Zubrinic) + +2003-06-22 Mihai Bazon + + * calendar.js: + * #723335 fixed (clicking TODAY will not select the today date if the + disabledHandler rejects it) + + * cal.html: * new code for to work with fix for bug #703238 + * switch to new version + + * calendar.js: + * some patches to make code compatible with Opera 7 (well, almost compatible) + * bug #703238 fixed (fix breaks compatibility with older code that uses + calendar in single-click mode) + * bug #703814 fixed + +2003-04-09 Mihai Bazon + + * lang/calendar-tr.js: added turkish lang file + +2003-03-19 Mihai Bazon + + * lang/calendar-ru.js: russian translation added + + * lang/calendar-no.js: norwegian translation added + +2003-03-15 Mihai Bazon + + * lang/calendar-no.js: norwegian translation + +2003-03-12 Mihai Bazon + + * lang/calendar-pl.js: added polish translation + +2003-03-11 Mihai Bazon + + * calendar.js: + bugfix in parseDate (added base to parseInt, thanks Alan!) + +2003-03-05 Mihai Bazon + + * calendar.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-du.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-nl.js, lang/calendar-ro.js, lang/calendar-sp.js, lang/calendar-sw.js: + New file. + + * calendar.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-du.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-nl.js, lang/calendar-ro.js, lang/calendar-sp.js, lang/calendar-sw.js: + moved to CVS at sourceforge.net + release: 0.9.2 + new language packs + + + * README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + New file. + + * README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + moved to CVS at sourceforge.net + release: 0.9.2 + new language packs + + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/README b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/README new file mode 100644 index 0000000..455ab3d --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/README @@ -0,0 +1,33 @@ +The DHTML Calendar +------------------- + + Author: Mihai Bazon, + http://dynarch.com/mishoo/ + + This program is free software published under the + terms of the GNU Lesser General Public License. + + For the entire license text please refer to + http://www.gnu.org/licenses/lgpl.html + +Contents +--------- + + calendar.js -- the main program file + lang/*.js -- internalization files + *.css -- color themes + cal.html -- example usage file + doc/ -- documentation, in PDF and HTML + simple-1.html -- quick setup examples [popup calendars] + simple-2.html -- quick setup example for flat calendar + calendar.php -- PHP wrapper + test.php -- test file for the PHP wrapper + +Homepage +--------- + + For details and latest versions please refer to calendar + homepage, located on my website: + + http://dynarch.com/mishoo/calendar.epl + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/Thumbs.db b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/Thumbs.db new file mode 100644 index 0000000..7572ae3 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/Thumbs.db differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/bugtest-hidden-selects.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/bugtest-hidden-selects.html new file mode 100644 index 0000000..df35337 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/bugtest-hidden-selects.html @@ -0,0 +1,108 @@ + + + +Bug + + + + + + + + + + + + + +
+Date: +
+ + +

+
+
Visible <select>, hides and unhides as expected +
+ + +

+
Hidden <select>, it should stay hidden (but doesn't) +
+ + +

+
Hidden textbox below, it stays hidden as expected +
+ +

+ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-blue.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-blue.css new file mode 100644 index 0000000..ca33cde --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-blue.css @@ -0,0 +1,232 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #556; + font-size: 11px; + color: #000; + cursor: default; + background: #eef; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ +} + +.calendar .nav { + background: #778 url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #fff; + color: #000; + padding: 2px; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + background: #778; + color: #fff; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #bdf; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #556; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #a66; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #aaf; + color: #000; + border: 1px solid #04f; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #77c; + padding: 2px 0px 0px 2px; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + color: #456; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #bdf; +} + +.calendar tbody .rowhilite td { + background: #def; +} + +.calendar tbody .rowhilite td.wn { + background: #eef; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #def; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #cde; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fff; + color: #000; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { /* Cell showing selected date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #556; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #fff; + color: #445; + border-top: 1px solid #556; + padding: 1px; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #aaf; + border: 1px solid #04f; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #77c; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #def; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #acf; +} + +.calendar .combo .active { + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + background: #eef; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #667; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-blue2.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-blue2.css new file mode 100644 index 0000000..47128ec --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-blue2.css @@ -0,0 +1,236 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #206A9B; + font-size: 11px; + color: #000; + cursor: default; + background: #F1F8FC; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ +} + +.calendar .nav { + background: #007ED1 url(menuarrow2.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #000; + color: #fff; + padding: 2px; +} + +.calendar thead tr { /* Row containing navigation buttons */ + background: #007ED1; + color: #fff; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #C7E1F3; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #206A9B; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #a66; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #34ABFA; + color: #000; + border: 1px solid #016DC5; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #006AA9; + border: 1px solid #008AFF; + padding: 2px 0px 0px 2px; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + color: #456; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #C7E1F3; +} + +.calendar tbody .rowhilite td { + background: #def; +} + +.calendar tbody .rowhilite td.wn { + background: #F1F8FC; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #def; + padding: 1px 3px 1px 1px; + border: 1px solid #8FC4E8; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #cde; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fff; + color: #000; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { /* Cell showing selected date */ + font-weight: bold; + color: #D50000; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #206A9B; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #000; + color: #fff; + border-top: 1px solid #206A9B; + padding: 1px; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #B8DAF0; + border: 1px solid #178AEB; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #006AA9; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #def; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #34ABFA; + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + font-weight: bold; +} + +.calendar .combo .active { + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + background: #F1F8FC; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #E3F0F9; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #F1F8FC; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #267DB7; + color: #fff; +} + +.calendar td.time span.active { + border-color: red; + background-color: #000; + color: #A5FF00; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-brown.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-brown.css new file mode 100644 index 0000000..c42da5e --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-brown.css @@ -0,0 +1,225 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #655; + font-size: 11px; + color: #000; + cursor: default; + background: #ffd; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ +} + +.calendar .nav { + background: #edc url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #654; + color: #fed; + padding: 2px; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + background: #edc; + color: #000; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #655; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #faa; + color: #000; + border: 1px solid #f40; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #c77; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #fed; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #fed; +} + +.calendar tbody .rowhilite td { + background: #ddf; +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #ffe; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #ddc; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fea; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { font-weight: bold; } + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #988; + color: #000; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + border-top: 1px solid #655; + background: #dcb; + color: #840; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #faa; + border: 1px solid #f40; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #c77; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #ffe; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #fc8; +} + +.calendar .combo .active { + border-top: 1px solid #a64; + border-bottom: 1px solid #a64; + background: #fee; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #a88; + padding: 1px 0px; + text-align: center; + background-color: #fed; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #988; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #866; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-green.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-green.css new file mode 100644 index 0000000..2e1867a --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-green.css @@ -0,0 +1,229 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #565; + font-size: 11px; + color: #000; + cursor: default; + background: #efe; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ + background: #676; + color: #fff; + font-size: 90%; +} + +.calendar .nav { + background: #676 url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + padding: 2px; + background: #250; + color: #efa; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #565; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #a66; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #afa; + color: #000; + border: 1px solid #084; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #7c7; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #dfb; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + color: #564; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #8a8; + background: #dfb; +} + +.calendar tbody .rowhilite td { + background: #dfd; +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #efd; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #dec; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #f8fff8; + color: #000; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { font-weight: bold; color: #0a0; } + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #565; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + padding: 2px; + background: #250; + color: #efa; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #afa; + border: 1px solid #084; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #7c7; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #565; + background: #efd; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #af8; +} + +.calendar .combo .active { + border-top: 1px solid #6a4; + border-bottom: 1px solid #6a4; + background: #efe; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #8a8; + padding: 1px 0px; + text-align: center; + background-color: #dfb; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #898; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #686; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-system.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-system.css new file mode 100644 index 0000000..b224885 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-system.css @@ -0,0 +1,251 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border: 1px solid; + border-color: #fff #000 #000 #fff; + font-size: 11px; + cursor: default; + background: Window; + color: WindowText; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border: 1px solid; + border-color: #fff #000 #000 #fff; + font-size: 11px; + cursor: default; + background: Window; + color: WindowText; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + background: ButtonFace; +} + +.calendar .nav { + background: ButtonFace url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: ActiveCaption; + color: CaptionText; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid ButtonShadow; + padding: 2px; + text-align: center; + background: ButtonFace; + color: ButtonText; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border: 2px solid; + padding: 0px; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + border-width: 1px; + padding: 2px 0px 0px 2px; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid ButtonShadow; + background: ButtonFace; + color: ButtonText; +} + +.calendar tbody .rowhilite td { + background: Highlight; + color: HighlightText; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + padding: 2px 2px 0px 2px; + background: ButtonFace; + color: ButtonText; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody td.disabled { color: GrayText; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: ButtonFace; + padding: 1px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + color: ButtonText; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + background: Menu; + color: MenuText; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + padding: 0px; + border: 1px solid #000; +} + +.calendar .combo .hilite { + background: Highlight; + color: HighlightText; +} + +.calendar td.time { + border-top: 1px solid ButtonShadow; + padding: 1px 0px; + text-align: center; + background-color: ButtonFace; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: Menu; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: Highlight; + color: HighlightText; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-tas.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-tas.css new file mode 100644 index 0000000..c2f8721 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-tas.css @@ -0,0 +1,239 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #655; + font-size: 11px; + color: #000; + cursor: default; + background: #ffd; + font-family: tahoma,verdana,sans-serif; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF); +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ + color:#363636; +} + +.calendar .nav { + background: #edc url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #654; + color: #363636; + padding: 2px; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#dddccc); +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + /*background: #3B86A0;*/ + color: #363636; + font-weight: bold; +filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#3b86a0); +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #655; + padding: 2px; + text-align: center; + color: #363636; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF); +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #ffcc86; + color: #000; + border: 1px solid #b59345; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #c77; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #fed; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #fed; +} + +.calendar tbody .rowhilite td { + background: #ddf; + +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #ffe; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #ddc; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fea; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { font-weight: bold; } + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #988; + color: #000; + +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + border-top: 1px solid #655; + background: #dcb; + color: #363636; + font-weight: bold; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#FFFFFF,EndColorStr=#DDDCCC); +} +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #faa; + border: 1px solid #f40; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #c77; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #ffe; + color: #000; + font-size: smaller; + z-index: 100; +} + +.combo .label, +.combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.combo .label-IEfix { + width: 4em; +} + +.combo .hilite { + background: #fc8; +} + +.combo .active { + border-top: 1px solid #a64; + border-bottom: 1px solid #a64; + background: #fee; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #a88; + padding: 1px 0px; + text-align: center; + background-color: #fed; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #988; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #866; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-1.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-1.css new file mode 100644 index 0000000..8c5d026 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-1.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4f0e8; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4e0d8; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4c0b8; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4f0e8; +} + +.calendar tbody .rowhilite td { + background: #e4e0d8; +} + +.calendar tbody .rowhilite td.wn { + background: #d4d0c8; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4e0d8; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4f0e8; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4e0d8; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c4c0b8; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #fea; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-2.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-2.css new file mode 100644 index 0000000..6f37b7d --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-2.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4c8d0; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4c8d0; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #847880; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4e8f0; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4d8e0; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4b8c0; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4e8f0; +} + +.calendar tbody .rowhilite td { + background: #e4d8e0; +} + +.calendar tbody .rowhilite td.wn { + background: #d4c8d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4d8e0; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4e8f0; + padding: 1px; + border: 1px solid #000; + background: #847880; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4d8e0; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4d8e0; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #d4c8d0; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #408; + color: #fea; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-cold-1.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-cold-1.css new file mode 100644 index 0000000..fa5c093 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-cold-1.css @@ -0,0 +1,265 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d0d4; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d0d4; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #788084; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #e8f0f4; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #d8e0e4; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #b8c0c4; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #e8f4f0; +} + +.calendar tbody .rowhilite td { + background: #d8e4e0; +} + +.calendar tbody .rowhilite td.wn { + background: #c8d4d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border: 1px solid; + border-color: #fff #000 #000 #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: #000 #fff #fff #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: #000 #fff #fff #000; + background: #d8e0e4; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #e8f0f4; + padding: 1px; + border: 1px solid #000; + background: #788084; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #d8e0e4; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #d8e0e4; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c8d0d4; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #aef; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #e8f0f4; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #667; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-cold-2.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-cold-2.css new file mode 100644 index 0000000..8e930c8 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar-win2k-cold-2.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d4d0; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d4d0; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #788480; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #e8f4f0; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #d8e4e0; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #b8c4c0; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #e8f4f0; +} + +.calendar tbody .rowhilite td { + background: #d8e4e0; +} + +.calendar tbody .rowhilite td.wn { + background: #c8d4d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #d8e4e0; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #e8f4f0; + padding: 1px; + border: 1px solid #000; + background: #788480; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #d8e4e0; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #d8e4e0; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c8d4d0; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #aef; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #e8f0f4; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #667; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar.php b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar.php new file mode 100644 index 0000000..5b9120d --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/calendar.php @@ -0,0 +1,119 @@ +calendar_file = 'calendar_stripped.js'; + $this->calendar_setup_file = 'calendar-setup_stripped.js'; + } else { + $this->calendar_file = 'calendar.js'; + $this->calendar_setup_file = 'calendar-setup.js'; + } + $this->calendar_lang_file = 'lang/calendar-' . $lang . '.js'; + $this->calendar_theme_file = $theme.'.css'; + $this->calendar_lib_path = preg_replace('/\/+$/', '/', $calendar_lib_path); + $this->calendar_options = array('ifFormat' => '%Y/%m/%d', + 'daFormat' => '%Y/%m/%d'); + } + + function set_option($name, $value) { + $this->calendar_options[$name] = $value; + } + + function load_files() { + echo $this->get_load_files_code(); + } + + function get_load_files_code() { + $code = ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' ); + return $code; + } + + function _make_calendar($other_options = array()) { + $js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options)); + $code = ( '' ); + return $code; + } + + function make_input_field($cal_options = array(), $field_attributes = array()) { + $id = $this->_gen_id(); + $attrstr = $this->_make_html_attr(array_merge($field_attributes, + array('id' => $this->_field_id($id), + 'type' => 'text'))); + echo ''; + echo '' . + ''; + + $options = array_merge($cal_options, + array('inputField' => $this->_field_id($id), + 'button' => $this->_trigger_id($id))); + echo $this->_make_calendar($options); + } + + /// PRIVATE SECTION + + function _field_id($id) { return 'f-calendar-field-' . $id; } + function _trigger_id($id) { return 'f-calendar-trigger-' . $id; } + function _gen_id() { static $id = 0; return ++$id; } + + function _make_js_hash($array) { + $jstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + if (is_bool($val)) + $val = $val ? 'true' : 'false'; + else if (!is_numeric($val)) + $val = '"'.$val.'"'; + if ($jstr) $jstr .= ','; + $jstr .= '"' . $key . '":' . $val; + } + return $jstr; + } + + function _make_html_attr($array) { + $attrstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + $attrstr .= $key . '="' . $val . '" '; + } + return $attrstr; + } +}; + +?> \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/dayinfo.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/dayinfo.html new file mode 100644 index 0000000..bc415c8 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/dayinfo.html @@ -0,0 +1,109 @@ + + +How to include additional info in day cells + + + + + + + + +

How to include additional info in day cells

+ +
+ + + +

The idea is simple:

+ +
    +
  1. +

    Define a callback that takes two parameters like this:

    +
    function getDateText(date, d)
    +

    + This function will receive the date object as the first + parameter and the current date number (1..31) as the second (you + can get it as well by calling date.getDate() but since it's very + probably useful I thought I'd pass it too so that we can avoid a + function call). +

    +

    + This function must return the text to be inserted in + the cell of the passed date. That is, one should at least + "return d;". +

    +
  2. +
  3. + Pass the above function as the "dateText" parameter to + Calendar.setup. +
  4. +
+ +

+ The function could simply look like: +

+ +
  function getDateText(date, d) {
+    if (d == 12) {
+      return "12th";
+    } else if (d == 13) {
+      return "bad luck";
+    } /* ... etc ... */
+  }
+ +

+ but it's easy to imagine that this approach sucks. For a better + way, see the source of this page and note the usage of an externally + defined "dateText" object which maps "date" to "date info", also + taking into account the year and month. This object can be easily + generated from a database, and the getDateText function becomes + extremely simple (and static). +

+ +

+ Cheers! +

+ +
+
mishoo
+ Last modified: Sat Mar 5 17:18:06 EET 2005 + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/Thumbs.db b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/Thumbs.db new file mode 100644 index 0000000..83363d8 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/Thumbs.db differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/field-button.jpg b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/field-button.jpg new file mode 100644 index 0000000..ecbe9d8 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/field-button.jpg differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference-Z-S.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference-Z-S.css new file mode 100644 index 0000000..02a6f88 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference-Z-S.css @@ -0,0 +1,193 @@ + + body { + color: black; + /* background-color: #e5e5e5;*/ + background-color: #ffffff; + /*background-color: beige;*/ + margin-top: 2em; + margin-left: 8%; + margin-right: 8%; + } + + h1,h2,h3,h4,h5,h6 { + margin-top: .5em; + } + + .title { + font-size: 200%; + font-weight: normal; + } + + .partheading { + font-size: 100%; + } + + .chapterheading { + font-size: 100%; + } + + .beginsection { + font-size: 110%; + } + + .tiny { + font-size: 40%; + } + + .scriptsize { + font-size: 60%; + } + + .footnotesize { + font-size: 75%; + } + + .small { + font-size: 90%; + } + + .normalsize { + font-size: 100%; + } + + .large { + font-size: 120%; + } + + .largecap { + font-size: 150%; + } + + .largeup { + font-size: 200%; + } + + .huge { + font-size: 300%; + } + + .hugecap { + font-size: 350%; + } + + pre { + margin-left: 2em; + } + + blockquote { + margin-left: 2em; + } + + ol { + list-style-type: decimal; + } + + ol ol { + list-style-type: lower-alpha; + } + + ol ol ol { + list-style-type: lower-roman; + } + + ol ol ol ol { + list-style-type: upper-alpha; + } + + /* + .verbatim { + color: #4d0000; + } + */ + + tt i { + font-family: serif; + } + + .verbatim em { + font-family: serif; + } + + .scheme em { + font-family: serif; + color: black; + } + + .scheme { + color: brown; + } + + .scheme .keyword { + color: #990000; + font-weight: bold; + } + + .scheme .builtin { + color: #990000; + } + + .scheme .variable { + color: navy; + } + + .scheme .global { + color: purple; + } + + .scheme .selfeval { + color: green; + } + + .scheme .comment { + color: teal; + } + + .schemeresponse { + color: green; + } + + .navigation { + color: red; + text-align: right; + font-size: medium; + font-style: italic; + } + + .disable { + /* color: #e5e5e5; */ + color: gray; + } + + .smallcaps { + font-size: 75%; + } + + .smallprint { + color: gray; + font-size: 75%; + text-align: right; + } + + /* + .smallprint hr { + text-align: left; + width: 40%; + } + */ + + .footnoterule { + text-align: left; + width: 40%; + } + + .colophon { + color: gray; + font-size: 80%; + text-align: right; + } + + .colophon a { + color: gray; + } + + \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference.css new file mode 100644 index 0000000..42e9283 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference.css @@ -0,0 +1,34 @@ +html { margin: 0px; padding: 0px; background-color: #08f; color: #444; font-family: georgia,serif; } +body { margin: 2em 8%; background-color: #fff; padding: 1em; border: 2px ridge #048; } + +a:link, a:visited { text-decoration: none; color: #00f; } +a:hover { color: #f00; text-decoration: underline; } +a:active { color: #f84; } + +h1, h2, h3, h4, h5, h6 { font-family: tahoma,verdana,sans-serif; } + +h2, h3 { font-weight: normal; } + +h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { text-decoration: none; } + +h1 { font-size: 170%; border: 2px ridge #048; letter-spacing: 2px; color: #000; margin-left: -2em; margin-right: -2em; +background-color: #fff; padding: 2px 1em; background-color: #def; } +h2 { font-size: 140%; color: #222; } +h3 { font-size: 120%; color: #444; } + +h1.title { font-size: 300%; font-family: georgia,serif; font-weight: normal; color: #846; letter-spacing: -1px; +border: none; +padding: none; +background-color: #fff; +border-bottom: 3px double #624; padding-bottom: 2px; margin-left: 8%; margin-right: 8%; } + +.colophon { padding-top: 2em; color: #999; font-size: 90%; font-family: georgia,"times new roman",serif; } +.colophon a:link, .colophon a:visited { color: #755; } +.colophon a:hover { color: #422; text-decoration: underline; } + +.footnote { font-size: 90%; font-style: italic; font-family: georgia,"times new roman",serif; margin: 0px 3em; } +.footnote sup { font-size: 120%; padding: 0px 0.3em; position: relative; top: -0.2em; } + +.small { font-size: 90%; } + +.verbatim { background-color: #eee; padding: 0.2em 1em; border: 1px solid #aaa; } diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference.html new file mode 100644 index 0000000..4bf6380 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/html/reference.html @@ -0,0 +1,1738 @@ + + + + + +DHTML Calendar Widget + + + + + + +

+

+

+

+

+

+

+

+

+

+

+

+

+ + + + +

+

+ + +

+

+

+

+

+



DHTML Calendar Widget

+

+
+Mihai Bazon, <mihai_bazon@yahoo.com>
+© Dynarch.com 2002-2005, www.dynarch.com

March 7, 2005

+

+

+calendar version: 1.0 ``It is happening again'' +

+
+

+

+$Id: reference.tex,v 1.23 2005/03/05 11:37:14 mishoo Exp $ +

+
+
+ +
+ +
+ +

Contents

+

+

+    1  Overview
+        1.1  How does this thing work?
+        1.2  Project files
+        1.3  License
+

+

+    2  Quick startup
+        2.1  Installing a popup calendar
+        2.2  Installing a flat calendar
+        2.3  Calendar.setup in detail
+

+

+    3  Recipes
+        3.1  Popup calendars
+            3.1.1  Simple text field with calendar attached to a button
+            3.1.2  Simple field with calendar attached to an image
+            3.1.3  Hidden field, plain text triggers
+            3.1.4  2 Linked fields, no trigger buttons
+        3.2  Flat calendars
+        3.3  Highlight special dates
+        3.4  Select multiple dates
+

+

+    4  The Calendar object overview
+        4.1  Creating a calendar
+        4.2  Order does matter ;-)
+        4.3  Caching the object
+        4.4  Callback functions
+

+

+    5  The Calendar object API reference
+        5.1  Calendar constructor
+        5.2  Useful member variables (properties)
+        5.3  Public methods
+            5.3.1  Calendar.create
+            5.3.2  Calendar.callHandler
+            5.3.3  Calendar.callCloseHandler
+            5.3.4  Calendar.hide
+            5.3.5  Calendar.setDateFormat
+            5.3.6  Calendar.setTtDateFormat
+            5.3.7  Calendar.setDisabledHandler
+            5.3.8  Calendar.setDateStatusHandler
+            5.3.9  Calendar.show
+            5.3.10  Calendar.showAt
+            5.3.11  Calendar.showAtElement
+            5.3.12  Calendar.setDate
+            5.3.13  Calendar.setFirstDayOfWeek
+            5.3.14  Calendar.parseDate
+            5.3.15  Calendar.setRange
+

+

+    6  Side effects
+

+

+    7  Credits
+

+

+

+

+

+ +

1  Overview

+

The DHTML Calendar widget1 +is an (HTML) user interface element that gives end-users a friendly way to +select date and time. It works in a web browser. The first versions only provided +support for popup calendars, while starting with version 0.9 it also supports +``flat'' display. A ``flat'' calendar is a calendar that stays visible in the +page all the time. In this mode it could be very useful for ``blog'' pages and +other pages that require the calendar to be always present.

+

+The calendar is compatible with most popular browsers nowadays. While it's +created using web standards and it should generally work with any compliant +browser, the following browsers were found to work: Mozilla/Firefox (the +development platform), Netscape 6.0 or better, all other Gecko-based browsers, +Internet Explorer 5.0 or better for Windows2, Opera 73, Konqueror 3.1.2 and Apple Safari for +MacOSX.

+

+You can find the latest info and version at the calendar homepage:

+

+

+ +

+

+ +

1.1  How does this thing work?

+

DHTML is not ``another kind of HTML''. It's merely a naming convention. DHTML +refers to the combination of HTML, CSS, JavaScript and DOM. DOM (Document +Object Model) is a set of interfaces that glues the other three together. In +other words, DOM allows dynamic modification of an HTML page through a program. +JavaScript is our programming language, since that's what browsers like. CSS +is a way to make it look good ;-). So all this soup is generically known as +DHTML.

+

+Using DOM calls, the program dynamically creates a <table> element +that contains a calendar for the given date and then inserts it in the document +body. Then it shows this table at a specified position. Usually the position +is related to some element in which the date needs to be displayed/entered, +such as an input field.

+

+By assigning a certain CSS class to the table we can control the look of the +calendar through an external CSS file; therefore, in order to change the +colors, backgrounds, rollover effects and other stuff, you can only change a +CSS file -- modification of the program itself is not necessary.

+

+

+ +

1.2  Project files

+

Here's a description of the project files, excluding documentation and example +files.

+

+

+

    +

    +
  • the main program file (calendar.js). This defines all the logic +behind the calendar widget.

    +

    +

    +
  • the CSS files (calendar-*.css). Loading one of them is +necessary in order to see the calendar as intended.

    +

    +

    +
  • the language definition files (lang/calendar-*.js). They are +plain JavaScript files that contain all texts that are displayed by the +calendar. Loading one of them is necessary.

    +

    +

    +
  • helper functions for quick setup of the calendar +(calendar-setup.js). You can do fine without it, but starting with +version 0.9.3 this is the recommended way to setup a calendar.

    +

    +

    +

+

+

+ +

1.3  License

+

+
+ +© Dynarch.com 2002-2005, +www.dynarch.com +Author: Mihai Bazon +
+

+The calendar is released under the +GNU Lesser General Public License.

+

+

+ +

2  Quick startup

+

+

+Installing the calendar used to be quite a task until version 0.9.3. Starting +with 0.9.3 I have included the file calendar-setup.js whose goal is to +assist you to setup a popup or flat calendar in minutes. You are +encouraged to modify this file and not calendar.js if you need +extra customization, but you're on your own.

+

+First you have to include the needed scripts and style-sheet. Make sure you do +this in your document's <head> section, also make sure you put the +correct paths to the scripts.

+

+

+
<style type="text/css">@import url(calendar-win2k-1.css);</style>
+<script type="text/javascript" src="calendar.js"></script>
+<script type="text/javascript" src="lang/calendar-en.js"></script>
+<script type="text/javascript" src="calendar-setup.js"></script>
+

+

+

+ +

2.1  Installing a popup calendar

+

+

+Now suppose you have the following HTML:

+

+

+
<form ...>
+  <input type="text" id="data" name="data" />
+  <button id="trigger">...</button>
+</form>
+

+

+You want the button to popup a calendar widget when clicked? Just +insert the following code immediately after the HTML form:

+

+

+
<script type="text/javascript">
+  Calendar.setup(
+    {
+      inputField  : "data",         // ID of the input field
+      ifFormat    : "%m %d, %Y",    // the date format
+      button      : "trigger"       // ID of the button
+    }
+  );
+</script>
+

+

+The Calendar.setup function, defined in calendar-setup.js +takes care of ``patching'' the button to display a calendar when clicked. The +calendar is by default in single-click mode and linked with the given input +field, so that when the end-user selects a date it will update the input field +with the date in the given format and close the calendar. If you are a +long-term user of the calendar you probably remember that for doing this you +needed to write a couple functions and add an ``onclick'' handler for the +button by hand.

+

+By looking at the example above we can see that the function +Calendar.setup receives only one parameter: a JavaScript object. +Further, that object can have lots of properties that tell to the setup +function how would we like to have the calendar. For instance, if we would +like a calendar that closes at double-click instead of single-click we would +also include the following: singleClick:false.

+

+For a list of all supported parameters please see the section +2.3.

+

+

+ +

2.2  Installing a flat calendar

+

+

+Here's how to configure a flat calendar, using the same Calendar.setup +function. First, you should have an empty element with an ID. This element +will act as a container for the calendar. It can be any block-level element, +such as DIV, TABLE, etc. We will use a DIV in this example.

+

+

+
<div id="calendar-container"></div>
+

+

+Then there is the JavaScript code that sets up the calendar into the +``calendar-container'' DIV. The code can occur anywhere in HTML +after the DIV element.

+

+

+
<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+

+

+

+ +

2.3  Calendar.setup in detail

+

+

+Following there is the complete list of properties interpreted by +Calendar.setup. All of them have default values, so you can pass only those +which you would like to customize. Anyway, you must pass at least one +of inputField, displayArea or button, for a popup +calendar, or flat for a flat calendar. Otherwise you will get a +warning message saying that there's nothing to setup.

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
property type description default +
inputField +string The ID of your input field. +null +
displayArea +string This is the ID of a <span>, <div>, or any other element that you would like to use to display the current date. This is generally useful only if the input field is hidden, as an area to display the date. +null +
button +string The ID of the calendar ``trigger''. This is an element (ordinarily a button or an image) that will dispatch a certain event (usually ``click'') to the function that creates and displays the calendar. +null +
eventName +string The name of the event that will trigger the calendar. The name should be without the ``on'' prefix, such as ``click'' instead of ``onclick''. Virtually all users will want to let this have the default value (``click''). Anyway, it could be useful if, say, you want the calendar to appear when the input field is focused and have no trigger button (in this case use ``focus'' as the event name). +``click'' +
ifFormat +string The format string that will be used to enter the date in the input field. This format will be honored even if the input field is hidden. +``%Y/%m/%d'' +
daFormat +string Format of the date displayed in the displayArea (if specified). +``%Y/%m/%d'' +
singleClick +boolean Wether the calendar is in ``single-click mode'' or ``double-click mode''. If true (the default) the calendar will be created in single-click mode. +true +
disableFunc +function A function that receives a JS Date object. It should return +true if that date has to be disabled, false otherwise. +DEPRECATED (see below). +null +
dateStatusFunc +function A function that receives a JS Date object and returns a boolean +or a string. This function allows one to set a certain CSS class to some +date, therefore making it look different. If it returns true then +the date will be disabled. If it returns false nothing special +happens with the given date. If it returns a string then that will be taken +as a CSS class and appended to the date element. If this string is +``disabled'' then the date is also disabled (therefore is like returning +true). For more information please also refer to section +5.3.8. +null +
firstDay +integer Specifies which day is to be displayed as the first day of +week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, ..., 6 +means Saturday. The end user can easily change this too, by clicking on the +day name in the calendar header. +0 +
weekNumbers +boolean If ``true'' then the calendar will display week numbers. +true +
align +string Alignment of the calendar, relative to the reference element. The +reference element is dynamically chosen like this: if a displayArea is +specified then it will be the reference element. Otherwise, the input field +is the reference element. For the meaning of the alignment characters +please section 5.3.11. +``Bl'' +
range +array An array having exactly 2 elements, integers. (!) The first [0] element is the minimum year that is available, and the second [1] element is the maximum year that the calendar will allow. +[1900, 2999] +
flat +string If you want a flat calendar, pass the ID of the parent object in +this property. If not, pass null here (or nothing at all as +null is the default value). +null +
flatCallback +function You should provide this function if the calendar is flat. It +will be called when the date in the calendar is changed with a reference to +the calendar object. See section 2.2 for an example +of how to setup a flat calendar. +null +
onSelect +function If you provide a function handler here then you have to manage +the ``click-on-date'' event by yourself. Look in the calendar-setup.js and +take as an example the onSelect handler that you can see there. +null +
onClose +function This handler will be called when the calendar needs to close. +You don't need to provide one, but if you do it's your responsibility to +hide/destroy the calendar. You're on your own. Check the calendar-setup.js +file for an example. +null +
onUpdate +function If you supply a function handler here, it will be called right +after the target field is updated with a new date. You can use this to +chain 2 calendars, for instance to setup a default date in the second just +after a date was selected in the first. +null +
date +date This allows you to setup an initial date where the calendar will be +positioned to. If absent then the calendar will open to the today date. +null +
showsTime +boolean If this is set to true then the calendar will also +allow time selection. +false +
timeFormat +string Set this to ``12'' or ``24'' to configure the way that the +calendar will display time. +``24'' +
electric +boolean Set this to ``false'' if you want the calendar to update the +field only when closed (by default it updates the field at each date change, +even if the calendar is not closed) true +
position +array Specifies the [x, y] position, relative to page's top-left corner, +where the calendar will be displayed. If not passed then the position will +be computed based on the ``align'' parameter. Defaults to ``null'' (not +used). null +
cache +boolean Set this to ``true'' if you want to cache the calendar object. +This means that a single calendar object will be used for all fields that +require a popup calendar false +
showOthers +boolean If set to ``true'' then days belonging to months overlapping +with the currently displayed month will also be displayed in the calendar +(but in a ``faded-out'' color) false + +
+ +

+

+ +

3  Recipes

+

This section presents some common ways to setup a calendar using the +Calendar.setup function detailed in the previous section.

+

+We don't discuss here about loading the JS or CSS code -- so make sure you +add the proper <script> and <style> or <link> elements in your +HTML code. Also, when we present input fields, please note that they should +be embedded in some form in order for data to be actually sent to server; we +don't discuss these things here because they are not related to our +calendar.

+

+

+ +

3.1  Popup calendars

+

These samples can be found in the file “simple-1.html� from the +calendar package.

+

+

+ +

3.1.1  Simple text field with calendar attached to a button

+

+

+This piece of code will create a calendar for a simple input field with a +button that will open the calendar when clicked.

+

+

+
<input type="text" name="date" id="f_date_b"
+       /><button type="reset" id="f_trigger_b"
+       >...</button>
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_b",           //*
+        ifFormat       :    "%m/%d/%Y %I:%M %p",
+        showsTime      :    true,
+        button         :    "f_trigger_b",        //*
+        step           :    1
+    });
+</script>
+

+

+Note that this code does more actually; the only required fields are +those marked with “//*� -- that is, the ID of the input field and the ID of +the button need to be passed to Calendar.setup in order for the +calendar to be properly assigned to this input field. As one can easily +guess from the argument names, the other arguments configure a certain date +format, instruct the calendar to also include a time selector and display +every year in the drop-down boxes (the “step� parameter) -- instead of showing +every other year as the default calendar does.

+

+

+ +

3.1.2  Simple field with calendar attached to an image

+

Same as the above, but the element that triggers the calendar is this time +an image, not a button.

+

+

+
<input type="text" name="date" id="f_date_c" readonly="1" />
+<img src="img.gif" id="f_trigger_c"
+     style="cursor: pointer; border: 1px solid red;"
+     title="Date selector"
+     onmouseover="this.style.background='red';"
+     onmouseout="this.style.background=''" />
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_c",
+        ifFormat       :    "%B %e, %Y",
+        button         :    "f_trigger_c",
+        align          :    "Tl",
+        singleClick    :    false
+    });
+</script>
+

+

+Note that the same 2 parameters are required as in the previous case; the +difference is that the 'button' parameter now gets the ID of the image +instead of the ID of the button. But the event is the same: at 'onclick' on +the element that is passed as 'button', the calendar will be shown.

+

+The above code additionally sets an alignment mode -- the parameters are +described in 5.3.11.

+

+

+ +

3.1.3  Hidden field, plain text triggers

+

Sometimes, to assure that the date is well formatted, you might want not to +allow the end user to write a date manually. This can easily be achieved +with an input field by setting its readonly attribute, which is +defined by the HTML4 standard; however, here's an even nicer approach: our +calendar widget allows you to use a hidden field as the way to pass data to +server, and a “display area� to show the end user the selected date. The +“display area� can be any HTML element, such as a DIV or a SPAN or +whatever -- we will use a SPAN in our sample.

+

+

+
<input type="hidden" name="date" id="f_date_d" />
+
+<p>Your birthday:
+   <span style="background-color: #ff8; cursor: default;"
+         onmouseover="this.style.backgroundColor='#ff0';"
+         onmouseout="this.style.backgroundColor='#ff8';"
+         id="show_d"
+   >Click to open date selector</span>.</p>
+
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_d",
+        ifFormat       :    "%Y/%d/%m",
+        displayArea    :    "show_d",
+        daFormat       :    "%A, %B %d, %Y",
+    });
+</script>
+

+

+The above code will configure a calendar attached to the hidden field and to +the SPAN having the id=“show_d�. When the SPAN element is clicked, the +calendar opens and allows the end user to chose a date. When the date is +chosen, the input field will be updated with the value in the format +“%Y/%d/%m�, and the SPAN element will display the date in a +friendlier format (defined by “daFormat�).

+

+Beware that using this approach will make your page unfunctional in browsers +that do not support JavaScript or our calendar.

+

+

+ +

3.1.4  2 Linked fields, no trigger buttons

+

Supposing you want to create 2 fields that hold an interval of exactly one +week. The first is the starting date, and the second is the ending date. +You want the fields to be automatically updated when some date is clicked in +one or the other, in order to keep exactly one week difference between them.

+

+

+
<input type="text" name="date" id="f_date_a" />
+<input type="text" name="date" id="f_calcdate" />
+
+<script type="text/javascript">
+    function catcalc(cal) {
+        var date = cal.date;
+        var time = date.getTime()
+        // use the _other_ field
+        var field = document.getElementById("f_calcdate");
+        if (field == cal.params.inputField) {
+            field = document.getElementById("f_date_a");
+            time -= Date.WEEK; // substract one week
+        } else {
+            time += Date.WEEK; // add one week
+        }
+        var date2 = new Date(time);
+        field.value = date2.print("%Y-%m-%d %H:%M");
+    }
+    Calendar.setup({
+        inputField     :    "f_date_a",
+        ifFormat       :    "%Y-%m-%d %H:%M",
+        showsTime      :    true,
+        timeFormat     :    "24",
+        onUpdate       :    catcalc
+    });
+    Calendar.setup({
+        inputField     :    "f_calcdate",
+        ifFormat       :    "%Y-%m-%d %H:%M",
+        showsTime      :    true,
+        timeFormat     :    "24",
+        onUpdate       :    catcalc
+    });
+</script>
+

+

+The above code will configure 2 input fields with calendars attached, as +usual. The first thing to note is that there's no trigger button -- in such +case, the calendar will popup when one clicks into the input field. Using +the onUpdate parameter, we pass a reference to a function of ours +that will get called after a date was selected. In that function we +determine what field was updated and we compute the date in the other input +field such that it keeps a one week difference between the two. Enjoy! :-)

+

+

+ +

3.2  Flat calendars

+

This sample can be found in “simple-2.html�. It will configure a +flat calendar that is always displayed in the page, in the DIV having the +id=“calendar-container�. When a date is clicked our function hander gets +called (dateChanged) and it will compute an URL to jump to based on +the selected date, then use window.location to visit the new link.

+

+

+
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+

+

+

+ +

3.3  Highlight special dates

+

So you want to display certain dates in a different color, or with bold +font, or whatever, right? Well, no problem -- our calendar can do this as +well. It doesn't matter if it's a flat or popup calendar -- we'll use a flat +one for this sample. The idea, however, is that you need to have the dates +in an array or a JavaScript object -- whatever is suitable for your way of +thinking -- and use it from a function that returns a value, telling the +calendar what kind of date is the passed one.

+

+Too much talking, here's the code ;-)

+

+

+
<!-- this goes into the <head> tag -->
+<style type="text/css">
+  .special { background-color: #000; color: #fff; }
+</style>
+
+<!-- and the rest inside the <body> -->
+<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  var SPECIAL_DAYS = {
+    0 : [ 13, 24 ],		// special days in January
+    2 : [ 1, 6, 8, 12, 18 ],	// special days in March
+    8 : [ 21, 11 ]		// special days in September
+  };
+
+  function dateIsSpecial(year, month, day) {
+    var m = SPECIAL_DAYS[month];
+    if (!m) return false;
+    for (var i in m) if (m[i] == day) return true;
+    return false;
+  };
+
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  function ourDateStatusFunc(date, y, m, d) {
+    if (dateIsSpecial(y, m, d))
+      return "special";
+    else
+      return false; // other dates are enabled
+      // return true if you want to disable other dates
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged,          // our callback function
+      dateStatusFunc : ourDateStatusFunc
+    }
+  );
+</script>
+

+

+So the above code creates a normal flat calendar, like in the previous +sample. We hook into it with the function “ourDateStatusFunc�, +which receives a date object as the first argument, and also the year, +month, date as the next 3 arguments (normally, you can extract year, month, +date from the first parameter too, but we pass them separately for +convenience, as it's very likely that they are going to be used in this +function).

+

+So, this function receives a date. It can return false if you want +no special action to be taken on that date, true if that date +should be disabled (unselectable), or a string if you want to assign a +special CSS class to that date. We return “special� for the dates that we +want to highlight -- and note that we defined a “special� look for them in +the CSS section.

+

+I used a simple approach here to define what dates are special. There's a +JavaScript object (the SPECIAL_DAYS global variable) which holds an array +of dates for each month. Month numbers start at zero (January). Months +that don't contain special dates can be absent from this object. Note that +the way to implement this is completely separated from the calendar +code -- therefore, feel free to use your imagination if you have better +ideas. :-)

+

+

+ +

3.4  Select multiple dates

+

Starting version 1.0, the calendar is able to handle multiple dates +selection. You just need to pass the “multiple� parameter to +Calendar.setup and add some special code that interprets the +selection once the calendar is closed.

+

+

+
<a id="trigger" href="#">[open calendar...]</a>
+<div id="output"></div>
+<script type="text/javascript">//<![CDATA[
+    // the default multiple dates selected,
+    // first time the calendar is displayed
+    var MA = [];
+
+    function closed(cal) {
+
+      // here we'll write the output; this is only for example.  You
+      // will normally fill an input field or something with the dates.
+      var el = document.getElementById("output");
+
+      // reset initial content.
+      el.innerHTML = "";
+
+      // Reset the "MA", in case one triggers the calendar again.
+      // CAREFUL!  You don't want to do "MA = [];".  We need to modify
+      // the value of the current array, instead of creating a new one.
+      // Calendar.setup is called only once! :-)  So be careful.
+      MA.length = 0;
+
+      // walk the calendar's multiple dates selection hash
+      for (var i in cal.multiple) {
+        var d = cal.multiple[i];
+        // sometimes the date is not actually selected,
+        // so let's check
+        if (d) {
+          // OK, selected.  Fill an input field or something.
+          el.innerHTML += d.print("%A, %Y %B %d") + "<br />";
+          // and push it in the "MA", in case one triggers the calendar again.
+          MA[MA.length] = d;
+        }
+      }
+      cal.hide();
+      return true;
+    };
+
+    Calendar.setup({
+      align      : "BR",
+      showOthers : true,
+      multiple   : MA, // pass the initial or computed array of multiple dates
+      onClose    : closed,
+      button     : "trigger"
+    });
+//]]></script>
+

+

+The above code creates a popup calendar and passes to it an array of dates, +which is initially empty, in the “multiple� argument. When the calendar is +closed it will call our “closed� function handler; in this handler +we determine what dates were actually selected, inspecting the +“cal.multiple� property, we display them in a DIV element right +next to the <a> element that opens the calendar, and we reinitialize the +global array of selected dates (which will be used if the end user opens the +calendar again). I guess the code speaks for itself, right? :-)

+

+

+ +

4  The Calendar object overview

+

+

+Basically you should be able to setup the calendar with the function presented +in the previous section. However, if for some reason Calendar.setup +doesn't provide all the functionality that you need and you want to tweak into +the process of creating and configuring the calendar ``by hand'', then this +section is the way to go.

+

+The file calendar.js implements the functionality of the calendar. +All (well, almost all) functions and variables are embedded in the JavaScript +object ``Calendar''.

+

+You can instantiate a Calendar object by calling the constructor, like +this: var cal = new Calendar(...). We will discuss the parameters +later. After creating the object, the variable cal will contain a +reference to it. You can use this reference to access further options of the +calendar, for instance:

+

+

+
cal.weekNumbers = false; // do not display week numbers
+cal.showsTime = true;    // include a time selector
+cal.setDateFormat("%Y.%m.%d %H:%M"); // set this format: 2003.12.31 23:59
+cal.setDisabledHandler(function(date, year, month, day) {
+  // verify date and return true if it has to be disabled
+  // ``date'' is a JS Date object, but if you only need the
+  // year, month and/or day you can get them separately as
+  // next 3 parameters, as you can see in the declaration
+  if (year == 2004) {
+    // disable all dates from 2004
+    return true;
+  }
+  return false;
+});
+

+

+etc. Prior to version +0.9.3 this was the only way to configure it. The Calendar.setup +function, documented in section 2, basically does the same +things (actually more) in order to setup the calendar, based on the parameters +that you provided.

+

+

+ +

4.1  Creating a calendar

+

The calendar is created by following some steps (even the function +Calendar.setup, described in section 2, does the +same). While you can skip optional (marked ``opt'') steps if you're happy with +the defaults, please respect the order below.

+

+

+

    +

    +
  1. Instantiate a Calendar object. Details about this in +section 5.1.

    +

    +

    +
  2. opt   Set the weekNumbers property to false if you don't want +the calendar to display week numbers.

    +

    +

    +
  3. opt   Set the showsTime property to true if you +want the calendar to also provide a time selector.

    +

    +

    +
  4. opt   Set the time24 property to false if you want +the time selector to be in 12-hour format. Default is 24-hour format. This +property only has effect if you also set showsTime to +true.

    +

    +

    +
  5. opt   Set the range of years available for selection (see section +5.3.15). The default range is [1970..2050].

    +

    +

    +
  6. opt   Set the getDateStatus property. You should pass +here a function that receives a JavaScript Date object and returns +true if the given date should be disabled, false otherwise (details in +section 5.3.7).

    +

    +

    +
  7. opt   Set a date format. Your handler function, passed to the +calendar constructor, will be called when a date is selected with a reference +to the calendar and a date string in this format.

    +

    +

    +
  8. Create the HTML elements related to the calendar. This step +practically puts the calendar in your HTML page. You simply call +Calendar.create(). You can give an optional parameter if you wanna +create a flat calendar (details in section 5.3.1).

    +

    +

    +
  9. opt   Initialize the calendar to a certain date, for instance from +the input field.

    +

    +

    +
  10. Show the calendar (details in section 5.3.9).

    +

    +

    +

+

+

+ +

4.2  Order does matter ;-)

+

As you could see in the previous section, there are more steps to be followed +in order to setup the calendar. This happens because there are two different +things that need to be accomplished: first there is the JavaScript object, that +is created with new Calendar(...). Secondly there are the HTML +elements that actually lets you see and manipulate the calendar.

+

+

+[ Those that did UI4 programming, no matter in what +language and on what platform, may be familiar with this concept. First there +is the object in memory that lets you manipulate the UI element, and secondly +there is the UI element (known as ``control'', ``window'', ``widget'', etc.), +also in memory but you don't usually access it directly. ] +

+By instantiating the calendar we create the JavaScript object. It lets us +configure some properties and it also knows how to create the UI element (the +HTML elements actually) that will eventually be what the end-user sees on +screen. Creation of the HTML element is accomplished by the function +Calendar.create. It knows how to create popup or flat calendars. +This function is described in section 5.3.1.

+

+Some properties need to be set prior to creating the HTML elements, because +otherwise they wouldn't have any effect. Such a property is +weekNumbers -- it has the default value ``true'', and if you don't +want the calendar to display the week numbers you have to set it to false. If, +however, you do that after calling Calendar.create the calendar +would still display the week numbers, because the HTML elements are already +created (including the <td>-s in the <table> element that +should contain the week numbers). For this reason the order of the steps above +is important.

+

+Another example is when you want to show the calendar. The ``create'' function +does create the HTML elements, but they are initially hidden (have the style +``display: none'') unless the calendar is a flat calendar that should be always +visible in the page. Obviously, the Calendar.show function should be +called after calling Calendar.create.

+

+

+ +

4.3  Caching the object

+

Suppose the end-user has popped up a calendar and selects a date. The calendar +then closes. What really happens now?

+

+There are two approaches. The first (used in very old versions of the +calendar) was to drop completely the Calendar object and when the end-user pops +up the calendar again to create another one. This approach is bad for more +reasons:

+

+

+

    +

    +
  • creating the JavaScript object and HTML elements is time-consuming

    +

    +

    +
  • we may loose some end-user preferences (i.e. he might prefer to have +Monday for the first day of week and probably already clicked it the first time +when the calendar was opened, but now he has to do it again)

    +

    +

    +

+

+The second approach, implemented by the Calendar.setup function, is to +cache the JavaScript object. It does this by checking the global variable +window.calendar and if it is not null it assumes it is the created +Calendar object. When the end-user closes the calendar, our code will only +call ``hide'' on it, therefore keeping the JavaScript object and the +HTML elements in place.

+

+CAVEAT:     Since time selection support was introduced, this +``object caching'' mechanism has the following drawback: if you once created +the calendar with the time selection support, then other items that may not +require this functionality will still get a calendar with the time selection +support enabled. And reciprocal. ;-) Hopefully this will be corrected in a +later version, but for now it doesn't seem such a big problem.

+

+

+ +

4.4  Callback functions

+

You might rightfully wonder how is the calendar related to the input field? +Who tells it that it has to update that input field when a date is +selected, or that it has to jump to that URL when a date is clicked in +flat mode?

+

+All this magic is done through callback functions. The calendar doesn't know +anything about the existence of an input field, nor does it know where to +redirect the browser when a date is clicked in flat mode. It just calls your +callback when a particular event is happening, and you're responsible to handle +it from there. For a general purpose library I think this is the best model of +making a truly reusable thing.

+

+The calendar supports the following user callbacks:

+

+

+

    +

    +
  • onSelect   -- this gets called when the end-user changes the date in the +calendar. Documented in section 5.1.

    +

    +

    +
  • onClose   -- this gets called when the calendar should close. It's +user's responsibility to close the calendar. Details in section +5.1.

    +

    +

    +
  • getDateStatus   -- this function gets called for any day in a month, +just before displaying the month. It is called with a JavaScript Date +object and should return true if that date should be disabled, false +if it's an ordinary date and no action should be taken, or it can return a +string in which case the returned value will be appended to the element's CSS +class (this way it provides a powerful way to make some dates ``special'', +i.e. highlight them differently). Details in section +5.3.8.

    +

    +

    +

+

+

+ +

5  The Calendar object API reference

+

+

+

+ +

5.1  Calendar constructor

+

+

+Synopsis:

+

+

+
var calendar = Calendar(firstDayOfWeek, date, onSelect, onClose);
+

+

+Parameters are as follows:

+

+

+

    +

    +
  • firstDayOfWeek   -- specifies which day is to be displayed as the first +day of week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, +..., 6 means Saturday.

    +

    +

    +
  • date   -- a JavaScript Date object or null. If null +is passed then the calendar will default to today date. Otherwise it will +initialize on the given date.

    +

    +

    +
  • onSelect   -- your callback for the ``onChange'' event. See above.

    +

    +

    +
  • onClose   -- your callback for the ``onClose'' event. See above.

    +

    +

    +

+

+

+ +

The onSelect event

+

+

+Here is a typical implementation of this function:

+

+

+
function onSelect(calendar, date) {
+  var input_field = document.getElementById("date");
+  input_field.value = date;
+};
+

+

+date is in the format selected with calendar.setDateFormat +(see section 5.3.5). This code simply updates the +input field. If you want the calendar to be in single-click mode then you +should also close the calendar after you updated the input field, so we come to +the following version:

+

+

+
function onSelect(calendar, date) {
+  var input_field = document.getElementById("date");
+  input_field.value = date;
+  if (calendar.dateClicked) {
+    calendar.callCloseHandler(); // this calls "onClose" (see above)
+  }
+};
+

+

+Note that we checked the member variable dateClicked and +only hide the calendar if it's true. If this variable is false it +means that no date was actually selected, but the user only changed the +month/year using the navigation buttons or the menus. We don't want to hide +the calendar in that case.

+

+

+ +

The onClose event

+

+

+This event is triggered when the calendar should close. It should hide or +destroy the calendar object -- the calendar itself just triggers the event, but +it won't close itself.

+

+A typical implementation of this function is the following:

+

+

+
function onClose(calendar) {
+  calendar.hide();
+  // or calendar.destroy();
+};
+

+

+

+ +

5.2  Useful member variables (properties)

+

+

+After creating the Calendar object you can access the following properties:

+

+

+

    +

    +
  • date -- is a JavaScript Date object. It will always +reflect the date shown in the calendar (yes, even if the calendar is hidden).

    +

    +

    +
  • isPopup -- if this is true then the current Calendar object is +a popup calendar. Otherwise (false) we have a flat calendar. This variable is +set from Calendar.create and has no meaning before this function was +called.

    +

    +

    +
  • dateClicked -- particularly useful in the onSelect +handler, this variable tells us if a date was really clicked. That's because +the onSelect handler is called even if the end-user only changed the +month/year but did not select a date. We don't want to close the calendar in +that case.

    +

    +

    +
  • weekNumbers -- if true (default) then the calendar +displays week numbers. If you don't want week numbers you have to set this +variable to false before calling Calendar.create.

    +

    +

    +
  • showsTime - if you set this to true (it is +false by default) then the calendar will also include a time selector.

    +

    +

    +
  • time24 - if you set this to false then the time +selector will be in 12-hour format. It is in 24-hour format by default.

    +

    +

    +
  • firstDayOfWeek -- specifies the first day of week (0 to 6, pass +0 for Sunday, 1 for Monday, ..., 6 for Saturday). This variable is set from +constructor, but you still have a chance to modify it before calling +Calendar.create.

    +

    +

    +

+

+There are lots of other member variables, but one should access them only +through member functions so I won't document them here.

+

+

+ +

5.3  Public methods

+

+ +

5.3.1  Calendar.create

+

+

+This function creates the afferent HTML elements that are needed to display the +calendar. You should call it after setting the calendar properties. Synopsis: +

+
calendar.create(); // creates a popup calendar
+  // -- or --
+calendar.create(document.getElementById(parent_id)); // makes a flat calendar
+

+

+It can create a popup calendar or a flat calendar. If the ``parent'' argument +is present (it should be a reference -- not ID -- to an HTML element) then +a flat calendar is created and it is inserted in the given element.

+

+At any moment, given a reference to a calendar object, we can inspect if it's a +popup or a flat calendar by checking the boolean member variable +isPopup:

+

+

+
if (calendar.isPopup) {
+   // this is a popup calendar
+} else {
+   // this is a flat calendar
+}
+

+

+

+ +

5.3.2  Calendar.callHandler

+

+

+This function calls the first user callback (the +onSelect handler) with the required parameters.

+

+

+ +

5.3.3  Calendar.callCloseHandler

+

+

+This function calls the second user callback (the +onClose handler). It's useful when you want to have a +``single-click'' calendar -- just call this in your onSelect handler, +if a date was clicked.

+

+

+ +

5.3.4  Calendar.hide

+

+

+Call this function to hide the calendar. The calendar object and HTML elements +will not be destroyed, thus you can later call one of the show +functions on the same element.

+

+

+ +

5.3.5  Calendar.setDateFormat

+

+

+This function configures the format in which the calendar reports the date to +your ``onSelect'' handler. Call it like this:

+

+

+
calendar.setDateFormat("%y/%m/%d");
+

+

+As you can see, it receives only one parameter, the required format. The magic +characters are the following:

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%C century number
%d the day of the month ( 00 .. 31 )
%e the day of the month ( 0 .. 31 )
%H hour ( 00 .. 23 )
%I hour ( 01 .. 12 )
%j day of the year ( 000 .. 366 )
%k hour ( 0 .. 23 )
%l hour ( 1 .. 12 )
%m month ( 01 .. 12 )
%M minute ( 00 .. 59 )
%n a newline character
%p ``PM'' or ``AM''
%P ``pm'' or ``am''
%S second ( 00 .. 59 )
%s number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC)
%t a tab character
%U, %W, %V the week number
%u the day of the week ( 1 .. 7, 1 = MON )
%w the day of the week ( 0 .. 6, 0 = SUN )
%y year without the century ( 00 .. 99 )
%Y year including the century ( ex. 1979 )
%% a literal % character +

+There are more algorithms for computing the week number. All +three specifiers currently implement the same one, as defined by ISO 8601: +``the week 01 is the week that has the Thursday in the current year, which is +equivalent to the week that contains the fourth day of January. Weeks start on +Monday.''

+

+

+ +

5.3.6  Calendar.setTtDateFormat

+

+

+Has the same prototype as Calendar.setDateFormat, but refers to the +format of the date displayed in the ``status bar'' when the mouse is over some +date.

+

+

+ +

5.3.7  Calendar.setDisabledHandler

+

+

+This function allows you to specify a callback function that checks if a +certain date must be disabled by the calendar. You are responsible to write +the callback function. Synopsis:

+

+

+
function disallowDate(date) {
+  // date is a JS Date object
+  if (  date.getFullYear() == 2003 &&
+        date.getMonth()    == 6 /* July, it's zero-based */ &&
+        date.getDate()     == 5  ) {
+    return true; // disable July 5 2003
+  }
+  return false; // enable other dates
+};
+
+calendar.setDisabledHandler(disallowDate);
+

+

+If you change this function in ``real-time'', meaning, without creating a new +calendar, then you have to call calendar.refresh() to make it +redisplay the month and take into account the new disabledHandler. +Calendar.setup does this, so you have no such trouble with it.

+

+Note that disallowDate should be very fast, as it is called for each +date in the month. Thus, it gets called, say, 30 times before displaying the +calendar, and 30 times when the month is changed. Tests I've done so far show +that it's still good, but in the future I might switch it to a different design +(for instance, to call it once per month and to return an array of dates that +must be disabled).

+

+This function should be considered deprecated in the favor of +Calendar.setDateStatusHandler, described below.

+

+

+ +

5.3.8  Calendar.setDateStatusHandler

+

+

+This function obsoletes Calendar.setDisabledHandler. You call it with +a function parameter, but this function can return a boolean +or a string. If the return value is a boolean (true or +false) then it behaves just like setDisabledHandler, +therefore disabling the date if the return value is true.

+

+If the returned value is a string then the given date will gain an additional +CSS class, namely the returned value. You can use this to highlight some dates +in some way. Note that you are responsible for defining the CSS class that you +return. If you return the string ``disabled'' then that date will be disabled, +just as if you returned true.

+

+Here is a simple scenario that shows what you can do with this function. The +following should be present in some of your styles, or in the document head in +a STYLE tag (but put it after the place where the calendar styles were +loaded):

+

+

+
.special { background-color: #000; color: #fff; }
+

+

+And you would use the following code before calling Calendar.create():

+

+

+
// this table holds your special days, so that we can automatize
+// things a bit:
+var SPECIAL_DAYS = {
+    0 : [ 13, 24 ],             // special days in January
+    2 : [ 1, 6, 8, 12, 18 ],    // special days in March
+    8 : [ 21, 11 ],             // special days in September
+   11 : [ 25, 28 ]              // special days in December
+};
+
+// this function returns true if the passed date is special
+function dateIsSpecial(year, month, day) {
+    var m = SPECIAL_DAYS[month];
+    if (!m) return false;
+    for (var i in m) if (m[i] == day) return true;
+    return false;
+}
+
+// this is the actual date status handler.  Note that it receives the
+// date object as well as separate values of year, month and date, for
+// your confort.
+function dateStatusHandler(date, y, m, d) {
+    if (dateIsSpecial(y, m, d)) return ``special'';
+    else return false;
+    // return true above if you want to disable other dates
+}
+
+// configure it to the calendar
+calendar.setDateStatusHandler(dateStatusHandler);
+

+

+The above code adds the ``special'' class name to some dates that are defined +in the SPECIAL_DAYS table. Other dates will simply be displayed as default, +enabled.

+

+

+ +

5.3.9  Calendar.show

+

+

+Call this function do show the calendar. It basically sets the CSS ``display'' +property to ``block''. It doesn't modify the calendar position.

+

+This function only makes sense when the calendar is in popup mode.

+

+

+ +

5.3.10  Calendar.showAt

+

+

+Call this to show the calendar at a certain (x, y) position. Prototype:

+

+

+
calendar.showAt(x, y);
+

+

+The parameters are absolute coordinates relative to the top left +corner of the page, thus they are page coordinates not screen +coordinates.

+

+After setting the given coordinates it calls Calendar.show. This function only +makes sense when the calendar is in popup mode.

+

+

+ +

5.3.11  Calendar.showAtElement

+

+

+This function is useful if you want to display the calendar near some element. +You call it like this:

+

+

+
calendar.showAtElement(element, align);
+

+

+where element is a reference to your element (for instance it can be the input +field that displays the date) and align is an optional parameter, of type string, +containing one or two characters. For instance, if you pass "Br" as +align, the calendar will appear below the element and with its right +margin continuing the element's right margin.

+

+As stated above, align may contain one or two characters. The first character +dictates the vertical alignment, relative to the element, and the second +character dictates the horizontal alignment. If the second character is +missing it will be assumed "l" (the left margin of the calendar will +be at the same horizontal position as the left margin of the element).

+

+The characters given for the align parameters are case sensitive. This +function only makes sense when the calendar is in popup mode. After computing +the position it uses Calendar.showAt to display the calendar there.

+

+

+ +

Vertical alignment

+

The first character in ``align'' can take one of the following values:

+

+

+

    +

    +
  • T -- completely above the reference element (bottom margin of +the calendar aligned to the top margin of the element).

    +

    +

    +
  • t -- above the element but may overlap it (bottom margin of the calendar aligned to +the bottom margin of the element).

    +

    +

    +
  • c -- the calendar displays vertically centered to the reference +element. It might overlap it (that depends on the horizontal alignment).

    +

    +

    +
  • b -- below the element but may overlap it (top margin of the calendar aligned to +the top margin of the element).

    +

    +

    +
  • B -- completely below the element (top margin of the calendar +aligned to the bottom margin of the element).

    +

    +

    +

+

+

+ +

Horizontal alignment

+

The second character in ``align'' can take one of the following values:

+

+

+

    +

    +
  • L -- completely to the left of the reference element (right +margin of the calendar aligned to the left margin of the element).

    +

    +

    +
  • l -- to the left of the element but may overlap it (left margin +of the calendar aligned to the left margin of the element).

    +

    +

    +
  • c -- horizontally centered to the element. Might overlap it, +depending on the vertical alignment.

    +

    +

    +
  • r -- to the right of the element but may overlap it (right +margin of the calendar aligned to the right margin of the element).

    +

    +

    +
  • R -- completely to the right of the element (left margin of the +calendar aligned to the right margin of the element).

    +

    +

    +

+

+

+ +

Default values

+

If the ``align'' parameter is missing the calendar will choose +``Br''.

+

+

+ +

5.3.12  Calendar.setDate

+

+

+Receives a JavaScript Date object. Sets the given date in the +calendar. If the calendar is visible the new date is displayed immediately.

+

+

+
calendar.setDate(new Date()); // go today
+

+

+

+ +

5.3.13  Calendar.setFirstDayOfWeek

+

+

+Changes the first day of week. The parameter has to be a numeric value ranging +from 0 to 6. Pass 0 for Sunday, 1 for Monday, ..., 6 for Saturday.

+

+

+
calendar.setFirstDayOfWeek(5); // start weeks on Friday
+

+

+

+ +

5.3.14  Calendar.parseDate

+

+

+Use this function to parse a date given as string and to move the calendar to +that date.

+

+The algorithm tries to parse the date according to the format that was +previously set with Calendar.setDateFormat; if that fails, it still +tries to get some valid date out of it (it doesn't read your thoughts, though).

+

+

+
calendar.parseDate("2003/07/06");
+

+

+

+ +

5.3.15  Calendar.setRange

+

+

+Sets the range of years that are allowed in the calendar. Synopsis:

+

+

+
calendar.setRange(1970, 2050);
+

+

+

+ +

6  Side effects

+

The calendar code was intentionally embedded in an object to make it have as +less as possible side effects. However, there are some -- not harmful, after +all. Here is a list of side effects; you can count they already happened after +calendar.js was loaded.

+

+

+

    +

    +
  1. The global variable window.calendar will be set to null. This +variable is used by the calendar code, especially when doing drag & drop for +moving the calendar. In the future I might get rid of it, but for now it +didn't harm anyone.

    +

    +

    +
  2. The JavaScript Date object is modified. We add some properties +and functions that are very useful to our calendar. It made more sense to add +them directly to the Date object than to the calendar itself. +Complete list:

    +

    +

    +

      +

      +
    1. Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); +

      +
    2. Date.SECOND = 1000 /* milliseconds */; +

      +
    3. Date.MINUTE = 60 * Date.SECOND; +

      +
    4. Date.HOUR = 60 * Date.MINUTE; +

      +
    5. Date.DAY = 24 * Date.HOUR; +

      +
    6. Date.WEEK = 7 * Date.DAY;

      +

      +

      +
    7. Date.prototype.getMonthDays(month) -- returns the number of days +of the given month, or of the current date object if no month was given.

      +

      +

      +
    8. Date.prototype.getWeekNumber() -- returns the week number of the +date in the current object.

      +

      +

      +
    9. Date.prototype.equalsTo(other_date) -- compare the current date +object with other_date and returns true if the dates are +equal. It ignores time.

      +

      +

      +
    10. Date.prototype.print(format) -- returns a string with the +current date object represented in the given format. It implements the format +specified in section 5.3.5.

      +

      +

      +

    +

    +

    +

+

+

+ +

7  Credits

+

The following people either sponsored, donated money to the project or bought +commercial licenses (listed in reverse chronological order). Your name could +be here too! If you wish to sponsor the project (for instance request a +feature and pay me for implementing it) or donate some money please +please contact me at mihai_bazon@yahoo.com.

+

+

+

+

+

+
+ +Thank you!
+ -- mihai_bazon@yahoo.com +
+

+

+

+

1 +by the term ``widget'' I understand a single element of user interface. +But that's in Linux world. For those that did lots of Windows +programming the term ``control'' might be more familiar +

+

2 people report that the calendar does +not work with IE5/Mac. However, this browser was discontinued and we +believe that supporting it doesn't worth the efforts, given the fact that +it has the worst, buggiest implementation for DOM I've ever seen.

+

3 under Opera 7 the calendar still lacks some functionality, such as +keyboard navigation; also Opera doesn't seem to allow disabling text +selection when one drags the mouse on the page; despite all that, the +calendar is still highly functional under Opera 7 and looks as good as +in other supported browsers.

+

4 user interface

+
+
+Last modified: Saturday, March 5th, 2005
+HTML conversion by TeX2page 2004-09-11
+
+ + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/reference.pdf b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/reference.pdf new file mode 100644 index 0000000..a09497f Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/doc/reference.pdf differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/index.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/index.html new file mode 100644 index 0000000..0cf4241 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/index.html @@ -0,0 +1,330 @@ + + + + + + + +The Coolest DHTML Calendar - Online Demo + + + + + + + + + + + + + + + + + + + + + + + + + + + +

jscalendar-1.0 +"It is happening again"

+ +

+

+Theme:
+Aqua +| +winter +| +blue +| +summer +| +green +
+win2k-1 +| +win2k-2 +| +win2k-cold-1 +| +win2k-cold-2 +
+system + +
+Release notes. +
+Set it up in minutes: + popup calendar, + flat calendar. +Other samples: + special days, + day info, + multiple dates selection +
+Documentation: + HTML, + PDF. +
+

+ +
+ +
+ + + + + + + + +
+ +
+
+Popup examples +
+ +
+ +Date #1: %Y-%m-%d [%W] %H:%M -- single +click
+ +Date #2: %a, %b %e, %Y [%I:%M %p] +-- double click + +

+ + +this select should hide when the calendar is above it. +

+ +Date #3: %d/%m/%Y +-- single click +
+ +Date #4: %A, %B %e, %Y -- +double click + +
+ +

This is release 1.0. Works on MSIE/Win 5.0 or better (really), +Opera 7+, Mozilla, Firefox, Netscape 6.x, 7.0 and all other Gecko-s, +Konqueror and Safari.

+ +

Keyboard navigation

+ +

Starting with version 0.9.2, you can also use the keyboard to select +dates (only for popup calendars; does not work with Opera +7 or Konqueror/Safari). The following keys are available:

+ +
    + +
  • ← , → , + ↑ , ↓ -- select date
  • +
  • CTRL + ← , + → -- select month
  • +
  • CTRL + ↑ , + ↓ -- select year
  • +
  • SPACE -- go to today date
  • +
  • ENTER -- accept the currently selected date
  • +
  • ESC -- cancel selection
  • + +
+ +
+ +
+ Flat calendar +
+ +

A non-popup version will appear below as soon + as the page is loaded. Note that it doesn't show the week number.

+ + +
+
 
+ +

+ The example above uses the setDisabledHandler() member function + to setup a handler that would only enable days withing a range of 10 days, + forward or backward, from the current date. +

+ + + +
+ +
+© dynarch.com 2002-2005
+Author: Mihai +Bazon
Distributed under the GNU LGPL.
+ +

If you use this script on a public page we +would love it if you would let us +know.

+ + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-af.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-af.js new file mode 100644 index 0000000..aeda581 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-af.js @@ -0,0 +1,39 @@ +// ** I18N Afrikaans +Calendar._DN = new Array +("Sondag", + "Maandag", + "Dinsdag", + "Woensdag", + "Donderdag", + "Vrydag", + "Saterdag", + "Sondag"); +Calendar._MN = new Array +("Januarie", + "Februarie", + "Maart", + "April", + "Mei", + "Junie", + "Julie", + "Augustus", + "September", + "Oktober", + "November", + "Desember"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Verander eerste dag van die week"; +Calendar._TT["PREV_YEAR"] = "Vorige jaar (hou vir keuselys)"; +Calendar._TT["PREV_MONTH"] = "Vorige maand (hou vir keuselys)"; +Calendar._TT["GO_TODAY"] = "Gaan na vandag"; +Calendar._TT["NEXT_MONTH"] = "Volgende maand (hou vir keuselys)"; +Calendar._TT["NEXT_YEAR"] = "Volgende jaar (hou vir keuselys)"; +Calendar._TT["SEL_DATE"] = "Kies datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te skuif"; +Calendar._TT["PART_TODAY"] = " (vandag)"; +Calendar._TT["MON_FIRST"] = "Vertoon Maandag eerste"; +Calendar._TT["SUN_FIRST"] = "Display Sunday first"; +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-al.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-al.js new file mode 100644 index 0000000..4f701cf --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-al.js @@ -0,0 +1,101 @@ +// Calendar ALBANIAN language +//author Rigels Gordani rige@hotmail.com + +// ditet +Calendar._DN = new Array +("E Diele", +"E Hene", +"E Marte", +"E Merkure", +"E Enjte", +"E Premte", +"E Shtune", +"E Diele"); + +//ditet shkurt +Calendar._SDN = new Array +("Die", +"Hen", +"Mar", +"Mer", +"Enj", +"Pre", +"Sht", +"Die"); + +// muajt +Calendar._MN = new Array +("Janar", +"Shkurt", +"Mars", +"Prill", +"Maj", +"Qeshor", +"Korrik", +"Gusht", +"Shtator", +"Tetor", +"Nentor", +"Dhjetor"); + +// muajte shkurt +Calendar._SMN = new Array +("Jan", +"Shk", +"Mar", +"Pri", +"Maj", +"Qes", +"Kor", +"Gus", +"Sht", +"Tet", +"Nen", +"Dhj"); + +// ndihmesa +Calendar._TT = {}; +Calendar._TT["INFO"] = "Per kalendarin"; + +Calendar._TT["ABOUT"] = +"Zgjedhes i ores/dates ne DHTML \n" + +"\n\n" +"Zgjedhja e Dates:\n" + +"- Perdor butonat \xab, \xbb per te zgjedhur vitin\n" + +"- Perdor butonat" + String.fromCharCode(0x2039) + ", " + +String.fromCharCode(0x203a) + +" per te zgjedhur muajin\n" + +"- Mbani shtypur butonin e mousit per nje zgjedje me te shpejte."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Zgjedhja e kohes:\n" + +"- Kliko tek ndonje nga pjeset e ores per ta rritur ate\n" + +"- ose kliko me Shift per ta zvogeluar ate\n" + +"- ose cliko dhe terhiq per zgjedhje me te shpejte."; + +Calendar._TT["PREV_YEAR"] = "Viti i shkuar (prit per menune)"; +Calendar._TT["PREV_MONTH"] = "Muaji i shkuar (prit per menune)"; +Calendar._TT["GO_TODAY"] = "Sot"; +Calendar._TT["NEXT_MONTH"] = "Muaji i ardhshem (prit per menune)"; +Calendar._TT["NEXT_YEAR"] = "Viti i ardhshem (prit per menune)"; +Calendar._TT["SEL_DATE"] = "Zgjidh daten"; +Calendar._TT["DRAG_TO_MOVE"] = "Terhiqe per te levizur"; +Calendar._TT["PART_TODAY"] = " (sot)"; + +// "%s" eshte dita e pare e javes +// %s do te zevendesohet me emrin e dite +Calendar._TT["DAY_FIRST"] = "Trego te %s te paren"; + + +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Mbyll"; +Calendar._TT["TODAY"] = "Sot"; +Calendar._TT["TIME_PART"] = "Kliko me (Shift-)ose terhiqe per te ndryshuar +vleren"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Java"; +Calendar._TT["TIME"] = "Koha:"; + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-bg.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-bg.js new file mode 100644 index 0000000..5eb73ec --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-bg.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar BG language +// Author: Mihai Bazon, +// Translator: Valentin Sheiretsky, +// Encoding: Windows-1251 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Íåäåëÿ", + "Ïîíåäåëíèê", + "Âòîðíèê", + "Ñðÿäà", + "×åòâúðòúê", + "Ïåòúê", + "Ñúáîòà", + "Íåäåëÿ"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Íåä", + "Ïîí", + "Âòî", + "Ñðÿ", + "×åò", + "Ïåò", + "Ñúá", + "Íåä"); + +// full month names +Calendar._MN = new Array +("ßíóàðè", + "Ôåâðóàðè", + "Ìàðò", + "Àïðèë", + "Ìàé", + "Þíè", + "Þëè", + "Àâãóñò", + "Ñåïòåìâðè", + "Îêòîìâðè", + "Íîåìâðè", + "Äåêåìâðè"); + +// short month names +Calendar._SMN = new Array +("ßíó", + "Ôåâ", + "Ìàð", + "Àïð", + "Ìàé", + "Þíè", + "Þëè", + "Àâã", + "Ñåï", + "Îêò", + "Íîå", + "Äåê"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Èíôîðìàöèÿ çà êàëåíäàðà"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Date selection:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + +"- Hold mouse button on any of the above buttons for faster selection."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- Click on any of the time parts to increase it\n" + +"- or Shift-click to decrease it\n" + +"- or click and drag for faster selection."; + +Calendar._TT["PREV_YEAR"] = "Ïðåäíà ãîäèíà (çàäðúæòå çà ìåíþ)"; +Calendar._TT["PREV_MONTH"] = "Ïðåäåí ìåñåö (çàäðúæòå çà ìåíþ)"; +Calendar._TT["GO_TODAY"] = "Èçáåðåòå äíåñ"; +Calendar._TT["NEXT_MONTH"] = "Ñëåäâàù ìåñåö (çàäðúæòå çà ìåíþ)"; +Calendar._TT["NEXT_YEAR"] = "Ñëåäâàùà ãîäèíà (çàäðúæòå çà ìåíþ)"; +Calendar._TT["SEL_DATE"] = "Èçáåðåòå äàòà"; +Calendar._TT["DRAG_TO_MOVE"] = "Ïðåìåñòâàíå"; +Calendar._TT["PART_TODAY"] = " (äíåñ)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "%s êàòî ïúðâè äåí"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Çàòâîðåòå"; +Calendar._TT["TODAY"] = "Äíåñ"; +Calendar._TT["TIME_PART"] = "(Shift-)Click èëè drag çà äà ïðîìåíèòå ñòîéíîñòòà"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A - %e %B %Y"; + +Calendar._TT["WK"] = "Ñåäì"; +Calendar._TT["TIME"] = "×àñ:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-big5-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-big5-utf8.js new file mode 100644 index 0000000..14e0d5d --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-big5-utf8.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar big5-utf8 language +// Author: Gary Fu, +// Encoding: utf8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六", + "星期日"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("æ—¥", + "一", + "二", + "三", + "å››", + "五", + "å…­", + "æ—¥"); + +// full month names +Calendar._MN = new Array +("一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "ä¹�月", + "å��月", + "å��一月", + "å��二月"); + +// short month names +Calendar._SMN = new Array +("一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "ä¹�月", + "å��月", + "å��一月", + "å��二月"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "關於"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"日期é�¸æ“‡æ–¹æ³•:\n" + +"- 使用 \xab, \xbb 按鈕å�¯é�¸æ“‡å¹´ä»½\n" + +"- 使用 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 按鈕å�¯é�¸æ“‡æœˆä»½\n" + +"- 按ä½�上é�¢çš„æŒ‰éˆ•å�¯ä»¥åŠ å¿«é�¸å�–"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"時間é�¸æ“‡æ–¹æ³•:\n" + +"- 點擊任何的時間部份å�¯å¢žåР其值\n" + +"- å�Œæ™‚按Shifté�µå†�點擊å�¯æ¸›å°‘其值\n" + +"- 點擊並拖曳å�¯åŠ å¿«æ”¹è®Šçš„å€¼"; + +Calendar._TT["PREV_YEAR"] = "上一年 (按ä½�é�¸å–®)"; +Calendar._TT["PREV_MONTH"] = "下一年 (按ä½�é�¸å–®)"; +Calendar._TT["GO_TODAY"] = "到今日"; +Calendar._TT["NEXT_MONTH"] = "上一月 (按ä½�é�¸å–®)"; +Calendar._TT["NEXT_YEAR"] = "下一月 (按ä½�é�¸å–®)"; +Calendar._TT["SEL_DATE"] = "é�¸æ“‡æ—¥æœŸ"; +Calendar._TT["DRAG_TO_MOVE"] = "拖曳"; +Calendar._TT["PART_TODAY"] = " (今日)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "å°‡ %s 顯示在å‰�"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "關閉"; +Calendar._TT["TODAY"] = "今日"; +Calendar._TT["TIME_PART"] = "點擊or拖曳å�¯æ”¹è®Šæ™‚é–“(å�Œæ™‚按Shift為減)"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "週"; +Calendar._TT["TIME"] = "Time:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-big5.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-big5.js new file mode 100644 index 0000000..a589358 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-big5.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar big5 language +// Author: Gary Fu, +// Encoding: big5 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("¬P´Á¤é", + "¬P´Á¤@", + "¬P´Á¤G", + "¬P´Á¤T", + "¬P´Á¥|", + "¬P´Á¤­", + "¬P´Á¤»", + "¬P´Á¤é"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("¤é", + "¤@", + "¤G", + "¤T", + "¥|", + "¤­", + "¤»", + "¤é"); + +// full month names +Calendar._MN = new Array +("¤@¤ë", + "¤G¤ë", + "¤T¤ë", + "¥|¤ë", + "¤­¤ë", + "¤»¤ë", + "¤C¤ë", + "¤K¤ë", + "¤E¤ë", + "¤Q¤ë", + "¤Q¤@¤ë", + "¤Q¤G¤ë"); + +// short month names +Calendar._SMN = new Array +("¤@¤ë", + "¤G¤ë", + "¤T¤ë", + "¥|¤ë", + "¤­¤ë", + "¤»¤ë", + "¤C¤ë", + "¤K¤ë", + "¤E¤ë", + "¤Q¤ë", + "¤Q¤@¤ë", + "¤Q¤G¤ë"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Ãö©ó"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"¤é´Á¿ï¾Ü¤èªk:\n" + +"- ¨Ï¥Î \xab, \xbb «ö¶s¥i¿ï¾Ü¦~¥÷\n" + +"- ¨Ï¥Î " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " «ö¶s¥i¿ï¾Ü¤ë¥÷\n" + +"- «ö¦í¤W­±ªº«ö¶s¥i¥H¥[§Ö¿ï¨ú"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"®É¶¡¿ï¾Ü¤èªk:\n" + +"- ÂIÀ»¥ô¦óªº®É¶¡³¡¥÷¥i¼W¥[¨ä­È\n" + +"- ¦P®É«öShiftÁä¦AÂIÀ»¥i´î¤Ö¨ä­È\n" + +"- ÂIÀ»¨Ã©ì¦²¥i¥[§Ö§ïÅܪº­È"; + +Calendar._TT["PREV_YEAR"] = "¤W¤@¦~ («ö¦í¿ï³æ)"; +Calendar._TT["PREV_MONTH"] = "¤U¤@¦~ («ö¦í¿ï³æ)"; +Calendar._TT["GO_TODAY"] = "¨ì¤µ¤é"; +Calendar._TT["NEXT_MONTH"] = "¤W¤@¤ë («ö¦í¿ï³æ)"; +Calendar._TT["NEXT_YEAR"] = "¤U¤@¤ë («ö¦í¿ï³æ)"; +Calendar._TT["SEL_DATE"] = "¿ï¾Ü¤é´Á"; +Calendar._TT["DRAG_TO_MOVE"] = "©ì¦²"; +Calendar._TT["PART_TODAY"] = " (¤µ¤é)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "±N %s Åã¥Ü¦b«e"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Ãö³¬"; +Calendar._TT["TODAY"] = "¤µ¤é"; +Calendar._TT["TIME_PART"] = "ÂIÀ»or©ì¦²¥i§ïÅܮɶ¡(¦P®É«öShift¬°´î)"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "¶g"; +Calendar._TT["TIME"] = "Time:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-br.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-br.js new file mode 100644 index 0000000..bfb0747 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-br.js @@ -0,0 +1,108 @@ +// ** I18N + +// Calendar pt-BR language +// Author: Fernando Dourado, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Domingo", + "Segunda", + "Terça", + "Quarta", + "Quinta", + "Sexta", + "Sabádo", + "Domingo"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +// [No changes using default values] + +// full month names +Calendar._MN = new Array +("Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro"); + +// short month names +// [No changes using default values] + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Sobre o calendário"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Translate to portuguese Brazil (pt-BR) by Fernando Dourado (fernando.dourado@ig.com.br)\n" + +"Tradução para o português Brasil (pt-BR) por Fernando Dourado (fernando.dourado@ig.com.br)" + +"\n\n" + +"Selecionar data:\n" + +"- Use as teclas \xab, \xbb para selecionar o ano\n" + +"- Use as teclas " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mês\n" + +"- Clique e segure com o mouse em qualquer botão para selecionar rapidamente."; + +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selecionar hora:\n" + +"- Clique em qualquer uma das partes da hora para aumentar\n" + +"- ou Shift-clique para diminuir\n" + +"- ou clique e arraste para selecionar rapidamente."; + +Calendar._TT["PREV_YEAR"] = "Ano anterior (clique e segure para menu)"; +Calendar._TT["PREV_MONTH"] = "Mês anterior (clique e segure para menu)"; +Calendar._TT["GO_TODAY"] = "Ir para a data atual"; +Calendar._TT["NEXT_MONTH"] = "Próximo mês (clique e segure para menu)"; +Calendar._TT["NEXT_YEAR"] = "Próximo ano (clique e segure para menu)"; +Calendar._TT["SEL_DATE"] = "Selecione uma data"; +Calendar._TT["DRAG_TO_MOVE"] = "Clique e segure para mover"; +Calendar._TT["PART_TODAY"] = " (hoje)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Exibir %s primeiro"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Fechar"; +Calendar._TT["TODAY"] = "Hoje"; +Calendar._TT["TIME_PART"] = "(Shift-)Clique ou arraste para mudar o valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%d de %B de %Y"; + +Calendar._TT["WK"] = "sem"; +Calendar._TT["TIME"] = "Hora:"; + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ca.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ca.js new file mode 100644 index 0000000..a2121bc --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ca.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar CA language +// Author: Mihai Bazon, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Diumenge", + "Dilluns", + "Dimarts", + "Dimecres", + "Dijous", + "Divendres", + "Dissabte", + "Diumenge"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Diu", + "Dil", + "Dmt", + "Dmc", + "Dij", + "Div", + "Dis", + "Diu"); + +// full month names +Calendar._MN = new Array +("Gener", + "Febrer", + "Març", + "Abril", + "Maig", + "Juny", + "Juliol", + "Agost", + "Setembre", + "Octubre", + "Novembre", + "Desembre"); + +// short month names +Calendar._SMN = new Array +("Gen", + "Feb", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Oct", + "Nov", + "Des"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Sobre el calendari"; + +Calendar._TT["ABOUT"] = +"DHTML Selector de Data/Hora\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Sel.lecció de Dates:\n" + +"- Fes servir els botons \xab, \xbb per sel.leccionar l'any\n" + +"- Fes servir els botons " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per se.lecciconar el mes\n" + +"- Manté el ratolí apretat en qualsevol dels anteriors per sel.lecció ràpida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- claca en qualsevol de les parts de la hora per augmentar-les\n" + +"- o Shift-click per decrementar-la\n" + +"- or click and arrastra per sel.lecció ràpida."; + +Calendar._TT["PREV_YEAR"] = "Any anterior (Mantenir per menu)"; +Calendar._TT["PREV_MONTH"] = "Mes anterior (Mantenir per menu)"; +Calendar._TT["GO_TODAY"] = "Anar a avui"; +Calendar._TT["NEXT_MONTH"] = "Mes següent (Mantenir per menu)"; +Calendar._TT["NEXT_YEAR"] = "Any següent (Mantenir per menu)"; +Calendar._TT["SEL_DATE"] = "Sel.leccionar data"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar per moure"; +Calendar._TT["PART_TODAY"] = " (avui)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Mostra %s primer"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Tanca"; +Calendar._TT["TODAY"] = "Avui"; +Calendar._TT["TIME_PART"] = "(Shift-)Click a arrastra per canviar el valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "st"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-cs-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-cs-utf8.js new file mode 100644 index 0000000..f6bbbeb --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-cs-utf8.js @@ -0,0 +1,65 @@ +/* + calendar-cs-win.js + language: Czech + encoding: windows-1250 + author: Lubos Jerabek (xnet@seznam.cz) + Jan Uhlir (espinosa@centrum.cz) +*/ + +// ** I18N +Calendar._DN = new Array('NedÄ›le','PondÄ›lí','Úterý','StÅ™eda','ÄŒtvrtek','Pátek','Sobota','NedÄ›le'); +Calendar._SDN = new Array('Ne','Po','Út','St','ÄŒt','Pá','So','Ne'); +Calendar._MN = new Array('Leden','Únor','BÅ™ezen','Duben','KvÄ›ten','ÄŒerven','ÄŒervenec','Srpen','Září','Říjen','Listopad','Prosinec'); +Calendar._SMN = new Array('Led','Úno','BÅ™e','Dub','KvÄ›','ÄŒrv','ÄŒvc','Srp','Zář','Říj','Lis','Pro'); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O komponentÄ› kalendář"; +Calendar._TT["TOGGLE"] = "ZmÄ›na prvního dne v týdnu"; +Calendar._TT["PREV_YEAR"] = "PÅ™edchozí rok (pÅ™idrž pro menu)"; +Calendar._TT["PREV_MONTH"] = "PÅ™edchozí mÄ›síc (pÅ™idrž pro menu)"; +Calendar._TT["GO_TODAY"] = "DneÅ¡ní datum"; +Calendar._TT["NEXT_MONTH"] = "Další mÄ›síc (pÅ™idrž pro menu)"; +Calendar._TT["NEXT_YEAR"] = "Další rok (pÅ™idrž pro menu)"; +Calendar._TT["SEL_DATE"] = "Vyber datum"; +Calendar._TT["DRAG_TO_MOVE"] = "ChyÅ¥ a táhni, pro pÅ™esun"; +Calendar._TT["PART_TODAY"] = " (dnes)"; +Calendar._TT["MON_FIRST"] = "Ukaž jako první PondÄ›lí"; +//Calendar._TT["SUN_FIRST"] = "Ukaž jako první NedÄ›li"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"VýbÄ›r datumu:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Použijte tlaÄ�ítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výbÄ›ru mÄ›síce\n" + +"- Podržte tlaÄ�ítko myÅ¡i na jakémkoliv z tÄ›ch tlaÄ�ítek pro rychlejší výbÄ›r."; + +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"VýbÄ›r Ä�asu:\n" + +"- KliknÄ›te na jakoukoliv z Ä�ástí výbÄ›ru Ä�asu pro zvýšení.\n" + +"- nebo Shift-click pro snížení\n" + +"- nebo kliknÄ›te a táhnÄ›te pro rychlejší výbÄ›r."; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Zobraz %s první"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Zavřít"; +Calendar._TT["TODAY"] = "Dnes"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro zmÄ›nu hodnoty"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "ÄŒas:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-cs-win.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-cs-win.js new file mode 100644 index 0000000..140dff3 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-cs-win.js @@ -0,0 +1,65 @@ +/* + calendar-cs-win.js + language: Czech + encoding: windows-1250 + author: Lubos Jerabek (xnet@seznam.cz) + Jan Uhlir (espinosa@centrum.cz) +*/ + +// ** I18N +Calendar._DN = new Array('Nedìle','Pondìlí','Úterý','Støeda','Ètvrtek','Pátek','Sobota','Nedìle'); +Calendar._SDN = new Array('Ne','Po','Út','St','Èt','Pá','So','Ne'); +Calendar._MN = new Array('Leden','Únor','Bøezen','Duben','Kvìten','Èerven','Èervenec','Srpen','Záøí','Øíjen','Listopad','Prosinec'); +Calendar._SMN = new Array('Led','Úno','Bøe','Dub','Kvì','Èrv','Èvc','Srp','Záø','Øíj','Lis','Pro'); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O komponentì kalendáø"; +Calendar._TT["TOGGLE"] = "Zmìna prvního dne v týdnu"; +Calendar._TT["PREV_YEAR"] = "Pøedchozí rok (pøidrž pro menu)"; +Calendar._TT["PREV_MONTH"] = "Pøedchozí mìsíc (pøidrž pro menu)"; +Calendar._TT["GO_TODAY"] = "Dnešní datum"; +Calendar._TT["NEXT_MONTH"] = "Další mìsíc (pøidrž pro menu)"; +Calendar._TT["NEXT_YEAR"] = "Další rok (pøidrž pro menu)"; +Calendar._TT["SEL_DATE"] = "Vyber datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Chy� a táhni, pro pøesun"; +Calendar._TT["PART_TODAY"] = " (dnes)"; +Calendar._TT["MON_FIRST"] = "Ukaž jako první Pondìlí"; +//Calendar._TT["SUN_FIRST"] = "Ukaž jako první Nedìli"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Výbìr datumu:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Použijte tlaèítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výbìru mìsíce\n" + +"- Podržte tlaèítko myši na jakémkoliv z tìch tlaèítek pro rychlejší výbìr."; + +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Výbìr èasu:\n" + +"- Kliknìte na jakoukoliv z èástí výbìru èasu pro zvýšení.\n" + +"- nebo Shift-click pro snížení\n" + +"- nebo kliknìte a táhnìte pro rychlejší výbìr."; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Zobraz %s první"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Zavøít"; +Calendar._TT["TODAY"] = "Dnes"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro zmìnu hodnoty"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Èas:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-da.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-da.js new file mode 100644 index 0000000..a99b598 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-da.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar DA language +// Author: Michael Thingmand Henriksen, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Søndag", +"Mandag", +"Tirsdag", +"Onsdag", +"Torsdag", +"Fredag", +"Lørdag", +"Søndag"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Søn", +"Man", +"Tir", +"Ons", +"Tor", +"Fre", +"Lør", +"Søn"); + +// full month names +Calendar._MN = new Array +("Januar", +"Februar", +"Marts", +"April", +"Maj", +"Juni", +"Juli", +"August", +"September", +"Oktober", +"November", +"December"); + +// short month names +Calendar._SMN = new Array +("Jan", +"Feb", +"Mar", +"Apr", +"Maj", +"Jun", +"Jul", +"Aug", +"Sep", +"Okt", +"Nov", +"Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Om Kalenderen"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For den seneste version besøg: http://www.dynarch.com/projects/calendar/\n"; + +"Distribueret under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detajler." + +"\n\n" + +"Valg af dato:\n" + +"- Brug \xab, \xbb knapperne for at vælge Ã¥r\n" + +"- Brug " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knapperne for at vælge mÃ¥ned\n" + +"- Hold knappen pÃ¥ musen nede pÃ¥ knapperne ovenfor for hurtigere valg."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Valg af tid:\n" + +"- Klik pÃ¥ en vilkÃ¥rlig del for større værdi\n" + +"- eller Shift-klik for for mindre værdi\n" + +"- eller klik og træk for hurtigere valg."; + +Calendar._TT["PREV_YEAR"] = "Ét Ã¥r tilbage (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Én mÃ¥ned tilbage (hold for menu)"; +Calendar._TT["GO_TODAY"] = "GÃ¥ til i dag"; +Calendar._TT["NEXT_MONTH"] = "Én mÃ¥ned frem (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Ét Ã¥r frem (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Vælg dag"; +Calendar._TT["DRAG_TO_MOVE"] = "Træk vinduet"; +Calendar._TT["PART_TODAY"] = " (i dag)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Vis %s først"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Luk"; +Calendar._TT["TODAY"] = "I dag"; +Calendar._TT["TIME_PART"] = "(Shift-)klik eller træk for at ændre værdi"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Uge"; +Calendar._TT["TIME"] = "Tid:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-de.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-de.js new file mode 100644 index 0000000..4bc1137 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-de.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar DE language +// Author: Jack (tR), +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag", + "Sonntag"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("So", + "Mo", + "Di", + "Mi", + "Do", + "Fr", + "Sa", + "So"); + +// full month names +Calendar._MN = new Array +("Januar", + "Februar", + "M\u00e4rz", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "M\u00e4r", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Datum ausw\u00e4hlen:\n" + +"- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" + +"- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" + +"- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Zeit ausw\u00e4hlen:\n" + +"- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" + +"- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" + +"- oder klicken und festhalten f\u00fcr Schnellauswahl."; + +Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen"; +Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)"; +Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)"; +Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen"; +Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)"; +Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)"; +Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen"; +Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten"; +Calendar._TT["PART_TODAY"] = " (Heute)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s "; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Schlie\u00dfen"; +Calendar._TT["TODAY"] = "Heute"; +Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Zeit:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-du.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-du.js new file mode 100644 index 0000000..2200448 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-du.js @@ -0,0 +1,45 @@ +// ** I18N +Calendar._DN = new Array +("Zondag", + "Maandag", + "Dinsdag", + "Woensdag", + "Donderdag", + "Vrijdag", + "Zaterdag", + "Zondag"); +Calendar._MN = new Array +("Januari", + "Februari", + "Maart", + "April", + "Mei", + "Juni", + "Juli", + "Augustus", + "September", + "Oktober", + "November", + "December"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Toggle startdag van de week"; +Calendar._TT["PREV_YEAR"] = "Vorig jaar (indrukken voor menu)"; +Calendar._TT["PREV_MONTH"] = "Vorige month (indrukken voor menu)"; +Calendar._TT["GO_TODAY"] = "Naar Vandaag"; +Calendar._TT["NEXT_MONTH"] = "Volgende Maand (indrukken voor menu)"; +Calendar._TT["NEXT_YEAR"] = "Volgend jaar (indrukken voor menu)"; +Calendar._TT["SEL_DATE"] = "Selecteer datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te verplaatsen"; +Calendar._TT["PART_TODAY"] = " (vandaag)"; +Calendar._TT["MON_FIRST"] = "Toon Maandag eerst"; +Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst"; +Calendar._TT["CLOSE"] = "Sluiten"; +Calendar._TT["TODAY"] = "Vandaag"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; +Calendar._TT["TT_DATE_FORMAT"] = "D, M d"; + +Calendar._TT["WK"] = "wk"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-el.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-el.js new file mode 100644 index 0000000..43a9b2c --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-el.js @@ -0,0 +1,89 @@ +// ** I18N +Calendar._DN = new Array +("ΚυÏ�ιακή", + "ΔευτέÏ�α", + "ΤÏ�ίτη", + "ΤετάÏ�τη", + "Πέμπτη", + "ΠαÏ�ασκευή", + "Σάββατο", + "ΚυÏ�ιακή"); + +Calendar._SDN = new Array +("Κυ", + "Δε", + "TÏ�", + "Τε", + "Πε", + "Πα", + "Σα", + "Κυ"); + +Calendar._MN = new Array +("ΙανουάÏ�ιος", + "ΦεβÏ�ουάÏ�ιος", + "ΜάÏ�τιος", + "ΑπÏ�ίλιος", + "Μάϊος", + "ΙοÏ�νιος", + "ΙοÏ�λιος", + "ΑÏ�γουστος", + "ΣεπτέμβÏ�ιος", + "ΟκτώβÏ�ιος", + "Î�οέμβÏ�ιος", + "ΔεκέμβÏ�ιος"); + +Calendar._SMN = new Array +("Ιαν", + "Φεβ", + "ΜαÏ�", + "ΑπÏ�", + "Μαι", + "Ιουν", + "Ιουλ", + "Αυγ", + "Σεπ", + "Οκτ", + "Î�οε", + "Δεκ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Για το ημεÏ�ολόγιο"; + +Calendar._TT["ABOUT"] = +"Επιλογέας ημεÏ�ομηνίας/ÏŽÏ�ας σε DHTML\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Για τελευταία έκδοση: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Επιλογή ημεÏ�ομηνίας:\n" + +"- ΧÏ�ησιμοποιείστε τα κουμπιά \xab, \xbb για επιλογή έτους\n" + +"- ΧÏ�ησιμοποιείστε τα κουμπιά " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " για επιλογή μήνα\n" + +"- ΚÏ�ατήστε κουμπί ποντικοÏ� πατημένο στα παÏ�απάνω κουμπιά για πιο γÏ�ήγοÏ�η επιλογή."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Επιλογή ÏŽÏ�ας:\n" + +"- Κάντε κλικ σε ένα από τα μέÏ�η της ÏŽÏ�ας για αÏ�ξηση\n" + +"- ή Shift-κλικ για μείωση\n" + +"- ή κλικ και μετακίνηση για πιο γÏ�ήγοÏ�η επιλογή."; +Calendar._TT["TOGGLE"] = "ΜπάÏ�α Ï€Ï�ώτης ημέÏ�ας της εβδομάδας"; +Calendar._TT["PREV_YEAR"] = "ΠÏ�οηγ. έτος (κÏ�ατήστε για το μενοÏ�)"; +Calendar._TT["PREV_MONTH"] = "ΠÏ�οηγ. μήνας (κÏ�ατήστε για το μενοÏ�)"; +Calendar._TT["GO_TODAY"] = "ΣήμεÏ�α"; +Calendar._TT["NEXT_MONTH"] = "Επόμενος μήνας (κÏ�ατήστε για το μενοÏ�)"; +Calendar._TT["NEXT_YEAR"] = "Επόμενο έτος (κÏ�ατήστε για το μενοÏ�)"; +Calendar._TT["SEL_DATE"] = "Επιλέξτε ημεÏ�ομηνία"; +Calendar._TT["DRAG_TO_MOVE"] = "ΣÏ�Ï�τε για να μετακινήσετε"; +Calendar._TT["PART_TODAY"] = " (σήμεÏ�α)"; +Calendar._TT["MON_FIRST"] = "Εμφάνιση ΔευτέÏ�ας Ï€Ï�ώτα"; +Calendar._TT["SUN_FIRST"] = "Εμφάνιση ΚυÏ�ιακής Ï€Ï�ώτα"; +Calendar._TT["CLOSE"] = "Κλείσιμο"; +Calendar._TT["TODAY"] = "ΣήμεÏ�α"; +Calendar._TT["TIME_PART"] = "(Shift-)κλικ ή μετακίνηση για αλλαγή"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; +Calendar._TT["TT_DATE_FORMAT"] = "D, d M"; + +Calendar._TT["WK"] = "εβδ"; + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-en.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-en.js new file mode 100644 index 0000000..0dbde79 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-en.js @@ -0,0 +1,127 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + "Sun"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 0; + +// full month names +Calendar._MN = new Array +("January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "About the calendar"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Date selection:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + +"- Hold mouse button on any of the above buttons for faster selection."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- Click on any of the time parts to increase it\n" + +"- or Shift-click to decrease it\n" + +"- or click and drag for faster selection."; + +Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; +Calendar._TT["GO_TODAY"] = "Go Today"; +Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Select date"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; +Calendar._TT["PART_TODAY"] = " (today)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Display %s first"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; +Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Time:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-es.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-es.js new file mode 100644 index 0000000..19c1b30 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-es.js @@ -0,0 +1,129 @@ +// ** I18N + +// Calendar ES (spanish) language +// Author: Mihai Bazon, +// Updater: Servilio Afre Puentes +// Updated: 2004-06-03 +// Encoding: utf-8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Domingo", + "Lunes", + "Martes", + "Miércoles", + "Jueves", + "Viernes", + "Sábado", + "Domingo"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Dom", + "Lun", + "Mar", + "Mié", + "Jue", + "Vie", + "Sáb", + "Dom"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 1; + +// full month names +Calendar._MN = new Array +("Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre"); + +// short month names +Calendar._SMN = new Array +("Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Acerca del calendario"; + +Calendar._TT["ABOUT"] = +"Selector DHTML de Fecha/Hora\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Para conseguir la última versión visite: http://www.dynarch.com/projects/calendar/\n" + +"Distribuido bajo licencia GNU LGPL. Visite http://gnu.org/licenses/lgpl.html para más detalles." + +"\n\n" + +"Selección de fecha:\n" + +"- Use los botones \xab, \xbb para seleccionar el año\n" + +"- Use los botones " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" + +"- Mantenga pulsado el ratón en cualquiera de estos botones para una selección rápida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selección de hora:\n" + +"- Pulse en cualquiera de las partes de la hora para incrementarla\n" + +"- o pulse las mayúsculas mientras hace clic para decrementarla\n" + +"- o haga clic y arrastre el ratón para una selección más rápida."; + +Calendar._TT["PREV_YEAR"] = "Año anterior (mantener para menú)"; +Calendar._TT["PREV_MONTH"] = "Mes anterior (mantener para menú)"; +Calendar._TT["GO_TODAY"] = "Ir a hoy"; +Calendar._TT["NEXT_MONTH"] = "Mes siguiente (mantener para menú)"; +Calendar._TT["NEXT_YEAR"] = "Año siguiente (mantener para menú)"; +Calendar._TT["SEL_DATE"] = "Seleccionar fecha"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar para mover"; +Calendar._TT["PART_TODAY"] = " (hoy)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Hacer %s primer día de la semana"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Cerrar"; +Calendar._TT["TODAY"] = "Hoy"; +Calendar._TT["TIME_PART"] = "(Mayúscula-)Clic o arrastre para cambiar valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y"; + +Calendar._TT["WK"] = "sem"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-fi.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-fi.js new file mode 100644 index 0000000..328eabb --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-fi.js @@ -0,0 +1,98 @@ +// ** I18N + +// Calendar FI language (Finnish, Suomi) +// Author: Jarno Käyhkö, +// Encoding: UTF-8 +// Distributed under the same terms as the calendar itself. + +// full day names +Calendar._DN = new Array +("Sunnuntai", + "Maanantai", + "Tiistai", + "Keskiviikko", + "Torstai", + "Perjantai", + "Lauantai", + "Sunnuntai"); + +// short day names +Calendar._SDN = new Array +("Su", + "Ma", + "Ti", + "Ke", + "To", + "Pe", + "La", + "Su"); + +// full month names +Calendar._MN = new Array +("Tammikuu", + "Helmikuu", + "Maaliskuu", + "Huhtikuu", + "Toukokuu", + "Kesäkuu", + "Heinäkuu", + "Elokuu", + "Syyskuu", + "Lokakuu", + "Marraskuu", + "Joulukuu"); + +// short month names +Calendar._SMN = new Array +("Tam", + "Hel", + "Maa", + "Huh", + "Tou", + "Kes", + "Hei", + "Elo", + "Syy", + "Lok", + "Mar", + "Jou"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Tietoja kalenterista"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Uusin versio osoitteessa: http://www.dynarch.com/projects/calendar/\n" + +"Julkaistu GNU LGPL lisenssin alaisuudessa. Lisätietoja osoitteessa http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"Päivämäärä valinta:\n" + +"- Käytä \xab, \xbb painikkeita valitaksesi vuosi\n" + +"- Käytä " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " painikkeita valitaksesi kuukausi\n" + +"- Pitämällä hiiren painiketta minkä tahansa yllä olevan painikkeen kohdalla, saat näkyviin valikon nopeampaan siirtymiseen."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Ajan valinta:\n" + +"- Klikkaa kellonajan numeroita lisätäksesi aikaa\n" + +"- tai pitämällä Shift-näppäintä pohjassa saat aikaa taaksepäin\n" + +"- tai klikkaa ja pidä hiiren painike pohjassa sekä liikuta hiirtä muuttaaksesi aikaa nopeasti eteen- ja taaksepäin."; + +Calendar._TT["PREV_YEAR"] = "Edell. vuosi (paina hetki, näet valikon)"; +Calendar._TT["PREV_MONTH"] = "Edell. kuukausi (paina hetki, näet valikon)"; +Calendar._TT["GO_TODAY"] = "Siirry tähän päivään"; +Calendar._TT["NEXT_MONTH"] = "Seur. kuukausi (paina hetki, näet valikon)"; +Calendar._TT["NEXT_YEAR"] = "Seur. vuosi (paina hetki, näet valikon)"; +Calendar._TT["SEL_DATE"] = "Valitse päivämäärä"; +Calendar._TT["DRAG_TO_MOVE"] = "Siirrä kalenterin paikkaa"; +Calendar._TT["PART_TODAY"] = " (tänään)"; +Calendar._TT["MON_FIRST"] = "Näytä maanantai ensimmäisenä"; +Calendar._TT["SUN_FIRST"] = "Näytä sunnuntai ensimmäisenä"; +Calendar._TT["CLOSE"] = "Sulje"; +Calendar._TT["TODAY"] = "Tänään"; +Calendar._TT["TIME_PART"] = "(Shift-) Klikkaa tai liikuta muuttaaksesi aikaa"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%d.%m.%Y"; + +Calendar._TT["WK"] = "Vko"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-fr.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-fr.js new file mode 100644 index 0000000..2a9e0b2 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-fr.js @@ -0,0 +1,125 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// Translator: David Duret, from previous french version + +// full day names +Calendar._DN = new Array +("Dimanche", + "Lundi", + "Mardi", + "Mercredi", + "Jeudi", + "Vendredi", + "Samedi", + "Dimanche"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Dim", + "Lun", + "Mar", + "Mar", + "Jeu", + "Ven", + "Sam", + "Dim"); + +// full month names +Calendar._MN = new Array +("Janvier", + "Février", + "Mars", + "Avril", + "Mai", + "Juin", + "Juillet", + "Août", + "Septembre", + "Octobre", + "Novembre", + "Décembre"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Fev", + "Mar", + "Avr", + "Mai", + "Juin", + "Juil", + "Aout", + "Sep", + "Oct", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "A propos du calendrier"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Heure Selecteur\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Pour la derniere version visitez : http://www.dynarch.com/projects/calendar/\n" + +"Distribué par GNU LGPL. Voir http://gnu.org/licenses/lgpl.html pour les details." + +"\n\n" + +"Selection de la date :\n" + +"- Utiliser les bouttons \xab, \xbb pour selectionner l\'annee\n" + +"- Utiliser les bouttons " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pour selectionner les mois\n" + +"- Garder la souris sur n'importe quels boutons pour une selection plus rapide"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selection de l\'heure :\n" + +"- Cliquer sur heures ou minutes pour incrementer\n" + +"- ou Maj-clic pour decrementer\n" + +"- ou clic et glisser-deplacer pour une selection plus rapide"; + +Calendar._TT["PREV_YEAR"] = "Année préc. (maintenir pour menu)"; +Calendar._TT["PREV_MONTH"] = "Mois préc. (maintenir pour menu)"; +Calendar._TT["GO_TODAY"] = "Atteindre la date du jour"; +Calendar._TT["NEXT_MONTH"] = "Mois suiv. (maintenir pour menu)"; +Calendar._TT["NEXT_YEAR"] = "Année suiv. (maintenir pour menu)"; +Calendar._TT["SEL_DATE"] = "Sélectionner une date"; +Calendar._TT["DRAG_TO_MOVE"] = "Déplacer"; +Calendar._TT["PART_TODAY"] = " (Aujourd'hui)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Afficher %s en premier"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Fermer"; +Calendar._TT["TODAY"] = "Aujourd'hui"; +Calendar._TT["TIME_PART"] = "(Maj-)Clic ou glisser pour modifier la valeur"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Sem."; +Calendar._TT["TIME"] = "Heure :"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-he-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-he-utf8.js new file mode 100644 index 0000000..7861217 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-he-utf8.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar EN language +// Author: Idan Sofer, +// Encoding: UTF-8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("ר×�שון", + "שני", + "שלישי", + "רביעי", + "חמישי", + "שישי", + "שבת", + "ר×�שון"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("×�", + "ב", + "×’", + "ד", + "×”", + "ו", + "ש", + "×�"); + +// full month names +Calendar._MN = new Array +("ינו×�ר", + "פברו×�ר", + "מרץ", + "×�פריל", + "מ×�×™", + "יוני", + "יולי", + "×�וגוסט", + "ספטמבר", + "×�וקטובר", + "נובמבר", + "דצמבר"); + +// short month names +Calendar._SMN = new Array +("×™× ×�", + "פבר", + "מרץ", + "×�פר", + "מ×�×™", + "יונ", + "יול", + "×�וג", + "ספט", + "×�וק", + "נוב", + "דצמ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "×�ודות השנתון"; + +Calendar._TT["ABOUT"] = +"בחרן ת×�ריך/שעה DHTML\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"הגירס×� ×”×�חרונה זמינה ב: http://www.dynarch.com/projects/calendar/\n" + +"מופץ תחת זיכיון ×” GNU LGPL. עיין ב http://gnu.org/licenses/lgpl.html לפרטי×� נוספי×�." + +"\n\n" + +בחירת ת×�ריך:\n" + +"- השתמש בכפתורי×� \xab, \xbb לבחירת שנה\n" + +"- השתמש בכפתורי×� " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " לבחירת חודש\n" + +"- ×”×—×–×§ העכבר לחוץ מעל הכפתורי×� המוזכרי×� לעיל לבחירה מהירה יותר."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"בחירת זמן:\n" + +"- לחץ על כל ×�חד מחלקי הזמן כדי להוסיף\n" + +"- ×�ו shift בשילוב ×¢×� לחיצה כדי להחסיר\n" + +"- ×�ו לחץ וגרור לפעולה מהירה יותר."; + +Calendar._TT["PREV_YEAR"] = "שנה קודמת - ×”×—×–×§ לקבלת תפריט"; +Calendar._TT["PREV_MONTH"] = "חודש קוד×� - ×”×—×–×§ לקבלת תפריט"; +Calendar._TT["GO_TODAY"] = "עבור להיו×�"; +Calendar._TT["NEXT_MONTH"] = "חודש הב×� - ×”×—×–×§ לתפריט"; +Calendar._TT["NEXT_YEAR"] = "שנה הב×�×” - ×”×—×–×§ לתפריט"; +Calendar._TT["SEL_DATE"] = "בחר ת×�ריך"; +Calendar._TT["DRAG_TO_MOVE"] = "גרור להזזה"; +Calendar._TT["PART_TODAY"] = " )היו×�("; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "הצג %s קוד×�"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "6"; + +Calendar._TT["CLOSE"] = "סגור"; +Calendar._TT["TODAY"] = "היו×�"; +Calendar._TT["TIME_PART"] = "(שיפט-)לחץ וגרור כדי לשנות ערך"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "שעה::"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hr-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hr-utf8.js new file mode 100644 index 0000000..d569cfd --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hr-utf8.js @@ -0,0 +1,49 @@ +/* Croatian language file for the DHTML Calendar version 0.9.2 +* Author Krunoslav Zubrinic , June 2003. +* Feel free to use this script under the terms of the GNU Lesser General +* Public License, as long as you do not remove or alter this notice. +*/ +Calendar._DN = new Array +("Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "ÄŒetvrtak", + "Petak", + "Subota", + "Nedjelja"); +Calendar._MN = new Array +("SijeÄ�anj", + "VeljaÄ�a", + "Ožujak", + "Travanj", + "Svibanj", + "Lipanj", + "Srpanj", + "Kolovoz", + "Rujan", + "Listopad", + "Studeni", + "Prosinac"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Promjeni dan s kojim poÄ�inje tjedan"; +Calendar._TT["PREV_YEAR"] = "Prethodna godina (dugi pritisak za meni)"; +Calendar._TT["PREV_MONTH"] = "Prethodni mjesec (dugi pritisak za meni)"; +Calendar._TT["GO_TODAY"] = "Idi na tekući dan"; +Calendar._TT["NEXT_MONTH"] = "Slijedeći mjesec (dugi pritisak za meni)"; +Calendar._TT["NEXT_YEAR"] = "Slijedeća godina (dugi pritisak za meni)"; +Calendar._TT["SEL_DATE"] = "Izaberite datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Pritisni i povuci za promjenu pozicije"; +Calendar._TT["PART_TODAY"] = " (today)"; +Calendar._TT["MON_FIRST"] = "Prikaži ponedjeljak kao prvi dan"; +Calendar._TT["SUN_FIRST"] = "Prikaži nedjelju kao prvi dan"; +Calendar._TT["CLOSE"] = "Zatvori"; +Calendar._TT["TODAY"] = "Danas"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; +Calendar._TT["TT_DATE_FORMAT"] = "DD, dd.mm.y"; + +Calendar._TT["WK"] = "Tje"; \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hr.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hr.js new file mode 100644 index 0000000..6c27f60 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hr.js differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hu.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hu.js new file mode 100644 index 0000000..f5bf057 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-hu.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar HU language +// Author: ??? +// Modifier: KARASZI Istvan, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Vasárnap", + "Hétfõ", + "Kedd", + "Szerda", + "Csütörtök", + "Péntek", + "Szombat", + "Vasárnap"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("v", + "h", + "k", + "sze", + "cs", + "p", + "szo", + "v"); + +// full month names +Calendar._MN = new Array +("január", + "február", + "március", + "április", + "május", + "június", + "július", + "augusztus", + "szeptember", + "október", + "november", + "december"); + +// short month names +Calendar._SMN = new Array +("jan", + "feb", + "már", + "ápr", + "máj", + "jún", + "júl", + "aug", + "sze", + "okt", + "nov", + "dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "A kalendáriumról"; + +Calendar._TT["ABOUT"] = +"DHTML dátum/idõ kiválasztó\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"a legfrissebb verzió megtalálható: http://www.dynarch.com/projects/calendar/\n" + +"GNU LGPL alatt terjesztve. Lásd a http://gnu.org/licenses/lgpl.html oldalt a részletekhez." + +"\n\n" + +"Dátum választás:\n" + +"- használja a \xab, \xbb gombokat az év kiválasztásához\n" + +"- használja a " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gombokat a hónap kiválasztásához\n" + +"- tartsa lenyomva az egérgombot a gyors választáshoz."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Idõ választás:\n" + +"- kattintva növelheti az idõt\n" + +"- shift-tel kattintva csökkentheti\n" + +"- lenyomva tartva és húzva gyorsabban kiválaszthatja."; + +Calendar._TT["PREV_YEAR"] = "Elõzõ év (tartsa nyomva a menühöz)"; +Calendar._TT["PREV_MONTH"] = "Elõzõ hónap (tartsa nyomva a menühöz)"; +Calendar._TT["GO_TODAY"] = "Mai napra ugrás"; +Calendar._TT["NEXT_MONTH"] = "Köv. hónap (tartsa nyomva a menühöz)"; +Calendar._TT["NEXT_YEAR"] = "Köv. év (tartsa nyomva a menühöz)"; +Calendar._TT["SEL_DATE"] = "Válasszon dátumot"; +Calendar._TT["DRAG_TO_MOVE"] = "Húzza a mozgatáshoz"; +Calendar._TT["PART_TODAY"] = " (ma)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "%s legyen a hét elsõ napja"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Bezár"; +Calendar._TT["TODAY"] = "Ma"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikk vagy húzás az érték változtatásához"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%b %e, %a"; + +Calendar._TT["WK"] = "hét"; +Calendar._TT["TIME"] = "idõ:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-it.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-it.js new file mode 100644 index 0000000..7f84cde --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-it.js @@ -0,0 +1,124 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Translator: Fabio Di Bernardini, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Domenica", + "Lunedì", + "Martedì", + "Mercoledì", + "Giovedì", + "Venerdì", + "Sabato", + "Domenica"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Dom", + "Lun", + "Mar", + "Mer", + "Gio", + "Ven", + "Sab", + "Dom"); + +// full month names +Calendar._MN = new Array +("Gennaio", + "Febbraio", + "Marzo", + "Aprile", + "Maggio", + "Giugno", + "Luglio", + "Augosto", + "Settembre", + "Ottobre", + "Novembre", + "Dicembre"); + +// short month names +Calendar._SMN = new Array +("Gen", + "Feb", + "Mar", + "Apr", + "Mag", + "Giu", + "Lug", + "Ago", + "Set", + "Ott", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Informazioni sul calendario"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Per gli aggiornamenti: http://www.dynarch.com/projects/calendar/\n" + +"Distribuito sotto licenza GNU LGPL. Vedi http://gnu.org/licenses/lgpl.html per i dettagli." + +"\n\n" + +"Selezione data:\n" + +"- Usa \xab, \xbb per selezionare l'anno\n" + +"- Usa " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per i mesi\n" + +"- Tieni premuto a lungo il mouse per accedere alle funzioni di selezione veloce."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selezione orario:\n" + +"- Clicca sul numero per incrementarlo\n" + +"- o Shift+click per decrementarlo\n" + +"- o click e sinistra o destra per variarlo."; + +Calendar._TT["PREV_YEAR"] = "Anno prec.(clicca a lungo per il menù)"; +Calendar._TT["PREV_MONTH"] = "Mese prec. (clicca a lungo per il menù)"; +Calendar._TT["GO_TODAY"] = "Oggi"; +Calendar._TT["NEXT_MONTH"] = "Pross. mese (clicca a lungo per il menù)"; +Calendar._TT["NEXT_YEAR"] = "Pross. anno (clicca a lungo per il menù)"; +Calendar._TT["SEL_DATE"] = "Seleziona data"; +Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostarlo"; +Calendar._TT["PART_TODAY"] = " (oggi)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Mostra prima %s"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Chiudi"; +Calendar._TT["TODAY"] = "Oggi"; +Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per cambiare il valore"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a:%b:%e"; + +Calendar._TT["WK"] = "set"; +Calendar._TT["TIME"] = "Ora:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-jp.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-jp.js new file mode 100644 index 0000000..3bca7eb --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-jp.js @@ -0,0 +1,45 @@ +// ** I18N +Calendar._DN = new Array +("“ú", + "ŒŽ", + "‰Î", + "�…", + "–Ø", + "‹à", + "“y", + "“ú"); +Calendar._MN = new Array +("1ŒŽ", + "2ŒŽ", + "3ŒŽ", + "4ŒŽ", + "5ŒŽ", + "6ŒŽ", + "7ŒŽ", + "8ŒŽ", + "9ŒŽ", + "10ŒŽ", + "11ŒŽ", + "12ŒŽ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "�T‚Ì�Å�‰‚Ì—j“ú‚ð�Ø‚è‘Ö‚¦"; +Calendar._TT["PREV_YEAR"] = "‘O”N"; +Calendar._TT["PREV_MONTH"] = "‘OŒŽ"; +Calendar._TT["GO_TODAY"] = "�¡“ú"; +Calendar._TT["NEXT_MONTH"] = "—‚ŒŽ"; +Calendar._TT["NEXT_YEAR"] = "—‚”N"; +Calendar._TT["SEL_DATE"] = "“ú•t‘I‘ð"; +Calendar._TT["DRAG_TO_MOVE"] = "ƒEƒBƒ“ƒhƒE‚̈ړ®"; +Calendar._TT["PART_TODAY"] = " (�¡“ú)"; +Calendar._TT["MON_FIRST"] = "ŒŽ—j“ú‚ð�擪‚É"; +Calendar._TT["SUN_FIRST"] = "“ú—j“ú‚ð�擪‚É"; +Calendar._TT["CLOSE"] = "•‚¶‚é"; +Calendar._TT["TODAY"] = "�¡“ú"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; +Calendar._TT["TT_DATE_FORMAT"] = "%mŒŽ %d“ú (%a)"; + +Calendar._TT["WK"] = "�T"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ko-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ko-utf8.js new file mode 100644 index 0000000..035dd74 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ko-utf8.js @@ -0,0 +1,120 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Translation: Yourim Yi +// Encoding: EUC-KR +// lang : ko +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names + +Calendar._DN = new Array +("ì�¼ìš”ì�¼", + "월요ì�¼", + "화요ì�¼", + "수요ì�¼", + "목요ì�¼", + "금요ì�¼", + "토요ì�¼", + "ì�¼ìš”ì�¼"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("ì�¼", + "ì›”", + "í™”", + "수", + "목", + "금", + "토", + "ì�¼"); + +// full month names +Calendar._MN = new Array +("1ì›”", + "2ì›”", + "3ì›”", + "4ì›”", + "5ì›”", + "6ì›”", + "7ì›”", + "8ì›”", + "9ì›”", + "10ì›”", + "11ì›”", + "12ì›”"); + +// short month names +Calendar._SMN = new Array +("1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "calendar ì—� 대해서"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"\n"+ +"최신 버전ì�„ 받으시려면 http://www.dynarch.com/projects/calendar/ ì—� 방문하세요\n" + +"\n"+ +"GNU LGPL ë�¼ì�´ì„¼ìŠ¤ë¡œ ë°°í�¬ë�©ë‹ˆë‹¤. \n"+ +"ë�¼ì�´ì„¼ìФì—� 대한 ìž�세한 ë‚´ìš©ì�€ http://gnu.org/licenses/lgpl.html ì�„ ì�½ìœ¼ì„¸ìš”." + +"\n\n" + +"ë‚ ì§œ ì„ íƒ�:\n" + +"- ì—°ë�„를 ì„ íƒ�하려면 \xab, \xbb 버튼ì�„ 사용합니다\n" + +"- 달ì�„ ì„ íƒ�하려면 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 버튼ì�„ 누르세요\n" + +"- 계ì†� 누르고 있으면 위 값들ì�„ 빠르게 ì„ íƒ�하실 수 있습니다."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"시간 ì„ íƒ�:\n" + +"- 마우스로 누르면 시간ì�´ ì¦�가합니다\n" + +"- Shift 키와 함께 누르면 ê°�소합니다\n" + +"- 누른 ìƒ�태ì—�서 마우스를 움ì§�ì�´ë©´ 좀 ë�” 빠르게 ê°’ì�´ 변합니다.\n"; + +Calendar._TT["PREV_YEAR"] = "지난 í•´ (길게 누르면 목ë¡�)"; +Calendar._TT["PREV_MONTH"] = "지난 달 (길게 누르면 목ë¡�)"; +Calendar._TT["GO_TODAY"] = "오늘 날짜로"; +Calendar._TT["NEXT_MONTH"] = "다ì�Œ 달 (길게 누르면 목ë¡�)"; +Calendar._TT["NEXT_YEAR"] = "다ì�Œ í•´ (길게 누르면 목ë¡�)"; +Calendar._TT["SEL_DATE"] = "날짜를 ì„ íƒ�하세요"; +Calendar._TT["DRAG_TO_MOVE"] = "마우스 드래그로 ì�´ë�™ 하세요"; +Calendar._TT["PART_TODAY"] = " (오늘)"; +Calendar._TT["MON_FIRST"] = "월요ì�¼ì�„ 한 주ì�˜ 시작 ìš”ì�¼ë¡œ"; +Calendar._TT["SUN_FIRST"] = "ì�¼ìš”ì�¼ì�„ 한 주ì�˜ 시작 ìš”ì�¼ë¡œ"; +Calendar._TT["CLOSE"] = "닫기"; +Calendar._TT["TODAY"] = "오늘"; +Calendar._TT["TIME_PART"] = "(Shift-)í�´ë¦­ ë˜�는 드래그 하세요"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]"; + +Calendar._TT["WK"] = "주"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ko.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ko.js new file mode 100644 index 0000000..8cddf58 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ko.js @@ -0,0 +1,120 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Translation: Yourim Yi +// Encoding: EUC-KR +// lang : ko +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names + +Calendar._DN = new Array +("ÀÏ¿äÀÏ", + "¿ù¿äÀÏ", + "È­¿äÀÏ", + "¼ö¿äÀÏ", + "¸ñ¿äÀÏ", + "±Ý¿äÀÏ", + "Åä¿äÀÏ", + "ÀÏ¿äÀÏ"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("ÀÏ", + "¿ù", + "È­", + "¼ö", + "¸ñ", + "±Ý", + "Åä", + "ÀÏ"); + +// full month names +Calendar._MN = new Array +("1¿ù", + "2¿ù", + "3¿ù", + "4¿ù", + "5¿ù", + "6¿ù", + "7¿ù", + "8¿ù", + "9¿ù", + "10¿ù", + "11¿ù", + "12¿ù"); + +// short month names +Calendar._SMN = new Array +("1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "calendar ¿¡ ´ëÇØ¼­"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"\n"+ +"ÃֽйöÀüÀ» ¹ÞÀ¸½Ã·Á¸é http://www.dynarch.com/projects/calendar/ ¿¡ ¹æ¹®Çϼ¼¿ä\n" + +"\n"+ +"GNU LGPL ¶óÀ̼¾½º·Î ¹èÆ÷µË´Ï´Ù. \n"+ +"¶óÀ̼¾½º¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº http://gnu.org/licenses/lgpl.html À» ÀÐÀ¸¼¼¿ä." + +"\n\n" + +"³¯Â¥ ¼±ÅÃ:\n" + +"- ¿¬µµ¸¦ ¼±ÅÃÇÏ·Á¸é \xab, \xbb ¹öưÀ» »ç¿ëÇÕ´Ï´Ù\n" + +"- ´ÞÀ» ¼±ÅÃÇÏ·Á¸é " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ¹öưÀ» ´©¸£¼¼¿ä\n" + +"- °è¼Ó ´©¸£°í ÀÖÀ¸¸é À§ °ªµéÀ» ºü¸£°Ô ¼±ÅÃÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"½Ã°£ ¼±ÅÃ:\n" + +"- ¸¶¿ì½º·Î ´©¸£¸é ½Ã°£ÀÌ Áõ°¡ÇÕ´Ï´Ù\n" + +"- Shift Ű¿Í ÇÔ²² ´©¸£¸é °¨¼ÒÇÕ´Ï´Ù\n" + +"- ´©¸¥ »óÅ¿¡¼­ ¸¶¿ì½º¸¦ ¿òÁ÷À̸é Á» ´õ ºü¸£°Ô °ªÀÌ º¯ÇÕ´Ï´Ù.\n"; + +Calendar._TT["PREV_YEAR"] = "Áö³­ ÇØ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["PREV_MONTH"] = "Áö³­ ´Þ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["GO_TODAY"] = "¿À´Ã ³¯Â¥·Î"; +Calendar._TT["NEXT_MONTH"] = "´ÙÀ½ ´Þ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["NEXT_YEAR"] = "´ÙÀ½ ÇØ (±æ°Ô ´©¸£¸é ¸ñ·Ï)"; +Calendar._TT["SEL_DATE"] = "³¯Â¥¸¦ ¼±ÅÃÇϼ¼¿ä"; +Calendar._TT["DRAG_TO_MOVE"] = "¸¶¿ì½º µå·¡±×·Î À̵¿ Çϼ¼¿ä"; +Calendar._TT["PART_TODAY"] = " (¿À´Ã)"; +Calendar._TT["MON_FIRST"] = "¿ù¿äÀÏÀ» ÇÑ ÁÖÀÇ ½ÃÀÛ ¿äÀÏ·Î"; +Calendar._TT["SUN_FIRST"] = "ÀÏ¿äÀÏÀ» ÇÑ ÁÖÀÇ ½ÃÀÛ ¿äÀÏ·Î"; +Calendar._TT["CLOSE"] = "´Ý±â"; +Calendar._TT["TODAY"] = "¿À´Ã"; +Calendar._TT["TIME_PART"] = "(Shift-)Ŭ¸¯ ¶Ç´Â µå·¡±× Çϼ¼¿ä"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]"; + +Calendar._TT["WK"] = "ÁÖ"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lt-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lt-utf8.js new file mode 100644 index 0000000..d39653b --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lt-utf8.js @@ -0,0 +1,114 @@ +// ** I18N + +// Calendar LT language +// Author: Martynas Majeris, +// Encoding: UTF-8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sekmadienis", + "Pirmadienis", + "Antradienis", + "TreÄ�iadienis", + "Ketvirtadienis", + "Pentadienis", + "Å eÅ¡tadienis", + "Sekmadienis"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sek", + "Pir", + "Ant", + "Tre", + "Ket", + "Pen", + "Å eÅ¡", + "Sek"); + +// full month names +Calendar._MN = new Array +("Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Gegužė", + "Birželis", + "Liepa", + "RugpjÅ«tis", + "RugsÄ—jis", + "Spalis", + "Lapkritis", + "Gruodis"); + +// short month names +Calendar._SMN = new Array +("Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spa", + "Lap", + "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Apie kalendorių"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"NaujausiÄ… versijÄ… rasite: http://www.dynarch.com/projects/calendar/\n" + +"Platinamas pagal GNU LGPL licencijÄ…. Aplankykite http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"Datos pasirinkimas:\n" + +"- Metų pasirinkimas: \xab, \xbb\n" + +"- MÄ—nesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + +"- Nuspauskite ir laikykite pelÄ—s klavišą greitesniam pasirinkimui."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Laiko pasirinkimas:\n" + +"- Spustelkite ant valandų arba minuÄ�ių - skaiÄ�ius padidÄ—s vienetu.\n" + +"- Jei spausite kartu su Shift, skaiÄ�ius sumažės.\n" + +"- Greitam pasirinkimui spustelkite ir pajudinkite pelÄ™."; + +Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)"; +Calendar._TT["PREV_MONTH"] = "Ankstesnis mÄ—nuo (laikykite, jei norite meniu)"; +Calendar._TT["GO_TODAY"] = "Pasirinkti Å¡iandienÄ…"; +Calendar._TT["NEXT_MONTH"] = "Kitas mÄ—nuo (laikykite, jei norite meniu)"; +Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)"; +Calendar._TT["SEL_DATE"] = "Pasirinkite datÄ…"; +Calendar._TT["DRAG_TO_MOVE"] = "Tempkite"; +Calendar._TT["PART_TODAY"] = " (Å¡iandien)"; +Calendar._TT["MON_FIRST"] = "Pirma savaitÄ—s diena - pirmadienis"; +Calendar._TT["SUN_FIRST"] = "Pirma savaitÄ—s diena - sekmadienis"; +Calendar._TT["CLOSE"] = "Uždaryti"; +Calendar._TT["TODAY"] = "Å iandien"; +Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d"; + +Calendar._TT["WK"] = "sav"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lt.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lt.js new file mode 100644 index 0000000..43b93d6 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lt.js @@ -0,0 +1,114 @@ +// ** I18N + +// Calendar LT language +// Author: Martynas Majeris, +// Encoding: Windows-1257 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sekmadienis", + "Pirmadienis", + "Antradienis", + "Treèiadienis", + "Ketvirtadienis", + "Pentadienis", + "Ðeðtadienis", + "Sekmadienis"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sek", + "Pir", + "Ant", + "Tre", + "Ket", + "Pen", + "Ðeð", + "Sek"); + +// full month names +Calendar._MN = new Array +("Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Geguþë", + "Birþelis", + "Liepa", + "Rugpjûtis", + "Rugsëjis", + "Spalis", + "Lapkritis", + "Gruodis"); + +// short month names +Calendar._SMN = new Array +("Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spa", + "Lap", + "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Apie kalendoriø"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Naujausià versijà rasite: http://www.dynarch.com/projects/calendar/\n" + +"Platinamas pagal GNU LGPL licencijà. Aplankykite http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"Datos pasirinkimas:\n" + +"- Metø pasirinkimas: \xab, \xbb\n" + +"- Mënesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + +"- Nuspauskite ir laikykite pelës klaviðà greitesniam pasirinkimui."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Laiko pasirinkimas:\n" + +"- Spustelkite ant valandø arba minuèiø - skaièus padidës vienetu.\n" + +"- Jei spausite kartu su Shift, skaièius sumaþës.\n" + +"- Greitam pasirinkimui spustelkite ir pajudinkite pelæ."; + +Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)"; +Calendar._TT["PREV_MONTH"] = "Ankstesnis mënuo (laikykite, jei norite meniu)"; +Calendar._TT["GO_TODAY"] = "Pasirinkti ðiandienà"; +Calendar._TT["NEXT_MONTH"] = "Kitas mënuo (laikykite, jei norite meniu)"; +Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)"; +Calendar._TT["SEL_DATE"] = "Pasirinkite datà"; +Calendar._TT["DRAG_TO_MOVE"] = "Tempkite"; +Calendar._TT["PART_TODAY"] = " (ðiandien)"; +Calendar._TT["MON_FIRST"] = "Pirma savaitës diena - pirmadienis"; +Calendar._TT["SUN_FIRST"] = "Pirma savaitës diena - sekmadienis"; +Calendar._TT["CLOSE"] = "Uþdaryti"; +Calendar._TT["TODAY"] = "Ðiandien"; +Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d"; + +Calendar._TT["WK"] = "sav"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lv.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lv.js new file mode 100644 index 0000000..407699d --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-lv.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar LV language +// Author: Juris Valdovskis, +// Encoding: cp1257 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Svçtdiena", + "Pirmdiena", + "Otrdiena", + "Treðdiena", + "Ceturdiena", + "Piektdiena", + "Sestdiena", + "Svçtdiena"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sv", + "Pr", + "Ot", + "Tr", + "Ce", + "Pk", + "Se", + "Sv"); + +// full month names +Calendar._MN = new Array +("Janvâris", + "Februâris", + "Marts", + "Aprîlis", + "Maijs", + "Jûnijs", + "Jûlijs", + "Augusts", + "Septembris", + "Oktobris", + "Novembris", + "Decembris"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jûn", + "Jûl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Par kalendâru"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Datuma izvçle:\n" + +"- Izmanto \xab, \xbb pogas, lai izvçlçtos gadu\n" + +"- Izmanto " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "pogas, lai izvçlçtos mçnesi\n" + +"- Turi nospiestu peles pogu uz jebkuru no augstâk minçtajâm pogâm, lai paâtrinâtu izvçli."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Laika izvçle:\n" + +"- Uzklikðíini uz jebkuru no laika daïâm, lai palielinâtu to\n" + +"- vai Shift-klikðíis, lai samazinâtu to\n" + +"- vai noklikðíini un velc uz attiecîgo virzienu lai mainîtu âtrâk."; + +Calendar._TT["PREV_YEAR"] = "Iepr. gads (turi izvçlnei)"; +Calendar._TT["PREV_MONTH"] = "Iepr. mçnesis (turi izvçlnei)"; +Calendar._TT["GO_TODAY"] = "Ðodien"; +Calendar._TT["NEXT_MONTH"] = "Nâkoðais mçnesis (turi izvçlnei)"; +Calendar._TT["NEXT_YEAR"] = "Nâkoðais gads (turi izvçlnei)"; +Calendar._TT["SEL_DATE"] = "Izvçlies datumu"; +Calendar._TT["DRAG_TO_MOVE"] = "Velc, lai pârvietotu"; +Calendar._TT["PART_TODAY"] = " (ðodien)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Attçlot %s kâ pirmo"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "1,7"; + +Calendar._TT["CLOSE"] = "Aizvçrt"; +Calendar._TT["TODAY"] = "Ðodien"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikðíis vai pârvieto, lai mainîtu"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Laiks:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-nl.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-nl.js new file mode 100644 index 0000000..a1dea94 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-nl.js @@ -0,0 +1,73 @@ +// ** I18N +Calendar._DN = new Array +("Zondag", + "Maandag", + "Dinsdag", + "Woensdag", + "Donderdag", + "Vrijdag", + "Zaterdag", + "Zondag"); + +Calendar._SDN_len = 2; + +Calendar._MN = new Array +("Januari", + "Februari", + "Maart", + "April", + "Mei", + "Juni", + "Juli", + "Augustus", + "September", + "Oktober", + "November", + "December"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Info"; + +Calendar._TT["ABOUT"] = +"DHTML Datum/Tijd Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + +"Ga voor de meest recente versie naar: http://www.dynarch.com/projects/calendar/\n" + +"Verspreid onder de GNU LGPL. Zie http://gnu.org/licenses/lgpl.html voor details." + +"\n\n" + +"Datum selectie:\n" + +"- Gebruik de \xab \xbb knoppen om een jaar te selecteren\n" + +"- Gebruik de " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knoppen om een maand te selecteren\n" + +"- Houd de muis ingedrukt op de genoemde knoppen voor een snellere selectie."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Tijd selectie:\n" + +"- Klik op een willekeurig onderdeel van het tijd gedeelte om het te verhogen\n" + +"- of Shift-klik om het te verlagen\n" + +"- of klik en sleep voor een snellere selectie."; + +//Calendar._TT["TOGGLE"] = "Selecteer de eerste week-dag"; +Calendar._TT["PREV_YEAR"] = "Vorig jaar (ingedrukt voor menu)"; +Calendar._TT["PREV_MONTH"] = "Vorige maand (ingedrukt voor menu)"; +Calendar._TT["GO_TODAY"] = "Ga naar Vandaag"; +Calendar._TT["NEXT_MONTH"] = "Volgende maand (ingedrukt voor menu)"; +Calendar._TT["NEXT_YEAR"] = "Volgend jaar (ingedrukt voor menu)"; +Calendar._TT["SEL_DATE"] = "Selecteer datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Klik en sleep om te verplaatsen"; +Calendar._TT["PART_TODAY"] = " (vandaag)"; +//Calendar._TT["MON_FIRST"] = "Toon Maandag eerst"; +//Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst"; + +Calendar._TT["DAY_FIRST"] = "Toon %s eerst"; + +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Sluiten"; +Calendar._TT["TODAY"] = "(vandaag)"; +Calendar._TT["TIME_PART"] = "(Shift-)Klik of sleep om de waarde te veranderen"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b %Y"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Tijd:"; \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-no.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-no.js new file mode 100644 index 0000000..d9297d1 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-no.js @@ -0,0 +1,114 @@ +// ** I18N + +// Calendar NO language +// Author: Daniel Holmen, +// Encoding: UTF-8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Søndag", + "Mandag", + "Tirsdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lørdag", + "Søndag"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Søn", + "Man", + "Tir", + "Ons", + "Tor", + "Fre", + "Lør", + "Søn"); + +// full month names +Calendar._MN = new Array +("Januar", + "Februar", + "Mars", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Desember"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Om kalenderen"; + +Calendar._TT["ABOUT"] = +"DHTML Dato-/Tidsvelger\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For nyeste versjon, gÃ¥ til: http://www.dynarch.com/projects/calendar/\n" + +"Distribuert under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detaljer." + +"\n\n" + +"Datovalg:\n" + +"- Bruk knappene \xab og \xbb for Ã¥ velge Ã¥r\n" + +"- Bruk knappene " + String.fromCharCode(0x2039) + " og " + String.fromCharCode(0x203a) + " for Ã¥ velge mÃ¥ned\n" + +"- Hold inne musknappen eller knappene over for raskere valg."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Tidsvalg:\n" + +"- Klikk pÃ¥ en av tidsdelene for Ã¥ øke den\n" + +"- eller Shift-klikk for Ã¥ senke verdien\n" + +"- eller klikk-og-dra for raskere valg.."; + +Calendar._TT["PREV_YEAR"] = "Forrige. Ã¥r (hold for meny)"; +Calendar._TT["PREV_MONTH"] = "Forrige. mÃ¥ned (hold for meny)"; +Calendar._TT["GO_TODAY"] = "GÃ¥ til idag"; +Calendar._TT["NEXT_MONTH"] = "Neste mÃ¥ned (hold for meny)"; +Calendar._TT["NEXT_YEAR"] = "Neste Ã¥r (hold for meny)"; +Calendar._TT["SEL_DATE"] = "Velg dato"; +Calendar._TT["DRAG_TO_MOVE"] = "Dra for Ã¥ flytte"; +Calendar._TT["PART_TODAY"] = " (idag)"; +Calendar._TT["MON_FIRST"] = "Vis mandag først"; +Calendar._TT["SUN_FIRST"] = "Vis søndag først"; +Calendar._TT["CLOSE"] = "Lukk"; +Calendar._TT["TODAY"] = "Idag"; +Calendar._TT["TIME_PART"] = "(Shift-)Klikk eller dra for Ã¥ endre verdi"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "uke"; \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pl-utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pl-utf8.js new file mode 100644 index 0000000..6b8ca67 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pl-utf8.js @@ -0,0 +1,93 @@ +// ** I18N + +// Calendar PL language +// Author: Dariusz Pietrzak, +// Author: Janusz Piwowarski, +// Encoding: utf-8 +// Distributed under the same terms as the calendar itself. + +Calendar._DN = new Array +("Niedziela", + "PoniedziaÅ‚ek", + "Wtorek", + "Åšroda", + "Czwartek", + "PiÄ…tek", + "Sobota", + "Niedziela"); +Calendar._SDN = new Array +("Nie", + "Pn", + "Wt", + "Åšr", + "Cz", + "Pt", + "So", + "Nie"); +Calendar._MN = new Array +("StyczeÅ„", + "Luty", + "Marzec", + "KwiecieÅ„", + "Maj", + "Czerwiec", + "Lipiec", + "SierpieÅ„", + "WrzesieÅ„", + "Październik", + "Listopad", + "GrudzieÅ„"); +Calendar._SMN = new Array +("Sty", + "Lut", + "Mar", + "Kwi", + "Maj", + "Cze", + "Lip", + "Sie", + "Wrz", + "Paź", + "Lis", + "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O kalendarzu"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Aby pobrać najnowszÄ… wersjÄ™, odwiedź: http://www.dynarch.com/projects/calendar/\n" + +"DostÄ™pny na licencji GNU LGPL. Zobacz szczegóły na http://gnu.org/licenses/lgpl.html." + +"\n\n" + +"Wybór daty:\n" + +"- Użyj przycisków \xab, \xbb by wybrać rok\n" + +"- Użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " by wybrać miesiÄ…c\n" + +"- Przytrzymaj klawisz myszy nad jednym z powyższych przycisków dla szybszego wyboru."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Wybór czasu:\n" + +"- Kliknij na jednym z pól czasu by zwiÄ™kszyć jego wartość\n" + +"- lub kliknij trzymajÄ…c Shift by zmiejszyć jego wartość\n" + +"- lub kliknij i przeciÄ…gnij dla szybszego wyboru."; + +//Calendar._TT["TOGGLE"] = "ZmieÅ„ pierwszy dzieÅ„ tygodnia"; +Calendar._TT["PREV_YEAR"] = "Poprzedni rok (przytrzymaj dla menu)"; +Calendar._TT["PREV_MONTH"] = "Poprzedni miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["GO_TODAY"] = "Idź do dzisiaj"; +Calendar._TT["NEXT_MONTH"] = "NastÄ™pny miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["NEXT_YEAR"] = "NastÄ™pny rok (przytrzymaj dla menu)"; +Calendar._TT["SEL_DATE"] = "Wybierz datÄ™"; +Calendar._TT["DRAG_TO_MOVE"] = "PrzeciÄ…gnij by przesunąć"; +Calendar._TT["PART_TODAY"] = " (dzisiaj)"; +Calendar._TT["MON_FIRST"] = "WyÅ›wietl poniedziaÅ‚ek jako pierwszy"; +Calendar._TT["SUN_FIRST"] = "WyÅ›wietl niedzielÄ™ jako pierwszÄ…"; +Calendar._TT["CLOSE"] = "Zamknij"; +Calendar._TT["TODAY"] = "Dzisiaj"; +Calendar._TT["TIME_PART"] = "(Shift-)Kliknij lub przeciÄ…gnij by zmienić wartość"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%e %B, %A"; + +Calendar._TT["WK"] = "ty"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pl.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pl.js new file mode 100644 index 0000000..76e0551 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pl.js @@ -0,0 +1,56 @@ +// ** I18N +// Calendar PL language +// Author: Artur Filipiak, +// January, 2004 +// Encoding: UTF-8 +Calendar._DN = new Array +("Niedziela", "PoniedziaÅ‚ek", "Wtorek", "Åšroda", "Czwartek", "PiÄ…tek", "Sobota", "Niedziela"); + +Calendar._SDN = new Array +("N", "Pn", "Wt", "Åšr", "Cz", "Pt", "So", "N"); + +Calendar._MN = new Array +("StyczeÅ„", "Luty", "Marzec", "KwiecieÅ„", "Maj", "Czerwiec", "Lipiec", "SierpieÅ„", "WrzesieÅ„", "Październik", "Listopad", "GrudzieÅ„"); + +Calendar._SMN = new Array +("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O kalendarzu"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Wybór daty:\n" + +"- aby wybrać rok użyj przycisków \xab, \xbb\n" + +"- aby wybrać miesiÄ…c użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + +"- aby przyspieszyć wybór przytrzymaj wciÅ›niÄ™ty przycisk myszy nad ww. przyciskami."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Wybór czasu:\n" + +"- aby zwiÄ™kszyć wartość kliknij na dowolnym elemencie selekcji czasu\n" + +"- aby zmniejszyć wartość użyj dodatkowo klawisza Shift\n" + +"- możesz również poruszać myszkÄ™ w lewo i prawo wraz z wciÅ›niÄ™tym lewym klawiszem."; + +Calendar._TT["PREV_YEAR"] = "Poprz. rok (przytrzymaj dla menu)"; +Calendar._TT["PREV_MONTH"] = "Poprz. miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["GO_TODAY"] = "Pokaż dziÅ›"; +Calendar._TT["NEXT_MONTH"] = "Nast. miesiÄ…c (przytrzymaj dla menu)"; +Calendar._TT["NEXT_YEAR"] = "Nast. rok (przytrzymaj dla menu)"; +Calendar._TT["SEL_DATE"] = "Wybierz datÄ™"; +Calendar._TT["DRAG_TO_MOVE"] = "PrzesuÅ„ okienko"; +Calendar._TT["PART_TODAY"] = " (dziÅ›)"; +Calendar._TT["MON_FIRST"] = "Pokaż PoniedziaÅ‚ek jako pierwszy"; +Calendar._TT["SUN_FIRST"] = "Pokaż NiedzielÄ™ jako pierwszÄ…"; +Calendar._TT["CLOSE"] = "Zamknij"; +Calendar._TT["TODAY"] = "DziÅ›"; +Calendar._TT["TIME_PART"] = "(Shift-)klik | drag, aby zmienić wartość"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y.%m.%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pt.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pt.js new file mode 100644 index 0000000..deee8a1 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-pt.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar pt_BR language +// Author: Adalberto Machado, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Domingo", + "Segunda", + "Terca", + "Quarta", + "Quinta", + "Sexta", + "Sabado", + "Domingo"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Dom", + "Seg", + "Ter", + "Qua", + "Qui", + "Sex", + "Sab", + "Dom"); + +// full month names +Calendar._MN = new Array +("Janeiro", + "Fevereiro", + "Marco", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Sobre o calendario"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Ultima versao visite: http://www.dynarch.com/projects/calendar/\n" + +"Distribuido sobre GNU LGPL. Veja http://gnu.org/licenses/lgpl.html para detalhes." + +"\n\n" + +"Selecao de data:\n" + +"- Use os botoes \xab, \xbb para selecionar o ano\n" + +"- Use os botoes " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mes\n" + +"- Segure o botao do mouse em qualquer um desses botoes para selecao rapida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selecao de hora:\n" + +"- Clique em qualquer parte da hora para incrementar\n" + +"- ou Shift-click para decrementar\n" + +"- ou clique e segure para selecao rapida."; + +Calendar._TT["PREV_YEAR"] = "Ant. ano (segure para menu)"; +Calendar._TT["PREV_MONTH"] = "Ant. mes (segure para menu)"; +Calendar._TT["GO_TODAY"] = "Hoje"; +Calendar._TT["NEXT_MONTH"] = "Prox. mes (segure para menu)"; +Calendar._TT["NEXT_YEAR"] = "Prox. ano (segure para menu)"; +Calendar._TT["SEL_DATE"] = "Selecione a data"; +Calendar._TT["DRAG_TO_MOVE"] = "Arraste para mover"; +Calendar._TT["PART_TODAY"] = " (hoje)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Mostre %s primeiro"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Fechar"; +Calendar._TT["TODAY"] = "Hoje"; +Calendar._TT["TIME_PART"] = "(Shift-)Click ou arraste para mudar valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b"; + +Calendar._TT["WK"] = "sm"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ro.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ro.js new file mode 100644 index 0000000..116e358 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ro.js @@ -0,0 +1,66 @@ +// ** I18N +Calendar._DN = new Array +("Duminică", + "Luni", + "MarÅ£i", + "Miercuri", + "Joi", + "Vineri", + "Sâmbătă", + "Duminică"); +Calendar._SDN_len = 2; +Calendar._MN = new Array +("Ianuarie", + "Februarie", + "Martie", + "Aprilie", + "Mai", + "Iunie", + "Iulie", + "August", + "Septembrie", + "Octombrie", + "Noiembrie", + "Decembrie"); + +// tooltips +Calendar._TT = {}; + +Calendar._TT["INFO"] = "Despre calendar"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Pentru ultima versiune vizitaÅ£i: http://www.dynarch.com/projects/calendar/\n" + +"Distribuit sub GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"SelecÅ£ia datei:\n" + +"- FolosiÅ£i butoanele \xab, \xbb pentru a selecta anul\n" + +"- FolosiÅ£i butoanele " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pentru a selecta luna\n" + +"- TineÅ£i butonul mouse-ului apăsat pentru selecÅ£ie mai rapidă."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"SelecÅ£ia orei:\n" + +"- Click pe ora sau minut pentru a mări valoarea cu 1\n" + +"- Sau Shift-Click pentru a micÅŸora valoarea cu 1\n" + +"- Sau Click ÅŸi drag pentru a selecta mai repede."; + +Calendar._TT["PREV_YEAR"] = "Anul precedent (lung pt menu)"; +Calendar._TT["PREV_MONTH"] = "Luna precedentă (lung pt menu)"; +Calendar._TT["GO_TODAY"] = "Data de azi"; +Calendar._TT["NEXT_MONTH"] = "Luna următoare (lung pt menu)"; +Calendar._TT["NEXT_YEAR"] = "Anul următor (lung pt menu)"; +Calendar._TT["SEL_DATE"] = "Selectează data"; +Calendar._TT["DRAG_TO_MOVE"] = "Trage pentru a miÅŸca"; +Calendar._TT["PART_TODAY"] = " (astăzi)"; +Calendar._TT["DAY_FIRST"] = "AfiÅŸează %s prima zi"; +Calendar._TT["WEEKEND"] = "0,6"; +Calendar._TT["CLOSE"] = "ÃŽnchide"; +Calendar._TT["TODAY"] = "Astăzi"; +Calendar._TT["TIME_PART"] = "(Shift-)Click sau drag pentru a selecta"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %d %B"; + +Calendar._TT["WK"] = "spt"; +Calendar._TT["TIME"] = "Ora:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ru.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ru.js new file mode 100644 index 0000000..9f75a6a --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ru.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar RU language +// Translation: Sly Golovanov, http://golovanov.net, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("воÑ�креÑ�енье", + "понедельник", + "вторник", + "Ñ�реда", + "четверг", + "пÑ�тница", + "Ñ�уббота", + "воÑ�креÑ�енье"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("вÑ�к", + "пон", + "втр", + "Ñ�рд", + "чет", + "пÑ�Ñ‚", + "Ñ�уб", + "вÑ�к"); + +// full month names +Calendar._MN = new Array +("Ñ�нварь", + "февраль", + "март", + "апрель", + "май", + "июнь", + "июль", + "авгуÑ�Ñ‚", + "Ñ�ентÑ�брь", + "октÑ�брь", + "ноÑ�брь", + "декабрь"); + +// short month names +Calendar._SMN = new Array +("Ñ�нв", + "фев", + "мар", + "апр", + "май", + "июн", + "июл", + "авг", + "Ñ�ен", + "окт", + "ноÑ�", + "дек"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "О календаре..."; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Как выбрать дату:\n" + +"- При помощи кнопок \xab, \xbb можно выбрать год\n" + +"- При помощи кнопок " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " можно выбрать меÑ�Ñ�ц\n" + +"- Подержите Ñ�ти кнопки нажатыми, чтобы поÑ�вилоÑ�ÑŒ меню быÑ�трого выбора."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Как выбрать времÑ�:\n" + +"- При клике на чаÑ�ах или минутах они увеличиваютÑ�Ñ�\n" + +"- при клике Ñ� нажатой клавишей Shift они уменьшаютÑ�Ñ�\n" + +"- еÑ�ли нажать и двигать мышкой влево/вправо, они будут менÑ�тьÑ�Ñ� быÑ�трее."; + +Calendar._TT["PREV_YEAR"] = "Ð�а год назад (удерживать длÑ� меню)"; +Calendar._TT["PREV_MONTH"] = "Ð�а меÑ�Ñ�ц назад (удерживать длÑ� меню)"; +Calendar._TT["GO_TODAY"] = "СегоднÑ�"; +Calendar._TT["NEXT_MONTH"] = "Ð�а меÑ�Ñ�ц вперед (удерживать длÑ� меню)"; +Calendar._TT["NEXT_YEAR"] = "Ð�а год вперед (удерживать длÑ� меню)"; +Calendar._TT["SEL_DATE"] = "Выберите дату"; +Calendar._TT["DRAG_TO_MOVE"] = "ПеретаÑ�кивайте мышкой"; +Calendar._TT["PART_TODAY"] = " (Ñ�егоднÑ�)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Первый день недели будет %s"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Закрыть"; +Calendar._TT["TODAY"] = "СегоднÑ�"; +Calendar._TT["TIME_PART"] = "(Shift-)клик или нажать и двигать"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a"; + +Calendar._TT["WK"] = "нед"; +Calendar._TT["TIME"] = "ВремÑ�:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ru_win_.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ru_win_.js new file mode 100644 index 0000000..de455af --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-ru_win_.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar RU language +// Translation: Sly Golovanov, http://golovanov.net, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("âîñêðåñåíüå", + "ïîíåäåëüíèê", + "âòîðíèê", + "ñðåäà", + "÷åòâåðã", + "ïÿòíèöà", + "ñóááîòà", + "âîñêðåñåíüå"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("âñê", + "ïîí", + "âòð", + "ñðä", + "÷åò", + "ïÿò", + "ñóá", + "âñê"); + +// full month names +Calendar._MN = new Array +("ÿíâàðü", + "ôåâðàëü", + "ìàðò", + "àïðåëü", + "ìàé", + "èþíü", + "èþëü", + "àâãóñò", + "ñåíòÿáðü", + "îêòÿáðü", + "íîÿáðü", + "äåêàáðü"); + +// short month names +Calendar._SMN = new Array +("ÿíâ", + "ôåâ", + "ìàð", + "àïð", + "ìàé", + "èþí", + "èþë", + "àâã", + "ñåí", + "îêò", + "íîÿ", + "äåê"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Î êàëåíäàðå..."; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Êàê âûáðàòü äàòó:\n" + +"- Ïðè ïîìîùè êíîïîê \xab, \xbb ìîæíî âûáðàòü ãîä\n" + +"- Ïðè ïîìîùè êíîïîê " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " ìîæíî âûáðàòü ìåñÿö\n" + +"- Ïîäåðæèòå ýòè êíîïêè íàæàòûìè, ÷òîáû ïîÿâèëîñü ìåíþ áûñòðîãî âûáîðà."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Êàê âûáðàòü âðåìÿ:\n" + +"- Ïðè êëèêå íà ÷àñàõ èëè ìèíóòàõ îíè óâåëè÷èâàþòñÿ\n" + +"- ïðè êëèêå ñ íàæàòîé êëàâèøåé Shift îíè óìåíüøàþòñÿ\n" + +"- åñëè íàæàòü è äâèãàòü ìûøêîé âëåâî/âïðàâî, îíè áóäóò ìåíÿòüñÿ áûñòðåå."; + +Calendar._TT["PREV_YEAR"] = "Íà ãîä íàçàä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["PREV_MONTH"] = "Íà ìåñÿö íàçàä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["GO_TODAY"] = "Ñåãîäíÿ"; +Calendar._TT["NEXT_MONTH"] = "Íà ìåñÿö âïåðåä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["NEXT_YEAR"] = "Íà ãîä âïåðåä (óäåðæèâàòü äëÿ ìåíþ)"; +Calendar._TT["SEL_DATE"] = "Âûáåðèòå äàòó"; +Calendar._TT["DRAG_TO_MOVE"] = "Ïåðåòàñêèâàéòå ìûøêîé"; +Calendar._TT["PART_TODAY"] = " (ñåãîäíÿ)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Ïåðâûé äåíü íåäåëè áóäåò %s"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Çàêðûòü"; +Calendar._TT["TODAY"] = "Ñåãîäíÿ"; +Calendar._TT["TIME_PART"] = "(Shift-)êëèê èëè íàæàòü è äâèãàòü"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a"; + +Calendar._TT["WK"] = "íåä"; +Calendar._TT["TIME"] = "Âðåìÿ:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-si.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-si.js new file mode 100644 index 0000000..cb3dfb9 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-si.js @@ -0,0 +1,94 @@ +/* Slovenian language file for the DHTML Calendar version 0.9.2 +* Author David Milost , January 2004. +* Feel free to use this script under the terms of the GNU Lesser General +* Public License, as long as you do not remove or alter this notice. +*/ + // full day names +Calendar._DN = new Array +("Nedelja", + "Ponedeljek", + "Torek", + "Sreda", + "ÄŒetrtek", + "Petek", + "Sobota", + "Nedelja"); + // short day names + Calendar._SDN = new Array +("Ned", + "Pon", + "Tor", + "Sre", + "ÄŒet", + "Pet", + "Sob", + "Ned"); +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec"); + // full month names +Calendar._MN = new Array +("Januar", + "Februar", + "Marec", + "April", + "Maj", + "Junij", + "Julij", + "Avgust", + "September", + "Oktober", + "November", + "December"); + +// tooltips +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O koledarju"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Za zadnjo verzijo pojdine na naslov: http://www.dynarch.com/projects/calendar/\n" + +"Distribuirano pod GNU LGPL. Poglejte http://gnu.org/licenses/lgpl.html za podrobnosti." + +"\n\n" + +"Izbor datuma:\n" + +"- Uporabite \xab, \xbb gumbe za izbor leta\n" + +"- Uporabite " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gumbe za izbor meseca\n" + +"- Zadržite klik na kateremkoli od zgornjih gumbov za hiter izbor."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Izbor ćasa:\n" + +"- Kliknite na katerikoli del ćasa za poveć. le-tega\n" + +"- ali Shift-click za zmanj. le-tega\n" + +"- ali kliknite in povlecite za hiter izbor."; + +Calendar._TT["TOGGLE"] = "Spremeni dan s katerim se prićne teden"; +Calendar._TT["PREV_YEAR"] = "Predhodnje leto (dolg klik za meni)"; +Calendar._TT["PREV_MONTH"] = "Predhodnji mesec (dolg klik za meni)"; +Calendar._TT["GO_TODAY"] = "Pojdi na tekoći dan"; +Calendar._TT["NEXT_MONTH"] = "Naslednji mesec (dolg klik za meni)"; +Calendar._TT["NEXT_YEAR"] = "Naslednje leto (dolg klik za meni)"; +Calendar._TT["SEL_DATE"] = "Izberite datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Pritisni in povleci za spremembo pozicije"; +Calendar._TT["PART_TODAY"] = " (danes)"; +Calendar._TT["MON_FIRST"] = "Prikaži ponedeljek kot prvi dan"; +Calendar._TT["SUN_FIRST"] = "Prikaži nedeljo kot prvi dan"; +Calendar._TT["CLOSE"] = "Zapri"; +Calendar._TT["TODAY"] = "Danes"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "Ted"; \ No newline at end of file diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sk.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sk.js new file mode 100644 index 0000000..4fe6a3c --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sk.js @@ -0,0 +1,99 @@ +// ** I18N + +// Calendar SK language +// Author: Peter Valach (pvalach@gmx.net) +// Encoding: utf-8 +// Last update: 2003/10/29 +// Distributed under the same terms as the calendar itself. + +// full day names +Calendar._DN = new Array +("NedeÄľa", + "Pondelok", + "Utorok", + "Streda", + "Ĺ tvrtok", + "Piatok", + "Sobota", + "NedeÄľa"); + +// short day names +Calendar._SDN = new Array +("Ned", + "Pon", + "Uto", + "Str", + "Ĺ tv", + "Pia", + "Sob", + "Ned"); + +// full month names +Calendar._MN = new Array +("Január", + "Február", + "Marec", + "AprĂ­l", + "Máj", + "JĂşn", + "JĂşl", + "August", + "September", + "OktĂłber", + "November", + "December"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "Máj", + "JĂşn", + "JĂşl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "O kalendári"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + +"PoslednĂş verziu nájdete na: http://www.dynarch.com/projects/calendar/\n" + +"DistribuovanĂ© pod GNU LGPL. ViÄŹ http://gnu.org/licenses/lgpl.html pre detaily." + +"\n\n" + +"VÄ‚Ë�ber dátumu:\n" + +"- PouĹľite tlaÄŤidlá \xab, \xbb pre vÄ‚Ë�ber roku\n" + +"- PouĹľite tlaÄŤidlá " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pre vÄ‚Ë�ber mesiaca\n" + +"- Ak ktorĂ©koÄľvek z tÄ‚Ë�chto tlaÄŤidiel podržíte dlhšie, zobrazĂ­ sa rÄ‚Ë�chly vÄ‚Ë�ber."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"VÄ‚Ë�ber ÄŤasu:\n" + +"- Kliknutie na niektorĂş poloĹľku ÄŤasu ju zvÄ‚Ë�ši\n" + +"- Shift-klik ju znĂ­Ĺľi\n" + +"- Ak podržíte tlaÄŤĂ­tko stlaÄŤenĂ©, posĂşvanĂ­m menĂ­te hodnotu."; + +Calendar._TT["PREV_YEAR"] = "PredošlÄ‚Ë� rok (podrĹľte pre menu)"; +Calendar._TT["PREV_MONTH"] = "PredošlÄ‚Ë� mesiac (podrĹľte pre menu)"; +Calendar._TT["GO_TODAY"] = "PrejsĹĄ na dnešok"; +Calendar._TT["NEXT_MONTH"] = "Nasl. mesiac (podrĹľte pre menu)"; +Calendar._TT["NEXT_YEAR"] = "Nasl. rok (podrĹľte pre menu)"; +Calendar._TT["SEL_DATE"] = "ZvoÄľte dátum"; +Calendar._TT["DRAG_TO_MOVE"] = "PodrĹľanĂ­m tlaÄŤĂ­tka zmenĂ­te polohu"; +Calendar._TT["PART_TODAY"] = " (dnes)"; +Calendar._TT["MON_FIRST"] = "ZobraziĹĄ pondelok ako prvÄ‚Ë�"; +Calendar._TT["SUN_FIRST"] = "ZobraziĹĄ nedeÄľu ako prvĂş"; +Calendar._TT["CLOSE"] = "ZavrieĹĄ"; +Calendar._TT["TODAY"] = "Dnes"; +Calendar._TT["TIME_PART"] = "(Shift-)klik/ĹĄahanie zmenĂ­ hodnotu"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "$d. %m. %Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %e. %b"; + +Calendar._TT["WK"] = "tÄ‚Ë�Ĺľ"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sp.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sp.js new file mode 100644 index 0000000..239d1b3 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sp.js @@ -0,0 +1,110 @@ +// ** I18N + +// Calendar SP language +// Author: Rafael Velasco +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Domingo", + "Lunes", + "Martes", + "Miercoles", + "Jueves", + "Viernes", + "Sabado", + "Domingo"); + +Calendar._SDN = new Array +("Dom", + "Lun", + "Mar", + "Mie", + "Jue", + "Vie", + "Sab", + "Dom"); + +// full month names +Calendar._MN = new Array +("Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre"); + +// short month names +Calendar._SMN = new Array +("Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Información del Calendario"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Nuevas versiones en: http://www.dynarch.com/projects/calendar/\n" + +"Distribuida bajo licencia GNU LGPL. Para detalles vea http://gnu.org/licenses/lgpl.html ." + +"\n\n" + +"Selección de Fechas:\n" + +"- Use \xab, \xbb para seleccionar el año\n" + +"- Use " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" + +"- Mantenga presionado el botón del ratón en cualquiera de las opciones superiores para un acceso rapido ."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Selección del Reloj:\n" + +"- Seleccione la hora para cambiar el reloj\n" + +"- o presione Shift-click para disminuirlo\n" + +"- o presione click y arrastre del ratón para una selección rapida."; + +Calendar._TT["PREV_YEAR"] = "Año anterior (Presione para menu)"; +Calendar._TT["PREV_MONTH"] = "Mes Anterior (Presione para menu)"; +Calendar._TT["GO_TODAY"] = "Ir a Hoy"; +Calendar._TT["NEXT_MONTH"] = "Mes Siguiente (Presione para menu)"; +Calendar._TT["NEXT_YEAR"] = "Año Siguiente (Presione para menu)"; +Calendar._TT["SEL_DATE"] = "Seleccione fecha"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastre y mueva"; +Calendar._TT["PART_TODAY"] = " (Hoy)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Mostrar %s primero"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Cerrar"; +Calendar._TT["TODAY"] = "Hoy"; +Calendar._TT["TIME_PART"] = "(Shift-)Click o arrastra para cambar el valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%dd-%mm-%yy"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y"; + +Calendar._TT["WK"] = "Sm"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sv.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sv.js new file mode 100644 index 0000000..db1f4b8 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-sv.js @@ -0,0 +1,93 @@ +// ** I18N + +// Calendar SV language (Swedish, svenska) +// Author: Mihai Bazon, +// Translation team: +// Translator: Leonard Norrgård +// Last translator: Leonard Norrgård +// Encoding: iso-latin-1 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("söndag", + "måndag", + "tisdag", + "onsdag", + "torsdag", + "fredag", + "lördag", + "söndag"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. +Calendar._SDN_len = 2; +Calendar._SMN_len = 3; + +// full month names +Calendar._MN = new Array +("januari", + "februari", + "mars", + "april", + "maj", + "juni", + "juli", + "augusti", + "september", + "oktober", + "november", + "december"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Om kalendern"; + +Calendar._TT["ABOUT"] = +"DHTML Datum/tid-väljare\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"För senaste version gå till: http://www.dynarch.com/projects/calendar/\n" + +"Distribueras under GNU LGPL. Se http://gnu.org/licenses/lgpl.html för detaljer." + +"\n\n" + +"Val av datum:\n" + +"- Använd knapparna \xab, \xbb för att välja år\n" + +"- Använd knapparna " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " för att välja månad\n" + +"- Håll musknappen nedtryckt på någon av ovanstående knappar för snabbare val."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Val av tid:\n" + +"- Klicka på en del av tiden för att öka den delen\n" + +"- eller skift-klicka för att minska den\n" + +"- eller klicka och drag för snabbare val."; + +Calendar._TT["PREV_YEAR"] = "Föregående år (håll för menu)"; +Calendar._TT["PREV_MONTH"] = "Föregående månad (håll för menu)"; +Calendar._TT["GO_TODAY"] = "Gå till dagens datum"; +Calendar._TT["NEXT_MONTH"] = "Följande månad (håll för menu)"; +Calendar._TT["NEXT_YEAR"] = "Följande år (håll för menu)"; +Calendar._TT["SEL_DATE"] = "Välj datum"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag för att flytta"; +Calendar._TT["PART_TODAY"] = " (idag)"; +Calendar._TT["MON_FIRST"] = "Visa måndag först"; +Calendar._TT["SUN_FIRST"] = "Visa söndag först"; +Calendar._TT["CLOSE"] = "Stäng"; +Calendar._TT["TODAY"] = "Idag"; +Calendar._TT["TIME_PART"] = "(Skift-)klicka eller drag för att ändra tid"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A %d %b %Y"; + +Calendar._TT["WK"] = "vecka"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-tr.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-tr.js new file mode 100644 index 0000000..2164687 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-tr.js @@ -0,0 +1,58 @@ +////////////////////////////////////////////////////////////////////////////////////////////// +// Turkish Translation by Nuri AKMAN +// Location: Ankara/TURKEY +// e-mail : nuriakman@hotmail.com +// Date : April, 9 2003 +// +// Note: if Turkish Characters does not shown on you screen +// please include falowing line your html code: +// +// +// +////////////////////////////////////////////////////////////////////////////////////////////// + +// ** I18N +Calendar._DN = new Array +("Pazar", + "Pazartesi", + "Salý", + "Çarþamba", + "Perþembe", + "Cuma", + "Cumartesi", + "Pazar"); +Calendar._MN = new Array +("Ocak", + "Þubat", + "Mart", + "Nisan", + "Mayýs", + "Haziran", + "Temmuz", + "Aðustos", + "Eylül", + "Ekim", + "Kasým", + "Aralýk"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Haftanýn ilk gününü kaydýr"; +Calendar._TT["PREV_YEAR"] = "Önceki Yýl (Menü için basýlý tutunuz)"; +Calendar._TT["PREV_MONTH"] = "Önceki Ay (Menü için basýlý tutunuz)"; +Calendar._TT["GO_TODAY"] = "Bugün'e git"; +Calendar._TT["NEXT_MONTH"] = "Sonraki Ay (Menü için basýlý tutunuz)"; +Calendar._TT["NEXT_YEAR"] = "Sonraki Yýl (Menü için basýlý tutunuz)"; +Calendar._TT["SEL_DATE"] = "Tarih seçiniz"; +Calendar._TT["DRAG_TO_MOVE"] = "Taþýmak için sürükleyiniz"; +Calendar._TT["PART_TODAY"] = " (bugün)"; +Calendar._TT["MON_FIRST"] = "Takvim Pazartesi gününden baþlasýn"; +Calendar._TT["SUN_FIRST"] = "Takvim Pazar gününden baþlasýn"; +Calendar._TT["CLOSE"] = "Kapat"; +Calendar._TT["TODAY"] = "Bugün"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; +Calendar._TT["TT_DATE_FORMAT"] = "d MM y, DD"; + +Calendar._TT["WK"] = "Hafta"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-zh.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-zh.js new file mode 100644 index 0000000..4a0feb6 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/calendar-zh.js @@ -0,0 +1,119 @@ +// ** I18N + +// Calendar ZH language +// Author: muziq, +// Encoding: GB2312 or GBK +// Distributed under the same terms as the calendar itself. + +// full day names +Calendar._DN = new Array +("ÐÇÆÚÈÕ", + "ÐÇÆÚÒ»", + "ÐÇÆÚ¶þ", + "ÐÇÆÚÈý", + "ÐÇÆÚËÄ", + "ÐÇÆÚÎå", + "ÐÇÆÚÁù", + "ÐÇÆÚÈÕ"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("ÈÕ", + "Ò»", + "¶þ", + "Èý", + "ËÄ", + "Îå", + "Áù", + "ÈÕ"); + +// full month names +Calendar._MN = new Array +("Ò»ÔÂ", + "¶þÔÂ", + "ÈýÔÂ", + "ËÄÔÂ", + "ÎåÔÂ", + "ÁùÔÂ", + "ÆßÔÂ", + "°ËÔÂ", + "¾ÅÔÂ", + "Ê®ÔÂ", + "ʮһÔÂ", + "Ê®¶þÔÂ"); + +// short month names +Calendar._SMN = new Array +("Ò»ÔÂ", + "¶þÔÂ", + "ÈýÔÂ", + "ËÄÔÂ", + "ÎåÔÂ", + "ÁùÔÂ", + "ÆßÔÂ", + "°ËÔÂ", + "¾ÅÔÂ", + "Ê®ÔÂ", + "ʮһÔÂ", + "Ê®¶þÔÂ"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "°ïÖú"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Ñ¡ÔñÈÕÆÚ:\n" + +"- µã»÷ \xab, \xbb °´Å¥Ñ¡ÔñÄê·Ý\n" + +"- µã»÷ " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " °´Å¥Ñ¡ÔñÔ·Ý\n" + +"- ³¤°´ÒÔÉϰ´Å¥¿É´Ó²Ëµ¥ÖпìËÙÑ¡ÔñÄê·Ý»òÔ·Ý"; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Ñ¡Ôñʱ¼ä:\n" + +"- µã»÷Сʱ»ò·ÖÖÓ¿Éʹ¸ÄÊýÖµ¼ÓÒ»\n" + +"- °´×¡Shift¼üµã»÷Сʱ»ò·ÖÖÓ¿Éʹ¸ÄÊýÖµ¼õÒ»\n" + +"- µã»÷Í϶¯Êó±ê¿É½øÐпìËÙÑ¡Ôñ"; + +Calendar._TT["PREV_YEAR"] = "ÉÏÒ»Äê (°´×¡³ö²Ëµ¥)"; +Calendar._TT["PREV_MONTH"] = "ÉÏÒ»Ô (°´×¡³ö²Ëµ¥)"; +Calendar._TT["GO_TODAY"] = "תµ½½ñÈÕ"; +Calendar._TT["NEXT_MONTH"] = "ÏÂÒ»Ô (°´×¡³ö²Ëµ¥)"; +Calendar._TT["NEXT_YEAR"] = "ÏÂÒ»Äê (°´×¡³ö²Ëµ¥)"; +Calendar._TT["SEL_DATE"] = "Ñ¡ÔñÈÕÆÚ"; +Calendar._TT["DRAG_TO_MOVE"] = "Í϶¯"; +Calendar._TT["PART_TODAY"] = " (½ñÈÕ)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "×î×ó±ßÏÔʾ%s"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "¹Ø±Õ"; +Calendar._TT["TODAY"] = "½ñÈÕ"; +Calendar._TT["TIME_PART"] = "(Shift-)µã»÷Êó±ê»òÍ϶¯¸Ä±äÖµ"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %b %eÈÕ"; + +Calendar._TT["WK"] = "ÖÜ"; +Calendar._TT["TIME"] = "ʱ¼ä:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/cn_utf8.js b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/cn_utf8.js new file mode 100644 index 0000000..a0ef7c6 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/lang/cn_utf8.js @@ -0,0 +1,123 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Translator : Niko +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("\u5468\u65e5",//\u5468\u65e5 + "\u5468\u4e00",//\u5468\u4e00 + "\u5468\u4e8c",//\u5468\u4e8c + "\u5468\u4e09",//\u5468\u4e09 + "\u5468\u56db",//\u5468\u56db + "\u5468\u4e94",//\u5468\u4e94 + "\u5468\u516d",//\u5468\u516d + "\u5468\u65e5");//\u5468\u65e5 + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("\u5468\u65e5", + "\u5468\u4e00", + "\u5468\u4e8c", + "\u5468\u4e09", + "\u5468\u56db", + "\u5468\u4e94", + "\u5468\u516d", + "\u5468\u65e5"); + +// full month names +Calendar._MN = new Array +("\u4e00\u6708", + "\u4e8c\u6708", + "\u4e09\u6708", + "\u56db\u6708", + "\u4e94\u6708", + "\u516d\u6708", + "\u4e03\u6708", + "\u516b\u6708", + "\u4e5d\u6708", + "\u5341\u6708", + "\u5341\u4e00\u6708", + "\u5341\u4e8c\u6708"); + +// short month names +Calendar._SMN = new Array +("\u4e00\u6708", + "\u4e8c\u6708", + "\u4e09\u6708", + "\u56db\u6708", + "\u4e94\u6708", + "\u516d\u6708", + "\u4e03\u6708", + "\u516b\u6708", + "\u4e5d\u6708", + "\u5341\u6708", + "\u5341\u4e00\u6708", + "\u5341\u4e8c\u6708"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "\u5173\u4e8e"; + +Calendar._TT["ABOUT"] = +" DHTML \u65e5\u8d77/\u65f6\u95f4\u9009\u62e9\u63a7\u4ef6\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: \u6700\u65b0\u7248\u672c\u8bf7\u767b\u9646http://www.dynarch.com/projects/calendar/\u5bdf\u770b\n" + +"\u9075\u5faaGNU LGPL. \u7ec6\u8282\u53c2\u9605 http://gnu.org/licenses/lgpl.html" + +"\n\n" + +"\u65e5\u671f\u9009\u62e9:\n" + +"- \u70b9\u51fb\xab(\xbb)\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e00\u5e74\u5ea6.\n" + +"- \u70b9\u51fb" + String.fromCharCode(0x2039) + "(" + String.fromCharCode(0x203a) + ")\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e2a\u6708\u4efd.\n" + +"- \u957f\u65f6\u95f4\u6309\u7740\u6309\u94ae\u5c06\u51fa\u73b0\u66f4\u591a\u9009\u62e9\u9879."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"\u65f6\u95f4\u9009\u62e9:\n" + +"-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u589e\u52a0\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\n" + +"-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u6309\u4f4fShift\u952e\u540e\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u51cf\u5c11\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)."; + +Calendar._TT["PREV_YEAR"] = "\u4e0a\u4e00\u5e74"; +Calendar._TT["PREV_MONTH"] = "\u4e0a\u4e2a\u6708"; +Calendar._TT["GO_TODAY"] = "\u5230\u4eca\u5929"; +Calendar._TT["NEXT_MONTH"] = "\u4e0b\u4e2a\u6708"; +Calendar._TT["NEXT_YEAR"] = "\u4e0b\u4e00\u5e74"; +Calendar._TT["SEL_DATE"] = "\u9009\u62e9\u65e5\u671f"; +Calendar._TT["DRAG_TO_MOVE"] = "\u62d6\u52a8"; +Calendar._TT["PART_TODAY"] = " (\u4eca\u5929)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "%s\u4e3a\u8fd9\u5468\u7684\u7b2c\u4e00\u5929"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "\u5173\u95ed"; +Calendar._TT["TODAY"] = "\u4eca\u5929"; +Calendar._TT["TIME_PART"] = "(\u6309\u7740Shift\u952e)\u5355\u51fb\u6216\u62d6\u52a8\u6539\u53d8\u503c"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e\u65e5"; + +Calendar._TT["WK"] = "\u5468"; +Calendar._TT["TIME"] = "\u65f6\u95f4:"; diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/multiple-dates.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/multiple-dates.html new file mode 100644 index 0000000..caf1920 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/multiple-dates.html @@ -0,0 +1,82 @@ + + + Sample for the multiple dates feature + + + + + + + + + + + + + + +

Sample for the multiple dates feature

+ +

+ Starting version 0.9.7, + the calendar is able to handle multiple dates selection, in either + flat or popup form. For this to happen one needs to pass the + "multiple: true" parameter to + Calendar.setup and to install an onUpdate + handler that watches for modifications. +

+ + [open calendar...] + +
+ + + +
+
mishoo
+ Last modified: Thu Mar 3 20:17:42 EET 2005 + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/release-notes.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/release-notes.html new file mode 100644 index 0000000..9addddb --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/release-notes.html @@ -0,0 +1,435 @@ + + + + jscalendar release notes + + + + + +
+ The Coolest DHTML Calendar
+ © Dynarch.com 2002 and later. +
+

jscalendar release notes

+ +

This release compiled at Monday, 7 Mar 2005 (19:06).

+ +

1.0

+ +
    + +
  • + Added support for multiple dates selection. In this mode the + calendar will allow the user to select more than one date, and + will maintain an array of selected dates that can be + investigated from your custom handlers. Sample in multiple-dates.html. +
  • + +
  • + Support for “day infoâ€�. Using this feature you can display + custom information for certain dates. Sample in dayinfo.html. Note that if the text + is really big the calendar layout might appear somehow broken; + this is something that should be easy to fix in the CSS file. +
  • + +
  • + Clicking on “Todayâ€� will now close the calendar if the current + date is already selected. +
  • + +
  • + The “first day of weekâ€� setting can now be defined in the + language file--after all, it is locale-specific. The new + parameter is “Calendar._FDâ€�. Language files should be + updated, but the calendar will not complain nor fail to + function if the parameter is not present. +
  • + +
  • + Some fixes to make the thing work in Safari. It now seems to + be properly supported, please let me know if you encounter any + problems. +
  • + +
  • + New skin: Aqua theme, appropriate for MacOSX fan sites :-) + This theme is located in “skins/aqua/theme.cssâ€� (in the + future, all themes will go to this directory). +
  • + +
  • + Bug fixes. +
      +
    • + Keyboard operation now functions normally when the + calendar is displaying days from adjacent months; it might + even work correctly for months containing disabled dates + :). This fix was originally developed under contract for + The + Zapatec Calendar. Zapatec kindly allowed us to + include the bugfixes back in the open source calendar. +
    • +
    • + Fixed the time selection bug: the previous version would + reset the time to current time when a new date was + clicked. +
    • +
    • + Parsing hours like "12:XX pm" would wrongfully replace + "pm" with "am"--fixed. +
    • +
    • + Fixed critical bugs in parseDate function that would + initialize the calendar with 'NaN' values in all cells if + the string to be parsed is not a valid date. +
    • +
    • + The golbal variable that we are using was renamed to + “_dynarch_popupCalendarâ€� to minimize the risk of name + clashes. It's still difficult to get rid of it. +
    • +
    • + Added z-index property to drop-down menus style. +
    • +
    • + The calendar will update an input field even in flat mode, + if an input field was passed. Also, the “showOthersâ€� + parameter will be effective in both popup and flat mode. +
    • +
    • + Others, probably. +
    • +
    +
  • + +
  • + Documentation & sample files updated. +
  • + +
+ +

0.9.6

+ +
    + +
  • + "Smart" (TM :-) positioning algorithm. The new algorithm will + try to keep the calendar in the browser view, which is helpful + in situations when the input field is near the bottom or the + right edge. This code is only tested with IE and Mozilla, but + it should work with other browsers too. Many thanks to Sunny Chowdhury for sponsoring + this feature! +
  • + +
  • + Support for IE5/Win is back. I also want to thank Janusz + Piwowarski for keeping his eye on the CVS ;-) He reviewed my + IE5-related changes and sent me a much cleaner patch. +
  • + +
  • + The calendar will now allow any day of week to be "the first + day of week". This was requested long time ago, by someone + whose name I forgot (sorry). The reason was that in certain + countries weeks start on Saturday. So I thought that instead + of having a "mondayFirst" and a "saturdayFirst" parameter, + :-), it's better to have a "firstDayOfWeek" parameter; now + it's present and its meaning is: "0 for Sunday", "1 for + Monday", "2 for Tuesday", etc. The equivalent parameter for + Calendar.setup is "firstDay". The end user can also change + it very easy: click on the day name in the calendar display. +
  • + +
  • + The above feature triggered one important change: the + notion of "weekend" is now defined in the language file. + Added parameters: + +
    +          Calendar._TT["WEEKEND"] = "0,6";
    +          Calendar._TT["DAY_FIRST"] = "Display %s first";
    + + "WEEKEND" specifies a string with comma-separated numbers from + 0 to 7; they define what days are marked as "weekend". 5 and + 6 mean, of course, "Sunday" and "Saturday". Day first is the + tooltip displayed when a day name is hovered; "%s" will get + replaced with the day name. Updated languages are "en" and + "ro", which I maintain. Please note that languages wich are + not updated will not work. If yours is one of them, + please consider fixing it and sending me the fix so that I can + include it in the distro. +
  • + +
  • + The calendar can now display days from the months adjacent to + the currently displayed one. This is optional, of course, and + the parameter name is "showsOtherMonths" (or "showOthers" in + Calendar.setup). All theme files were updated. +
  • + +
  • + Displays "Time:" near the time selector, only if defined in + the language file. +
  • + +
  • + Some bugs fixed in the date parsing code (which has also been + rewritten a little bit cleaner). +
  • + +
  • + Calendar.setup will now configure the calendar to trigger the + input fields' "onchange" event, if specified, when a date is + selected. +
  • + +
  • + New parameter in Calendar.setup: "cache" (defaults to + false). If set to true then the popup calendar object + will be "cached", meaning, it will be created only once, no + matter how many input fields are there in the page. Sometimes + this is not desirable, which is why I've added this + parameter. Please note that it defaults to "false" (thus the + default behavior has changed). +
  • + +
  • + Added a simple PHP wrapper. It provides code which loads all + the required scripts and theme file, and one function which + creates and configures an input field for date input. It + takes care of creating and assigning unique ID-s for the + calendar fields and it also creates the "Calendar.setup" code. + Functions to create more specialized fields can be added very + easily. This feature was requested by the FreeMED.org project + (thanks for donating!). +
  • + +
+ +

Wow, there were quite some changes :-D Enjoy it!

+ +

0.9.5

+ +

+ This release's primary goal is to fix a wrong license statement which + can be found in some files from 0.9.4. For instance in README or + calendar.js, the statement was that the code is distributed under the + GNU GPL; that's because I had plans to change the license, then + changed my mind but unfortunately I committed files so. I am sorry + for this inconvenience, please use the latest (0.9.5) release which is + fully covered by LGPL. +

+ +

Other changes:

+ +
    + +
  • + Fixed an annoying bug that prevented the calendar to display + correctly when it was configured for an input field inside a + scrolling area. Many thanks to Ian Barrack (Simban.com) who pointed it up and + donated quite some money for the Calendar project! +
  • + +
  • + All examples use UTF-8 now; the translations may not be all + up-to-date, but I strongly suggest everyone to use + UTF-8; other encodings are a plain mess. So far I know for sure + that Romanian translation will work with UTF-8 and not + anymore with ISO-8859-2. Other translations are probably + usable under UTF-8, but if your preferred language isn't... ;-) + please make it and send it to me for inclusion. +
  • + +
  • + Fixed small bug in the documentation (one footnote didn't appear + where it should have). +
  • + +
  • + Updated translations: DE, ES, HU, IT, RO. Thanks to everyone who + sent translations! +
  • + +
+ +

0.9.4

+ +

New stuff

+ +
    + +
  • Supports time selection. Yes. ;-) This work has been largely + sponsored by Himanshukumar Shah (thank you!). See + the docs and example files for details on how to setup.
  • + +
  • Easy to link 2 or more fields by using the new + onUpdate parameter of Calendar.setup. This + is useful, say, to automatically set a value in a second field based + on the value selected in the first field. See the documentation and + first sample in simple-1.html.
  • + +
  • Other Calendar.setup low-level parameters, for those + wanting to have the complete control: onSelect and + onClose. The handlers are called when something is + selected in the calendar or when the calendar is closed.
  • + +
  • The translation files can optionally include the short day names + and the short month names. That's because in some languages, like + German, the short form is not the first 3 letters of the entire name + but only the first 2. Also in other languages short names can't be + as easily derived from the full name by just calling substr, so this + patch solves the problem.
  • + +
  • Implemented a nice way to make some dates "special" (look + different). Specifically, the setDisabledHandler method + was replaced with the more general setDateStatusHandler + method (the old one is still available for backwards compatibility but + will be removed). More details about this in the + documentation. Also see simple-3.html + for a live sample.
  • + +
  • Date parsing and formatting engine is now rewritten and supports a + subset of strftime format specifiers from ANSI C. This + makes it possible to use dates like "YYYYMMDD" (the corresponding + format for this would be "%Y%m%d"). Details in the documentation. + Please note that the new engine is not compatibile with older + calendar releases!
  • + +
  • Along with the new date parser I workarounded an unpleasant crash + that occurred in IE when certain accented characters appeared in the + texts. I think German was one of the language with such problems, and + the workaround was to use the letter without an accent. Well, now you + can translate to whatever you want.
  • + +
  • "Fixes" (I mean, "horrible workarounds") for Konqueror (and + hopefully Safari). Unfortunately, this otherwise excellent browser + still has some bugs that keep the calendar from working + exactly as it should.. But they're going to be fixed, + right? ;-)
  • + +
  • CSS themes got pretty much modified too so if you wrote your theme + you need to update it. Aside for the time selector support, the CSS + themes contain a simple hack that makes the navigation buttons show + a little arrow in the lower-right corner which indicates that if one + holds the mouse a menu will appear.
  • + +
+ +

Translation files

+ +

The translation files need to be updated in order for the calendar to + work properly. Currently the only updated files are calendar-en.js + (main file) and calendar-ro.js (well, yes, I am a Romanian ;-).

+ +

Specifically, they need the following:

+ +
    + +
  • Correct date format, according with the new format specifiers + introduced in 0.9.4. Details about the available format specifiers + in the documentation
  • + +
  • Short day or month names, if required. If they can be + derived by taking the first N letters of the full name then a simple + Calendar._SDN_len = N or Calendar._SMN_len = N will suffice. If N + is 3 then nothing needs to be done as we take it for granted if no + other option is offered ;-)
  • + +
  • We have some new texts that shows short usage information as well + as copyright information.
  • + +
+ +

If your favorite language is not there yet, or it is but not updated + according to the main calendar-en.js file, then please consider + translating calendar-en.js and send the translation back to me so that + I include it in the official distribution.

+ +

Bug status

+ +

Check SourceForge, + I didn't keep track. However, there were a lot of bugfixes.

+ +

0.9.3

+ +

New stuff

+ +
    + +
  • Opera 7 compatibility — keyboard navigation is + still not available; text selection can't be disabled, leading to an + ugly effect when walking through the month/year menus.
  • + +
  • Ability to align the calendar relative to the input field (or any + other element). Vertical: top, center, bottom. Horizontal: left, + center, right. This is established as a new parameter for + showAtElement.
  • + +
  • Added dateClicked property (boolean). This can be + inspected in the "onSelect" handler to determine if a date was + really clicked or the user only changed month/year using the menus. + You need to check this for "single-click" calendars and + only close/hide the calendar if it's true.
  • + +
  • Full documentation in HTML + and PDF format is now available in the + distribution archive.
  • + +
  • New language definition files: HU, HR, PT, ZH. Thanks those who + submitted!
  • + +
+ +

Bug status

+ +

This covers only those bugs that have been reported at SourceForge.

+ +
    + +
  1. #703,238 — fixed
  2. +
  3. #703,814 — fixed
  4. +
  5. #716,777 — closed (was fixed already in 0.9.2-1)
  6. +
  7. #723,335 — fixed
  8. +
  9. #715,122 — feature request; implemented.
  10. +
  11. #721,206 — fixed (added "refresh()" function)
  12. +
  13. #721,833 — fixed (bug concerning the "yy" format + parsing)
  14. +
  15. #721,833 — won't fix (we won't set the time to + midnight; time might actually be useful when we implement support + for time selection). + +
+ +
+
Mihai Bazon
+ + +Last modified on Wed Oct 29 02:37:07 2003 + + + + + + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-1.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-1.html new file mode 100644 index 0000000..c2a944a --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-1.html @@ -0,0 +1,244 @@ + + + + + +Simple calendar setups [popup calendar] + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page lists some common setups for the popup calendar. In + order to see how to do any of them please see the source of this + page. For each example it's structured like this: there's the + <form> that contains the input field, and following there is + the JavaScript snippet that setups that form. An example of + flat calendar is available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +

Basic setup: one input per calendar. Clicking in the input field +activates the calendar. The date format is "%m/%d/%Y %I:%M %p". The +calendar defaults to "single-click mode".

+ +

The example below has been updated to show you how to create "linked" +fields. Basically, when some field is filled with a date, the other +is updated so that the difference between them remains one week. The +property useful here is "onUpdate".

+ +
+ + +
+ + + + + +
+ +

Input field with a trigger button. Clicking the button activates +the calendar. Note that this one needs double-click (singleClick parameter +is explicitely set to false). Also demonstrates the "step" parameter +introduced in 0.9.6 (show all years in drop-down boxes, instead of every +other year as default).

+ +
+ +
+ + + + + +
+ +

Input field with a trigger image. Note that the Calendar.setup +function doesn't care if the trigger is a button, image, or anything else. +Also in this example we setup a different alignment, just to show how it's +done. The input field is read-only (that is set from HTML).

+ +
+ + + +
+
+ + + + + +
+ +

Hidden field, display area. The calendar now puts the date into 2 +elements: one is an input field of type "hidden"—so that the user +can't directly see or modify it— and one is a <span> element in +which the date is displayed. Note that if the trigger is not specified the +calendar will use the displayArea (or inputField as in the first example). +The display area can have it's own format. This is useful if, for instance, +we need to store one format in the database (thus pass it in the input +field) but we wanna show a friendlier format to the end-user.

+ +
+ +
+ +

Your birthday: + Click to open date selector.

+ + + + + +
+ +

Hidden field, display area, trigger image. Very similar to the +previous example. The difference is that we also have a trigger image.

+ +
+ +
+ +

Your birthday: -- not entered -- .

+ + + + + +
+ +

Hidden field, display area. Very much like the previous examples, +but we now disable some dates (all weekends, that is, Saturdays and +Sundays).

+ +
+ +
+ +

Your birthday: + Click to open date selector.

+ + + + + + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-2.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-2.html new file mode 100644 index 0000000..b55bae8 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-2.html @@ -0,0 +1,108 @@ + + + + + +Simple calendar setup [flat calendar] + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page demonstrates how to setup a flat calendar. Examples of + popup calendars are available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +
+ + + +

The positioning of the DIV that contains the calendar is entirely your +job. For instance, the "calendar-container" DIV from this page has the +following style: "float: right; margin-left: 1em; margin-bottom: 1em".

+ +

Following there is the code that has been used to create this calendar. +You can find the full description of the Calendar.setup() function +in the calendar documenation.

+ +
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+ + + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-3.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-3.html new file mode 100644 index 0000000..c096e87 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/simple-3.html @@ -0,0 +1,130 @@ + + + + + +Simple calendar setup [flat calendar] + + + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page demonstrates how to setup a flat calendar. Examples of + popup calendars are available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +
+ + + +

The positioning of the DIV that contains the calendar is entirely your +job. For instance, the "calendar-container" DIV from this page has the +following style: "float: right; margin-left: 1em; margin-bottom: 1em".

+ +

Following there is the code that has been used to create this calendar. +You can find the full description of the Calendar.setup() function +in the calendar documenation.

+ +
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+ + + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/Thumbs.db b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/Thumbs.db new file mode 100644 index 0000000..520ef22 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/Thumbs.db differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/active-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/active-bg.gif new file mode 100644 index 0000000..d608c54 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/active-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/dark-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/dark-bg.gif new file mode 100644 index 0000000..1dea48a Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/dark-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/hover-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/hover-bg.gif new file mode 100644 index 0000000..fbf94fc Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/hover-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/menuarrow.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/menuarrow.gif new file mode 100644 index 0000000..40c0aad Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/menuarrow.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/normal-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/normal-bg.gif new file mode 100644 index 0000000..bdb5068 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/normal-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/rowhover-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/rowhover-bg.gif new file mode 100644 index 0000000..7715342 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/rowhover-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/status-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/status-bg.gif new file mode 100644 index 0000000..857108c Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/status-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/theme.css b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/theme.css new file mode 100644 index 0000000..18dd6cf --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/theme.css @@ -0,0 +1,236 @@ +/* Distributed as part of The Coolest DHTML Calendar + Author: Mihai Bazon, www.bazon.net/mishoo + Copyright Dynarch.com 2005, www.dynarch.com +*/ + +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #bdb2bf; + font-size: 11px; + color: #000; + cursor: default; + background: url("normal-bg.gif"); + font-family: "trebuchet ms",verdana,tahoma,sans-serif; +} + +.calendar { + border-color: #797979; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ + background: url("title-bg.gif") repeat-x 0 100%; color: #000; + font-weight: bold; +} + +.calendar .nav { + font-family: verdana,tahoma,sans-serif; +} + +.calendar .nav div { + background: transparent url("menuarrow.gif") no-repeat 100% 100%; +} + +.calendar thead tr { background: url("title-bg.gif") repeat-x 0 100%; color: #000; } + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + padding: 2px; + background: url("title-bg.gif") repeat-x 0 100%; color: #000; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #797979; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #c44; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background: url("hover-bg.gif"); + border-bottom: 1px solid #797979; + padding: 2px 2px 1px 2px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background: url("active-bg.gif"); color: #fff; + padding: 3px 1px 0px 3px; + border-bottom: 1px solid #797979; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: url("dark-bg.gif"); +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + font-family: verdana,tahoma,sans-serif; + width: 2em; + color: #000; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #999; +} +.calendar tbody .day.othermonth.oweekend { + color: #f99; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #797979; + background: url("dark-bg.gif"); +} + +.calendar tbody .rowhilite td, +.calendar tbody .rowhilite td.wn { + background: url("rowhover-bg.gif"); +} + +.calendar tbody td.today { font-weight: bold; /* background: url("today-bg.gif") no-repeat 70% 50%; */ } + +.calendar tbody td.hilite { /* Hovered cells */ + background: url("hover-bg.gif"); + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #c44; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border: 1px solid #797979; + padding: 1px 3px 1px 1px; + background: url("active-bg.gif"); color: #fff; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #565; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + padding: 2px; + background: url("status-bg.gif") repeat-x 0 0; color: #000; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #afa; + border: 1px solid #084; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #7c7; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border-width: 0 1px 1px 1px; + border-style: solid; + border-color: #797979; + background: url("normal-bg.gif"); color: #000; + z-index: 100; + font-size: 90%; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: url("hover-bg.gif"); color: #000; +} + +.calendar .combo .active { + background: url("active-bg.gif"); color: #fff; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #797979; + padding: 1px 0px; + text-align: center; + background: url("dark-bg.gif"); +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 5px 0px 6px; + font-weight: bold; + background: url("normal-bg.gif"); color: #000; +} + +.calendar td.time .hour, +.calendar td.time .minute { + font-family: monospace; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + background: url("hover-bg.gif"); color: #000; +} + +.calendar td.time span.active { + background: url("active-bg.gif"); color: #fff; +} diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/title-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/title-bg.gif new file mode 100644 index 0000000..6a541b3 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/title-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/today-bg.gif b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/today-bg.gif new file mode 100644 index 0000000..7161538 Binary files /dev/null and b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/skins/aqua/today-bg.gif differ diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/test-position.html b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/test-position.html new file mode 100644 index 0000000..5544871 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/test-position.html @@ -0,0 +1,40 @@ + + + + + JS Calendar (positioning test) + + + + + + + + + + + + +
+ + + + + + + +
+ + + diff --git a/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/test.php b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/test.php new file mode 100644 index 0000000..c9c2e28 --- /dev/null +++ b/lib/javascript/cal/jscalendar-1.0/jscalendar-1.0/test.php @@ -0,0 +1,116 @@ + + + + + +Test for calendar.php + + + section; it will "echo" code that loads the calendar +// scripts and theme file. +$calendar->load_files(); + +?> + + + + + + + +

Form submitted

+ + $val) { + echo htmlspecialchars($key) . ' = ' . htmlspecialchars($val) . '
'; +} ?> + + + +

Calendar.php test

+ +
+ Select language: +
+ NOTE: as of this release, 0.9.6, only "EN" and "RO", which I + maintain, function correctly. Other language files do not work + because they need to be updated. If you update some language file, + please consider sending it back to me so that I can include it in the + calendar distribution. +
+
+ +
+ + + + + + + +
+ Date 1: + + make_input_field( + // calendar options go here; see the documentation and/or calendar-setup.js + array('firstDay' => 1, // show Monday first + 'showsTime' => true, + 'showOthers' => true, + 'ifFormat' => '%Y-%m-%d %I:%M %P', + 'timeFormat' => '12'), + // field attributes go here + array('style' => 'width: 15em; color: #840; background-color: #ff8; border: 1px solid #000; text-align: center', + 'name' => 'date1', + 'value' => strftime('%Y-%m-%d %I:%M %P', strtotime('now')))); ?> +
+ +
+ + +
+ + + + + diff --git a/lib/javascript/cal/soso/calendar.js b/lib/javascript/cal/soso/calendar.js new file mode 100644 index 0000000..2891314 --- /dev/null +++ b/lib/javascript/cal/soso/calendar.js @@ -0,0 +1,111 @@ +// + +// Global Variables +var Dates = new Array(); +var HTTPO_Calendar = null; +var SelectedDay=''; +var CurrentDate=(new Date())/1000; +// Calendar Functions + +function Calendar_QURL(RQT){ + RetVal="feed.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentDate; + return RetVal; +}; + +function StartCalendarSession( httpRequestType ){ + var QURL=''; + if (HTTPO_Calendar == null ){ + HTTPO_Calendar = getHTTPObject(); + }; + if (HTTPO_Calendar != null) { + QURL=Calendar_QURL( httpRequestType ); + HTTPO_Calendar.open("GET", QURL , true); + HTTPO_Calendar.send(''); + HTTPO_Calendar.onreadystatechange = HGDT_Calendar; + Ext.MessageBox.wait("GetLabel('_Loading_Histo_');?>","GetLabel('_Please_Wait_');?>",{ + width: '100%', + hidden: true, + progress: true, + closable: false + }); + } else { + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CCXL00231'); + }; +}; + +function HGDT_Calendar(){ + switch( HTTPO_Calendar.readyState ){ + case 0: window.status = 'C:Communication is Uninitialized'; + break; + case 1: window.status = 'C:Loading Data'; + break; + case 2: window.status = 'C:Data is Loaded'; + break; + case 3: window.status = 'C:Communication is Interactive'; + break; + case 4: window.status = 'C:Data Load Complete'; + break; + }; + if( HTTPO_Calendar.readyState == 4 ){ + var T_Arr; + //alert(HTTPO_Calendar.responseText); + T_Arr = JSON_parse( HTTPO_Calendar.responseText,'' ); + httpRequestType=T_Arr.type/1; + //alert(httpRequestType); + Dates=new Array(); + for (index=0;index'; + InDTA+='SuMoTuWeThFrSa'; + InDTA+=''; + for(index=0;index'+(index-Msh+1).toString()+''; + } else { + InDTA+=''+(index-Msh+1).toString()+''; + } + if ((index+1)%7==0){ + InDTA+=''; + }; + }; + for(;(index)%7!=0;index++){ + InDTA+=' '; + }; + InDTA+=''; + + tab=document.getElementById('calendar_TD'); + tab.innerHTML=InDTA; +}; \ No newline at end of file diff --git a/lib/javascript/cal/soso/chat.js b/lib/javascript/cal/soso/chat.js new file mode 100644 index 0000000..a163b15 --- /dev/null +++ b/lib/javascript/cal/soso/chat.js @@ -0,0 +1,335 @@ +// + +var ChatModule; +var ChatModuleEnabled = false; +var ChatMode = 1; +var SoundEnabled = true; +var MessegesIntervalHandler; +var WiFiNetworksWindow; +var ChatPopUpWindow; +var ChatForwardingWindow; +var ChatQueryBusy = false; +var ChatForwardingLoader; + +function PopUpChatForwarding(){ + if( !ChatForwardingLoader ){ + ChatForwardingLoader = new Ext.tree.TreeLoader({ + dataUrl: 'lib/connector/json/chat_device_list.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID, + baseAttrs:{ + expanded: true + }, + listeners:{ + load: function( tre, tnode, response ){ + //alert('lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID); + //GMapToolbox.doLayout(); + //GMapToolbox.expand(); + if ( tnode.getPath() == InitTreeNodePath ){ + tnode.select(); + }; + } + } + }); + }; + if( !ChatForwardingWindow ){ + ChatForwardingWindow = new Ext.Window({ + title : "Forward Device Messeges", + layout : 'fit', + width : 300, + height : 440, + closeAction :'hide', + items: new Ext.tree.TreePanel({ + id:'chat-dev-tree', + title: "Chat Enabled Devices", + frame: true, + loader: ChatForwardingLoader, + rootVisible: true, + lines: true, + autoScroll:true, + root: new Ext.tree.AsyncTreeNode({ + text: '****', + expanded: true + }) + }), + buttons: [{ + text: 'Apply Changes', + handler: function(){ + A=ChatForwardingWindow.getComponent(0).getChecked('device_db_id'); + B=''; + for(i=0;i'/*, { + id: 'dis_ext_sound', + text: '', + iconCls: (( SoundEnabled )?'chat_mute_on_icon':'chat_mute_off_icon'), + tooltip: 'Mute Sound Notification', + handler: function(){ + if ( SoundEnabled ){ + Ext.Msg.show({ + title:'Disable Sound Notification', + width: 500, + msg: '
Are You Certain You Want To Do This ?
The Emergency Event and Ne', + buttons: Ext.Msg.YESNOCANCEL, + fn: function(btn, text){ + if (btn == 'yes'){ + SoundEnabled = false; + Ext.getCmp('dis_sound').setIconClass('chat_mute_off_icon'); + Ext.getCmp('dis_ext_sound').setIconClass('chat_mute_off_icon'); + } else { + SoundEnabled = true; + }; + }, + //animEl: 'elId', + icon: Ext.MessageBox.QUESTION + }); + if ( SoundEnabled ){ + niftyplayer('niftyPlayer1').loadAndPlay('/resources/sound/que.mp3'); + }; + } else { + SoundEnabled = true; + Ext.getCmp('dis_sound').setIconClass('chat_mute_on_icon'); + Ext.getCmp('dis_ext_sound').setIconClass('chat_mute_on_icon'); + }; + } + } */], + items: [{ + html: '


Loading Data ...
' + }] + })], + buttonAlign: 'right', + buttons: [ { + id: 'chat_ffwd_wnd', + text: 'Configure Forwaring', + handler: function(){ + PopUpChatForwarding(); + } + }] + }); + }; + //ChatMode = 2; + ChatPopUpWindow.show(); + Ext.getCmp('pc_dev').setText( DevNMS[CDevID] ); + StartCCalendarSession(); + //GetMesseges(); +}; +var PreviewTimer = null; +var PreviewLP; +var PreviewLZ; +var PreviewICO = null; +var PreviewMarker = null; +function BeginPreviewWP(a,b){ + if( PreviewTimer ){ + window.clearTimeout( PreviewTimer ); + }; + if( !PreviewICO ){ + PreviewICO = new GIcon(); + PreviewICO.image = "resources/markers/pos.gif"; + PreviewICO.iconSize = new GSize(32,32); + PreviewICO.iconAnchor = new GPoint(16,26); + PreviewICO.infoWindowAnchor = new GPoint (0,16); + }; + if( PreviewMarker ){ + map.removeOverlay( PreviewMarker ); + PreviewMarker = null; + }; + PreviewMarker = new GMarker( new GLatLng( b/1000000, a/1000000 ) , { + icon: PreviewICO, + zIndexProcess: function(){ + return 281250; + } + }); + map.addOverlay( PreviewMarker ); + PreviewLP = map.getCenter(); + PreviewLZ = map.getZoom(); + map.setCenter( new GLatLng( b/1000000, a/1000000 ) , PreviewLZ ); + map.checkResize(); + //alert( ' coords:'+a+'x'+b ); + PreviewTimer = window.setTimeout('EndPreviewWP();', 5000 ); // 5Sec; +}; +function EndPreviewWP(){ + window.clearTimeout( PreviewTimer ); + map.removeOverlay( PreviewMarker ); + PreviewMarker = null; + map.setCenter( PreviewLP, PreviewLZ ); + PreviewTimer = null; +}; +function GetMesseges(){ + if( !ChatQueryBusy ){ + ChatQueryBusy = true; + window.clearTimeout( MessegesIntervalHandler ); + Ext.Ajax.abort(); + Ext.MessageBox.hide(); + Ext.Ajax.request({ + url: 'lib/connector/json/get_messages.php?UID='+UserID+'&SID='+SessionID+'&DID='+ CDevID +'&mode='+ChatMode, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + if ( ChatMode == 1 ){ + var cdiv = document.getElementById('chat_div'); + } else { + var cdiv = document.getElementById('chat_ext_div'); + }; + if ( cdiv ){ + var i = 0; + var begin_in = '
'; + InDTA+=''; + InDTA+=''; + for(index=0;index'+(index-Msh+1).toString()+''; + InDTA+=''; + } else { + if( ( SD - 1 ) == index ){ + InDTA+=''; + } else { + InDTA+=''; + }; + }; + if ((index+1)%7==0){ + InDTA+=''; + }; + }; + for(;(index)%7!=0;index++){ + InDTA+=''; + }; + InDTA+='
'; + var begin_out = '
'; + var end = '
'; + cdiv.innerHTML = ''; + for( i=0; i< obj.rows.length; i++ ){ + if( obj.rows[i].src == 0 ){ + if ( obj.rows[i].status == 'R' ){ + status_t = ''; + } else { + status_t = ''; + }; + cdiv.innerHTML += begin_out + '
' + DevNMS[ CDevID ]+ ' ' + obj.rows[i].ts + status_t + '
' + obj.rows[i].body + '

' + end; + } else { + if ( obj.rows[i].status == 'R' ){ + if ( obj.rows[i].body == 'Emergency !!!') { + if ( SoundEnabled ) niftyplayer('niftyPlayer1').loadAndPlay('/resources/sound/beep.mp3'); + Ext.Msg.show({ + title:'Emergency !!', + msg: '
The device ' + DevNMS[ CDevID ] + '
Entered into Emergency Mode
', + buttons: Ext.Msg.OK, + width: 500, + fn: function(){ + if ( SoundEnabled ){ + niftyplayer('niftyPlayer1').stop(); + }; + }, + //animEl: 'elId', + icon: Ext.MessageBox.WARNING + }); + } else { + if ( SoundEnabled ) niftyplayer('niftyPlayer1').loadAndPlay('/resources/sound/ndr.mp3'); + }; + status_t = ''; + } else { + status_t = ''; + }; + if( ( obj.rows[i].lat != 0 ) && ( obj.rows[i].lon != 0 ) ){ + status_t += ' '; + } else { + status_t += ' '; + }; + cdiv.innerHTML += begin_in + '
' + DevNMS[ CDevID ] + ' ' + obj.rows[i].ts + status_t + '
' + obj.rows[i].body + '

' + end; + }; + }; + }; + ChatQueryBusy = false; + if ( ChatModuleEnabled ) MessegesIntervalHandler = window.setTimeout('GetMesseges();',20000); + }, + failure: function( response, opts ){ + ChatQueryBusy = false; + //Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + if ( ChatModuleEnabled ) MessegesIntervalHandler = window.setTimeout('GetMesseges();', 1000); + }/*, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' }*/ + }); + }; +}; + +function GetHistoryMesseges(){ + //if( !ChatQueryBusy ){ + //ChatQueryBusy = true; + //window.clearTimeout( MessegesIntervalHandler ); + Ext.Ajax.abort(); + Ext.MessageBox.hide(); + Ext.MessageBox.wait("GetLabel('_Loading_Histo_');?>","GetLabel('_Please_Wait_');?>",{ + width: '100%', + hidden: true, + progress: true, + closable: false + }); + Ext.Ajax.request({ + url: 'lib/connector/json/get_messages_history.php?UID='+UserID+'&SID='+SessionID+'&DID='+ CDevID +'&mode='+ChatMode + '&M=' + SM + '&D=' + SD + '&Y=' + SY, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + var cdiv = document.getElementById('chat_ext_div'); + if ( cdiv ){ + var i = 0; + var begin_in = '
'; + InDTA+=''; + InDTA+=''; + for(index=0;index'+(index-Msh+1).toString()+''; + } else { + InDTA+=''; + } + if ((index+1)%7==0){ + InDTA+=''; + }; + }; + for(;(index)%7!=0;index++){ + InDTA+=''; + }; + InDTA+='
'; + var begin_out = '
'; + var end = '
'; + cdiv.innerHTML = ''; + for( i=0; i< obj.rows.length; i++ ){ + if( obj.rows[i].src == 0 ){ + if ( obj.rows[i].status == 'R' ){ + status_t = ''; + } else { + status_t = ''; + }; + cdiv.innerHTML += begin_out + '
' + DevNMS[ CDevID ]+ ' ' + obj.rows[i].ts + status_t + '
' + obj.rows[i].body + '

' + end; + } else { + if ( obj.rows[i].status == 'R' ){ + status_t = ''; + } else { + status_t = ''; + }; + cdiv.innerHTML += begin_in + '
' + DevNMS[ CDevID ] + ' ' + obj.rows[i].ts + status_t + '
' + obj.rows[i].body + '

' + end; + }; + }; + }; + //ChatQueryBusy = false; + //if ( ChatModuleEnabled ) MessegesIntervalHandler = window.setTimeout('GetMesseges();',20000); + Ext.MessageBox.hide(); + }, + failure: function( response, opts ){ + //ChatQueryBusy = false; + //Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + //if ( ChatModuleEnabled ) MessegesIntervalHandler = window.setTimeout('GetMesseges();', 1000); + Ext.MessageBox.hide(); + } + }); + //}; +}; + diff --git a/lib/javascript/cal/soso/chat_calendar.js b/lib/javascript/cal/soso/chat_calendar.js new file mode 100644 index 0000000..02b2534 --- /dev/null +++ b/lib/javascript/cal/soso/chat_calendar.js @@ -0,0 +1,142 @@ +// + + +// Global Variables +var CDates = new Array(); +var HTTPO_CCalendar = null; +var SelectedCDay=''; +var CurrentCDate = Math.round((new Date())/1000); +// Calendar Functions + +function CCalendar_QURL(RQT){ + switch(RQT){ + default:{// Get Dates + RetVal="/lib/connector/json/get_messages_dates.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentCDate; + break; + }; + }; + //alert(RetVal); + return RetVal; +}; + +function StartCCalendarSession( httpRequestType ){ + var QURL=''; + if (HTTPO_CCalendar == null ){ + HTTPO_CCalendar = getHTTPObject(); + }; + if (HTTPO_CCalendar != null) { + QURL=CCalendar_QURL( httpRequestType ); + HTTPO_CCalendar.open("GET", QURL , true); + HTTPO_CCalendar.send(''); + HTTPO_CCalendar.onreadystatechange = HGDT_CCalendar; + Ext.MessageBox.wait("GetLabel('_Loading_Histo_');?>","GetLabel('_Please_Wait_');?>",{ + width: '100%', + hidden: true, + progress: true, + closable: false + }); + } else { + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CCXL00231'); + }; +}; + +function HGDT_CCalendar(){ + switch( HTTPO_CCalendar.readyState ){ + case 0: window.status = 'C:Communication is Uninitialized'; + break; + case 1: window.status = 'C:Loading Data'; + break; + case 2: window.status = 'C:Data is Loaded'; + break; + case 3: window.status = 'C:Communication is Interactive'; + break; + case 4: window.status = 'C:Data Load Complete'; + break; + }; + if( HTTPO_CCalendar.readyState == 4 ){ + var T_Arr; + //alert(HTTPO_CCalendar.responseText); + T_Arr = JSON_parse( HTTPO_CCalendar.responseText,'' ); + httpRequestType=T_Arr.type/1; + //alert(httpRequestType); + //CDates=new Array(); + for (index=0;index<31;index++){ + if ( index
SuMoTuWeThFrSa
'+(index-Msh+1).toString()+'
 
'; + + tab=document.getElementById('chat_calendar_TD'); + tab.innerHTML=InDTA; +}; \ No newline at end of file diff --git a/lib/javascript/cal/soso/extjs_gplogger.js b/lib/javascript/cal/soso/extjs_gplogger.js new file mode 100644 index 0000000..ebb7550 --- /dev/null +++ b/lib/javascript/cal/soso/extjs_gplogger.js @@ -0,0 +1,1471 @@ +function GetUserList(){ + Ext.Ajax.request({ + url: 'lib/connector/json/user_list.php?UID='+UserID+'&SID='+SessionID, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + UserListDataStore.loadData( obj ); + Ext.getCmp('user-list-grid').doLayout(); + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CEUL00227'); + }, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' } + }); +}; +function SetUserAddDescription(){ + CVal=Ext.getCmp('add_user_access_select').getValue(); + var DTX=Ext.getCmp('add_user_access_description'); + DTX.removeAll(); + switch( CVal ){ + case 1:{ + DTX.add({html:'Tracking Reviewer Access Level Will Grant:
  • Review Online Tracking
'}); + break; + }; + case 2:{ + DTX.add({html:'Report Reviewer Access Level Will Grant:
  • Review Online Tracking
  • Review and Print Reports
'}); + break; + }; + case 3:{ + DTX.add({html:'Report Manager Access Level Will Grant:
  1. Review Online Tracking
  2. Review and Print Reports
  3. Manage Report Events
'}); + break; + }; + case 4:{ + DTX.add({html:'Administrator Access Level Will Grant:
  • Review Online Tracking
  • Review and Print Reports
  • Manage Report Events
  • Manage Account Settings
  • Manage Account Users
'}); + break; + }; + }; + DTX.doLayout(); +}; + +function SetUserEditorDescription(){ + CVal=Ext.getCmp('edit_user_access_select').getValue(); + var DTX=Ext.getCmp('edit_user_access_description'); + DTX.removeAll(); + switch( CVal ){ + case 1:{ + DTX.add({html:'Tracking Reviewer Access Level Will Grant:
  • Review Online Tracking
'}); + break; + }; + case 2:{ + DTX.add({html:'Report Reviewer Access Level Will Grant:
  • Review Online Tracking
  • Review and Print Reports
'}); + break; + }; + case 3:{ + DTX.add({html:'Report Manager Access Level Will Grant:
  1. Review Online Tracking
  2. Review and Print Reports
  3. Manage Report Events
'}); + break; + }; + case 4:{ + DTX.add({html:'Administrator Access Level Will Grant:
  • Review Online Tracking
  • Review and Print Reports
  • Manage Report Events
  • Manage Account Settings
  • Manage Account Users
'}); + break; + }; + }; + DTX.doLayout(); +}; + +var UserListRecord = Ext.data.Record.create([ + 'id', + 'login', + 'status', + 'type', + 'created', + 'last_access' +]); + +var UserListDataStore = new Ext.data.Store({ + reader: new Ext.data.JsonReader({ + // The metadata property, with configuration options: + //totalProperty: "results", // the property which contains the total dataset size (optional) + root: "rows", // the property which contains an Array of row objects + idProperty: "id" // the property within each row object that provides an ID for the record (optional) + }, UserListRecord // Ext.data.Record constructor that provides mapping for JSON object + ) +}); + + +// DEEVICE LIST + +var DeviceListRecord = Ext.data.Record.create([ + 'id', + 'device_id', + 'status', + 'icon', + 'name', + 'created', + 'last_access', + 'sms' +]); + +var DeviceListDataStore = new Ext.data.Store({ + reader: new Ext.data.JsonReader({ + root: "rows", // the property which contains an Array of row objects + idProperty: "id" // the property within each row object that provides an ID for the record (optional) + }, DeviceListRecord // Ext.data.Record constructor that provides mapping for JSON object + ) +}); + +function GetDeviceList(){ + Ext.Ajax.request({ + url: 'lib/connector/json/device_list.php?UID='+UserID+'&SID='+SessionID, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + DeviceListDataStore.loadData( obj ); + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CEDL00226'); + }, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' } + }); +}; + +// New Device List + + var NDeviceListRecord = Ext.data.Record.create([ + 'id', + 'device_id' + ]); + + var NDeviceListDataStore = new Ext.data.Store({ + reader: new Ext.data.JsonReader({ + // The metadata property, with configuration options: + //totalProperty: "results", // the property which contains the total dataset size (optional) + root: "rows", // the property which contains an Array of row objects + idProperty: "id" // the property within each row object that provides an ID for the record (optional) + }, NDeviceListRecord // Ext.data.Record constructor that provides mapping for JSON object + ) + }); + + function GetNewDeviceList(){ + Ext.Ajax.request({ + url: 'lib/connector/json/new_device_list.php?UID='+UserID+'&SID='+SessionID, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + NDeviceListDataStore.loadData( obj ); + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + }, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' } + }); + }; + + +// Reports + +var SelectedRDevice; +var RepportDeviceButtonList = new Ext.Panel({ + id: 'New-Device-List', + //renderTo: RDeviceListDiv, + frame: true, + title: 'Report Manager', + bodyStyle:'padding: 5px;' +}); + +var RepportPlaceholderPanel = new Ext.Panel({ + id: 'New-Device-List', + //renderTo: RDeviceListDiv, + frame: true, + height: PanelH, + title: 'Reports', + bodyStyle:'padding: 5px;' +}); + + + function GetRepDevicesButtons(){ + Ext.Ajax.request({ + url: 'lib/connector/json/device_list.php?UID='+UserID+'&SID='+SessionID, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + for( index=0; index < obj.rows.length; index++ ){ + RepportDeviceButtonList.add({ + xtype: 'button', + param: obj.rows[index].device_id, + text: obj.rows[index].name, + width: '100%', + style: 'padding-top: 3px;', + handler: function( tb, e ){ + alert( tb.param ); + } + }); + }; + RepportDeviceButtonList.doLayout(); + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CEDL00224'); + }, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' } + }); + }; + + +Ext.onReady( function(){ + + + + Ext.QuickTips.init(); + + // turn on validation errors beside the field globally + Ext.form.Field.prototype.msgTarget = 'side'; + + + var UserListDiv = Ext.get('user_list'); + var DeviceListDiv = Ext.get('device_list'); + var NDeviceListDiv = Ext.get('ndevice_list'); + var RDeviceListDiv = Ext.get('rep_dev_list'); + var AddNewUserWindow; + var EditUserWindow; + + // MAP + + var gct_p = Ext.get('gmap_control_placeholder'); + var gct_t = Ext.get('gmap_control_toolbox'); + var gct_m = Ext.get('gmap_control_map'); + + var GMapToolbox = new Ext.Panel({ + title: 'Tools', + //renderTo: gct_t, + region:'west', + margins: '5 0 0 5', + width: 200, + height: PanelH, + collapsible: true, // make collapsible + //collapsed: true, + //collapseFirst: true, + cmargins: '5 5 0 5', // adjust top margin when collapsed + id: 'GMAP-Toolbox', + style: 'background: white; border: 1px solid black;', + hideCollapseTool: false, + layoutConfig: { + titleCollapse: true, + //animate: false, + activeOnTop: true + }, + items: [ + new Ext.Panel({ + //title: 'Tools', + //margins: '5 0 0 5', + width: 200, + height: PanelH - 220, + bodyBorder: true, + layout:'accordion', + unstyled: true, + defaults: { + // applied to each contained panel + bodyStyle: 'padding:5px', + frame: false + }, + layoutConfig: { + // layout-specific configs go here + //titleCollapse: false, + //animate: false + //activeOnTop: true + }, + items: [ + new Ext.tree.TreePanel({ + id:'im-tree', + title: 'Vehicles', + frame: true, + loader: new Ext.tree.TreeLoader({ + dataUrl: 'lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID, + baseAttrs:{ + expanded: true + }, + listeners:{ + load: function( me, node, response ){ + //alert('lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID); + //GMapToolbox.doLayout(); + //GMapToolbox.expand(); + if ( node.getPath() == InitTreeNodePath ){ + node.select(); + }; + } + } + }), + selModel: new Ext.tree.DefaultSelectionModel({ + listeners:{ + selectionchange: function ( me, node ){ + if (isNaN(node.id)){ + CDevID=node.id-1; + CQStyle=2 + RetriveData(); + } else { + CDevID=node.id-1; + CQStyle=0 + RetriveData(); + }; + } + } + }), + rootVisible:false, + lines:false, + autoScroll:true, + root: new Ext.tree.AsyncTreeNode({ + text:'All Devices', + expanded: true + }) + }), new Ext.Panel({ + title: 'Tracking Settings', + frame: true, + //style: 'background: white;', + align: 'center', + items: [ + { + layout: 'form', + frame: true, + items: [ + { + xtype:'label', + autoWidth: true, + fieldLabel: 'Tracking Mode' + }, + new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: 'Real Time Tracking', + listeners: { + 'check': function( me, checked ){ + if(checked){ + map.checkResize(); + StartTrackingSession(0); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + trackingMode = 1; + Ext.getCmp('history-settings').setVisible( false ); + try{ + Ext.getCmp('history-settings').doLayout(); + } catch (e){}; + }; + } + }, + id: 'track_type_r', + name: 'track_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: 'Tracking History', + listeners: { + 'check': function( me, checked ){ + if(checked){ + window.clearInterval(MapUpdateInterval); + trackingMode = 2; + StartCalendarSession(5); + Ext.getCmp('history-settings').setVisible( true ); + try{ + Ext.getCmp('history-settings').doLayout(); + } catch(e){}; + }; + } + }, + id: 'track_type_h', + name: 'track_type' + }) + ] + }, + new Ext.Spacer({ + height: 5, + style: 'background: white' + }), + { + xtype: 'tabpanel', + id: 'history-settings', + activeTab: 0, + height: 280, // Why do I have to specify the height here? + // Shouldn't its container's 'fit' layout take + // care of that? + //width: PanelH, + hidden: true, + border: false, + deferredRender: true, // This works + //defaults: {autoScroll: true}, + items: [ + { + layout: 'form', + title: 'Simple Param.', + frame: true, + //bodyStyle: 'padding 10px;', + labelWidth: 50, + defaults: { width: 80}, + items: [{ + html:'koko' + }/*, + new Ext.Slider({ + fieldLabel: 'Plot Number', + width: 150, + value: 50, + increment: 10, + minValue: 0, + maxValue: 100 + })*/ + ], + buttons: [{ + xtype: 'button', + text: 'Display History' + }] + },{ + layout: 'form', + title: 'Date/Time', + frame: true, + labelAlign: 'right', + labelWidth: 50, + defaults: { width: 80}, + items: [ + new Ext.form.TimeField({ + id: 'STimeFROM', + width: 120, + fieldLabel: 'From', + minValue: '00:00', + maxValue: '24:00', + increment: 30 + }), + new Ext.form.TimeField({ + id: 'STimeTO', + width: 50, + fieldLabel: 'Till', + minValue: '00:00', + maxValue: '24:00', + increment: 30 + }) + ], + html: '
', + buttons: [{ + xtype: 'button', + text: 'Display History' + }] + }] + } + ] + + }),new Ext.Panel({ + title: 'Map Settings', + frame: true, + //style: 'background: white;', + align: 'center', + items: [{ + layout: 'form', + //title: 'Address Info', + frame: true, + //labelAlign: 'center', + //style: 'text-align: center;', + //defaults: {width: 75}, + items: [ + { + xtype:'label', + autoWidth: true, + fieldLabel: 'Map Type' + }, + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: 'Regular Map', + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,1); + map.setMapType(G_NORMAL_MAP); + }; + } + }, + id: 'map_type_1', + name: 'map_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'sat', + boxLabel: 'Satelite Map', + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,2); + map.setMapType(G_SATELLITE_MAP); + }; + } + }, + id: 'map_type_2', + name: 'map_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'comb', + boxLabel: 'Hybrid Map (Satelite/Regular)', + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,3); + map.setMapType(G_HYBRID_MAP); + }; + } + }, + id: 'map_type_3', + name: 'map_type' + }) + ] + }, + new Ext.Spacer({ + height: 5, + style: 'background: white' + }), + { + layout: 'form', + frame: true, + items: [ + { + xtype:'label', + autoWidth: true, + fieldLabel: 'Advanced Options' + }, + new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: 'Show Traffic (If Possible)', + listeners: { + 'check': function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(12,1); + mapTrafficOverlay=new GTrafficOverlay(); + map.addOverlay( mapTrafficOverlay ); + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(12,0); + map.removeOverlay( mapTrafficOverlay ); + mapTrafficOverlay = null; + }; + }; + } + }, + id: 'map_show_traffic', + name: 'map_show_traffic' + }), + new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: 'sat', + boxLabel: 'Show Pan/Zoom Control', + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ) SaveSetting(11,1); + mapPZControlPosition = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10)); + mapPZControl = new GLargeMapControl3D(); + map.addControl( mapPZControl, mapPZControlPosition ); + } else { + if ( InitSetupParameters ) SaveSetting(11,0); + map.removeControl( mapPZControl ); + mapPZControlPosition = null; + mapPZControl = null; + }; + } + }, + id: 'map_show_ptz', + name: 'map_show_ptz' + }), + new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: 'red', + boxLabel: 'Connect WayPoints', + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(13,1); + polyline_r = new GPolyline(CPoints, "#ff0000", 5); + map.addOverlay( polyline_r ); + mapShowRedLine = true; + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(13,0); + mapShowRedLine = false; + map.removeOverlay( polyline_r ); + polyline_r = null; + }; + }; + } + }, + id: 'map_show_red', + name: 'map_show_red' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: '0', + boxLabel: 'Do Not Follow Vehicle', + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(8,0); + mapVehicleCentered = false; + mapAreaCentered = false; + }; + }; + } + }, + id: 'map_no_centered', + name: 'map_centered' + }),new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: '1', + boxLabel: 'Center to Vehicle', + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(8,1); + mapAreaCentered = false; + mapVehicleCentered = true; + map.panTo( CPoints[CPoints.length-1] ); + }; + }; + } + }, + id: 'map_vehicle_centered', + name: 'map_centered' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: '2', + boxLabel: 'Center to WayPoints Area', + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + if ( polygon_r == null ){ + polygon_r = new GPolygon(CPoints, "#808080", 5); + }; + SaveSetting(8,2); + map.panTo( polygon_r.getBounds().getCenter() ); + mapAreaCentered = true; + mapVehicleCentered = false; + }; + }; + } + }, + id: 'map_area_centered', + name: 'map_centered' + }), + new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: '', + boxLabel: 'Zoom to WayPoints Area', + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(7,1); + if ( polygon_r == null ){ + polygon_r = new GPolygon(CPoints, "#808080", 5); + } + map.setCenter( map.getCenter(), map.getBoundsZoomLevel( polygon_r.getBounds()) ); + mapShowZoomed = true; + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(7,0); + mapShowZoomed = false; + }; + }; + } + }, + id: 'map_show_zoomed', + name: 'map_show_zoomed' + }) + ] + } + ] + }) + ] + }), + new Ext.Panel({ + title: 'Info', + frame: true, + height: 150, + html: '
' + }) + ] + + }); + + + + + var GMapPanel = new Ext.Panel({ + title: 'Map', + width: '100%', + //renderTo: gct_m, + height: PanelH, + frame: true, + //margins: '0 0 0 0', + region: 'center', // center region is required, no width/height specified + //xtype: 'container', + layoutConfig: { + // layout-specific configs go here + //titleCollapse: true, + //animate: true + //renderHidden: true, + //activeOnTop: true + }, + layout: 'fit', + margins: '5 5 0 0', + html: '
' + //handlers + }); + + var GMapWindow = new Ext.Panel({ + width: '100%', + //renderTo: gct_p, + frame: true, + height: PanelH, + title: 'Online Tracking', + layout: 'border', + items: [ GMapPanel, GMapToolbox ] + }); + + function ShowAddNewUser(){ + // create the window on the first click and reuse on subsequent clicks + if( !AddNewUserWindow ){ + AddNewUserWindow = new Ext.Window({ + title : 'Add New User Dialog', + layout : 'fit', + width : 500, + height : 300, + closeAction :'hide', + plain : false, + resizable : false, + items : [ new Ext.FormPanel({ + id: 'add_user_form', + labelWidth: 150, // label settings here cascade unless overridden + //url:'lib/connector/add_user.php', + frame: true, + //bodyBorder: false, + //border: false, + //title: 'Simple Form', + bodyStyle:'padding:5px 5px 0', + width: '100%', + defaultType: 'textfield', + items: [{ + fieldLabel: 'User ID(Login)', + name: 'nnl', + width: 180, + allowBlank: false + },{ + fieldLabel: 'Password', + width: 180, + inputType: 'password', + name: 'npasswd' + },{ + fieldLabel: 'Retype Password', + width: 180, + inputType: 'password', + name: 'repasswd' + }, new Ext.form.ComboBox({ + id: 'add_user_access_select', + typeAhead: true, + width: 180, + triggerAction: 'all', + fieldLabel: 'User Access Level', + forceSelection: true, + hiddenName: 'type', + lazyRender: true, + mode: 'local', + listeners: { + select: SetUserAddDescription + }, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'val', + 'displayText' + ], + data: [[1, 'Tracking Reviewer'], [2, 'Report Reviewer'],[3, 'Report Manager'],[4, 'Administrator']] + }), + valueField: 'val', + displayField: 'displayText' + }), new Ext.Panel({ + id: 'add_user_access_description', + frame: true, + bodyBorder: true, + border: true, + collapsible: true, + width: '100%', + height: 100 + })] + })], + + buttons: [{ + text : 'Add New User', + disabled : false, + handler : function(){ + Ext.getCmp('add_user_form').getForm().submit({ + url: 'lib/connector/json/add_user.php?UID='+UserID+'&SID='+SessionID, + waitMsg:'Creating New User...', + success : function(){ + AddNewUserWindow.hide(); + } + }); + } + },{ + text : 'Cancel', + handler : function(){ + AddNewUserWindow.hide(); + } + }] + }); + } + AddNewUserWindow.show(UserListDiv); + }; + + + function ShowEditUser(){ + // create the window on the first click and reuse on subsequent clicks + if( !EditUserWindow ){ + EditUserWindow = new Ext.Window({ + title : 'Edit User Dialog', + layout : 'fit', + width : 500, + height : 300, + closeAction :'hide', + plain : false, + resizable : false, + items : new Ext.FormPanel({ + labelWidth: 150, // label settings here cascade unless overridden + id: 'edit_user_form', + url:'save-form.php', + frame: true, + bodyStyle:'padding:5px 5px 0', + width: '100%', + defaultType: 'textfield', + items: [{ + fieldLabel: 'User ID(Login)', + name: 'login', + width: 180, + //disabled: true, + readOnly: true, + allowBlank: false + },{ + fieldLabel: 'New Password', + inputType: 'password', + width: 180, + name: 'npasswd' + },{ + fieldLabel: 'Retype New Password', + inputType: 'password', + width: 180, + name: 'repasswd' + }, new Ext.form.ComboBox({ + typeAhead: true, + id: 'edit_user_access_select', + triggerAction: 'all', + width: 180, + fieldLabel: 'User Access Level', + forceSelection: true, + //lazyRender:true, + hiddenName: 'type', + mode: 'local', + listeners: { + select: SetUserEditorDescription + }, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'val', + 'displayText' + ], + data: [[1, 'Tracking Reviewer'], [2, 'Report Reviewer'],[3, 'Report Manager'],[4, 'Administrator']] + }), + valueField: 'val', + displayField: 'displayText' + }), new Ext.Panel({ + id: 'edit_user_access_description', + frame: true, + bodyBorder: true, + border: true, + collapsible: true, + width: '100%', + height: 100 + })] + }), + + buttons: [{ + text : 'Update', + disabled : false, + handler : function(){ + Ext.getCmp('edit_user_form').getForm().submit({ + url: 'lib/connector/json/update_user.php?UID='+UserID+'&SID='+SessionID, + waitMsg:'Updating User Data...', + success : function(){ + EditUserWindow.hide(); + GetUserList(); + } + }); + } + },{ + text : 'Cancel', + handler : function(){ + EditUserWindow.hide(); + } + }] + }); + } + EditUserWindow.show(UserListDiv); + }; + + function SuspendUser( UserLogin ){ + Ext.Ajax.request({ + url: 'lib/connector/json/suspend_user.php?UID='+UserID+'&SID='+SessionID+'&uln='+UserLogin, + success: function( response, opts ){ + GetUserList(); + } + }); + }; + + function ActivateUser( UserLogin ){ + Ext.Ajax.request({ + url: 'lib/connector/json/activate_user.php?UID='+UserID+'&SID='+SessionID+'&uln='+UserLogin, + success: function( response, opts ){ + GetUserList(); + } + }); + }; + + + GetUserList(); + + + function StatusRenderer(val){ + switch(val){ + case 0: return 'Suspended'; + case 1: return 'Active'; + }; + return ''; + }; + + function AccessLevelRenderer(val){ + switch(val){ + case 1: return 'Tracking Reviewer'; + case 2: return 'Report Reviewer'; + case 3: return 'Report Manager'; + case 4: return 'Administrator'; + case 5: return 'Account Holder'; + }; + return ''; + }; + + var UserListColModel = new Ext.grid.ColumnModel([ + {header: "User Name (Login)", sortable: true, locked: true, dataIndex: 'login'}, + {header: "Status", width: 85, sortable: true, renderer: StatusRenderer, dataIndex: 'status'}, + {header: "Access Level", width: 95, sortable: true, renderer: AccessLevelRenderer , dataIndex: 'type'}, + {header: "Active Since", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'created'}, + {header: "Last Activity", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'last_access'} + ]); + + var SelectedUser; + + var UserListGridForm = new Ext.FormPanel({ + id: 'User-List', + frame: true, + labelAlign: 'left', + title: 'List of Account Users', + bodyStyle:'padding: 5px; align: center;', + shim: false, + //animCollapse: false, + constrainHeader: true, + layout: 'fit', + items: { + xtype: 'grid', + ds: UserListDataStore, + cm: UserListColModel, + id: 'user-list-grid', + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec) { + if (!SelectedUser){ + SelectedUser=rec; + } else { + SelectedUser=rec; + if ( SelectedUser.data.type<5 ){ + Ext.getCmp('Suspend_AUB').enable(); + Ext.getCmp('Edit_AUB').enable(); + Ext.getCmp('Delete_AUB').enable(); + if ( SelectedUser.data.status>0 ){ + Ext.getCmp('Suspend_AUB').setText('Suspend'); + Ext.getCmp('Suspend_AUB').setTooltip('Suspend Access of Selected User'); + } else { + Ext.getCmp('Suspend_AUB').setText('Activate'); + Ext.getCmp('Suspend_AUB').setTooltip('Activate Access of Selected User'); + }; + } else { + Ext.getCmp('Edit_AUB').disable(); + Ext.getCmp('Suspend_AUB').disable(); + Ext.getCmp('Delete_AUB').disable(); + }; + }; + } + } + }), + //autoExpandColumn: 'login', + height: 350, + width: '100%', + forceFit: true, + border: false, + listeners: { + render: function(g) { + g.getSelectionModel().selectRow(0); + }, + delay: 20 // Allow rows to be rendered. + }, + viewConfig: { + forceFit:true + }, + bbar: [{ + tooltip: 'Create New User and Set Privilegies', + text: 'Add New', + iconCls:'user-add', + handler : function(){ + ShowAddNewUser(); + } + },{ + tooltip:'Edit Access Level of Selected User', + id: 'Edit_AUB', + text: 'Edit', + iconCls:'user-edit', + handler: function(){ + ShowEditUser(); + Ext.getCmp("edit_user_form").getForm().loadRecord(SelectedUser); + SetUserEditorDescription(); + }, + disabled: true + },{ + tooltip:'Suspend Access of Selected User', + id: 'Suspend_AUB', + text: 'Suspend', + iconCls:'user-block', + handler: function(){ + if ( SelectedUser.data.status>0 ){ + SuspendUser( SelectedUser.data.login ); + } else { + ActivateUser( SelectedUser.data.login ); + }; + }, + disabled: true + },{ + tooltip: 'Remove Selected User from Account', + id: 'Delete_AUB', + text:'Delete', + iconCls:'user-delete', + disabled: true, + handler: function(){ + Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', function (){ + + }); + } + }] + }, + renderTo: UserListDiv + }); + + + GetDeviceList(); + + function DevStatusRenderer(val){ + switch(val){ + case 0: return 'Off Line'; + case 1: return 'On Line'; + }; + return ''; + }; + + function IconRenderer( val ) { + if ( val > 0) { + return ''; + } + return val; + }; + function SMSRenderer( val ) { + if ( val!='Disabled' ) { + return 'SMS Reports to '+val+' Enabled'; + } else { + return 'SMS Reports '+val+''; + }; + return ''; + }; + + // the DefaultColumnModel expects this blob to define columns. It can be extended to provide + // custom or reusable ColumnModels + + var DeviceListColModel = new Ext.grid.ColumnModel([ + {header: "", width: 38, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: IconRenderer, dataIndex: 'icon'}, + {header: "Device ID", width: 120, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'device_id'}, + {header: "Vehicle ID", width: 120, sortable: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'name'}, + {header: "Status", width: 95, sortable: true, align: 'center', css: 'vertical-align: middle;', renderer: DevStatusRenderer, dataIndex: 'status'}, + {header: "SMS", width: 36, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', renderer: SMSRenderer, dataIndex: 'sms'}, + {header: "Active Since", width: 85, sortable: true, css: 'vertical-align: middle;', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'created'}, + {header: "Last Activity", width: 85, sortable: true, css: 'vertical-align: middle;', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'last_access'} + ]); + + var SelectedDevice; + + var DeviceListGridForm = new Ext.FormPanel({ + id: 'Device-List', + frame: true, + labelAlign: 'left', + title: 'List of Devices', + bodyStyle:'padding: 5px; align: center;', + shim: false, + //animCollapse: false, + constrainHeader: true, + + //layout: 'column', // Specifies that the items will now be arranged in columns + + layout: 'fit', + items: { + xtype: 'grid', + frame: false, + forceFit: true, + ds: DeviceListDataStore, + cm: DeviceListColModel, + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec) { + if (!SelectedUser){ + SelectedDevice=rec; + } else { + SelectedDevice=rec; + if ( SelectedDevice.data.type<5 ){ + Ext.getCmp('Suspend_AUB').enable(); + Ext.getCmp('Edit_AUB').enable(); + Ext.getCmp('Delete_AUB').enable(); + if ( SelectedDevice.data.status>0 ){ + Ext.getCmp('Suspend_AUB').setText('Suspend'); + Ext.getCmp('Suspend_AUB').setTooltip('Suspend Access of Selected User'); + } else { + Ext.getCmp('Suspend_AUB').setText('Activate'); + Ext.getCmp('Suspend_AUB').setTooltip('Activate Access of Selected User'); + }; + } else { + Ext.getCmp('Edit_AUB').disable(); + Ext.getCmp('Suspend_AUB').disable(); + Ext.getCmp('Delete_AUB').disable(); + }; + }; + } + } + }), + //autoExpandColumn: 'login', + height: 350, + width: '100%', + border: false, + listeners: { + render: function(g) { + g.getSelectionModel().selectRow(0); + }, + delay: 10 // Allow rows to be rendered. + }, + viewConfig: { + forceFit:true + }, + bbar: [{ + tooltip:'Edit Vehicle ID and Image', + id: 'Edit_DEV', + text: 'Edit', + iconCls:'user-edit', + handler: function(){ + //ShowEditUser(); + Ext.getCmp("edit_user_form").getForm().loadRecord(SelectedUser); + SetUserEditorDescription(); + }, + disabled: false + },{ + tooltip:'Setup Custom Events', + id: 'Events_DEV', + text: 'Events', + iconCls:'user-block', + handler: function(){ + if ( SelectedDevice.data.status>0 ){ + //SuspendUser( SelectedUser.data.login ); + } else { + //ActivateUser( SelectedUser.data.login ); + }; + }, + disabled: false + }] + }, + renderTo: DeviceListDiv + }); + + GetNewDeviceList(); + + function NewIconRenderer( val ) { + if ( val > 0) { + return ''+val+''; + } + return val; + }; + + // the DefaultColumnModel expects this blob to define columns. It can be extended to provide + // custom or reusable ColumnModels + + var NDeviceListColModel = new Ext.grid.ColumnModel([ + {header: "", width: 38, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: NewIconRenderer,dataIndex: 'id'}, + {header: "Device ID", width: 120, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'device_id'} + ]); + + + var SelectedNDevice; + + var NewDeviceListGridForm = new Ext.FormPanel({ + id: 'New-Device-List', + frame: true, + labelAlign: 'left', + title: 'Newly Purchased Devices', + bodyStyle:'padding: 5px; align: center;', + shim: false, + //animCollapse: false, + constrainHeader: true, + + //layout: 'column', // Specifies that the items will now be arranged in columns + + layout: 'fit', + items: { + xtype: 'grid', + frame: false, + forceFit: true, + ds: NDeviceListDataStore, + cm: NDeviceListColModel, + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec) { + if (!SelectedUser){ + SelectedNDevice=rec; + } else { + SelectedNDevice=rec; + if ( SelectedNDevice.data.type<5 ){ + Ext.getCmp('Suspend_AUB').enable(); + Ext.getCmp('Edit_AUB').enable(); + Ext.getCmp('Delete_AUB').enable(); + if ( SelectedDevice.data.status>0 ){ + Ext.getCmp('Suspend_AUB').setText('Suspend'); + Ext.getCmp('Suspend_AUB').setTooltip('Suspend Access of Selected User'); + } else { + Ext.getCmp('Suspend_AUB').setText('Activate'); + Ext.getCmp('Suspend_AUB').setTooltip('Activate Access of Selected User'); + }; + } else { + Ext.getCmp('Edit_AUB').disable(); + Ext.getCmp('Suspend_AUB').disable(); + Ext.getCmp('Delete_AUB').disable(); + }; + }; + } + } + }), + //autoExpandColumn: 'login', + height: 350, + width: '100%', + border: false, + listeners: { + render: function(g) { + g.getSelectionModel().selectRow(0); + }, + delay: 10 // Allow rows to be rendered. + }, + viewConfig: { + forceFit:true + }, + bbar: [{ + tooltip:'Add Purchased Elsewhere Device', + id: 'ANew_DEV', + text: 'Add', + iconCls:'user-block', + handler: function(){ + if ( SelectedDevice.data.status>0 ){ + //SuspendUser( SelectedUser.data.login ); + } else { + //ActivateUser( SelectedUser.data.login ); + }; + }, + disabled: false + },{ + tooltip:'Activate Selected Device', + id: 'Act_DEV', + text: 'Activate', + iconCls:'user-edit', + handler: function(){ + //ShowEditUser(); + Ext.getCmp("edit_user_form").getForm().loadRecord(SelectedUser); + SetUserEditorDescription(); + }, + disabled: true + },{ + tooltip:'Purchase Additional', + id: 'Purc_DEV', + text: 'Purchase', + iconCls:'user-block', + handler: function(){ + window.location='/Products.php'; + }, + disabled: false + }] + }, + renderTo: NDeviceListDiv + }); + + + + var AccountInfo = new Ext.FormPanel({ + //renderTo: document.body, + frame: true, + labelAlign: 'left', + title: 'Account Settings', + bodyStyle:'padding: 5px; align: center;', + //shim: false, + //animCollapse: false, + //constrainHeader: true, + //url: '/', + width: 500, + //height: 300, + layout: 'fit', + items: [ + { + xtype: 'tabpanel', + activeTab: 0, + height: 324, // Why do I have to specify the height here? + // Shouldn't its container's 'fit' layout take + // care of that? + width: PanelH, + border: false, + deferredRender: true, // This works + //defaults: {autoScroll: true}, + items: [ + { + title: 'Account Info', + frame: true, + bodyStyle: 'padding 10px;', + html: "This is just some text..." + }, + { + layout: 'form', + title: 'Address Info', + frame: true, + labelAlign: 'right', + defaults: {width: 175}, + items: [ + { + xtype: 'textfield', + name: 'address_1', + value: '', + fieldLabel: 'Street Adress' + },{ + xtype: 'textfield', + name: 'address_2', + value: '', + fieldLabel: 'City' + }, + { + xtype: 'combo', + hiddenName: 'state', + fieldLabel: 'State', + store: new Ext.data.SimpleStore({ + fields: ['abbr', 'state', 'tooltip'], + data : Ext.exampledata.states // from states.js + }), + editable: false, + allowBlank: true, + valueField:'abbr', + displayField:'state', + typeAhead: true, + mode: 'local', + triggerAction: 'all', + selectOnFocus:true + }, + { + xtype: 'combo', + hiddenName: 'country', + fieldLabel: 'Country', + store: new Ext.data.SimpleStore({ + fields: ['abbr', 'country', 'tooltip'], + data : Ext.exampledata.countries // from states.js + }), + editable: false, + allowBlank: true, + valueField:'abbr', + displayField:'country', + typeAhead: true, + mode: 'local', + triggerAction: 'all', + selectOnFocus:true + } + ] + } + ] + } + ], + bbar: [{ + tooltip: 'Save All Account Settings', + text: 'Save Changes', + iconCls:'account-save', + handler : function(){ + //ShowAddNewUser(); + } + }] + }); + + GetRepDevicesButtons(); + RepportPlaceholderPanel.render('rep_placeholder'); + RepportDeviceButtonList.render('rep_dev_list'); + AccountInfo.render('account_info'); + GMapWindow.doLayout(); + //GMapWindow.render('gmap_control_placeholder'); + //GMapToolbox.doLayout(); + //alert('koko2'); + //GMapPanel.doLayout(); + //alert('koko3'); + //GMapWindow.doLayout(); + //alert('koko4'); + //GMapToolbox.collapse(); + //alert('koko5'); + //GMapToolbox.doLayout(); + //alert('koko6'); + try { + GMapWindow.render('gmap_control_placeholder'); + } catch (e){ + + }; + Ext.MessageBox.wait('Loading items...','Please wait',{ + progressText: 'Initializing...', + width:300, + progress:true, + closable:false + }); + window.setTimeout(function(){ + GMapToolbox.expand(); + //GMapWindow.doLayout(); + }, 1000 ); + window.setTimeout(function(){ + Tracking_Init(); + }, 2000 ); +}); diff --git a/lib/javascript/cal/soso/extjs_tracker.js b/lib/javascript/cal/soso/extjs_tracker.js new file mode 100644 index 0000000..69dc70a --- /dev/null +++ b/lib/javascript/cal/soso/extjs_tracker.js @@ -0,0 +1,1444 @@ +// + +function SecRenderer(value){ + if(value>0){ + return ''; + } else { + return ''; + }; +}; +var WiFiListColModel = new Ext.grid.ColumnModel([ + {header: "GetLabel('_SECURITY_NET_');?>", width: 80, sortable: false, locked: true, menuDisabled: true, fixed: true, align: 'left', renderer: SecRenderer, dataIndex: 'wifi_sec'}, + {header: "GetLabel('_WIFI_NETNAME_');?>",width: 252, sortable: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'wifi_name'}, + {header: "GetLabel('_WIFI_CAPS_');?>", width: 100, sortable: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'wifi_cap'} +]); +var WiFiListRecord = Ext.data.Record.create([ + 'id', + 'wifi_name', + 'wifi_cap', + 'wifi_sec' +]); +var WiFiListDataStore = new Ext.data.Store({ + reader: new Ext.data.JsonReader({ + root: "rows", // the property which contains an Array of row objects + idProperty: "id" // the property within each row object that provides an ID for the record (optional) + }, WiFiListRecord // Ext.data.Record constructor that provides mapping for JSON object + ) +}); +function GetWiFiList(){ + Ext.Ajax.request({ + url: 'lib/connector/json/device_wlans.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID, + success: function( response, opts ){ + var obj = Ext.decode( response.responseText ); + WiFiListDataStore.loadData( obj ); + Ext.getCmp('wifi_grid').doLayout(); + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + }, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' } + }); +} + +var AddCategoryWindow; +var SelectedNode=null; // root + +function ShowAddWindow(){ + if( !AddCategoryWindow ){ + AddCategoryWindow = new Ext.Window({ + title : 'Add New Group', + layout : 'fit', + width : 300, + height : 120, + closeAction :'hide', + plain : false, + animateTarget: 'create_group', + resizable : false, + items : [ new Ext.FormPanel({ + id: 'add_catpan', + labelWidth: 100, // label settings here cascade unless overridden + //url:'/connector/json/add_devices_group.php', + frame: true, + //bodyBorder: false, + //border: false, + //title : 'The Geofencing Service', + bodyStyle:'padding:0px 0px 0', + width: '100%', + //layout : 'fit', + defaultType: 'textfield', + items: [{ + name : 'grp_name', + labelStyle : 'color: black;', + fieldLabel : 'New Group' + },{ + hidden : true, + value : SelectedNode.id, + name : 'grp_parent'//, + //fieldLabel : 'New Category' + }] + })], + buttons:[{ + text: 'Add', + listeners: { + click: function(){ + Ext.getCmp('add_catpan').getForm().submit({ + url: 'lib/connector/json/add_devices_group.php?UID='+UserID+'&SID='+SessionID+'', + waitMsg:'Creating New Group...', + params: { + parent: SelectedNode.id + }, + success: function ( aa, rr ){ + Ext.getCmp('dev-tree').getLoader().load(Ext.getCmp('dev-tree').root); + AddCategoryWindow.hide(); + }, + failure: function( aa, rr ){ + switch( rr.result.err_status ){ + case 'NEX': // Not Existed Key + Ext.Msg.show({ + title:'Activation Failed', + msg: '

You are entered activation code that
does not registered in', + buttons: Ext.Msg.OK, + width: 400, + icon: Ext.MessageBox.ERROR + }); + break; + } + } + }); + } + } + },{ + text: 'Cancel', + listeners: { + click: function(){ + AddCategoryWindow.hide(); + } + } + }] + }); + }; + AddCategoryWindow.show(); +}; +function SetIRStatus(a) { + if( a == 0 ){ + Ext.getCmp('ir_retrieve').setText('Request Sent'); + Ext.getCmp('ir_retrieve').disable(); + document.getElementById('ir_status_text').innerHTML='Queued'; + document.getElementById('ir_status_img').innerHTML=''; + } else { + Ext.getCmp('ir_retrieve').setText('Send Request'); + Ext.getCmp('ir_retrieve').enable(); + document.getElementById('ir_status_text').innerHTML='Idle'; + document.getElementById('ir_status_img').innerHTML=''; + }; +}; + +var HTTPO_IR = null; +var IR_TIMER = null; + +function StartIRSession(){ + var QURL=''; + if ( HTTPO_IR == null ){ + HTTPO_IR = getHTTPObject(); + }; + if ( HTTPO_IR != null ) { + QURL="/lib/connector/json/iridium_ping.php?UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&OP=CHLS"; + HTTPO_IR.open("GET", QURL , true); + HTTPO_IR.send(''); + HTTPO_IR.onreadystatechange = HGDT_IR; + } else { + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CSXL00221'); + }; +}; +function HGDT_IR(){ + switch(HTTPO_IR.readyState){ + case 0: window.status = 'IR:Communication is Uninitialized'; + break; + case 1: window.status = 'IR:Loading Data'; + break; + case 2: window.status = 'IR:Data is Loaded'; + break; + case 3: window.status = 'IR:Communication is Interactive'; + break; + case 4: window.status = 'IR:Data Load Complete'; + break; + }; + if( HTTPO_IR.readyState == 4 ){ + var T_Arr; + //alert( HTTPO_IR.responseText); + T_Arr = JSON_parse( HTTPO_IR.responseText,'' ); + httpRequestType=T_Arr.type/1; + //alert(httpRequestType); + if( T_Arr.status == 0 ){ + SetIRStatus(0); + if( IR_TIMER == null ){ + IR_TIMER = window.setInterval( 'StartIRSession();',20000); + }; + } else { + SetIRStatus(1); + if( IR_TIMER != null ){ + window.clearInterval( IR_TIMER ); + IR_TIMER = null; + }; + }; + }; +}; + +function ShowWiFiNetworks(){ + if( !WiFiNetworksWindow ){ + WiFiNetworksWindow = new Ext.Window({ + title : "GetLabel('_WIFI_NETS_RANGE');?>", + layout : 'fit', + width : 450, + height : 300, + closeAction :'hide', + plain : false, + resizable : false, + items : [ + { + xtype : 'grid', + id : 'wifi_grid', + height : 189, + frame: false, + forceFit: true, + //title: 'Geofencing Zones List', + ds: WiFiListDataStore, + cm: WiFiListColModel, + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec) { + SelectedZone=rec.data; + PreviewZone(SelectedZone.id); + } + } + }), + //autoExpandColumn: 'login', + width: '100%', + border: false + } + ], + buttons: [ + { + text: "GetLabel('_CLOSE_');?>", + handler: function(){ + WiFiNetworksWindow.hide(); + } + } + ]}); + }; + WiFiNetworksWindow.show(); + GetWiFiList(); +}; + +Ext.onReady( function(){ + + var gct_p = Ext.get('gmap_control_placeholder'); + var gct_t = Ext.get('gmap_control_toolbox'); + var gct_m = Ext.get('gmap_control_map'); + + var GMapToolbox = new Ext.Panel({ + title: "GetLabel('_Tools_');?>", + //renderTo: gct_t, + region:'west', + margins: '5 0 0 5', + width: 200, + height: PanelH, + collapsible: true, // make collapsible + //collapsed: true, + //collapseFirst: true, + cmargins: '5 5 0 5', // adjust top margin when collapsed + id: 'GMAP-Toolbox', + style: 'background: white; border: 1px solid black;', + hideCollapseTool: false, + layoutConfig: { + titleCollapse: true, + //animate: false, + activeOnTop: true + }, + items: [ + new Ext.Panel({ + id: 'acc_module', + //title: 'Tools', + //margins: '5 0 0 5', + width: 200, + height: PanelH - 160, + bodyBorder: true, + layout:'accordion', + unstyled: true, + defaults: { + // applied to each contained panel + bodyStyle: 'padding:5px', + frame: false + }, + layoutConfig: { + // layout-specific configs go here + //titleCollapse: false, + //animate: false + //activeOnTop: true + }, + items: [ + new Ext.tree.TreePanel({ + id:'dev-tree', + title: "GetLabel('_TRACK_DEVICES_');?>", + frame: false, + enableDD:true, + animate: true, + autoScroll:true, + dropConfig: {appendOnly:true}, + //containerScroll: true, + border: false, + loader: new Ext.tree.TreeLoader({ + dataUrl: 'lib/connector/json/tracking_device_tree.php?UID='+UserID+'&SID='+SessionID, + baseAttrs:{ + expanded: true + }, + listeners:{ + load: function( tre, tnode, response ){ + //alert('lib/connector/json/tracking_device_list.php?UID='+UserID+'&SID='+SessionID); + //GMapToolbox.doLayout(); + //GMapToolbox.expand(); + if ( tnode.getPath() == InitTreeNodePath ){ + tnode.select(); + }; + } + } + }), + listeners:{ + movenode: function( tt, nn, op, np, idx ){ + if( nn.attributes.device_db_id == 0 ){ + AURL = 'lib/connector/json/move_group_node.php?node='+nn.id+'&from='+op.id+'&to='+np.id+'&UID='+UserID+'&SID='+SessionID; + } else { + AURL = 'lib/connector/json/move_tracker_node.php?node='+nn.attributes.device_db_id+'&from='+op.id+'&to='+np.id+'&UID='+UserID+'&SID='+SessionID; + }; + Ext.Ajax.request({ + url: AURL, + success: function( response, opts ){ + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + }, + headers: { 'my-header': 'foo' }, + params: { foo: 'bar' } + }); + }, + click : function( tnode, evt ){ + SelectedNode= tnode; + //alert( tnode.getPath() ); + if ( PopUpShown ){ + if ( map.getExtInfoWindow() != null) { + map.closeExtInfoWindow(); + } + //Markers[ PopUpMarkerID ].closeExtInfoWindow(); + }; + if ( tnode.attributes.device_db_id == 0 ){ // Group Selected + Ext.getCmp('t_settings').disable(); + CDevID=tnode.id; + SaveSetting(2, CDevID ); + CQStyle = 2 + RetriveData(); + } else { // Device Selected + Ext.getCmp('t_settings').enable(); + if ( tnode.attributes.link_type == 'G' ){ + NumberOfPoints=OLD_NumberOfPoints; + Ext.getCmp('trh_simple').enable(); + Ext.getCmp('trh_sms').disable(); + Ext.getCmp('history-settings').setActiveTab('trh_simple'); + if ( SMS_timer != null ) window.clearInterval( SMS_timer ); + } else { + if ( tnode.attributes.link_type == 'I' ){ // Combined Mode = GPRS+SMS + NumberOfPoints=OLD_NumberOfPoints; + Ext.getCmp('trh_simple').enable(); + Ext.getCmp('trh_sms').enable(); + Ext.getCmp('history-settings').setActiveTab('trh_simple'); + SMS_timer=window.setInterval('StartSmsSession(9);',5000); + } else { + OLD_NumberOfPoints=NumberOfPoints; + NumberOfPoints=1; + Ext.getCmp('trh_simple').disable(); + Ext.getCmp('trh_sms').enable(); + Ext.getCmp('history-settings').setActiveTab('trh_sms'); + SMS_timer=window.setInterval('StartSmsSession(9);',5000); + }; + }; + CDevID=tnode.attributes.device_db_id; + SaveSetting(2, 'dev_'+CDevID ); + Ext.getCmp('ctrack_name').removeAll(); + Ext.getCmp('ctrack_name').add({ + html: "GetLabel('_TRACKER_DEV_');?>"+':  '+ tnode.text +'' + }); + Ext.getCmp('ctrack_name').doLayout(); + if( ( tnode.attributes.caps & 8 ) == 8 ){ + Ext.getCmp('ird_retrive').enable(); + StartIRSession(); + ChatModuleEnabled = true; + CurrentCDate = Math.round((new Date())/1000); + if ( !ChatModule ){ + ChatModule = Ext.getCmp('acc_module').insert( 1, new Ext.Panel({ + id: 'chat_module', + title: 'Online Chat', + listeners:{ + expand: function( pA ){ + GetMesseges(); + } + }, + tbar: [ {xtype: 'tbspacer'}, { xtype: 'tbtext', id: 'c_dev', text: '', style: 'color: white; font-weight: bold;' }, '->',{ + id: 'dis_sound', + text: '', + iconCls: 'chat_mute_on_icon', + tooltip: 'Mute Sound Notification', + handler: function(){ + if ( SoundEnabled ){ + Ext.Msg.show({ + title:'Disable Sound Notification', + width: 500, + msg: '
Are You Certain You Want To Do This ?
The Emergency Event and New Messages will appear Silently.
', + buttons: Ext.Msg.YESNOCANCEL, + fn: function(btn, text){ + if (btn == 'yes'){ + SoundEnabled = false; + Ext.getCmp('dis_sound').setIconClass('chat_mute_off_icon'); + } else { + SoundEnabled = true; + }; + }, + //animEl: 'elId', + icon: Ext.MessageBox.QUESTION + }); + if ( SoundEnabled ){ + niftyplayer('niftyPlayer1').loadAndPlay('/resources/sound/que.mp3'); + }; + } else { + SoundEnabled = true; + Ext.getCmp('dis_sound').setIconClass('chat_mute_on_icon'); + }; + } + }, '-', { + id: 'chat_popup_btn', + text: '', + iconCls: 'chat_popup_icon', + tooltip: 'Popup Chat Window', + handler: function(){ + PopUpChat(); + } + } ], + items: [{ + html: '
Loading Data ...
' + }, new Ext.form.TextField({ + id: 'chat_input', + width: '100%', + height: 25, + listeners: { + specialkey: function( field, e ){ + // e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN, + // e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN + if ( e.getKey() == e.ENTER ) { + CMSG=''; + CMSG=Ext.getCmp('chat_input').getValue(); + Ext.getCmp('chat_input').reset(); + Ext.getCmp('chat_send_btn').disable(); + if ( CMSG != ''){ + Ext.Ajax.request({ + url: 'lib/connector/json/send_message.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID, + success: function( response, opts ){ + Ext.getCmp('chat_send_btn').enable(); + GetMesseges(); + }, + failure: function( response, opts ){ + Ext.getCmp('chat_send_btn').enable(); + //Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + }, + headers: { + 'my-header': 'foo' + }, + params: { MSG: CMSG } + }); + }; + }; + } + } + }) + ], + buttonAlign: 'right', + buttons: [ { + id: 'chat_send_btn', + text: 'SEND', + handler: function(){ + CMSG=''; + CMSG=Ext.getCmp('chat_input').getValue(); + Ext.getCmp('chat_input').reset(); + Ext.getCmp('chat_send_btn').disable(); + if ( CMSG != ''){ + Ext.Ajax.request({ + url: 'lib/connector/json/send_message.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID, + success: function( response, opts ){ + Ext.getCmp('chat_send_btn').enable(); + GetMesseges(); + }, + failure: function( response, opts ){ + Ext.getCmp('chat_send_btn').enable(); + //Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + }, + headers: { + 'my-header': 'foo' + }, + params: { MSG: CMSG } + }); + }; + + } + } ] + }) ); + }; + Ext.getCmp('acc_module').doLayout(); + Ext.getCmp('c_dev').setText( tnode.text ); + } else { + SetIRStatus(1); + Ext.getCmp('ird_retrive').disable(); + if( IR_TIMER ){ + window.clearInterval( IR_TIMER ); + IR_TIMER = null; + }; + if( ChatModuleEnabled ){ + window.clearTimeout( MessegesIntervalHandler ); + ChatModuleEnabled = false; + Ext.getCmp('acc_module').remove( ChatModule, true ); + ChatModule = null; + Ext.getCmp('acc_module').doLayout(); + }; + }; + CQStyle=0; + RetriveData(); + }; + } + }, + tbar:[ '->',{ + id: 'create_group', + iconCls: 'add_group_icon', + text: '', + tooltip: 'Add New Group', + handler: function(){ + ShowAddWindow(); + } + },{ + id: 'delete_group', + iconCls: 'del_group_icon', + tooltip: 'Remove Group', + text: '', + handler: function(){ + if( SelectedNode != null ){ + if( SelectedNode.attributes.device_db_id == 0 ){ + if( SelectedNode.isExpanded() ){ + if( SelectedNode.hasChildNodes() ){ + Ext.Msg.show({ + title:'Error', + msg: '

You can not delete not empty group
', + buttons: Ext.Msg.OK, + width: 400, + icon: Ext.MessageBox.ERROR + }); + } else { + Ext.Ajax.request({ + url: 'lib/connector/json/delete_devices_group.php?UID='+UserID+'&SID='+SessionID+'&GID='+SelectedNode.id, + success: function( response, opts ){ + Ext.getCmp('dev-tree').getLoader().load(Ext.getCmp('dev-tree').root); + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + } + }); + }; + } else { + Ext.Msg.show({ + title:'Error', + msg: '

You can not delete collapsed group
', + buttons: Ext.Msg.OK, + width: 400, + icon: Ext.MessageBox.ERROR + }); + }; + }; + }; + } + }], + rootVisible:false, + lines: true, + autoScroll:true, + root: new Ext.tree.AsyncTreeNode({ + text: "GetLabel('_ALL_DEVICES_');?>", + expanded: true + }) + }), new Ext.Panel({ + id: 't_settings', + title: "GetLabel('_TRACK_SETTINGS_');?>", + frame: true, + //style: 'background: white;', + align: 'center', + items: [{ + id: 'ctrack_name', + width: 190, + height: 30 + },{ + xtype: 'tabpanel', + id: 'history-settings', + resizeTabs: true, + minTabWidth: 70, + activeTab: 0, + width: 190, + //height: 240, // Why do I have to specify the height here? + // Shouldn't its container's 'fit' layout take + // care of that? + //width: PanelH, + //hidden: true, + border: false, + deferredRender: true, // This works + //defaults: {autoScroll: true}, + listeners:{ + 'tabchange': function( tab , tab_p ){ + if(tab_p.id=='trh_dts'){ + window.clearInterval(MapUpdateInterval); + trackingMode = 2; + CQStyle=5; + StartCalendarSession(5); + //Ext.getCmp('history-settings').setVisible( true ); + try{ + Ext.getCmp('history-settings').doLayout(); + } catch(e){}; + } else { + map.checkResize(); + StartTrackingSession(0); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + trackingMode = 1; + CQStyle=0; + //Ext.getCmp('history-settings').setVisible( false ); + try{ + Ext.getCmp('history-settings').doLayout(); + } catch (e){}; + }; + //alert(trackingMode); + } + }, + items: [ + { + layout: 'form', + title: "GetLabel('_REAL_TIME_');?>", + frame: true, + id:'trh_simple', + tabWidth: 100, + //height: 180, + //labelWidth: 50, + //defaults: { width: 80}, + items: [new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: "GetLabel('_50_LAST_POINT_');?>", + listeners: { + 'check': function( ch, checked ){ + if(checked){ + NumberOfPoints=50; + OLD_NumberOfPoints=50; + SaveSetting(18,50); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + RetriveData(); + }; + } + }, + id: 'track_type_50', + name: 'track_type' + }), new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: "GetLabel('_25_LAST_POINT_');?>", + listeners: { + 'check': function( ch, checked ){ + if(checked){ + NumberOfPoints=25; + OLD_NumberOfPoints=25; + SaveSetting(18,25); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + RetriveData(); + }; + } + }, + id: 'track_type_25', + name: 'track_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: "GetLabel('_15_LAST_POINT_');?>", + listeners: { + 'check': function( ch, checked ){ + if(checked){ + NumberOfPoints=15; + OLD_NumberOfPoints=15; + SaveSetting(18,15); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + RetriveData(); + }; + } + }, + id: 'track_type_15', + name: 'track_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: "GetLabel('_5_LAST_POINT_');?>", + listeners: { + 'check': function( ch, checked ){ + if(checked){ + NumberOfPoints=5; + OLD_NumberOfPoints=5; + SaveSetting(18,5); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + RetriveData(); + }; + } + }, + id: 'track_type_5', + name: 'track_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + boxLabel: "GetLabel('_1_LAST_POINT_');?>", + listeners: { + 'check': function( ch, checked ){ + if(checked){ + NumberOfPoints=1; + OLD_NumberOfPoints=1; + SaveSetting(18,1); + window.clearInterval(MapUpdateInterval); + MapUpdateInterval=window.setInterval("RetriveData();",10000); + RetriveData(); + }; + } + }, + id: 'track_type_1', + name: 'track_type' + }), { + xtype: 'spacer', + height: 10 + }, { + xtype: 'panel', + id: 'ird_retrive', + frame: true, + disabled: true, + title: 'Retrieve Current Position', + items:[{ + html: '
Idle
' + }, { + xtype: 'button', + id: 'ir_retrieve', + width: '100%', + text: 'Send Request', + handler: function(){ + SetIRStatus( 0 ); + Ext.Ajax.request({ + url: 'lib/connector/json/iridium_ping.php?UID='+UserID+'&SID='+SessionID+'&DID='+CDevID+'&OP=REQP', + success: function( response, opts ){ + StartIRSession(); + }, + failure: function( response, opts ){ + SetIRStatus( 0 ); + } + }); + } + } + ] + } + ] + },{ + layout: 'form', + title: "GetLabel('_HISTORY_');?>", + id:'trh_dts', + frame: true, + height: 255, + labelAlign: 'right', + labelWidth: 50, + defaults: { width: 80}, + items: [ + new Ext.form.ComboBox({ + id: 'STimeFROM', + typeAhead: true, + width: 120, + triggerAction: 'all', + fieldLabel: "GetLabel('_FROM_TIME_');?>", + forceSelection: true, + allowBlank: false, + hiddenName: 'type', + //labelStyle: 'width: 150px;', + lazyRender: true, + mode: 'local', + value: '00:00', + listeners: { + select: function( me, mrec, idx ){ + SH=Math.floor( me.getValue()/60 ); + SM=me.getValue() - 60 * SH; + } + }, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'val', + 'displayText' + ], + data: [ + ['0000', '00:00'], + ['0030', '00:30'], + ['0060', '01:00'], + ['0090', '01:30'], + ['0120', '02:00'], + ['0150', '02:30'], + ['0180', '03:00'], + ['0210', '03:30'], + ['0240', '04:00'], + ['0270', '04:30'], + ['0300', '05:00'], + ['0330', '05:30'], + ['0360', '06:00'], + ['0390', '06:30'], + ['0420', '07:00'], + ['0450', '07:30'], + ['0480', '08:00'], + ['0510', '08:30'], + ['0540', '09:00'], + ['0570', '09:30'], + ['0600', '10:00'], + ['0630', '10:30'], + ['0660', '11:00'], + ['0690', '11:30'], + ['0720', '12:00'], + ['0750', '12:30'], + ['0780', '13:00'], + ['0810', '13:30'], + ['0840', '14:00'], + ['0870', '14:30'], + ['0900', '15:00'], + ['0930', '15:30'], + ['0960', '16:00'], + ['0990', '16:30'], + ['1020', '17:00'], + ['1050', '17:30'], + ['1080', '18:00'], + ['1110', '18:30'], + ['1140', '19:00'], + ['1170', '19:30'], + ['1200', '20:00'], + ['1230', '20:30'], + ['1260', '21:00'], + ['1290', '21:30'], + ['1320', '22:00'], + ['1350', '22:30'], + ['1380', '23:00'], + ['1410', '23:30'], + ['1439', '24:00'] + ] + }), + valueField: 'val', + displayField: 'displayText' + }),new Ext.form.ComboBox({ + id: 'STimeTO', + typeAhead: true, + width: 50, + triggerAction: 'all', + fieldLabel: "GetLabel('_TILL_TIME_');?>", + forceSelection: true, + allowBlank: false, + hiddenName: 'type', + //labelStyle: 'width: 150px;', + lazyRender: true, + mode: 'local', + value: '00:00', + listeners: { + select: function( me, mrec, idx ){ + EH=Math.floor( me.getValue()/60 ); + EM=me.getValue() - 60 * EH; + } + }, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'val', + 'displayText' + ], + data: [ + ['0000', '00:00'], + ['0030', '00:30'], + ['0060', '01:00'], + ['0090', '01:30'], + ['0120', '02:00'], + ['0150', '02:30'], + ['0180', '03:00'], + ['0210', '03:30'], + ['0240', '04:00'], + ['0270', '04:30'], + ['0300', '05:00'], + ['0330', '05:30'], + ['0360', '06:00'], + ['0390', '06:30'], + ['0420', '07:00'], + ['0450', '07:30'], + ['0480', '08:00'], + ['0510', '08:30'], + ['0540', '09:00'], + ['0570', '09:30'], + ['0600', '10:00'], + ['0630', '10:30'], + ['0660', '11:00'], + ['0690', '11:30'], + ['0720', '12:00'], + ['0750', '12:30'], + ['0780', '13:00'], + ['0810', '13:30'], + ['0840', '14:00'], + ['0870', '14:30'], + ['0900', '15:00'], + ['0930', '15:30'], + ['0960', '16:00'], + ['0990', '16:30'], + ['1020', '17:00'], + ['1050', '17:30'], + ['1080', '18:00'], + ['1110', '18:30'], + ['1140', '19:00'], + ['1170', '19:30'], + ['1200', '20:00'], + ['1230', '20:30'], + ['1260', '21:00'], + ['1290', '21:30'], + ['1320', '22:00'], + ['1350', '22:30'], + ['1380', '23:00'], + ['1410', '23:30'], + ['1439', '24:00'] + ] + }), + valueField: 'val', + displayField: 'displayText' + }),{ + width: '100%', + html: '
' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + width: '100%', + text: "GetLabel('_DISP_HISTORY_');?>", + listeners:{ + click: function( me, e){ + //alert(SMO+' '+SD); + CQStyle=3; + RetriveData(); + } + } + }] + },{ + title: 'SMS', + frame: true, + id:'trh_sms', + disabled: true, + //height: 200, + items: [ new Ext.Panel({ + title: "GetLabel('_TRACK_POINTS_');?>", + frame: true, + //height: 100, + html: '
'+ACC_sms_ammount+" GetLabel('_POINTS_');?>.
", + buttons: [{ + xtype: 'button', + text: "GetLabel('_PURCH_MORE_');?>", + listeners: { + click: function(){ + window.location='http://www.gplogger.com/Services.php?PCID=4'; + } + } + }] + }),new Ext.Spacer({ + height: 5, + style: 'background: white' + }),new Ext.Panel({ + title: "GetLabel('_TRACKING_');?>", + frame: true, + align: 'center', + items: [{ + layout: 'form', + items: [{ + xtype: 'button', + id: 'sms_button', + text: "GetLabel('_GET_POSITION_');?>", + width: '100%', + disabled: true, + style: 'padding-top: 3px;', + handler: function( tb, e ){ + if ( SMS_timer != null ) window.clearInterval( SMS_timer ); + Ext.getCmp('sms_button').disable(); + StartSmsSession(10); + } + }] + },new Ext.Spacer({ + height: 5, + style: 'background: white' + }),{ + layout: 'form', + height: 20, + html: '
'+"GetLabel('_STATUS_');?>"+':'+"GetLabel('_WAIT_UPDATE_');?>"+'
' + }] + })] + }] + } + ] + + }),new Ext.Panel({ + title: "GetLabel('_MAP_SETTINGS_');?>", + frame: true, + //style: 'background: white;', + align: 'center', + items: [{ + layout: 'form', + //title: 'Address Info', + frame: true, + //labelAlign: 'center', + //style: 'text-align: center;', + //defaults: {width: 75}, + items: [ new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "GetLabel('_REGULAR_MAP_');?>", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,1); + map.setMapType(G_NORMAL_MAP); + }; + } + }, + id: 'map_type_1', + name: 'map_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'sat', + boxLabel: "GetLabel('_SATELITE_MAP_');?>", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,2); + map.setMapType(G_SATELLITE_MAP); + }; + } + }, + id: 'map_type_2', + name: 'map_type' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'comb', + boxLabel: "GetLabel('_HYBRID_MAP_');?>", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,3); + map.setMapType(G_HYBRID_MAP); + }; + } + }, + id: 'map_type_3', + name: 'map_type' + }),new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "GetLabel('_MAPNIK_MAP_');?>", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,4); + map.setMapType( mapMapnik ); + }; + } + }, + id: 'map_type_4', + name: 'map_type' + }),new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "GetLabel('_OSMARE_MAP_');?>", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,5); + map.setMapType( mapOsmarender ); + }; + } + }, + id: 'map_type_5', + name: 'map_type' + }),new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "Google Terrain", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,6); + map.setMapType( mapTerrainA ); + }; + } + }, + id: 'map_type_6', + name: 'map_type' + }),new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "Open Cycle Map", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,7); + map.setMapType( mapTerrainB ); + }; + } + }, + id: 'map_type_7', + name: 'map_type' + })/*,new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "Yandex Map", + listeners: { + 'check': function( me, checked ){ + if( checked ){ + if ( InitSetupParameters ) SaveSetting(3,8); + map.setMapType( mapYandex ); + }; + } + }, + id: 'map_type_7', + name: 'map_type' + })*/ + ] + } + ] + }),new Ext.Panel({ + title: "GetLabel('_ADVANCED_SET_');?>", + frame: true, + //style: 'background: white;', + align: 'center', + items: [{ + layout: 'form', + frame: true, + items: [ new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "GetLabel('_SHOW_TRAFFIC_');?>", + listeners: { + 'check': function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(12,1); + mapTrafficOverlay=new GTrafficOverlay(); + map.addOverlay( mapTrafficOverlay ); + mapShowTraffic = true; + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(12,0); + if (mapTrafficOverlay!=null){ + map.removeOverlay( mapTrafficOverlay ); + mapTrafficOverlay = null; + }; + mapShowTraffic = false; + }; + }; + } + }, + id: 'map_show_traffic', + name: 'map_show_traffic' + }), new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: 'reg', + boxLabel: "GetLabel('_SHOW_GEOFENCE_');?>", + listeners: { + 'check': function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(19,1); + mapShowFence = true; + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(19,0); + mapShowFence = false; + for (index=0;indexGetLabel('_SHOW_PTZ_');?>", + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ) SaveSetting(11,1); + mapPZControlPosition = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10)); + mapPZControl = new GLargeMapControl3D(); + map.addControl( mapPZControl, mapPZControlPosition ); + } else { + if ( InitSetupParameters ) SaveSetting(11,0); + map.removeControl( mapPZControl ); + mapPZControlPosition = null; + mapPZControl = null; + }; + } + }, + id: 'map_show_ptz', + name: 'map_show_ptz' + }), + new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: 'red', + boxLabel: "GetLabel('_CONNECT_WP_');?>", + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(13,1); + polyline_r = new GPolyline(CPoints, "#ff0000", 5); + map.addOverlay( polyline_r ); + mapShowRedLine = true; + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(13,0); + mapShowRedLine = false; + map.removeOverlay( polyline_r ); + polyline_r = null; + }; + }; + } + }, + id: 'map_show_red', + name: 'map_show_red' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: '0', + boxLabel: "GetLabel('_NFOLOW_VC_');?>", + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(8,0); + mapVehicleCentered = false; + mapAreaCentered = false; + }; + }; + } + }, + id: 'map_no_centered', + name: 'map_centered' + }),new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: '1', + boxLabel: "GetLabel('_CENTER_TO_VC_');?>", + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(8,1); + mapAreaCentered = false; + mapVehicleCentered = true; + map.panTo( CPoints[CPoints.length-1] ); + }; + }; + } + }, + id: 'map_vehicle_centered', + name: 'map_centered' + }), + new Ext.form.Radio({ + width: 180, + hideLabel: true, + value: '2', + boxLabel: "GetLabel('_CENTER_TO_WA_');?>", + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + if ( polygon_r == null ){ + polygon_r = new GPolygon(CPoints, "#808080", 5); + }; + SaveSetting(8,2); + map.panTo( polygon_r.getBounds().getCenter() ); + mapAreaCentered = true; + mapVehicleCentered = false; + }; + }; + } + }, + id: 'map_area_centered', + name: 'map_centered' + }), + new Ext.form.Checkbox({ + width: 180, + hideLabel: true, + value: '', + boxLabel: "GetLabel('_ZOOM_TO_WA_');?>", + listeners: { + 'check':function( me, checked ){ + if ( checked ){ + if ( InitSetupParameters ){ + SaveSetting(7,1); + if ( polygon_r == null ){ + polygon_r = new GPolygon(CPoints, "#808080", 5); + } + map.setCenter( map.getCenter(), map.getBoundsZoomLevel( polygon_r.getBounds()) ); + mapShowZoomed = true; + }; + } else { + if ( InitSetupParameters ){ + SaveSetting(7,0); + mapShowZoomed = false; + }; + }; + } + }, + id: 'map_show_zoomed', + name: 'map_show_zoomed' + }) + ] + } + ] + }) + ] + }), + new Ext.Panel({ + title: "GetLabel('_LAST_POS_NFO_');?>", + frame: true, + height: 90, + html: '
' + }) + ] + + }); + var ts = new Ext.tree.TreeSorter( Ext.getCmp('dev-tree'), { folderSort:true }); + var te = new Ext.tree.TreeEditor( Ext.getCmp('dev-tree'),{},{ + //completeOnEnter: true, + autosize: true, + //ignoreNoChange: true, + listeners: { + complete: function(te,val,sval){ + if (sval!=val){ + //alert('Edited node'+te.editNode.id+" New Val:"+val); + if( te.editNode.attributes.device_db_id == 0 ){ + AURL = 'lib/connector/json/rename_group_node.php?node='+te.editNode.id+'&name='+val+'&UID='+UserID+'&SID='+SessionID; + } else { + AURL = 'lib/connector/json/rename_tracker_node.php?node='+te.editNode.attributes.device_db_id+'&name='+val+'&UID='+UserID+'&SID='+SessionID; + }; + Ext.Ajax.request({ + url: AURL, + success: function( response, opts ){ + }, + failure: function( response, opts ){ + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CENDL00225'); + }, + headers: { + 'my-header': 'foo' + }, + params: { foo: 'bar' } + }); + }; + } + } + }); + var GMapPanel = new Ext.Panel({ + title: "GetLabel('_MAP_');?>", + width: '100%', + //renderTo: gct_m, + height: PanelH, + frame: true, + //margins: '0 0 0 0', + region: 'center', // center region is required, no width/height specified + //xtype: 'container', + layoutConfig: { + // layout-specific configs go here + //titleCollapse: true, + //animate: true + //renderHidden: true, + //activeOnTop: true + }, + layout: 'fit', + margins: '5 5 0 0', + html: '
' + //handlers + }); + + var GMapWindow = new Ext.Panel({ + width: '100%', + //renderTo: gct_p, + frame: true, + height: PanelH, + title: "GetLabel('_ONLINE_TRACK_');?>", + layout: 'border', + items: [ GMapPanel, GMapToolbox ] + }); + + GMapWindow.doLayout(); + + try { + GMapWindow.render('gmap_control_placeholder'); + } catch (e){ + + }; + Ext.MessageBox.wait("GetLabel('_Load_Items_');?>","GetLabel('_Please_Wait_');?>",{ + progressText: 'Initializing...', + width: '100%', + hidden: true, + progress: true, + closable: false + }); + window.setTimeout(function(){ + GMapToolbox.expand(); + //GMapWindow.doLayout(); + }, 1000 ); + window.setTimeout(function(){ + Tracking_Init(); + }, 2000 ); + + //Ext.QuickTips.init(); + + // turn on validation errors beside the field globally + //Ext.form.Field.prototype.msgTarget = 'side'; +}); diff --git a/lib/javascript/jsapi_dynamic/rgoose_cameras.js b/lib/javascript/jsapi_dynamic/rgoose_cameras.js index d92da32..877d70b 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_cameras.js +++ b/lib/javascript/jsapi_dynamic/rgoose_cameras.js @@ -259,7 +259,6 @@ function preloadOnvifCredentials( SC ){ 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 ); var tpic = document.getElementById('pic_prev'); @@ -273,7 +272,6 @@ function preloadOnvifCredentials( SC ){ Ext.getCmp('lens_tab').disable(); Ext.getCmp('str_tab').disable(); Ext.getCmp('ptz_tab').disable(); - Ext.getCmp('loc_tab').disable(); Ext.getCmp('coc_tabs').setActiveTab( 0 ); sourceListStore.removeAll(); if( data.error != null ){ @@ -295,7 +293,6 @@ function preloadOnvifCredentials( SC ){ Ext.getCmp('lens_tab').disable(); Ext.getCmp('str_tab').disable(); Ext.getCmp('ptz_tab').disable(); - Ext.getCmp('loc_tab').disable(); Ext.getCmp('coc_tabs').setActiveTab( 0 ); sourceListStore.removeAll(); } @@ -322,7 +319,6 @@ function discoverOnvifProfiles( CamID, camUser, camPasswd ){ 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 ); var tpic = document.getElementById('pic_prev'); @@ -356,6 +352,24 @@ function showIPCamPropDialog(){ closeAction: 'hide', border: false, items:[{ + xtype: 'form', + width: '100%', + labelWidth: 200, + labelAlign: 'right', + labelSeparator: '', + items: [{ + xtype: 'spacer', + height: 5 + },{ + id: 'cam_label', + xtype: 'textfield', + fieldLabel: 'GetLabel('_CAM_MAP_NAME_');?>' + //width: 200 + },{ + xtype: 'spacer', + height: 5 + }] + },{ id: 'coc_tabs', xtype: 'tabpanel', activeTab: 0, @@ -413,11 +427,13 @@ function showIPCamPropDialog(){ },{ title: 'GetLabel('_STREAMS_');?>', id: 'str_tab', + frame: false, disabled: true, items:[{ xtype: 'grid', - title: 'GetLabel('_STREAMS_');?>', + //title: 'GetLabel('_STREAMS_');?>', height: 124, + frame: false, disableSelection: true, ds: sourceListStore, cm: sourceListColModel, @@ -452,6 +468,10 @@ function showIPCamPropDialog(){ lazyRender: true, id: 'sens_size', mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['size','size_txt'], data: [ @@ -470,7 +490,79 @@ function showIPCamPropDialog(){ ] }), valueField: 'size', - displayField: 'size_txt' + displayField: 'size_txt', + value: 0 + },{ + html: ' ' + },{ + html: 'Focal Length' + },{ + xtype: 'combo', + fieldLabel: 'Lens Focal Length', + lazyRender: true, + id: 'lens_fl', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['fl','fl_txt'], + data: [ + [0,'2.7 mm.'], + [1,'3.0 mm.'], + [2,'3.2 mm.'], + [3,'3.5 mm.'], + [4,'3.7 mm.'], + [5,'3.9 mm.'], + [6,'4.0 mm.'], + [7,'4.3 mm.'], + [8,'4.8 mm.'], + [9,'5.0 mm.'], + [10,'5.1 mm.'], + [11,'5.5 mm.'], + [12,'5.8 mm.'], + [13,'6.0 mm.'], + [14,'6.2 mm.'], + [15,'6.6 mm.'], + [16,'7.0 mm.'], + [17,'7.1 mm.'], + [18,'7.5 mm.'], + [19,'7.6 mm.'], + [20,'8.0 mm.'], + [21,'8.6 mm.'], + [22,'8.9 mm.'], + [23,'9.0 mm.'], + [24,'9.2 mm.'], + [25,'9.3 mm.'], + [26,'10.0 mm.'], + [27,'10.5 mm.'], + [28,'10.6 mm.'], + [29,'10.7 mm.'], + [30,'11.0 mm.'], + [31,'11.3 mm.'], + [32,'12.0 mm.'], + [33,'12.9 mm.'], + [34,'13.0 mm.'], + [35,'13.5 mm.'], + [36,'13.6 mm.'], + [37,'14.0 mm.'], + [38,'14.6 mm.'], + [39,'15.0 mm.'], + [40,'15.1 mm.'], + [41,'15.5 mm.'], + [42,'16.0 mm.'], + [43,'17.0 mm.'], + [44,'17.5 mm.'], + [44,'17.7 mm.'], + [45,'18.0 mm.'], + [46,'18.2 mm.'], + [47,'19.0 mm.'] + ] + }), + valueField: 'fl', + displayField: 'fl_txt', + value: 0 },{ html: ' ' },{ @@ -479,7 +571,7 @@ function showIPCamPropDialog(){ xtype: 'radio', id: 'no_zoom', name: 'zoom_ena', - value: 0, + value: 1, checked: true },{ html: ' ' @@ -490,62 +582,23 @@ function showIPCamPropDialog(){ id: 'on_zoom', hideLabel: false, fieldLabel: 'Variable Zoom', - html: 'koko', name: 'zoom_ena', - value: 1, + value: 0, checked: false, handler: function( a, c ){ if( c ){ - Ext.getCmp('max_foc').enable(); Ext.getCmp('zoom_val').enable(); - var mf = Ext.getCmp('min_foc').getValue(); - if( mf > 0 ){ - Ext.getCmp('max_foc').setValue( mf ); - Ext.getCmp('zoom_val').setValue( 1 ); - }; + Ext.getCmp('zoom_val').setValue( 1 ); + var zz = Ext.getCmp('zoom_d'); + if( zz.rendered ) zz.update('

X 1

'); } else { - Ext.getCmp('max_foc').disable(); Ext.getCmp('zoom_val').disable(); - Ext.getCmp('zoom_disp').update(' '); + var zz = Ext.getCmp('zoom_d'); + if( zz.rendered ) zz.update(' '); }; } },{ html: ' ' - },{ - html: 'Min. Focal Length' - },{ - xtype: 'numberfield', - id: 'min_foc', - width: '95%', - minValue: 1.0, - maxValue: 270.0 - },{ - html: ' ' - },{ - html: 'Max. Focal Length' - },{ - xtype: 'numberfield', - id: 'max_foc', - width: '95%', - disabled: true, - minValue: 1.0, - maxValue: 270.0, - listeners:{ - change: function( a, c, b ){ - if( b == c ) return; - var mf = Ext.getCmp('min_foc').getValue(); - if( mf > 0 ){ - if( c < mf ){ - Ext.getCmp('max_foc').setValue( mf ); - } else { - var zl = c / mf; - Ext.getCmp('zoom_val').setValue( zl ); - }; - }; - } - } - },{ - html: ' ' },{ html: 'Zoom Ratio' },{ @@ -556,15 +609,12 @@ function showIPCamPropDialog(){ maxValue: 40.0, listeners:{ change: function( a, c, b ){ - var mf = Ext.getCmp('min_foc').getValue(); - if( mf > 0 ){ - Ext.getCmp('max_foc').setValue( mf*c ); - Ext.getCmp('zoom_disp').update('

X '+ c + '

'); - }; + var zz = Ext.getCmp('zoom_d'); + if( zz.rendered ) zz.update('

X '+ c + '

'); } } },{ - id: 'zoom_disp', + id: 'zoom_d', html: ' ' }] }] @@ -591,6 +641,10 @@ function showIPCamPropDialog(){ lazyRender: true, id: 'ptz_proto', mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['type','type_txt'], data: [ @@ -602,6 +656,7 @@ function showIPCamPropDialog(){ [5,'GB/T28181'] ] }), + value: 0, valueField: 'type', displayField: 'type_txt', listeners:{ @@ -638,7 +693,11 @@ function showIPCamPropDialog(){ lazyRender: true, id: 'uart_id', mode: 'local', - disabled: true, + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + disabled: true, store: new Ext.data.ArrayStore({ fields: ['uart','uart_txt'], data: [GetLabel('_ADV_TAB_');?>', - disabled: true, - layout: 'table', - id: 'loc_tab', - border: false, - defaults: { - // applied to each contained panel - border: false, - frame: false, - bodyStyle: 'text-align:right;padding-left:10px;padding-right:10px;' - }, - layoutConfig: { - columns: 3 - }, - items: [{ - html: 'GetLabel('_CAM_MAP_NAME_');?>:' - },{ - id: 'cam_label', - xtype: 'textfield', - width: 200 - },{ - html: ' ' - }] }] }], bbar:[{ @@ -784,8 +831,8 @@ function showIPCamPropDialog(){ var CPANANG = Ext.getCmp('pan_ang').getValue(); var CTILTANG = Ext.getCmp('tilt_ang').getValue(); var CIMAGER = Ext.getCmp('sens_size').getValue(); - var CMINF = Ext.getCmp('min_foc').getValue(); - var CMAXF = Ext.getCmp('max_foc').getValue(); + var CLFL = Ext.getCmp('lens_fl').getValue(); + var CZOOM = Ext.getCmp('zoom_val').getValue(); var AllOK = true; if( CLAB == '' ) { AllOK = false; @@ -839,7 +886,7 @@ function showIPCamPropDialog(){ }; if( AllOK ){ Ext.Ajax.request({ - url: '/lib/controller/addCameraNode.php', + url: '/lib/controller/addNetworkNode.php', params: { SITEID: , UID: , @@ -854,16 +901,30 @@ function showIPCamPropDialog(){ PANANG: CPANANG, TILTANG: CTILTANG, IMSIZE: CIMAGER, - FMIN: CMINF, - FMAX: CMAXF, + LFL: CLFL, + ZOOM: CZOOM, PTZ: CPTZP, - CTYPE: SelectedCamTYPE + TYPE: SelectedCamTYPE }, success: function( response, opts ){ - addIpCamDialog.close(); - addIpCamDialog = null; - connectCamDialog.close(); - connectCamDialog = null; + var data = Ext.decode(response.responseText); + if( data.success ){ + addIpCamDialog.close(); + addIpCamDialog = null; + connectIPCamDialog.close(); + connectIPCamDialog = null; + } else { + Ext.Msg.show({ + title:'Error Message', + msg: data.msg, + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + //SettingsLidar3D.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; }, failure: failureAJAXFunction }); @@ -1508,16 +1569,27 @@ function addEthernet2Uart(){ modal: true, title: 'Add Ethernet To Serial Adapter', width: 400, - height: 300, + height: 540, layout: 'fit', closeAction: 'hide', items:[{ xtype: 'form', labelWidth: 120, // label settings here cascade unless overridden frame: false, - bodyStyle:'padding:5px 5px 0', + width: 400, + labelAlign: 'right', + //bodyStyle:'padding:5px 5px 0', defaultType: 'textfield', items:[{ + xtype: 'panel', + height: 200, + frame: false, + border: false, + html: '
' + },{ + fieldLabel: 'Name', + id: 'ued_name' + },{ xtype: 'combo', fieldLabel: 'Speed', id: 'ued_speed', @@ -1527,6 +1599,7 @@ function addEthernet2Uart(){ fields: ['speed'], data: [[19200], [115200]] }), + value: 19200, valueField: 'speed', displayField: 'speed' },{ @@ -1539,6 +1612,7 @@ function addEthernet2Uart(){ fields: ['bits'], data: [[5],[6],[7],[8],[9]] }), + value: 8, valueField: 'bits', displayField: 'bits' },{ @@ -1551,6 +1625,7 @@ function addEthernet2Uart(){ fields: ['stops'], data: [[1],[1.5],[2]] }), + value: 1, valueField: 'stops', displayField: 'stops' },{ @@ -1563,6 +1638,7 @@ function addEthernet2Uart(){ fields: ['parity'], data: [['Odd'], ['Even'],['None']] }), + value: 'None', valueField: 'parity', displayField: 'parity' },{ @@ -1575,6 +1651,7 @@ function addEthernet2Uart(){ fields: ['mode','mode_txt'], data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']] }), + value: 3, valueField: 'mode', displayField: 'mode_txt' },{ @@ -1582,7 +1659,11 @@ function addEthernet2Uart(){ id: 'ued_ip' },{ fieldLabel: 'IP Port', + value: 8234, id: 'ued_port' + },{ + fieldLabel: 'MAC Address', + id: 'ued_mac' }], bbar: [{ text: 'Cancel', @@ -1601,10 +1682,12 @@ function addEthernet2Uart(){ var MOD = Ext.getCmp('ued_mode').getValue(); var IP = Ext.getCmp('ued_ip').getValue(); var PORT= Ext.getCmp('ued_port').getValue(); + var MAC = Ext.getCmp('ued_mac').getValue(); + var NAME= Ext.getCmp('ued_name').getValue(); Ext.Ajax.request({ url: '/lib/controller/addNetworkNode.php', params: { - NID: , + SITEID: , TYPE: 20, UART_SPEED: SPD, UART_BITS: BIT, @@ -1613,6 +1696,8 @@ function addEthernet2Uart(){ UART_MODE: MOD, UART_IP: IP, UART_PORT: PORT, + UART_MAC: MAC, + UART_NAME: NAME, UID: , SID: '' }, diff --git a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js index 61c03cc..2e38922 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js +++ b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js @@ -61,7 +61,8 @@ function Draw3DTargets( k, b ){ for( var z = 0; z < b.length; z++ ){ var az = b[z].az * ( Math.PI/180.0 ); var el = b[z].el * ( Math.PI/180.0 ); - addl3dTarget( k, b[z].range, az, el, b[z].color ); + //addl3dTarget( k, b[z].range, az, el, b[z].color ); + addl3dTarget( k, 280, az, el, b[z].color ); }; }; @@ -775,27 +776,27 @@ function fetchSiteStatus(){ nodeDashboardStatuses[i] = data.nodes[i].status; switch( data.nodes[i].status ){ case 0:{ - if( data.nodes[i].type == 3 ) cleanupDraw( data.nodes[i].id ); + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); tt.update('
Offline
'); break; }; case 1:{ - if( data.nodes[i].type == 3 ) cleanupDraw( data.nodes[i].id ); + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); tt.update('
Online
'); break; }; case 2:{ - if( data.nodes[i].type == 3 ) cleanupDraw( data.nodes[i].id ); + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); tt.update('
Initializing
'); break; }; case 3:{ - if( data.nodes[i].type == 3 ) cleanupDraw( data.nodes[i].id ); + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); tt.update('
Trouble
'); break; }; case 4:{ - if( data.nodes[i].type == 3 ) DrawTargets( data.nodes[i].id, data.nodes[i].targets ); + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id, data.nodes[i].targets ); tt.update('
Alarm
'); break; }; @@ -1146,8 +1147,11 @@ function showSensorToolBox( NodeID ){ text: 'Force Study Background', scale: 'large', iconCls: 'ctrl_panel_study', - iconAlign: 'left' - }); + iconAlign: 'left', + handler: function(){ + doDeviceOperation( deviceCtrlNode, 2 ); + } + }); detectionProfileWindow.add({ xtype: 'button', width: '100%', diff --git a/lib/javascript/jsapi_dynamic/rgoose_devices.js b/lib/javascript/jsapi_dynamic/rgoose_devices.js index c3d9bdf..568beb3 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_devices.js +++ b/lib/javascript/jsapi_dynamic/rgoose_devices.js @@ -1288,7 +1288,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ items:[{ xtype: 'panel', width: cMapCanvasWidth, - html: '
' + html: '
' }], tbar:[{ text:'New Polygone', diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index 8d130ad..fcd54e1 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -4,6 +4,7 @@ var winW = Data['width']);?>; var winH = Data['height']);?>; var initView = Data['last_content_view']);?>; +var PanelW = winW; var PanelH = winH-90; var SelectedSite = ; var SettingsLidar3D = null; @@ -212,7 +213,15 @@ Ext.onReady(function(){ id:'go_monitor', text: 'GetLabel('_EVT_MONITOR_');?>', handler: function( b, e ){ - loadTimeLine(); + loadMonitoring(); + } + },{ + xtype: 'button', + width: '100%', + id:'go_archive', + text: 'GetLabel('_EVT_ARCHIVE_');?>', + handler: function( b, e ){ + loadArchive(); } },{ xtype: 'button', diff --git a/lib/javascript/jsapi_dynamic/rgoose_timeline.js b/lib/javascript/jsapi_dynamic/rgoose_timeline.js index 01c3280..ec6c40b 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_timeline.js +++ b/lib/javascript/jsapi_dynamic/rgoose_timeline.js @@ -13,6 +13,9 @@ var timelineObj = null; var tlGroups = new vis.DataSet(); var tlItems = new vis.DataSet(); +var selecredActiveSourceFilter = 0; +var ActiveZones = null; + var tlOptions = { groupOrder: 'content', // groupOrder can be a property name or a sorting function stack: true, @@ -27,6 +30,266 @@ var tlLastTS = 0; var tlInterval = null; var tlMonitoring = false; + + + +// Global Variables +var Dates = new Array(); +var HTTPO_Calendar = null; +var SelectedDay=''; +var CurrentDate=(new Date())/1000; +// Calendar Functions + +function Calendar_QURL(RQT){ + RetVal="feed.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentDate; + return RetVal; +}; + +function StartCalendarSession( httpRequestType ){ + var QURL=''; + if (HTTPO_Calendar == null ){ + HTTPO_Calendar = getHTTPObject(); + }; + if (HTTPO_Calendar != null) { + QURL=Calendar_QURL( httpRequestType ); + HTTPO_Calendar.open("GET", QURL , true); + HTTPO_Calendar.send(''); + HTTPO_Calendar.onreadystatechange = HGDT_Calendar; + Ext.MessageBox.wait("GetLabel('_Loading_Histo_');?>","GetLabel('_Please_Wait_');?>",{ + width: '100%', + hidden: true, + progress: true, + closable: false + }); + } else { + Ext.Msg.alert('Status', 'Error Creating AJAX Connection.
Code: CCXL00231'); + }; +}; + +function HGDT_Calendar(){ + switch( HTTPO_Calendar.readyState ){ + case 0: window.status = 'C:Communication is Uninitialized'; + break; + case 1: window.status = 'C:Loading Data'; + break; + case 2: window.status = 'C:Data is Loaded'; + break; + case 3: window.status = 'C:Communication is Interactive'; + break; + case 4: window.status = 'C:Data Load Complete'; + break; + }; + if( HTTPO_Calendar.readyState == 4 ){ + var T_Arr; + //alert(HTTPO_Calendar.responseText); + T_Arr = JSON_parse( HTTPO_Calendar.responseText,'' ); + httpRequestType=T_Arr.type/1; + //alert(httpRequestType); + Dates=new Array(); + for (index=0;index
SuMoTuWeThFrSa
'+(index-Msh+1).toString()+'
'+(index-Msh+1).toString()+'
'+(index-Msh+1).toString()+'
 
'; + tab=document.getElementById('calendar_TD'); + tab.innerHTML=InDTA; +}; + + +function loadCalendarDates(){ + Ext.MessageBox.wait("GetLabel('_Loading_Calo_');?>","GetLabel('_Please_Wait_');?>",{ + width: '100%', + hidden: true, + progress: true, + closable: false + }); + Ext.Ajax.request({ + url: '/lib/controller/getEventDates.php', + params: { + NID: selecredActiveSourceFilter, + UID: , + SID: '', + SYE: SY, + SMO: SMO + }, + success: function( response, opts ){ + Ext.MessageBox.hide(); + var data = Ext.decode( response.responseText ); + if( data.status == 'ok' ){ + Dates = data.days; + BuildCalendar(); + //for( var i = 0; i < data.days.length; i++ ){ + // + //}; + }; + }, + failure: function( response, opts ) { + Ext.MessageBox.hide(); + } + }); +}; + + + + + + + + var eventsListStore = new Ext.data.JsonStore({ root: 'log', totalProperty: 'totalCount', @@ -48,15 +311,15 @@ var eventsListStore = new Ext.data.JsonStore({ name: 'event', type: 'string' },{ - name: 'data', - type: 'string', + name: 'data', + type: 'string', },{ name: 'has_target', type: 'boolean' },{ name: 'has_geo', type: 'boolean' - }], + }] /*, proxy : new Ext.data.HttpProxy({ method: 'POST', prettyUrls: false, @@ -64,9 +327,9 @@ var eventsListStore = new Ext.data.JsonStore({ headers: { UID: , SID: '', - NID: 1 + NID: 1 } - }) + })*/ }); var SelectedEvent = 0; @@ -116,9 +379,15 @@ function ModeRenderer(val){ function LocRenderer( val ){ if( val ){ - return 'Location'; + return 'Location'; + }; + return 'NO Location'; +}; +function PicRenderer( val ){ + if( val ){ + return ''; }; - return 'NO Location'; + return ''; }; var eventsListColModel_ops = { @@ -129,7 +398,8 @@ var eventsListColModel_ops = { {header: "Device", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'device' }, {header: "Event", width: 80, sortable: false, dataIndex: 'event' }, {header: "Info", width: 200, sortable: false, dataindex: 'data' }, - {header: "", width: 20, sortable: false, dataIndex: 'has_geo', renderer: LocRenderer } + {header: "", width: 25, sortable: false, dataIndex: 'has_geo', renderer: LocRenderer }, + {header: "", width: 25, sortable: false, dataIndex: 'has_pic', renderer: PicRenderer } ], defaults: { sortable: true, @@ -183,6 +453,79 @@ function loadTimeLineGroups( NID ){ }); }; +function clickDeviceSelector( id ){ + var rr = document.getElementById(id+'_div'); + if( selecredActiveSourceFilter != id ){ + if( selecredActiveSourceFilter > 0 ){ + var oo = document.getElementById( selecredActiveSourceFilter + '_div'); + oo.classList.remove( "cardDeviceSourceSelected" ); + oo.classList.add( "cardDeviceSource" ); + }; + rr.classList.remove( "cardDeviceSource" ); + rr.classList.add( "cardDeviceSourceSelected" ); + selecredActiveSourceFilter = id; + turnOffAllGzButThis( selecredActiveSourceFilter ); + } else { + selecredActiveSourceFilter = 0; + rr.classList.remove( "cardDeviceSourceSelected" ); + rr.classList.add( "cardDeviceSource" ); + turnAllGzOn(); + var tPanel = Ext.getCmp('prop_content'); + tPanel.remove(0); + tPanel.add( { + title: 'Event Information', + border: false, + frame: false, + collapsible: false, + draggable: false, + html: '

Select an Event from TimeLine to See Information

' + } ); + tPanel.doLayout(); + + }; +}; +function getZoneByNode( nid ){ + var rVal = -1; + for( var i=0; i < ActiveZones.totalCount; i++ ){ + if( ActiveZones.zones[i].dev_id == nid ){ + rVal = i; + break; + }; + }; + return rVal; +}; + +function turnOffAllGzButThis( nid ){ + var chocho = -1; + for( var i=0; i < ActiveZones.totalCount; i++ ){ + if( ActiveZones.zones[i].dev_id == nid ) chocho = i; + map.removeLayer( ActiveZones.fig[i] ); + map.removeLayer( ActiveZones.zang[i] ); + map.removeLayer( ActiveZones.center[i] ); + }; + if( chocho > -1 ){ + map.addLayer( ActiveZones.fig[chocho] ); + map.addLayer( ActiveZones.zang[chocho] ); + map.addLayer( ActiveZones.center[chocho] ); + var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) ); + map.flyToBounds( cVisible.getBounds() ); + }; +}; + +function turnAllGzOn(){ + var tall = Array(); + for( var i=0; i < ActiveZones.totalCount; i++ ){ + tall[i*3] = ActiveZones.fig[i]; + tall[i*3+1] = ActiveZones.zang[i]; + tall[i*3+2] = ActiveZones.center[i]; + if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] ); + if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] ); + if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] ); + }; + var cVisible = L.featureGroup( tall ); + map.flyToBounds( cVisible.getBounds() ); +}; + function loadMapZones( SID ){ Ext.Ajax.request({ url: '/lib/controller/getGeoZones.php', @@ -194,98 +537,86 @@ function loadMapZones( SID ){ success: function( response, opts ){ // If the response is JSON, you have to decode it var data = Ext.decode(response.responseText); + var pp = Ext.getCmp('sources_panel'); + if( typeof pp !== 'undefined' ) pp.removeAll(); + ActiveZones = data; + ActiveZones.fig = new Array(); + ActiveZones.zang = new Array(); + ActiveZones.center = new Array(); for(var i = 0; i < data.totalCount; i++ ) { switch( data.zones[i].type ){ case 'circle':{ - L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map ); + //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map ); + ActiveZones.fig[i] = new L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ); + //map.addLayer( ActiveZones.fig[i] ); break; }; case 'poly':{ - L.polygon( data.zones[i].points, {color: data.zones[i].color, dashArray: "4 1 2 3", weight: 1, opacity: 0.8, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map); + ActiveZones.fig[i] = new L.polygon( data.zones[i].points, {color: data.zones[i].color, dashArray: "4 1 2 3", weight: 1, opacity: 0.8, clickable: false, interactive: false, bubblingMouseEvents: false });//.addTo(map); + //map.addLayer( ActiveZones.fig[i] ); break; }; case 'image':{ - L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 }).addTo( map ); + ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map ); + //map.addLayer( ActiveZones.fig[i] ); break; }; case 'image_rot':{ - L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, { + ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, { opacity: 0.8 //, //interactive: true, //attribution: "Historical building plan © Instituto Geográfico Nacional de España" - }).addTo( map ); + });//.addTo( map ); + //map.addLayer( ActiveZones.fig[i] ); break; }; }; + if( data.zones[i].dev_is_source ){ + if( typeof pp !== 'undefined' ) { + var sty = ''; + if( selecredActiveSourceFilter == data.zones[i].dev_id ){ + sty = 'cardDeviceSourceSelected'; + } else { + sty = 'cardDeviceSource'; + }; + pp.add( { + id: data.zones[i].dev_id+'_container', + frame: false, + border: false, + width: 130, + height: 130, + html: '

'+data.zones[i].dev_name+'

' + }); + }; + }; if( data.zones[i].zang != undefined ){ //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map); - L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } ).addTo( map ); + ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map ); }; if( data.zones[i].center != undefined ){ //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map); - L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } ).addTo( map ); + ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } ).addTo( map ); }; }; - //tlGroups.update( data ); - //loadTimeLineItems( selectedSite ); - LoadMapEvents( SelectedSite ); - tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite ); - }, - failure: function( response, opts ) { - //Ext.fly('some_div').update('Fail!'); - } - }); -}; - -function loadTimeLineItems( NID ){ - if( tlLoadLocker ) return; - tlLoadLocker = true; - Ext.Ajax.request({ - url: '/lib/controller/getTimeLineEvents.php', - params: { - NID: NID, - UID: , - SID: '', - LTS: tlLastTS - }, - success: function( response, opts ){ - // If the response is JSON, you have to decode it - var data = Ext.decode(response.responseText); - var i = 0; - for(; i < data.length; i++ ){ - tlLastTS = data[i].start; - data[i].start = moment.utc( ''+data[i].start, 'X' ); - tlItems.add( data[i] ); - }; - if( timelineObj == null ){ - var container = document.getElementById('timeline'); - timelineObj = new vis.Timeline( container ); - timelineObj.setOptions( tlOptions ); - timelineObj.setGroups( tlGroups ); - timelineObj.setItems( tlItems ); - timelineObj.on('select', function (properties) { - //alert( properties.items[0] ); - loadEventProperties( properties.items[0] ); - //logEvent('select', properties.items[0]); - }); + if( selecredActiveSourceFilter == 0 ){ + turnAllGzOn(); } else { - timelineObj.redraw(); + turnOffAllGzButThis( selecredActiveSourceFilter ); }; - if( tlMonitoring ) timelineObj.moveTo( moment.utc() ); - - eventsListStore.reload(); - - tlLoadLocker = false; + if( typeof pp !== 'undefined' ) pp.doLayout(); + //LoadMapEvents( SelectedSite ); + //tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite ); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!'); - tlLoadLocker = false; } }); }; + var cevt = Array(); var coz = Array(); -function LoadMapEvents( SID ){ + +function LoadMapEventsZ( SID ){ if( tlLoadLocker ) return; tlLoadLocker = true; Ext.Ajax.request({ @@ -332,7 +663,7 @@ function LoadMapEvents( SID ){ }; }; - eventsListStore.reload(); + //eventsListStore.reload(); tlLoadLocker = false; }, failure: function( response, opts ) { @@ -366,8 +697,228 @@ function loadEventProperties( EventID ){ }); }; +function getData( Mode ){ + if( tlLoadLocker ) return; + tlLoadLocker = true; + Ext.Ajax.request({ + url: '/lib/controller/getEventRecords.php', + params: { + SITE: , + UID: , + SID: '', + MODE: Mode, + FIL: selecredActiveSourceFilter, + SDA: SD, + SMO: SMO, + SYE: SY, + STM: 0, + ETM: 0, + }, + success: function( response, opts ){ + tlLoadLocker = false; + var data = Ext.decode(response.responseText); + eventsListStore.loadData( data, false ); + + }, + failure: failureAJAXFunction + }); + +}; -function loadTimeLine(){ +function loadArchive(){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + timelineObj = null; + }; + setUserContent( 1 ); + var tPanel = Ext.getCmp('main_portal'); + tPanel.removeAll( true ); + Ext.getCmp('main_content').setTitle( 'Events Archive' ); + tPanel.add({ + columnWidth: 0.83, + frame: false, + border: false, + items: [{ + title: 'Site Map', + frame: false, + border: false, + layout: 'vbox', + layoutConfig: { + align : 'stretch', + pack : 'start', + }, + height: PanelH-300, + items:[{ + height: PanelH-325, + flex: 1, + frame: false, + border: false, + layout: 'fit', + items:{ + id: 'event_map', + html: ' ' + } + }] + },{ + frame: false, + border: false, + collapsible: false, + draggable: false, + layout: 'hbox', + items:[{ + layout: 'form', + title: 'Date/Time', + width: 200, + frame: true, + border: false, + labelAlign: 'right', + labelWidth: 50, + defaults: { width: 80}, + items: [{ + xtype: 'timefield', + id: 'STimeFROM', + width: 120, + fieldLabel: 'From', + minValue: '00:00', + maxValue: '24:00', + increment: 30 + },{ + xtype: 'timefield', + id: 'STimeTO', + width: 120, + fieldLabel: 'Till', + minValue: '00:00', + maxValue: '24:00', + increment: 30 + }], + html: '
', + buttons: [{ + xtype: 'button', + text: 'Display History' + }] + },{ + title: 'Event Log', + frame: false, + height: 303, + xtype: 'grid', + ds: eventsListStore, + cm: new Ext.grid.ColumnModel( eventsListColModel_ops ), + sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ) + }] + }] + }); + tPanel.add({ + columnWidth: 0.17, + frame: false, + id: 'prop_content', + border: false, + items: [{ + title: 'Event Information', + border: true, + frame: true, + html: '

Select an Event from TimeLine to See Information

' + }] + }); + + tPanel.doLayout(); + + //BuildCalendar(); + loadCalendarDates(); + + map = L.map('event_map',{ + attributionControl: true, + //preferCanvas: true, + zoomControl: true, + center: [SiteLat, SiteLon], + /*zoomControl: false, + zoom: 17, + minZoom: 17, + maxZoom: 17,*/ + keyboard: false + }).setView([SiteLat, SiteLon], 17); + //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("GetLabel('_SYS_ANCHORT_LBL_');?>"); + + var mapLayers = []; + + /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', { + subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + attribution: '© Bing Maps', + detectRetina: true + });*/ + mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', + maxNativeZoom: 18, + maxZoom: 24, + }) + // https://leaflet-extras.github.io/leaflet-providers/preview/ + mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { + attribution: 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012', + maxZoom: 19 + }); + + mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community', + maxZoom: 19 + }); + + mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', { + attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community', + maxZoom: 24 + }); + + mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde + attribution: 'Map data © OpenStreetMap contributors', + maxZoom: 19 + }); + + mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", { + attribution: 'Kartendaten: © OpenStreetMap-Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA) ', + maxZoom: 19 + }); + /* + mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { + attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', + maxZoom: 22 + }); + mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { + attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', + maxZoom: 22 + }); + mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], { + attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors', + maxZoom: 22 + }); + */ + + var baseMaps = { + "MyMap": mapLayers["MyMap"], + "OpenStreetMap": mapLayers["OpenStreetMap"], + "OpenTopoMap": mapLayers["OpenTopoMap"], + "EsriSat": mapLayers["EsriSat"], + "EsriStreet": mapLayers["EsriStreet"], + "EsriTopo": mapLayers["EsriTopo"], + //"Bing": mapLayers["Bing"], + //"OSM-Cycle": mapLayers["Cycle"], + //"Landscape": mapLayers["Landscape"], + //"Outdoor": mapLayers["Outdoor"], + }; + L.control.layers( baseMaps ).addTo(map); + + mapLayers["MyMap"].addTo(map); + + /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors', + maxNativeZoom: 18, + maxZoom: 24, + }).addTo(map); */ + //loadTimeLineGroups( selectedSite ); + loadMapZones( SelectedSite ); + getData( 'arch' ); + //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }}); +}; + +function loadMonitoring(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; @@ -376,7 +927,7 @@ function loadTimeLine(){ setUserContent( 1 ); var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll( true ); - Ext.getCmp('main_content').setTitle( 'Full Events Log' ); + Ext.getCmp('main_content').setTitle( 'Events Monitoring' ); tPanel.add({ columnWidth: 0.83, frame: false, @@ -385,6 +936,8 @@ function loadTimeLine(){ title: 'getLabel('_MAP_MONITORING_');?>', frame: false, border: false, + collapsible: false, + draggable: false, layout: 'vbox', layoutConfig: { align : 'stretch', @@ -398,72 +951,55 @@ function loadTimeLine(){ border: false, layout: 'fit', items:{ - //style: 'background: ivory;', id: 'event_map', html: ' ' - }, - tbar:[{ - id: 'fev', - text: 'Fit Events', - disabled: tlMonitoring, - handler: function(){ - showEventPanel(); - } - },{ - id: 'gtn', - text: 'Go to Now', - disabled: tlMonitoring, - handler: function(){ - timelineObj.moveTo( moment.utc() ); - } - },{ - text: 'Live Monitoring', - enableToggle: true, - pressed: tlMonitoring, - toggleHandler: function(){ - tlMonitoring = !tlMonitoring; - if( tlMonitoring ){ - Ext.getCmp('gtn').disable(); - Ext.getCmp('fev').disable(); - } else { - Ext.getCmp('gtn').enable(); - Ext.getCmp('fev').enable(); - }; - } - }] + } }] },{ - title: 'Event Log', frame: false, - height: 303, - xtype: 'grid', - ds: eventsListStore, - cm: new Ext.grid.ColumnModel( eventsListColModel_ops ), - sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ), - //viewConfig: { - //forceFit: true - //}, - bbar: [{ - text: 'Clear', - handler: function(){ - Ext.Ajax.request({ - url: '/lib/controller/clearEventCloud.php', - params: { - UID: , - SID: '' - }, - success: function( response, opts ){ - }, - failure: function( response, opts ) { + border: true, + collapsible: false, + draggable: false, + layout: 'hbox', + items:[{ + title: 'Alarm Sources', + xtype: 'panel', + border: false, + frame: false, + collapsible: false, + draggable: false, + id: 'sources_panel', + width: 160, + autoScroll: 'auto', + height: 303 + },{ + title: 'Event Log', + height: 303, + xtype: 'grid', + border: false, + frame: false, + collapsible: false, + draggable: false, + ds: eventsListStore, + cm: new Ext.grid.ColumnModel( eventsListColModel_ops ), + sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ), + bbar: [{ + text: 'Clear', + handler: function(){ + Ext.Ajax.request({ + url: '/lib/controller/clearEventCloud.php', + params: { + UID: , + SID: '' + }, + success: function( response, opts ){ + }, + failure: function( response, opts ) { } - }); - } - }/*,'->',{ - id: 'con_to_src', - text: 'Connect To Selected', - disabled: ( SelectedCam == 0 ), - handler: connectToSeleced - }*/] + }); + } + }] + }] }] }); tPanel.add({ @@ -568,11 +1104,11 @@ function loadTimeLine(){ }).addTo(map); */ //loadTimeLineGroups( selectedSite ); loadMapZones( SelectedSite ); - eventsListStore.load({params:{start:0, limit:50}}); + getData( 'live' ); + //eventsListStore.load({params:{start:0, limit:50}}); }; - function loadOnlineMonitoring(devID){ var tPanel = Ext.getCmp('main_content'); if( tlInterval!= null ){ @@ -587,3 +1123,4 @@ function loadOnlineMonitoring(devID){ }); tPanel.doLayout(); }; + diff --git a/lib/javascript/panolens/panolens.js b/lib/javascript/panolens/panolens.js new file mode 100644 index 0000000..a47d060 --- /dev/null +++ b/lib/javascript/panolens/panolens.js @@ -0,0 +1,9595 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three')) : + typeof define === 'function' && define.amd ? define(['exports', 'three'], factory) : + (global = global || self, factory(global.PANOLENS = {}, global.THREE)); +}(this, function (exports, THREE) { 'use strict'; + + const version="0.12.1";const dependencies={three:"^0.105.2"}; + + /** + * REVISION + * @module REVISION + * @example PANOLENS.REVISION + * @type {string} revision + */ + const REVISION = version.split( '.' )[ 1 ]; + + /** + * VERSION + * @module VERSION + * @example PANOLENS.VERSION + * @type {string} version + */ + const VERSION = version; + + /** + * THREEJS REVISION + * @module THREE_REVISION + * @example PANOLENS.THREE_REVISION + * @type {string} threejs revision + */ + const THREE_REVISION = dependencies.three.split( '.' )[ 1 ]; + + /** + * THREEJS VERSION + * @module THREE_VERSION + * @example PANOLENS.THREE_VERSION + * @type {string} threejs version + */ + const THREE_VERSION = dependencies.three.replace( /[^0-9.]/g, '' ); + + /** + * CONTROLS + * @module CONTROLS + * @example PANOLENS.CONTROLS.ORBIT + * @property {number} ORBIT 0 + * @property {number} DEVICEORIENTATION 1 + */ + const CONTROLS = { ORBIT: 0, DEVICEORIENTATION: 1 }; + + /** + * MODES + * @module MODES + * @example PANOLENS.MODES.UNKNOWN + * @property {number} UNKNOWN 0 + * @property {number} NORMAL 1 + * @property {number} CARDBOARD 2 + * @property {number} STEREO 3 + */ + const MODES = { UNKNOWN: 0, NORMAL: 1, CARDBOARD: 2, STEREO: 3 }; + + /** + * Data URI Images + * @module DataImage + * @example PANOLENS.DataImage.Info + * @property {string} Info Information Icon + * @property {string} Arrow Arrow Icon + * @property {string} FullscreenEnter Fullscreen Enter Icon + * @property {string} FullscreenLeave Fullscreen Leave Icon + * @property {string} VideoPlay Video Play Icon + * @property {string} VideoPause Video Pause Icon + * @property {string} WhiteTile White Tile Icon + * @property {string} Setting Settings Icon + * @property {string} ChevronRight Chevron Right Icon + * @property {string} Check Check Icon + * @property {string} ViewIndicator View Indicator Icon + */ + const DataImage = { + Info: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAABAAAAAQADq8/hgAAADBklEQVR42u2bP08UQRiHnzFaSYCI/xoksdBIqGwIiYWRUBISExpCQ0ej38FWOmlIKKhoMPEbaCxsrrHiYrQgOSlQEaICrT+LHSPZzNzt3s3c3Hn7lHvLzvv82L2dm30XKioqKgYY062BJF0HpoA7wARwBbhsPz4DjoEG8AnYNcZ8Sx1Op8IXJM1KWpdUV3nq9m9nJV1I7VNGfEzSM0mNNqR9NOwxx1L7NRMflbQm6SSgeJ4TO8Zoat+8/LKkg4jieQ4kLaf2RtKwpJ0uiufZkTScSn5S0l5C+b/sSZrstvyMpKPU5uc4kjTTjkvpeYCkaeA1/+7hvcIZMGuMqUULQNIU8Aa4ltrWwyHwyBizGzwASSPAe+B2assW7AH3jTE/i+xcZoa12Qfy2Bo3i+5cKABl99zF1GYlWFTBeULLS0DZrOsDcDNggTXgc27bLWA64BhfgHvGmB8dHUXZ1DM0S45xliKMs9bKr+klIOkqsBrwv9JtVq1DewEAT4Ch1BYdMGQdygeg7Df4SmqDAKyoyXpCszPgITCeuvoAjFuX0gE8jljUdv7bCtiOOJ7XpdUZ8L/gdXHOA5QtYH5NXXVgbrgWWn1nwFTqaiPgdPIFcDd1tRFwOl307DwRuZgXwLvctgfA04hjOp18AcReZ6sZY16e3yDpUuQxnU6+S2AkcjEpcDr1zxOXSPgCKLSa0mc4nXwB/EpdbQScTr4AGqmrjYDTyRfAx9TVRsDp5Aug8LJyH+F0cgZg58z11BUHpO5ruGh2G3ybuuqAeF2aBfAqddUB8bq0OgP2U1cegH3aOQOMMb+BrdTVB2DLupQLwLIOnKY26IBT6+ClaQDGmO/ARmqLDtiwDn7HVkcY+EdjNoTlCI+tYhO2iUppm6HKslPUq2qQKHpUe8AFsjaUXuUQWCgqXyoAG8IuME/WkNRrnAHzZfqDSgdgQ6gBc2Td3b3CMTBXtkOsIzTIjZLnQhjcVtlcEIPZLJ0LoVvt8s/Va+3yuSAG84UJRxB98cpM9dJURUVFxSDzBxKde4Lk3/h2AAAAAElFTkSuQmCC', + Arrow: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAABAAAAAQADq8/hgAAADPklEQVR42u2bMUscQRiG30/SRaJEI1ZKUiRErNIELRUbQYSAnX8hpVUgkDYp0wgWVjYW+QcJaQzYpLojJIXhtDDEKBpj65ti58ixmdmb2ZvZ7+T2AUHudmfmeXf2bnb3O6CmpqZmgJGqOiI5AWAWwEMA0wDuArht3r4CcAagBeAbgIaI/NQOp1fhIZKLJN+SbDKcptl3keSQtk+I+BjJVyRbJaRdtEybY9p+ReKjJN+QvIwonufS9DGq7ZuXXyd5nFA8zzHJdW1vkLxDcrdC8Ty7JO9oyc+QPFCUb3NAcqZq+TmSp9rmHZySnCvjErwOIPkUwHv8+w7vF64ALIrIfrIASM4C+ADgnratgxMACyLSiB4AyREAnwE80LbswgGAJyJy4bNxyApr6wbIw4xxy3djrwCYfeeuaZsFsEbPdULXU4DZqusLgMkEA21P05EEbf8A8FhEzos28pkBLxLKL5s/r/M1kEkz9vKQHGeatf05yfmOfubNa7G5JDle5NhtBjwHMBz5yFwAWBaRT+0XzP8pZsKwcQiH2fX8Ycojb+kzxUw4ZJn7CSQXqpRPHMKCq7+iZJ71Mvdy/DftXSQ6HcJdSDaqPPKW/mPOBO+lcbvzCU35RCFM2PpwnQKzZQfdgfe0dxH5dLA6uQJ4pC2fIASrkyuA6X6QjxyC1ckVQNn7bNHlI4ZgdXIFUObiJJl8pBCsTjGfuIwA2Cv4FN7xbYjkjqsRAHuIePXoCiDF1Zk2VidXAL+1R5sAq5MrgJb2aBNgdXIF8FV7tAmwOrkCCFs73wysTtYATHFCU3vEEWm6Ci6KvgY/ao86Ik6XogDeaY86Ik6XbjPgSHvkEThCwQy45XpDRK5JbgN4GWkgUyR9H65MRQxgW0SunZ5FezK7pfwd8e8MV8UfAPdF5Jdrg8JrAbPjprZFD2wWyQP6j8ZSEufRmGlgQ9umBBvd5IOgbjFUKLu+XnWBhG+rpsFVZGUo/coJgFVf+aAATAgNACvICpL6jSsAKyH1QcEBmBD2ASwhq+7uF84ALIVWiPUEB7lQsiOEwS2VzQUxmMXSuRCqKpd/zX4rl88FMZg/mLAEcSN+MlP/aKqmpqZmkPkL0hSjwOpNKxwAAAAASUVORK5CYII=', + FullscreenEnter: 'data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjRkZGRkZGIiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz4KICAgIDxwYXRoIGQ9Ik03IDE0SDV2NWg1di0ySDd2LTN6bS0yLTRoMlY3aDNWNUg1djV6bTEyIDdoLTN2Mmg1di01aC0ydjN6TTE0IDV2MmgzdjNoMlY1aC01eiIvPgo8L3N2Zz4=', + FullscreenLeave: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggc3R5bGU9ImZpbGw6I2ZmZiIgZD0iTTE0LDE0SDE5VjE2SDE2VjE5SDE0VjE0TTUsMTRIMTBWMTlIOFYxNkg1VjE0TTgsNUgxMFYxMEg1VjhIOFY1TTE5LDhWMTBIMTRWNUgxNlY4SDE5WiIgLz48L3N2Zz4=', + VideoPlay: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggc3R5bGU9ImZpbGw6I2ZmZiIgZD0iTTgsNS4xNFYxOS4xNEwxOSwxMi4xNEw4LDUuMTRaIiAvPjwvc3ZnPg==', + VideoPause: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggc3R5bGU9ImZpbGw6I2ZmZiIgZD0iTTE0LDE5LjE0SDE4VjUuMTRIMTRNNiwxOS4xNEgxMFY1LjE0SDZWMTkuMTRaIiAvPjwvc3ZnPg==', + WhiteTile: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB1WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjE8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOlBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24+MjwvdGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KAtiABQAAACRQTFRFAAAAAAAABgYGBwcHHh4eKysrx8fHy8vLzMzM7OzsAAAABgYG+q7SZgAAAAp0Uk5TAP7+/v7+/v7+/iJx/a8AAAOwSURBVHja7d0hbsNAEAVQo6SFI6XEcALDcgNLvUBvEBQVhpkWVYWlhSsVFS7t5QIshRt695lEASZP+8c7a1kzDL1fz+/zyuvzp6FbvoddrL6uDd1yGZ5eXldeb18N3fIx7A+58prmhm65DfvDcd0952lu6JabFbD/zVprZj1lzcys+fj9z8xTZtbT8rv8yWlu6BYAIgAAAAAAAAAAAABAM6QXEAEAAAAAAAAAgJ2gnaAIiIA3Q2qAGgAAAAAAAAAAAAAAAAAAAAAAAAAAQJsADkVFAAAAAAA8Bj0GRUAEREAEREAEREAEREAEAAAAAAAAAAB2gnaCIiACPplRA9QANUAERAAAAEVQERQBERCBVlfAcZ3aeZobusUKMGBhV6KUElHGKBERJR6/fxExRkQZl9/lT8S1oVsuhqyYMmPKjCkzvfcCpsxohrwY0Q06EAEAAAAAAAAAAACgGdILiAAAAAAAAAAAwE7QTlAERMCbITVADQAAAAAAAAAAAAAAAAAAAAAAAAAAwKmwQ1ERAAAAAACPQY9BERABERABERABERABERABAAAAAAAAAICdoJ2gCIiAT2bUADVADRABEQAAQBFUBEVABERgEyvAlJm+V4ApM6bMmDJjyowpM6bMdN0LmDKjGfJiRDfoQAQAAAAAAAAAAACAZkgvIAIAAAAAAAAAADtBO0EREAFvhtQANQAAAAAAAAAAAAAAAAAAAAAAAAAAAKfCDkVFAAAAAAA8Bj0GRUAEREAEREAEREAEREAEAAAAAAAAAAB2gnaCIiACPplRA9QANUAERAAAAEVQERQBERCBTawAU2b6XgGmzJgyY8qMKTOmzJgy03UvYMqMZsiLEd2gAxEAAAAAAAAAAAAAmiG9gAgAAAAAAAAAAOwE7QRFQAS8GVID1AAAAAAAAAAAAAAAAAAAAAAAAAAAAJwKOxQVAQAAAADwGPQYFAEREAEREAEREAEREAERAAAAAAAAAADYCdoJioAI+GRGDVAD1AAREAEAABRBRVAEREAENrECTJnpewWYMmPKjCkzpsyYMmPKTNe9gCkzmiEvRnSDDkQAAAAAAAAAAAAAaIb0AiIAAAAAAAAAALATtBMUARHwZkgNUAMAAAAAAAAAAAAAAAAAAAAAAAAAAHAq7FBUBAAAAADAY9BjUAREQAREQAREQAREQAREAAAAAAAAAABgJ2gnKAIi4JMZNUANUANEQAQAAFAEFUEREAER2MQKMGWm7xVgyowpM50PWen9ugNGXz1XaocAFgAAAABJRU5ErkJggg==', + Setting: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAABAAAAAQADq8/hgAAADn0lEQVR42u2bzUsVURjGnyO6CPzAMnTjppAo3LTwH1CqTfaxbeOiRS37A0wXtROFVi1aRBs3LWohSIGbQAQXViBGRhG0UIRKUCpK7q/FnOB2uc6cOXNmRnGe3eW+H8/7zLln3vNxpQoVKlQ4wjBFJAFOSRqX1O7osivpvjHmU1nChBZglvSYLYJbS0EanCvIJzWK+gnsyH34/8OuMaYjb265jwCgz6N4SWq3vodbAEmnS/KtBDgoAgyU5BteAOAkMAPcBroc7PskDWfgN+wyDwBdltMMcDI3tYBnde/pHeARMNTErgd4APzweP834oeN1dMkz5DlsFNn/yyv4kdiSK4At4AO4CqwGaDwRmza2B0210qM7YhrXU59ANAq6bWkwQTTn5KO5fIE0uVYlXTeGLOXFMx1DrjlULwKKN41x6DlnIjEEQCckPRe0okCiguJr5LOGGO+xhm5jICJQ1i8LOeJJKPYEQAMKvrtt5ZdjSf2FM0Fq/sZJI2A6UNcvCz36TiDfUcAcE1SPu/U6Mm8k/TFfu6XdFb5iX3dGPM8lQfwNod3+TowBnQ3yddtv1vPIe+b1JIBiwEJ1IAJ208k5W21trWA+V/5CHAcmAtU/A2P/DcCiTAHHE8tgCVhgLvAXgYCk17Jo/yTGfLuWe7Zd72AC8CWB4n3OAz7mLytNkZabAEXMhfeQKYfWEpJZCxA3rGUOZeA/qDF15FpAz47EvlNk9neI2e3jeWCz0BbmvipNkSMMX8kuSZYM8Z8zyqAjbHmaN5mOeYjgIXrU93MWrxHrNQjrqiDkQMLHwG+OdqF3NN3jeXKzU8AoF1SzdH8XKhJUO7HZDXLMbwAwICkJUULFxe0SbqSVQAbw3Xi7Ze0ZLmGAzAKbHs0JGU1QtvAaIjCW4B7ZOvJy2qFa5a730RPtBiaz0CgnkiZi6F5fBZDVMvho7EhcuS3xJJ2hV9IupgTqaLw0hhzab8vq23xOG/r+LDsKjLgYVzxUnU0ltwK2wDezUyJmEwqXgp/PL4rvxthaeCSI+zxuA10J8ZkWdJNSb2SLkvayKHwDRu71+ZajrG941J8agALDQ3GU/a/IvMkYCPzmCbtLNEVmacNtgs5iP9fYVNEV1Q6Hez7yNZSL+J2SarTcpqiyV2iUkG0IvPFvbz5FbEn+KEk3wMjwMeSfCsBXFBdly9CAPk9ydyffpECuB5tZfVJjaKWueOSfinln6YK4lahQoUKRxd/AcRPGTcQCAUQAAAAAElFTkSuQmCC', + ChevronRight: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTguNTksMTYuNThMMTMuMTcsMTJMOC41OSw3LjQxTDEwLDZMMTYsMTJMMTAsMThMOC41OSwxNi41OFoiIC8+PC9zdmc+', + Check: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTIxLDdMOSwxOUwzLjUsMTMuNUw0LjkxLDEyLjA5TDksMTYuMTdMMTkuNTksNS41OUwyMSw3WiIgLz48L3N2Zz4=', + ViewIndicator: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBpZD0idmlldy1pbmRpY2F0b3IiIGhlaWdodD0iMzAiIHdpZHRoPSIzMCIgdmlld0JveD0iLTIuNSAtMSAzMCAzMCI+Cgk8c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5zdDB7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLW1pdGVybGltaXQ6MTA7ZmlsbDpub25lO30uc3Qxe3N0cm9rZS13aWR0aDo2O3N0cm9rZS1taXRlcmxpbWl0OjEwO30KCTwvc3R5bGU+Cgk8Zz4KCQk8cGF0aCBjbGFzcz0ic3QwIiBkPSJNIDEyLjUgMCBBIDEyLjUgMTIuNSAwIDAgMCAtMTIuNSAwIEEgMTIuNSAxMi41IDAgMCAwIDEyLjUgMCIgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwxMywxNS41KSI+PC9wYXRoPgoJCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0gMTMgMCBMIDEwIDIgTCAxNiAyIFoiPjwvcGF0aD4KCQk8cGF0aCBjbGFzcz0ic3QyIiBkPSJNIDIgMCBBIDIgMiAwIDAgMCAtMiAwIEEgMiAyIDAgMCAwIDIgMCIgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwxMywxNS41KSI+PC9wYXRoPgoJCTxwYXRoIGNsYXNzPSJzdDEiIGlkPSJpbmRpY2F0b3IiIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMTMsMTUuNSkiPjwvcGF0aD4KCTwvZz4KPC9zdmc+' + }; + + /** + * @module ImageLoader + * @description Image loader with progress based on {@link https://github.com/mrdoob/three.js/blob/master/src/loaders/ImageLoader.js} + */ + const ImageLoader = { + + /** + * Load image + * @example PANOLENS.ImageLoader.load( IMAGE_URL ) + * @method load + * @param {string} url - An image url + * @param {function} onLoad - On load callback + * @param {function} onProgress - In progress callback + * @param {function} onError - On error callback + */ + load: function ( url, onLoad = () => {}, onProgress = () => {}, onError = () => {} ) { + + // Enable cache + THREE.Cache.enabled = true; + + let cached, request, arrayBufferView, blob, urlCreator, image, reference; + + // Reference key + for (let iconName in DataImage) { + + if (DataImage.hasOwnProperty(iconName) && url === DataImage[iconName]) { + + reference = iconName; + + } + + } + + // Cached + cached = THREE.Cache.get(reference ? reference : url); + + if (cached !== undefined) { + + if (onLoad) { + + setTimeout(function () { + + onProgress({loaded: 1, total: 1}); + onLoad(cached); + + }, 0); + + } + + return cached; + + } + + // Construct a new XMLHttpRequest + urlCreator = window.URL || window.webkitURL; + image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); + + // Add to cache + THREE.Cache.add(reference ? reference : url, image); + + const onImageLoaded = () => { + + urlCreator.revokeObjectURL(image.src); + onLoad(image); + + }; + + if (url.indexOf('data:') === 0) { + + image.addEventListener('load', onImageLoaded, false); + image.src = url; + return image; + } + + image.crossOrigin = this.crossOrigin !== undefined ? this.crossOrigin : ''; + + request = new window.XMLHttpRequest(); + request.open('GET', url, true); + if (process.env.npm_lifecycle_event !== 'test') { + request.onreadystatechange = function () { + if (this.readyState === 4 && this.status >= 400) { + onError(); + } + }; + } + request.responseType = 'arraybuffer'; + request.addEventListener( 'error', onError ); + request.addEventListener( 'progress', event => { + + if ( !event ) return; + + const { loaded, total, lengthComputable } = event; + + if ( lengthComputable ) { + + onProgress( { loaded, total } ); + + } + + } ); + + request.addEventListener( 'loadend', event => { + + if ( !event ) return; + const { currentTarget: { response } } = event; + + arrayBufferView = new Uint8Array( response ); + blob = new window.Blob( [ arrayBufferView ] ); + + image.addEventListener( 'load', onImageLoaded, false ); + image.src = urlCreator.createObjectURL( blob ); + + } ); + + request.send(null); + + } + + }; + + /** + * @module TextureLoader + * @description Texture loader based on {@link https://github.com/mrdoob/three.js/blob/master/src/loaders/TextureLoader.js} + */ + const TextureLoader = { + + /** + * Load image texture + * @example PANOLENS.TextureLoader.load( IMAGE_URL ) + * @method load + * @param {string} url - An image url + * @param {function} onLoad - On load callback + * @param {function} onProgress - In progress callback + * @param {function} onError - On error callback + * @return {THREE.Texture} - Image texture + */ + load: function ( url, onLoad = () => {}, onProgress, onError ) { + + var texture = new THREE.Texture(); + + ImageLoader.load( url, function ( image ) { + + texture.image = image; + + // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. + const isJPEG = url.search( /\.(jpg|jpeg)$/ ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; + + texture.format = isJPEG ? THREE.RGBFormat : THREE.RGBAFormat; + texture.needsUpdate = true; + + onLoad( texture ); + + }, onProgress, onError ); + + return texture; + + } + + }; + + /** + * @module CubeTextureLoader + * @description Cube Texture Loader based on {@link https://github.com/mrdoob/three.js/blob/master/src/loaders/CubeTextureLoader.js} + */ + const CubeTextureLoader = { + + /** + * Load 6 images as a cube texture + * @example PANOLENS.CubeTextureLoader.load( [ 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' ] ) + * @method load + * @param {array} urls - array of 6 urls to images, one for each side of the CubeTexture. The urls should be specified in the following order: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z + * @param {function} onLoad - On load callback + * @param {function} onProgress - In progress callback + * @param {function} onError - On error callback + * @return {THREE.CubeTexture} - Cube texture + */ + load: function ( urls, onLoad = () => {}, onProgress = () => {}, onError ) { + + var texture, loaded, progress, all, loadings; + + texture = new THREE.CubeTexture( [] ); + + loaded = 0; + progress = {}; + all = {}; + + urls.map( function ( url, index ) { + + ImageLoader.load( url, function ( image ) { + + texture.images[ index ] = image; + + loaded++; + + if ( loaded === 6 ) { + + texture.needsUpdate = true; + + onLoad( texture ); + + } + + }, function ( event ) { + + progress[ index ] = { loaded: event.loaded, total: event.total }; + + all.loaded = 0; + all.total = 0; + loadings = 0; + + for ( var i in progress ) { + + loadings++; + all.loaded += progress[ i ].loaded; + all.total += progress[ i ].total; + + } + + if ( loadings < 6 ) { + + all.total = all.total / loadings * 6; + + } + + onProgress( all ); + + }, onError ); + + } ); + + return texture; + + } + + }; + + /** + * @classdesc User Media + * @constructor + * @param {object} [constraints={ video: { width: { ideal: 1920 }, height: { ideal: 1080 }, facingMode: { exact: 'environment' } }, audio: false }] + */ + function Media ( constraints ) { + + const defaultConstraints = { video: { width: { ideal: 1920 }, height: { ideal: 1080 }, facingMode: { exact: 'environment' } }, audio: false }; + + this.constraints = Object.assign( defaultConstraints, constraints ); + + this.container = null; + this.scene = null; + this.element = null; + this.devices = []; + this.stream = null; + this.ratioScalar = 1; + this.videoDeviceIndex = 0; + + } + Media.prototype = Object.assign( Object.create( THREE.EventDispatcher.prototype ), { + + setContainer: function ( container ) { + + this.container = container; + + }, + + setScene: function ( scene ) { + + this.scene = scene; + + }, + + /** + * Enumerate devices + * @memberOf Media + * @instance + * @returns {Promise} + */ + enumerateDevices: function () { + + const devices = this.devices; + const resolvedPromise = new Promise( resolve => { resolve( devices ); } ); + + return devices.length > 0 ? resolvedPromise : window.navigator.mediaDevices.enumerateDevices(); + + }, + + /** + * Switch to next available video device + * @memberOf Media + * @instance + */ + switchNextVideoDevice: function () { + + const stop = this.stop.bind( this ); + const start = this.start.bind( this ); + const setVideDeviceIndex = this.setVideDeviceIndex.bind( this ); + + let index = this.videoDeviceIndex; + + this.getDevices( 'video' ) + .then( devices => { + stop(); + index++; + if ( index >= devices.length ) { + setVideDeviceIndex( 0 ); + index--; + } else { + setVideDeviceIndex( index ); + } + + start( devices[ index ] ); + + + } ); + + }, + + /** + * Get devices + * @param {string} type - type keyword to match device.kind + * @memberOf Media + * @instance + */ + getDevices: function ( type = 'video' ) { + + const devices = this.devices; + const validate = _devices => { + + return _devices.map( device => { + + if ( !devices.includes( device ) ) { devices.push( device ); } + return device; + + } ); + + }; + const filter = _devices => { + + const reg = new RegExp( type, 'i' ); + return _devices.filter( device => reg.test( device.kind ) ); + + }; + + return this.enumerateDevices() + .then( validate ) + .then( filter ); + + }, + + /** + * Get user media + * @param {MediaStreamConstraints} constraints + * @memberOf Media + * @instance + */ + getUserMedia: function ( constraints ) { + + const setMediaStream = this.setMediaStream.bind( this ); + const playVideo = this.playVideo.bind( this ); + const onCatchError = error => { console.warn( `PANOLENS.Media: ${error}` ); }; + + return window.navigator.mediaDevices.getUserMedia( constraints ) + .then( setMediaStream ) + .then( playVideo ) + .catch( onCatchError ); + + }, + + /** + * Set video device index + * @param {number} index + * @memberOf Media + * @instance + */ + setVideDeviceIndex: function ( index ) { + + this.videoDeviceIndex = index; + + }, + + /** + * Start streaming + * @param {MediaDeviceInfo} [targetDevice] + * @memberOf Media + * @instance + */ + start: function( targetDevice ) { + + const constraints = this.constraints; + const getUserMedia = this.getUserMedia.bind( this ); + const onVideoDevices = devices => { + + if ( !devices || devices.length === 0 ) { + + throw Error( 'no video device found' ); + + } + + const device = targetDevice || devices[ 0 ]; + constraints.video.deviceId = device.deviceId; + + return getUserMedia( constraints ); + + }; + + this.element = this.createVideoElement(); + + return this.getDevices().then( onVideoDevices ); + + }, + + /** + * Stop streaming + * @memberOf Media + * @instance + */ + stop: function () { + + const stream = this.stream; + + if ( stream && stream.active ) { + + const track = stream.getTracks()[ 0 ]; + + track.stop(); + + window.removeEventListener( 'resize', this.onWindowResize.bind( this ) ); + + this.element = null; + this.stream = null; + + } + + }, + + /** + * Set media stream + * @param {MediaStream} stream + * @memberOf Media + * @instance + */ + setMediaStream: function ( stream ) { + + this.stream = stream; + this.element.srcObject = stream; + + if ( this.scene ) { + + this.scene.background = this.createVideoTexture(); + + } + + window.addEventListener( 'resize', this.onWindowResize.bind( this ) ); + + }, + + /** + * Play video element + * @memberOf Media + * @instance + */ + playVideo: function () { + + const { element } = this; + + if ( element ) { + + element.play(); + this.dispatchEvent( { type: 'play' } ); + + } + + }, + + /** + * Pause video element + * @memberOf Media + * @instance + */ + pauseVideo: function () { + + const { element } = this; + + if ( element ) { + + element.pause(); + this.dispatchEvent( { type: 'pause' } ); + + } + + }, + + /** + * Create video texture + * @memberOf Media + * @instance + * @returns {THREE.VideoTexture} + */ + createVideoTexture: function () { + + const video = this.element; + const texture = new THREE.VideoTexture( video ); + + texture.generateMipmaps = false; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.format = THREE.RGBFormat; + texture.center.set( 0.5, 0.5 ); + + video.addEventListener( 'canplay', this.onWindowResize.bind( this ) ); + + return texture; + + }, + + /** + * Create video element + * @memberOf Media + * @instance + * @returns {HTMLVideoElement} + * @fires Media#canplay + */ + createVideoElement: function() { + + const dispatchEvent = this.dispatchEvent.bind( this ); + const video = document.createElement( 'video' ); + + /** + * Video can play event + * @type {object} + * @event Media#canplay + */ + const canPlay = () => dispatchEvent( { type: 'canplay' } ); + + video.setAttribute( 'autoplay', '' ); + video.setAttribute( 'muted', '' ); + video.setAttribute( 'playsinline', '' ); + + video.style.position = 'absolute'; + video.style.top = '0'; + video.style.left = '0'; + video.style.width = '100%'; + video.style.height = '100%'; + video.style.objectPosition = 'center'; + video.style.objectFit = 'cover'; + video.style.display = this.scene ? 'none' : ''; + + video.addEventListener( 'canplay', canPlay ); + + return video; + + }, + + /** + * On window resize event + * @param {Event} event + * @memberOf Media + * @instance + */ + onWindowResize: function () { + + if ( this.element && this.element.videoWidth && this.element.videoHeight && this.scene ) { + + const { clientWidth: width, clientHeight: height } = this.container; + const texture = this.scene.background; + const { videoWidth, videoHeight } = this.element; + const cameraRatio = videoHeight / videoWidth; + const viewportRatio = this.container ? width / height : 1.0; + const ratio = cameraRatio * viewportRatio * this.ratioScalar; + + if ( width > height ) { + texture.repeat.set( ratio, 1 ); + } else { + texture.repeat.set( 1, 1 / ratio ); + } + + } + + } + + } ); + + /** + * @classdesc Reticle 3D Sprite + * @constructor + * @param {THREE.Color} [color=0xffffff] - Color of the reticle sprite + * @param {boolean} [autoSelect=true] - Auto selection + * @param {number} [dwellTime=1500] - Duration for dwelling sequence to complete + */ + + function Reticle ( color = 0xffffff, autoSelect = true, dwellTime = 1500 ) { + + this.dpr = window.devicePixelRatio; + + const { canvas, context } = this.createCanvas(); + const material = new THREE.SpriteMaterial( { color, map: this.createCanvasTexture( canvas ) } ); + + THREE.Sprite.call( this, material ); + + this.canvasWidth = canvas.width; + this.canvasHeight = canvas.height; + this.context = context; + this.color = color instanceof THREE.Color ? color : new THREE.Color( color ); + + this.autoSelect = autoSelect; + this.dwellTime = dwellTime; + this.rippleDuration = 500; + this.position.z = -10; + this.center.set( 0.5, 0.5 ); + this.scale.set( 0.5, 0.5, 1 ); + + this.startTimestamp = null; + this.timerId = null; + this.callback = null; + + this.frustumCulled = false; + + this.updateCanvasArcByProgress( 0 ); + + } + Reticle.prototype = Object.assign( Object.create( THREE.Sprite.prototype ), { + + constructor: Reticle, + + /** + * Set material color + * @param {THREE.Color} color + * @memberOf Reticle + * @instance + */ + setColor: function ( color ) { + + this.material.color.copy( color instanceof THREE.Color ? color : new THREE.Color( color ) ); + + }, + + /** + * Create canvas texture + * @param {HTMLCanvasElement} canvas + * @memberOf Reticle + * @instance + * @returns {THREE.CanvasTexture} + */ + createCanvasTexture: function ( canvas ) { + + const texture = new THREE.CanvasTexture( canvas ); + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + + return texture; + + }, + + /** + * Create canvas element + * @memberOf Reticle + * @instance + * @returns {object} object + * @returns {HTMLCanvasElement} object.canvas + * @returns {CanvasRenderingContext2D} object.context + */ + createCanvas: function () { + + const width = 32; + const height = 32; + const canvas = document.createElement( 'canvas' ); + const context = canvas.getContext( '2d' ); + const dpr = this.dpr; + + canvas.width = width * dpr; + canvas.height = height * dpr; + context.scale( dpr, dpr ); + + context.shadowBlur = 5; + context.shadowColor = 'rgba(200,200,200,0.9)'; + + return { canvas, context }; + + }, + + /** + * Update canvas arc by progress + * @param {number} progress + * @memberOf Reticle + * @instance + */ + updateCanvasArcByProgress: function ( progress ) { + + const context = this.context; + const { canvasWidth, canvasHeight, material } = this; + const dpr = this.dpr; + const degree = progress * Math.PI * 2; + const color = this.color.getStyle(); + const x = canvasWidth * 0.5 / dpr; + const y = canvasHeight * 0.5 / dpr; + const lineWidth = 3; + + context.clearRect( 0, 0, canvasWidth, canvasHeight ); + context.beginPath(); + + if ( progress === 0 ) { + context.arc( x, y, canvasWidth / 16, 0, 2 * Math.PI ); + context.fillStyle = color; + context.fill(); + } else { + context.arc( x, y, canvasWidth / 4 - lineWidth, -Math.PI / 2, -Math.PI / 2 + degree ); + context.strokeStyle = color; + context.lineWidth = lineWidth; + context.stroke(); + } + + context.closePath(); + + material.map.needsUpdate = true; + + }, + + /** + * Ripple effect + * @memberOf Reticle + * @instance + * @fires Reticle#reticle-ripple-start + * @fires Reticle#reticle-ripple-end + */ + ripple: function () { + + const context = this.context; + const { canvasWidth, canvasHeight, material } = this; + const duration = this.rippleDuration; + const timestamp = performance.now(); + const color = this.color; + const dpr = this.dpr; + const x = canvasWidth * 0.5 / dpr; + const y = canvasHeight * 0.5 / dpr; + + const update = () => { + + const timerId = window.requestAnimationFrame( update ); + const elapsed = performance.now() - timestamp; + const progress = elapsed / duration; + const opacity = 1.0 - progress > 0 ? 1.0 - progress : 0; + const radius = progress * canvasWidth * 0.5 / dpr; + + context.clearRect( 0, 0, canvasWidth, canvasHeight ); + context.beginPath(); + context.arc( x, y, radius, 0, Math.PI * 2 ); + context.fillStyle = `rgba(${color.r * 255}, ${color.g * 255}, ${color.b * 255}, ${opacity})`; + context.fill(); + context.closePath(); + + if ( progress >= 1.0 ) { + + window.cancelAnimationFrame( timerId ); + this.updateCanvasArcByProgress( 0 ); + + /** + * Reticle ripple end event + * @type {object} + * @event Reticle#reticle-ripple-end + */ + this.dispatchEvent( { type: 'reticle-ripple-end' } ); + + } + + material.map.needsUpdate = true; + + }; + + /** + * Reticle ripple start event + * @type {object} + * @event Reticle#reticle-ripple-start + */ + this.dispatchEvent( { type: 'reticle-ripple-start' } ); + + update(); + + }, + + /** + * Make reticle visible + * @memberOf Reticle + * @instance + */ + show: function () { + + this.visible = true; + + }, + + /** + * Make reticle invisible + * @memberOf Reticle + * @instance + */ + hide: function () { + + this.visible = false; + + }, + + /** + * Start dwelling + * @param {function} callback + * @memberOf Reticle + * @instance + * @fires Reticle#reticle-start + */ + start: function ( callback ) { + + if ( !this.autoSelect ) { + + return; + + } + + /** + * Reticle start event + * @type {object} + * @event Reticle#reticle-start + */ + this.dispatchEvent( { type: 'reticle-start' } ); + + this.startTimestamp = performance.now(); + this.callback = callback; + this.update(); + + }, + + /** + * End dwelling + * @memberOf Reticle + * @instance + * @fires Reticle#reticle-end + */ + end: function(){ + + if ( !this.startTimestamp ) { return; } + + window.cancelAnimationFrame( this.timerId ); + + this.updateCanvasArcByProgress( 0 ); + this.callback = null; + this.timerId = null; + this.startTimestamp = null; + + /** + * Reticle end event + * @type {object} + * @event Reticle#reticle-end + */ + this.dispatchEvent( { type: 'reticle-end' } ); + + }, + + /** + * Update dwelling + * @memberOf Reticle + * @instance + * @fires Reticle#reticle-update + */ + update: function () { + + this.timerId = window.requestAnimationFrame( this.update.bind( this ) ); + + const elapsed = performance.now() - this.startTimestamp; + const progress = elapsed / this.dwellTime; + + this.updateCanvasArcByProgress( progress ); + + /** + * Reticle update event + * @type {object} + * @event Reticle#reticle-update + */ + this.dispatchEvent( { type: 'reticle-update', progress } ); + + if ( progress >= 1.0 ) { + + window.cancelAnimationFrame( this.timerId ); + if ( this.callback ) { this.callback(); } + this.end(); + this.ripple(); + + } + + } + + } ); + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var Tween = createCommonjsModule(function (module, exports) { + /** + * Tween.js - Licensed under the MIT license + * https://github.com/tweenjs/tween.js + * ---------------------------------------------- + * + * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors. + * Thank you all, you're awesome! + */ + + + var _Group = function () { + this._tweens = {}; + this._tweensAddedDuringUpdate = {}; + }; + + _Group.prototype = { + getAll: function () { + + return Object.keys(this._tweens).map(function (tweenId) { + return this._tweens[tweenId]; + }.bind(this)); + + }, + + removeAll: function () { + + this._tweens = {}; + + }, + + add: function (tween) { + + this._tweens[tween.getId()] = tween; + this._tweensAddedDuringUpdate[tween.getId()] = tween; + + }, + + remove: function (tween) { + + delete this._tweens[tween.getId()]; + delete this._tweensAddedDuringUpdate[tween.getId()]; + + }, + + update: function (time, preserve) { + + var tweenIds = Object.keys(this._tweens); + + if (tweenIds.length === 0) { + return false; + } + + time = time !== undefined ? time : TWEEN.now(); + + // Tweens are updated in "batches". If you add a new tween during an update, then the + // new tween will be updated in the next batch. + // If you remove a tween during an update, it may or may not be updated. However, + // if the removed tween was added during the current batch, then it will not be updated. + while (tweenIds.length > 0) { + this._tweensAddedDuringUpdate = {}; + + for (var i = 0; i < tweenIds.length; i++) { + + var tween = this._tweens[tweenIds[i]]; + + if (tween && tween.update(time) === false) { + tween._isPlaying = false; + + if (!preserve) { + delete this._tweens[tweenIds[i]]; + } + } + } + + tweenIds = Object.keys(this._tweensAddedDuringUpdate); + } + + return true; + + } + }; + + var TWEEN = new _Group(); + + TWEEN.Group = _Group; + TWEEN._nextId = 0; + TWEEN.nextId = function () { + return TWEEN._nextId++; + }; + + + // Include a performance.now polyfill. + // In node.js, use process.hrtime. + if (typeof (self) === 'undefined' && typeof (process) !== 'undefined' && process.hrtime) { + TWEEN.now = function () { + var time = process.hrtime(); + + // Convert [seconds, nanoseconds] to milliseconds. + return time[0] * 1000 + time[1] / 1000000; + }; + } + // In a browser, use self.performance.now if it is available. + else if (typeof (self) !== 'undefined' && + self.performance !== undefined && + self.performance.now !== undefined) { + // This must be bound, because directly assigning this function + // leads to an invocation exception in Chrome. + TWEEN.now = self.performance.now.bind(self.performance); + } + // Use Date.now if it is available. + else if (Date.now !== undefined) { + TWEEN.now = Date.now; + } + // Otherwise, use 'new Date().getTime()'. + else { + TWEEN.now = function () { + return new Date().getTime(); + }; + } + + + TWEEN.Tween = function (object, group) { + this._object = object; + this._valuesStart = {}; + this._valuesEnd = {}; + this._valuesStartRepeat = {}; + this._duration = 1000; + this._repeat = 0; + this._repeatDelayTime = undefined; + this._yoyo = false; + this._isPlaying = false; + this._reversed = false; + this._delayTime = 0; + this._startTime = null; + this._easingFunction = TWEEN.Easing.Linear.None; + this._interpolationFunction = TWEEN.Interpolation.Linear; + this._chainedTweens = []; + this._onStartCallback = null; + this._onStartCallbackFired = false; + this._onUpdateCallback = null; + this._onRepeatCallback = null; + this._onCompleteCallback = null; + this._onStopCallback = null; + this._group = group || TWEEN; + this._id = TWEEN.nextId(); + + }; + + TWEEN.Tween.prototype = { + getId: function () { + return this._id; + }, + + isPlaying: function () { + return this._isPlaying; + }, + + to: function (properties, duration) { + + this._valuesEnd = Object.create(properties); + + if (duration !== undefined) { + this._duration = duration; + } + + return this; + + }, + + duration: function duration(d) { + this._duration = d; + return this; + }, + + start: function (time) { + + this._group.add(this); + + this._isPlaying = true; + + this._onStartCallbackFired = false; + + this._startTime = time !== undefined ? typeof time === 'string' ? TWEEN.now() + parseFloat(time) : time : TWEEN.now(); + this._startTime += this._delayTime; + + for (var property in this._valuesEnd) { + + // Check if an Array was provided as property value + if (this._valuesEnd[property] instanceof Array) { + + if (this._valuesEnd[property].length === 0) { + continue; + } + + // Create a local copy of the Array with the start value at the front + this._valuesEnd[property] = [this._object[property]].concat(this._valuesEnd[property]); + + } + + // If `to()` specifies a property that doesn't exist in the source object, + // we should not set that property in the object + if (this._object[property] === undefined) { + continue; + } + + // Save the starting value. + this._valuesStart[property] = this._object[property]; + + if ((this._valuesStart[property] instanceof Array) === false) { + this._valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings + } + + this._valuesStartRepeat[property] = this._valuesStart[property] || 0; + + } + + return this; + + }, + + stop: function () { + + if (!this._isPlaying) { + return this; + } + + this._group.remove(this); + this._isPlaying = false; + + if (this._onStopCallback !== null) { + this._onStopCallback(this._object); + } + + this.stopChainedTweens(); + return this; + + }, + + end: function () { + + this.update(Infinity); + return this; + + }, + + stopChainedTweens: function () { + + for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { + this._chainedTweens[i].stop(); + } + + }, + + group: function (group) { + this._group = group; + return this; + }, + + delay: function (amount) { + + this._delayTime = amount; + return this; + + }, + + repeat: function (times) { + + this._repeat = times; + return this; + + }, + + repeatDelay: function (amount) { + + this._repeatDelayTime = amount; + return this; + + }, + + yoyo: function (yoyo) { + + this._yoyo = yoyo; + return this; + + }, + + easing: function (easingFunction) { + + this._easingFunction = easingFunction; + return this; + + }, + + interpolation: function (interpolationFunction) { + + this._interpolationFunction = interpolationFunction; + return this; + + }, + + chain: function () { + + this._chainedTweens = arguments; + return this; + + }, + + onStart: function (callback) { + + this._onStartCallback = callback; + return this; + + }, + + onUpdate: function (callback) { + + this._onUpdateCallback = callback; + return this; + + }, + + onRepeat: function onRepeat(callback) { + + this._onRepeatCallback = callback; + return this; + + }, + + onComplete: function (callback) { + + this._onCompleteCallback = callback; + return this; + + }, + + onStop: function (callback) { + + this._onStopCallback = callback; + return this; + + }, + + update: function (time) { + + var property; + var elapsed; + var value; + + if (time < this._startTime) { + return true; + } + + if (this._onStartCallbackFired === false) { + + if (this._onStartCallback !== null) { + this._onStartCallback(this._object); + } + + this._onStartCallbackFired = true; + } + + elapsed = (time - this._startTime) / this._duration; + elapsed = (this._duration === 0 || elapsed > 1) ? 1 : elapsed; + + value = this._easingFunction(elapsed); + + for (property in this._valuesEnd) { + + // Don't update properties that do not exist in the source object + if (this._valuesStart[property] === undefined) { + continue; + } + + var start = this._valuesStart[property] || 0; + var end = this._valuesEnd[property]; + + if (end instanceof Array) { + + this._object[property] = this._interpolationFunction(end, value); + + } else { + + // Parses relative end values with start as base (e.g.: +10, -3) + if (typeof (end) === 'string') { + + if (end.charAt(0) === '+' || end.charAt(0) === '-') { + end = start + parseFloat(end); + } else { + end = parseFloat(end); + } + } + + // Protect against non numeric properties. + if (typeof (end) === 'number') { + this._object[property] = start + (end - start) * value; + } + + } + + } + + if (this._onUpdateCallback !== null) { + this._onUpdateCallback(this._object, elapsed); + } + + if (elapsed === 1) { + + if (this._repeat > 0) { + + if (isFinite(this._repeat)) { + this._repeat--; + } + + // Reassign starting values, restart by making startTime = now + for (property in this._valuesStartRepeat) { + + if (typeof (this._valuesEnd[property]) === 'string') { + this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]); + } + + if (this._yoyo) { + var tmp = this._valuesStartRepeat[property]; + + this._valuesStartRepeat[property] = this._valuesEnd[property]; + this._valuesEnd[property] = tmp; + } + + this._valuesStart[property] = this._valuesStartRepeat[property]; + + } + + if (this._yoyo) { + this._reversed = !this._reversed; + } + + if (this._repeatDelayTime !== undefined) { + this._startTime = time + this._repeatDelayTime; + } else { + this._startTime = time + this._delayTime; + } + + if (this._onRepeatCallback !== null) { + this._onRepeatCallback(this._object); + } + + return true; + + } else { + + if (this._onCompleteCallback !== null) { + + this._onCompleteCallback(this._object); + } + + for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { + // Make the chained tweens start exactly at the time they should, + // even if the `update()` method was called way past the duration of the tween + this._chainedTweens[i].start(this._startTime + this._duration); + } + + return false; + + } + + } + + return true; + + } + }; + + + TWEEN.Easing = { + + Linear: { + + None: function (k) { + + return k; + + } + + }, + + Quadratic: { + + In: function (k) { + + return k * k; + + }, + + Out: function (k) { + + return k * (2 - k); + + }, + + InOut: function (k) { + + if ((k *= 2) < 1) { + return 0.5 * k * k; + } + + return - 0.5 * (--k * (k - 2) - 1); + + } + + }, + + Cubic: { + + In: function (k) { + + return k * k * k; + + }, + + Out: function (k) { + + return --k * k * k + 1; + + }, + + InOut: function (k) { + + if ((k *= 2) < 1) { + return 0.5 * k * k * k; + } + + return 0.5 * ((k -= 2) * k * k + 2); + + } + + }, + + Quartic: { + + In: function (k) { + + return k * k * k * k; + + }, + + Out: function (k) { + + return 1 - (--k * k * k * k); + + }, + + InOut: function (k) { + + if ((k *= 2) < 1) { + return 0.5 * k * k * k * k; + } + + return - 0.5 * ((k -= 2) * k * k * k - 2); + + } + + }, + + Quintic: { + + In: function (k) { + + return k * k * k * k * k; + + }, + + Out: function (k) { + + return --k * k * k * k * k + 1; + + }, + + InOut: function (k) { + + if ((k *= 2) < 1) { + return 0.5 * k * k * k * k * k; + } + + return 0.5 * ((k -= 2) * k * k * k * k + 2); + + } + + }, + + Sinusoidal: { + + In: function (k) { + + return 1 - Math.cos(k * Math.PI / 2); + + }, + + Out: function (k) { + + return Math.sin(k * Math.PI / 2); + + }, + + InOut: function (k) { + + return 0.5 * (1 - Math.cos(Math.PI * k)); + + } + + }, + + Exponential: { + + In: function (k) { + + return k === 0 ? 0 : Math.pow(1024, k - 1); + + }, + + Out: function (k) { + + return k === 1 ? 1 : 1 - Math.pow(2, - 10 * k); + + }, + + InOut: function (k) { + + if (k === 0) { + return 0; + } + + if (k === 1) { + return 1; + } + + if ((k *= 2) < 1) { + return 0.5 * Math.pow(1024, k - 1); + } + + return 0.5 * (- Math.pow(2, - 10 * (k - 1)) + 2); + + } + + }, + + Circular: { + + In: function (k) { + + return 1 - Math.sqrt(1 - k * k); + + }, + + Out: function (k) { + + return Math.sqrt(1 - (--k * k)); + + }, + + InOut: function (k) { + + if ((k *= 2) < 1) { + return - 0.5 * (Math.sqrt(1 - k * k) - 1); + } + + return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1); + + } + + }, + + Elastic: { + + In: function (k) { + + if (k === 0) { + return 0; + } + + if (k === 1) { + return 1; + } + + return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI); + + }, + + Out: function (k) { + + if (k === 0) { + return 0; + } + + if (k === 1) { + return 1; + } + + return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1; + + }, + + InOut: function (k) { + + if (k === 0) { + return 0; + } + + if (k === 1) { + return 1; + } + + k *= 2; + + if (k < 1) { + return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI); + } + + return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1; + + } + + }, + + Back: { + + In: function (k) { + + var s = 1.70158; + + return k * k * ((s + 1) * k - s); + + }, + + Out: function (k) { + + var s = 1.70158; + + return --k * k * ((s + 1) * k + s) + 1; + + }, + + InOut: function (k) { + + var s = 1.70158 * 1.525; + + if ((k *= 2) < 1) { + return 0.5 * (k * k * ((s + 1) * k - s)); + } + + return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2); + + } + + }, + + Bounce: { + + In: function (k) { + + return 1 - TWEEN.Easing.Bounce.Out(1 - k); + + }, + + Out: function (k) { + + if (k < (1 / 2.75)) { + return 7.5625 * k * k; + } else if (k < (2 / 2.75)) { + return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75; + } else if (k < (2.5 / 2.75)) { + return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375; + } else { + return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375; + } + + }, + + InOut: function (k) { + + if (k < 0.5) { + return TWEEN.Easing.Bounce.In(k * 2) * 0.5; + } + + return TWEEN.Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5; + + } + + } + + }; + + TWEEN.Interpolation = { + + Linear: function (v, k) { + + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + var fn = TWEEN.Interpolation.Utils.Linear; + + if (k < 0) { + return fn(v[0], v[1], f); + } + + if (k > 1) { + return fn(v[m], v[m - 1], m - f); + } + + return fn(v[i], v[i + 1 > m ? m : i + 1], f - i); + + }, + + Bezier: function (v, k) { + + var b = 0; + var n = v.length - 1; + var pw = Math.pow; + var bn = TWEEN.Interpolation.Utils.Bernstein; + + for (var i = 0; i <= n; i++) { + b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i); + } + + return b; + + }, + + CatmullRom: function (v, k) { + + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); + var fn = TWEEN.Interpolation.Utils.CatmullRom; + + if (v[0] === v[m]) { + + if (k < 0) { + i = Math.floor(f = m * (1 + k)); + } + + return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i); + + } else { + + if (k < 0) { + return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]); + } + + if (k > 1) { + return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]); + } + + return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i); + + } + + }, + + Utils: { + + Linear: function (p0, p1, t) { + + return (p1 - p0) * t + p0; + + }, + + Bernstein: function (n, i) { + + var fc = TWEEN.Interpolation.Utils.Factorial; + + return fc(n) / fc(i) / fc(n - i); + + }, + + Factorial: (function () { + + var a = [1]; + + return function (n) { + + var s = 1; + + if (a[n]) { + return a[n]; + } + + for (var i = n; i > 1; i--) { + s *= i; + } + + a[n] = s; + return s; + + }; + + })(), + + CatmullRom: function (p0, p1, p2, p3, t) { + + var v0 = (p2 - p0) * 0.5; + var v1 = (p3 - p1) * 0.5; + var t2 = t * t; + var t3 = t * t2; + + return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (- 3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; + + } + + } + + }; + + // UMD (Universal Module Definition) + (function (root) { + + { + + // Node.js + module.exports = TWEEN; + + } + + })(); + }); + + /** + * @classdesc Information spot attached to panorama + * @constructor + * @param {number} [scale=300] - Default scale + * @param {string} [imageSrc=PANOLENS.DataImage.Info] - Image overlay info + * @param {boolean} [animated=true] - Enable default hover animation + */ + function Infospot ( scale = 300, imageSrc, animated ) { + + const duration = 500, scaleFactor = 1.3; + + imageSrc = imageSrc || DataImage.Info; + + THREE.Sprite.call( this ); + + this.type = 'infospot'; + + this.animated = animated !== undefined ? animated : true; + this.isHovering = false; + + /* + * TODO: Three.js bug hotfix for sprite raycasting r104 + * https://github.com/mrdoob/three.js/issues/14624 + */ + this.frustumCulled = false; + + this.element = null; + this.toPanorama = null; + this.cursorStyle = null; + + this.mode = MODES.NORMAL; + + this.scale.set( scale, scale, 1 ); + this.rotation.y = Math.PI; + + this.container = null; + + this.originalRaycast = this.raycast; + + // Event Handler + this.HANDLER_FOCUS = null; + + this.material.side = THREE.DoubleSide; + this.material.depthTest = false; + this.material.transparent = true; + this.material.opacity = 0; + + this.scaleUpAnimation = new Tween.Tween(); + this.scaleDownAnimation = new Tween.Tween(); + + + const postLoad = function ( texture ) { + + if ( !this.material ) { return; } + + const ratio = texture.image.width / texture.image.height; + const textureScale = new THREE.Vector3(); + + texture.image.width = texture.image.naturalWidth || 64; + texture.image.height = texture.image.naturalHeight || 64; + + this.scale.set( ratio * scale, scale, 1 ); + + textureScale.copy( this.scale ); + + this.scaleUpAnimation = new Tween.Tween( this.scale ) + .to( { x: textureScale.x * scaleFactor, y: textureScale.y * scaleFactor }, duration ) + .easing( Tween.Easing.Elastic.Out ); + + this.scaleDownAnimation = new Tween.Tween( this.scale ) + .to( { x: textureScale.x, y: textureScale.y }, duration ) + .easing( Tween.Easing.Elastic.Out ); + + this.material.map = texture; + this.material.needsUpdate = true; + + }.bind( this ); + + // Add show and hide animations + this.showAnimation = new Tween.Tween( this.material ) + .to( { opacity: 1 }, duration ) + .onStart( this.enableRaycast.bind( this, true ) ) + .easing( Tween.Easing.Quartic.Out ); + + this.hideAnimation = new Tween.Tween( this.material ) + .to( { opacity: 0 }, duration ) + .onStart( this.enableRaycast.bind( this, false ) ) + .easing( Tween.Easing.Quartic.Out ); + + // Attach event listeners + this.addEventListener( 'click', this.onClick ); + this.addEventListener( 'hover', this.onHover ); + this.addEventListener( 'hoverenter', this.onHoverStart ); + this.addEventListener( 'hoverleave', this.onHoverEnd ); + this.addEventListener( 'panolens-dual-eye-effect', this.onDualEyeEffect ); + this.addEventListener( 'panolens-container', this.setContainer.bind( this ) ); + this.addEventListener( 'dismiss', this.onDismiss ); + this.addEventListener( 'panolens-infospot-focus', this.setFocusMethod ); + + TextureLoader.load( imageSrc, postLoad ); + + } + Infospot.prototype = Object.assign( Object.create( THREE.Sprite.prototype ), { + + constructor: Infospot, + + /** + * Set infospot container + * @param {HTMLElement|object} data - Data with container information + * @memberOf Infospot + * @instance + */ + setContainer: function ( data ) { + + let container; + + if ( data instanceof HTMLElement ) { + + container = data; + + } else if ( data && data.container ) { + + container = data.container; + + } + + // Append element if exists + if ( container && this.element ) { + + container.appendChild( this.element ); + + } + + this.container = container; + + }, + + /** + * Get container + * @memberOf Infospot + * @instance + * @return {HTMLElement} - The container of this infospot + */ + getContainer: function () { + + return this.container; + + }, + + /** + * This will be called by a click event + * Translate and lock the hovering element if any + * @param {object} event - Event containing mouseEvent with clientX and clientY + * @memberOf Infospot + * @instance + */ + onClick: function ( event ) { + + if ( this.element && this.getContainer() ) { + + this.onHoverStart( event ); + + // Lock element + this.lockHoverElement(); + + } + + }, + + /** + * Dismiss current element if any + * @param {object} event - Dismiss event + * @memberOf Infospot + * @instance + */ + onDismiss: function () { + + if ( this.element ) { + + this.unlockHoverElement(); + this.onHoverEnd(); + + } + + }, + + /** + * This will be called by a mouse hover event + * Translate the hovering element if any + * @param {object} event - Event containing mouseEvent with clientX and clientY + * @memberOf Infospot + * @instance + */ + onHover: function () {}, + + /** + * This will be called on a mouse hover start + * Sets cursor style to 'pointer', display the element and scale up the infospot + * @param {object} event + * @memberOf Infospot + * @instance + */ + onHoverStart: function ( event ) { + + if ( !this.getContainer() ) { return; } + + const cursorStyle = this.cursorStyle || ( this.mode === MODES.NORMAL ? 'pointer' : 'default' ); + const { scaleDownAnimation, scaleUpAnimation, element } = this; + + this.isHovering = true; + this.container.style.cursor = cursorStyle; + + if ( this.animated ) { + + scaleDownAnimation.stop(); + scaleUpAnimation.start(); + + } + + if ( element && event.mouseEvent.clientX >= 0 && event.mouseEvent.clientY >= 0 ) { + + const { left, right, style } = element; + + if ( this.mode === MODES.CARDBOARD || this.mode === MODES.STEREO ) { + + style.display = 'none'; + left.style.display = 'block'; + right.style.display = 'block'; + + // Store element width for reference + element._width = left.clientWidth; + element._height = left.clientHeight; + + } else { + + style.display = 'block'; + if ( left ) { left.style.display = 'none'; } + if ( right ) { right.style.display = 'none'; } + + // Store element width for reference + element._width = element.clientWidth; + element._height = element.clientHeight; + + } + + } + + }, + + /** + * This will be called on a mouse hover end + * Sets cursor style to 'default', hide the element and scale down the infospot + * @memberOf Infospot + * @instance + */ + onHoverEnd: function () { + + if ( !this.getContainer() ) { return; } + + const { scaleDownAnimation, scaleUpAnimation, element } = this; + + this.isHovering = false; + this.container.style.cursor = 'default'; + + if ( this.animated ) { + + scaleUpAnimation.stop(); + scaleDownAnimation.start(); + + } + + if ( element && !this.element.locked ) { + + const { left, right, style } = element; + + style.display = 'none'; + if ( left ) { left.style.display = 'none'; } + if ( right ) { right.style.display = 'none'; } + + this.unlockHoverElement(); + + } + + }, + + /** + * On dual eye effect handler + * Creates duplicate left and right element + * @param {object} event - panolens-dual-eye-effect event + * @memberOf Infospot + * @instance + */ + onDualEyeEffect: function ( event ) { + + if ( !this.getContainer() ) { return; } + + let element, halfWidth, halfHeight; + + this.mode = event.mode; + + element = this.element; + + halfWidth = this.container.clientWidth / 2; + halfHeight = this.container.clientHeight / 2; + + if ( !element ) { + + return; + + } + + if ( !element.left && !element.right ) { + + element.left = element.cloneNode( true ); + element.right = element.cloneNode( true ); + + } + + if ( this.mode === MODES.CARDBOARD || this.mode === MODES.STEREO ) { + + element.left.style.display = element.style.display; + element.right.style.display = element.style.display; + element.style.display = 'none'; + + } else { + + element.style.display = element.left.style.display; + element.left.style.display = 'none'; + element.right.style.display = 'none'; + + } + + // Update elements translation + this.translateElement( halfWidth, halfHeight ); + + this.container.appendChild( element.left ); + this.container.appendChild( element.right ); + + }, + + /** + * Translate the hovering element by css transform + * @param {number} x - X position on the window screen + * @param {number} y - Y position on the window screen + * @memberOf Infospot + * @instance + */ + translateElement: function ( x, y ) { + + if ( !this.element._width || !this.element._height || !this.getContainer() ) { + + return; + + } + + let left, top, element, width, height, delta, container; + + container = this.container; + element = this.element; + width = element._width / 2; + height = element._height / 2; + delta = element.verticalDelta !== undefined ? element.verticalDelta : 40; + + left = x - width; + top = y - height - delta; + + if ( ( this.mode === MODES.CARDBOARD || this.mode === MODES.STEREO ) + && element.left && element.right + && !( x === container.clientWidth / 2 && y === container.clientHeight / 2 ) ) { + + left = container.clientWidth / 4 - width + ( x - container.clientWidth / 2 ); + top = container.clientHeight / 2 - height - delta + ( y - container.clientHeight / 2 ); + + this.setElementStyle( 'transform', element.left, 'translate(' + left + 'px, ' + top + 'px)' ); + + left += container.clientWidth / 2; + + this.setElementStyle( 'transform', element.right, 'translate(' + left + 'px, ' + top + 'px)' ); + + } else { + + this.setElementStyle( 'transform', element, 'translate(' + left + 'px, ' + top + 'px)' ); + + } + + }, + + /** + * Set vendor specific css + * @param {string} type - CSS style name + * @param {HTMLElement} element - The element to be modified + * @param {string} value - Style value + * @memberOf Infospot + * @instance + */ + setElementStyle: function ( type, element, value ) { + + const style = element.style; + + if ( type === 'transform' ) { + + style.webkitTransform = style.msTransform = style.transform = value; + + } + + }, + + /** + * Set hovering text content + * @param {string} text - Text to be displayed + * @memberOf Infospot + * @instance + */ + setText: function ( text ) { + + if ( this.element ) { + + this.element.textContent = text; + + } + + }, + + /** + * Set cursor css style on hover + * @memberOf Infospot + * @instance + */ + setCursorHoverStyle: function ( style ) { + + this.cursorStyle = style; + + }, + + /** + * Add hovering text element + * @param {string} text - Text to be displayed + * @param {number} [delta=40] - Vertical delta to the infospot + * @memberOf Infospot + * @instance + */ + addHoverText: function ( text, delta = 40 ) { + + if ( !this.element ) { + + this.element = document.createElement( 'div' ); + this.element.style.display = 'none'; + this.element.style.color = '#fff'; + this.element.style.top = 0; + this.element.style.maxWidth = '50%'; + this.element.style.maxHeight = '50%'; + this.element.style.textShadow = '0 0 3px #000000'; + this.element.style.fontFamily = '"Trebuchet MS", Helvetica, sans-serif'; + this.element.style.position = 'absolute'; + this.element.classList.add( 'panolens-infospot' ); + this.element.verticalDelta = delta; + + } + + this.setText( text ); + + }, + + /** + * Add hovering element by cloning an element + * @param {HTMLDOMElement} el - Element to be cloned and displayed + * @param {number} [delta=40] - Vertical delta to the infospot + * @memberOf Infospot + * @instance + */ + addHoverElement: function ( el, delta = 40 ) { + + if ( !this.element ) { + + this.element = el.cloneNode( true ); + this.element.style.display = 'none'; + this.element.style.top = 0; + this.element.style.position = 'absolute'; + this.element.classList.add( 'panolens-infospot' ); + this.element.verticalDelta = delta; + + } + + }, + + /** + * Remove hovering element + * @memberOf Infospot + * @instance + */ + removeHoverElement: function () { + + if ( this.element ) { + + if ( this.element.left ) { + + this.container.removeChild( this.element.left ); + this.element.left = null; + + } + + if ( this.element.right ) { + + this.container.removeChild( this.element.right ); + this.element.right = null; + + } + + this.container.removeChild( this.element ); + this.element = null; + + } + + }, + + /** + * Lock hovering element + * @memberOf Infospot + * @instance + */ + lockHoverElement: function () { + + if ( this.element ) { + + this.element.locked = true; + + } + + }, + + /** + * Unlock hovering element + * @memberOf Infospot + * @instance + */ + unlockHoverElement: function () { + + if ( this.element ) { + + this.element.locked = false; + + } + + }, + + /** + * Enable raycasting + * @param {boolean} [enabled=true] + * @memberOf Infospot + * @instance + */ + enableRaycast: function ( enabled = true ) { + + if ( enabled ) { + + this.raycast = this.originalRaycast; + + } else { + + this.raycast = () => {}; + + } + + }, + + /** + * Show infospot + * @param {number} [delay=0] - Delay time to show + * @memberOf Infospot + * @instance + */ + show: function ( delay = 0 ) { + + const { animated, hideAnimation, showAnimation, material } = this; + + if ( animated ) { + + hideAnimation.stop(); + showAnimation.delay( delay ).start(); + + } else { + + this.enableRaycast( true ); + material.opacity = 1; + + } + + }, + + /** + * Hide infospot + * @param {number} [delay=0] - Delay time to hide + * @memberOf Infospot + * @instance + */ + hide: function ( delay = 0 ) { + + const { animated, hideAnimation, showAnimation, material, element } = this; + + if ( element ) { + const { style } = element; + style.display = 'none'; + } + + if ( animated ) { + + showAnimation.stop(); + hideAnimation.delay( delay ).start(); + + } else { + + this.enableRaycast( false ); + material.opacity = 0; + + } + + }, + + /** + * Set focus event handler + * @memberOf Infospot + * @instance + */ + setFocusMethod: function ( event ) { + + if ( event ) { + + this.HANDLER_FOCUS = event.method; + + } + + }, + + /** + * Focus camera center to this infospot + * @param {number} [duration=1000] - Duration to tween + * @param {function} [easing=TWEEN.Easing.Exponential.Out] - Easing function + * @memberOf Infospot + * @instance + */ + focus: function ( duration, easing ) { + + if ( this.HANDLER_FOCUS ) { + + this.HANDLER_FOCUS( this.position, duration, easing ); + this.onDismiss(); + + } + + }, + + /** + * Dispose + * @memberOf Infospot + * @instance + */ + dispose: function () { + + const { geometry, material } = this; + const { map } = material; + + this.removeHoverElement(); + + if ( this.parent ) { + + this.parent.remove( this ); + + } + + if ( map ) { map.dispose(); material.map = null; } + if ( geometry ) { geometry.dispose(); this.geometry = null; } + if ( material ) { material.dispose(); this.material = null; } + + } + + } ); + + /** + * @classdesc Widget for controls + * @constructor + * @param {HTMLElement} container - A domElement where default control widget will be attached to + */ + function Widget ( container ) { + + if ( !container ) { + + console.warn( 'PANOLENS.Widget: No container specified' ); + + } + + THREE.EventDispatcher.call( this ); + + this.DEFAULT_TRANSITION = 'all 0.27s ease'; + this.TOUCH_ENABLED = !!(( 'ontouchstart' in window ) || window.DocumentTouch && document instanceof DocumentTouch); + this.PREVENT_EVENT_HANDLER = function ( event ) { + event.preventDefault(); + event.stopPropagation(); + }; + + this.container = container; + + this.barElement = null; + this.fullscreenElement = null; + this.videoElement = null; + this.settingElement = null; + + this.mainMenu = null; + + this.activeMainItem = null; + this.activeSubMenu = null; + this.mask = null; + + } + + Widget.prototype = Object.assign( Object.create( THREE.EventDispatcher.prototype ), { + + constructor: Widget, + + /** + * Add control bar + * @memberOf Widget + * @instance + */ + addControlBar: function () { + + if ( !this.container ) { + + console.warn( 'Widget container not set' ); + return; + } + + var scope = this, bar, styleTranslate, styleOpacity, gradientStyle; + + gradientStyle = 'linear-gradient(bottom, rgba(0,0,0,0.2), rgba(0,0,0,0))'; + + bar = document.createElement( 'div' ); + bar.style.width = '100%'; + bar.style.height = '44px'; + bar.style.float = 'left'; + bar.style.transform = bar.style.webkitTransform = bar.style.msTransform = 'translateY(-100%)'; + bar.style.background = '-webkit-' + gradientStyle; + bar.style.background = '-moz-' + gradientStyle; + bar.style.background = '-o-' + gradientStyle; + bar.style.background = '-ms-' + gradientStyle; + bar.style.background = gradientStyle; + bar.style.transition = this.DEFAULT_TRANSITION; + bar.style.pointerEvents = 'none'; + bar.isHidden = false; + bar.toggle = function () { + bar.isHidden = !bar.isHidden; + styleTranslate = bar.isHidden ? 'translateY(0)' : 'translateY(-100%)'; + styleOpacity = bar.isHidden ? 0 : 1; + bar.style.transform = bar.style.webkitTransform = bar.style.msTransform = styleTranslate; + bar.style.opacity = styleOpacity; + }; + + // Menu + var menu = this.createDefaultMenu(); + this.mainMenu = this.createMainMenu( menu ); + bar.appendChild( this.mainMenu ); + + // Mask + var mask = this.createMask(); + this.mask = mask; + this.container.appendChild( mask ); + + // Dispose + bar.dispose = function () { + + if ( scope.fullscreenElement ) { + + bar.removeChild( scope.fullscreenElement ); + scope.fullscreenElement.dispose(); + scope.fullscreenElement = null; + + } + + if ( scope.settingElement ) { + + bar.removeChild( scope.settingElement ); + scope.settingElement.dispose(); + scope.settingElement = null; + + } + + if ( scope.videoElement ) { + + bar.removeChild( scope.videoElement ); + scope.videoElement.dispose(); + scope.videoElement = null; + + } + + }; + + this.container.appendChild( bar ); + + // Mask events + this.mask.addEventListener( 'mousemove', this.PREVENT_EVENT_HANDLER, true ); + this.mask.addEventListener( 'mouseup', this.PREVENT_EVENT_HANDLER, true ); + this.mask.addEventListener( 'mousedown', this.PREVENT_EVENT_HANDLER, true ); + this.mask.addEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'click', function ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + scope.mask.hide(); + scope.settingElement.deactivate(); + + }, false ); + + // Event listener + this.addEventListener( 'control-bar-toggle', bar.toggle ); + + this.barElement = bar; + + }, + + /** + * Create default menu + * @memberOf Widget + * @instance + */ + createDefaultMenu: function () { + + var scope = this, handler; + + handler = function ( method, data ) { + + return function () { + + scope.dispatchEvent( { + + type: 'panolens-viewer-handler', + method: method, + data: data + + } ); + + }; + + }; + + return [ + + { + title: 'Control', + subMenu: [ + { + title: this.TOUCH_ENABLED ? 'Touch' : 'Mouse', + handler: handler( 'enableControl', CONTROLS.ORBIT ) + }, + { + title: 'Sensor', + handler: handler( 'enableControl', CONTROLS.DEVICEORIENTATION ) + } + ] + }, + + { + title: 'Mode', + subMenu: [ + { + title: 'Normal', + handler: handler( 'disableEffect' ) + }, + { + title: 'Cardboard', + handler: handler( 'enableEffect', MODES.CARDBOARD ) + }, + { + title: 'Stereoscopic', + handler: handler( 'enableEffect', MODES.STEREO ) + } + ] + } + + ]; + + }, + + /** + * Add buttons on top of control bar + * @param {string} name - The control button name to be created + * @memberOf Widget + * @instance + */ + addControlButton: function ( name ) { + + let element; + + switch( name ) { + + case 'fullscreen': + + element = this.createFullscreenButton(); + this.fullscreenElement = element; + + break; + + case 'setting': + + element = this.createSettingButton(); + this.settingElement = element; + + break; + + case 'video': + + element = this.createVideoControl(); + this.videoElement = element; + + break; + + default: + + return; + + } + + if ( !element ) { + + return; + + } + + this.barElement.appendChild( element ); + + }, + + /** + * Create modal mask + * @memberOf Widget + * @instance + */ + createMask: function () { + + const element = document.createElement( 'div' ); + element.style.position = 'absolute'; + element.style.top = 0; + element.style.left = 0; + element.style.width = '100%'; + element.style.height = '100%'; + element.style.background = 'transparent'; + element.style.display = 'none'; + + element.show = function () { + + this.style.display = 'block'; + + }; + + element.hide = function () { + + this.style.display = 'none'; + + }; + + return element; + + }, + + /** + * Create Setting button to toggle menu + * @memberOf Widget + * @instance + */ + createSettingButton: function () { + + let scope = this, item; + + function onTap ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + scope.mainMenu.toggle(); + + if ( this.activated ) { + + this.deactivate(); + + } else { + + this.activate(); + + } + + } + + item = this.createCustomItem( { + + style: { + + backgroundImage: 'url("' + DataImage.Setting + '")', + webkitTransition: this.DEFAULT_TRANSITION, + transition: this.DEFAULT_TRANSITION + + }, + + onTap: onTap + + } ); + + item.activate = function () { + + this.style.transform = 'rotate3d(0,0,1,90deg)'; + this.activated = true; + scope.mask.show(); + + }; + + item.deactivate = function () { + + this.style.transform = 'rotate3d(0,0,0,0)'; + this.activated = false; + scope.mask.hide(); + + if ( scope.mainMenu && scope.mainMenu.visible ) { + + scope.mainMenu.hide(); + + } + + if ( scope.activeSubMenu && scope.activeSubMenu.visible ) { + + scope.activeSubMenu.hide(); + + } + + if ( scope.mainMenu && scope.mainMenu._width ) { + + scope.mainMenu.changeSize( scope.mainMenu._width ); + scope.mainMenu.unslideAll(); + + } + + }; + + item.activated = false; + + return item; + + }, + + /** + * Create Fullscreen button + * @return {HTMLSpanElement} - The dom element icon for fullscreen + * @memberOf Widget + * @instance + * @fires Widget#panolens-viewer-handler + */ + createFullscreenButton: function () { + + let scope = this, item, isFullscreen = false, tapSkipped = true, stylesheetId; + + const { container } = this; + + stylesheetId = 'panolens-style-addon'; + + // Don't create button if no support + if ( !document.fullscreenEnabled && + !document.webkitFullscreenEnabled && + !document.mozFullScreenEnabled && + !document.msFullscreenEnabled ) { + return; + } + + function onTap ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + tapSkipped = false; + + if ( !isFullscreen ) { + + if ( container.requestFullscreen ) { container.requestFullscreen(); } + if ( container.msRequestFullscreen ) { container.msRequestFullscreen(); } + if ( container.mozRequestFullScreen ) { container.mozRequestFullScreen(); } + if ( container.webkitRequestFullscreen ) { container.webkitRequestFullscreen( Element.ALLOW_KEYBOARD_INPUT ); } + + isFullscreen = true; + + } else { + + if ( document.exitFullscreen ) { document.exitFullscreen(); } + if ( document.msExitFullscreen ) { document.msExitFullscreen(); } + if ( document.mozCancelFullScreen ) { document.mozCancelFullScreen(); } + if ( document.webkitExitFullscreen ) { document.webkitExitFullscreen( ); } + + isFullscreen = false; + + } + + this.style.backgroundImage = ( isFullscreen ) + ? 'url("' + DataImage.FullscreenLeave + '")' + : 'url("' + DataImage.FullscreenEnter + '")'; + + } + + function onFullScreenChange () { + + if ( tapSkipped ) { + + isFullscreen = !isFullscreen; + + item.style.backgroundImage = ( isFullscreen ) + ? 'url("' + DataImage.FullscreenLeave + '")' + : 'url("' + DataImage.FullscreenEnter + '")'; + + } + + /** + * Viewer handler event + * @type {object} + * @event Widget#panolens-viewer-handler + * @property {string} method - 'onWindowResize' function call on Viewer + */ + scope.dispatchEvent( { type: 'panolens-viewer-handler', method: 'onWindowResize' } ); + + tapSkipped = true; + + } + + document.addEventListener( 'fullscreenchange', onFullScreenChange, false ); + document.addEventListener( 'webkitfullscreenchange', onFullScreenChange, false ); + document.addEventListener( 'mozfullscreenchange', onFullScreenChange, false ); + document.addEventListener( 'MSFullscreenChange', onFullScreenChange, false ); + + item = this.createCustomItem( { + + style: { + + backgroundImage: 'url("' + DataImage.FullscreenEnter + '")' + + }, + + onTap: onTap + + } ); + + // Add fullscreen stlye if not exists + if ( !document.querySelector( stylesheetId ) ) { + const sheet = document.createElement( 'style' ); + sheet.id = stylesheetId; + sheet.innerHTML = ':-webkit-full-screen { width: 100% !important; height: 100% !important }'; + document.body.appendChild( sheet ); + } + + return item; + + }, + + /** + * Create video control container + * @memberOf Widget + * @instance + * @return {HTMLSpanElement} - The dom element icon for video control + */ + createVideoControl: function () { + + const item = document.createElement( 'span' ); + item.style.display = 'none'; + item.show = function () { + + item.style.display = ''; + + }; + + item.hide = function () { + + item.style.display = 'none'; + item.controlButton.paused = true; + item.controlButton.update(); + + }; + + item.controlButton = this.createVideoControlButton(); + item.seekBar = this.createVideoControlSeekbar(); + + item.appendChild( item.controlButton ); + item.appendChild( item.seekBar ); + + item.dispose = function () { + + item.removeChild( item.controlButton ); + item.removeChild( item.seekBar ); + + item.controlButton.dispose(); + item.controlButton = null; + + item.seekBar.dispose(); + item.seekBar = null; + + }; + + this.addEventListener( 'video-control-show', item.show ); + this.addEventListener( 'video-control-hide', item.hide ); + + return item; + + }, + + /** + * Create video control button + * @memberOf Widget + * @instance + * @return {HTMLSpanElement} - The dom element icon for video control + * @fires Widget#panolens-viewer-handler + */ + createVideoControlButton: function () { + + const scope = this; + + function onTap ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + /** + * Viewer handler event + * @type {object} + * @event Widget#panolens-viewer-handler + * @property {string} method - 'toggleVideoPlay' function call on Viewer + */ + scope.dispatchEvent( { type: 'panolens-viewer-handler', method: 'toggleVideoPlay', data: !this.paused } ); + + this.paused = !this.paused; + + item.update(); + + } + const item = this.createCustomItem( { + + style: { + + float: 'left', + backgroundImage: 'url("' + DataImage.VideoPlay + '")' + + }, + + onTap: onTap + + } ); + + item.paused = true; + + item.update = function ( paused ) { + + this.paused = paused !== undefined ? paused : this.paused; + + this.style.backgroundImage = 'url("' + ( this.paused + ? DataImage.VideoPlay + : DataImage.VideoPause ) + '")'; + + }; + + return item; + + }, + + /** + * Create video seekbar + * @memberOf Widget + * @instance + * @return {HTMLSpanElement} - The dom element icon for video seekbar + * @fires Widget#panolens-viewer-handler + */ + createVideoControlSeekbar: function () { + + let scope = this, item, progressElement, progressElementControl, + isDragging = false, mouseX, percentageNow, percentageNext; + + progressElement = document.createElement( 'div' ); + progressElement.style.width = '0%'; + progressElement.style.height = '100%'; + progressElement.style.backgroundColor = '#fff'; + + progressElementControl = document.createElement( 'div' ); + progressElementControl.style.float = 'right'; + progressElementControl.style.width = '14px'; + progressElementControl.style.height = '14px'; + progressElementControl.style.transform = 'translate(7px, -5px)'; + progressElementControl.style.borderRadius = '50%'; + progressElementControl.style.backgroundColor = '#ddd'; + + progressElementControl.addEventListener( 'mousedown', onMouseDown, { passive: true } ); + progressElementControl.addEventListener( 'touchstart', onMouseDown, { passive: true } ); + + function onMouseDown ( event ) { + + event.stopPropagation(); + + isDragging = true; + + mouseX = event.clientX || ( event.changedTouches && event.changedTouches[0].clientX ); + + percentageNow = parseInt( progressElement.style.width ) / 100; + + addControlListeners(); + } + + function onVideoControlDrag ( event ) { + + if( isDragging ){ + + const clientX = event.clientX || ( event.changedTouches && event.changedTouches[0].clientX ); + + percentageNext = ( clientX - mouseX ) / item.clientWidth; + + percentageNext = percentageNow + percentageNext; + + percentageNext = percentageNext > 1 ? 1 : ( ( percentageNext < 0 ) ? 0 : percentageNext ); + + item.setProgress ( percentageNext ); + + /** + * Viewer handler event + * @type {object} + * @event Widget#panolens-viewer-handler + * @property {string} method - 'setVideoCurrentTime' function call on Viewer + * @property {number} data - Percentage of current video. Range from 0.0 to 1.0 + */ + scope.dispatchEvent( { type: 'panolens-viewer-handler', method: 'setVideoCurrentTime', data: percentageNext } ); + + } + + } + + function onVideoControlStop ( event ) { + + event.stopPropagation(); + + isDragging = false; + + removeControlListeners(); + + } + + function addControlListeners () { + + scope.container.addEventListener( 'mousemove', onVideoControlDrag, { passive: true } ); + scope.container.addEventListener( 'mouseup', onVideoControlStop, { passive: true } ); + scope.container.addEventListener( 'touchmove', onVideoControlDrag, { passive: true } ); + scope.container.addEventListener( 'touchend', onVideoControlStop, { passive: true } ); + + + } + + function removeControlListeners () { + + scope.container.removeEventListener( 'mousemove', onVideoControlDrag, false ); + scope.container.removeEventListener( 'mouseup', onVideoControlStop, false ); + scope.container.removeEventListener( 'touchmove', onVideoControlDrag, false ); + scope.container.removeEventListener( 'touchend', onVideoControlStop, false ); + + } + + function onTap ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + if ( event.target === progressElementControl ) { return; } + + const percentage = ( event.changedTouches && event.changedTouches.length > 0 ) + ? ( event.changedTouches[0].pageX - event.target.getBoundingClientRect().left ) / this.clientWidth + : event.offsetX / this.clientWidth; + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'setVideoCurrentTime' function call on Viewer + * @property {number} data - Percentage of current video. Range from 0.0 to 1.0 + */ + scope.dispatchEvent( { type: 'panolens-viewer-handler', method: 'setVideoCurrentTime', data: percentage } ); + + item.setProgress( event.offsetX / this.clientWidth ); + + } + function onDispose () { + + removeControlListeners(); + progressElement = null; + progressElementControl = null; + + } + + progressElement.appendChild( progressElementControl ); + + item = this.createCustomItem( { + + style: { + + float: 'left', + width: '30%', + height: '4px', + marginTop: '20px', + backgroundColor: 'rgba(188,188,188,0.8)' + + }, + + onTap: onTap, + onDispose: onDispose + + } ); + + item.appendChild( progressElement ); + + item.setProgress = function( percentage ) { + + progressElement.style.width = percentage * 100 + '%'; + + }; + + this.addEventListener( 'video-update', function ( event ) { + + item.setProgress( event.percentage ); + + } ); + + item.progressElement = progressElement; + item.progressElementControl = progressElementControl; + + return item; + + }, + + /** + * Create menu item + * @param {string} title - Title to display + * @memberOf Widget + * @instance + * @return {HTMLElement} - An anchor tag element + */ + createMenuItem: function ( title ) { + + const scope = this; + const item = document.createElement( 'a' ); + item.textContent = title; + item.style.display = 'block'; + item.style.padding = '10px'; + item.style.textDecoration = 'none'; + item.style.cursor = 'pointer'; + item.style.pointerEvents = 'auto'; + item.style.transition = this.DEFAULT_TRANSITION; + + item.slide = function ( right ) { + + this.style.transform = 'translateX(' + ( right ? '' : '-' ) + '100%)'; + + }; + + item.unslide = function () { + + this.style.transform = 'translateX(0)'; + + }; + + item.setIcon = function ( url ) { + + if ( this.icon ) { + + this.icon.style.backgroundImage = 'url(' + url + ')'; + + } + + }; + + item.setSelectionTitle = function ( title ) { + + if ( this.selection ) { + + this.selection.textContent = title; + + } + + }; + + item.addSelection = function ( name ) { + + const selection = document.createElement( 'span' ); + selection.style.fontSize = '13px'; + selection.style.fontWeight = '300'; + selection.style.float = 'right'; + + this.selection = selection; + this.setSelectionTitle( name ); + this.appendChild( selection ); + + return this; + + }; + + item.addIcon = function ( url = DataImage.ChevronRight, left = false, flip = false ) { + + const element = document.createElement( 'span' ); + element.style.float = left ? 'left' : 'right'; + element.style.width = '17px'; + element.style.height = '17px'; + element.style[ 'margin' + ( left ? 'Right' : 'Left' ) ] = '12px'; + element.style.backgroundSize = 'cover'; + + if ( flip ) { + + element.style.transform = 'rotateZ(180deg)'; + + } + + this.icon = element; + this.setIcon( url ); + this.appendChild( element ); + + return this; + + }; + + item.addSubMenu = function ( title, items ) { + + this.subMenu = scope.createSubMenu( title, items ); + + return this; + + }; + + item.addEventListener( 'mouseenter', function () { + + this.style.backgroundColor = '#e0e0e0'; + + }, false ); + + item.addEventListener( 'mouseleave', function () { + + this.style.backgroundColor = '#fafafa'; + + }, false ); + + return item; + + }, + + /** + * Create menu item header + * @param {string} title - Title to display + * @memberOf Widget + * @instance + * @return {HTMLElement} - An anchor tag element + */ + createMenuItemHeader: function ( title ) { + + const header = this.createMenuItem( title ); + + header.style.borderBottom = '1px solid #333'; + header.style.paddingBottom = '15px'; + + return header; + + }, + + /** + * Create main menu + * @param {array} menus - Menu array list + * @memberOf Widget + * @instance + * @return {HTMLElement} - A span element + */ + createMainMenu: function ( menus ) { + + let scope = this, menu = this.createMenu(); + + menu._width = 200; + menu.changeSize( menu._width ); + + function onTap ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + let mainMenu = scope.mainMenu, subMenu = this.subMenu; + + function onNextTick () { + + mainMenu.changeSize( subMenu.clientWidth ); + subMenu.show(); + subMenu.unslideAll(); + + } + + mainMenu.hide(); + mainMenu.slideAll(); + mainMenu.parentElement.appendChild( subMenu ); + + scope.activeMainItem = this; + scope.activeSubMenu = subMenu; + + window.requestAnimationFrame( onNextTick ); + + } + for ( var i = 0; i < menus.length; i++ ) { + + var item = menu.addItem( menus[ i ].title ); + + item.style.paddingLeft = '20px'; + + item.addIcon() + .addEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'click', onTap, false ); + + if ( menus[ i ].subMenu && menus[ i ].subMenu.length > 0 ) { + + var title = menus[ i ].subMenu[ 0 ].title; + + item.addSelection( title ) + .addSubMenu( menus[ i ].title, menus[ i ].subMenu ); + + } + + } + + return menu; + + }, + + /** + * Create sub menu + * @param {string} title - Sub menu title + * @param {array} items - Item array list + * @memberOf Widget + * @instance + * @return {HTMLElement} - A span element + */ + createSubMenu: function ( title, items ) { + + let scope = this, menu, subMenu = this.createMenu(); + + subMenu.items = items; + subMenu.activeItem = null; + + function onTap ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + menu = scope.mainMenu; + menu.changeSize( menu._width ); + menu.unslideAll(); + menu.show(); + subMenu.slideAll( true ); + subMenu.hide(); + + if ( this.type !== 'header' ) { + + subMenu.setActiveItem( this ); + scope.activeMainItem.setSelectionTitle( this.textContent ); + + if ( this.handler ) { this.handler(); } + + } + + } + + subMenu.addHeader( title ).addIcon( undefined, true, true ).addEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'click', onTap, false ); + + for ( let i = 0; i < items.length; i++ ) { + + const item = subMenu.addItem( items[ i ].title ); + + item.style.fontWeight = 300; + item.handler = items[ i ].handler; + item.addIcon( ' ', true ); + item.addEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'click', onTap, false ); + + if ( !subMenu.activeItem ) { + + subMenu.setActiveItem( item ); + + } + + } + + subMenu.slideAll( true ); + + return subMenu; + + }, + + /** + * Create general menu + * @memberOf Widget + * @instance + * @return {HTMLElement} - A span element + */ + createMenu: function () { + + const scope = this; + const menu = document.createElement( 'span' ); + const style = menu.style; + + style.padding = '5px 0'; + style.position = 'fixed'; + style.bottom = '100%'; + style.right = '14px'; + style.backgroundColor = '#fafafa'; + style.fontFamily = 'Helvetica Neue'; + style.fontSize = '14px'; + style.visibility = 'hidden'; + style.opacity = 0; + style.boxShadow = '0 0 12pt rgba(0,0,0,0.25)'; + style.borderRadius = '2px'; + style.overflow = 'hidden'; + style.willChange = 'width, height, opacity'; + style.pointerEvents = 'auto'; + style.transition = this.DEFAULT_TRANSITION; + + menu.visible = false; + + menu.changeSize = function ( width, height ) { + + if ( width ) { + + this.style.width = width + 'px'; + + } + + if ( height ) { + + this.style.height = height + 'px'; + + } + + }; + + menu.show = function () { + + this.style.opacity = 1; + this.style.visibility = 'visible'; + this.visible = true; + + }; + + menu.hide = function () { + + this.style.opacity = 0; + this.style.visibility = 'hidden'; + this.visible = false; + + }; + + menu.toggle = function () { + + if ( this.visible ) { + + this.hide(); + + } else { + + this.show(); + + } + + }; + + menu.slideAll = function ( right ) { + + for ( let i = 0; i < menu.children.length; i++ ){ + + if ( menu.children[ i ].slide ) { + + menu.children[ i ].slide( right ); + + } + + } + + }; + + menu.unslideAll = function () { + + for ( let i = 0; i < menu.children.length; i++ ){ + + if ( menu.children[ i ].unslide ) { + + menu.children[ i ].unslide(); + + } + + } + + }; + + menu.addHeader = function ( title ) { + + const header = scope.createMenuItemHeader( title ); + header.type = 'header'; + + this.appendChild( header ); + + return header; + + }; + + menu.addItem = function ( title ) { + + const item = scope.createMenuItem( title ); + item.type = 'item'; + + this.appendChild( item ); + + return item; + + }; + + menu.setActiveItem = function ( item ) { + + if ( this.activeItem ) { + + this.activeItem.setIcon( ' ' ); + + } + + item.setIcon( DataImage.Check ); + + this.activeItem = item; + + }; + + menu.addEventListener( 'mousemove', this.PREVENT_EVENT_HANDLER, true ); + menu.addEventListener( 'mouseup', this.PREVENT_EVENT_HANDLER, true ); + menu.addEventListener( 'mousedown', this.PREVENT_EVENT_HANDLER, true ); + + return menu; + + }, + + /** + * Create custom item element + * @memberOf Widget + * @instance + * @return {HTMLSpanElement} - The dom element icon + */ + createCustomItem: function ( options = {} ) { + + const scope = this; + const item = options.element || document.createElement( 'span' ); + const { onDispose } = options; + + item.style.cursor = 'pointer'; + item.style.float = 'right'; + item.style.width = '44px'; + item.style.height = '100%'; + item.style.backgroundSize = '60%'; + item.style.backgroundRepeat = 'no-repeat'; + item.style.backgroundPosition = 'center'; + item.style.webkitUserSelect = + item.style.MozUserSelect = + item.style.userSelect = 'none'; + item.style.position = 'relative'; + item.style.pointerEvents = 'auto'; + + // White glow on icon + item.addEventListener( scope.TOUCH_ENABLED ? 'touchstart' : 'mouseenter', function() { + item.style.filter = + item.style.webkitFilter = 'drop-shadow(0 0 5px rgba(255,255,255,1))'; + }, { passive: true }); + item.addEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'mouseleave', function() { + item.style.filter = + item.style.webkitFilter = ''; + }, { passive: true }); + + this.mergeStyleOptions( item, options.style ); + + if ( options.onTap ) { + + item.addEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'click', options.onTap, false ); + + } + + item.dispose = function () { + + item.removeEventListener( scope.TOUCH_ENABLED ? 'touchend' : 'click', options.onTap, false ); + + if ( onDispose ) { options.onDispose(); } + + }; + + return item; + + }, + + /** + * Merge item css style + * @param {HTMLElement} element - The element to be merged with style + * @param {object} options - The style options + * @memberOf Widget + * @instance + * @return {HTMLElement} - The same element with merged styles + */ + mergeStyleOptions: function ( element, options = {} ) { + + for ( let property in options ){ + + if ( options.hasOwnProperty( property ) ) { + + element.style[ property ] = options[ property ]; + + } + + } + + return element; + + }, + + /** + * Dispose widgets by detaching dom elements from container + * @memberOf Widget + * @instance + */ + dispose: function () { + + if ( this.barElement ) { + this.container.removeChild( this.barElement ); + this.barElement.dispose(); + this.barElement = null; + + } + + } + + } ); + + /** + * @classdesc Base Panorama + * @constructor + * @param {THREE.Geometry} geometry - The geometry for this panorama + * @param {THREE.Material} material - The material for this panorama + */ + function Panorama ( geometry, material ) { + + THREE.Mesh.call( this, geometry, material ); + + this.type = 'panorama'; + + this.ImageQualityLow = 1; + this.ImageQualityFair = 2; + this.ImageQualityMedium = 3; + this.ImageQualityHigh = 4; + this.ImageQualitySuperHigh = 5; + + this.animationDuration = 1000; + + this.defaultInfospotSize = 350; + + this.container = undefined; + + this.loaded = false; + + this.linkedSpots = []; + + this.isInfospotVisible = false; + + this.linkingImageURL = undefined; + this.linkingImageScale = undefined; + + this.material.side = THREE.BackSide; + this.material.opacity = 0; + + this.scale.x *= -1; + this.renderOrder = -1; + + this.active = false; + + this.infospotAnimation = new Tween.Tween( this ).to( {}, this.animationDuration / 2 ); + + this.addEventListener( 'load', this.fadeIn.bind( this ) ); + this.addEventListener( 'panolens-container', this.setContainer.bind( this ) ); + this.addEventListener( 'click', this.onClick.bind( this ) ); + + this.setupTransitions(); + + } + + Panorama.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), { + + constructor: Panorama, + + /** + * Adding an object + * To counter the scale.x = -1, it will automatically add an + * empty object with inverted scale on x + * @memberOf Panorama + * @instance + * @param {THREE.Object3D} object - The object to be added + */ + add: function ( object ) { + + let invertedObject; + + if ( arguments.length > 1 ) { + + for ( var i = 0; i < arguments.length; i ++ ) { + + this.add( arguments[ i ] ); + + } + + return this; + + } + + // In case of infospots + if ( object instanceof Infospot ) { + + invertedObject = object; + + if ( object.dispatchEvent ) { + + const { container } = this; + + if ( container ) { object.dispatchEvent( { type: 'panolens-container', container } ); } + + object.dispatchEvent( { type: 'panolens-infospot-focus', method: function ( vector, duration, easing ) { + + /** + * Infospot focus handler event + * @type {object} + * @event Panorama#panolens-viewer-handler + * @property {string} method - Viewer function name + * @property {*} data - The argument to be passed into the method + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'tweenControlCenter', data: [ vector, duration, easing ] } ); + + + }.bind( this ) } ); + } + + } else { + + // Counter scale.x = -1 effect + invertedObject = new THREE.Object3D(); + invertedObject.scale.x = -1; + invertedObject.scalePlaceHolder = true; + invertedObject.add( object ); + + } + + THREE.Object3D.prototype.add.call( this, invertedObject ); + + }, + + load: function () { + + this.onLoad(); + + }, + + /** + * Click event handler + * @param {object} event - Click event + * @memberOf Panorama + * @instance + * @fires Infospot#dismiss + */ + onClick: function ( event ) { + + if ( event.intersects && event.intersects.length === 0 ) { + + this.traverse( function ( object ) { + + /** + * Dimiss event + * @type {object} + * @event Infospot#dismiss + */ + object.dispatchEvent( { type: 'dismiss' } ); + + } ); + + } + + }, + + /** + * Set container of this panorama + * @param {HTMLElement|object} data - Data with container information + * @memberOf Panorama + * @instance + * @fires Infospot#panolens-container + */ + setContainer: function ( data ) { + + let container; + + if ( data instanceof HTMLElement ) { + + container = data; + + } else if ( data && data.container ) { + + container = data.container; + + } + + if ( container ) { + + this.children.forEach( function ( child ) { + + if ( child instanceof Infospot && child.dispatchEvent ) { + + /** + * Set container event + * @type {object} + * @event Infospot#panolens-container + * @property {HTMLElement} container - The container of this panorama + */ + child.dispatchEvent( { type: 'panolens-container', container: container } ); + + } + + } ); + + this.container = container; + + } + + }, + + /** + * This will be called when panorama is loaded + * @memberOf Panorama + * @instance + * @fires Panorama#load + */ + onLoad: function () { + + this.loaded = true; + + /** + * Load panorama event + * @type {object} + * @event Panorama#load + */ + this.dispatchEvent( { type: 'load' } ); + + }, + + /** + * This will be called when panorama is in progress + * @memberOf Panorama + * @instance + * @fires Panorama#progress + */ + onProgress: function ( progress ) { + + /** + * Loading panorama progress event + * @type {object} + * @event Panorama#progress + * @property {object} progress - The progress object containing loaded and total amount + */ + this.dispatchEvent( { type: 'progress', progress: progress } ); + + }, + + /** + * This will be called when panorama loading has error + * @memberOf Panorama + * @instance + * @fires Panorama#error + */ + onError: function () { + + /** + * Loading panorama error event + * @type {object} + * @event Panorama#error + */ + this.dispatchEvent( { type: 'error' } ); + + }, + + /** + * Get zoom level based on window width + * @memberOf Panorama + * @instance + * @return {number} zoom level indicating image quality + */ + getZoomLevel: function () { + + let zoomLevel; + + if ( window.innerWidth <= 800 ) { + + zoomLevel = this.ImageQualityFair; + + } else if ( window.innerWidth > 800 && window.innerWidth <= 1280 ) { + + zoomLevel = this.ImageQualityMedium; + + } else if ( window.innerWidth > 1280 && window.innerWidth <= 1920 ) { + + zoomLevel = this.ImageQualityHigh; + + } else if ( window.innerWidth > 1920 ) { + + zoomLevel = this.ImageQualitySuperHigh; + + } else { + + zoomLevel = this.ImageQualityLow; + + } + + return zoomLevel; + + }, + + /** + * Update texture of a panorama + * @memberOf Panorama + * @instance + * @param {THREE.Texture} texture - Texture to be updated + */ + updateTexture: function ( texture ) { + + this.material.map = texture; + this.material.needsUpdate = true; + + }, + + /** + * Toggle visibility of infospots in this panorama + * @param {boolean} isVisible - Visibility of infospots + * @param {number} delay - Delay in milliseconds to change visibility + * @memberOf Panorama + * @instance + * @fires Panorama#infospot-animation-complete + */ + toggleInfospotVisibility: function ( isVisible, delay ) { + + delay = ( delay !== undefined ) ? delay : 0; + + const visible = ( isVisible !== undefined ) ? isVisible : ( this.isInfospotVisible ? false : true ); + + this.traverse( function ( object ) { + + if ( object instanceof Infospot ) { + + if ( visible ) { + + object.show( delay ); + + } else { + + object.hide( delay ); + + } + + } + + } ); + + this.isInfospotVisible = visible; + + // Animation complete event + this.infospotAnimation.onComplete( function () { + + /** + * Complete toggling infospot visibility + * @event Panorama#infospot-animation-complete + * @type {object} + */ + this.dispatchEvent( { type: 'infospot-animation-complete', visible: visible } ); + + }.bind( this ) ).delay( delay ).start(); + + }, + + /** + * Set image of this panorama's linking infospot + * @memberOf Panorama + * @instance + * @param {string} url - Url to the image asset + * @param {number} scale - Scale factor of the infospot + */ + setLinkingImage: function ( url, scale ) { + + this.linkingImageURL = url; + this.linkingImageScale = scale; + + }, + + /** + * Link one-way panorama + * @param {Panorama} pano - The panorama to be linked to + * @param {THREE.Vector3} position - The position of infospot which navigates to the pano + * @param {number} [imageScale=300] - Image scale of linked infospot + * @param {string} [imageSrc=DataImage.Arrow] - The image source of linked infospot + * @memberOf Panorama + * @instance + */ + link: function ( pano, position, imageScale, imageSrc ) { + + let scale, img; + + this.visible = true; + + if ( !position ) { + + console.warn( 'Please specify infospot position for linking' ); + + return; + + } + + // Infospot scale + if ( imageScale !== undefined ) { + + scale = imageScale; + + } else if ( pano.linkingImageScale !== undefined ) { + + scale = pano.linkingImageScale; + + } else { + + scale = 300; + + } + + + // Infospot image + if ( imageSrc ) { + + img = imageSrc; + + } else if ( pano.linkingImageURL ) { + + img = pano.linkingImageURL; + + } else { + + img = DataImage.Arrow; + + } + + // Creates a new infospot + const spot = new Infospot( scale, img ); + spot.position.copy( position ); + spot.toPanorama = pano; + spot.addEventListener( 'click', function () { + + /** + * Viewer handler event + * @type {object} + * @event Panorama#panolens-viewer-handler + * @property {string} method - Viewer function name + * @property {*} data - The argument to be passed into the method + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'setPanorama', data: pano } ); + + }.bind( this ) ); + + this.linkedSpots.push( spot ); + + this.add( spot ); + + this.visible = false; + + }, + + reset: function () { + + this.children.length = 0; + + }, + + setupTransitions: function () { + + this.fadeInAnimation = new Tween.Tween( this.material ) + .easing( Tween.Easing.Quartic.Out ) + .onStart( function () { + + this.visible = true; + // this.material.visible = true; + + /** + * Enter panorama fade in start event + * @event Panorama#enter-fade-start + * @type {object} + */ + this.dispatchEvent( { type: 'enter-fade-start' } ); + + }.bind( this ) ); + + this.fadeOutAnimation = new Tween.Tween( this.material ) + .easing( Tween.Easing.Quartic.Out ) + .onComplete( function () { + + this.visible = false; + // this.material.visible = true; + + /** + * Leave panorama complete event + * @event Panorama#leave-complete + * @type {object} + */ + this.dispatchEvent( { type: 'leave-complete' } ); + + }.bind( this ) ); + + this.enterTransition = new Tween.Tween( this ) + .easing( Tween.Easing.Quartic.Out ) + .onComplete( function () { + + /** + * Enter panorama and animation complete event + * @event Panorama#enter-complete + * @type {object} + */ + this.dispatchEvent( { type: 'enter-complete' } ); + + }.bind ( this ) ) + .start(); + + this.leaveTransition = new Tween.Tween( this ) + .easing( Tween.Easing.Quartic.Out ); + + }, + + onFadeAnimationUpdate: function () { + + const alpha = this.material.opacity; + const { uniforms } = this.material; + + if ( uniforms && uniforms.opacity ) { + uniforms.opacity.value = alpha; + } + + }, + + /** + * Start fading in animation + * @memberOf Panorama + * @instance + * @fires Panorama#enter-fade-complete + */ + fadeIn: function ( duration ) { + + duration = duration >= 0 ? duration : this.animationDuration; + + this.fadeOutAnimation.stop(); + this.fadeInAnimation + .to( { opacity: 1 }, duration ) + .onUpdate( this.onFadeAnimationUpdate.bind( this ) ) + .onComplete( function () { + + this.toggleInfospotVisibility( true, duration / 2 ); + + /** + * Enter panorama fade complete event + * @event Panorama#enter-fade-complete + * @type {object} + */ + this.dispatchEvent( { type: 'enter-fade-complete' } ); + + }.bind( this ) ) + .start(); + + }, + + /** + * Start fading out animation + * @memberOf Panorama + * @instance + */ + fadeOut: function ( duration ) { + + duration = duration >= 0 ? duration : this.animationDuration; + + this.fadeInAnimation.stop(); + this.fadeOutAnimation + .to( { opacity: 0 }, duration ) + .onUpdate( this.onFadeAnimationUpdate.bind( this ) ) + .start(); + + }, + + /** + * This will be called when entering a panorama + * @memberOf Panorama + * @instance + * @fires Panorama#enter + * @fires Panorama#enter-start + */ + onEnter: function () { + + const duration = this.animationDuration; + + this.leaveTransition.stop(); + this.enterTransition + .to( {}, duration ) + .onStart( function () { + + /** + * Enter panorama and animation starting event + * @event Panorama#enter-start + * @type {object} + */ + this.dispatchEvent( { type: 'enter-start' } ); + + if ( this.loaded ) { + + this.fadeIn( duration ); + + } else { + + this.load(); + + } + + }.bind( this ) ) + .start(); + + /** + * Enter panorama event + * @event Panorama#enter + * @type {object} + */ + this.dispatchEvent( { type: 'enter' } ); + + this.children.forEach( child => { + + child.dispatchEvent( { type: 'panorama-enter' } ); + + } ); + + this.active = true; + + }, + + /** + * This will be called when leaving a panorama + * @memberOf Panorama + * @instance + * @fires Panorama#leave + */ + onLeave: function () { + + const duration = this.animationDuration; + + this.enterTransition.stop(); + this.leaveTransition + .to( {}, duration ) + .onStart( function () { + + /** + * Leave panorama and animation starting event + * @event Panorama#leave-start + * @type {object} + */ + this.dispatchEvent( { type: 'leave-start' } ); + + this.fadeOut( duration ); + this.toggleInfospotVisibility( false ); + + }.bind( this ) ) + .start(); + + /** + * Leave panorama event + * @event Panorama#leave + * @type {object} + */ + this.dispatchEvent( { type: 'leave' } ); + + this.children.forEach( child => { + + child.dispatchEvent( { type: 'panorama-leave' } ); + + } ); + + this.active = false; + + }, + + /** + * Dispose panorama + * @memberOf Panorama + * @instance + */ + dispose: function () { + + this.infospotAnimation.stop(); + this.fadeInAnimation.stop(); + this.fadeOutAnimation.stop(); + this.enterTransition.stop(); + this.leaveTransition.stop(); + + /** + * On panorama dispose handler + * @type {object} + * @event Panorama#panolens-viewer-handler + * @property {string} method - Viewer function name + * @property {*} data - The argument to be passed into the method + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'onPanoramaDispose', data: this } ); + + // recursive disposal on 3d objects + function recursiveDispose ( object ) { + + const { geometry, material } = object; + + for ( var i = object.children.length - 1; i >= 0; i-- ) { + + recursiveDispose( object.children[i] ); + object.remove( object.children[i] ); + + } + + if ( object instanceof Infospot ) { + + object.dispose(); + + } + + if ( geometry ) { geometry.dispose(); object.geometry = null; } + if ( material ) { material.dispose(); object.material = null; } + + } + + recursiveDispose( this ); + + if ( this.parent ) { + + this.parent.remove( this ); + + } + + } + + } ); + + /** + * @classdesc Equirectangular based image panorama + * @constructor + * @param {string} image - Image url or HTMLImageElement + */ + function ImagePanorama ( image, _geometry, _material ) { + + const radius = 5000; + const geometry = _geometry || new THREE.SphereBufferGeometry( radius, 60, 40 ); + const material = _material || new THREE.MeshBasicMaterial( { opacity: 0, transparent: true } ); + + Panorama.call( this, geometry, material ); + + this.src = image; + this.radius = radius; + + } + + ImagePanorama.prototype = Object.assign( Object.create( Panorama.prototype ), { + + constructor: ImagePanorama, + + /** + * Load image asset + * @param {*} src - Url or image element + * @memberOf ImagePanorama + * @instance + */ + load: function ( src ) { + + src = src || this.src; + + if ( !src ) { + + console.warn( 'Image source undefined' ); + + return; + + } else if ( typeof src === 'string' ) { + + TextureLoader.load( src, this.onLoad.bind( this ), this.onProgress.bind( this ), this.onError.bind( this ) ); + + } else if ( src instanceof HTMLImageElement ) { + + this.onLoad( new THREE.Texture( src ) ); + + } + + }, + + /** + * This will be called when image is loaded + * @param {THREE.Texture} texture - Texture to be updated + * @memberOf ImagePanorama + * @instance + */ + onLoad: function ( texture ) { + + texture.minFilter = texture.magFilter = THREE.LinearFilter; + texture.needsUpdate = true; + + this.updateTexture( texture ); + + window.requestAnimationFrame( Panorama.prototype.onLoad.bind( this ) ); + + }, + + /** + * Reset + * @memberOf ImagePanorama + * @instance + */ + reset: function () { + + Panorama.prototype.reset.call( this ); + + }, + + /** + * Dispose + * @memberOf ImagePanorama + * @instance + */ + dispose: function () { + + const { material: { map } } = this; + + // Release cached image + THREE.Cache.remove( this.src ); + + if ( map ) { map.dispose(); } + + Panorama.prototype.dispose.call( this ); + + } + + } ); + + /** + * @classdesc Empty panorama + * @constructor + */ + function EmptyPanorama () { + + const geometry = new THREE.BufferGeometry(); + const material = new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0, transparent: true } ); + + geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array(), 1 ) ); + + Panorama.call( this, geometry, material ); + + } + + EmptyPanorama.prototype = Object.assign( Object.create( Panorama.prototype ), { + + constructor: EmptyPanorama + + } ); + + /** + * @classdesc Cubemap-based panorama + * @constructor + * @param {array} images - Array of 6 urls to images, one for each side of the CubeTexture. The urls should be specified in the following order: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z + */ + function CubePanorama ( images = [] ){ + + const edgeLength = 10000; + const shader = Object.assign( {}, THREE.ShaderLib[ 'cube' ] ); + const geometry = new THREE.BoxBufferGeometry( edgeLength, edgeLength, edgeLength ); + const material = new THREE.ShaderMaterial( { + + fragmentShader: shader.fragmentShader, + vertexShader: shader.vertexShader, + uniforms: shader.uniforms, + side: THREE.BackSide, + transparent: true + + } ); + + Panorama.call( this, geometry, material ); + + this.images = images; + this.edgeLength = edgeLength; + this.material.uniforms.opacity.value = 0; + + } + + CubePanorama.prototype = Object.assign( Object.create( Panorama.prototype ), { + + constructor: CubePanorama, + + /** + * Load 6 images and bind listeners + * @memberOf CubePanorama + * @instance + */ + load: function () { + + CubeTextureLoader.load( + + this.images, + + this.onLoad.bind( this ), + this.onProgress.bind( this ), + this.onError.bind( this ) + + ); + + }, + + /** + * This will be called when 6 textures are ready + * @param {THREE.CubeTexture} texture - Cube texture + * @memberOf CubePanorama + * @instance + */ + onLoad: function ( texture ) { + + this.material.uniforms[ 'tCube' ].value = texture; + + Panorama.prototype.onLoad.call( this ); + + }, + + /** + * Dispose + * @memberOf CubePanorama + * @instance + */ + dispose: function () { + + const { value } = this.material.uniforms.tCube; + + this.images.forEach( ( image ) => { THREE.Cache.remove( image ); } ); + + if ( value instanceof THREE.CubeTexture ) { + + value.dispose(); + + } + + Panorama.prototype.dispose.call( this ); + + } + + } ); + + /** + * @classdesc Basic panorama with 6 pre-defined grid images + * @constructor + */ + function BasicPanorama () { + + const images = []; + + for ( let i = 0; i < 6; i++ ) { + + images.push( DataImage.WhiteTile ); + + } + + CubePanorama.call( this, images ); + + } + + BasicPanorama.prototype = Object.assign( Object.create( CubePanorama.prototype ), { + + constructor: BasicPanorama + + } ); + + /** + * @classdesc Video Panorama + * @constructor + * @param {string} src - Equirectangular video url + * @param {object} [options] - Option for video settings + * @param {HTMLElement} [options.videoElement] - HTML5 video element contains the video + * @param {boolean} [options.loop=true] - Specify if the video should loop in the end + * @param {boolean} [options.muted=true] - Mute the video or not. Need to be true in order to autoplay on some browsers + * @param {boolean} [options.autoplay=false] - Specify if the video should auto play + * @param {boolean} [options.playsinline=true] - Specify if video should play inline for iOS. If you want it to auto play inline, set both autoplay and muted options to true + * @param {string} [options.crossOrigin="anonymous"] - Sets the cross-origin attribute for the video, which allows for cross-origin videos in some browsers (Firefox, Chrome). Set to either "anonymous" or "use-credentials". + * @param {number} [radius=5000] - The minimum radius for this panoram + */ + function VideoPanorama ( src, options = {} ) { + + const radius = 5000; + const geometry = new THREE.SphereBufferGeometry( radius, 60, 40 ); + const material = new THREE.MeshBasicMaterial( { opacity: 0, transparent: true } ); + + Panorama.call( this, geometry, material ); + + this.src = src; + + this.options = { + + videoElement: document.createElement( 'video' ), + loop: true, + muted: true, + autoplay: false, + playsinline: true, + crossOrigin: 'anonymous' + + }; + + Object.assign( this.options, options ); + + this.videoElement = this.options.videoElement; + this.videoProgress = 0; + this.radius = radius; + + this.addEventListener( 'leave', this.pauseVideo.bind( this ) ); + this.addEventListener( 'enter-fade-start', this.resumeVideoProgress.bind( this ) ); + this.addEventListener( 'video-toggle', this.toggleVideo.bind( this ) ); + this.addEventListener( 'video-time', this.setVideoCurrentTime.bind( this ) ); + + } + VideoPanorama.prototype = Object.assign( Object.create( Panorama.prototype ), { + + constructor: VideoPanorama, + + isMobile: function () { + + let check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})( window.navigator.userAgent || window.navigator.vendor || window.opera ); + return check; + + }, + + /** + * Load video panorama + * @memberOf VideoPanorama + * @instance + * @fires Panorama#panolens-viewer-handler + */ + load: function () { + + const { muted, loop, autoplay, playsinline, crossOrigin } = this.options; + const video = this.videoElement; + const material = this.material; + const onProgress = this.onProgress.bind( this ); + const onLoad = this.onLoad.bind( this ); + + video.loop = loop; + video.autoplay = autoplay; + video.playsinline = playsinline; + video.crossOrigin = crossOrigin; + video.muted = muted; + + if ( playsinline ) { + + video.setAttribute( 'playsinline', '' ); + video.setAttribute( 'webkit-playsinline', '' ); + + } + + const onloadeddata = function() { + + this.setVideoTexture( video ); + + if ( autoplay ) { + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'updateVideoPlayButton' + * @property {boolean} data - Pause video or not + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'updateVideoPlayButton', data: false } ); + + } + + // For mobile silent autoplay + if ( this.isMobile() ) { + + video.pause(); + + if ( autoplay && muted ) { + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'updateVideoPlayButton' + * @property {boolean} data - Pause video or not + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'updateVideoPlayButton', data: false } ); + + } else { + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'updateVideoPlayButton' + * @property {boolean} data - Pause video or not + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'updateVideoPlayButton', data: true } ); + + } + + } + + const loaded = () => { + + // Fix for threejs r89 delayed update + material.map.needsUpdate = true; + + onProgress( { loaded: 1, total: 1 } ); + onLoad(); + + }; + + window.requestAnimationFrame( loaded ); + + }; + + /** + * Ready state of the audio/video element + * 0 = HAVE_NOTHING - no information whether or not the audio/video is ready + * 1 = HAVE_METADATA - metadata for the audio/video is ready + * 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play next frame/millisecond + * 3 = HAVE_FUTURE_DATA - data for the current and at least the next frame is available + * 4 = HAVE_ENOUGH_DATA - enough data available to start playing + */ + if ( video.readyState > 2 ) { + + onloadeddata.call( this ); + + } else { + + if ( video.querySelectorAll( 'source' ).length === 0 ) { + + const source = document.createElement( 'source' ); + source.src = this.src; + video.appendChild( source ); + + } + + video.load(); + } + + video.addEventListener( 'loadeddata', onloadeddata.bind( this ) ); + + video.addEventListener( 'timeupdate', function () { + + this.videoProgress = video.duration >= 0 ? video.currentTime / video.duration : 0; + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'onVideoUpdate' + * @property {number} data - The percentage of video progress. Range from 0.0 to 1.0 + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'onVideoUpdate', data: this.videoProgress } ); + + }.bind( this ) ); + + video.addEventListener( 'ended', function () { + + if ( !loop ) { + + this.resetVideo(); + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'updateVideoPlayButton', data: true } ); + + } + + }.bind( this ), false ); + + }, + + /** + * Set video texture + * @memberOf VideoPanorama + * @instance + * @param {HTMLVideoElement} video - The html5 video element + * @fires Panorama#panolens-viewer-handler + */ + setVideoTexture: function ( video ) { + + if ( !video ) return; + + const videoTexture = new THREE.VideoTexture( video ); + videoTexture.minFilter = THREE.LinearFilter; + videoTexture.magFilter = THREE.LinearFilter; + videoTexture.format = THREE.RGBFormat; + + this.updateTexture( videoTexture ); + + }, + + /** + * Reset + * @memberOf VideoPanorama + * @instance + */ + reset: function () { + + this.videoElement = undefined; + + Panorama.prototype.reset.call( this ); + + }, + + /** + * Check if video is paused + * @memberOf VideoPanorama + * @instance + * @return {boolean} - is video paused or not + */ + isVideoPaused: function () { + + return this.videoElement.paused; + + }, + + /** + * Toggle video to play or pause + * @memberOf VideoPanorama + * @instance + */ + toggleVideo: function () { + + const video = this.videoElement; + + if ( !video ) { return; } + + video[ video.paused ? 'play' : 'pause' ](); + + }, + + /** + * Set video currentTime + * @memberOf VideoPanorama + * @instance + * @param {object} event - Event contains percentage. Range from 0.0 to 1.0 + */ + setVideoCurrentTime: function ( { percentage } ) { + + const video = this.videoElement; + + if ( video && !Number.isNaN( percentage ) && percentage !== 1 ) { + + video.currentTime = video.duration * percentage; + + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'onVideoUpdate', data: percentage } ); + + } + + }, + + /** + * Play video + * @memberOf VideoPanorama + * @instance + * @fires VideoPanorama#play + * @fires VideoPanorama#play-error + */ + playVideo: function () { + + const video = this.videoElement; + const playVideo = this.playVideo.bind( this ); + const dispatchEvent = this.dispatchEvent.bind( this ); + const onSuccess = () => { + + /** + * Play event + * @type {object} + * @event VideoPanorama#play + * + */ + dispatchEvent( { type: 'play' } ); + + }; + const onError = ( error ) => { + + // Error playing video. Retry next frame. Possibly Waiting for user interaction + window.requestAnimationFrame( playVideo ); + + /** + * Play event + * @type {object} + * @event VideoPanorama#play-error + * + */ + dispatchEvent( { type: 'play-error', error } ); + + }; + + if ( video && video.paused ) { + + video.play().then( onSuccess ).catch( onError ); + + } + + }, + + /** + * Pause video + * @memberOf VideoPanorama + * @instance + * @fires VideoPanorama#pause + */ + pauseVideo: function () { + + const video = this.videoElement; + + if ( video && !video.paused ) { + + video.pause(); + + } + + /** + * Pause event + * @type {object} + * @event VideoPanorama#pause + * + */ + this.dispatchEvent( { type: 'pause' } ); + + }, + + /** + * Resume video + * @memberOf VideoPanorama + * @instance + */ + resumeVideoProgress: function () { + + const video = this.videoElement; + + if ( video.readyState >= 4 && video.autoplay && !this.isMobile() ) { + + this.playVideo(); + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'updateVideoPlayButton' + * @property {boolean} data - Pause video or not + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'updateVideoPlayButton', data: false } ); + + } else { + + this.pauseVideo(); + + /** + * Viewer handler event + * @type {object} + * @property {string} method - 'updateVideoPlayButton' + * @property {boolean} data - Pause video or not + */ + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'updateVideoPlayButton', data: true } ); + + } + + this.setVideoCurrentTime( { percentage: this.videoProgress } ); + + }, + + /** + * Reset video at stating point + * @memberOf VideoPanorama + * @instance + */ + resetVideo: function () { + + const video = this.videoElement; + + if ( video ) { + + this.setVideoCurrentTime( { percentage: 0 } ); + + } + + }, + + /** + * Check if video is muted + * @memberOf VideoPanorama + * @instance + * @return {boolean} - is video muted or not + */ + isVideoMuted: function () { + + return this.videoElement.muted; + + }, + + /** + * Mute video + * @memberOf VideoPanorama + * @instance + */ + muteVideo: function () { + + const video = this.videoElement; + + if ( video && !video.muted ) { + + video.muted = true; + + } + + this.dispatchEvent( { type: 'volumechange' } ); + + }, + + /** + * Unmute video + * @memberOf VideoPanorama + * @instance + */ + unmuteVideo: function () { + + const video = this.videoElement; + + if ( video && this.isVideoMuted() ) { + + video.muted = false; + + } + + this.dispatchEvent( { type: 'volumechange' } ); + + }, + + /** + * Returns the video element + * @memberOf VideoPanorama + * @instance + * @returns {HTMLElement} + */ + getVideoElement: function () { + + return this.videoElement; + + }, + + /** + * Dispose video panorama + * @memberOf VideoPanorama + * @instance + */ + dispose: function () { + + const { material: { map } } = this; + + this.pauseVideo(); + + this.removeEventListener( 'leave', this.pauseVideo.bind( this ) ); + this.removeEventListener( 'enter-fade-start', this.resumeVideoProgress.bind( this ) ); + this.removeEventListener( 'video-toggle', this.toggleVideo.bind( this ) ); + this.removeEventListener( 'video-time', this.setVideoCurrentTime.bind( this ) ); + + if ( map ) { map.dispose(); } + + Panorama.prototype.dispose.call( this ); + + } + + } ); + + /** + * @classdesc Google Street View Loader + * @constructor + * @param {object} parameters + */ + function GoogleStreetviewLoader ( parameters = {} ) { + + this._parameters = parameters; + this._zoom = null; + this._panoId = null; + this._panoClient = new google.maps.StreetViewService(); + this._count = 0; + this._total = 0; + this._canvas = []; + this._ctx = []; + this._wc = 0; + this._hc = 0; + this.result = null; + this.rotation = 0; + this.copyright = ''; + this.onSizeChange = null; + this.onPanoramaLoad = null; + + this.levelsW = [ 1, 2, 4, 7, 13, 26 ]; + this.levelsH = [ 1, 1, 2, 4, 7, 13 ]; + + this.widths = [ 416, 832, 1664, 3328, 6656, 13312 ]; + this.heights = [ 416, 416, 832, 1664, 3328, 6656 ]; + + this.maxW = 6656; + this.maxH = 6656; + + let gl; + + try { + + const canvas = document.createElement( 'canvas' ); + + gl = canvas.getContext( 'experimental-webgl' ); + + if( !gl ) { + + gl = canvas.getContext( 'webgl' ); + + } + + } + catch ( error ) { + + } + + this.maxW = Math.max( gl.getParameter( gl.MAX_TEXTURE_SIZE ), this.maxW ); + this.maxH = Math.max( gl.getParameter( gl.MAX_TEXTURE_SIZE ), this.maxH ); + + } + + Object.assign( GoogleStreetviewLoader.prototype, { + + constructor: GoogleStreetviewLoader, + + /** + * Set progress + * @param {number} loaded + * @param {number} total + * @memberOf GoogleStreetviewLoader + * @instance + */ + setProgress: function ( loaded, total ) { + + if ( this.onProgress ) { + + this.onProgress( { loaded: loaded, total: total } ); + + } + + }, + + /** + * Adapt texture to zoom + * @memberOf GoogleStreetviewLoader + * @instance + */ + adaptTextureToZoom: function () { + + const w = this.widths [ this._zoom ]; + const h = this.heights[ this._zoom ]; + + const maxW = this.maxW; + const maxH = this.maxH; + + this._wc = Math.ceil( w / maxW ); + this._hc = Math.ceil( h / maxH ); + + for( let y = 0; y < this._hc; y++ ) { + for( let x = 0; x < this._wc; x++ ) { + const c = document.createElement( 'canvas' ); + if( x < ( this._wc - 1 ) ) c.width = maxW; else c.width = w - ( maxW * x ); + if( y < ( this._hc - 1 ) ) c.height = maxH; else c.height = h - ( maxH * y ); + this._canvas.push( c ); + this._ctx.push( c.getContext( '2d' ) ); + } + } + + }, + + /** + * Compose from tile + * @param {number} x + * @param {number} y + * @param {*} texture + * @memberOf GoogleStreetviewLoader + * @instance + */ + composeFromTile: function ( x, y, texture ) { + + const maxW = this.maxW; + const maxH = this.maxH; + + x *= 512; + y *= 512; + + const px = Math.floor( x / maxW ); + const py = Math.floor( y / maxH ); + + x -= px * maxW; + y -= py * maxH; + + this._ctx[ py * this._wc + px ].drawImage( texture, 0, 0, texture.width, texture.height, x, y, 512, 512 ); + + this.progress(); + + }, + + /** + * Progress + * @memberOf GoogleStreetviewLoader + * @instance + */ + progress: function() { + + this._count++; + + this.setProgress( this._count, this._total ); + + if ( this._count === this._total) { + + this.canvas = this._canvas; + this.panoId = this._panoId; + this.zoom = this._zoom; + + if ( this.onPanoramaLoad ) { + + this.onPanoramaLoad( this._canvas[ 0 ] ); + + } + + } + }, + + /** + * Compose panorama + * @memberOf GoogleStreetviewLoader + * @instance + */ + composePanorama: function () { + + this.setProgress( 0, 1 ); + + const w = this.levelsW[ this._zoom ]; + const h = this.levelsH[ this._zoom ]; + const self = this; + + this._count = 0; + this._total = w * h; + + const { useWebGL } = this._parameters; + + for( let y = 0; y < h; y++ ) { + for( let x = 0; x < w; x++ ) { + const url = 'https://geo0.ggpht.com/cbk?cb_client=maps_sv.tactile&authuser=0&hl=en&output=tile&zoom=' + this._zoom + '&x=' + x + '&y=' + y + '&panoid=' + this._panoId + '&nbt&fover=2'; + ( function( x, y ) { + if( useWebGL ) { + const texture = TextureLoader.load( url, null, function() { + self.composeFromTile( x, y, texture ); + } ); + } else { + const img = new Image(); + img.addEventListener( 'load', function() { + self.composeFromTile( x, y, this ); + } ); + img.crossOrigin = ''; + img.src = url; + } + } )( x, y ); + } + } + + }, + + /** + * Load + * @param {string} panoid + * @memberOf GoogleStreetviewLoader + * @instance + */ + load: function ( panoid ) { + + this.loadPano( panoid ); + + }, + + /** + * Load panorama + * @param {string} id + * @memberOf GoogleStreetviewLoader + * @instance + */ + loadPano: function( id ) { + + const self = this; + this._panoClient.getPanoramaById( id, function (result, status) { + if (status === google.maps.StreetViewStatus.OK) { + self.result = result; + self.copyright = result.copyright; + self._panoId = result.location.pano; + self.composePanorama(); + } + }); + + }, + + /** + * Set zoom level + * @param {number} z + * @memberOf GoogleStreetviewLoader + * @instance + */ + setZoom: function( z ) { + + this._zoom = z; + this.adaptTextureToZoom(); + } + + } ); + + /** + * @classdesc Google streetview panorama + * @description [How to get Panorama ID]{@link http://stackoverflow.com/questions/29916149/google-maps-streetview-how-to-get-panorama-id} + * @constructor + * @param {string} panoId - Panorama id from Google Streetview + * @param {string} [apiKey] - Google Street View API Key + */ + function GoogleStreetviewPanorama ( panoId, apiKey ) { + + ImagePanorama.call( this ); + + this.panoId = panoId; + + this.gsvLoader = null; + + this.loadRequested = false; + + this.setupGoogleMapAPI( apiKey ); + + } + + GoogleStreetviewPanorama.prototype = Object.assign( Object.create( ImagePanorama.prototype ), { + + constructor: GoogleStreetviewPanorama, + + /** + * Load Google Street View by panorama id + * @param {string} panoId - Gogogle Street View panorama id + * @memberOf GoogleStreetviewPanorama + * @instance + */ + load: function ( panoId ) { + + this.loadRequested = true; + + panoId = ( panoId || this.panoId ) || {}; + + if ( panoId && this.gsvLoader ) { + + this.loadGSVLoader( panoId ); + + } + + }, + + /** + * Setup Google Map API + * @param {string} apiKey + * @memberOf GoogleStreetviewPanorama + * @instance + */ + setupGoogleMapAPI: function ( apiKey ) { + + const script = document.createElement( 'script' ); + script.src = 'https://maps.googleapis.com/maps/api/js?'; + script.src += apiKey ? 'key=' + apiKey : ''; + script.onreadystatechange = this.setGSVLoader.bind( this ); + script.onload = this.setGSVLoader.bind( this ); + + document.querySelector( 'head' ).appendChild( script ); + + }, + + /** + * Set GSV Loader + * @memberOf GoogleStreetviewPanorama + * @instance + */ + setGSVLoader: function () { + + this.gsvLoader = new GoogleStreetviewLoader(); + + if ( this.loadRequested ) { + + this.load(); + + } + + }, + + /** + * Get GSV Loader + * @memberOf GoogleStreetviewPanorama + * @instance + * @return {GoogleStreetviewLoader} GSV Loader instance + */ + getGSVLoader: function () { + + return this.gsvLoader; + + }, + + /** + * Load GSV Loader + * @param {string} panoId - Gogogle Street View panorama id + * @memberOf GoogleStreetviewPanorama + * @instance + */ + loadGSVLoader: function ( panoId ) { + + this.loadRequested = false; + + this.gsvLoader.onProgress = this.onProgress.bind( this ); + + this.gsvLoader.onPanoramaLoad = this.onLoad.bind( this ); + + this.gsvLoader.setZoom( this.getZoomLevel() ); + + this.gsvLoader.load( panoId ); + + this.gsvLoader.loaded = true; + }, + + /** + * This will be called when panorama is loaded + * @param {HTMLCanvasElement} canvas - Canvas where the tiles have been drawn + * @memberOf GoogleStreetviewPanorama + * @instance + */ + onLoad: function ( canvas ) { + + ImagePanorama.prototype.onLoad.call( this, new THREE.Texture( canvas ) ); + + }, + + /** + * Reset + * @memberOf GoogleStreetviewPanorama + * @instance + */ + reset: function () { + + this.gsvLoader = undefined; + + ImagePanorama.prototype.reset.call( this ); + + } + + } ); + + /** + * Stereographic projection shader + * based on http://notlion.github.io/streetview-stereographic + * @author pchen66 + */ + + /** + * @description Stereograhpic Shader + * @module StereographicShader + * @property {object} uniforms + * @property {THREE.Texture} uniforms.tDiffuse diffuse map + * @property {number} uniforms.resolution image resolution + * @property {THREE.Matrix4} uniforms.transform transformation matrix + * @property {number} uniforms.zoom image zoom factor + * @property {number} uniforms.opacity image opacity + * @property {string} vertexShader vertex shader + * @property {string} fragmentShader fragment shader + */ + const StereographicShader = { + + uniforms: { + + 'tDiffuse': { value: new THREE.Texture() }, + 'resolution': { value: 1.0 }, + 'transform': { value: new THREE.Matrix4() }, + 'zoom': { value: 1.0 }, + 'opacity': { value: 1.0 } + + }, + + vertexShader: [ + + 'varying vec2 vUv;', + + 'void main() {', + + 'vUv = uv;', + 'gl_Position = vec4( position, 1.0 );', + + '}' + + ].join( '\n' ), + + fragmentShader: [ + + 'uniform sampler2D tDiffuse;', + 'uniform float resolution;', + 'uniform mat4 transform;', + 'uniform float zoom;', + 'uniform float opacity;', + + 'varying vec2 vUv;', + + 'const float PI = 3.141592653589793;', + + 'void main(){', + + 'vec2 position = -1.0 + 2.0 * vUv;', + + 'position *= vec2( zoom * resolution, zoom * 0.5 );', + + 'float x2y2 = position.x * position.x + position.y * position.y;', + 'vec3 sphere_pnt = vec3( 2. * position, x2y2 - 1. ) / ( x2y2 + 1. );', + + 'sphere_pnt = vec3( transform * vec4( sphere_pnt, 1.0 ) );', + + 'vec2 sampleUV = vec2(', + '(atan(sphere_pnt.y, sphere_pnt.x) / PI + 1.0) * 0.5,', + '(asin(sphere_pnt.z) / PI + 0.5)', + ');', + + 'gl_FragColor = texture2D( tDiffuse, sampleUV );', + + 'gl_FragColor.a *= opacity;', + + '}' + + ].join( '\n' ) + + }; + + /** + * @classdesc Little Planet + * @constructor + * @param {string} type - Type of little planet basic class + * @param {string} source - URL for the image source + * @param {number} [size=10000] - Size of plane geometry + * @param {number} [ratio=0.5] - Ratio of plane geometry's height against width + */ + function LittlePlanet ( type = 'image', source, size = 10000, ratio = 0.5 ) { + + if ( type === 'image' ) { + + ImagePanorama.call( this, source, this.createGeometry( size, ratio ), this.createMaterial( size ) ); + + } + + this.size = size; + this.ratio = ratio; + this.EPS = 0.000001; + this.frameId = null; + + this.dragging = false; + this.userMouse = new THREE.Vector2(); + + this.quatA = new THREE.Quaternion(); + this.quatB = new THREE.Quaternion(); + this.quatCur = new THREE.Quaternion(); + this.quatSlerp = new THREE.Quaternion(); + + this.vectorX = new THREE.Vector3( 1, 0, 0 ); + this.vectorY = new THREE.Vector3( 0, 1, 0 ); + + this.addEventListener( 'window-resize', this.onWindowResize ); + + } + + LittlePlanet.prototype = Object.assign( Object.create( ImagePanorama.prototype ), { + + constructor: LittlePlanet, + + add: function ( object ) { + + if ( arguments.length > 1 ) { + + for ( let i = 0; i < arguments.length; i ++ ) { + + this.add( arguments[ i ] ); + + } + + return this; + + } + + if ( object instanceof Infospot ) { + + object.material.depthTest = false; + + } + + ImagePanorama.prototype.add.call( this, object ); + + }, + + createGeometry: function ( size, ratio ) { + + return new THREE.PlaneBufferGeometry( size, size * ratio ); + + }, + + createMaterial: function ( size ) { + + const shader = Object.assign( {}, StereographicShader ), uniforms = shader.uniforms; + + uniforms.zoom.value = size; + uniforms.opacity.value = 0.0; + + return new THREE.ShaderMaterial( { + + uniforms: uniforms, + vertexShader: shader.vertexShader, + fragmentShader: shader.fragmentShader, + side: THREE.BackSide, + transparent: true + + } ); + + }, + + registerMouseEvents: function () { + + this.container.addEventListener( 'mousedown', this.onMouseDown.bind( this ), { passive: true } ); + this.container.addEventListener( 'mousemove', this.onMouseMove.bind( this ), { passive: true } ); + this.container.addEventListener( 'mouseup', this.onMouseUp.bind( this ), { passive: true } ); + this.container.addEventListener( 'touchstart', this.onMouseDown.bind( this ), { passive: true } ); + this.container.addEventListener( 'touchmove', this.onMouseMove.bind( this ), { passive: true } ); + this.container.addEventListener( 'touchend', this.onMouseUp.bind( this ), { passive: true } ); + this.container.addEventListener( 'mousewheel', this.onMouseWheel.bind( this ), { passive: false } ); + this.container.addEventListener( 'DOMMouseScroll', this.onMouseWheel.bind( this ), { passive: false } ); + this.container.addEventListener( 'contextmenu', this.onContextMenu.bind( this ), { passive: true } ); + + }, + + unregisterMouseEvents: function () { + + this.container.removeEventListener( 'mousedown', this.onMouseDown.bind( this ), false ); + this.container.removeEventListener( 'mousemove', this.onMouseMove.bind( this ), false ); + this.container.removeEventListener( 'mouseup', this.onMouseUp.bind( this ), false ); + this.container.removeEventListener( 'touchstart', this.onMouseDown.bind( this ), false ); + this.container.removeEventListener( 'touchmove', this.onMouseMove.bind( this ), false ); + this.container.removeEventListener( 'touchend', this.onMouseUp.bind( this ), false ); + this.container.removeEventListener( 'mousewheel', this.onMouseWheel.bind( this ), false ); + this.container.removeEventListener( 'DOMMouseScroll', this.onMouseWheel.bind( this ), false ); + this.container.removeEventListener( 'contextmenu', this.onContextMenu.bind( this ), false ); + + }, + + onMouseDown: function ( event ) { + + const inputCount = ( event.touches && event.touches.length ) || 1 ; + + switch ( inputCount ) { + + case 1: + + const x = ( event.clientX >= 0 ) ? event.clientX : event.touches[ 0 ].clientX; + const y = ( event.clientY >= 0 ) ? event.clientY : event.touches[ 0 ].clientY; + + this.dragging = true; + this.userMouse.set( x, y ); + + break; + + case 2: + + const dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + const dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + const distance = Math.sqrt( dx * dx + dy * dy ); + this.userMouse.pinchDistance = distance; + + break; + + default: + + break; + + } + + this.onUpdateCallback(); + + }, + + onMouseMove: function ( event ) { + + const inputCount = ( event.touches && event.touches.length ) || 1 ; + + switch ( inputCount ) { + + case 1: + + const x = ( event.clientX >= 0 ) ? event.clientX : event.touches[ 0 ].clientX; + const y = ( event.clientY >= 0 ) ? event.clientY : event.touches[ 0 ].clientY; + + const angleX = THREE.Math.degToRad( x - this.userMouse.x ) * 0.4; + const angleY = THREE.Math.degToRad( y - this.userMouse.y ) * 0.4; + + if ( this.dragging ) { + this.quatA.setFromAxisAngle( this.vectorY, angleX ); + this.quatB.setFromAxisAngle( this.vectorX, angleY ); + this.quatCur.multiply( this.quatA ).multiply( this.quatB ); + this.userMouse.set( x, y ); + } + + break; + + case 2: + + const dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + const dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + const distance = Math.sqrt( dx * dx + dy * dy ); + + this.addZoomDelta( this.userMouse.pinchDistance - distance ); + + break; + + default: + + break; + + } + + }, + + onMouseUp: function () { + + this.dragging = false; + + }, + + onMouseWheel: function ( event ) { + + event.preventDefault(); + event.stopPropagation(); + + let delta = 0; + + if ( event.wheelDelta !== undefined ) { // WebKit / Opera / Explorer 9 + + delta = event.wheelDelta; + + } else if ( event.detail !== undefined ) { // Firefox + + delta = - event.detail; + + } + + this.addZoomDelta( delta ); + this.onUpdateCallback(); + + }, + + addZoomDelta: function ( delta ) { + + const uniforms = this.material.uniforms; + const lowerBound = this.size * 0.1; + const upperBound = this.size * 10; + + uniforms.zoom.value += delta; + + if ( uniforms.zoom.value <= lowerBound ) { + + uniforms.zoom.value = lowerBound; + + } else if ( uniforms.zoom.value >= upperBound ) { + + uniforms.zoom.value = upperBound; + + } + + }, + + onUpdateCallback: function () { + + this.frameId = window.requestAnimationFrame( this.onUpdateCallback.bind( this ) ); + + this.quatSlerp.slerp( this.quatCur, 0.1 ); + + if ( this.material ) { + + this.material.uniforms.transform.value.makeRotationFromQuaternion( this.quatSlerp ); + + } + + if ( !this.dragging && 1.0 - this.quatSlerp.clone().dot( this.quatCur ) < this.EPS ) { + + window.cancelAnimationFrame( this.frameId ); + + } + + }, + + reset: function () { + + this.quatCur.set( 0, 0, 0, 1 ); + this.quatSlerp.set( 0, 0, 0, 1 ); + this.onUpdateCallback(); + + }, + + onLoad: function ( texture ) { + + this.material.uniforms.resolution.value = this.container.clientWidth / this.container.clientHeight; + + this.registerMouseEvents(); + this.onUpdateCallback(); + + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'disableControl' } ); + + ImagePanorama.prototype.onLoad.call( this, texture ); + + }, + + onLeave: function () { + + this.unregisterMouseEvents(); + + this.dispatchEvent( { type: 'panolens-viewer-handler', method: 'enableControl', data: CONTROLS.ORBIT } ); + + window.cancelAnimationFrame( this.frameId ); + + ImagePanorama.prototype.onLeave.call( this ); + + }, + + onWindowResize: function () { + + this.material.uniforms.resolution.value = this.container.clientWidth / this.container.clientHeight; + + }, + + onContextMenu: function () { + + this.dragging = false; + + }, + + dispose: function () { + + this.unregisterMouseEvents(); + + ImagePanorama.prototype.dispose.call( this ); + + } + + }); + + /** + * @classdesc Image Little Planet + * @constructor + * @param {string} source - URL for the image source + * @param {number} [size=10000] - Size of plane geometry + * @param {number} [ratio=0.5] - Ratio of plane geometry's height against width + */ + function ImageLittlePlanet ( source, size, ratio ) { + + LittlePlanet.call( this, 'image', source, size, ratio ); + + } + + ImageLittlePlanet.prototype = Object.assign( Object.create( LittlePlanet.prototype ), { + + constructor: ImageLittlePlanet, + + /** + * On loaded with texture + * @param {THREE.Texture} texture + * @memberOf ImageLittlePlanet + * @instance + */ + onLoad: function ( texture ) { + + this.updateTexture( texture ); + + LittlePlanet.prototype.onLoad.call( this, texture ); + + }, + + /** + * Update texture + * @param {THREE.Texture} texture + * @memberOf ImageLittlePlanet + * @instance + */ + updateTexture: function ( texture ) { + + texture.minFilter = texture.magFilter = THREE.LinearFilter; + + this.material.uniforms[ 'tDiffuse' ].value = texture; + + }, + + /** + * Dispose + * @memberOf ImageLittlePlanet + * @instance + */ + dispose: function () { + + const tDiffuse = this.material.uniforms[ 'tDiffuse' ]; + + if ( tDiffuse && tDiffuse.value ) { + + tDiffuse.value.dispose(); + + } + + LittlePlanet.prototype.dispose.call( this ); + + } + + } ); + + /** + * @classdesc Camera panorama + * @description See {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints|MediaStreamConstraints} for constraints + * @param {object} - camera constraints + * @constructor + */ + function CameraPanorama ( constraints ) { + + const radius = 5000; + const geometry = new THREE.SphereBufferGeometry( radius, 60, 40 ); + const material = new THREE.MeshBasicMaterial( { visible: false }); + + Panorama.call( this, geometry, material ); + + this.media = new Media( constraints ); + this.radius = radius; + + this.addEventListener( 'enter', this.start.bind( this ) ); + this.addEventListener( 'leave', this.stop.bind( this ) ); + this.addEventListener( 'panolens-container', this.onPanolensContainer.bind( this ) ); + this.addEventListener( 'panolens-scene', this.onPanolensScene.bind( this ) ); + + } + + CameraPanorama.prototype = Object.assign( Object.create( Panorama.prototype ), { + + constructor: CameraPanorama, + + /** + * On container event + * @param {object} event + * @memberOf CameraPanorama + * @instance + */ + onPanolensContainer: function ( { container } ) { + + this.media.setContainer( container ); + + }, + + /** + * On scene event + * @param {object} event + * @memberOf CameraPanorama + * @instance + */ + onPanolensScene: function ( { scene } ) { + + this.media.setScene( scene ); + + }, + + /** + * Start camera streaming + * @memberOf CameraPanorama + * @instance + * @returns {Promise} + */ + start: function () { + + return this.media.start(); + + }, + + /** + * Stop camera streaming + * @memberOf CameraPanorama + * @instance + */ + stop: function () { + + this.media.stop(); + + }, + + } ); + + /** + * @classdesc Orbit Controls + * @constructor + * @external OrbitControls + * @param {THREE.Object} object + * @param {HTMLElement} domElement + */ + function OrbitControls ( object, domElement ) { + + this.object = object; + this.domElement = ( domElement !== undefined ) ? domElement : document; + this.frameId = null; + + // API + + // Set to false to disable this control + this.enabled = true; + + /* + * "target" sets the location of focus, where the control orbits around + * and where it pans with respect to. + */ + this.target = new THREE.Vector3(); + + // center is old, deprecated; use "target" instead + this.center = this.target; + + /* + * This option actually enables dollying in and out; left as "zoom" for + * backwards compatibility + */ + this.noZoom = false; + this.zoomSpeed = 1.0; + + // Limits to how far you can dolly in and out ( PerspectiveCamera only ) + this.minDistance = 0; + this.maxDistance = Infinity; + + // Limits to how far you can zoom in and out ( OrthographicCamera only ) + this.minZoom = 0; + this.maxZoom = Infinity; + + // Set to true to disable this control + this.noRotate = false; + this.rotateSpeed = -0.15; + + // Set to true to disable this control + this.noPan = true; + this.keyPanSpeed = 7.0; // pixels moved per arrow key push + + // Set to true to automatically rotate around the target + this.autoRotate = false; + this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60 + + /* + * How far you can orbit vertically, upper and lower limits. + * Range is 0 to Math.PI radians. + */ + this.minPolarAngle = 0; // radians + this.maxPolarAngle = Math.PI; // radians + + // Momentum + this.momentumDampingFactor = 0.90; + this.momentumScalingFactor = -0.005; + this.momentumKeydownFactor = 20; + + // Fov + this.minFov = 30; + this.maxFov = 120; + + /* + * How far you can orbit horizontally, upper and lower limits. + * If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ]. + */ + this.minAzimuthAngle = - Infinity; // radians + this.maxAzimuthAngle = Infinity; // radians + + // Set to true to disable use of the keys + this.noKeys = false; + + // The four arrow keys + this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 }; + + // Mouse buttons + this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT }; + + /* + * ////////// + * internals + */ + + var scope = this; + + var EPS = 10e-8; + var MEPS = 10e-5; + + var rotateStart = new THREE.Vector2(); + var rotateEnd = new THREE.Vector2(); + var rotateDelta = new THREE.Vector2(); + + var panStart = new THREE.Vector2(); + var panEnd = new THREE.Vector2(); + var panDelta = new THREE.Vector2(); + var panOffset = new THREE.Vector3(); + + var offset = new THREE.Vector3(); + + var dollyStart = new THREE.Vector2(); + var dollyEnd = new THREE.Vector2(); + var dollyDelta = new THREE.Vector2(); + + var theta = 0; + var phi = 0; + var phiDelta = 0; + var thetaDelta = 0; + var scale = 1; + var pan = new THREE.Vector3(); + + var lastPosition = new THREE.Vector3(); + var lastQuaternion = new THREE.Quaternion(); + + var momentumLeft = 0, momentumUp = 0; + var eventPrevious; + var momentumOn = false; + + var keyUp, keyBottom, keyLeft, keyRight; + + var STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 }; + + var state = STATE.NONE; + + // for reset + + this.target0 = this.target.clone(); + this.position0 = this.object.position.clone(); + this.zoom0 = this.object.zoom; + + // so camera.up is the orbit axis + + var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) ); + var quatInverse = quat.clone().inverse(); + + // events + + var changeEvent = { type: 'change' }; + var startEvent = { type: 'start' }; + var endEvent = { type: 'end' }; + + this.setLastQuaternion = function ( quaternion ) { + lastQuaternion.copy( quaternion ); + scope.object.quaternion.copy( quaternion ); + }; + + this.getLastPosition = function () { + return lastPosition; + }; + + this.rotateLeft = function ( angle ) { + + if ( angle === undefined ) { + + angle = getAutoRotationAngle(); + + } + + thetaDelta -= angle; + + + }; + + this.rotateUp = function ( angle ) { + + if ( angle === undefined ) { + + angle = getAutoRotationAngle(); + + } + + phiDelta -= angle; + + }; + + // pass in distance in world space to move left + this.panLeft = function ( distance ) { + + var te = this.object.matrix.elements; + + // get X column of matrix + panOffset.set( te[ 0 ], te[ 1 ], te[ 2 ] ); + panOffset.multiplyScalar( - distance ); + + pan.add( panOffset ); + + }; + + // pass in distance in world space to move up + this.panUp = function ( distance ) { + + var te = this.object.matrix.elements; + + // get Y column of matrix + panOffset.set( te[ 4 ], te[ 5 ], te[ 6 ] ); + panOffset.multiplyScalar( distance ); + + pan.add( panOffset ); + + }; + + /* + * pass in x,y of change desired in pixel space, + * right and down are positive + */ + this.pan = function ( deltaX, deltaY ) { + + var element = scope.domElement === document ? scope.domElement.body : scope.domElement; + + if ( scope.object instanceof THREE.PerspectiveCamera ) { + + // perspective + var position = scope.object.position; + var offset = position.clone().sub( scope.target ); + var targetDistance = offset.length(); + + // half of the fov is center to top of screen + targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 ); + + // we actually don't use screenWidth, since perspective camera is fixed to screen height + scope.panLeft( 2 * deltaX * targetDistance / element.clientHeight ); + scope.panUp( 2 * deltaY * targetDistance / element.clientHeight ); + + } else if ( scope.object instanceof THREE.OrthographicCamera ) { + + // orthographic + scope.panLeft( deltaX * (scope.object.right - scope.object.left) / element.clientWidth ); + scope.panUp( deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight ); + + } else { + + // camera neither orthographic or perspective + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' ); + + } + + }; + + this.momentum = function(){ + + if ( !momentumOn ) return; + + if ( Math.abs( momentumLeft ) < MEPS && Math.abs( momentumUp ) < MEPS ) { + + momentumOn = false; + return; + } + + momentumUp *= this.momentumDampingFactor; + momentumLeft *= this.momentumDampingFactor; + + thetaDelta -= this.momentumScalingFactor * momentumLeft; + phiDelta -= this.momentumScalingFactor * momentumUp; + + }; + + this.dollyIn = function ( dollyScale ) { + + if ( dollyScale === undefined ) { + + dollyScale = getZoomScale(); + + } + + if ( scope.object instanceof THREE.PerspectiveCamera ) { + + scale /= dollyScale; + + } else if ( scope.object instanceof THREE.OrthographicCamera ) { + + scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom * dollyScale ) ); + scope.object.updateProjectionMatrix(); + scope.dispatchEvent( changeEvent ); + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + + } + + }; + + this.dollyOut = function ( dollyScale ) { + + if ( dollyScale === undefined ) { + + dollyScale = getZoomScale(); + + } + + if ( scope.object instanceof THREE.PerspectiveCamera ) { + + scale *= dollyScale; + + } else if ( scope.object instanceof THREE.OrthographicCamera ) { + + scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / dollyScale ) ); + scope.object.updateProjectionMatrix(); + scope.dispatchEvent( changeEvent ); + + } else { + + console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); + + } + + }; + + this.update = function ( ignoreUpdate ) { + + var position = this.object.position; + + offset.copy( position ).sub( this.target ); + + // rotate offset to "y-axis-is-up" space + offset.applyQuaternion( quat ); + + // angle from z-axis around y-axis + + theta = Math.atan2( offset.x, offset.z ); + + // angle from y-axis + + phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y ); + + if ( this.autoRotate && state === STATE.NONE ) { + + this.rotateLeft( getAutoRotationAngle() ); + + } + + this.momentum(); + + theta += thetaDelta; + phi += phiDelta; + + // restrict theta to be between desired limits + theta = Math.max( this.minAzimuthAngle, Math.min( this.maxAzimuthAngle, theta ) ); + + // restrict phi to be between desired limits + phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) ); + + // restrict phi to be betwee EPS and PI-EPS + phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) ); + + var radius = offset.length() * scale; + + // restrict radius to be between desired limits + radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) ); + + // move target to panned location + this.target.add( pan ); + + offset.x = radius * Math.sin( phi ) * Math.sin( theta ); + offset.y = radius * Math.cos( phi ); + offset.z = radius * Math.sin( phi ) * Math.cos( theta ); + + // rotate offset back to "camera-up-vector-is-up" space + offset.applyQuaternion( quatInverse ); + + position.copy( this.target ).add( offset ); + + this.object.lookAt( this.target ); + + thetaDelta = 0; + phiDelta = 0; + scale = 1; + pan.set( 0, 0, 0 ); + + /* + * update condition is: + * min(camera displacement, camera rotation in radians)^2 > EPS + * using small-angle approximation cos(x/2) = 1 - x^2 / 8 + */ + if ( lastPosition.distanceToSquared( this.object.position ) > EPS + || 8 * (1 - lastQuaternion.dot(this.object.quaternion)) > EPS ) { + + if ( ignoreUpdate !== true ) { this.dispatchEvent( changeEvent ); } + + lastPosition.copy( this.object.position ); + lastQuaternion.copy (this.object.quaternion ); + + } + + }; + + + this.reset = function () { + + state = STATE.NONE; + + this.target.copy( this.target0 ); + this.object.position.copy( this.position0 ); + this.object.zoom = this.zoom0; + + this.object.updateProjectionMatrix(); + this.dispatchEvent( changeEvent ); + + this.update(); + + }; + + this.getPolarAngle = function () { + + return phi; + + }; + + this.getAzimuthalAngle = function () { + + return theta; + + }; + + function getAutoRotationAngle() { + + return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed; + + } + + function getZoomScale() { + + return Math.pow( 0.95, scope.zoomSpeed ); + + } + + function onMouseDown( event ) { + + momentumOn = false; + + momentumLeft = momentumUp = 0; + + if ( scope.enabled === false ) return; + event.preventDefault(); + + if ( event.button === scope.mouseButtons.ORBIT ) { + if ( scope.noRotate === true ) return; + + state = STATE.ROTATE; + + rotateStart.set( event.clientX, event.clientY ); + + } else if ( event.button === scope.mouseButtons.ZOOM ) { + if ( scope.noZoom === true ) return; + + state = STATE.DOLLY; + + dollyStart.set( event.clientX, event.clientY ); + + } else if ( event.button === scope.mouseButtons.PAN ) { + if ( scope.noPan === true ) return; + + state = STATE.PAN; + + panStart.set( event.clientX, event.clientY ); + + } + + if ( state !== STATE.NONE ) { + document.addEventListener( 'mousemove', onMouseMove, false ); + document.addEventListener( 'mouseup', onMouseUp, false ); + scope.dispatchEvent( startEvent ); + } + + scope.update(); + + } + + function onMouseMove( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + + var element = scope.domElement === document ? scope.domElement.body : scope.domElement; + + if ( state === STATE.ROTATE ) { + + if ( scope.noRotate === true ) return; + + rotateEnd.set( event.clientX, event.clientY ); + rotateDelta.subVectors( rotateEnd, rotateStart ); + + // rotating across whole screen goes 360 degrees around + scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed ); + + // rotating up and down along whole screen attempts to go 360, but limited to 180 + scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed ); + + rotateStart.copy( rotateEnd ); + + if( eventPrevious ){ + momentumLeft = event.clientX - eventPrevious.clientX; + momentumUp = event.clientY - eventPrevious.clientY; + } + + eventPrevious = event; + + } else if ( state === STATE.DOLLY ) { + + if ( scope.noZoom === true ) return; + + dollyEnd.set( event.clientX, event.clientY ); + dollyDelta.subVectors( dollyEnd, dollyStart ); + + if ( dollyDelta.y > 0 ) { + + scope.dollyIn(); + + } else if ( dollyDelta.y < 0 ) { + + scope.dollyOut(); + + } + + dollyStart.copy( dollyEnd ); + + } else if ( state === STATE.PAN ) { + + if ( scope.noPan === true ) return; + + panEnd.set( event.clientX, event.clientY ); + panDelta.subVectors( panEnd, panStart ); + + scope.pan( panDelta.x, panDelta.y ); + + panStart.copy( panEnd ); + + } + + if ( state !== STATE.NONE ) scope.update(); + + } + + function onMouseUp( /* event */ ) { + + momentumOn = true; + + eventPrevious = undefined; + + if ( scope.enabled === false ) return; + + document.removeEventListener( 'mousemove', onMouseMove, false ); + document.removeEventListener( 'mouseup', onMouseUp, false ); + scope.dispatchEvent( endEvent ); + state = STATE.NONE; + + } + + function onMouseWheel( event ) { + + if ( scope.enabled === false || scope.noZoom === true || state !== STATE.NONE ) return; + + event.preventDefault(); + event.stopPropagation(); + + var delta = 0; + + if ( event.wheelDelta !== undefined ) { // WebKit / Opera / Explorer 9 + + delta = event.wheelDelta; + + } else if ( event.detail !== undefined ) { // Firefox + + delta = - event.detail; + + } + + if ( delta > 0 ) { + + // scope.dollyOut(); + scope.object.fov = ( scope.object.fov < scope.maxFov ) + ? scope.object.fov + 1 + : scope.maxFov; + scope.object.updateProjectionMatrix(); + + } else if ( delta < 0 ) { + + // scope.dollyIn(); + scope.object.fov = ( scope.object.fov > scope.minFov ) + ? scope.object.fov - 1 + : scope.minFov; + scope.object.updateProjectionMatrix(); + + } + + scope.update(); + scope.dispatchEvent( changeEvent ); + scope.dispatchEvent( startEvent ); + scope.dispatchEvent( endEvent ); + + } + + function onKeyUp ( event ) { + + switch ( event.keyCode ) { + + case scope.keys.UP: + keyUp = false; + break; + + case scope.keys.BOTTOM: + keyBottom = false; + break; + + case scope.keys.LEFT: + keyLeft = false; + break; + + case scope.keys.RIGHT: + keyRight = false; + break; + + } + + } + + function onKeyDown( event ) { + + if ( scope.enabled === false || scope.noKeys === true || scope.noRotate === true ) return; + + switch ( event.keyCode ) { + + case scope.keys.UP: + keyUp = true; + break; + + case scope.keys.BOTTOM: + keyBottom = true; + break; + + case scope.keys.LEFT: + keyLeft = true; + break; + + case scope.keys.RIGHT: + keyRight = true; + break; + + } + + if (keyUp || keyBottom || keyLeft || keyRight) { + + momentumOn = true; + + if (keyUp) momentumUp = - scope.rotateSpeed * scope.momentumKeydownFactor; + if (keyBottom) momentumUp = scope.rotateSpeed * scope.momentumKeydownFactor; + if (keyLeft) momentumLeft = - scope.rotateSpeed * scope.momentumKeydownFactor; + if (keyRight) momentumLeft = scope.rotateSpeed * scope.momentumKeydownFactor; + + } + + } + + function touchstart( event ) { + + momentumOn = false; + + momentumLeft = momentumUp = 0; + + if ( scope.enabled === false ) return; + + switch ( event.touches.length ) { + + case 1: // one-fingered touch: rotate + + if ( scope.noRotate === true ) return; + + state = STATE.TOUCH_ROTATE; + + rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + break; + + case 2: // two-fingered touch: dolly + + if ( scope.noZoom === true ) return; + + state = STATE.TOUCH_DOLLY; + + var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + var distance = Math.sqrt( dx * dx + dy * dy ); + + dollyStart.set( 0, distance ); + + break; + + case 3: // three-fingered touch: pan + + if ( scope.noPan === true ) return; + + state = STATE.TOUCH_PAN; + + panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + break; + + default: + + state = STATE.NONE; + + } + + if ( state !== STATE.NONE ) scope.dispatchEvent( startEvent ); + + } + + function touchmove( event ) { + + if ( scope.enabled === false ) return; + + event.preventDefault(); + event.stopPropagation(); + + var element = scope.domElement === document ? scope.domElement.body : scope.domElement; + + switch ( event.touches.length ) { + + case 1: // one-fingered touch: rotate + + if ( scope.noRotate === true ) return; + if ( state !== STATE.TOUCH_ROTATE ) return; + + rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + rotateDelta.subVectors( rotateEnd, rotateStart ); + + // rotating across whole screen goes 360 degrees around + scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed ); + // rotating up and down along whole screen attempts to go 360, but limited to 180 + scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed ); + + rotateStart.copy( rotateEnd ); + + if( eventPrevious ){ + momentumLeft = event.touches[ 0 ].pageX - eventPrevious.pageX; + momentumUp = event.touches[ 0 ].pageY - eventPrevious.pageY; + } + + eventPrevious = { + pageX: event.touches[ 0 ].pageX, + pageY: event.touches[ 0 ].pageY, + }; + + scope.update(); + break; + + case 2: // two-fingered touch: dolly + + if ( scope.noZoom === true ) return; + if ( state !== STATE.TOUCH_DOLLY ) return; + + var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; + var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; + var distance = Math.sqrt( dx * dx + dy * dy ); + + dollyEnd.set( 0, distance ); + dollyDelta.subVectors( dollyEnd, dollyStart ); + + if ( dollyDelta.y < 0 ) { + + scope.object.fov = ( scope.object.fov < scope.maxFov ) + ? scope.object.fov + 1 + : scope.maxFov; + scope.object.updateProjectionMatrix(); + + } else if ( dollyDelta.y > 0 ) { + + scope.object.fov = ( scope.object.fov > scope.minFov ) + ? scope.object.fov - 1 + : scope.minFov; + scope.object.updateProjectionMatrix(); + + } + + dollyStart.copy( dollyEnd ); + + scope.update(); + scope.dispatchEvent( changeEvent ); + break; + + case 3: // three-fingered touch: pan + + if ( scope.noPan === true ) return; + if ( state !== STATE.TOUCH_PAN ) return; + + panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); + panDelta.subVectors( panEnd, panStart ); + + scope.pan( panDelta.x, panDelta.y ); + + panStart.copy( panEnd ); + + scope.update(); + break; + + default: + + state = STATE.NONE; + + } + + } + + function touchend( /* event */ ) { + + momentumOn = true; + + eventPrevious = undefined; + + if ( scope.enabled === false ) return; + + scope.dispatchEvent( endEvent ); + state = STATE.NONE; + + } + + this.dispose = function() { + + this.domElement.removeEventListener( 'mousedown', onMouseDown ); + this.domElement.removeEventListener( 'mousewheel', onMouseWheel ); + this.domElement.removeEventListener( 'DOMMouseScroll', onMouseWheel ); + + this.domElement.removeEventListener( 'touchstart', touchstart ); + this.domElement.removeEventListener( 'touchend', touchend ); + this.domElement.removeEventListener( 'touchmove', touchmove ); + + window.removeEventListener( 'keyup', onKeyUp ); + window.removeEventListener( 'keydown', onKeyDown ); + + }; + + // this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false ); + this.domElement.addEventListener( 'mousedown', onMouseDown, { passive: false } ); + this.domElement.addEventListener( 'mousewheel', onMouseWheel, { passive: false } ); + this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, { passive: false } ); // firefox + + this.domElement.addEventListener( 'touchstart', touchstart, { passive: false } ); + this.domElement.addEventListener( 'touchend', touchend, { passive: false } ); + this.domElement.addEventListener( 'touchmove', touchmove, { passive: false } ); + + window.addEventListener( 'keyup', onKeyUp, { passive: false } ); + window.addEventListener( 'keydown', onKeyDown, { passive: false } ); + + // force an update at start + this.update(); + + } + OrbitControls.prototype = Object.assign( Object.create( THREE.EventDispatcher.prototype ), { + + constructor: OrbitControls + + } ); + + /** + * @classdesc Device Orientation Control + * @constructor + * @external DeviceOrientationControls + * @param {THREE.Camera} camera + * @param {HTMLElement} domElement + */ + function DeviceOrientationControls ( camera, domElement ) { + + var scope = this; + var changeEvent = { type: 'change' }; + + var rotY = 0; + var rotX = 0; + var tempX = 0; + var tempY = 0; + + this.camera = camera; + this.camera.rotation.reorder( 'YXZ' ); + this.domElement = ( domElement !== undefined ) ? domElement : document; + + this.enabled = true; + + this.deviceOrientation = {}; + this.screenOrientation = 0; + + this.alpha = 0; + this.alphaOffsetAngle = 0; + + + var onDeviceOrientationChangeEvent = function( event ) { + + scope.deviceOrientation = event; + + }; + + var onScreenOrientationChangeEvent = function() { + + scope.screenOrientation = window.orientation || 0; + + }; + + var onTouchStartEvent = function (event) { + + event.preventDefault(); + event.stopPropagation(); + + tempX = event.touches[ 0 ].pageX; + tempY = event.touches[ 0 ].pageY; + + }; + + var onTouchMoveEvent = function (event) { + + event.preventDefault(); + event.stopPropagation(); + + rotY += THREE.Math.degToRad( ( event.touches[ 0 ].pageX - tempX ) / 4 ); + rotX += THREE.Math.degToRad( ( tempY - event.touches[ 0 ].pageY ) / 4 ); + + scope.updateAlphaOffsetAngle( rotY ); + + tempX = event.touches[ 0 ].pageX; + tempY = event.touches[ 0 ].pageY; + + }; + + // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y'' + + var setCameraQuaternion = function( quaternion, alpha, beta, gamma, orient ) { + + var zee = new THREE.Vector3( 0, 0, 1 ); + + var euler = new THREE.Euler(); + + var q0 = new THREE.Quaternion(); + + var q1 = new THREE.Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis + + var vectorFingerY; + var fingerQY = new THREE.Quaternion(); + var fingerQX = new THREE.Quaternion(); + + if ( scope.screenOrientation == 0 ) { + + vectorFingerY = new THREE.Vector3( 1, 0, 0 ); + fingerQY.setFromAxisAngle( vectorFingerY, -rotX ); + + } else if ( scope.screenOrientation == 180 ) { + + vectorFingerY = new THREE.Vector3( 1, 0, 0 ); + fingerQY.setFromAxisAngle( vectorFingerY, rotX ); + + } else if ( scope.screenOrientation == 90 ) { + + vectorFingerY = new THREE.Vector3( 0, 1, 0 ); + fingerQY.setFromAxisAngle( vectorFingerY, rotX ); + + } else if ( scope.screenOrientation == - 90) { + + vectorFingerY = new THREE.Vector3( 0, 1, 0 ); + fingerQY.setFromAxisAngle( vectorFingerY, -rotX ); + + } + + q1.multiply( fingerQY ); + q1.multiply( fingerQX ); + + euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us + + quaternion.setFromEuler( euler ); // orient the device + + quaternion.multiply( q1 ); // camera looks out the back of the device, not the top + + quaternion.multiply( q0.setFromAxisAngle( zee, - orient ) ); // adjust for screen orientation + + }; + + this.connect = function() { + + onScreenOrientationChangeEvent(); // run once on load + + window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent, { passive: true } ); + window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent, { passive: true } ); + window.addEventListener( 'deviceorientation', this.update.bind( this ), { passive: true } ); + + scope.domElement.addEventListener( 'touchstart', onTouchStartEvent, { passive: false } ); + scope.domElement.addEventListener( 'touchmove', onTouchMoveEvent, { passive: false } ); + + scope.enabled = true; + + }; + + this.disconnect = function() { + + window.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent, false ); + window.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent, false ); + window.removeEventListener( 'deviceorientation', this.update.bind( this ), false ); + + scope.domElement.removeEventListener( 'touchstart', onTouchStartEvent, false ); + scope.domElement.removeEventListener( 'touchmove', onTouchMoveEvent, false ); + + scope.enabled = false; + + }; + + this.update = function( ignoreUpdate ) { + + if ( scope.enabled === false ) return; + + var alpha = scope.deviceOrientation.alpha ? THREE.Math.degToRad( scope.deviceOrientation.alpha ) + scope.alphaOffsetAngle : 0; // Z + var beta = scope.deviceOrientation.beta ? THREE.Math.degToRad( scope.deviceOrientation.beta ) : 0; // X' + var gamma = scope.deviceOrientation.gamma ? THREE.Math.degToRad( scope.deviceOrientation.gamma ) : 0; // Y'' + var orient = scope.screenOrientation ? THREE.Math.degToRad( scope.screenOrientation ) : 0; // O + + setCameraQuaternion( scope.camera.quaternion, alpha, beta, gamma, orient ); + scope.alpha = alpha; + + if ( ignoreUpdate !== true ) { scope.dispatchEvent( changeEvent ); } + + }; + + this.updateAlphaOffsetAngle = function( angle ) { + + this.alphaOffsetAngle = angle; + this.update(); + + }; + + this.dispose = function() { + + this.disconnect(); + + }; + + this.connect(); + + } + DeviceOrientationControls.prototype = Object.assign( Object.create( THREE.EventDispatcher.prototype), { + + constructor: DeviceOrientationControls + + } ); + + /** + * @classdesc Google Cardboard Effect Composer + * @constructor + * @external CardboardEffect + * @param {THREE.WebGLRenderer} renderer + */ + function CardboardEffect ( renderer ) { + + var _camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); + + var _scene = new THREE.Scene(); + + var _stereo = new THREE.StereoCamera(); + _stereo.aspect = 0.5; + + var _params = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat }; + + var _renderTarget = new THREE.WebGLRenderTarget( 512, 512, _params ); + _renderTarget.scissorTest = true; + _renderTarget.texture.generateMipmaps = false; + + /* + * Distortion Mesh ported from: + * https://github.com/borismus/webvr-boilerplate/blob/master/src/distortion/barrel-distortion-fragment.js + */ + + var distortion = new THREE.Vector2( 0.441, 0.156 ); + + var geometry = new THREE.PlaneBufferGeometry( 1, 1, 10, 20 ).removeAttribute( 'normal' ).toNonIndexed(); + + var positions = geometry.attributes.position.array; + var uvs = geometry.attributes.uv.array; + + // duplicate + geometry.attributes.position.count *= 2; + geometry.attributes.uv.count *= 2; + + var positions2 = new Float32Array( positions.length * 2 ); + positions2.set( positions ); + positions2.set( positions, positions.length ); + + var uvs2 = new Float32Array( uvs.length * 2 ); + uvs2.set( uvs ); + uvs2.set( uvs, uvs.length ); + + var vector = new THREE.Vector2(); + var length = positions.length / 3; + + for ( var i = 0, l = positions2.length / 3; i < l; i ++ ) { + + vector.x = positions2[ i * 3 + 0 ]; + vector.y = positions2[ i * 3 + 1 ]; + + var dot = vector.dot( vector ); + var scalar = 1.5 + ( distortion.x + distortion.y * dot ) * dot; + + var offset = i < length ? 0 : 1; + + positions2[ i * 3 + 0 ] = ( vector.x / scalar ) * 1.5 - 0.5 + offset; + positions2[ i * 3 + 1 ] = ( vector.y / scalar ) * 3.0; + + uvs2[ i * 2 ] = ( uvs2[ i * 2 ] + offset ) * 0.5; + + } + + geometry.attributes.position.array = positions2; + geometry.attributes.uv.array = uvs2; + + // + + var material = new THREE.MeshBasicMaterial( { map: _renderTarget.texture } ); + var mesh = new THREE.Mesh( geometry, material ); + _scene.add( mesh ); + + // + + this.setSize = function ( width, height ) { + + renderer.setSize( width, height ); + + var pixelRatio = renderer.getPixelRatio(); + + _renderTarget.setSize( width * pixelRatio, height * pixelRatio ); + + }; + + this.render = function ( scene, camera ) { + + scene.updateMatrixWorld(); + + if ( camera.parent === null ) camera.updateMatrixWorld(); + + _stereo.update( camera ); + + var width = _renderTarget.width / 2; + var height = _renderTarget.height; + + if ( renderer.autoClear ) renderer.clear(); + + _renderTarget.scissor.set( 0, 0, width, height ); + _renderTarget.viewport.set( 0, 0, width, height ); + renderer.setRenderTarget( _renderTarget ); + renderer.render( scene, _stereo.cameraL ); + + renderer.clearDepth(); + + _renderTarget.scissor.set( width, 0, width, height ); + _renderTarget.viewport.set( width, 0, width, height ); + renderer.setRenderTarget( _renderTarget ); + renderer.render( scene, _stereo.cameraR ); + + renderer.clearDepth(); + + renderer.setRenderTarget( null ); + renderer.render( _scene, _camera ); + }; + + } + + /** + * @classdesc Stereo Effect Composer + * @constructor + * @external StereoEffect + * @param {THREE.WebGLRenderer} renderer + */ + const StereoEffect = function ( renderer ) { + + var _stereo = new THREE.StereoCamera(); + _stereo.aspect = 0.5; + var size = new THREE.Vector2(); + + this.setEyeSeparation = function ( eyeSep ) { + + _stereo.eyeSep = eyeSep; + + }; + + this.setSize = function ( width, height ) { + + renderer.setSize( width, height ); + + }; + + this.render = function ( scene, camera ) { + + scene.updateMatrixWorld(); + + if ( camera.parent === null ) camera.updateMatrixWorld(); + + _stereo.update( camera ); + + renderer.getSize( size ); + + if ( renderer.autoClear ) renderer.clear(); + renderer.setScissorTest( true ); + + renderer.setScissor( 0, 0, size.width / 2, size.height ); + renderer.setViewport( 0, 0, size.width / 2, size.height ); + renderer.render( scene, _stereo.cameraL ); + + renderer.setScissor( size.width / 2, 0, size.width / 2, size.height ); + renderer.setViewport( size.width / 2, 0, size.width / 2, size.height ); + renderer.render( scene, _stereo.cameraR ); + + renderer.setScissorTest( false ); + + }; + + }; + + /** + * @classdesc Viewer contains pre-defined scene, camera and renderer + * @constructor + * @param {object} [options] - Use custom or default config options + * @param {HTMLElement} [options.container] - A HTMLElement to host the canvas + * @param {THREE.Scene} [options.scene=THREE.Scene] - A THREE.Scene which contains panorama and 3D objects + * @param {THREE.Camera} [options.camera=THREE.PerspectiveCamera] - A THREE.Camera to view the scene + * @param {THREE.WebGLRenderer} [options.renderer=THREE.WebGLRenderer] - A THREE.WebGLRenderer to render canvas + * @param {boolean} [options.controlBar=true] - Show/hide control bar on the bottom of the container + * @param {array} [options.controlButtons=[]] - Button names to mount on controlBar if controlBar exists, Defaults to ['fullscreen', 'setting', 'video'] + * @param {boolean} [options.autoHideControlBar=false] - Auto hide control bar when click on non-active area + * @param {boolean} [options.autoHideInfospot=true] - Auto hide infospots when click on non-active area + * @param {boolean} [options.horizontalView=false] - Allow only horizontal camera control + * @param {number} [options.clickTolerance=10] - Distance tolerance to tigger click / tap event + * @param {number} [options.cameraFov=60] - Camera field of view value + * @param {boolean} [options.reverseDragging=false] - Reverse dragging direction + * @param {boolean} [options.enableReticle=false] - Enable reticle for mouseless interaction other than VR mode + * @param {number} [options.dwellTime=1500] - Dwell time for reticle selection in ms + * @param {boolean} [options.autoReticleSelect=true] - Auto select a clickable target after dwellTime + * @param {boolean} [options.viewIndicator=false] - Adds an angle view indicator in upper left corner + * @param {number} [options.indicatorSize=30] - Size of View Indicator + * @param {string} [options.output='none'] - Whether and where to output raycast position. Could be 'event', 'console' or 'overlay'. + * @param {boolean} [options.autoRotate=false] - Auto rotate + * @param {number} [options.autoRotateSpeed=2.0] - Auto rotate speed as in degree per second. Positive is counter-clockwise and negative is clockwise. + * @param {number} [options.autoRotateActivationDuration=5000] - Duration before auto rotatation when no user interactivity in ms + */ + function Viewer ( options ) { + + let container; + + options = options || {}; + options.controlBar = options.controlBar !== undefined ? options.controlBar : true; + options.controlButtons = options.controlButtons || [ 'fullscreen', 'setting', 'video' ]; + options.autoHideControlBar = options.autoHideControlBar !== undefined ? options.autoHideControlBar : false; + options.autoHideInfospot = options.autoHideInfospot !== undefined ? options.autoHideInfospot : true; + options.horizontalView = options.horizontalView !== undefined ? options.horizontalView : false; + options.clickTolerance = options.clickTolerance || 10; + options.cameraFov = options.cameraFov || 60; + options.reverseDragging = options.reverseDragging || false; + options.enableReticle = options.enableReticle || false; + options.dwellTime = options.dwellTime || 1500; + options.autoReticleSelect = options.autoReticleSelect !== undefined ? options.autoReticleSelect : true; + options.viewIndicator = options.viewIndicator !== undefined ? options.viewIndicator : false; + options.indicatorSize = options.indicatorSize || 30; + options.output = options.output ? options.output : 'none'; + options.autoRotate = options.autoRotate || false; + options.autoRotateSpeed = options.autoRotateSpeed || 2.0; + options.autoRotateActivationDuration = options.autoRotateActivationDuration || 5000; + + this.options = options; + + /* + * CSS Icon + * const styleLoader = new StyleLoader(); + * styleLoader.inject( 'icono' ); + */ + + // Container + if ( options.container ) { + + container = options.container; + container._width = container.clientWidth; + container._height = container.clientHeight; + + } else { + + container = document.createElement( 'div' ); + container.classList.add( 'panolens-container' ); + container.style.width = '100%'; + container.style.height = '100%'; + container._width = window.innerWidth; + container._height = window.innerHeight; + document.body.appendChild( container ); + + } + + this.container = container; + + this.camera = options.camera || new THREE.PerspectiveCamera( this.options.cameraFov, this.container.clientWidth / this.container.clientHeight, 1, 10000 ); + this.scene = options.scene || new THREE.Scene(); + this.renderer = options.renderer || new THREE.WebGLRenderer( { alpha: true, antialias: false } ); + this.sceneReticle = new THREE.Scene(); + + this.viewIndicatorSize = this.options.indicatorSize; + + this.reticle = {}; + this.tempEnableReticle = this.options.enableReticle; + + this.mode = MODES.NORMAL; + + this.panorama = null; + this.widget = null; + + this.hoverObject = null; + this.infospot = null; + this.pressEntityObject = null; + this.pressObject = null; + + this.raycaster = new THREE.Raycaster(); + this.raycasterPoint = new THREE.Vector2(); + this.userMouse = new THREE.Vector2(); + this.updateCallbacks = []; + this.requestAnimationId = null; + + this.cameraFrustum = new THREE.Frustum(); + this.cameraViewProjectionMatrix = new THREE.Matrix4(); + + this.autoRotateRequestId = null; + + this.outputDivElement = null; + + this.touchSupported = 'ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch; + + // Handler references + this.HANDLER_MOUSE_DOWN = this.onMouseDown.bind( this ); + this.HANDLER_MOUSE_UP = this.onMouseUp.bind( this ); + this.HANDLER_MOUSE_MOVE = this.onMouseMove.bind( this ); + this.HANDLER_WINDOW_RESIZE = this.onWindowResize.bind( this ); + this.HANDLER_KEY_DOWN = this.onKeyDown.bind( this ); + this.HANDLER_KEY_UP = this.onKeyUp.bind( this ); + this.HANDLER_TAP = this.onTap.bind( this, { + clientX: this.container.clientWidth / 2, + clientY: this.container.clientHeight / 2 + } ); + + // Flag for infospot output + this.OUTPUT_INFOSPOT = false; + + // Animations + this.tweenLeftAnimation = new Tween.Tween(); + this.tweenUpAnimation = new Tween.Tween(); + + // Renderer + this.renderer.setPixelRatio( window.devicePixelRatio ); + this.renderer.setSize( this.container.clientWidth, this.container.clientHeight ); + this.renderer.setClearColor( 0x000000, 0 ); + this.renderer.autoClear = false; + + // Append Renderer Element to container + this.renderer.domElement.classList.add( 'panolens-canvas' ); + this.renderer.domElement.style.display = 'block'; + this.container.style.backgroundColor = '#000'; + this.container.appendChild( this.renderer.domElement ); + + // Camera Controls + this.OrbitControls = new OrbitControls( this.camera, this.container ); + this.OrbitControls.id = 'orbit'; + this.OrbitControls.minDistance = 1; + this.OrbitControls.noPan = true; + this.OrbitControls.autoRotate = this.options.autoRotate; + this.OrbitControls.autoRotateSpeed = this.options.autoRotateSpeed; + + this.DeviceOrientationControls = new DeviceOrientationControls( this.camera, this.container ); + this.DeviceOrientationControls.id = 'device-orientation'; + this.DeviceOrientationControls.enabled = false; + this.camera.position.z = 1; + + // Register change event if passiveRenering + if ( this.options.passiveRendering ) { + + console.warn( 'passiveRendering is now deprecated' ); + + } + + // Controls + this.controls = [ this.OrbitControls, this.DeviceOrientationControls ]; + this.control = this.OrbitControls; + + // Cardboard effect + this.CardboardEffect = new CardboardEffect( this.renderer ); + this.CardboardEffect.setSize( this.container.clientWidth, this.container.clientHeight ); + + // Stereo effect + this.StereoEffect = new StereoEffect( this.renderer ); + this.StereoEffect.setSize( this.container.clientWidth, this.container.clientHeight ); + + this.effect = this.CardboardEffect; + + // Add default hidden reticle + this.addReticle(); + + // Lock horizontal view + if ( this.options.horizontalView ) { + this.OrbitControls.minPolarAngle = Math.PI / 2; + this.OrbitControls.maxPolarAngle = Math.PI / 2; + } + + // Add Control UI + if ( this.options.controlBar !== false ) { + this.addDefaultControlBar( this.options.controlButtons ); + } + + // Add View Indicator + if ( this.options.viewIndicator ) { + this.addViewIndicator(); + } + + // Reverse dragging direction + if ( this.options.reverseDragging ) { + this.reverseDraggingDirection(); + } + + // Register event if reticle is enabled, otherwise defaults to mouse + if ( this.options.enableReticle ) { + this.enableReticleControl(); + } else { + this.registerMouseAndTouchEvents(); + } + + // Output infospot position to an overlay container if specified + if ( this.options.output === 'overlay' ) { + this.addOutputElement(); + } + + // Register dom event listeners + this.registerEventListeners(); + + // Animate + this.animate.call( this ); + + } + Viewer.prototype = Object.assign( Object.create( THREE.EventDispatcher.prototype ), { + + constructor: Viewer, + + /** + * Add an object to the scene + * Automatically hookup with panolens-viewer-handler listener + * to communicate with viewer method + * @param {THREE.Object3D} object - The object to be added + * @memberOf Viewer + * @instance + */ + add: function ( object ) { + + if ( arguments.length > 1 ) { + + for ( let i = 0; i < arguments.length; i ++ ) { + + this.add( arguments[ i ] ); + + } + + return this; + + } + + this.scene.add( object ); + + // All object added to scene has 'panolens-viewer-handler' event to handle viewer communication + if ( object.addEventListener ) { + + object.addEventListener( 'panolens-viewer-handler', this.eventHandler.bind( this ) ); + + } + + // All object added to scene being passed with container + if ( object instanceof Panorama && object.dispatchEvent ) { + + object.dispatchEvent( { type: 'panolens-container', container: this.container } ); + + } + + if ( object instanceof CameraPanorama ) { + + object.dispatchEvent( { type: 'panolens-scene', scene: this.scene } ); + + } + + // Hookup default panorama event listeners + if ( object.type === 'panorama' ) { + + this.addPanoramaEventListener( object ); + + if ( !this.panorama ) { + + this.setPanorama( object ); + + } + + } + + }, + + /** + * Remove an object from the scene + * @param {THREE.Object3D} object - Object to be removed + * @memberOf Viewer + * @instance + */ + remove: function ( object ) { + + if ( object.removeEventListener ) { + + object.removeEventListener( 'panolens-viewer-handler', this.eventHandler.bind( this ) ); + + } + + this.scene.remove( object ); + + }, + + /** + * Add default control bar + * @param {array} array - The control buttons array + * @memberOf Viewer + * @instance + */ + addDefaultControlBar: function ( array ) { + + if ( this.widget ) { + + console.warn( 'Default control bar exists' ); + return; + + } + + const widget = new Widget( this.container ); + widget.addEventListener( 'panolens-viewer-handler', this.eventHandler.bind( this ) ); + widget.addControlBar(); + array.forEach( buttonName => { + + widget.addControlButton( buttonName ); + + } ); + + this.widget = widget; + + }, + + /** + * Set a panorama to be the current one + * @param {Panorama} pano - Panorama to be set + * @memberOf Viewer + * @instance + */ + setPanorama: function ( pano ) { + + const leavingPanorama = this.panorama; + + if ( pano.type === 'panorama' && leavingPanorama !== pano ) { + + // Clear exisiting infospot + this.hideInfospot(); + + const afterEnterComplete = function () { + + if ( leavingPanorama ) { leavingPanorama.onLeave(); } + pano.removeEventListener( 'enter-fade-start', afterEnterComplete ); + + }; + + pano.addEventListener( 'enter-fade-start', afterEnterComplete ); + + // Assign and enter panorama + (this.panorama = pano).onEnter(); + + } + + }, + + /** + * Event handler to execute commands from child objects + * @param {object} event - The dispatched event with method as function name and data as an argument + * @memberOf Viewer + * @instance + */ + eventHandler: function ( event ) { + + if ( event.method && this[ event.method ] ) { + + this[ event.method ]( event.data ); + + } + + }, + + /** + * Dispatch event to all descendants + * @param {object} event - Event to be passed along + * @memberOf Viewer + * @instance + */ + dispatchEventToChildren: function ( event ) { + + this.scene.traverse( function ( object ) { + + if ( object.dispatchEvent ) { + + object.dispatchEvent( event ); + + } + + }); + + }, + + /** + * Set widget content + * @method activateWidgetItem + * @param {integer} controlIndex - Control index + * @param {integer} mode - Modes for effects + * @memberOf Viewer + * @instance + */ + activateWidgetItem: function ( controlIndex, mode ) { + + const mainMenu = this.widget.mainMenu; + const ControlMenuItem = mainMenu.children[ 0 ]; + const ModeMenuItem = mainMenu.children[ 1 ]; + + let item; + + if ( controlIndex !== undefined ) { + + switch ( controlIndex ) { + + case 0: + + item = ControlMenuItem.subMenu.children[ 1 ]; + + break; + + case 1: + + item = ControlMenuItem.subMenu.children[ 2 ]; + + break; + + default: + + item = ControlMenuItem.subMenu.children[ 1 ]; + + break; + + } + + ControlMenuItem.subMenu.setActiveItem( item ); + ControlMenuItem.setSelectionTitle( item.textContent ); + + } + + if ( mode !== undefined ) { + + switch( mode ) { + + case MODES.CARDBOARD: + + item = ModeMenuItem.subMenu.children[ 2 ]; + + break; + + case MODES.STEREO: + + item = ModeMenuItem.subMenu.children[ 3 ]; + + break; + + default: + + item = ModeMenuItem.subMenu.children[ 1 ]; + + break; + } + + ModeMenuItem.subMenu.setActiveItem( item ); + ModeMenuItem.setSelectionTitle( item.textContent ); + + } + + }, + + /** + * Enable rendering effect + * @param {MODES} mode - Modes for effects + * @memberOf Viewer + * @instance + */ + enableEffect: function ( mode ) { + + if ( this.mode === mode ) { return; } + if ( mode === MODES.NORMAL ) { this.disableEffect(); return; } + else { this.mode = mode; } + + const fov = this.camera.fov; + + switch( mode ) { + + case MODES.CARDBOARD: + + this.effect = this.CardboardEffect; + this.enableReticleControl(); + + break; + + case MODES.STEREO: + + this.effect = this.StereoEffect; + this.enableReticleControl(); + + break; + + default: + + this.effect = null; + this.disableReticleControl(); + + break; + + } + + this.activateWidgetItem( undefined, this.mode ); + + /** + * Dual eye effect event + * @type {object} + * @event Infospot#panolens-dual-eye-effect + * @property {MODES} mode - Current display mode + */ + this.dispatchEventToChildren( { type: 'panolens-dual-eye-effect', mode: this.mode } ); + + // Force effect stereo camera to update by refreshing fov + this.camera.fov = fov + 10e-3; + this.effect.setSize( this.container.clientWidth, this.container.clientHeight ); + this.render(); + this.camera.fov = fov; + + /** + * Dispatch mode change event + * @type {object} + * @event Viewer#mode-change + * @property {MODES} mode - Current display mode + */ + this.dispatchEvent( { type: 'mode-change', mode: this.mode } ); + + }, + + /** + * Disable additional rendering effect + * @memberOf Viewer + * @instance + */ + disableEffect: function () { + + if ( this.mode === MODES.NORMAL ) { return; } + + this.mode = MODES.NORMAL; + this.disableReticleControl(); + + this.activateWidgetItem( undefined, this.mode ); + + /** + * Dual eye effect event + * @type {object} + * @event Infospot#panolens-dual-eye-effect + * @property {MODES} mode - Current display mode + */ + this.dispatchEventToChildren( { type: 'panolens-dual-eye-effect', mode: this.mode } ); + + this.renderer.setSize( this.container.clientWidth, this.container.clientHeight ); + this.render(); + + /** + * Dispatch mode change event + * @type {object} + * @event Viewer#mode-change + * @property {MODES} mode - Current display mode + */ + this.dispatchEvent( { type: 'mode-change', mode: this.mode } ); + }, + + /** + * Enable reticle control + * @memberOf Viewer + * @instance + */ + enableReticleControl: function () { + + if ( this.reticle.visible ) { return; } + + this.tempEnableReticle = true; + + // Register reticle event and unregister mouse event + this.unregisterMouseAndTouchEvents(); + this.reticle.show(); + this.registerReticleEvent(); + this.updateReticleEvent(); + + }, + + /** + * Disable reticle control + * @memberOf Viewer + * @instance + */ + disableReticleControl: function () { + + this.tempEnableReticle = false; + + // Register mouse event and unregister reticle event + if ( !this.options.enableReticle ) { + + this.reticle.hide(); + this.unregisterReticleEvent(); + this.registerMouseAndTouchEvents(); + + } else { + + this.updateReticleEvent(); + + } + + }, + + /** + * Enable auto rotation + * @memberOf Viewer + * @instance + */ + enableAutoRate: function () { + + this.options.autoRotate = true; + this.OrbitControls.autoRotate = true; + + }, + + /** + * Disable auto rotation + * @memberOf Viewer + * @instance + */ + disableAutoRate: function () { + + clearTimeout( this.autoRotateRequestId ); + this.options.autoRotate = false; + this.OrbitControls.autoRotate = false; + + }, + + /** + * Toggle video play or stop + * @param {boolean} pause + * @memberOf Viewer + * @instance + * @fires Viewer#video-toggle + */ + toggleVideoPlay: function ( pause ) { + + if ( this.panorama instanceof VideoPanorama ) { + + /** + * Toggle video event + * @type {object} + * @event Viewer#video-toggle + */ + this.panorama.dispatchEvent( { type: 'video-toggle', pause: pause } ); + + } + + }, + + /** + * Set currentTime in a video + * @param {number} percentage - Percentage of a video. Range from 0.0 to 1.0 + * @memberOf Viewer + * @instance + * @fires Viewer#video-time + */ + setVideoCurrentTime: function ( percentage ) { + + if ( this.panorama instanceof VideoPanorama ) { + + /** + * Setting video time event + * @type {object} + * @event Viewer#video-time + * @property {number} percentage - Percentage of a video. Range from 0.0 to 1.0 + */ + this.panorama.dispatchEvent( { type: 'video-time', percentage: percentage } ); + + } + + }, + + /** + * This will be called when video updates if an widget is present + * @param {number} percentage - Percentage of a video. Range from 0.0 to 1.0 + * @memberOf Viewer + * @instance + * @fires Viewer#video-update + */ + onVideoUpdate: function ( percentage ) { + + const { widget } = this; + + /** + * Video update event + * @type {object} + * @event Viewer#video-update + * @property {number} percentage - Percentage of a video. Range from 0.0 to 1.0 + */ + if( widget ) { widget.dispatchEvent( { type: 'video-update', percentage: percentage } ); } + + }, + + /** + * Add update callback to be called every animation frame + * @param {function} callback + * @memberOf Viewer + * @instance + */ + addUpdateCallback: function ( fn ) { + + if ( fn ) { + + this.updateCallbacks.push( fn ); + + } + + }, + + /** + * Remove update callback + * @param {function} fn - The function to be removed + * @memberOf Viewer + * @instance + */ + removeUpdateCallback: function ( fn ) { + + const index = this.updateCallbacks.indexOf( fn ); + + if ( fn && index >= 0 ) { + + this.updateCallbacks.splice( index, 1 ); + + } + + }, + + /** + * Show video widget + * @memberOf Viewer + * @instance + */ + showVideoWidget: function () { + + const { widget } = this; + + /** + * Show video widget event + * @type {object} + * @event Viewer#video-control-show + */ + if( widget ) { widget.dispatchEvent( { type: 'video-control-show' } ); } + + }, + + /** + * Hide video widget + * @memberOf Viewer + * @instance + */ + hideVideoWidget: function () { + + const { widget } = this; + + /** + * Hide video widget + * @type {object} + * @event Viewer#video-control-hide + */ + if( widget ) { widget.dispatchEvent( { type: 'video-control-hide' } ); } + + }, + + /** + * Update video play button + * @param {boolean} paused + * @memberOf Viewer + * @instance + */ + updateVideoPlayButton: function ( paused ) { + + const { widget } = this; + + if ( widget && widget.videoElement && widget.videoElement.controlButton ) { + + widget.videoElement.controlButton.update( paused ); + + } + + }, + + /** + * Add default panorama event listeners + * @param {Panorama} pano - The panorama to be added with event listener + * @memberOf Viewer + * @instance + */ + addPanoramaEventListener: function ( pano ) { + + // Set camera control on every panorama + pano.addEventListener( 'enter-fade-start', this.setCameraControl.bind( this ) ); + + // Show and hide widget event only when it's VideoPanorama + if ( pano instanceof VideoPanorama ) { + + pano.addEventListener( 'enter-fade-start', this.showVideoWidget.bind( this ) ); + pano.addEventListener( 'leave', function () { + + if ( !(this.panorama instanceof VideoPanorama) ) { + + this.hideVideoWidget.call( this ); + + } + + }.bind( this ) ); + + } + + }, + + /** + * Set camera control + * @memberOf Viewer + * @instance + */ + setCameraControl: function () { + + this.OrbitControls.target.copy( this.panorama.position ); + + }, + + /** + * Get current camera control + * @return {object} - Current navigation control + * @memberOf Viewer + * @instance + * @returns {THREE.OrbitControls|THREE.DeviceOrientationControls} + */ + getControl: function () { + + return this.control; + + }, + + /** + * Get scene + * @memberOf Viewer + * @instance + * @return {THREE.Scene} - Current scene which the viewer is built on + */ + getScene: function () { + + return this.scene; + + }, + + /** + * Get camera + * @memberOf Viewer + * @instance + * @return {THREE.Camera} - The scene camera + */ + getCamera: function () { + + return this.camera; + + }, + + /** + * Get renderer + * @memberOf Viewer + * @instance + * @return {THREE.WebGLRenderer} - The renderer using webgl + */ + getRenderer: function () { + + return this.renderer; + + }, + + /** + * Get container + * @memberOf Viewer + * @instance + * @return {HTMLElement} - The container holds rendererd canvas + */ + getContainer: function () { + + return this.container; + + }, + + /** + * Get control id + * @memberOf Viewer + * @instance + * @return {string} - Control id. 'orbit' or 'device-orientation' + */ + getControlId: function () { + + return this.control.id; + + }, + + /** + * Get next navigation control id + * @memberOf Viewer + * @instance + * @return {string} - Next control id + */ + getNextControlId: function () { + + return this.controls[ this.getNextControlIndex() ].id; + + }, + + /** + * Get next navigation control index + * @memberOf Viewer + * @instance + * @return {number} - Next control index + */ + getNextControlIndex: function () { + + const controls = this.controls; + const control = this.control; + const nextIndex = controls.indexOf( control ) + 1; + + return ( nextIndex >= controls.length ) ? 0 : nextIndex; + + }, + + /** + * Set field of view of camera + * @param {number} fov + * @memberOf Viewer + * @instance + */ + setCameraFov: function ( fov ) { + + this.camera.fov = fov; + this.camera.updateProjectionMatrix(); + + }, + + /** + * Enable control by index + * @param {CONTROLS} index - Index of camera control + * @memberOf Viewer + * @instance + */ + enableControl: function ( index ) { + + index = ( index >= 0 && index < this.controls.length ) ? index : 0; + + this.control.enabled = false; + + this.control = this.controls[ index ]; + + this.control.enabled = true; + + switch ( index ) { + + case CONTROLS.ORBIT: + + this.camera.position.copy( this.panorama.position ); + this.camera.position.z += 1; + + break; + + case CONTROLS.DEVICEORIENTATION: + + this.camera.position.copy( this.panorama.position ); + + break; + + default: + + break; + } + + this.control.update(); + + this.activateWidgetItem( index, undefined ); + + }, + + /** + * Disable current control + * @memberOf Viewer + * @instance + */ + disableControl: function () { + + this.control.enabled = false; + + }, + + /** + * Toggle next control + * @memberOf Viewer + * @instance + */ + toggleNextControl: function () { + + this.enableControl( this.getNextControlIndex() ); + + }, + + /** + * Screen Space Projection + * @memberOf Viewer + * @instance + */ + getScreenVector: function ( worldVector ) { + + const vector = worldVector.clone(); + const widthHalf = ( this.container.clientWidth ) / 2; + const heightHalf = this.container.clientHeight / 2; + + vector.project( this.camera ); + + vector.x = ( vector.x * widthHalf ) + widthHalf; + vector.y = - ( vector.y * heightHalf ) + heightHalf; + vector.z = 0; + + return vector; + + }, + + /** + * Check Sprite in Viewport + * @memberOf Viewer + * @instance + */ + checkSpriteInViewport: function ( sprite ) { + + this.camera.matrixWorldInverse.getInverse( this.camera.matrixWorld ); + this.cameraViewProjectionMatrix.multiplyMatrices( this.camera.projectionMatrix, this.camera.matrixWorldInverse ); + this.cameraFrustum.setFromMatrix( this.cameraViewProjectionMatrix ); + + return sprite.visible && this.cameraFrustum.intersectsSprite( sprite ); + + }, + + /** + * Reverse dragging direction + * @memberOf Viewer + * @instance + */ + reverseDraggingDirection: function () { + + this.OrbitControls.rotateSpeed *= -1; + this.OrbitControls.momentumScalingFactor *= -1; + + }, + + /** + * Add reticle + * @memberOf Viewer + * @instance + */ + addReticle: function () { + + this.reticle = new Reticle( 0xffffff, true, this.options.dwellTime ); + this.reticle.hide(); + this.camera.add( this.reticle ); + this.sceneReticle.add( this.camera ); + + }, + + /** + * Tween control looking center + * @param {THREE.Vector3} vector - Vector to be looked at the center + * @param {number} [duration=1000] - Duration to tween + * @param {function} [easing=TWEEN.Easing.Exponential.Out] - Easing function + * @memberOf Viewer + * @instance + */ + tweenControlCenter: function ( vector, duration, easing ) { + + if ( this.control !== this.OrbitControls ) { + + return; + + } + + // Pass in arguments as array + if ( vector instanceof Array ) { + + duration = vector[ 1 ]; + easing = vector[ 2 ]; + vector = vector[ 0 ]; + + } + + duration = duration !== undefined ? duration : 1000; + easing = easing || Tween.Easing.Exponential.Out; + + let scope, ha, va, chv, cvv, hv, vv, vptc, ov, nv; + + scope = this; + + chv = this.camera.getWorldDirection( new THREE.Vector3() ); + cvv = chv.clone(); + + vptc = this.panorama.getWorldPosition( new THREE.Vector3() ).sub( this.camera.getWorldPosition( new THREE.Vector3() ) ); + + hv = vector.clone(); + // Scale effect + hv.x *= -1; + hv.add( vptc ).normalize(); + vv = hv.clone(); + + chv.y = 0; + hv.y = 0; + + ha = Math.atan2( hv.z, hv.x ) - Math.atan2( chv.z, chv.x ); + ha = ha > Math.PI ? ha - 2 * Math.PI : ha; + ha = ha < -Math.PI ? ha + 2 * Math.PI : ha; + va = Math.abs( cvv.angleTo( chv ) + ( cvv.y * vv.y <= 0 ? vv.angleTo( hv ) : -vv.angleTo( hv ) ) ); + va *= vv.y < cvv.y ? 1 : -1; + + ov = { left: 0, up: 0 }; + nv = { left: 0, up: 0 }; + + this.tweenLeftAnimation.stop(); + this.tweenUpAnimation.stop(); + + this.tweenLeftAnimation = new Tween.Tween( ov ) + .to( { left: ha }, duration ) + .easing( easing ) + .onUpdate(function(ov){ + scope.control.rotateLeft( ov.left - nv.left ); + nv.left = ov.left; + }) + .start(); + + this.tweenUpAnimation = new Tween.Tween( ov ) + .to( { up: va }, duration ) + .easing( easing ) + .onUpdate(function(ov){ + scope.control.rotateUp( ov.up - nv.up ); + nv.up = ov.up; + }) + .start(); + + }, + + /** + * Tween control looking center by object + * @param {THREE.Object3D} object - Object to be looked at the center + * @param {number} [duration=1000] - Duration to tween + * @param {function} [easing=TWEEN.Easing.Exponential.Out] - Easing function + * @memberOf Viewer + * @instance + */ + tweenControlCenterByObject: function ( object, duration, easing ) { + + let isUnderScalePlaceHolder = false; + + object.traverseAncestors( function ( ancestor ) { + + if ( ancestor.scalePlaceHolder ) { + + isUnderScalePlaceHolder = true; + + } + } ); + + if ( isUnderScalePlaceHolder ) { + + const invertXVector = new THREE.Vector3( -1, 1, 1 ); + + this.tweenControlCenter( object.getWorldPosition( new THREE.Vector3() ).multiply( invertXVector ), duration, easing ); + + } else { + + this.tweenControlCenter( object.getWorldPosition( new THREE.Vector3() ), duration, easing ); + + } + + }, + + /** + * This is called when window size is changed + * @fires Viewer#window-resize + * @param {number} [windowWidth] - Specify if custom element has changed width + * @param {number} [windowHeight] - Specify if custom element has changed height + * @memberOf Viewer + * @instance + */ + onWindowResize: function ( windowWidth, windowHeight ) { + + let width, height; + + const expand = this.container.classList.contains( 'panolens-container' ) || this.container.isFullscreen; + + if ( windowWidth !== undefined && windowHeight !== undefined ) { + + width = windowWidth; + height = windowHeight; + this.container._width = windowWidth; + this.container._height = windowHeight; + + } else { + + const isAndroid = /(android)/i.test(window.navigator.userAgent); + + const adjustWidth = isAndroid + ? Math.min(document.documentElement.clientWidth, window.innerWidth || 0) + : Math.max(document.documentElement.clientWidth, window.innerWidth || 0); + + const adjustHeight = isAndroid + ? Math.min(document.documentElement.clientHeight, window.innerHeight || 0) + : Math.max(document.documentElement.clientHeight, window.innerHeight || 0); + + width = expand ? adjustWidth : this.container.clientWidth; + height = expand ? adjustHeight : this.container.clientHeight; + + this.container._width = width; + this.container._height = height; + + } + + this.camera.aspect = width / height; + this.camera.updateProjectionMatrix(); + + this.renderer.setSize( width, height ); + + // Update reticle + if ( this.options.enableReticle || this.tempEnableReticle ) { + + this.updateReticleEvent(); + + } + + /** + * Window resizing event + * @type {object} + * @event Viewer#window-resize + * @property {number} width - Width of the window + * @property {number} height - Height of the window + */ + this.dispatchEvent( { type: 'window-resize', width: width, height: height }); + this.scene.traverse( function ( object ) { + + if ( object.dispatchEvent ) { + + object.dispatchEvent( { type: 'window-resize', width: width, height: height }); + + } + + } ); + + }, + + /** + * Add output element + * @memberOf Viewer + * @instance + */ + addOutputElement: function () { + + const element = document.createElement( 'div' ); + element.style.position = 'absolute'; + element.style.right = '10px'; + element.style.top = '10px'; + element.style.color = '#fff'; + this.container.appendChild( element ); + this.outputDivElement = element; + + }, + + /** + * Output position in developer console by holding down Ctrl button + * @memberOf Viewer + * @instance + */ + outputPosition: function () { + + const intersects = this.raycaster.intersectObject( this.panorama, true ); + + if ( intersects.length > 0 ) { + + const point = intersects[ 0 ].point.clone(); + const converter = new THREE.Vector3( -1, 1, 1 ); + const world = this.panorama.getWorldPosition( new THREE.Vector3() ); + point.sub( world ).multiply( converter ); + + const position = { + x: point.x.toFixed(2), + y: point.y.toFixed(2), + z: point.z.toFixed(2), + }; + + const message = `${position.x}, ${position.y}, ${position.z}`; + + if ( point.length() === 0 ) { return; } + + switch ( this.options.output ) { + + case 'event': + /** + * Dispatch raycast position as event + * @type {object} + * @event Viewer#position-output + */ + this.dispatchEvent( { type: 'position-output', position: position } ); + break; + + case 'console': + console.info( message ); + break; + + case 'overlay': + this.outputDivElement.textContent = message; + break; + + default: + break; + + } + + } + + }, + + /** + * On mouse down + * @param {MouseEvent} event + * @memberOf Viewer + * @instance + */ + onMouseDown: function ( event ) { + + event.preventDefault(); + + this.userMouse.x = ( event.clientX >= 0 ) ? event.clientX : event.touches[0].clientX; + this.userMouse.y = ( event.clientY >= 0 ) ? event.clientY : event.touches[0].clientY; + this.userMouse.type = 'mousedown'; + this.onTap( event ); + + }, + + /** + * On mouse move + * @param {MouseEvent} event + * @memberOf Viewer + * @instance + */ + onMouseMove: function ( event ) { + + event.preventDefault(); + this.userMouse.type = 'mousemove'; + this.onTap( event ); + + }, + + /** + * On mouse up + * @param {MouseEvent} event + * @memberOf Viewer + * @instance + */ + onMouseUp: function ( event ) { + + let onTarget = false; + + this.userMouse.type = 'mouseup'; + + const type = ( this.userMouse.x >= event.clientX - this.options.clickTolerance + && this.userMouse.x <= event.clientX + this.options.clickTolerance + && this.userMouse.y >= event.clientY - this.options.clickTolerance + && this.userMouse.y <= event.clientY + this.options.clickTolerance ) + || ( event.changedTouches + && this.userMouse.x >= event.changedTouches[0].clientX - this.options.clickTolerance + && this.userMouse.x <= event.changedTouches[0].clientX + this.options.clickTolerance + && this.userMouse.y >= event.changedTouches[0].clientY - this.options.clickTolerance + && this.userMouse.y <= event.changedTouches[0].clientY + this.options.clickTolerance ) + ? 'click' : undefined; + + // Event should happen on canvas + if ( event && event.target && !event.target.classList.contains( 'panolens-canvas' ) ) { return; } + + event.preventDefault(); + + if ( event.changedTouches && event.changedTouches.length === 1 ) { + + onTarget = this.onTap( { clientX: event.changedTouches[0].clientX, clientY: event.changedTouches[0].clientY }, type ); + + } else { + + onTarget = this.onTap( event, type ); + + } + + this.userMouse.type = 'none'; + + if ( onTarget ) { + + return; + + } + + if ( type === 'click' ) { + + const { options: { autoHideInfospot, autoHideControlBar }, panorama, toggleControlBar } = this; + + if ( autoHideInfospot && panorama ) { + + panorama.toggleInfospotVisibility(); + + } + + if ( autoHideControlBar ) { + + toggleControlBar(); + + } + + } + + }, + + /** + * On tap eveny frame + * @param {MouseEvent} event + * @param {string} type + * @memberOf Viewer + * @instance + */ + onTap: function ( event, type ) { + + const { left, top } = this.container.getBoundingClientRect(); + const { clientWidth, clientHeight } = this.container; + + this.raycasterPoint.x = ( ( event.clientX - left ) / clientWidth ) * 2 - 1; + this.raycasterPoint.y = - ( ( event.clientY - top ) / clientHeight ) * 2 + 1; + + this.raycaster.setFromCamera( this.raycasterPoint, this.camera ); + + // Return if no panorama + if ( !this.panorama ) { + + return; + + } + + // output infospot information + if ( event.type !== 'mousedown' && this.touchSupported || this.OUTPUT_INFOSPOT ) { + + this.outputPosition(); + + } + + + const intersects = this.raycaster.intersectObjects( this.panorama.children, true ); + const intersect_entity = this.getConvertedIntersect( intersects ); + const intersect = ( intersects.length > 0 ) ? intersects[0].object : undefined; + + if ( this.userMouse.type === 'mouseup' ) { + + if ( intersect_entity && this.pressEntityObject === intersect_entity && this.pressEntityObject.dispatchEvent ) { + + this.pressEntityObject.dispatchEvent( { type: 'pressstop-entity', mouseEvent: event } ); + + } + + this.pressEntityObject = undefined; + + } + + if ( this.userMouse.type === 'mouseup' ) { + + if ( intersect && this.pressObject === intersect && this.pressObject.dispatchEvent ) { + + this.pressObject.dispatchEvent( { type: 'pressstop', mouseEvent: event } ); + + } + + this.pressObject = undefined; + + } + + if ( type === 'click' ) { + + this.panorama.dispatchEvent( { type: 'click', intersects: intersects, mouseEvent: event } ); + + if ( intersect_entity && intersect_entity.dispatchEvent ) { + + intersect_entity.dispatchEvent( { type: 'click-entity', mouseEvent: event } ); + + } + + if ( intersect && intersect.dispatchEvent ) { + + intersect.dispatchEvent( { type: 'click', mouseEvent: event } ); + + } + + } else { + + this.panorama.dispatchEvent( { type: 'hover', intersects: intersects, mouseEvent: event } ); + + if ( ( this.hoverObject && intersects.length > 0 && this.hoverObject !== intersect_entity ) + || ( this.hoverObject && intersects.length === 0 ) ){ + + if ( this.hoverObject.dispatchEvent ) { + + this.hoverObject.dispatchEvent( { type: 'hoverleave', mouseEvent: event } ); + + this.reticle.end(); + + } + + this.hoverObject = undefined; + + } + + if ( intersect_entity && intersects.length > 0 ) { + + if ( this.hoverObject !== intersect_entity ) { + + this.hoverObject = intersect_entity; + + if ( this.hoverObject.dispatchEvent ) { + + this.hoverObject.dispatchEvent( { type: 'hoverenter', mouseEvent: event } ); + + // Start reticle timer + if ( this.options.autoReticleSelect && this.options.enableReticle || this.tempEnableReticle ) { + this.reticle.start( this.onTap.bind( this, event, 'click' ) ); + } + + } + + } + + if ( this.userMouse.type === 'mousedown' && this.pressEntityObject != intersect_entity ) { + + this.pressEntityObject = intersect_entity; + + if ( this.pressEntityObject.dispatchEvent ) { + + this.pressEntityObject.dispatchEvent( { type: 'pressstart-entity', mouseEvent: event } ); + + } + + } + + if ( this.userMouse.type === 'mousedown' && this.pressObject != intersect ) { + + this.pressObject = intersect; + + if ( this.pressObject.dispatchEvent ) { + + this.pressObject.dispatchEvent( { type: 'pressstart', mouseEvent: event } ); + + } + + } + + if ( this.userMouse.type === 'mousemove' || this.options.enableReticle ) { + + if ( intersect && intersect.dispatchEvent ) { + + intersect.dispatchEvent( { type: 'hover', mouseEvent: event } ); + + } + + if ( this.pressEntityObject && this.pressEntityObject.dispatchEvent ) { + + this.pressEntityObject.dispatchEvent( { type: 'pressmove-entity', mouseEvent: event } ); + + } + + if ( this.pressObject && this.pressObject.dispatchEvent ) { + + this.pressObject.dispatchEvent( { type: 'pressmove', mouseEvent: event } ); + + } + + } + + } + + if ( !intersect_entity && this.pressEntityObject && this.pressEntityObject.dispatchEvent ) { + + this.pressEntityObject.dispatchEvent( { type: 'pressstop-entity', mouseEvent: event } ); + + this.pressEntityObject = undefined; + + } + + if ( !intersect && this.pressObject && this.pressObject.dispatchEvent ) { + + this.pressObject.dispatchEvent( { type: 'pressstop', mouseEvent: event } ); + + this.pressObject = undefined; + + } + + } + + // Infospot handler + if ( intersect && intersect instanceof Infospot ) { + + this.infospot = intersect; + + if ( type === 'click' ) { + + return true; + + } + + + } else if ( this.infospot ) { + + this.hideInfospot(); + + } + + // Auto rotate + if ( this.options.autoRotate && this.userMouse.type !== 'mousemove' ) { + + // Auto-rotate idle timer + clearTimeout( this.autoRotateRequestId ); + + if ( this.control === this.OrbitControls ) { + + this.OrbitControls.autoRotate = false; + this.autoRotateRequestId = window.setTimeout( this.enableAutoRate.bind( this ), this.options.autoRotateActivationDuration ); + + } + + } + + }, + + /** + * Get converted intersect + * @param {array} intersects + * @memberOf Viewer + * @instance + */ + getConvertedIntersect: function ( intersects ) { + + let intersect; + + for ( let i = 0; i < intersects.length; i++ ) { + + if ( intersects[i].distance >= 0 && intersects[i].object && !intersects[i].object.passThrough ) { + + if ( intersects[i].object.entity && intersects[i].object.entity.passThrough ) { + continue; + } else if ( intersects[i].object.entity && !intersects[i].object.entity.passThrough ) { + intersect = intersects[i].object.entity; + break; + } else { + intersect = intersects[i].object; + break; + } + + } + + } + + return intersect; + + }, + + /** + * Hide infospot + * @memberOf Viewer + * @instance + */ + hideInfospot: function () { + + if ( this.infospot ) { + + this.infospot.onHoverEnd(); + + this.infospot = undefined; + + } + + }, + + /** + * Toggle control bar + * @memberOf Viewer + * @instance + * @fires Viewer#control-bar-toggle + */ + toggleControlBar: function () { + + const { widget } = this; + + /** + * Toggle control bar event + * @type {object} + * @event Viewer#control-bar-toggle + */ + if ( widget ) { + + widget.dispatchEvent( { type: 'control-bar-toggle' } ); + + } + + }, + + /** + * On key down + * @param {KeyboardEvent} event + * @memberOf Viewer + * @instance + */ + onKeyDown: function ( event ) { + + if ( this.options.output && this.options.output !== 'none' && event.key === 'Control' ) { + + this.OUTPUT_INFOSPOT = true; + + } + + }, + + /** + * On key up + * @param {KeyboardEvent} event + * @memberOf Viewer + * @instance + */ + onKeyUp: function () { + + this.OUTPUT_INFOSPOT = false; + + }, + + /** + * Update control and callbacks + * @memberOf Viewer + * @instance + */ + update: function () { + + Tween.update(); + + this.updateCallbacks.forEach( function( callback ){ callback(); } ); + + this.control.update(); + + this.scene.traverse( function( child ){ + if ( child instanceof Infospot + && child.element + && ( this.hoverObject === child + || child.element.style.display !== 'none' + || (child.element.left && child.element.left.style.display !== 'none') + || (child.element.right && child.element.right.style.display !== 'none') ) ) { + if ( this.checkSpriteInViewport( child ) ) { + const { x, y } = this.getScreenVector( child.getWorldPosition( new THREE.Vector3() ) ); + child.translateElement( x, y ); + } else { + child.onDismiss(); + } + + } + }.bind( this ) ); + + }, + + /** + * Rendering function to be called on every animation frame + * Render reticle last + * @memberOf Viewer + * @instance + */ + render: function () { + + if ( this.mode === MODES.CARDBOARD || this.mode === MODES.STEREO ) { + + this.renderer.clear(); + this.effect.render( this.scene, this.camera ); + this.effect.render( this.sceneReticle, this.camera ); + + + } else { + + this.renderer.clear(); + this.renderer.render( this.scene, this.camera ); + this.renderer.clearDepth(); + this.renderer.render( this.sceneReticle, this.camera ); + + } + + }, + + /** + * Animate + * @memberOf Viewer + * @instance + */ + animate: function () { + + this.requestAnimationId = window.requestAnimationFrame( this.animate.bind( this ) ); + + this.onChange(); + + }, + + /** + * On change + * @memberOf Viewer + * @instance + */ + onChange: function () { + + this.update(); + this.render(); + + }, + + /** + * Register mouse and touch event on container + * @memberOf Viewer + * @instance + */ + registerMouseAndTouchEvents: function () { + + const options = { passive: false }; + + this.container.addEventListener( 'mousedown' , this.HANDLER_MOUSE_DOWN, options ); + this.container.addEventListener( 'mousemove' , this.HANDLER_MOUSE_MOVE, options ); + this.container.addEventListener( 'mouseup' , this.HANDLER_MOUSE_UP , options ); + this.container.addEventListener( 'touchstart', this.HANDLER_MOUSE_DOWN, options ); + this.container.addEventListener( 'touchend' , this.HANDLER_MOUSE_UP , options ); + + }, + + /** + * Unregister mouse and touch event on container + * @memberOf Viewer + * @instance + */ + unregisterMouseAndTouchEvents: function () { + + this.container.removeEventListener( 'mousedown' , this.HANDLER_MOUSE_DOWN, false ); + this.container.removeEventListener( 'mousemove' , this.HANDLER_MOUSE_MOVE, false ); + this.container.removeEventListener( 'mouseup' , this.HANDLER_MOUSE_UP , false ); + this.container.removeEventListener( 'touchstart', this.HANDLER_MOUSE_DOWN, false ); + this.container.removeEventListener( 'touchend' , this.HANDLER_MOUSE_UP , false ); + + }, + + /** + * Register reticle event + * @memberOf Viewer + * @instance + */ + registerReticleEvent: function () { + + this.addUpdateCallback( this.HANDLER_TAP ); + + }, + + /** + * Unregister reticle event + * @memberOf Viewer + * @instance + */ + unregisterReticleEvent: function () { + + this.removeUpdateCallback( this.HANDLER_TAP ); + + }, + + /** + * Update reticle event + * @memberOf Viewer + * @instance + */ + updateReticleEvent: function () { + + const clientX = this.container.clientWidth / 2 + this.container.offsetLeft; + const clientY = this.container.clientHeight / 2; + + this.removeUpdateCallback( this.HANDLER_TAP ); + this.HANDLER_TAP = this.onTap.bind( this, { clientX, clientY } ); + this.addUpdateCallback( this.HANDLER_TAP ); + + }, + + /** + * Register container and window listeners + * @memberOf Viewer + * @instance + */ + registerEventListeners: function () { + + // Resize Event + window.addEventListener( 'resize' , this.HANDLER_WINDOW_RESIZE, true ); + + // Keyboard Event + window.addEventListener( 'keydown', this.HANDLER_KEY_DOWN, true ); + window.addEventListener( 'keyup' , this.HANDLER_KEY_UP , true ); + + }, + + /** + * Unregister container and window listeners + * @memberOf Viewer + * @instance + */ + unregisterEventListeners: function () { + + // Resize Event + window.removeEventListener( 'resize' , this.HANDLER_WINDOW_RESIZE, true ); + + // Keyboard Event + window.removeEventListener( 'keydown', this.HANDLER_KEY_DOWN, true ); + window.removeEventListener( 'keyup' , this.HANDLER_KEY_UP , true ); + + }, + + /** + * Dispose all scene objects and clear cache + * @memberOf Viewer + * @instance + */ + dispose: function () { + + this.tweenLeftAnimation.stop(); + this.tweenUpAnimation.stop(); + + // Unregister dom event listeners + this.unregisterEventListeners(); + + // recursive disposal on 3d objects + function recursiveDispose ( object ) { + + for ( let i = object.children.length - 1; i >= 0; i-- ) { + + recursiveDispose( object.children[i] ); + object.remove( object.children[i] ); + + } + + if ( object instanceof Panorama || object instanceof Infospot ) { + + object.dispose(); + object = null; + + } else if ( object.dispatchEvent ){ + + object.dispatchEvent( 'dispose' ); + + } + + } + + recursiveDispose( this.scene ); + + // dispose widget + if ( this.widget ) { + + this.widget.dispose(); + this.widget = null; + + } + + // clear cache + if ( THREE.Cache && THREE.Cache.enabled ) { + + THREE.Cache.clear(); + + } + + }, + + /** + * Destroy viewer by disposing and stopping requestAnimationFrame + * @memberOf Viewer + * @instance + */ + destroy: function () { + + this.dispose(); + this.render(); + window.cancelAnimationFrame( this.requestAnimationId ); + + }, + + /** + * On panorama dispose + * @memberOf Viewer + * @instance + */ + onPanoramaDispose: function ( panorama ) { + + if ( panorama instanceof VideoPanorama ) { + + this.hideVideoWidget(); + + } + + if ( panorama === this.panorama ) { + + this.panorama = null; + + } + + }, + + /** + * Load ajax call + * @param {string} url - URL to be requested + * @param {function} [callback] - Callback after request completes + * @memberOf Viewer + * @instance + */ + loadAsyncRequest: function ( url, callback = () => {} ) { + + const request = new window.XMLHttpRequest(); + request.onloadend = function ( event ) { + callback( event ); + }; + request.open( 'GET', url, true ); + request.send( null ); + + }, + + /** + * View indicator in upper left + * @memberOf Viewer + * @instance + */ + addViewIndicator: function () { + + const scope = this; + + function loadViewIndicator ( asyncEvent ) { + + if ( asyncEvent.loaded === 0 ) return; + + const viewIndicatorDiv = asyncEvent.target.responseXML.documentElement; + viewIndicatorDiv.style.width = scope.viewIndicatorSize + 'px'; + viewIndicatorDiv.style.height = scope.viewIndicatorSize + 'px'; + viewIndicatorDiv.style.position = 'absolute'; + viewIndicatorDiv.style.top = '10px'; + viewIndicatorDiv.style.left = '10px'; + viewIndicatorDiv.style.opacity = '0.5'; + viewIndicatorDiv.style.cursor = 'pointer'; + viewIndicatorDiv.id = 'panolens-view-indicator-container'; + + scope.container.appendChild( viewIndicatorDiv ); + + const indicator = viewIndicatorDiv.querySelector( '#indicator' ); + const setIndicatorD = function () { + + scope.radius = scope.viewIndicatorSize * 0.225; + scope.currentPanoAngle = scope.camera.rotation.y - THREE.Math.degToRad( 90 ); + scope.fovAngle = THREE.Math.degToRad( scope.camera.fov ) ; + scope.leftAngle = -scope.currentPanoAngle - scope.fovAngle / 2; + scope.rightAngle = -scope.currentPanoAngle + scope.fovAngle / 2; + scope.leftX = scope.radius * Math.cos( scope.leftAngle ); + scope.leftY = scope.radius * Math.sin( scope.leftAngle ); + scope.rightX = scope.radius * Math.cos( scope.rightAngle ); + scope.rightY = scope.radius * Math.sin( scope.rightAngle ); + scope.indicatorD = 'M ' + scope.leftX + ' ' + scope.leftY + ' A ' + scope.radius + ' ' + scope.radius + ' 0 0 1 ' + scope.rightX + ' ' + scope.rightY; + + if ( scope.leftX && scope.leftY && scope.rightX && scope.rightY && scope.radius ) { + + indicator.setAttribute( 'd', scope.indicatorD ); + + } + + }; + + scope.addUpdateCallback( setIndicatorD ); + + const indicatorOnMouseEnter = function () { + + this.style.opacity = '1'; + + }; + + const indicatorOnMouseLeave = function () { + + this.style.opacity = '0.5'; + + }; + + viewIndicatorDiv.addEventListener( 'mouseenter', indicatorOnMouseEnter ); + viewIndicatorDiv.addEventListener( 'mouseleave', indicatorOnMouseLeave ); + } + + this.loadAsyncRequest( DataImage.ViewIndicator, loadViewIndicator ); + + }, + + /** + * Append custom control item to existing control bar + * @param {object} [option={}] - Style object to overwirte default element style. It takes 'style', 'onTap' and 'group' properties. + * @memberOf Viewer + * @instance + */ + appendControlItem: function ( option ) { + + const item = this.widget.createCustomItem( option ); + + if ( option.group === 'video' ) { + + this.widget.videoElement.appendChild( item ); + + } else { + + this.widget.barElement.appendChild( item ); + + } + + return item; + + }, + + /** + * Clear all cached files + * @memberOf Viewer + * @instance + */ + clearAllCache: function () { + + THREE.Cache.clear(); + + } + + } ); + + if ( THREE.REVISION != THREE_REVISION ) { + + console.warn( `three.js version is not matched. Please consider use the target revision ${THREE_REVISION}` ); + + } + + /** + * Panolens.js + * @author pchen66 + * @namespace PANOLENS + */ + window.TWEEN = Tween; + + exports.BasicPanorama = BasicPanorama; + exports.CONTROLS = CONTROLS; + exports.CameraPanorama = CameraPanorama; + exports.CubePanorama = CubePanorama; + exports.CubeTextureLoader = CubeTextureLoader; + exports.DataImage = DataImage; + exports.EmptyPanorama = EmptyPanorama; + exports.GoogleStreetviewPanorama = GoogleStreetviewPanorama; + exports.ImageLittlePlanet = ImageLittlePlanet; + exports.ImageLoader = ImageLoader; + exports.ImagePanorama = ImagePanorama; + exports.Infospot = Infospot; + exports.LittlePlanet = LittlePlanet; + exports.MODES = MODES; + exports.Media = Media; + exports.Panorama = Panorama; + exports.REVISION = REVISION; + exports.Reticle = Reticle; + exports.THREE_REVISION = THREE_REVISION; + exports.THREE_VERSION = THREE_VERSION; + exports.TextureLoader = TextureLoader; + exports.VERSION = VERSION; + exports.VideoPanorama = VideoPanorama; + exports.Viewer = Viewer; + exports.Widget = Widget; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/lib/javascript/panolens/panolens.js-master.zip b/lib/javascript/panolens/panolens.js-master.zip new file mode 100644 index 0000000..c1bf4a7 Binary files /dev/null and b/lib/javascript/panolens/panolens.js-master.zip differ diff --git a/lib/javascript/panolens/panolens.min.js b/lib/javascript/panolens/panolens.min.js new file mode 100644 index 0000000..078ef53 --- /dev/null +++ b/lib/javascript/panolens/panolens.min.js @@ -0,0 +1,202 @@ +(function(h,e){"object"===typeof exports&&"undefined"!==typeof module?e(exports,require("three")):"function"===typeof define&&define.amd?define(["exports","three"],e):(h=h||self,e(h.PANOLENS={},h.THREE))})(this,function(h,e){function S(a){this.constraints=Object.assign({video:{width:{ideal:1920},height:{ideal:1080},facingMode:{exact:"environment"}},audio:!1},a);this.element=this.scene=this.container=null;this.devices=[];this.stream=null;this.ratioScalar=1;this.videoDeviceIndex=0}function M(a,b,c){a= +void 0===a?16777215:a;b=void 0===b?!0:b;c=void 0===c?1500:c;this.dpr=window.devicePixelRatio;var d=this.createCanvas(),g=d.canvas;d=d.context;var k=new e.SpriteMaterial({color:a,map:this.createCanvasTexture(g)});e.Sprite.call(this,k);this.canvasWidth=g.width;this.canvasHeight=g.height;this.context=d;this.color=a instanceof e.Color?a:new e.Color(a);this.autoSelect=b;this.dwellTime=c;this.rippleDuration=500;this.position.z=-10;this.center.set(.5,.5);this.scale.set(.5,.5,1);this.callback=this.timerId= +this.startTimestamp=null;this.frustumCulled=!1;this.updateCanvasArcByProgress(0)}function z(a,b,c){a=void 0===a?300:a;b=b||u.Info;e.Sprite.call(this);this.type="infospot";this.animated=void 0!==c?c:!0;this.frustumCulled=this.isHovering=!1;this.cursorStyle=this.toPanorama=this.element=null;this.mode=t.NORMAL;this.scale.set(a,a,1);this.rotation.y=Math.PI;this.container=null;this.originalRaycast=this.raycast;this.HANDLER_FOCUS=null;this.material.side=e.DoubleSide;this.material.depthTest=!1;this.material.transparent= +!0;this.material.opacity=0;this.scaleUpAnimation=new r.Tween;this.scaleDownAnimation=new r.Tween;c=function(d){if(this.material){var b=d.image.width/d.image.height,c=new e.Vector3;d.image.width=d.image.naturalWidth||64;d.image.height=d.image.naturalHeight||64;this.scale.set(b*a,a,1);c.copy(this.scale);this.scaleUpAnimation=(new r.Tween(this.scale)).to({x:1.3*c.x,y:1.3*c.y},500).easing(r.Easing.Elastic.Out);this.scaleDownAnimation=(new r.Tween(this.scale)).to({x:c.x,y:c.y},500).easing(r.Easing.Elastic.Out); +this.material.map=d;this.material.needsUpdate=!0}}.bind(this);this.showAnimation=(new r.Tween(this.material)).to({opacity:1},500).onStart(this.enableRaycast.bind(this,!0)).easing(r.Easing.Quartic.Out);this.hideAnimation=(new r.Tween(this.material)).to({opacity:0},500).onStart(this.enableRaycast.bind(this,!1)).easing(r.Easing.Quartic.Out);this.addEventListener("click",this.onClick);this.addEventListener("hover",this.onHover);this.addEventListener("hoverenter",this.onHoverStart);this.addEventListener("hoverleave", +this.onHoverEnd);this.addEventListener("panolens-dual-eye-effect",this.onDualEyeEffect);this.addEventListener("panolens-container",this.setContainer.bind(this));this.addEventListener("dismiss",this.onDismiss);this.addEventListener("panolens-infospot-focus",this.setFocusMethod);N.load(b,c)}function I(a){a||console.warn("PANOLENS.Widget: No container specified");e.EventDispatcher.call(this);this.DEFAULT_TRANSITION="all 0.27s ease";this.TOUCH_ENABLED=!!("ontouchstart"in window||window.DocumentTouch&& +document instanceof DocumentTouch);this.PREVENT_EVENT_HANDLER=function(a){a.preventDefault();a.stopPropagation()};this.container=a;this.mask=this.activeSubMenu=this.activeMainItem=this.mainMenu=this.settingElement=this.videoElement=this.fullscreenElement=this.barElement=null}function n(a,b){e.Mesh.call(this,a,b);this.type="panorama";this.ImageQualityLow=1;this.ImageQualityFair=2;this.ImageQualityMedium=3;this.ImageQualityHigh=4;this.ImageQualitySuperHigh=5;this.animationDuration=1E3;this.defaultInfospotSize= +350;this.container=void 0;this.loaded=!1;this.linkedSpots=[];this.isInfospotVisible=!1;this.linkingImageScale=this.linkingImageURL=void 0;this.material.side=e.BackSide;this.material.opacity=0;this.scale.x*=-1;this.renderOrder=-1;this.active=!1;this.infospotAnimation=(new r.Tween(this)).to({},this.animationDuration/2);this.addEventListener("load",this.fadeIn.bind(this));this.addEventListener("panolens-container",this.setContainer.bind(this));this.addEventListener("click",this.onClick.bind(this));this.setupTransitions()} +function y(a,b,c){b=b||new e.SphereBufferGeometry(5E3,60,40);c=c||new e.MeshBasicMaterial({opacity:0,transparent:!0});n.call(this,b,c);this.src=a;this.radius=5E3}function W(){var a=new e.BufferGeometry,b=new e.MeshBasicMaterial({color:0,opacity:0,transparent:!0});a.addAttribute("position",new e.BufferAttribute(new Float32Array,1));n.call(this,a,b)}function F(a){a=void 0===a?[]:a;var b=Object.assign({},e.ShaderLib.cube),c=new e.BoxBufferGeometry(1E4,1E4,1E4);b=new e.ShaderMaterial({fragmentShader:b.fragmentShader, +vertexShader:b.vertexShader,uniforms:b.uniforms,side:e.BackSide,transparent:!0});n.call(this,c,b);this.images=a;this.edgeLength=1E4;this.material.uniforms.opacity.value=0}function O(){for(var a=[],b=0;6>b;b++)a.push(u.WhiteTile);F.call(this,a)}function B(a,b){b=void 0===b?{}:b;var c=new e.SphereBufferGeometry(5E3,60,40),d=new e.MeshBasicMaterial({opacity:0,transparent:!0});n.call(this,c,d);this.src=a;this.options={videoElement:document.createElement("video"),loop:!0,muted:!0,autoplay:!1,playsinline:!0, +crossOrigin:"anonymous"};Object.assign(this.options,b);this.videoElement=this.options.videoElement;this.videoProgress=0;this.radius=5E3;this.addEventListener("leave",this.pauseVideo.bind(this));this.addEventListener("enter-fade-start",this.resumeVideoProgress.bind(this));this.addEventListener("video-toggle",this.toggleVideo.bind(this));this.addEventListener("video-time",this.setVideoCurrentTime.bind(this))}function P(a){this._parameters=a=void 0===a?{}:a;this._panoId=this._zoom=null;this._panoClient= +new google.maps.StreetViewService;this._total=this._count=0;this._canvas=[];this._ctx=[];this._hc=this._wc=0;this.result=null;this.rotation=0;this.copyright="";this.onPanoramaLoad=this.onSizeChange=null;this.levelsW=[1,2,4,7,13,26];this.levelsH=[1,1,2,4,7,13];this.widths=[416,832,1664,3328,6656,13312];this.heights=[416,416,832,1664,3328,6656];this.maxH=this.maxW=6656;var b;try{var c=document.createElement("canvas");(b=c.getContext("experimental-webgl"))||(b=c.getContext("webgl"))}catch(d){}this.maxW= +Math.max(b.getParameter(b.MAX_TEXTURE_SIZE),this.maxW);this.maxH=Math.max(b.getParameter(b.MAX_TEXTURE_SIZE),this.maxH)}function Z(a,b){y.call(this);this.panoId=a;this.gsvLoader=null;this.loadRequested=!1;this.setupGoogleMapAPI(b)}function C(a,b,c,d){c=void 0===c?1E4:c;d=void 0===d?.5:d;"image"===(void 0===a?"image":a)&&y.call(this,b,this.createGeometry(c,d),this.createMaterial(c));this.size=c;this.ratio=d;this.EPS=1E-6;this.frameId=null;this.dragging=!1;this.userMouse=new e.Vector2;this.quatA=new e.Quaternion; +this.quatB=new e.Quaternion;this.quatCur=new e.Quaternion;this.quatSlerp=new e.Quaternion;this.vectorX=new e.Vector3(1,0,0);this.vectorY=new e.Vector3(0,1,0);this.addEventListener("window-resize",this.onWindowResize)}function aa(a,b,c){C.call(this,"image",a,b,c)}function J(a){var b=new e.SphereBufferGeometry(5E3,60,40),c=new e.MeshBasicMaterial({visible:!1});n.call(this,b,c);this.media=new S(a);this.radius=5E3;this.addEventListener("enter",this.start.bind(this));this.addEventListener("leave",this.stop.bind(this)); +this.addEventListener("panolens-container",this.onPanolensContainer.bind(this));this.addEventListener("panolens-scene",this.onPanolensScene.bind(this))}function ba(a,b){function c(a){Q=!1;K=L=0;if(!1!==f.enabled){a.preventDefault();if(a.button===f.mouseButtons.ORBIT){if(!0===f.noRotate)return;x=w.ROTATE;D.set(a.clientX,a.clientY)}else if(a.button===f.mouseButtons.ZOOM){if(!0===f.noZoom)return;x=w.DOLLY;y.set(a.clientX,a.clientY)}else if(a.button===f.mouseButtons.PAN){if(!0===f.noPan)return;x=w.PAN; +n.set(a.clientX,a.clientY)}x!==w.NONE&&(document.addEventListener("mousemove",d,!1),document.addEventListener("mouseup",g,!1),f.dispatchEvent(O));f.update()}}function d(a){if(!1!==f.enabled){a.preventDefault();var d=f.domElement===document?f.domElement.body:f.domElement;if(x===w.ROTATE){if(!0===f.noRotate)return;h.set(a.clientX,a.clientY);r.subVectors(h,D);f.rotateLeft(2*Math.PI*r.x/d.clientWidth*f.rotateSpeed);f.rotateUp(2*Math.PI*r.y/d.clientHeight*f.rotateSpeed);D.copy(h);G&&(K=a.clientX-G.clientX, +L=a.clientY-G.clientY);G=a}else if(x===w.DOLLY){if(!0===f.noZoom)return;z.set(a.clientX,a.clientY);T.subVectors(z,y);0T.y&&f.dollyOut();y.copy(z)}else if(x===w.PAN){if(!0===f.noPan)return;U.set(a.clientX,a.clientY);t.subVectors(U,n);f.pan(t.x,t.y);n.copy(U)}x!==w.NONE&&f.update()}}function g(){Q=!0;G=void 0;!1!==f.enabled&&(document.removeEventListener("mousemove",d,!1),document.removeEventListener("mouseup",g,!1),f.dispatchEvent(P),x=w.NONE)}function k(a){if(!1!==f.enabled&&!0!== +f.noZoom&&x===w.NONE){a.preventDefault();a.stopPropagation();var d=0;void 0!==a.wheelDelta?d=a.wheelDelta:void 0!==a.detail&&(d=-a.detail);0d&&(f.object.fov=f.object.fov>f.minFov?f.object.fov-1:f.minFov,f.object.updateProjectionMatrix());f.update();f.dispatchEvent(V);f.dispatchEvent(O);f.dispatchEvent(P)}}function p(a){switch(a.keyCode){case f.keys.UP:I=!1;break;case f.keys.BOTTOM:J=!1;break;case f.keys.LEFT:X= +!1;break;case f.keys.RIGHT:Y=!1}}function m(a){if(!1!==f.enabled&&!0!==f.noKeys&&!0!==f.noRotate){switch(a.keyCode){case f.keys.UP:I=!0;break;case f.keys.BOTTOM:J=!0;break;case f.keys.LEFT:X=!0;break;case f.keys.RIGHT:Y=!0}if(I||J||X||Y)Q=!0,I&&(L=-f.rotateSpeed*f.momentumKeydownFactor),J&&(L=f.rotateSpeed*f.momentumKeydownFactor),X&&(K=-f.rotateSpeed*f.momentumKeydownFactor),Y&&(K=f.rotateSpeed*f.momentumKeydownFactor)}}function l(a){Q=!1;K=L=0;if(!1!==f.enabled){switch(a.touches.length){case 1:if(!0=== +f.noRotate)return;x=w.TOUCH_ROTATE;D.set(a.touches[0].pageX,a.touches[0].pageY);break;case 2:if(!0===f.noZoom)return;x=w.TOUCH_DOLLY;var d=a.touches[0].pageX-a.touches[1].pageX;a=a.touches[0].pageY-a.touches[1].pageY;y.set(0,Math.sqrt(d*d+a*a));break;case 3:if(!0===f.noPan)return;x=w.TOUCH_PAN;n.set(a.touches[0].pageX,a.touches[0].pageY);break;default:x=w.NONE}x!==w.NONE&&f.dispatchEvent(O)}}function v(a){if(!1!==f.enabled){a.preventDefault();a.stopPropagation();var d=f.domElement===document?f.domElement.body: +f.domElement;switch(a.touches.length){case 1:if(!0===f.noRotate)break;if(x!==w.TOUCH_ROTATE)break;h.set(a.touches[0].pageX,a.touches[0].pageY);r.subVectors(h,D);f.rotateLeft(2*Math.PI*r.x/d.clientWidth*f.rotateSpeed);f.rotateUp(2*Math.PI*r.y/d.clientHeight*f.rotateSpeed);D.copy(h);G&&(K=a.touches[0].pageX-G.pageX,L=a.touches[0].pageY-G.pageY);G={pageX:a.touches[0].pageX,pageY:a.touches[0].pageY};f.update();break;case 2:if(!0===f.noZoom)break;if(x!==w.TOUCH_DOLLY)break;d=a.touches[0].pageX-a.touches[1].pageX; +a=a.touches[0].pageY-a.touches[1].pageY;z.set(0,Math.sqrt(d*d+a*a));T.subVectors(z,y);0>T.y?(f.object.fov=f.object.fovf.minFov?f.object.fov-1:f.minFov,f.object.updateProjectionMatrix());y.copy(z);f.update();f.dispatchEvent(V);break;case 3:if(!0===f.noPan)break;if(x!==w.TOUCH_PAN)break;U.set(a.touches[0].pageX,a.touches[0].pageY);t.subVectors(U,n);f.pan(t.x,t.y);n.copy(U);f.update();break;default:x= +w.NONE}}}function q(){Q=!0;G=void 0;!1!==f.enabled&&(f.dispatchEvent(P),x=w.NONE)}this.object=a;this.domElement=void 0!==b?b:document;this.frameId=null;this.enabled=!0;this.center=this.target=new e.Vector3;this.noZoom=!1;this.zoomSpeed=1;this.minDistance=0;this.maxDistance=Infinity;this.minZoom=0;this.maxZoom=Infinity;this.noRotate=!1;this.rotateSpeed=-.15;this.noPan=!0;this.keyPanSpeed=7;this.autoRotate=!1;this.autoRotateSpeed=2;this.minPolarAngle=0;this.maxPolarAngle=Math.PI;this.momentumDampingFactor= +.9;this.momentumScalingFactor=-.005;this.momentumKeydownFactor=20;this.minFov=30;this.maxFov=120;this.minAzimuthAngle=-Infinity;this.maxAzimuthAngle=Infinity;this.noKeys=!1;this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};this.mouseButtons={ORBIT:e.MOUSE.LEFT,ZOOM:e.MOUSE.MIDDLE,PAN:e.MOUSE.RIGHT};var f=this,D=new e.Vector2,h=new e.Vector2,r=new e.Vector2,n=new e.Vector2,U=new e.Vector2,t=new e.Vector2,u=new e.Vector3,A=new e.Vector3,y=new e.Vector2,z=new e.Vector2,T=new e.Vector2,R=0,H=0,B=0,C=0,E=1, +F=new e.Vector3,M=new e.Vector3,N=new e.Quaternion,K=0,L=0,G,Q=!1,I,J,X,Y,w={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},x=w.NONE;this.target0=this.target.clone();this.position0=this.object.position.clone();this.zoom0=this.object.zoom;var S=(new e.Quaternion).setFromUnitVectors(a.up,new e.Vector3(0,1,0)),W=S.clone().inverse(),V={type:"change"},O={type:"start"},P={type:"end"};this.setLastQuaternion=function(a){N.copy(a);f.object.quaternion.copy(a)};this.getLastPosition= +function(){return M};this.rotateLeft=function(a){void 0===a&&(a=2*Math.PI/60/60*f.autoRotateSpeed);C-=a};this.rotateUp=function(a){void 0===a&&(a=2*Math.PI/60/60*f.autoRotateSpeed);B-=a};this.panLeft=function(a){var d=this.object.matrix.elements;u.set(d[0],d[1],d[2]);u.multiplyScalar(-a);F.add(u)};this.panUp=function(a){var d=this.object.matrix.elements;u.set(d[4],d[5],d[6]);u.multiplyScalar(a);F.add(u)};this.pan=function(a,d){var b=f.domElement===document?f.domElement.body:f.domElement;if(f.object instanceof +e.PerspectiveCamera){var c=f.object.position.clone().sub(f.target).length();c*=Math.tan(f.object.fov/2*Math.PI/180);f.panLeft(2*a*c/b.clientHeight);f.panUp(2*d*c/b.clientHeight)}else f.object instanceof e.OrthographicCamera?(f.panLeft(a*(f.object.right-f.object.left)/b.clientWidth),f.panUp(d*(f.object.top-f.object.bottom)/b.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")};this.momentum=function(){Q&&(1E-4>Math.abs(K)&&1E-4>Math.abs(L)?Q= +!1:(L*=this.momentumDampingFactor,K*=this.momentumDampingFactor,C-=this.momentumScalingFactor*K,B-=this.momentumScalingFactor*L))};this.dollyIn=function(a){void 0===a&&(a=Math.pow(.95,f.zoomSpeed));f.object instanceof e.PerspectiveCamera?E/=a:f.object instanceof e.OrthographicCamera?(f.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*a)),f.object.updateProjectionMatrix(),f.dispatchEvent(V)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")}; +this.dollyOut=function(a){void 0===a&&(a=Math.pow(.95,f.zoomSpeed));f.object instanceof e.PerspectiveCamera?E*=a:f.object instanceof e.OrthographicCamera?(f.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/a)),f.object.updateProjectionMatrix(),f.dispatchEvent(V)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")};this.update=function(a){var d=this.object.position;A.copy(d).sub(this.target);A.applyQuaternion(S);R=Math.atan2(A.x, +A.z);H=Math.atan2(Math.sqrt(A.x*A.x+A.z*A.z),A.y);this.autoRotate&&x===w.NONE&&this.rotateLeft(2*Math.PI/60/60*f.autoRotateSpeed);this.momentum();R+=C;H+=B;R=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,R));H=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,H));H=Math.max(1E-7,Math.min(Math.PI-1E-7,H));var b=A.length()*E;b=Math.max(this.minDistance,Math.min(this.maxDistance,b));this.target.add(F);A.x=b*Math.sin(H)*Math.sin(R);A.y=b*Math.cos(H);A.z=b*Math.sin(H)*Math.cos(R);A.applyQuaternion(W); +d.copy(this.target).add(A);this.object.lookAt(this.target);B=C=0;E=1;F.set(0,0,0);if(1E-7g&&(l.total=l.total/g*6);c(l)},d)});return k}};S.prototype=Object.assign(Object.create(e.EventDispatcher.prototype),{setContainer:function(a){this.container=a},setScene:function(a){this.scene=a},enumerateDevices:function(){var a=this.devices,b=new Promise(function(b){b(a)});return 0=g.length?(c(0),d--):c(d);b(g[d])})},getDevices:function(a){a=void 0===a?"video":a;var b=this.devices;return this.enumerateDevices().then(function(a){return a.map(function(a){b.includes(a)||b.push(a);return a})}).then(function(b){var d=new RegExp(a,"i");return b.filter(function(a){return d.test(a.kind)})})},getUserMedia:function(a){var b=this.setMediaStream.bind(this),c=this.playVideo.bind(this); +return window.navigator.mediaDevices.getUserMedia(a).then(b).then(c).catch(function(a){console.warn("PANOLENS.Media: "+a)})},setVideDeviceIndex:function(a){this.videoDeviceIndex=a},start:function(a){var b=this.constraints,c=this.getUserMedia.bind(this);this.element=this.createVideoElement();return this.getDevices().then(function(d){if(!d||0===d.length)throw Error("no video device found");b.video.deviceId=(a||d[0]).deviceId;return c(b)})},stop:function(){var a=this.stream;a&&a.active&&(a.getTracks()[0].stop(), +window.removeEventListener("resize",this.onWindowResize.bind(this)),this.stream=this.element=null)},setMediaStream:function(a){this.stream=a;this.element.srcObject=a;this.scene&&(this.scene.background=this.createVideoTexture());window.addEventListener("resize",this.onWindowResize.bind(this))},playVideo:function(){var a=this.element;a&&(a.play(),this.dispatchEvent({type:"play"}))},pauseVideo:function(){var a=this.element;a&&(a.pause(),this.dispatchEvent({type:"pause"}))},createVideoTexture:function(){var a= +this.element,b=new e.VideoTexture(a);b.generateMipmaps=!1;b.minFilter=e.LinearFilter;b.magFilter=e.LinearFilter;b.format=e.RGBFormat;b.center.set(.5,.5);a.addEventListener("canplay",this.onWindowResize.bind(this));return b},createVideoElement:function(){var a=this.dispatchEvent.bind(this),b=document.createElement("video");b.setAttribute("autoplay","");b.setAttribute("muted","");b.setAttribute("playsinline","");b.style.position="absolute";b.style.top="0";b.style.left="0";b.style.width="100%";b.style.height= +"100%";b.style.objectPosition="center";b.style.objectFit="cover";b.style.display=this.scene?"none":"";b.addEventListener("canplay",function(){return a({type:"canplay"})});return b},onWindowResize:function(){if(this.element&&this.element.videoWidth&&this.element.videoHeight&&this.scene){var a=this.container,b=a.clientWidth;a=a.clientHeight;var c=this.scene.background,d=this.element;d=d.videoHeight/d.videoWidth*(this.container?b/a:1)*this.ratioScalar;b>a?c.repeat.set(d,1):c.repeat.set(1,1/d)}}});M.prototype= +Object.assign(Object.create(e.Sprite.prototype),{constructor:M,setColor:function(a){this.material.color.copy(a instanceof e.Color?a:new e.Color(a))},createCanvasTexture:function(a){a=new e.CanvasTexture(a);a.minFilter=e.LinearFilter;a.magFilter=e.LinearFilter;a.generateMipmaps=!1;return a},createCanvas:function(){var a=document.createElement("canvas"),b=a.getContext("2d"),c=this.dpr;a.width=32*c;a.height=32*c;b.scale(c,c);b.shadowBlur=5;b.shadowColor="rgba(200,200,200,0.9)";return{canvas:a,context:b}}, +updateCanvasArcByProgress:function(a){var b=this.context,c=this.canvasWidth,d=this.canvasHeight,g=this.material,k=this.dpr,e=a*Math.PI*2,m=this.color.getStyle(),l=.5*c/k;k=.5*d/k;b.clearRect(0,0,c,d);b.beginPath();0===a?(b.arc(l,k,c/16,0,2*Math.PI),b.fillStyle=m,b.fill()):(b.arc(l,k,c/4-3,-Math.PI/2,-Math.PI/2+e),b.strokeStyle=m,b.lineWidth=3,b.stroke());b.closePath();g.map.needsUpdate=!0},ripple:function(){var a=this,b=this.context,c=this.canvasWidth,d=this.canvasHeight,g=this.material,k=this.rippleDuration, +e=performance.now(),m=this.color,l=this.dpr,h=.5*c/l,q=.5*d/l,f=function(){var p=window.requestAnimationFrame(f),v=(performance.now()-e)/k,n=0<1-v?1-v:0,r=v*c*.5/l;b.clearRect(0,0,c,d);b.beginPath();b.arc(h,q,r,0,2*Math.PI);b.fillStyle="rgba("+255*m.r+", "+255*m.g+", "+255*m.b+", "+n+")";b.fill();b.closePath();1<=v&&(window.cancelAnimationFrame(p),a.updateCanvasArcByProgress(0),a.dispatchEvent({type:"reticle-ripple-end"}));g.map.needsUpdate=!0};this.dispatchEvent({type:"reticle-ripple-start"});f()}, +show:function(){this.visible=!0},hide:function(){this.visible=!1},start:function(a){this.autoSelect&&(this.dispatchEvent({type:"reticle-start"}),this.startTimestamp=performance.now(),this.callback=a,this.update())},end:function(){this.startTimestamp&&(window.cancelAnimationFrame(this.timerId),this.updateCanvasArcByProgress(0),this.startTimestamp=this.timerId=this.callback=null,this.dispatchEvent({type:"reticle-end"}))},update:function(){this.timerId=window.requestAnimationFrame(this.update.bind(this)); +var a=(performance.now()-this.startTimestamp)/this.dwellTime;this.updateCanvasArcByProgress(a);this.dispatchEvent({type:"reticle-update",progress:a});1<=a&&(window.cancelAnimationFrame(this.timerId),this.callback&&this.callback(),this.end(),this.ripple())}});var r=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(a,b){b=function(){this._tweens={};this._tweensAddedDuringUpdate={}};b.prototype={getAll:function(){return Object.keys(this._tweens).map(function(a){return this._tweens[a]}.bind(this))}, +removeAll:function(){this._tweens={}},add:function(a){this._tweens[a.getId()]=a;this._tweensAddedDuringUpdate[a.getId()]=a},remove:function(a){delete this._tweens[a.getId()];delete this._tweensAddedDuringUpdate[a.getId()]},update:function(a,b){var d=Object.keys(this._tweens);if(0===d.length)return!1;for(a=void 0!==a?a:c.now();0(a*=2)?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return 1> +(a*=2)?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return 1>(a*=2)?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return 1>(a*=2)?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0=== +a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:1>(a*=2)?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return 1>(a*=2)?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){return 0===a?0:1===a?1:-Math.pow(2,10*(a-1))*Math.sin(5*(a-1.1)*Math.PI)},Out:function(a){return 0===a?0:1===a? +1:Math.pow(2,-10*a)*Math.sin(5*(a-.1)*Math.PI)+1},InOut:function(a){if(0===a)return 0;if(1===a)return 1;a*=2;return 1>a?-.5*Math.pow(2,10*(a-1))*Math.sin(5*(a-1.1)*Math.PI):.5*Math.pow(2,-10*(a-1))*Math.sin(5*(a-1.1)*Math.PI)+1}},Back:{In:function(a){return a*a*(2.70158*a-1.70158)},Out:function(a){return--a*a*(2.70158*a+1.70158)+1},InOut:function(a){return 1>(a*=2)?.5*a*a*(3.5949095*a-2.5949095):.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)}},Bounce:{In:function(a){return 1-c.Easing.Bounce.Out(1-a)},Out:function(a){return a< +1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return.5>a?.5*c.Easing.Bounce.In(2*a):.5*c.Easing.Bounce.Out(2*a-1)+.5}}};c.Interpolation={Linear:function(a,b){var d=a.length-1,g=d*b,e=Math.floor(g),l=c.Interpolation.Utils.Linear;return 0>b?l(a[0],a[1],g):1d?d:e+1],g-e)},Bezier:function(a,b){for(var d=0,g=a.length-1,e=Math.pow,l=c.Interpolation.Utils.Bernstein,h=0;h<= +g;h++)d+=e(1-b,g-h)*e(b,h)*a[h]*l(g,h);return d},CatmullRom:function(a,b){var d=a.length-1,g=d*b,e=Math.floor(g),l=c.Interpolation.Utils.CatmullRom;return a[0]===a[d]?(0>b&&(e=Math.floor(g=d*(1+b))),l(a[(e-1+d)%d],a[e],a[(e+1)%d],a[(e+2)%d],g-e)):0>b?a[0]-(l(a[0],a[0],a[1],a[1],-g)-a[0]):1l?0:l,f.setProgress(l),g.dispatchEvent({type:"panolens-viewer-handler",method:"setVideoCurrentTime",data:l}))}function c(a){a.stopPropagation();e=!1;d()}function d(){g.container.removeEventListener("mousemove",b,!1);g.container.removeEventListener("mouseup",c,!1);g.container.removeEventListener("touchmove",b,!1);g.container.removeEventListener("touchend",c,!1)}var g=this,e=!1,p,m,l;var h=document.createElement("div");h.style.width="0%";h.style.height="100%";h.style.backgroundColor="#fff";var q= +document.createElement("div");q.style.float="right";q.style.width="14px";q.style.height="14px";q.style.transform="translate(7px, -5px)";q.style.borderRadius="50%";q.style.backgroundColor="#ddd";q.addEventListener("mousedown",a,{passive:!0});q.addEventListener("touchstart",a,{passive:!0});h.appendChild(q);var f=this.createCustomItem({style:{float:"left",width:"30%",height:"4px",marginTop:"20px",backgroundColor:"rgba(188,188,188,0.8)"},onTap:function(a){a.preventDefault();a.stopPropagation();if(a.target!== +q){var b=a.changedTouches&&0=window.innerWidth?this.ImageQualityFair:800=window.innerWidth?this.ImageQualityMedium:1280=window.innerWidth?this.ImageQualityHigh:1920=d&&(b.zoom.value=d)},onUpdateCallback:function(){this.frameId=window.requestAnimationFrame(this.onUpdateCallback.bind(this));this.quatSlerp.slerp(this.quatCur,.1);this.material&& +this.material.uniforms.transform.value.makeRotationFromQuaternion(this.quatSlerp);!this.dragging&&1-this.quatSlerp.clone().dot(this.quatCur)=a.length?0:b},setCameraFov:function(a){this.camera.fov=a;this.camera.updateProjectionMatrix()}, +enableControl:function(a){a=0<=a&&aMath.PI?m-2*Math.PI:m;m=m<-Math.PI?m+2*Math.PI:m;k=Math.abs(h.angleTo(k)+(0>=h.y*l.y?l.angleTo(a):-l.angleTo(a)));k*=l.y=a.clientX-this.options.clickTolerance&&this.userMouse.x<=a.clientX+ +this.options.clickTolerance&&this.userMouse.y>=a.clientY-this.options.clickTolerance&&this.userMouse.y<=a.clientY+this.options.clickTolerance||a.changedTouches&&this.userMouse.x>=a.changedTouches[0].clientX-this.options.clickTolerance&&this.userMouse.x<=a.changedTouches[0].clientX+this.options.clickTolerance&&this.userMouse.y>=a.changedTouches[0].clientY-this.options.clickTolerance&&this.userMouse.y<=a.changedTouches[0].clientY+this.options.clickTolerance?"click":void 0;if(!a||!a.target||a.target.classList.contains("panolens-canvas"))if(a.preventDefault(), +a=a.changedTouches&&1===a.changedTouches.length?this.onTap({clientX:a.changedTouches[0].clientX,clientY:a.changedTouches[0].clientY},b):this.onTap(a,b),this.userMouse.type="none",!a&&"click"===b){b=this.options;a=b.autoHideControlBar;var c=this.panorama,d=this.toggleControlBar;b.autoHideInfospot&&c&&c.toggleInfospotVisibility();a&&d()}},onTap:function(a,b){var c=this.container.getBoundingClientRect(),d=c.top,e=this.container,h=e.clientHeight;this.raycasterPoint.x=(a.clientX-c.left)/e.clientWidth* +2-1;this.raycasterPoint.y=2*-((a.clientY-d)/h)+1;this.raycaster.setFromCamera(this.raycasterPoint,this.camera);if(this.panorama){("mousedown"!==a.type&&this.touchSupported||this.OUTPUT_INFOSPOT)&&this.outputPosition();c=this.raycaster.intersectObjects(this.panorama.children,!0);d=this.getConvertedIntersect(c);e=0>8&255]+gt[t>>16&255]+gt[t>>24&255]+"-"+gt[255&e]+gt[e>>8&255]+"-"+gt[e>>16&15|64]+gt[e>>24&255]+"-"+gt[63&n|128]+gt[n>>8&255]+"-"+gt[n>>16&255]+gt[n>>24&255]+gt[255&i]+gt[i>>8&255]+gt[i>>16&255]+gt[i>>24&255]).toLowerCase()}function bt(t,e,n){return Math.max(e,Math.min(n,t))}function Mt(t,e){return(t%e+e)%e}function wt(t,e,n){return(1-n)*t+n*e}function St(t){return 0==(t&t-1)&&0!==t}function Tt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Et(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var At=Object.freeze({__proto__:null,DEG2RAD:yt,RAD2DEG:xt,generateUUID:_t,clamp:bt,euclideanModulo:Mt,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:wt,damp:function(t,e,n,i){return wt(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(Mt(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(vt=t);let e=vt+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*yt},radToDeg:function(t){return t*xt},isPowerOfTwo:St,ceilPowerOfTwo:Tt,floorPowerOfTwo:Et,setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+i)/2),h=a((e+i)/2),u=s((e-i)/2),d=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*h,l*u,l*d,o*c);break;case"YZY":t.set(l*d,o*h,l*u,o*c);break;case"ZXZ":t.set(l*u,l*d,o*h,o*c);break;case"XZX":t.set(o*h,l*m,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*m,o*c);break;case"ZYZ":t.set(l*m,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}},denormalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}});class Rt{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Rt.prototype.isVector2=!0;class Ct{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],x=i[7],_=i[2],b=i[5],M=i[8];return r[0]=s*m+a*v+o*_,r[3]=s*f+a*y+o*b,r[6]=s*g+a*x+o*M,r[1]=l*m+c*v+h*_,r[4]=l*f+c*y+h*b,r[7]=l*g+c*x+h*M,r[2]=u*m+d*v+p*_,r[5]=u*f+d*y+p*b,r[8]=u*g+d*x+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(i*l-c*n)*m,t[2]=(a*n-i*s)*m,t[3]=u*m,t[4]=(c*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(n*o-l*e)*m,t[8]=(s*e-n*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],s=i[3],a=i[6],o=i[1],l=i[4],c=i[7];return i[0]=e*r+n*o,i[3]=e*s+n*l,i[6]=e*a+n*c,i[1]=-n*r+e*o,i[4]=-n*s+e*l,i[7]=-n*a+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function Lt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}Ct.prototype.isMatrix3=!0;const Pt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Dt(t,e){return new Pt[t](e)}function It(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Nt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Bt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Ot={[lt]:{[ct]:Nt},[ct]:{[lt]:Bt}},zt={legacyMode:!0,get workingColorSpace(){return ct},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(Ot[e]&&void 0!==Ot[e][n]){const i=Ot[e][n];return t.r=i(t.r),t.g=i(t.g),t.b=i(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},Ut={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ft={r:0,g:0,b:0},Ht={h:0,s:0,l:0},Gt={h:0,s:0,l:0};function kt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Vt(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class Wt{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e="srgb"){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,zt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i="srgb-linear"){return this.r=t,this.g=e,this.b=n,zt.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i="srgb-linear"){if(t=Mt(t,1),e=bt(e,0,1),n=bt(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=kt(r,i,t+1/3),this.g=kt(r,i,t),this.b=kt(r,i,t-1/3)}return zt.toWorkingColorSpace(this,i),this}setStyle(t,e="srgb"){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,zt.toWorkingColorSpace(this,e),n(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,zt.toWorkingColorSpace(this,e),n(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const i=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,s=parseInt(t[3],10)/100;return n(t[4]),this.setHSL(i,r,s,e)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,zt.toWorkingColorSpace(this,e),this;if(6===n)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,zt.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const n=Ut[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Nt(t.r),this.g=Nt(t.g),this.b=Nt(t.b),this}copyLinearToSRGB(t){return this.r=Bt(t.r),this.g=Bt(t.g),this.b=Bt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return zt.fromWorkingColorSpace(Vt(this,Ft),t),bt(255*Ft.r,0,255)<<16^bt(255*Ft.g,0,255)<<8^bt(255*Ft.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){zt.fromWorkingColorSpace(Vt(this,Ft),e);const n=Ft.r,i=Ft.g,r=Ft.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c<=.5?t/(s+a):t/(2-s-a),s){case n:o=(i-r)/t+(i2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=It("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t1)switch(this.wrapS){case c:t.x=t.x-Math.floor(t.x);break;case h:t.x=t.x<0?0:1;break;case u:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case c:t.y=t.y-Math.floor(t.y);break;case h:t.y=t.y<0?0:1;break;case u:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}Zt.DEFAULT_IMAGE=null,Zt.DEFAULT_MAPPING=i,Zt.prototype.isTexture=!0;class Kt{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-u)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(bt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}re.prototype.isQuaternion=!0;class se{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(oe.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(oe.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*i-a*n,c=o*n+a*e-r*i,h=o*i+r*n-s*e,u=-r*e-s*n-a*i;return this.x=l*o+u*-r+c*-a-h*-s,this.y=c*o+u*-s+h*-r-l*-a,this.z=h*o+u*-a+l*-s-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return ae.copy(this).projectOnVector(t),this.sub(ae)}reflect(t){return this.sub(ae.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(bt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}se.prototype.isVector3=!0;const ae=new se,oe=new re;class le{constructor(t=new se(1/0,1/0,1/0),e=new se(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.length;or&&(r=l),c>s&&(s=c),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,s,a),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.count;or&&(r=l),c>s&&(s=c),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,s,a),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,he),he.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ye),xe.subVectors(this.max,ye),de.subVectors(t.a,ye),pe.subVectors(t.b,ye),me.subVectors(t.c,ye),fe.subVectors(pe,de),ge.subVectors(me,pe),ve.subVectors(de,me);let e=[0,-fe.z,fe.y,0,-ge.z,ge.y,0,-ve.z,ve.y,fe.z,0,-fe.x,ge.z,0,-ge.x,ve.z,0,-ve.x,-fe.y,fe.x,0,-ge.y,ge.x,0,-ve.y,ve.x,0];return!!Me(e,de,pe,me,xe)&&(e=[1,0,0,0,1,0,0,0,1],!!Me(e,de,pe,me,xe)&&(_e.crossVectors(fe,ge),e=[_e.x,_e.y,_e.z],Me(e,de,pe,me,xe)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return he.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(he).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ce[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ce[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ce[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ce[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ce[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ce[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ce[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ce[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ce)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}le.prototype.isBox3=!0;const ce=[new se,new se,new se,new se,new se,new se,new se,new se],he=new se,ue=new le,de=new se,pe=new se,me=new se,fe=new se,ge=new se,ve=new se,ye=new se,xe=new se,_e=new se,be=new se;function Me(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){be.fromArray(t,s);const a=r.x*Math.abs(be.x)+r.y*Math.abs(be.y)+r.z*Math.abs(be.z),o=e.dot(be),l=n.dot(be),c=i.dot(be);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const we=new le,Se=new se,Te=new se,Ee=new se;class Ae{constructor(t=new se,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):we.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Ee.subVectors(t,this.center);const e=Ee.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(Ee.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?Te.set(0,0,1).multiplyScalar(t.radius):Te.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Se.copy(t.center).add(Te)),this.expandByPoint(Se.copy(t.center).sub(Te)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Re=new se,Ce=new se,Le=new se,Pe=new se,De=new se,Ie=new se,Ne=new se;class Be{constructor(t=new se,e=new se(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Re)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Re.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Re.copy(this.direction).multiplyScalar(e).add(this.origin),Re.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Ce.copy(t).add(e).multiplyScalar(.5),Le.copy(e).sub(t).normalize(),Pe.copy(this.origin).sub(Ce);const r=.5*t.distanceTo(e),s=-this.direction.dot(Le),a=Pe.dot(this.direction),o=-Pe.dot(Le),l=Pe.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Le).multiplyScalar(u).add(Ce),d}intersectSphere(t,e){Re.subVectors(t.center,this.origin);const n=Re.dot(this.direction),i=Re.dot(Re)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return a<0&&o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Re)}intersectTriangle(t,e,n,i,r){De.subVectors(e,t),Ie.subVectors(n,t),Ne.crossVectors(De,Ie);let s,a=this.direction.dot(Ne);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Pe.subVectors(this.origin,t);const o=s*this.direction.dot(Ie.crossVectors(Pe,Ie));if(o<0)return null;const l=s*this.direction.dot(De.cross(Pe));if(l<0)return null;if(o+l>a)return null;const c=-s*Pe.dot(Ne);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Oe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Oe).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/ze.setFromMatrixColumn(t,0).length(),r=1/ze.setFromMatrixColumn(t,1).length(),s=1/ze.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Fe,t,He)}lookAt(t,e,n){const i=this.elements;return Ve.subVectors(t,e),0===Ve.lengthSq()&&(Ve.z=1),Ve.normalize(),Ge.crossVectors(n,Ve),0===Ge.lengthSq()&&(1===Math.abs(n.z)?Ve.x+=1e-4:Ve.z+=1e-4,Ve.normalize(),Ge.crossVectors(n,Ve)),Ge.normalize(),ke.crossVectors(Ve,Ge),i[0]=Ge.x,i[4]=ke.x,i[8]=Ve.x,i[1]=Ge.y,i[5]=ke.y,i[9]=Ve.y,i[2]=Ge.z,i[6]=ke.z,i[10]=Ve.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],x=n[11],_=n[15],b=i[0],M=i[4],w=i[8],S=i[12],T=i[1],E=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],D=i[14],I=i[3],N=i[7],B=i[11],O=i[15];return r[0]=s*b+a*T+o*C+l*I,r[4]=s*M+a*E+o*L+l*N,r[8]=s*w+a*A+o*P+l*B,r[12]=s*S+a*R+o*D+l*O,r[1]=c*b+h*T+u*C+d*I,r[5]=c*M+h*E+u*L+d*N,r[9]=c*w+h*A+u*P+d*B,r[13]=c*S+h*R+u*D+d*O,r[2]=p*b+m*T+f*C+g*I,r[6]=p*M+m*E+f*L+g*N,r[10]=p*w+m*A+f*P+g*B,r[14]=p*S+m*R+f*D+g*O,r[3]=v*b+y*T+x*C+_*I,r[7]=v*M+y*E+x*L+_*N,r[11]=v*w+y*A+x*P+_*B,r[15]=v*S+y*R+x*D+_*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=h*f*l-m*u*l+m*o*d-a*f*d-h*o*g+a*u*g,y=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,x=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,_=p*h*o-c*m*o-p*a*u+s*m*u+c*a*f-s*h*f,b=e*v+n*y+i*x+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return t[0]=v*M,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*M,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*M,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*M,t[4]=y*M,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*M,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*M,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*M,t[8]=x*M,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*M,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*M,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*M,t[12]=_*M,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*M,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*M,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*M,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,m=s*c,f=s*h,g=a*h,v=o*l,y=o*c,x=o*h,_=n.x,b=n.y,M=n.z;return i[0]=(1-(m+g))*_,i[1]=(d+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(u+g))*b,i[6]=(f+v)*b,i[7]=0,i[8]=(p+y)*M,i[9]=(f-v)*M,i[10]=(1-(u+m))*M,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=ze.set(i[0],i[1],i[2]).length();const s=ze.set(i[4],i[5],i[6]).length(),a=ze.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Ue.copy(this);const o=1/r,l=1/s,c=1/a;return Ue.elements[0]*=o,Ue.elements[1]*=o,Ue.elements[2]*=o,Ue.elements[4]*=l,Ue.elements[5]*=l,Ue.elements[6]*=l,Ue.elements[8]*=c,Ue.elements[9]*=c,Ue.elements[10]*=c,e.setFromRotationMatrix(Ue),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,o=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s){const a=this.elements,o=1/(e-t),l=1/(n-i),c=1/(s-r),h=(e+t)*o,u=(n+i)*l,d=(s+r)*c;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}Oe.prototype.isMatrix4=!0;const ze=new se,Ue=new Oe,Fe=new se(0,0,0),He=new se(1,1,1),Ge=new se,ke=new se,Ve=new se,We=new Oe,je=new re;class qe{constructor(t=0,e=0,n=0,i=qe.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(bt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-bt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-bt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return We.makeRotationFromQuaternion(t),this.setFromRotationMatrix(We,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return je.setFromEuler(this),this.setFromQuaternion(je,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}qe.prototype.isEuler=!0,qe.DefaultOrder="XYZ",qe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Xe{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){cn.subVectors(i,e),hn.subVectors(n,e),un.subVectors(t,e);const s=cn.dot(cn),a=cn.dot(hn),o=cn.dot(un),l=hn.dot(hn),c=hn.dot(un),h=s*l-a*a;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,dn),dn.x>=0&&dn.y>=0&&dn.x+dn.y<=1}static getUV(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,dn),o.set(0,0),o.addScaledVector(r,dn.x),o.addScaledVector(s,dn.y),o.addScaledVector(a,dn.z),o}static isFrontFacing(t,e,n,i){return cn.subVectors(n,e),hn.subVectors(t,e),cn.cross(hn).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return cn.subVectors(this.c,this.b),hn.subVectors(this.a,this.b),.5*cn.cross(hn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return xn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return xn.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return xn.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return xn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return xn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;pn.subVectors(i,n),mn.subVectors(r,n),gn.subVectors(t,n);const o=pn.dot(gn),l=mn.dot(gn);if(o<=0&&l<=0)return e.copy(n);vn.subVectors(t,i);const c=pn.dot(vn),h=mn.dot(vn);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(pn,s);yn.subVectors(t,r);const d=pn.dot(yn),p=mn.dot(yn);if(p>=0&&d<=p)return e.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(mn,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return fn.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(fn,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(pn,s).addScaledVector(mn,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let _n=0;class bn extends ft{constructor(){super(),Object.defineProperty(this,"id",{value:_n++}),this.uuid=_t(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=n,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ht,this.stencilZFail=ht,this.stencilZPass=ht,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}bn.prototype.isMaterial=!0,bn.fromType=function(){return null};class Mn extends bn{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Wt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Mn.prototype.isMeshBasicMaterial=!0;const wn=new se,Sn=new Rt;class Tn{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=ut,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),qn.copy(n.boundingSphere),qn.applyMatrix4(r),!1===t.ray.intersectsSphere(qn))return;if(Wn.copy(r).invert(),jn.copy(t.ray).applyMatrix4(Wn),null!==n.boundingBox&&!1===jn.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:ai.clone(),object:t}}(t,e,n,i,Xn,Jn,Yn,si);if(p){o&&(ni.fromBufferAttribute(o,c),ii.fromBufferAttribute(o,h),ri.fromBufferAttribute(o,u),p.uv=xn.getUV(si,Xn,Jn,Yn,ni,ii,ri,new Rt)),l&&(ni.fromBufferAttribute(l,c),ii.fromBufferAttribute(l,h),ri.fromBufferAttribute(l,u),p.uv2=xn.getUV(si,Xn,Jn,Yn,ni,ii,ri,new Rt));const t={a:c,b:h,c:u,normal:new se,materialIndex:0};xn.getNormal(Xn,Jn,Yn,t.normal),p.face=t}return p}oi.prototype.isMesh=!0;class ci extends Vn{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,m,f,g,v){const y=s/f,x=p/g,_=s/2,b=p/2,M=m/2,w=f+1,S=g+1;let T=0,E=0;const A=new se;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(o/f),h.push(1-s/g),T+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}pi.prototype.isShaderMaterial=!0;class mi extends ln{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Oe,this.projectionMatrix=new Oe,this.projectionMatrixInverse=new Oe}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}mi.prototype.isCamera=!0;class fi extends mi{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*yt*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xt*Math.atan(Math.tan(.5*yt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*yt*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}fi.prototype.isPerspectiveCamera=!0;const gi=90;class vi extends ln{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new fi(gi,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new se(1,0,0)),this.add(i);const r=new fi(gi,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new se(-1,0,0)),this.add(r);const s=new fi(gi,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new se(0,1,0)),this.add(s);const a=new fi(gi,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new se(0,-1,0)),this.add(a);const o=new fi(gi,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new se(0,0,1)),this.add(o);const l=new fi(gi,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new se(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,a,o,l]=this.children,c=t.getRenderTarget(),h=t.outputEncoding,u=t.toneMapping,d=t.xr.enabled;t.outputEncoding=at,t.toneMapping=0,t.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=p,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(c),t.outputEncoding=h,t.toneMapping=u,t.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class yi extends Zt{constructor(t,e,n,i,s,a,o,l,c,h){super(t=void 0!==t?t:[],e=void 0!==e?e:r,n,i,s,a,o,l,c,h),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}yi.prototype.isCubeTexture=!0;class xi extends Qt{constructor(t,e={}){super(t,t,e);const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new yi(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:f}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new ci(5,5,5),r=new pi({name:"CubemapFromEquirect",uniforms:hi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new oi(i,r),a=e.minFilter;e.minFilter===v&&(e.minFilter=f);return new vi(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}xi.prototype.isWebGLCubeRenderTarget=!0;const _i=new se,bi=new se,Mi=new Ct;class wi{constructor(t=new se(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=_i.subVectors(n,e).cross(bi.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(_i),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Mi.getNormalMatrix(t),i=this.coplanarPoint(_i).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}wi.prototype.isPlane=!0;const Si=new Ae,Ti=new se;class Ei{constructor(t=new wi,e=new wi,n=new wi,i=new wi,r=new wi,s=new wi){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-i,h-o,m-u,y-f).normalize(),e[1].setComponents(a+i,h+o,m+u,y+f).normalize(),e[2].setComponents(a+r,h+l,m+d,y+g).normalize(),e[3].setComponents(a-r,h-l,m-d,y-g).normalize(),e[4].setComponents(a-s,h-c,m-p,y-v).normalize(),e[5].setComponents(a+s,h+c,m+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Si.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Si)}intersectsSprite(t){return Si.center.set(0,0,0),Si.radius=.7071067811865476,Si.applyMatrix4(t.matrixWorld),this.intersectsSphere(Si)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,Ti.y=i.normal.y>0?t.max.y:t.min.y,Ti.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Ti)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ai(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ri(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Pi={common:{diffuse:{value:new Wt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ct},uv2Transform:{value:new Ct},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Rt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Wt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Wt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ct}},sprite:{diffuse:{value:new Wt(16777215)},opacity:{value:1},center:{value:new Rt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ct}}},Di={basic:{uniforms:ui([Pi.common,Pi.specularmap,Pi.envmap,Pi.aomap,Pi.lightmap,Pi.fog]),vertexShader:Li.meshbasic_vert,fragmentShader:Li.meshbasic_frag},lambert:{uniforms:ui([Pi.common,Pi.specularmap,Pi.envmap,Pi.aomap,Pi.lightmap,Pi.emissivemap,Pi.fog,Pi.lights,{emissive:{value:new Wt(0)}}]),vertexShader:Li.meshlambert_vert,fragmentShader:Li.meshlambert_frag},phong:{uniforms:ui([Pi.common,Pi.specularmap,Pi.envmap,Pi.aomap,Pi.lightmap,Pi.emissivemap,Pi.bumpmap,Pi.normalmap,Pi.displacementmap,Pi.fog,Pi.lights,{emissive:{value:new Wt(0)},specular:{value:new Wt(1118481)},shininess:{value:30}}]),vertexShader:Li.meshphong_vert,fragmentShader:Li.meshphong_frag},standard:{uniforms:ui([Pi.common,Pi.envmap,Pi.aomap,Pi.lightmap,Pi.emissivemap,Pi.bumpmap,Pi.normalmap,Pi.displacementmap,Pi.roughnessmap,Pi.metalnessmap,Pi.fog,Pi.lights,{emissive:{value:new Wt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag},toon:{uniforms:ui([Pi.common,Pi.aomap,Pi.lightmap,Pi.emissivemap,Pi.bumpmap,Pi.normalmap,Pi.displacementmap,Pi.gradientmap,Pi.fog,Pi.lights,{emissive:{value:new Wt(0)}}]),vertexShader:Li.meshtoon_vert,fragmentShader:Li.meshtoon_frag},matcap:{uniforms:ui([Pi.common,Pi.bumpmap,Pi.normalmap,Pi.displacementmap,Pi.fog,{matcap:{value:null}}]),vertexShader:Li.meshmatcap_vert,fragmentShader:Li.meshmatcap_frag},points:{uniforms:ui([Pi.points,Pi.fog]),vertexShader:Li.points_vert,fragmentShader:Li.points_frag},dashed:{uniforms:ui([Pi.common,Pi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Li.linedashed_vert,fragmentShader:Li.linedashed_frag},depth:{uniforms:ui([Pi.common,Pi.displacementmap]),vertexShader:Li.depth_vert,fragmentShader:Li.depth_frag},normal:{uniforms:ui([Pi.common,Pi.bumpmap,Pi.normalmap,Pi.displacementmap,{opacity:{value:1}}]),vertexShader:Li.meshnormal_vert,fragmentShader:Li.meshnormal_frag},sprite:{uniforms:ui([Pi.sprite,Pi.fog]),vertexShader:Li.sprite_vert,fragmentShader:Li.sprite_frag},background:{uniforms:{uvTransform:{value:new Ct},t2D:{value:null}},vertexShader:Li.background_vert,fragmentShader:Li.background_frag},cube:{uniforms:ui([Pi.envmap,{opacity:{value:1}}]),vertexShader:Li.cube_vert,fragmentShader:Li.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Li.equirect_vert,fragmentShader:Li.equirect_frag},distanceRGBA:{uniforms:ui([Pi.common,Pi.displacementmap,{referencePosition:{value:new se},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Li.distanceRGBA_vert,fragmentShader:Li.distanceRGBA_frag},shadow:{uniforms:ui([Pi.lights,Pi.fog,{color:{value:new Wt(0)},opacity:{value:1}}]),vertexShader:Li.shadow_vert,fragmentShader:Li.shadow_frag}};function Ii(t,e,n,i,r,s){const a=new Wt(0);let o,c,h=!0===r?0:1,u=null,d=0,p=null;function m(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,s)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,m(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,m(a,h)},render:function(n,r){let s=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const g=t.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(f=null),null===f?m(a,h):f&&f.isColor&&(m(f,1),s=!0),(t.autoClear||s)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===l)?(void 0===c&&(c=new oi(new ci(1,1,1),new pi({name:"BackgroundCubeMaterial",uniforms:hi(Di.cube.uniforms),vertexShader:Di.cube.vertexShader,fragmentShader:Di.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=f,c.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,u===f&&d===f.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=f,d=f.version,p=t.toneMapping),n.unshift(c,c.geometry,c.material,0,0,null)):f&&f.isTexture&&(void 0===o&&(o=new oi(new Ci(2,2),new pi({name:"BackgroundMaterial",uniforms:hi(Di.background.uniforms),vertexShader:Di.background.vertexShader,fragmentShader:Di.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),u===f&&d===f.version&&p===t.toneMapping||(o.material.needsUpdate=!0,u=f,d=f.version,p=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Ni(t,e,n,i){const r=t.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=p(null);let c=l,h=!1;function u(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],i=[];for(let t=0;t=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,a=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),m=t.getParameter(34921),f=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),y=u>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(36183):0}}function zi(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new wi,o=new Ct,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0){const a=new xi(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}Di.physical={uniforms:ui([Di.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Rt(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Wt(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Rt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Wt(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Wt(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Li.meshphysical_vert,fragmentShader:Li.meshphysical_frag};class Fi extends mi{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Fi.prototype.isOrthographicCamera=!0;const Hi=[.125,.215,.35,.446,.526,.582],Gi=20,ki=new Fi,Vi=new Wt;let Wi=null;const ji=(1+Math.sqrt(5))/2,qi=1/ji,Xi=[new se(1,1,1),new se(-1,1,1),new se(1,1,-1),new se(-1,1,-1),new se(0,ji,qi),new se(0,ji,-qi),new se(qi,0,ji),new se(-qi,0,ji),new se(ji,qi,0),new se(-ji,qi,0)];class Ji{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Wi=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Qi(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Ki(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?o=Hi[a-t+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-1),c=-l/2,h=1+l/2,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*d),y=new Float32Array(f*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,m*p*t),y.set(u,f*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const _=new Vn;_.setAttribute("position",new Tn(v,m)),_.setAttribute("uv",new Tn(y,f)),_.setAttribute("faceIndex",new Tn(x,g)),e.push(_),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(Gi),r=new se(0,1,0);return new pi({name:"SphericalGaussianBlur",defines:{n:Gi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:$i(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new oi(this._lodPlanes[0],t);this._renderer.compile(e,ki)}_sceneToCubeUV(t,e,n,i){const r=new fi(90,1,e,n),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(Vi),o.toneMapping=0,o.autoClear=!1;const h=new Mn({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new oi(new ci,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(Vi),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(a[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,a[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,a[e]));const l=this._cubeSize;Zi(i,n*l,e>2?l:0,l,l),o.setRenderTarget(i),d&&o.render(u,r),o.render(t,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===r||t.mapping===s;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Qi()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ki());const a=i?this._cubemapMaterial:this._equirectMaterial,o=new oi(this._lodPlanes[0],a);a.uniforms.envMap.value=t;const l=this._cubeSize;Zi(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(o,ki)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;eGi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;tv-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(e),o.render(c,ki)}}function Yi(t,e,n){const i=new Qt(t,e,n);return i.texture.mapping=l,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Zi(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Ki(){return new pi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:$i(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Qi(){return new pi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:$i(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function $i(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function tr(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(l){if(l&&l.isTexture){const c=l.mapping,h=c===a||c===o,u=c===r||c===s;if(h||u){if(l.isRenderTargetTexture&&!0===l.needsPMREMUpdate){l.needsPMREMUpdate=!1;let i=e.get(l);return null===n&&(n=new Ji(t)),i=h?n.fromEquirectangular(l,i):n.fromCubemap(l,i),e.set(l,i),i.texture}if(e.has(l))return e.get(l).texture;{const r=l.image;if(h&&r&&r.height>0||u&&r&&function(t){let e=0;const n=6;for(let i=0;ie.maxTextureSize&&(A=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const R=new Float32Array(E*A*4*m),C=new $t(R,E,A,m);C.type=b,C.needsUpdate=!0;const L=4*T;for(let D=0;D0)return t;const r=e*n;let s=mr[r];if(void 0===s&&(s=new Float32Array(r),mr[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function _r(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function ws(t){return t.replace(Ms,Ss)}function Ss(t,e){const n=Li[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return ws(n)}const Ts=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Es=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function As(t){return t.replace(Es,Cs).replace(Ts,Rs)}function Rs(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Cs(t,e,n,i)}function Cs(t,e,n,i){let r="";for(let t=parseInt(e);t0&&(x+="\n"),_=[g,v].filter(xs).join("\n"),_.length>0&&(_+="\n")):(x=[Ls(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(xs).join("\n"),_=[g,Ls(n),"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",n.envMap?"#define "+m:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Li.tonemapping_pars_fragment:"",0!==n.toneMapping?ys("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Li.encodings_pars_fragment,vs("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(xs).join("\n")),c=ws(c),c=_s(c,n),c=bs(c,n),h=ws(h),h=_s(h,n),h=bs(h,n),c=As(c),h=As(h),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,_=["#define varying in",n.glslVersion===pt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===pt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_);const M=b+_+h,w=ms(a,35633,b+x+c),S=ms(a,35632,M);if(a.attachShader(y,w),a.attachShader(y,S),void 0!==n.index0AttributeName?a.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&a.bindAttribLocation(y,0,"position"),a.linkProgram(y),t.debug.checkShaderErrors){const t=a.getProgramInfoLog(y).trim(),e=a.getShaderInfoLog(w).trim(),n=a.getShaderInfoLog(S).trim();let i=!0,r=!0;if(!1===a.getProgramParameter(y,35714)){i=!1;const e=gs(a,w,"vertex"),n=gs(a,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(y,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:x},fragmentShader:{log:n,prefix:_}})}let T,E;return a.deleteShader(w),a.deleteShader(S),this.getUniforms=function(){return void 0===T&&(T=new ps(a,y)),T},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r0,O=s.clearcoat>0;return{isWebGL2:u,shaderID:T,shaderName:s.type,vertexShader:C,fragmentShader:L,defines:s.defines,customVertexShaderID:P,customFragmentShaderID:D,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:g,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:f,outputEncoding:null===N?t.outputEncoding:!0===N.isXRRenderTarget?N.texture.encoding:at,map:!!s.map,matcap:!!s.matcap,envMap:!!w,envMapMode:w&&w.mapping,envMapCubeUVHeight:S,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===ot,clearcoat:O,clearcoatMap:O&&!!s.clearcoatMap,clearcoatRoughnessMap:O&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:O&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&1===s.blending,alphaMap:!!s.alphaMap,alphaTest:B,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!_,useFog:s.fog,fogExp2:_&&_.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===x.isSkinnedMesh&&E>0,maxBones:E,useVertexTexture:p,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:R,morphTextureStride:I,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection)}(n,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.map&&o.enable(4);e.matcap&&o.enable(5);e.envMap&&o.enable(6);e.lightMap&&o.enable(7);e.aoMap&&o.enable(8);e.emissiveMap&&o.enable(9);e.bumpMap&&o.enable(10);e.normalMap&&o.enable(11);e.objectSpaceNormalMap&&o.enable(12);e.tangentSpaceNormalMap&&o.enable(13);e.clearcoat&&o.enable(14);e.clearcoatMap&&o.enable(15);e.clearcoatRoughnessMap&&o.enable(16);e.clearcoatNormalMap&&o.enable(17);e.displacementMap&&o.enable(18);e.specularMap&&o.enable(19);e.roughnessMap&&o.enable(20);e.metalnessMap&&o.enable(21);e.gradientMap&&o.enable(22);e.alphaMap&&o.enable(23);e.alphaTest&&o.enable(24);e.vertexColors&&o.enable(25);e.vertexAlphas&&o.enable(26);e.vertexUvs&&o.enable(27);e.vertexTangents&&o.enable(28);e.uvsVertexOnly&&o.enable(29);e.fog&&o.enable(30);t.push(o.mask),o.disableAll(),e.useFog&&o.enable(0);e.flatShading&&o.enable(1);e.logarithmicDepthBuffer&&o.enable(2);e.skinning&&o.enable(3);e.useVertexTexture&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.physicallyCorrectLights&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.depthPacking&&o.enable(13);e.dithering&&o.enable(14);e.specularIntensityMap&&o.enable(15);e.specularColorMap&&o.enable(16);e.transmission&&o.enable(17);e.transmissionMap&&o.enable(18);e.thicknessMap&&o.enable(19);e.sheen&&o.enable(20);e.sheenColorMap&&o.enable(21);e.sheenRoughnessMap&&o.enable(22);e.decodeVideoTexture&&o.enable(23);e.opaque&&o.enable(24);t.push(o.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=v[t.type];let n;if(e){const t=Di[e];n=di.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||zs),i.length>1&&i.sort(e||Us),r.length>1&&r.sort(e||Us)}}}function Hs(){let t=new WeakMap;return{get:function(e,n){let i;return!1===t.has(e)?(i=new Fs,t.set(e,[i])):n>=t.get(e).length?(i=new Fs,t.get(e).push(i)):i=t.get(e)[n],i},dispose:function(){t=new WeakMap}}}function Gs(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new se,color:new Wt};break;case"SpotLight":n={position:new se,direction:new se,color:new Wt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new se,color:new Wt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new se,skyColor:new Wt,groundColor:new Wt};break;case"RectAreaLight":n={color:new Wt,position:new se,halfWidth:new se,halfHeight:new se}}return t[e.id]=n,n}}}let ks=0;function Vs(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ws(t,e){const n=new Gs,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Rt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Rt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new se);const s=new se,a=new Oe,o=new Oe;return{setup:function(s,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0;s.sort(Vs);const y=!0!==a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Pi.LTC_FLOAT_1,r.rectAreaLTC2=Pi.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Pi.LTC_HALF_1,r.rectAreaLTC2=Pi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const x=r.hash;x.directionalLength===h&&x.pointLength===u&&x.spotLength===d&&x.rectAreaLength===p&&x.hemiLength===m&&x.numDirectionalShadows===f&&x.numPointShadows===g&&x.numSpotShadows===v||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,x.directionalLength=h,x.pointLength=u,x.spotLength=d,x.rectAreaLength=p,x.hemiLength=m,x.numDirectionalShadows=f,x.numPointShadows=g,x.numSpotShadows=v,r.version=ks++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e=n.get(i).length?(s=new js(t,e),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class Xs extends bn{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Xs.prototype.isMeshDepthMaterial=!0;class Js extends bn{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new se,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}Js.prototype.isMeshDistanceMaterial=!0;function Ys(t,e,n){let i=new Ei;const r=new Rt,s=new Rt,a=new Kt,o=new Xs({depthPacking:3201}),l=new Js,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},p=new pi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Rt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const f=new Vn;f.setAttribute("position",new Tn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new oi(f,p),v=this;function y(n,i){const r=e.update(g);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,m.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,p,g,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,m,g,null)}function x(e,n,i,r,s,a){let h=null;const d=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(h=void 0!==d?d:!0===i.isPointLight?l:o,t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=h.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=h.clone(),i[e]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=3===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=s),h}function _(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/m.x),r.x=s.x*m.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/m.y),r.y=s.y*m.y,u.mapSize.y=s.y)),null!==u.map||u.isPointLightShadow||3!==this.type||(u.map=new Qt(r.x,r.y),u.map.texture.name=c.name+".shadowMap",u.mapPass=new Qt(r.x,r.y),u.camera.updateProjectionMatrix()),null===u.map){const t={minFilter:d,magFilter:d,format:S};u.map=new Qt(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t=1):-1!==L.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),R=C>=2);let P=null,D={};const I=t.getParameter(3088),N=t.getParameter(2978),B=(new Kt).fromArray(I),O=(new Kt).fromArray(N);function z(e,n,i){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;ei||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Et:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===I&&(I=O(s,a));const o=n?O(s,a):I;o.width=s,o.height=a;return o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function U(t){return St(t.width)&&St(t.height)}function F(t,e){return t.generateMipmaps&&e&&t.minFilter!==d&&t.minFilter!==f}function H(e){t.generateMipmap(e)}function G(n,i,r,s,a=!1){if(!1===o)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=s===ot&&!1===a?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function k(t,e,n){return!0===F(t,n)||t.isFramebufferTexture&&t.minFilter!==d&&t.minFilter!==f?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function V(t){return t===d||t===p||t===m?9728:9729}function W(t){const e=t.target;e.removeEventListener("dispose",W),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=N.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&q(t),0===Object.keys(r).length&&N.delete(n)}i.remove(t)}(e),e.isVideoTexture&&D.delete(e)}function j(e){const n=e.target;n.removeEventListener("dispose",j),function(e){const n=e.texture,r=i.get(e),s=i.get(n);void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e0&&r.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void $(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}const Y={[c]:10497,[h]:33071,[u]:33648},Z={[d]:9728,[p]:9984,[m]:9986,[f]:9729,[g]:9985,[v]:9987};function K(n,s,a){if(a?(t.texParameteri(n,10242,Y[s.wrapS]),t.texParameteri(n,10243,Y[s.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,Y[s.wrapR]),t.texParameteri(n,10240,Z[s.magFilter]),t.texParameteri(n,10241,Z[s.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),s.wrapS===h&&s.wrapT===h||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,V(s.magFilter)),t.texParameteri(n,10241,V(s.minFilter)),s.minFilter!==d&&s.minFilter!==f&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(s.type===b&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&s.type===M&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function Q(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",W));const r=n.source;let s=N.get(r);void 0===s&&(s={},N.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(n);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&q(n)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return i}function $(e,i,r){let a=3553;i.isDataArrayTexture&&(a=35866),i.isData3DTexture&&(a=32879);const l=Q(e,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(a,e.__webglTexture),c.version!==c.__currentVersion||!0===l){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const r=function(t){return!o&&(t.wrapS!==h||t.wrapT!==h||t.minFilter!==d&&t.minFilter!==f)}(i)&&!1===U(i.image);let l=z(i.image,r,!1,R);l=st(i,l);const u=U(l)||o,p=s.convert(i.format,i.encoding);let m,g=s.convert(i.type),v=G(i.internalFormat,p,g,i.encoding,i.isVideoTexture);K(a,i,u);const y=i.mipmaps,M=o&&!0!==i.isVideoTexture,A=void 0===e.__version,C=k(i,l,u);if(i.isDepthTexture)v=6402,o?v=i.type===b?36012:i.type===_?33190:i.type===w?35056:33189:i.type===b&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===T&&6402===v&&i.type!==x&&i.type!==_&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=x,g=s.convert(i.type)),i.format===E&&6402===v&&(v=34041,i.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=w,g=s.convert(i.type))),M&&A?n.texStorage2D(3553,1,v,l.width,l.height):n.texImage2D(3553,0,v,l.width,l.height,0,p,g,null);else if(i.isDataTexture)if(y.length>0&&u){M&&A&&n.texStorage2D(3553,C,v,y[0].width,y[0].height);for(let t=0,e=y.length;t0&&u){M&&A&&n.texStorage2D(3553,C,v,y[0].width,y[0].height);for(let t=0,e=y.length;t0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function st(t,n){const i=t.encoding,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===mt||i!==at&&(i===ot?!1===o?!0===e.has("EXT_sRGB")&&r===S?(t.format=mt,t.minFilter=f,t.generateMipmaps=!1):n=qt.sRGBToLinear(n):r===S&&s===y||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const t=X;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),X+=1,t},this.resetTextureUnits=function(){X=0},this.setTexture2D=J,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?$(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?$(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;const a=Q(e,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),l.version!==l.__currentVersion||!0===a){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,a=i.image[0]&&i.image[0].isDataTexture,c=[];for(let t=0;t<6;t++)c[t]=r||a?a?i.image[t].image:i.image[t]:z(i.image[t],!1,!0,A),c[t]=st(i,c[t]);const h=c[0],u=U(h)||o,d=s.convert(i.format,i.encoding),p=s.convert(i.type),m=G(i.internalFormat,d,p,i.encoding),f=o&&!0!==i.isVideoTexture,g=void 0===e.__version;let v,y=k(i,h,u);if(K(34067,i,u),r){f&&g&&n.texStorage2D(34067,y,m,h.width,h.height);for(let t=0;t<6;t++){v=c[t].mipmaps;for(let e=0;e0&&y++,n.texStorage2D(34067,y,m,c[0].width,c[0].height));for(let t=0;t<6;t++)if(a){f?n.texSubImage2D(34069+t,0,0,0,c[t].width,c[t].height,d,p,c[t].data):n.texImage2D(34069+t,0,m,c[t].width,c[t].height,0,d,p,c[t].data);for(let e=0;e0&&!1===rt(e)){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),a=G(l.internalFormat,i,r,l.encoding),o=it(e);t.renderbufferStorageMultisample(36161,o,a,e.width,e.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),et(c.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),K(34067,l,p);for(let t=0;t<6;t++)tt(c.__webglFramebuffer[t],e,l,36064,34069+t);F(l,p)&&H(34067),n.unbindTexture()}else if(d){const t=e.texture;for(let r=0,s=t.length;r0&&!1===rt(e)){const r=e.width,s=e.height;let a=16384;const o=[36064],l=e.stencilBuffer?33306:36096;e.depthBuffer&&o.push(l);const c=i.get(e),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),t.blitFramebuffer(0,0,r,s,0,0,r,s,a,9728),P&&t.invalidateFramebuffer(36008,o),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=nt,this.setupFrameBufferTexture=tt,this.useMultisampledRTT=rt}function Qs(t,e,n){const i=n.isWebGL2;return{convert:function(t,n=null){let r;if(t===y)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1010===t)return 5120;if(1011===t)return 5122;if(t===x)return 5123;if(1013===t)return 5124;if(t===_)return 5125;if(t===b)return 5126;if(t===M)return i?5131:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===S)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===T)return 6402;if(t===E)return 34041;if(1028===t)return 6403;if(1022===t)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(t===mt)return r=e.get("EXT_sRGB"),null!==r?r.SRGB_ALPHA_EXT:null;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1033===t)return 36249;if(t===A||t===R||t===C||t===L)if(n===ot){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(t===A)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(t===R)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(t===C)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(t===L)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(t===A)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===R)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===C)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===L)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===P||t===D||t===I||t===N){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(t===P)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===D)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===I)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===N)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(t===B||t===O){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(t===B)return n===ot?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(t===O)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(t===z||t===U||t===F||t===H||t===G||t===k||t===V||t===W||t===j||t===q||t===X||t===J||t===Y||t===Z){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(t===z)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(t===U)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(t===F)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(t===H)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(t===G)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(t===k)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(t===V)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(t===W)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(t===j)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(t===q)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(t===X)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(t===J)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(t===Y)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(t===Z)return n===ot?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(t===K){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(t===K)return n===ot?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}return t===w?i?34042:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class $s extends fi{constructor(t=[]){super(),this.cameras=t}}$s.prototype.isArrayCamera=!0;class ta extends ln{constructor(){super(),this.type="Group"}}ta.prototype.isGroup=!0;const ea={type:"move"};class na{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ta,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ta,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new se,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new se),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ta,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new se,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new se),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ea))),l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new ta;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class ia extends Zt{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:T)!==T&&c!==E)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===T&&(n=x),void 0===n&&c===E&&(n=w),super(null,i,r,s,a,o,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:d,this.minFilter=void 0!==o?o:d,this.flipY=!1,this.generateMipmaps=!1}}ia.prototype.isDepthTexture=!0;class ra extends ft{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=null,l=null,c=null,h=null,u=null;const d=e.getContextAttributes();let p=null,m=null;const f=[],g=new Map,v=new fi;v.layers.enable(1),v.viewport=new Kt;const _=new fi;_.layers.enable(2),_.viewport=new Kt;const b=[v,_],M=new $s;M.layers.enable(1),M.layers.enable(2);let A=null,R=null;function C(t){const e=g.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function L(){g.forEach((function(t,e){t.disconnect(e)})),g.clear(),A=null,R=null,t.setRenderTarget(p),h=null,c=null,l=null,i=null,m=null,O.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function P(t){const e=i.inputSources;for(let t=0;t0&&(n.alphaTest.value=i.alphaTest);const r=e.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*e}let s,a;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.roughnessMap?s=i.roughnessMap:i.metalnessMap?s=i.metalnessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap?s=i.emissiveMap:i.clearcoatMap?s=i.clearcoatMap:i.clearcoatNormalMap?s=i.clearcoatNormalMap:i.clearcoatRoughnessMap?s=i.clearcoatRoughnessMap:i.specularIntensityMap?s=i.specularIntensityMap:i.specularColorMap?s=i.specularColorMap:i.transmissionMap?s=i.transmissionMap:i.thicknessMap?s=i.thicknessMap:i.sheenColorMap?s=i.sheenColorMap:i.sheenRoughnessMap&&(s=i.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uvTransform.value.copy(s.matrix)),i.aoMap?a=i.aoMap:i.lightMap&&(a=i.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,s,a){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(t,i):i.isMeshToonMaterial?(n(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,i)):i.isMeshPhongMaterial?(n(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,i)):i.isMeshStandardMaterial?(n(t,i),function(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap);n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,i),i.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,a)):i.isMeshMatcapMaterial?(n(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,i)):i.isMeshDepthMaterial?n(t,i):i.isMeshDistanceMaterial?(n(t,i),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?n(t,i):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,s):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function aa(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=It("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0===t.depth||t.depth,r=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,o=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let h;h=void 0!==t.context?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let u=null,d=null;const p=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=at,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const f=this;let g=!1,x=0,_=0,w=null,T=-1,E=null;const A=new Kt,R=new Kt;let C=null,L=e.width,P=e.height,D=1,I=null,N=null;const B=new Kt(0,0,L,P),O=new Kt(0,0,L,P);let z=!1;const U=new Ei;let F=!1,H=!1,G=null;const k=new Oe,V=new Rt,W=new se,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===w?D:1}let X,J,Y,Z,K,Q,$,tt,et,nt,it,rt,st,ot,lt,ct,ht,ut,dt,pt,mt,ft,gt,vt=n;function yt(t,n){for(let i=0;i0&&function(t,e,n){const i=J.isWebGL2;null===G&&(G=new Qt(1,1,{generateMipmaps:!0,type:null!==ft.convert(M)?M:y,minFilter:v,samples:i&&!0===s?4:0}));f.getDrawingBufferSize(V),i?G.setSize(V.x,V.y):G.setSize(Et(V.x),Et(V.y));const r=f.getRenderTarget();f.setRenderTarget(G),f.clear();const a=f.toneMapping;f.toneMapping=0,Dt(t,e,n),f.toneMapping=a,Q.updateMultisampleRenderTarget(G),Q.updateRenderTargetMipmap(G),f.setRenderTarget(r)}(r,e,n),i&&Y.viewport(A.copy(i)),r.length>0&&Dt(r,e,n),a.length>0&&Dt(a,e,n),o.length>0&&Dt(o,e,n),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Dt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?m[m.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){K.get(t.texture).__webglTexture=e,K.get(t.depthTexture).__webglTexture=n;const i=K.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===X.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=K.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){w=t,x=e,_=n;let i=!0;if(t){const e=K.get(t);void 0!==e.__useDefaultFramebuffer?(Y.bindFramebuffer(36160,null),i=!1):void 0===e.__webglFramebuffer?Q.setupRenderTarget(t):e.__hasExternalTextures&&Q.rebindTextures(t,K.get(t.texture).__webglTexture,K.get(t.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(a=!0);const i=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],s=!0):r=J.isWebGL2&&t.samples>0&&!1===Q.useMultisampledRTT(t)?K.get(t).__webglMultisampledFramebuffer:i,A.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else A.copy(B).multiplyScalar(D).floor(),R.copy(O).multiplyScalar(D).floor(),C=z;if(Y.bindFramebuffer(36160,r)&&J.drawBuffers&&i&&Y.drawBuffers(t,r),Y.viewport(A),Y.scissor(R),Y.setScissorTest(C),s){const i=K.get(t.texture);vt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(a){const i=K.get(t.texture),r=e||0;vt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}T=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Y.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==S&&ft.convert(o)!==vt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===M&&(X.has("EXT_color_buffer_half_float")||J.isWebGL2&&X.has("EXT_color_buffer_float"));if(!(l===y||ft.convert(l)===vt.getParameter(35738)||l===b&&(J.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&vt.readPixels(e,n,i,r,ft.convert(o),ft.convert(l),s)}finally{const t=null!==w?K.get(w).__webglFramebuffer:null;Y.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){if(!0!==e.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);Q.setTexture2D(e,0),vt.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,s),Y.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=ft.convert(n.format),o=ft.convert(n.type);Q.setTexture2D(n,0),vt.pixelStorei(37440,n.flipY),vt.pixelStorei(37441,n.premultiplyAlpha),vt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?vt.texSubImage2D(3553,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?vt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):vt.texSubImage2D(3553,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&vt.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=ft.convert(i.format),c=ft.convert(i.type);let h;if(i.isData3DTexture)Q.setTexture3D(i,0),h=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Q.setTexture2DArray(i,0),h=35866}vt.pixelStorei(37440,i.flipY),vt.pixelStorei(37441,i.premultiplyAlpha),vt.pixelStorei(3317,i.unpackAlignment);const u=vt.getParameter(3314),d=vt.getParameter(32878),p=vt.getParameter(3316),m=vt.getParameter(3315),g=vt.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;vt.pixelStorei(3314,v.width),vt.pixelStorei(32878,v.height),vt.pixelStorei(3316,t.min.x),vt.pixelStorei(3315,t.min.y),vt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?vt.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),vt.compressedTexSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,v.data)):vt.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,v),vt.pixelStorei(3314,u),vt.pixelStorei(32878,d),vt.pixelStorei(3316,p),vt.pixelStorei(3315,m),vt.pixelStorei(32877,g),0===r&&i.generateMipmaps&&vt.generateMipmap(h),Y.unbindTexture()},this.initTexture=function(t){Q.setTexture2D(t,0),Y.unbindTexture()},this.resetState=function(){x=0,_=0,w=null,Y.reset(),gt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}aa.prototype.isWebGLRenderer=!0;class oa extends aa{}oa.prototype.isWebGL1Renderer=!0;class la{constructor(t,e=25e-5){this.name="",this.color=new Wt(t),this.density=e}clone(){return new la(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}la.prototype.isFogExp2=!0;class ca{constructor(t,e=1,n=1e3){this.name="",this.color=new Wt(t),this.near=e,this.far=n}clone(){return new ca(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ca.prototype.isFog=!0;class ha extends ln{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}ha.prototype.isScene=!0;class ua{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ut,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=_t()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:ga.clone(),uv:xn.getUV(ga,Ma,wa,Sa,Ta,Ea,Aa,new Rt),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ca(t,e,n,i,r,s){xa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(_a.x=s*xa.x-r*xa.y,_a.y=r*xa.x+s*xa.y):_a.copy(xa),t.copy(e),t.x+=_a.x,t.y+=_a.y,t.applyMatrix4(ba)}Ra.prototype.isSprite=!0;const La=new se,Pa=new se;class Da extends ln{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t0){let n,i;for(n=1,i=e.length;n0){La.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(La);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){La.setFromMatrixPosition(t.matrixWorld),Pa.setFromMatrixPosition(this.matrixWorld);const n=La.distanceTo(Pa)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;io)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);dt.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;no)continue;u.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(u);it.far||e.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}no.prototype.isLine=!0;const io=new se,ro=new se;class so extends no{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function mo(t,e,n,i,r,s,a){const o=co.distanceSqToPoint(t);if(or.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}po.prototype.isPoints=!0;class fo extends Zt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.minFilter=void 0!==s?s:f,this.magFilter=void 0!==r?r:f,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}fo.prototype.isVideoTexture=!0;class go extends Zt{constructor(t,e,n){super({width:t,height:e}),this.format=n,this.magFilter=d,this.minFilter=d,this.generateMipmaps=!1,this.needsUpdate=!0}}go.prototype.isFramebufferTexture=!0;class vo extends Zt{constructor(t,e,n,i,r,s,a,o,l,c,h,u){super(null,s,a,o,l,c,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}vo.prototype.isCompressedTexture=!0;class yo extends Zt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.needsUpdate=!0}}yo.prototype.isCanvasTexture=!0;class xo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Rt:new se);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new se,i=[],r=[],s=[],a=new se,o=new Oe;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new se)}r[0]=new se,s[0]=new se;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(bt(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(bt(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class _o extends xo{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new Rt,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(wo.subVectors(i[0],i[1]).add(i[0]),a=wo);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Ro(a,o.x,l.x,c.x,h.x),Ro(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Go extends Vn{constructor(t=[new Rt(0,.5),new Rt(.5,0),new Rt(0,-.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=bt(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],l=[],c=1/e,h=new se,u=new Rt,d=new se,p=new se,m=new se;let f=0,g=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),o.push(d.x,d.y,d.z),m.copy(p)}for(let r=0;r<=e;r++){const d=n+r*c*i,p=Math.sin(d),m=Math.cos(d);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*p,h.y=t[n].y,h.z=t[n].x*m,s.push(h.x,h.y,h.z),u.x=r/e,u.y=n/(t.length-1),a.push(u.x,u.y);const i=o[3*n+0]*p,c=o[3*n+1],d=o[3*n+0]*m;l.push(i,c,d)}}for(let n=0;n0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Nn(h,3)),this.setAttribute("normal",new Nn(u,3)),this.setAttribute("uv",new Nn(d,2))}static fromJSON(t){return new Wo(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class jo extends Wo{constructor(t=1,e=1,n=8,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new jo(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class qo extends Vn{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=t.clone().lerp(n,i/r),o=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/l)}for(let t=0;t.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Nn(r,3)),this.setAttribute("normal",new Nn(r.slice(),3)),this.setAttribute("uv",new Nn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new qo(t.vertices,t.indices,t.radius,t.details)}}class Xo extends qo{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Xo(t.radius,t.detail)}}const Jo=new se,Yo=new se,Zo=new se,Ko=new xn;class Qo extends Vn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(yt*e),s=t.getIndex(),a=t.getAttribute("position"),o=s?s.count:a.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t80*n){o=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?1/p:0}return il(s,a,n,o,l,p),a};function el(t,e,n,i,r){let s,a;if(r===function(t,e,n,i){let r=0;for(let s=e,a=n-i;s0)for(s=e;s=e;s-=i)a=Ml(s,t[s],t[s+1],a);return a&&gl(a,a.next)&&(wl(a),a=a.next),a}function nl(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!gl(i,i.next)&&0!==fl(i.prev,i,i.next))i=i.next;else{if(wl(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function il(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=ul(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,s);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?sl(t,i,r,s):rl(t))e.push(o.i/n),e.push(t.i/n),e.push(l.i/n),wl(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?il(t=al(nl(t),e,n),e,n,i,r,s,2):2===a&&ol(t,e,n,i,r,s):il(nl(t),e,n,i,r,s,1);break}}function rl(t){const e=t.prev,n=t,i=t.next;if(fl(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(pl(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&fl(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function sl(t,e,n,i){const r=t.prev,s=t,a=t.next;if(fl(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,h=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,u=ul(o,l,e,n,i),d=ul(c,h,e,n,i);let p=t.prevZ,m=t.nextZ;for(;p&&p.z>=u&&m&&m.z<=d;){if(p!==t.prev&&p!==t.next&&pl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&fl(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&pl(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&fl(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&pl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&fl(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==t.prev&&m!==t.next&&pl(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&fl(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function al(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!gl(r,s)&&vl(r,i,i.next,s)&&_l(r,s)&&_l(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),wl(i),wl(i.next),i=t=s),i=i.next}while(i!==t);return nl(i)}function ol(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&ml(a,t)){let o=bl(a,t);return a=nl(a,a.next),o=nl(o,o.next),il(a,e,n,i,r,s),void il(o,e,n,i,r,s)}t=t.next}a=a.next}while(a!==t)}function ll(t,e){return t.x-e.x}function cl(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let s,a=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>a){if(a=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&pl(rs.x||n.x===s.x&&hl(s,n)))&&(s=n,u=h)),n=n.next}while(n!==o);return s}(t,e),e){const n=bl(e,t);nl(e,e.next),nl(n,n.next)}}function hl(t,e){return fl(t.prev,t,e.prev)<0&&fl(e.next,t,t.next)<0}function ul(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function dl(t){let e=t,n=t;do{(e.x=0&&(t-a)*(i-o)-(n-a)*(e-o)>=0&&(n-a)*(s-o)-(r-a)*(i-o)>=0}function ml(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&vl(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(_l(t,e)&&_l(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(fl(t.prev,t,e.prev)||fl(t,e.prev,e))||gl(t,e)&&fl(t.prev,t,t.next)>0&&fl(e.prev,e,e.next)>0)}function fl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function gl(t,e){return t.x===e.x&&t.y===e.y}function vl(t,e,n,i){const r=xl(fl(t,e,n)),s=xl(fl(t,e,i)),a=xl(fl(n,i,t)),o=xl(fl(n,i,e));return r!==s&&a!==o||(!(0!==r||!yl(t,n,e))||(!(0!==s||!yl(t,i,e))||(!(0!==a||!yl(n,t,i))||!(0!==o||!yl(n,e,i)))))}function yl(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function xl(t){return t>0?1:t<0?-1:0}function _l(t,e){return fl(t.prev,t,t.next)<0?fl(t,e,t.next)>=0&&fl(t,t.prev,e)>=0:fl(t,e,t.prev)<0||fl(t,t.next,e)<0}function bl(t,e){const n=new Sl(t.i,t.x,t.y),i=new Sl(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Ml(t,e,n,i){const r=new Sl(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function wl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Sl(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Tl{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Al(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,m=e.y+a/u,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-t.x,r=m+o*f-t.y;const g=i*i+r*r;if(g<=2)return new Rt(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Rt(i/s,r/s)}const P=[];for(let t=0,e=E.length,n=e-1,i=t+1;t=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t0)&&d.push(e,r,l),(t!==n-1||o0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}jl.prototype.isMeshPhysicalMaterial=!0;class ql extends bn{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Wt(16777215),this.specular=new Wt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}ql.prototype.isMeshPhongMaterial=!0;class Xl extends bn{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Wt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Xl.prototype.isMeshToonMaterial=!0;class Jl extends bn{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Jl.prototype.isMeshNormalMaterial=!0;class Yl extends bn{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Wt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Yl.prototype.isMeshLambertMaterial=!0;class Zl extends bn{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Wt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Zl.prototype.isMeshMatcapMaterial=!0;class Kl extends Za{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Kl.prototype.isLineDashedMaterial=!0;const Ql={ShadowMaterial:kl,SpriteMaterial:ma,RawShaderMaterial:Vl,ShaderMaterial:pi,PointsMaterial:oo,MeshPhysicalMaterial:jl,MeshStandardMaterial:Wl,MeshPhongMaterial:ql,MeshToonMaterial:Xl,MeshNormalMaterial:Jl,MeshLambertMaterial:Yl,MeshDepthMaterial:Xs,MeshDistanceMaterial:Js,MeshBasicMaterial:Mn,MeshMatcapMaterial:Zl,LineDashedMaterial:Kl,LineBasicMaterial:Za,Material:bn};bn.fromType=function(t){return new Ql[t]};const $l={arraySlice:function(t,e,n){return $l.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const a=[];for(let t=0;t=i)){l.push(e.times[t]);for(let n=0;ns.tracks[t].times[0]&&(o=s.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*l+o,e=t+l-o;d=$l.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=o,n=l-o;t.evaluate(s),d=$l.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new re).fromArray(d).normalize().conjugate().toArray(d)}const p=a.times.length;for(let t=0;t=r)break t;{const a=e[1];t=r)break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=$l.arraySlice(n,r,s),this.values=$l.arraySlice(this.values,r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&$l.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=$l.arraySlice(this.times),e=$l.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===tt,r=t.length-1;let s=1;for(let a=1;a0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=$l.arraySlice(t,0,s),this.values=$l.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=$l.arraySlice(this.times,0),e=$l.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}rc.prototype.TimeBufferType=Float32Array,rc.prototype.ValueBufferType=Float32Array,rc.prototype.DefaultInterpolation=$;class sc extends rc{}sc.prototype.ValueTypeName="bool",sc.prototype.ValueBufferType=Array,sc.prototype.DefaultInterpolation=Q,sc.prototype.InterpolantFactoryMethodLinear=void 0,sc.prototype.InterpolantFactoryMethodSmooth=void 0;class ac extends rc{}ac.prototype.ValueTypeName="color";class oc extends rc{}oc.prototype.ValueTypeName="number";class lc extends tc{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let t=l+a;l!==t;l+=4)re.slerpFlat(r,0,s,l-a,s,l,o);return r}}class cc extends rc{InterpolantFactoryMethodLinear(t){return new lc(this.times,this.values,this.getValueSize(),t)}}cc.prototype.ValueTypeName="quaternion",cc.prototype.DefaultInterpolation=$,cc.prototype.InterpolantFactoryMethodSmooth=void 0;class hc extends rc{}hc.prototype.ValueTypeName="string",hc.prototype.ValueBufferType=Array,hc.prototype.DefaultInterpolation=Q,hc.prototype.InterpolantFactoryMethodLinear=void 0,hc.prototype.InterpolantFactoryMethodSmooth=void 0;class uc extends rc{}uc.prototype.ValueTypeName="vector";class dc{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=_t(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(pc(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(rc.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];$l.flattenJSON(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==yc[t])return void yc[t].push({onLoad:e,onProgress:n,onError:i});yc[t]=[],yc[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=yc[t],i=e.body.getReader(),r=e.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{mc.add(t,e);const n=yc[t];delete yc[t];for(let t=0,i=n.length;t{const n=yc[t];if(void 0===n)throw this.manager.itemError(t),e;delete yc[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class _c extends vc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=mc.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=It("img");function o(){c(),mc.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class bc extends vc{constructor(t){super(t)}load(t,e,n,i){const r=new yi,s=new _c(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(t[n],(function(t){r.images[n]=t,a++,6===a&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new Wt).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Rt).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new se).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Kt).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Ct).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Oe).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Rt).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Rt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}}class Wc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){re.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;re.multiplyQuaternionsFlat(t,s,t,e,t,n),re.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const yh="\\[\\]\\.:\\/",xh=new RegExp("[\\[\\]\\.:\\/]","g"),_h="[^\\[\\]\\.:\\/]",bh="[^"+yh.replace("\\.","")+"]",Mh=/((?:WC+[\/:])*)/.source.replace("WC",_h),wh=/(WCOD+)?/.source.replace("WCOD",bh),Sh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_h),Th=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_h),Eh=new RegExp("^"+Mh+wh+Sh+Th+"$"),Ah=["material","materials","bones"];class Rh{constructor(t,e,n){this.path=e,this.parsedPath=n||Rh.parseTrackName(e),this.node=Rh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Rh.Composite(t,e,n):new Rh(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(xh,"")}static parseTrackName(t){const e=Eh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Ah.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[o]=s,t[s]=a;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),a.push(e),r.push(h);for(let n=c,i=o.length;n!==i;++n){const i=o[n];h[n]=new Rh(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];e[t[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}Ch.prototype.isAnimationObjectGroup=!0;class Lh{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:et,endingEnd:et};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===st)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r?i:s&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=nt,i.endingEnd=nt):(i.endingStart=t?this.zeroSlopeAtStart?nt:et:it,i.endingEnd=e?this.zeroSlopeAtEnd?nt:et:it)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}class Ph extends ft{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new vh(Rh.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a){e[a]._update(i,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;tthis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return zh.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Uh.prototype.isBox2=!0;const Fh=new se,Hh=new se;class Gh{constructor(t=new se,e=new se){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Fh.subVectors(t,this.start),Hh.subVectors(this.end,this.start);const n=Hh.dot(Hh);let i=Hh.dot(Fh)/n;return e&&(i=bt(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const kh=new se;const Vh=new se,Wh=new Oe,jh=new Oe;class qh extends so{constructor(t){const e=Xh(t),n=new Vn,i=[],r=[],s=new Wt(0,0,1),a=new Wt(0,1,0);for(let t=0;t>-e-14,pu[256|t]=1024>>-e-14|32768,mu[t]=-e-1,mu[256|t]=-e-1):e<=15?(pu[t]=e+15<<10,pu[256|t]=e+15<<10|32768,mu[t]=13,mu[256|t]=13):e<128?(pu[t]=31744,pu[256|t]=64512,mu[t]=24,mu[256|t]=24):(pu[t]=31744,pu[256|t]=64512,mu[t]=13,mu[256|t]=13)}const fu=new Uint32Array(2048),gu=new Uint32Array(64),vu=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;0==(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,fu[t]=e|n}for(let t=1024;t<2048;++t)fu[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)gu[t]=t<<23;gu[31]=1199570944,gu[32]=2147483648;for(let t=33;t<63;++t)gu[t]=2147483648+(t-32<<23);gu[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(vu[t]=1024);xo.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(xo.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Ho.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)};Kh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},qh.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};vc.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Wc.extractUrlBase(t)},vc.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Uh.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Uh.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Uh.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Uh.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},le.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},le.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},le.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},le.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},le.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},qe.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},Ae.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ei.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Gh.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Ct.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Ct.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Ct.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Ct.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Ct.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Ct.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Oe.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Oe.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Oe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new se).setFromMatrixColumn(this,3)},Oe.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Oe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Oe.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Oe.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Oe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Oe.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Oe.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Oe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Oe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Oe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Oe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Oe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Oe.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Oe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Oe.prototype.makeFrustum=function(t,e,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,s)},Oe.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wi.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},re.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},re.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Be.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Be.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},Be.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},xn.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},xn.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},xn.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},xn.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},xn.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},xn.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),xn.getBarycoord(t,e,n,i,r)},xn.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),xn.getNormal(t,e,n,i)},$o.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},$o.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Rl(this,t)},$o.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Il(this,t)},Rt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Rt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Rt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},se.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},se.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},se.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},se.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},se.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},se.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},se.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},se.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},se.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Kt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Kt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ln.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},ln.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ln.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},ln.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ln.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ln.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),oi.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(oi.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ua.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},fi.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Sc.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(Tn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===dt},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(dt)}}}),Tn.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?dt:ut),this},Tn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Tn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Vn.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Vn.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new Tn(arguments[1],arguments[2])))},Vn.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},Vn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Vn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Vn.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Vn.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Vn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),ua.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?dt:ut),this},ua.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Rl.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Rl.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Rl.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ha.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Dh.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(bn.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Wt}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(pi.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),aa.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},aa.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},aa.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},aa.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},aa.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},aa.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},aa.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},aa.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},aa.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},aa.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},aa.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},aa.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},aa.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},aa.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},aa.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},aa.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},aa.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},aa.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},aa.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},aa.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},aa.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},aa.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},aa.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},aa.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},aa.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(aa.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?ot:at}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Ys.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(Qt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),uh.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new $c).load(t,(function(t){e.setBuffer(t)})),this},gh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},vi.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},vi.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},qt.crossOrigin=void 0,qt.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new wc;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},qt.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new bc;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},qt.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},qt.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const yu={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e),t.ACESFilmicToneMapping=4,t.AddEquation=n,t.AddOperation=2,t.AdditiveAnimationBlendMode=st,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Fc,t.AmbientLightProbe=eh,t.AnimationClip=dc,t.AnimationLoader=class extends vc{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new xc(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{au.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(au,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}},t.Audio=uh,t.AudioAnalyser=gh,t.AudioContext=Qc,t.AudioListener=class extends ln{constructor(){super(),this.type="AudioListener",this.context=Qc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new sh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(oh,lh,ch),hh.set(0,0,-1).applyQuaternion(lh),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(oh.x,t),e.positionY.linearRampToValueAtTime(oh.y,t),e.positionZ.linearRampToValueAtTime(oh.z,t),e.forwardX.linearRampToValueAtTime(hh.x,t),e.forwardY.linearRampToValueAtTime(hh.y,t),e.forwardZ.linearRampToValueAtTime(hh.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(oh.x,oh.y,oh.z),e.setOrientation(hh.x,hh.y,hh.z,n.x,n.y,n.z)}},t.AudioLoader=$c,t.AxesHelper=cu,t.AxisHelper=class extends cu{constructor(t){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(t)}},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.BinaryTextureLoader=class extends Mc{constructor(t){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(t)}},t.Bone=Fa,t.BooleanKeyframeTrack=sc,t.BoundingBoxHelper=class extends su{constructor(t,e){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(t,e)}},t.Box2=Uh,t.Box3=le,t.Box3Helper=class extends so{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Vn;i.setIndex(new Tn(n,1)),i.setAttribute("position",new Nn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new Za({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}},t.BoxBufferGeometry=ci,t.BoxGeometry=ci,t.BoxHelper=su,t.BufferAttribute=Tn,t.BufferGeometry=Vn,t.BufferGeometryLoader=qc,t.ByteType=1010,t.Cache=mc,t.Camera=mi,t.CameraHelper=class extends so{constructor(t){const e=new Vn,n=new Za({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},a=new Wt(16755200),o=new Wt(16711680),l=new Wt(43775),c=new Wt(16777215),h=new Wt(3355443);function u(t,e,n){d(t,n),d(e,n)}function d(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",o),u("p","n2",o),u("p","n3",o),u("p","n4",o),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),e.setAttribute("position",new Nn(i,3)),e.setAttribute("color",new Nn(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){const t=this.geometry,e=this.pointMap;nu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),iu("c",e,t,nu,0,0,-1),iu("t",e,t,nu,0,0,1),iu("n1",e,t,nu,-1,-1,-1),iu("n2",e,t,nu,1,-1,-1),iu("n3",e,t,nu,-1,1,-1),iu("n4",e,t,nu,1,1,-1),iu("f1",e,t,nu,-1,-1,1),iu("f2",e,t,nu,1,-1,1),iu("f3",e,t,nu,-1,1,1),iu("f4",e,t,nu,1,1,1),iu("u1",e,t,nu,.7,1.1,-1),iu("u2",e,t,nu,-.7,1.1,-1),iu("u3",e,t,nu,0,2,-1),iu("cf1",e,t,nu,-1,0,1),iu("cf2",e,t,nu,1,0,1),iu("cf3",e,t,nu,0,-1,1),iu("cf4",e,t,nu,0,1,1),iu("cn1",e,t,nu,-1,0,-1),iu("cn2",e,t,nu,1,0,-1),iu("cn3",e,t,nu,0,-1,-1),iu("cn4",e,t,nu,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=yo,t.CapsuleBufferGeometry=ko,t.CapsuleGeometry=ko,t.CatmullRomCurve3=Ao,t.CineonToneMapping=3,t.CircleBufferGeometry=Vo,t.CircleGeometry=Vo,t.ClampToEdgeWrapping=h,t.Clock=sh,t.Color=Wt,t.ColorKeyframeTrack=ac,t.ColorManagement=zt,t.CompressedTexture=vo,t.CompressedTextureLoader=class extends vc{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],a=new vo,o=new xc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=f),a.image=s,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=bt(t,-65504,65504),uu[0]=t;const e=du[0],n=e>>23&511;return pu[n]+((8388607&e)>>mu[n])}static fromHalfFloat(t){const e=t>>10;return du[0]=fu[vu[e]+(1023&t)]+gu[e],uu[0]}},t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=gc,t.DepthFormat=T,t.DepthStencilFormat=E,t.DepthTexture=ia,t.DirectionalLight=Uc,t.DirectionalLightHelper=class extends ln{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new Vn;i.setAttribute("position",new Nn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new Za({fog:!1,toneMapped:!1});this.lightPlane=new no(i,r),this.add(this.lightPlane),i=new Vn,i.setAttribute("position",new Nn([0,0,0,0,0,1],3)),this.targetLine=new no(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Qh.setFromMatrixPosition(this.light.matrixWorld),$h.setFromMatrixPosition(this.light.target.matrixWorld),tu.subVectors($h,Qh),this.lightPlane.lookAt($h),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt($h),this.targetLine.scale.z=tu.length()}},t.DiscreteInterpolant=ic,t.DodecahedronBufferGeometry=Xo,t.DodecahedronGeometry=Xo,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicBufferAttribute=class extends Tn{constructor(t,e){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(t,e),this.setUsage(dt)}},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=dt,t.DynamicReadUsage=35049,t.EdgesGeometry=Qo,t.EdgesHelper=class extends so{constructor(t,e){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new Qo(t.geometry),new Za({color:void 0!==e?e:16777215}))}},t.EllipseCurve=_o,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=a,t.EquirectangularRefractionMapping=o,t.Euler=qe,t.EventDispatcher=ft,t.ExtrudeBufferGeometry=Rl,t.ExtrudeGeometry=Rl,t.FaceColors=1,t.FileLoader=xc,t.FlatShading=1,t.Float16BufferAttribute=In,t.Float32Attribute=class extends Nn{constructor(t,e){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(t,e)}},t.Float32BufferAttribute=Nn,t.Float64Attribute=class extends Bn{constructor(t,e){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(t,e)}},t.Float64BufferAttribute=Bn,t.FloatType=b,t.Fog=ca,t.FogExp2=la,t.Font=function(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")},t.FontLoader=function(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")},t.FramebufferTexture=go,t.FrontSide=0,t.Frustum=Ei,t.GLBufferAttribute=Nh,t.GLSL1="100",t.GLSL3=pt,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=Kh,t.Group=ta,t.HalfFloatType=M,t.HemisphereLight=Tc,t.HemisphereLightHelper=class extends ln{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Pl(e);i.rotateY(.5*Math.PI),this.material=new Mn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new Tn(s,3)),this.add(new oi(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Yh.copy(this.light.color),Zh.copy(this.light.groundColor);for(let t=0,n=e.count;t0){const n=new fc(e);r=new _c(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e0){i=new _c(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const r=Tl.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let a,o,l;const c=[];if(1===s.length)return o=s[0],l=new $o,l.curves=o.curves,c.push(l),c;let h=!r(s[0].getPoints());h=t?!h:h;const u=[],d=[];let p,m,f=[],g=0;d[g]=void 0,f[g]=[];for(let e=0,n=s.length;e1){let t=!1,e=0;for(let t=0,e=d.length;t0&&!1===t&&(f=u)}for(let t=0,e=d.length;tescape( $Name ); + $QS = "INSERT INTO `network_interfaces` SET `type`={$Type}, `key`='{$Key}', `mode`={$Mode}, `device_name`='{$Ename}', `mac`='{$Mac}', `aux_id`={$AUX_ID} ON DUPLICATE KEY UPDATE `id`=`id`"; + $DATABASE->Query( $QS ); + $NID = $DATABASE->getLastInsertID(); + if( $NID == 0 ){ + $QS="SELECT `id` FROM `network_interfaces` WHERE `key`='{$Key}'"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ) $NID = intval( $RR[0]['id'] ); + }; + return $NID; + }; + + function getServerNode( $SiteID, $Pos = 0 ){ + global $DATABASE; + $QS = "SELECT `id` FROM `nodes` WHERE `site_id`={$SiteID} AND `type`=0"; + $SS = $DATABASE->Query( $QS, false ); + if( count( $SS ) ){ + if( $Pos ){ + if( isset ($SS[$Pos] ) ){ + return intval($SS[$Pos]['id']); + }; + } else return intval($SS[0]['id']); + }; + return 0; + }; + + function getResourceID( $NodeID, $ResType ){ global $DATABASE; $QS = "SELECT `id` FROM `resources` WHERE `node_id`={$NodeID} AND `type`={$ResType}"; $RR = $DATABASE->Query( $QS, false ); @@ -172,7 +201,7 @@ $NodeID = $DATABASE->getLastInsertID(); $ResName = $IP . ':' . $PORT; $ResID = createResource( $NodeID, 0, 101, $ResName ); - $ServerNetResources = getRessourceID( $ServerNODE, 101 ); + $ServerNetResources = getResourceID( $ServerNODE, 101 ); if( count( $ServerNetResources ) ){ $ServerNetRID = $ServerNetResources[0]; createConnection( $SiteID, $ServerNODE, $ServerNetRID, $NodeID, $ResID, 4 ); @@ -225,6 +254,7 @@ $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 ); + return true; }; function addAnalogPtzCamera( $SiteID, $ServerNODE, $CamName, $StreamID, $ImagerSize, $Fmin, $Fmax, $PanMode, $PanAng, $TiltMode, $TiltAng, $Protocol, $Protocol_Aux, $UartID ){ @@ -254,9 +284,309 @@ $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 ); + return true; + }; + + function addIpPtzCamera( $SiteID, $ServerNODE, $CamName, $CamID, $StreamID, $ImagerSize, $LFL, $Zoom, $PanMode, $PanAng, $TiltMode, $TiltAng, $Protocol, $Protocol_Aux, $UART=0 ){ + global $DATABASE; + $QS = "SELECT * FROM `cameras` WHERE `id`={$CamID}"; + $CR = $DATABASE->Query( $QS, false ); + $Range = 0.0; + if( count( $CR ) ){ + $CamData = $CR[0]; + $QS = "INSERT INTO `nodes` SET `site_id`={$SiteID}, `type`=13, `aux_id`={$CamID}, `aux_parameter`={$StreamID}, `name`='{$CamName}'"; + $DATABASE->Query( $QS, false ); + $NODEID = $DATABASE->getLastInsertID(); + $DevICE = $CamID .':'.$StreamID.':STREAM'; + $QS = "INSERT INTO `resources` SET `node_id`={$NODEID}, `class`=4, `type`=32, `aux_id`={$StreamID}, `used`=1, `device`='{$DevICE}'"; + $DATABASE->Query( $QS, false ); + $STRRID = $DATABASE->getLastInsertID(); + $INSTRRIR = getResourceID( $ServerNODE, 101 ); + + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NODEID}, `from_aux`={$STRRID}, `to`={$ServerNODE}, `to_aux`={$INSTRRIR[0]}, `type`=4"; + $DATABASE->Query( $QS, false ); + switch( $Protocol ){ + case 3:{ + // Onvif + $QS = "UPDATE `cameras` SET `node_id`={$NODEID}, `type`=13, `status`=3, `protocol`={$Protocol}, `imager_type`={$ImagerSize}, `lens_f`={$LFL}, `zoom`={$Zoom}, `pan_model`={$PanMode}, `pan_angles`={$PanAng}, `tilt_model`={$TiltMode}, `tilt_angles`={$TiltAng}, `max_range`={$Range} WHERE `id`={$CamID}"; + $DATABASE->Query( $QS, false ); + $DevICE = $CamID . ':eth0'; + $Key = md5( $DevICE ); + $QS = "INSERT INTO `network_interfaces` SET `device_name`='{$DevICE}', `key`='{$Key}', `mac`='{$CamData['mac']}'"; + $DATABASE->Query( $QS, false ); + $NIFID = $DATABASE->getLastInsertID(); + $DevICE = $CamID .':'.$StreamID.':CTRL'; + $QS = "INSERT INTO `resources` SET `node_id`={$NODEID}, `class`=3, `type`=101, `aux_id`={$NIFID}, `used`=1, `device`='{$DevICE}'"; + $DATABASE->Query( $QS, false ); + $CTLRID = $DATABASE->getLastInsertID(); + + $INCTLNID = $ServerNODE; + $INCTLRID = $INSTRRIR[0]; + $CTLTYP = 4; + break; + }; + default:{ + // any serial control + $QS = "UPDATE `cameras` SET `node_id`={$NODEID}, `type`=13, `status`=3, `protocol`={$Protocol}, `protocol_aux`={$Protocol_Aux}, `uart_id`={$UART}, `imager_type`={$ImagerSize}, `lens_f`={$LFL}, `zoom`={$Zoom}, `pan_model`={$PanMode}, `pan_angles`={$PanAng}, `tilt_model`={$TiltMode}, `tilt_angles`={$TiltAng}, `max_range`={$Range} WHERE `id`={$CamID}"; + $DATABASE->Query( $QS, false ); + $DevICE = $CamID .':'.$StreamID.':CTRL'; + $QS = "INSERT INTO `resources` SET `node_id`={$NODEID}, `class`=1, `type`=1 `aux_id`={$CamID}, `used`=1, `device`='{$DevICE}'"; + $DATABASE->Query( $QS, false ); + $CTLRID = $DATABASE->getLastInsertID(); + $QS = "SELECT `id`, `node_id` FROM `resources` WHERE `type`=1, `aux_id`={$UART}"; + $RR = $DATABASE->Query( $QS, false ); + + $INCTLRID = $RR[0]['id']; + $INCTLNID = $RR[0]['node_id']; + $CTLTYP = 1; + break; + }; + }; + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NODEID}, `from_aux`={$CTLRID}, `to`={$INCTLNID}, `to_aux`={$INCTLRID}, `type`={$CTLTYP}"; + $DATABASE->Query( $QS, false ); + return true; + }; + return false; + }; + + function addEthernet2Serial( $SiteID, $ServerNODE, $Name, $Mac, $Ip, $Port, $Mode, $Speed, $Bits, $Stop, $Parity, $User='admin', $Pass='admin' ){ + global $DATABASE; + $SPD = intval( $Speed ); + $BITS = intval( $Bits ); + $STOP = floatval( $Stop ); + $PAR = strtoupper( substr( $Parity, 0, 1 ) ); + $MODE = intval( $Mode ); + $IP = $DATABASE->escape( $Ip ); + $PORT = intval( $Port ); + $EUSER = $DATABASE->escape( $User ); + $EPASS = $DATABASE->escape( $Pass ); + //Add Node + $QS = "INSERT INTO nodes SET `type`=20, `aux_id`=0, `site_id`={$SiteID}, `name`='{$Name}'"; + $DATABASE->Query( $QS, false ); + $NODEID = $DATABASE->getLastInsertID(); + //Add UART + $QS = "INSERT INTO `uart_settings` SET `type`=129, `node_id`={$NODEID}, `mode`={$MODE}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}', `username`='{$EUSER}', `password`='{$EPASS}'"; + $DATABASE->Query( $QS, false ); + $UARTID = $DATABASE->getLastInsertID(); + $DevICE = $IP .':'.$PORT; + $UARTRESID = createResource( $NODEID, $UARTID, ARGUS_NODE_RES_TYPE_SERIAL_PORT, $DevICE ); + + $QS = "UPDATE `nodes` SET `aux_id`={$UARTID}, `aux_parameter`={$UARTRESID} WHERE `id`={$NODEID}"; + $DATABASE->Query( $QS, false ); + + //Add Network + $NETID = createNIF( $NODEID . ':eth0' ); + $NETRESID = createResource( $NODEID, $NETID, ARGUS_NODE_RES_TYPE_NETWORK, $DevICE ); + //Connection Server <-> E2S + $SNETRESID = getResourceID( $ServerNODE, ARGUS_NODE_RES_TYPE_NETWORK ); + createConnection( $SiteID, $ServerNODE, $SNETRESID[0], $NODEID, $NETRESID, CON_TYPE_TCP ); + return true; + }; + function deleteResource( $RID ){ + global $DATABASE; + $QS = "SELECT * FROM `resources` WHERE ``id`={$RID}"; + $Result = $DATABASE->Query( $QS ); + if( count( $Result ) ){ + $RD = $Result[0]; + switch( $RD['type'] ){ + case 1:{ + // UART + break; + }; + case 30:{ + // analog Video Source + break; + }; + case 31:{ + // analog Video Capture + }; + case 32:{ + // digital Video Source + break; + }; + case 101:{ + // Network eth Interface + $QS = "SELECT * FROM `network_interfaces` WHERE `id`={$RD['aux_id']}"; + $Result = $DATABASE->Query( $QS ); + if( count( $Result ) ){ + $NIF = $Result[0]; + }; + break; + }; + case 102:{ + // Network wifi Interface + break; + }; + }; + }; + }; + + function disrIsEmpty( $Dir ){ + if (!is_readable($Dir)) return false; + return (count(scandir($Dir)) == 2); }; - function addIpPtzCamera( $SiteID, $ServerNODE, $CamName, $CamID, $StreamID, $ImagerSize, $Fmin, $Fmax, $PanMode, $PanAng, $TiltMode, $TiltAng, $Protocol, $Protocol_Aux, $UART=0 ){ + function deletePicturesByStream( $DataDir, $StreamID ){ global $DATABASE; + if( is_readable( $DataDir ) ){ + /* + $QS = "SELECT id, md5, ext FROM pictures WHERE media_stream_id={$StreamID} LIMIT 100"; + $RR = $DATABASE->Query( $QS ); + while( count( $RR ) ){ + foreach( $RR as $R ){ + //$Base1 = $DataDir . '/' . substr( $R['md5'], 0, 2 ); + //if( is_readable( $Base1 ) ){ + //$Base2 = $Base1 . '/' . substr( $R['md5'], 2, 2 ); + //if( is_readable( $Base2 ) ){ + $Pic = $Base2 . '/' . $R['md5'] . '.' . $R['ext']; + //if( is_readable( $Pic ) ) unlink( $Pic ); + //if( disrIsEmpty( $Base2 ) ) rmdir( $Base2 ); + //}; + //if( disrIsEmpty( $Base1 ) ) rmdir( $Base1 ); + //}; + $QZ = "DELETE FROM events_2_pictures WHERE picture_id={$R['id']}"; + $DATABASE->Query( $QZ ); + }; + $RR = $DATABASE->Query( $QS ); + }; + + */ + $CMD = "rm -R {$DataDir}"; + $LL = `$CMD`; + if( !is_readable( $DataDir ) ) mkdir( $DataDir ); + }; + $QS = "DELETE FROM events_2_pictures WHERE id IN ( SELECT id FROM pictures WHERE media_stream_id={$StreamID} )"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM pictures WHERE media_stream_id={$StreamID}"; + $DATABASE->Query( $QS ); + echo "KOKO"; + }; + + function deleteNode( $NodeID ){ + global $DATABASE; + $QS = "SELECT * FROM `nodes` WHERE `id`={$NodeID}"; + $Result = $DATABASE->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; + }; + // Handle Network Interfaces + case 100: + case 101: + case 102: + case 103: + case 104: + case 105:{ + $QS = "DELETE FROM `network_interfaces` WHERE `id`={$R['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `networks` WHERE `nif_id`={$R['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `network_infrastructure` WHERE `nif_id`={$R['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `wifis` WHERE `nif_id`={$R['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; + // Handle Access Point + case 125:{ + 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 = "SELECT id FROM `media_streams` WHERE `source_id`={$ND['aux_id']} OR `id`={$ND['aux_parameter']}"; + $STR = $DATABASE->Query( $QS ); + //foreach( $STR as $R ) deletePicturesByStream( 'data/reports', $R['id'] ); + $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 `uart_settings` WHERE `node_id`={$ND['id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `events_cloud` WHERE `node_id`={$ND['id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `events_archive` WHERE `node_id`={$ND['id']}"; + $DATABASE->Query( $QS ); + $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 ); + }; + }; }; + ?> \ No newline at end of file diff --git a/lib/php/ui/UI_functions.php b/lib/php/ui/UI_functions.php index 91ad53a..2b5c1b9 100644 --- a/lib/php/ui/UI_functions.php +++ b/lib/php/ui/UI_functions.php @@ -186,20 +186,20 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){ - + - - + - + diff --git a/style/assets/7shields.png b/style/assets/7shields.png new file mode 100644 index 0000000..c64b192 Binary files /dev/null and b/style/assets/7shields.png differ diff --git a/style/assets/led_green_blink_300ms.gif b/style/assets/led_green_blink_300ms.gif new file mode 100644 index 0000000..5d8325a Binary files /dev/null and b/style/assets/led_green_blink_300ms.gif differ diff --git a/style/assets/led_red_blink_300ms_delay_off_phase.gif b/style/assets/led_red_blink_300ms_delay_off_phase.gif new file mode 100644 index 0000000..41e3f56 Binary files /dev/null and b/style/assets/led_red_blink_300ms_delay_off_phase.gif differ diff --git a/style/img/calendar/1.gif b/style/img/calendar/1.gif new file mode 100644 index 0000000..cfc2528 Binary files /dev/null and b/style/img/calendar/1.gif differ diff --git a/style/img/calendar/1.png b/style/img/calendar/1.png new file mode 100644 index 0000000..db90207 Binary files /dev/null and b/style/img/calendar/1.png differ diff --git a/style/img/calendar/2.gif b/style/img/calendar/2.gif new file mode 100644 index 0000000..b1c1ee5 Binary files /dev/null and b/style/img/calendar/2.gif differ diff --git a/style/img/calendar/2.png b/style/img/calendar/2.png new file mode 100644 index 0000000..bce0847 Binary files /dev/null and b/style/img/calendar/2.png differ diff --git a/style/img/calendar/3.gif b/style/img/calendar/3.gif new file mode 100644 index 0000000..4a6e577 Binary files /dev/null and b/style/img/calendar/3.gif differ diff --git a/style/img/calendar/3.png b/style/img/calendar/3.png new file mode 100644 index 0000000..77f9f91 Binary files /dev/null and b/style/img/calendar/3.png differ diff --git a/style/img/calendar/4.gif b/style/img/calendar/4.gif new file mode 100644 index 0000000..ce8e6c9 Binary files /dev/null and b/style/img/calendar/4.gif differ diff --git a/style/img/calendar/4.png b/style/img/calendar/4.png new file mode 100644 index 0000000..24e7544 Binary files /dev/null and b/style/img/calendar/4.png differ diff --git a/style/img/calendar/5.gif b/style/img/calendar/5.gif new file mode 100644 index 0000000..0d3de57 Binary files /dev/null and b/style/img/calendar/5.gif differ diff --git a/style/img/calendar/5.png b/style/img/calendar/5.png new file mode 100644 index 0000000..7e969a2 Binary files /dev/null and b/style/img/calendar/5.png differ diff --git a/style/img/calendar/6.gif b/style/img/calendar/6.gif new file mode 100644 index 0000000..fcec01f Binary files /dev/null and b/style/img/calendar/6.gif differ diff --git a/style/img/calendar/6.png b/style/img/calendar/6.png new file mode 100644 index 0000000..5429d31 Binary files /dev/null and b/style/img/calendar/6.png differ diff --git a/style/img/calendar/calen_cbg.psd b/style/img/calendar/calen_cbg.psd new file mode 100644 index 0000000..a8fd7cb Binary files /dev/null and b/style/img/calendar/calen_cbg.psd differ diff --git a/style/img/calendar/l_cal_b.gif b/style/img/calendar/l_cal_b.gif new file mode 100644 index 0000000..ad9f129 Binary files /dev/null and b/style/img/calendar/l_cal_b.gif differ diff --git a/style/img/calendar/r_cal_b.gif b/style/img/calendar/r_cal_b.gif new file mode 100644 index 0000000..dd6ce4c Binary files /dev/null and b/style/img/calendar/r_cal_b.gif differ diff --git a/style/style.css b/style/style.css index 36e722d..18db756 100644 --- a/style/style.css +++ b/style/style.css @@ -420,4 +420,188 @@ object:hover { .x-form-text{ height: 24px !important; -} \ No newline at end of file +} + +.cardDeviceSource{ + display: block-inline; + width: 120px; + height: 120px; + border-radius: 10px; + margin-left: 10px; + margin-top: 10px; + color: black; + border: 2px solid darkgray; + background-color: darkgray; + cursor: pointer; +} +.cardDeviceSourceSelected{ + display: block-inline; + width: 120px; + height: 120px; + border-radius: 10px; + margin-left: 10px; + margin-top: 10px; + color: black; + border: 2px solid red; + background-color: orange; + cursor: pointer; +} +.cardDeviceSource:hover{ + border: 2px solid orange; + background-color: orange; +} + +.CalendarWT{ + background: #808080; + text-align: center; + color: #FFFFFF; + font-size: 10px; + font-weight: bold; +} +.CalendarMN{ + font-size: 9px; + text-align: center; + font-weight: bold; +} + +.calendar_t{ + display: block; + width: 19px; + height: 19px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; + cursor: pointer; +} + +.calendar_t#disabled{ + background: url(img/calendar/3.png); +} + +.calendar_t#have_data_day{ + color: white; + background: url(img/calendar/1.png); +} + +.calendar_t#have_data_day:hover{ + background: url(img/calendar/2.png); +} + +.calendar_t#no_data_day{ + color: black; + background: url(img/calendar/3.png); +} + +.calendar_t#no_data_day:hover{ + background: url(img/calendar/4.png); +} + +.calendar_t#selected_day{ + color: black; + background: url(img/calendar/5.png); +} + +.calendar_t#selected_day:hover{ + background: url(img/calendar/6.png); +} + +A.CalendarDD:link, A.CalendarDD:active, A.CalendarDD:visited { + display: block; + color: #808080; + background: url(img/calendar/3.png); + width: 19px; + height: 19px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDD:hover { + display: block; + color: #808080; + background: url(img/calendar/4.png); + width: 19px; + height: 15px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDE:link, A.CalendarDE:active, A.CalendarDE:visited { + display: block; + color: #FFFFFF; + background: url(img/calendar/1.png); + width: 19px; + height: 15px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDE:hover { + display: block; + color: #FFFFFF; + background: url(img/calendar/2.png); + width: 19px; + height: 15px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDT:link, A.CalendarDT:active, A.CalendarDT:visited { + display: block; + color: #FFFFFF; + background: url(img/calendar/3.png); + width: 19px; + height: 15px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDT:hover { + display: block; + color: #FFFFFF; + background: url(img/calendar/4.png); + width: 19px; + height: 15px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDS:link, A.CalendarDS:active, A.CalendarDS:visited { + display: block; + color: #FFFFFF; + width: 19px; + height: 15px; + background: url(img/calendar/5.png); + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} +A.CalendarDS:hover { + display: block; + color: #FFFFFF; + background: url(img/calendar/6.png); + width: 19px; + height: 15px; + padding: 4px 0px 0px 0px; + font-size: 9px; + font-weight: bold; + text-align: center; + text-decoration: none; +} + +