Commit d522f27b authored by dasharatha.vamshi's avatar dasharatha.vamshi

initial push

parent ca6b0cc1
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.6 (rasa_x)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Nosetests" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyChainedComparisonsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoreConstantInTheMiddle" value="true" />
</inspection_tool>
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="46">
<item index="0" class="java.lang.String" itemvalue="scikit-image" />
<item index="1" class="java.lang.String" itemvalue="scipy" />
<item index="2" class="java.lang.String" itemvalue="opencv-python" />
<item index="3" class="java.lang.String" itemvalue="torch" />
<item index="4" class="java.lang.String" itemvalue="torchvision" />
<item index="5" class="java.lang.String" itemvalue="absl-py" />
<item index="6" class="java.lang.String" itemvalue="protobuf" />
<item index="7" class="java.lang.String" itemvalue="rsa" />
<item index="8" class="java.lang.String" itemvalue="tensorflow-estimator" />
<item index="9" class="java.lang.String" itemvalue="opt-einsum" />
<item index="10" class="java.lang.String" itemvalue="python-dateutil" />
<item index="11" class="java.lang.String" itemvalue="cycler" />
<item index="12" class="java.lang.String" itemvalue="gast" />
<item index="13" class="java.lang.String" itemvalue="numpy" />
<item index="14" class="java.lang.String" itemvalue="pyasn1" />
<item index="15" class="java.lang.String" itemvalue="requests" />
<item index="16" class="java.lang.String" itemvalue="importlib-metadata" />
<item index="17" class="java.lang.String" itemvalue="pyasn1-modules" />
<item index="18" class="java.lang.String" itemvalue="requests-oauthlib" />
<item index="19" class="java.lang.String" itemvalue="tensorflow" />
<item index="20" class="java.lang.String" itemvalue="tensorboard-plugin-wit" />
<item index="21" class="java.lang.String" itemvalue="zipp" />
<item index="22" class="java.lang.String" itemvalue="oauthlib" />
<item index="23" class="java.lang.String" itemvalue="astunparse" />
<item index="24" class="java.lang.String" itemvalue="urllib3" />
<item index="25" class="java.lang.String" itemvalue="pyparsing" />
<item index="26" class="java.lang.String" itemvalue="Cython" />
<item index="27" class="java.lang.String" itemvalue="Markdown" />
<item index="28" class="java.lang.String" itemvalue="google-auth-oauthlib" />
<item index="29" class="java.lang.String" itemvalue="Werkzeug" />
<item index="30" class="java.lang.String" itemvalue="kiwisolver" />
<item index="31" class="java.lang.String" itemvalue="tqdm" />
<item index="32" class="java.lang.String" itemvalue="yolov5processor" />
<item index="33" class="java.lang.String" itemvalue="tensorboard" />
<item index="34" class="java.lang.String" itemvalue="future" />
<item index="35" class="java.lang.String" itemvalue="matplotlib" />
<item index="36" class="java.lang.String" itemvalue="cachetools" />
<item index="37" class="java.lang.String" itemvalue="grpcio" />
<item index="38" class="java.lang.String" itemvalue="Keras" />
<item index="39" class="java.lang.String" itemvalue="google-auth" />
<item index="40" class="java.lang.String" itemvalue="idna" />
<item index="41" class="java.lang.String" itemvalue="Pillow" />
<item index="42" class="java.lang.String" itemvalue="cython" />
<item index="43" class="java.lang.String" itemvalue="keras" />
<item index="44" class="java.lang.String" itemvalue="imgaug" />
<item index="45" class="java.lang.String" itemvalue="opencv-contrib-python" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N806" />
<option value="N801" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="cv2.imresize" />
<option value="detectron2.model_zoo.get_config_file" />
<option value="detectron2.model_zoo.get_checkpoint_url" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (rasa_x)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/KL-Bot.iml" filepath="$PROJECT_DIR$/.idea/KL-Bot.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3ade1139-54f0-423a-8d8a-8e1d4fc91729" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="ProjectId" id="1mN8oBxoHGeinS2XvQH12xIGEhY" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../KL-bot-services" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Admin\Desktop\Rasa" />
</key>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3ade1139-54f0-423a-8d8a-8e1d4fc91729" name="Default Changelist" comment="" />
<created>1609322860467</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1609322860467</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="566" y="252" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1609739904059">
<screen x="0" y="0" width="1600" height="900" />
</state>
<state x="566" y="252" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1600.900@0.0.1600.900" timestamp="1609739904059" />
<state x="580" y="205" key="FileChooserDialogImpl" timestamp="1610446271799">
<screen x="0" y="0" width="1600" height="900" />
</state>
<state x="580" y="205" key="FileChooserDialogImpl/0.0.1600.900@0.0.1600.900" timestamp="1610446271799" />
<state x="301" y="95" key="SettingsEditor" timestamp="1609833928728">
<screen x="0" y="0" width="1600" height="900" />
</state>
<state x="301" y="95" key="SettingsEditor/0.0.1600.900@0.0.1600.900" timestamp="1609833928728" />
</component>
</project>
\ No newline at end of file
FROM python:3.6-stretch
RUN pip install rasa rasa-sdk
ADD . /opt/code
WORKDIR /opt/code
CMD rasa run -m models --enable-api --cors "*"
\ No newline at end of file
# Rasa_CustomUI-v_2.0
A Chat widget easy to connect to RASA bot to Custom Channel(a webpage).
Added Support for
- Buttons
- Images
Command to start the bot:
> rasa run -m models --enable-api --cors "*" --debug
## Screenshots:
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_1.PNG)
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_2.PNG)
<!DOCTYPE html>
<html>
<head>
<title>ChatBot</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<!--Main css-->
<link rel="stylesheet" type="text/css" href="static/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="container">
<div class="widget">
<div class="chat_header">
<!--Add the name of the bot here -->
<span style="color:white;margin-left: 5px;">KL Bot </span>
<!-- <span style="color:white;margin-right: 5px;float:right;margin-top: 5px;" id="close">
<i class="material-icons">close</i>
</span> -->
</div>
<!--Chatbot contents goes here -->
<div class="chats" id="chats">
<div class="clearfix"></div>
</div>
<!--user typing indicator -->
<div class="keypad">
<input type="text" id="keypad" class="usrInput browser-default" placeholder="Type a message..."
autocomplete="off">
</div>
</div>
<!--bot widget -->
<div class="profile_div" id="profile_div">
<img class="imgProfile" src="static/img/chat-bot.svg" />
</div>
<div class="profile_toggle" id="close">
<i class="material-icons bootToggle">keyboard_arrow_down</i>
</div>
</div>
<!--JavaScript at end of body for optimized loading-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="static/js/materialize.min.js"></script>
<!--Main Script -->
<script type="text/javascript" src="static/js/script.js"></script>
</body>
</html>
\ No newline at end of file
/*! Flickity v2.2.0
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled{position:relative}.flickity-enabled:focus{outline:0}.flickity-viewport{overflow:hidden;position:relative;height:100%}.flickity-slider{position:absolute;width:100%;height:100%}.flickity-enabled.is-draggable{-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.flickity-enabled.is-draggable .flickity-viewport{cursor:move;cursor:-webkit-grab;cursor:grab}.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down{cursor:-webkit-grabbing;cursor:grabbing}.flickity-button{position:absolute;background:hsla(0,0%,100%,.75);border:none;color:#333}.flickity-button:hover{background:#fff;cursor:pointer}.flickity-button:focus{outline:0;box-shadow:0 0 0 5px #19F}.flickity-button:active{opacity:.6}.flickity-button:disabled{opacity:.3;cursor:auto;pointer-events:none}.flickity-button-icon{fill:currentColor}.flickity-prev-next-button{top:50%;width:44px;height:44px;border-radius:50%;transform:translateY(-50%)}.flickity-prev-next-button.previous{left:10px}.flickity-prev-next-button.next{right:10px}.flickity-rtl .flickity-prev-next-button.previous{left:auto;right:10px}.flickity-rtl .flickity-prev-next-button.next{right:auto;left:10px}.flickity-prev-next-button .flickity-button-icon{position:absolute;left:20%;top:20%;width:60%;height:60%}.flickity-page-dots{position:absolute;width:100%;bottom:-25px;padding:0;margin:0;list-style:none;text-align:center;line-height:1}.flickity-rtl .flickity-page-dots{direction:rtl}.flickity-page-dots .dot{display:inline-block;width:10px;height:10px;margin:0 8px;background:#333;border-radius:50%;opacity:.25;cursor:pointer}.flickity-page-dots .dot.is-selected{opacity:1}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
.widget {
display: none;
width: 400px;
right: 15px;
height: 650px;
bottom: 9%;
position: fixed;
background: #f6f6f6;
border-radius: 10px 10px 10px 10px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
}
.chat_header {
height: 7%;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
/* #6072e6 */
border-radius: 10px 10px 0px 0px;
padding: 5px;
font-size: 20px;
}
.chats {
height: 520px;
padding: 5px;
margin-top: 5px;
border-radius: 1px;
overflow-y: auto;
transition: 0.2s;
}
/* div.chats::-webkit-scrollbar {
width: 0px;
/* remove scrollbar space /
background: transparent;
/ optional: just make scrollbar invisible */
} */
/* Track */
div.chats::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
div.chats::-webkit-scrollbar-thumb {
background: #c0bebe;
}
/* Handle on hover */
div.chats::-webkit-scrollbar-thumb:hover {
background: #918f8f;
}
#close {
cursor: pointer;
}
.clearfix {
margin-top: 2px;
margin-bottom: 2px;
}
.message {
margin-top: 5px;
margin-bottom: 5px;
margin-right: 0;
margin-left: 0;
}
.botAvatar {
/* border-radius: 50%; */
width: 1.5em;
height: 1.5em;
float: left;
margin-left: 5px;
/* border: 2px solid #6072e6; */
}
.botMsg {
float: left;
margin-top: 5px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #efeef5;
border: 1px solid #ffffff;
margin-left: 0.5em;
padding: 0.6em 1em;
border-radius: 1.5em;
max-width: 55%;
min-width: 25%;
font-size: 12px;
word-wrap: break-word;
}
.userMsg {
animation: animateElement linear 0.2s;
animation-iteration-count: 1;
margin-top: 5px;
word-wrap: break-word;
padding: 0.6em 1em;
float: right;
margin-right: 0.5em;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border: 1px solid transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
color: #fff;
border-radius: 1.5em;
margin-bottom: 0.15em;
font-size: 12px;
max-width: 55%;
min-width: 25%;
line-height: 1.5em;
}
.userAvatar {
animation: animateElement linear 0.3s;
animation-iteration-count: 1;
border-radius: 50%;
width: 1.5em;
height: 1.5em;
float: right;
margin-right: 5px;
border: 2px solid #6072e6;
}
.singleCard {
/* height: 200px; */
padding-left: 10%;
padding-right: 10px;
}
.suggestions {
padding: 5px;
width: 100%;
/* border-radius: 10px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #dbdade; */
}
.cardsImage {
width: 100%;
height: 80%;
border-radius: 10px 10px 0px 0px;
}
.keypad {
height: 45px;
position: absolute;
bottom: 10px;
width: 320px;
}
.usrInput {
background: #f1f0f0;
padding: 0.5em;
width: 90%;
margin-left: 4%;
border-radius: 20px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
border: 0;
padding-left: 15px;
height: 40px;
}
input:focus {
outline: none;
}
video:focus {
outline: none;
}
.menuTitle {
padding: 5px;
margin-top: 5px;
margin-bottom: 5px;
}
.menu {
padding: 5px;
}
.menuChips {
background: #85eb8aa3;
color: #188c33;
text-align: center;
padding: 8px;
border: #85eb8aa3;
margin: 5px;
cursor: pointer;
border-radius: 8px;
font-size: 14px;
word-wrap: break-word;
float: right;
}
.imgcard {
object-fit: cover;
width: 80%;
height: 90%;
border-radius: 10px 10px 10px 10px;
margin-left: 1%;
}
.chip {
background-color: #6072e6;
color: #fff;
font-weight: normal;
font-weight: 0;
text-align: center;
}
@keyframes animateElement {
0% {
opacity: 0;
transform: translate(0px, 10px);
}
100% {
opacity: 1;
transform: translate(0px, 0px);
}
}
.imgProfile {
box-shadow: 0 0px 1px 0 rgba(0, 0, 0, 0.16), 0 0px 10px 0 rgba(0, 0, 0, 0.12);
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border-radius: 22px;
width: 60px;
padding: 10px;
}
.profile_div {
/* display: none; */
position: fixed;
padding: 5px;
width: 10%;
bottom: 0;
right: -65px;
cursor: pointer;
}
.profile_toggle{
display: none;
position: fixed;
padding: 5px;
width: 5%;
bottom: 0;
right: 0;
cursor: pointer;
}
.profileIcon {
height: 15%;
align-items: center;
float: left;
margin-right: 10px;
}
.bootToggle{
padding: 2px;
margin: 10px;
border-radius: 30px;
color: #ffffff;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
font-size: 35px !important;
}
::-webkit-scrollbar {
width: 8px;
height: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px #605c5c;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: grey;
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42.18" viewBox="0 0 42 42.18">
<defs>
<style>
.cls-1 {
fill: #fff;
}
.cls-2 {
fill: none;
}
.cls-3 {
fill: #25d366;
}
</style>
</defs>
<g id="chat-bot" transform="translate(-0.332)">
<path id="Path_4" data-name="Path 4" class="cls-1" d="M18.865,35.363V32.33h14.27a2.416,2.416,0,0,0,1.836-.887A3.306,3.306,0,0,0,35.73,29.3V8.066a3.306,3.306,0,0,0-.759-2.146,2.416,2.416,0,0,0-1.836-.887H7.189a2.416,2.416,0,0,0-1.836.887,3.306,3.306,0,0,0-.759,2.146V29.3a3.306,3.306,0,0,0,.759,2.146,2.416,2.416,0,0,0,1.836.887H18.865v3.033H7.189C4.322,35.363,2,32.646,2,29.3V8.066C2,4.715,4.323,2,7.189,2H33.135C36,2,38.325,4.715,38.325,8.066V40.457c0,3.351-8.6-5.094-11.462-5.095h-8Z" transform="translate(0.595 -2)"/>
<rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-2" width="42" height="42" transform="translate(0.332 0.18)"/>
<rect id="Rectangle_1" data-name="Rectangle 1" class="cls-1" width="32" height="29" rx="4" transform="translate(4.332 2.18)"/>
<path id="Path_1" data-name="Path 1" class="cls-3" d="M17.734,20.259A9.069,9.069,0,0,1,10.167,16.2l2.161-1.437a6.487,6.487,0,0,0,10.812,0L25.3,16.2a9.069,9.069,0,0,1-7.567,4.059Z" transform="translate(3.023 3.313)"/>
<path id="Path_2" data-name="Path 2" class="cls-3" d="M20.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,20.595,8Z" transform="translate(5.352 1.302)"/>
<path id="Path_3" data-name="Path 3" class="cls-3" d="M12.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,12.595,8Z" transform="translate(2.973 1.302)"/>
</g>
</svg>
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
This source diff could not be displayed because it is too large. You can view the blob instead.
// on input/text enter--------------------------------------------------------------------------------------
$('.usrInput').on('keyup keypress', function (e) {
var keyCode = e.keyCode || e.which;
var text = $(".usrInput").val();
if (keyCode === 13) {
if (text == "" || $.trim(text) == '') {
e.preventDefault();
return false;
} else {
$(".usrInput").blur();
setUserResponse(text);
send(text);
e.preventDefault();
return false;
}
}
});
//------------------------------------- Set user response------------------------------------
function setUserResponse(val) {
var UserResponse = '<p class="userMsg">' + val + ' </p><div class="clearfix"></div>';
$(UserResponse).appendTo('.chats').show('slow');
$(".usrInput").val('');
scrollToBottomOfResults();
$('.suggestions').remove();
}
//---------------------------------- Scroll to the bottom of the chats-------------------------------
function scrollToBottomOfResults() {
var terminalResultsDiv = document.getElementById('chats');
terminalResultsDiv.scrollTop = terminalResultsDiv.scrollHeight;
}
function e3() {
var h='0123456789abcdef';
var k='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
/* same as e4() below */
}
function e4() {
var h=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var k=['x','x','x','x','x','x','x','x','-','x','x','x','x','-','4','x','x','x','-','y','x','x','x','-','x','x','x','x','x','x','x','x','x','x','x','x'];
var u='',i=0,rb=Math.random()*0xffffffff|0;
while(i++<36) {
var c=k[i-1],r=rb&0xf,v=c=='x'?r:(r&0x3|0x8);
u+=(c=='-'||c=='4')?c:h[v];rb=i%8==0?Math.random()*0xffffffff|0:rb>>4
}
return u
}
x = e4()
function send(message) {
console.log("User Message:", message)
$.ajax({
url: 'http://localhost:5005/webhooks/rest/webhook',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"message": message,
"sender": x
}),
success: function (data, textStatus) {
if(data != null){
setBotResponse(data);
}
console.log("Rasa Response: ", data, "\n Status:", textStatus)
},
error: function (errorMessage) {
setBotResponse("");
console.log('Error' + errorMessage);
}
});
}
send("Hi");
//------------------------------------ Set bot response -------------------------------------
function setBotResponse(val) {
setTimeout(function () {
if (val.length < 1) {
//if there is no response from Rasa
msg = 'I couldn\'t get that. Let\' try something else!';
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + msg + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
} else {
//if we get response from Rasa
for (i = 0; i < val.length; i++) {
//check if there is text message
if (val[i].hasOwnProperty("text")) {
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + val[i].text + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is image
if (val[i].hasOwnProperty("image")) {
var BotResponse = '<div class="singleCard">' +
'<img class="imgcard" src="' + val[i].image + '">' +
'</div><div class="clearfix">'
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is button message
if (val[i].hasOwnProperty("buttons")) {
addSuggestion(val[i].buttons);
}
}
scrollToBottomOfResults();
}
}, 500);
}
// ------------------------------------------ Toggle chatbot -----------------------------------------------
$('#profile_div').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
scrollToBottomOfResults();
});
$('#close').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
});
// ------------------------------------------ Suggestions -----------------------------------------------
function addSuggestion(textToAdd) {
setTimeout(function () {
var suggestions = textToAdd;
var suggLength = textToAdd.length;
$(' <div class="singleCard"> <div class="suggestions"><div class="menu"></div></div></diV>').appendTo('.chats').hide().fadeIn(1000);
// Loop through suggestions
for (i = 0; i < suggLength; i++) {
$('<button class="menuChips" data-payload=\''+(suggestions[i].payload)+'\'>' + suggestions[i].title + "</button>").appendTo(".menu");
}
scrollToBottomOfResults();
}, 1000);
}
// on click of suggestions, get the value and send to rasa
$(document).on("click", ".menu .menuChips", function () {
var text = this.innerText;
var payload= this.getAttribute('data-payload');
console.log("button payload: ",this.getAttribute('data-payload'))
setUserResponse(text);
send(payload);
$('.suggestions').remove(); //delete the suggestions
});
FROM python:3.6-stretch
RUN pip install rasa rasa-sdk
ADD . /opt/code
WORKDIR /opt/code
CMD rasa run actions
\ No newline at end of file
# Rasa_CustomUI-v_2.0
A Chat widget easy to connect to RASA bot to Custom Channel(a webpage).
Added Support for
- Buttons
- Images
Command to start the bot:
> rasa run -m models --enable-api --cors "*" --debug
## Screenshots:
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_1.PNG)
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_2.PNG)
<!DOCTYPE html>
<html>
<head>
<title>ChatBot</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<!--Main css-->
<link rel="stylesheet" type="text/css" href="static/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="container">
<div class="widget">
<div class="chat_header">
<!--Add the name of the bot here -->
<span style="color:white;margin-left: 5px;">KL Bot </span>
<!-- <span style="color:white;margin-right: 5px;float:right;margin-top: 5px;" id="close">
<i class="material-icons">close</i>
</span> -->
</div>
<!--Chatbot contents goes here -->
<div class="chats" id="chats">
<div class="clearfix"></div>
</div>
<!--user typing indicator -->
<div class="keypad">
<input type="text" id="keypad" class="usrInput browser-default" placeholder="Type a message..."
autocomplete="off">
</div>
</div>
<!--bot widget -->
<div class="profile_div" id="profile_div">
<img class="imgProfile" src="static/img/chat-bot.svg" />
</div>
<div class="profile_toggle" id="close">
<i class="material-icons bootToggle">keyboard_arrow_down</i>
</div>
</div>
<!--JavaScript at end of body for optimized loading-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="static/js/materialize.min.js"></script>
<!--Main Script -->
<script type="text/javascript" src="static/js/script.js"></script>
</body>
</html>
\ No newline at end of file
/*! Flickity v2.2.0
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled{position:relative}.flickity-enabled:focus{outline:0}.flickity-viewport{overflow:hidden;position:relative;height:100%}.flickity-slider{position:absolute;width:100%;height:100%}.flickity-enabled.is-draggable{-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.flickity-enabled.is-draggable .flickity-viewport{cursor:move;cursor:-webkit-grab;cursor:grab}.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down{cursor:-webkit-grabbing;cursor:grabbing}.flickity-button{position:absolute;background:hsla(0,0%,100%,.75);border:none;color:#333}.flickity-button:hover{background:#fff;cursor:pointer}.flickity-button:focus{outline:0;box-shadow:0 0 0 5px #19F}.flickity-button:active{opacity:.6}.flickity-button:disabled{opacity:.3;cursor:auto;pointer-events:none}.flickity-button-icon{fill:currentColor}.flickity-prev-next-button{top:50%;width:44px;height:44px;border-radius:50%;transform:translateY(-50%)}.flickity-prev-next-button.previous{left:10px}.flickity-prev-next-button.next{right:10px}.flickity-rtl .flickity-prev-next-button.previous{left:auto;right:10px}.flickity-rtl .flickity-prev-next-button.next{right:auto;left:10px}.flickity-prev-next-button .flickity-button-icon{position:absolute;left:20%;top:20%;width:60%;height:60%}.flickity-page-dots{position:absolute;width:100%;bottom:-25px;padding:0;margin:0;list-style:none;text-align:center;line-height:1}.flickity-rtl .flickity-page-dots{direction:rtl}.flickity-page-dots .dot{display:inline-block;width:10px;height:10px;margin:0 8px;background:#333;border-radius:50%;opacity:.25;cursor:pointer}.flickity-page-dots .dot.is-selected{opacity:1}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
.widget {
display: none;
width: 400px;
right: 15px;
height: 650px;
bottom: 9%;
position: fixed;
background: #f6f6f6;
border-radius: 10px 10px 10px 10px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
}
.chat_header {
height: 7%;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
/* #6072e6 */
border-radius: 10px 10px 0px 0px;
padding: 5px;
font-size: 20px;
}
.chats {
height: 520px;
padding: 5px;
margin-top: 5px;
border-radius: 1px;
overflow-y: auto;
transition: 0.2s;
}
/* div.chats::-webkit-scrollbar {
width: 0px;
/* remove scrollbar space /
background: transparent;
/ optional: just make scrollbar invisible */
} */
/* Track */
div.chats::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
div.chats::-webkit-scrollbar-thumb {
background: #c0bebe;
}
/* Handle on hover */
div.chats::-webkit-scrollbar-thumb:hover {
background: #918f8f;
}
#close {
cursor: pointer;
}
.clearfix {
margin-top: 2px;
margin-bottom: 2px;
}
.message {
margin-top: 5px;
margin-bottom: 5px;
margin-right: 0;
margin-left: 0;
}
.botAvatar {
/* border-radius: 50%; */
width: 1.5em;
height: 1.5em;
float: left;
margin-left: 5px;
/* border: 2px solid #6072e6; */
}
.botMsg {
float: left;
margin-top: 5px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #efeef5;
border: 1px solid #ffffff;
margin-left: 0.5em;
padding: 0.6em 1em;
border-radius: 1.5em;
max-width: 55%;
min-width: 25%;
font-size: 12px;
word-wrap: break-word;
}
.userMsg {
animation: animateElement linear 0.2s;
animation-iteration-count: 1;
margin-top: 5px;
word-wrap: break-word;
padding: 0.6em 1em;
float: right;
margin-right: 0.5em;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border: 1px solid transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
color: #fff;
border-radius: 1.5em;
margin-bottom: 0.15em;
font-size: 12px;
max-width: 55%;
min-width: 25%;
line-height: 1.5em;
}
.userAvatar {
animation: animateElement linear 0.3s;
animation-iteration-count: 1;
border-radius: 50%;
width: 1.5em;
height: 1.5em;
float: right;
margin-right: 5px;
border: 2px solid #6072e6;
}
.singleCard {
/* height: 200px; */
padding-left: 10%;
padding-right: 10px;
}
.suggestions {
padding: 5px;
width: 100%;
/* border-radius: 10px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #dbdade; */
}
.cardsImage {
width: 100%;
height: 80%;
border-radius: 10px 10px 0px 0px;
}
.keypad {
height: 45px;
position: absolute;
bottom: 10px;
width: 320px;
}
.usrInput {
background: #f1f0f0;
padding: 0.5em;
width: 90%;
margin-left: 4%;
border-radius: 20px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
border: 0;
padding-left: 15px;
height: 40px;
}
input:focus {
outline: none;
}
video:focus {
outline: none;
}
.menuTitle {
padding: 5px;
margin-top: 5px;
margin-bottom: 5px;
}
.menu {
padding: 5px;
}
.menuChips {
background: #85eb8aa3;
color: #188c33;
text-align: center;
padding: 8px;
border: #85eb8aa3;
margin: 5px;
cursor: pointer;
border-radius: 8px;
font-size: 14px;
word-wrap: break-word;
float: right;
}
.imgcard {
object-fit: cover;
width: 80%;
height: 90%;
border-radius: 10px 10px 10px 10px;
margin-left: 1%;
}
.chip {
background-color: #6072e6;
color: #fff;
font-weight: normal;
font-weight: 0;
text-align: center;
}
@keyframes animateElement {
0% {
opacity: 0;
transform: translate(0px, 10px);
}
100% {
opacity: 1;
transform: translate(0px, 0px);
}
}
.imgProfile {
box-shadow: 0 0px 1px 0 rgba(0, 0, 0, 0.16), 0 0px 10px 0 rgba(0, 0, 0, 0.12);
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border-radius: 22px;
width: 60px;
padding: 10px;
}
.profile_div {
/* display: none; */
position: fixed;
padding: 5px;
width: 10%;
bottom: 0;
right: -65px;
cursor: pointer;
}
.profile_toggle{
display: none;
position: fixed;
padding: 5px;
width: 5%;
bottom: 0;
right: 0;
cursor: pointer;
}
.profileIcon {
height: 15%;
align-items: center;
float: left;
margin-right: 10px;
}
.bootToggle{
padding: 2px;
margin: 10px;
border-radius: 30px;
color: #ffffff;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
font-size: 35px !important;
}
::-webkit-scrollbar {
width: 8px;
height: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px #605c5c;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: grey;
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42.18" viewBox="0 0 42 42.18">
<defs>
<style>
.cls-1 {
fill: #fff;
}
.cls-2 {
fill: none;
}
.cls-3 {
fill: #25d366;
}
</style>
</defs>
<g id="chat-bot" transform="translate(-0.332)">
<path id="Path_4" data-name="Path 4" class="cls-1" d="M18.865,35.363V32.33h14.27a2.416,2.416,0,0,0,1.836-.887A3.306,3.306,0,0,0,35.73,29.3V8.066a3.306,3.306,0,0,0-.759-2.146,2.416,2.416,0,0,0-1.836-.887H7.189a2.416,2.416,0,0,0-1.836.887,3.306,3.306,0,0,0-.759,2.146V29.3a3.306,3.306,0,0,0,.759,2.146,2.416,2.416,0,0,0,1.836.887H18.865v3.033H7.189C4.322,35.363,2,32.646,2,29.3V8.066C2,4.715,4.323,2,7.189,2H33.135C36,2,38.325,4.715,38.325,8.066V40.457c0,3.351-8.6-5.094-11.462-5.095h-8Z" transform="translate(0.595 -2)"/>
<rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-2" width="42" height="42" transform="translate(0.332 0.18)"/>
<rect id="Rectangle_1" data-name="Rectangle 1" class="cls-1" width="32" height="29" rx="4" transform="translate(4.332 2.18)"/>
<path id="Path_1" data-name="Path 1" class="cls-3" d="M17.734,20.259A9.069,9.069,0,0,1,10.167,16.2l2.161-1.437a6.487,6.487,0,0,0,10.812,0L25.3,16.2a9.069,9.069,0,0,1-7.567,4.059Z" transform="translate(3.023 3.313)"/>
<path id="Path_2" data-name="Path 2" class="cls-3" d="M20.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,20.595,8Z" transform="translate(5.352 1.302)"/>
<path id="Path_3" data-name="Path 3" class="cls-3" d="M12.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,12.595,8Z" transform="translate(2.973 1.302)"/>
</g>
</svg>
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
This source diff could not be displayed because it is too large. You can view the blob instead.
// on input/text enter--------------------------------------------------------------------------------------
$('.usrInput').on('keyup keypress', function (e) {
var keyCode = e.keyCode || e.which;
var text = $(".usrInput").val();
if (keyCode === 13) {
if (text == "" || $.trim(text) == '') {
e.preventDefault();
return false;
} else {
$(".usrInput").blur();
setUserResponse(text);
send(text);
e.preventDefault();
return false;
}
}
});
//------------------------------------- Set user response------------------------------------
function setUserResponse(val) {
var UserResponse = '<p class="userMsg">' + val + ' </p><div class="clearfix"></div>';
$(UserResponse).appendTo('.chats').show('slow');
$(".usrInput").val('');
scrollToBottomOfResults();
$('.suggestions').remove();
}
//---------------------------------- Scroll to the bottom of the chats-------------------------------
function scrollToBottomOfResults() {
var terminalResultsDiv = document.getElementById('chats');
terminalResultsDiv.scrollTop = terminalResultsDiv.scrollHeight;
}
function e3() {
var h='0123456789abcdef';
var k='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
/* same as e4() below */
}
function e4() {
var h=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var k=['x','x','x','x','x','x','x','x','-','x','x','x','x','-','4','x','x','x','-','y','x','x','x','-','x','x','x','x','x','x','x','x','x','x','x','x'];
var u='',i=0,rb=Math.random()*0xffffffff|0;
while(i++<36) {
var c=k[i-1],r=rb&0xf,v=c=='x'?r:(r&0x3|0x8);
u+=(c=='-'||c=='4')?c:h[v];rb=i%8==0?Math.random()*0xffffffff|0:rb>>4
}
return u
}
x = e4()
function send(message) {
console.log("User Message:", message)
$.ajax({
url: 'http://localhost:5005/webhooks/rest/webhook',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"message": message,
"sender": x
}),
success: function (data, textStatus) {
if(data != null){
setBotResponse(data);
}
console.log("Rasa Response: ", data, "\n Status:", textStatus)
},
error: function (errorMessage) {
setBotResponse("");
console.log('Error' + errorMessage);
}
});
}
send("Hi");
//------------------------------------ Set bot response -------------------------------------
function setBotResponse(val) {
setTimeout(function () {
if (val.length < 1) {
//if there is no response from Rasa
msg = 'I couldn\'t get that. Let\' try something else!';
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + msg + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
} else {
//if we get response from Rasa
for (i = 0; i < val.length; i++) {
//check if there is text message
if (val[i].hasOwnProperty("text")) {
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + val[i].text + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is image
if (val[i].hasOwnProperty("image")) {
var BotResponse = '<div class="singleCard">' +
'<img class="imgcard" src="' + val[i].image + '">' +
'</div><div class="clearfix">'
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is button message
if (val[i].hasOwnProperty("buttons")) {
addSuggestion(val[i].buttons);
}
}
scrollToBottomOfResults();
}
}, 500);
}
// ------------------------------------------ Toggle chatbot -----------------------------------------------
$('#profile_div').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
scrollToBottomOfResults();
});
$('#close').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
});
// ------------------------------------------ Suggestions -----------------------------------------------
function addSuggestion(textToAdd) {
setTimeout(function () {
var suggestions = textToAdd;
var suggLength = textToAdd.length;
$(' <div class="singleCard"> <div class="suggestions"><div class="menu"></div></div></diV>').appendTo('.chats').hide().fadeIn(1000);
// Loop through suggestions
for (i = 0; i < suggLength; i++) {
$('<button class="menuChips" data-payload=\''+(suggestions[i].payload)+'\'>' + suggestions[i].title + "</button>").appendTo(".menu");
}
scrollToBottomOfResults();
}, 1000);
}
// on click of suggestions, get the value and send to rasa
$(document).on("click", ".menu .menuChips", function () {
var text = this.innerText;
var payload= this.getAttribute('data-payload');
console.log("button payload: ",this.getAttribute('data-payload'))
setUserResponse(text);
send(payload);
$('.suggestions').remove(); //delete the suggestions
});
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
import re
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker, FormValidationAction
from rasa_sdk.events import SlotSet, EventType
from rasa_sdk.executor import CollectingDispatcher
import webbrowser
from rasa_sdk.events import AllSlotsReset
from rasa_sdk.events import Restarted
from rasa_sdk.types import DomainDict
from actions.email_utility import SMTPUtility
import requests
def hit_api(payload):
try:
url = "http://rasa-flask:2526/insert_into_mongo"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
except Exception as e:
print(e)
class DemoSlotReset(Action):
def name(self) -> Text:
return "demo_slot_reset"
def run(self, dispatcher, tracker, domain):
return [SlotSet("demo", None)]
class UserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "user_details_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "demo"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class ActionSubmit(FormValidationAction):
def name(self) -> Text:
return "action_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will contact you for "
"scheduling the demo.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"product\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("demo")),
str(tracker.get_slot("company")),
"Requesting a Demo of " + str(
tracker.get_slot("demo")))
payload = "{" + body + "}"
hit_api(payload)
class CallForm(FormValidationAction):
def name(self) -> Text:
return "call_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class CallSubmit(FormValidationAction):
def name(self) -> Text:
return "call_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will reach out to you in "
"a short while.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"company\":\"{3}\",\"request\":\"{4}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("company")),
"Requesting for a Call Back")
payload = "{" + body + "}"
hit_api(payload)
class QueryForm(FormValidationAction):
def name(self) -> Text:
return "query_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "query"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class QuerySubmit(FormValidationAction):
def name(self) -> Text:
return "query_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Your query has been registered with us. Our team of experts will follow up with a "
"resolution soon")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"query\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("query")),
str(tracker.get_slot("company")),
"Have a Query")
payload = "{" + body + "}"
hit_api(payload)
class ActionRestarted(Action):
def name(self):
return 'action_restarted'
def run(self, dispatcher, tracker, domain):
return [Restarted()]
class ActionSlotReset(Action):
def name(self):
return 'action_slot_reset'
def run(self, dispatcher, tracker, domain):
return [AllSlotsReset()]
class ActionSessionId(Action):
def name(self) -> Text:
return "action_session_id"
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
conversation_id = tracker.sender_id
dispatcher.utter_message("The conversation id is {}".format(conversation_id))
return []
class EmailForm(Action):
def name(self) -> Text:
return "email_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["email"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
return [SlotSet("requested_slot", None)]
class EmailSubmit(FormValidationAction):
def name(self) -> Text:
return "email_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
# dispatcher.utter_message("Your Details: " + "\n Email: " + tracker.get_slot("email"))
dispatcher.utter_message("You have successfully subscribed to our newsletter")
body = "\"email\":\"{0}\",\"request\":\"{1}\"".format(str(tracker.get_slot("email")), "Email Signup")
payload = "{" + body + "}"
hit_api(payload)
class ValidateEmailForm(FormValidationAction):
def name(self) -> Text:
return "validate_email_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
class ValidateUserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "validate_user_details_form"
def validate_demo(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
myval = ['mlens', 'ilens', 'glens']
mylist = str(slot_value.lower()).split(" ")
a = set(myval)
b = set(mylist)
if a & b:
return {'demo': list(a & b)[0]}
else:
dispatcher.utter_message("Sorry we dont have support for that product.")
return {'demo': None}
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid")
return {'number': None}
class ValidateQueryForm(FormValidationAction):
def name(self) -> Text:
return "validate_query_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid")
return {'number': None}
class ValidateCallForm(FormValidationAction):
def name(self) -> Text:
return "validate_call_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid")
return {'number': None}
import ssl
import smtplib
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class SMTPUtility:
def __init__(self):
self.from_address = "dasharatha.vamshi@knowledgelens.com"
self.to_address = ["saivamshi2309@gmail.com", "saivamshi.s16@iiits.in"]
self.msg = MIMEMultipart()
self.msg['From'] = self.from_address
self.msg['To'] = " ,".join(self.to_address)
self.filename = ""
self.smtp_server = "smtp.gmail.com"
self.username = "dasharatha.vamshi@knowledgelens.com"
self.password = "Salla$230999"
self.smtp_server_port = 587
self.ssl = False
def send_email(self, content, attach=False):
try:
self.msg['Subject'] = "KL Bot: " + content['subject']
self.msg['body'] = content['body']
self.msg.attach(MIMEText(self.msg['body'], 'plain'))
# give filename in self.filename to attach a document.
if attach:
attachment = open(self.filename, "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % self.filename)
self.msg.attach(p)
# starting the sever
if self.ssl:
context = ssl.create_default_context()
with smtplib.SMTP_SSL(self.smtp_server, self.smtp_server_port, context=context) as server:
server.login(self.username, self.password)
server.sendmail(self.from_address, self.to_address, self.msg.as_string())
else:
s = smtplib.SMTP(self.smtp_server, self.smtp_server_port)
s.starttls()
s.login(self.username, self.password)
s.sendmail(self.from_address, self.to_address, self.msg.as_string())
s.quit()
return True
except:
return False
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
# No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# If you'd like to customize it, uncomment and adjust the pipeline.
# See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 300
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# No configuration for policies was provided. The following default policies were used to train your model.
# If you'd like to customize them, uncomment and adjust the policies.
# See https://rasa.com/docs/rasa/policies for more information.
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 5
epochs: 300
- name: RulePolicy
- name: MappingPolicy
- name: FormPolicy
# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/messaging-and-voice-channels
rest:
# # you don't need to provide anything here - this channel doesn't
# # require any credentials
#facebook:
# verify: "<verify>"
# secret: "<your secret>"
# page-access-token: "<your page access token>"
#slack:
# slack_token: "<your slack token>"
# slack_channel: "<the slack channel>"
# slack_signing_secret: "<your slack signing secret>"
#socketio:
# user_message_evt: <event name for user message>
# bot_message_evt: <event name for bot messages>
# session_persistence: <true/false>
#mattermost:
# url: "https://<mattermost instance>/api/v4"
# token: "<bot token>"
# webhook_url: "<callback URL>"
# This entry is needed if you are using Rasa X. The entry represents credentials
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5002/api"
version: "2.0"
nlu:
- intent: greet
examples: |
- hey
- hello
- hi
- hello there
- good morning
- good evening
- moin
- hey there
- let's go
- hey dude
- goodmorning
- goodevening
- good afternoon
- Hi
- intent: goodbye
examples: |
- good afternoon
- cu
- good by
- cee you later
- good night
- bye
- goodbye
- have a nice day
- see you around
- bye bye
- see you later
- intent: affirm
examples: |
- yes
- y
- indeed
- of course
- that sounds good
- correct
- intent: deny
examples: |
- no
- n
- never
- I don't think so
- don't like that
- no way
- not really
- why should i give
- no i dont want to mention
- why do you need that
- no i dont provide
- why do you need this
- i wont
- wont
- intent: ask_id
examples: |
- tell me the id
- tell me the conversation id
- tell me the chat id
- tell me the session id
- what is my conversational id
- conversational id
- session id
- may i know my session id
- intent: mood_great
examples: |
- perfect
- great
- amazing
- feeling like a king
- wonderful
- I am feeling very good
- I am great
- I am amazing
- I am going to save the world
- super stoked
- extremely good
- so so perfect
- so good
- so perfect
- intent: mood_unhappy
examples: |
- my day was horrible
- I am sad
- I don't feel very well
- I am disappointed
- super sad
- I'm so sad
- sad
- very sad
- unhappy
- not good
- not very good
- extremly sad
- so saad
- so sad
- intent: bot_challenge
examples: |
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
- intent: glens
examples: |
- what is glens?
- tell me about glens?
- what is green lens?
- glens?
- glens
- intent: ilens
examples: |
- what is ilens?
- tell me about ilens?
- ilens?
- ilens
- intent: mlens
examples: |
- what is mlens?
- tell me about mlens?
- mlens?
- mlens
- intent: know_more
examples: |
- know more?
- I want to know more?
- tell me more?
- more?
- know more
- intent: name_entry
examples: |
- my name is [vamshi](name)
- [raju](name)
- [kevin](name) is my name
- my name is [tarun](name)
- [rajesh](name)
- my name is [mike](name)
- [stark](name)
- [vamshi](name)
- [shiva](name)
- [kiran](name)
- [yuvraj](name)
- [yuvaraj](name)
- intent: my_email
examples: |
- my email is [sai@gmail.com](email)
- [saivamshi@gmail.com](email)
- [r@gamil.com](email)
- my email is [d@gmail.com](email)
- [dash@knowledgelens.com](email)
- [saik@gmail.com](email)
- [yuv@gmail.com](email)
- intent: email_entry
examples: |
- [vamshi@knowledgelens.com](email) is my email
- my email id is [sai@knowledgelens.com](email)
- [v@yahoo.co.in](email)
- [sai@yahoo.co.in](email)
- [yuvraj.s@knowledgelens.com](email)
- intent: number_entry
examples: |
- my number is [1234567890](number)
- [1234567809](number)
- [1029384756](number) is my number
- my number is [1234509876](number)
- [1902873674](number)
- my number is [7687564789](number)
- [1076452288](number)
- [7799558890](number)
- intent: company_entry
examples: |
- i am from [google](company)
- [knowledgelens](company)
- [unemployed](company)
- [student](company)
- intent: query_entry
examples: |
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- intent: request_demo
examples: |
- request demo
- can we have a demo
- can i get demo
- demo
- request_demo
- intent: request_call_back
examples: |
- call back
- can we have a call
- can you call back
- request_call_back
- intent: signup_for_email_newsletter
examples: |
- signup
- signup for email newsletter
- email signup
- newsletter signup
- signup_for_email_newsletter
- intent: send_us_a_query
examples: |
- i have a question
- i have a query
- can i get a answer for my question
- send a query
- intent: out_of_scope
examples: |
- I want to order food
- 2 + 2?
- us president?
version: "2.0"
rules:
- rule: Say goodbye anytime the user says goodbye
steps:
- intent: goodbye
- action: utter_goodbye
- rule: Say 'I am a bot' anytime the user challenges
steps:
- intent: bot_challenge
- action: utter_iamabot
- rule: Id asked
steps:
- intent: ask_id
- action: action_session_id
- rule: Demo form Activate
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- rule: Call back Form Activate
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- rule: Email signup Form Activate
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- rule: Query form Activate
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- rule: Submit form Demo
condition:
# Condition that form is active.
- active_loop: user_details_form
steps:
# Form is deactivated
- action: user_details_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: action_submit
- action: demo_slot_reset
- action: utter_show_options2
- rule: Submit form Email
condition:
# Condition that form is active.
- active_loop: email_form
steps:
# Form is deactivated
- action: email_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: email_submit
- action: utter_show_options2
- rule: Submit form Query
condition:
# Condition that form is active.
- active_loop: query_form
steps:
# Form is deactivated
- action: query_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: query_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
- rule: Submit form Call letter
condition:
# Condition that form is active.
- active_loop: call_form
steps:
# Form is deactivated
- action: call_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: call_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
\ No newline at end of file
version: "2.0"
stories:
- story: happy path
steps:
- intent: greet
- action: utter_show_options
- story: bye
steps:
- intent: deny
- action: utter_goodbye
- story: user details form stop
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: query form stop
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: email form stop
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: call form stop
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
\ No newline at end of file
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: false
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- glens
- ilens
- mlens
- show_options
- know_more
- ask_id
- request_demo
- request_call_back
- signup_for_email_newsletter
- send_us_a_query
- out_of_scope
- name_entry:
use_entities:
- name
- email_entry:
use_entities:
- email
- number_entry:
use_entities:
- number
- company_entry:
use_entities:
- company
- query_entry:
use_entities:
- query
- nlu_feedback
entities:
- name
- email
- number
- company
- query
slots:
demo:
type: unfeaturized
influence_conversation: false
name:
type: unfeaturized
influence_conversation: false
email:
type: unfeaturized
influence_conversation: false
number:
type: unfeaturized
influence_conversation: false
company:
type: unfeaturized
influence_conversation: false
query:
type: unfeaturized
influence_conversation: false
requested_slot:
type: unfeaturized
influence_conversation: false
responses:
utter_exit_form:
- text: I am sorry, I could not process your request.
utter_request_demo:
- text: You have requested for a demo.
utter_request_call_back:
- text: You have requested for a call back.
utter_signup_for_email_newsletter:
- text: You have requested for email newsletter signup.
utter_send_us_a_query:
- text: You have requested to send us a query.
utter_greet:
- text: Hello there, Welcome to KL bot.
utter_enter:
- text: Please enter your details
utter_cheer_up:
- image: https://i.imgur.com/nGF1K8f.jpg
text: 'Here is something to cheer you up:'
utter_did_that_help:
- text: Did that help you?
utter_happy:
- text: Great, carry on!
utter_goodbye:
- text: Thank you. Have a great day!
utter_iamabot:
- text: I am a bot, powered by Rasa.
utter_glens:
- text: GLens is Real-Time Data Acquisition, Monitoring and Analytics suite of Products
for Industrial Emissions, Effluent Discharges and Ambient Air Monitoring. GLens
DAS Software, GLens Server Platform, GLens Environ Data Logger provides a comprehensive
solution for all Industry Environmental needs.
utter_ilens:
- text: Intelligent IoT Solutions, built for Industry 4.0
utter_mlens:
- text: MLens is a one-stop solution for all your Big Data needs, from Automated
Disaster Recovery to Compute Workload Migration, and everything in between.
utter_show_options:
- buttons:
- payload: request_demo
title: Request a Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for our Montly Newsletter
- payload: send_us_a_query
title: Send us a query
text: Hello there! How may I assist you today?
utter_show_options2:
- buttons:
- payload: request_demo
title: Request Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for email newsletter
- payload: send_us_a_query
title: Send us a query
text: Is there anything else we can help you with?
utter_know_more:
- text: Please enter your email id for contacting you
utter_ask_name:
- text: Please enter your name to proceed.
utter_ask_email:
- text: Please enter your email id.
utter_ask_number:
- text: Please enter your mobile number.
utter_ask_company:
- text: Please enter your company name.
utter_thanks:
- text: Thanks for providing the values.
utter_ask_query:
- text: Please tell us your query.
utter_details_thanks:
- text: "Thanks for providing the details \n email: {email} \n name: {name} \n mobile:\
\ {number} \n company: {company}"
utter_out_of_scope:
- text: Sorry, I did'nt get what you said. Please rephrase what you said.
utter_ask_demo:
- buttons:
- payload: glens
title: "GLens"
- payload: ilens
title: "ILens"
- payload: mlens
title: "MLens"
text: Please select the product that you would like to schedule a demo for.
actions:
- action_submit
- email_submit
- query_submit
- call_submit
- action_slot_reset
- action_session_id
- validate_email_form
- validate_call_form
- validate_query_form
- validate_user_details_form
- demo_slot_reset
forms:
user_details_form:
demo:
- entity: None
type: from_text
not_intent: deny
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
call_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
email_form:
email:
- entity: None
type: from_text
not_intent: deny
query_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
query:
- entity: None
type: from_text
not_intent: deny
\ No newline at end of file
# This file contains the different endpoints your bot can use.
# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
#models:
# url: http://my-server.com/models/default_core@latest
# wait_time_between_pulls: 10 # [optional](default: 100)
# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions
action_endpoint:
url: "http://rasa-services:5055/webhook"
# Tracker store which is used to store pippithe conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/tracker-stores
#tracker_store:
# type: redis
# url: <host of the redis instance, e.g. localhost>
# port: <port of your redis instance, usually 6379>
# db: <number of your database within redis, e.g. 0>
# password: <password used for authentication>
# use_ssl: <whether or not the communication is encrypted, default false>
#tracker_store:
# type: mongod
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
# db: <name of the db within your mongo instance, e.g. rasa>
# username: <username used for authentication>
# password: <password used for authentication>
# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/event-brokers
#event_broker:
# url: localhost
# username: username
# password: password
# queue: queue
#### This file contains tests to evaluate that your bot behaves as expected.
#### If you want to learn more, please see the docs: https://rasa.com/docs/rasa/testing-your-assistant
stories:
- story: happy path 1
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- story: happy path 2
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: sad path 1
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
yes
intent: affirm
- action: utter_happy
- story: sad path 2
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
not really
intent: deny
- action: utter_goodbye
- story: sad path 3
steps:
- user: |
hi
intent: greet
- action: utter_greet
- user: |
very terrible
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
no
intent: deny
- action: utter_goodbye
- story: say goodbye
steps:
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: bot challenge
steps:
- user: |
are you a bot?
intent: bot_challenge
- action: utter_iamabot
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
import re
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker, FormValidationAction
from rasa_sdk.events import SlotSet, EventType
from rasa_sdk.executor import CollectingDispatcher
import webbrowser
from rasa_sdk.events import AllSlotsReset
from rasa_sdk.events import Restarted
from rasa_sdk.types import DomainDict
from actions.email_utility import SMTPUtility
import requests
def hit_api(payload):
try:
url = "http://rasa-flask:2526/insert_into_mongo"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
except Exception as e:
print(e)
class DemoSlotReset(Action):
def name(self) -> Text:
return "demo_slot_reset"
def run(self, dispatcher, tracker, domain):
return [SlotSet("demo", None)]
class UserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "user_details_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "demo"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class ActionSubmit(FormValidationAction):
def name(self) -> Text:
return "action_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will contact you for "
"scheduling the demo.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"product\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("demo")),
str(tracker.get_slot("company")),
"Requesting a Demo of " + str(
tracker.get_slot("demo")))
payload = "{" + body + "}"
hit_api(payload)
class CallForm(FormValidationAction):
def name(self) -> Text:
return "call_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class CallSubmit(FormValidationAction):
def name(self) -> Text:
return "call_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will reach out to you in "
"a short while.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"company\":\"{3}\",\"request\":\"{4}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("company")),
"Requesting for a Call Back")
payload = "{" + body + "}"
hit_api(payload)
class QueryForm(FormValidationAction):
def name(self) -> Text:
return "query_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "query"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class QuerySubmit(FormValidationAction):
def name(self) -> Text:
return "query_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Your query has been registered with us. Our team of experts will follow up with a "
"resolution soon")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"query\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("query")),
str(tracker.get_slot("company")),
"Have a Query")
payload = "{" + body + "}"
hit_api(payload)
class ActionRestarted(Action):
def name(self):
return 'action_restarted'
def run(self, dispatcher, tracker, domain):
return [Restarted()]
class ActionSlotReset(Action):
def name(self):
return 'action_slot_reset'
def run(self, dispatcher, tracker, domain):
return [AllSlotsReset()]
class ActionSessionId(Action):
def name(self) -> Text:
return "action_session_id"
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
conversation_id = tracker.sender_id
dispatcher.utter_message("The conversation id is {}".format(conversation_id))
return []
class EmailForm(Action):
def name(self) -> Text:
return "email_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["email"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
return [SlotSet("requested_slot", None)]
class EmailSubmit(FormValidationAction):
def name(self) -> Text:
return "email_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
# dispatcher.utter_message("Your Details: " + "\n Email: " + tracker.get_slot("email"))
dispatcher.utter_message("You have successfully subscribed to our newsletter")
body = "\"email\":\"{0}\",\"request\":\"{1}\"".format(str(tracker.get_slot("email")), "Email Signup")
payload = "{" + body + "}"
hit_api(payload)
class ValidateEmailForm(FormValidationAction):
def name(self) -> Text:
return "validate_email_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
class ValidateUserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "validate_user_details_form"
def validate_demo(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
myval = ['mlens', 'ilens', 'glens']
mylist = str(slot_value.lower()).split(" ")
a = set(myval)
b = set(mylist)
if a & b:
return {'demo': list(a & b)[0]}
else:
dispatcher.utter_message("Sorry we dont have support for that product.")
return {'demo': None}
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid")
return {'number': None}
class ValidateQueryForm(FormValidationAction):
def name(self) -> Text:
return "validate_query_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid")
return {'number': None}
class ValidateCallForm(FormValidationAction):
def name(self) -> Text:
return "validate_call_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid")
return {'number': None}
import ssl
import smtplib
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class SMTPUtility:
def __init__(self):
self.from_address = "dasharatha.vamshi@knowledgelens.com"
self.to_address = ["saivamshi2309@gmail.com", "saivamshi.s16@iiits.in"]
self.msg = MIMEMultipart()
self.msg['From'] = self.from_address
self.msg['To'] = " ,".join(self.to_address)
self.filename = ""
self.smtp_server = "smtp.gmail.com"
self.username = "dasharatha.vamshi@knowledgelens.com"
self.password = "Salla$230999"
self.smtp_server_port = 587
self.ssl = False
def send_email(self, content, attach=False):
try:
self.msg['Subject'] = "KL Bot: " + content['subject']
self.msg['body'] = content['body']
self.msg.attach(MIMEText(self.msg['body'], 'plain'))
# give filename in self.filename to attach a document.
if attach:
attachment = open(self.filename, "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % self.filename)
self.msg.attach(p)
# starting the sever
if self.ssl:
context = ssl.create_default_context()
with smtplib.SMTP_SSL(self.smtp_server, self.smtp_server_port, context=context) as server:
server.login(self.username, self.password)
server.sendmail(self.from_address, self.to_address, self.msg.as_string())
else:
s = smtplib.SMTP(self.smtp_server, self.smtp_server_port)
s.starttls()
s.login(self.username, self.password)
s.sendmail(self.from_address, self.to_address, self.msg.as_string())
s.quit()
return True
except:
return False
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
# No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# If you'd like to customize it, uncomment and adjust the pipeline.
# See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 300
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# No configuration for policies was provided. The following default policies were used to train your model.
# If you'd like to customize them, uncomment and adjust the policies.
# See https://rasa.com/docs/rasa/policies for more information.
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 5
epochs: 300
- name: RulePolicy
- name: MappingPolicy
- name: FormPolicy
# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/messaging-and-voice-channels
rest:
# # you don't need to provide anything here - this channel doesn't
# # require any credentials
#facebook:
# verify: "<verify>"
# secret: "<your secret>"
# page-access-token: "<your page access token>"
#slack:
# slack_token: "<your slack token>"
# slack_channel: "<the slack channel>"
# slack_signing_secret: "<your slack signing secret>"
#socketio:
# user_message_evt: <event name for user message>
# bot_message_evt: <event name for bot messages>
# session_persistence: <true/false>
#mattermost:
# url: "https://<mattermost instance>/api/v4"
# token: "<bot token>"
# webhook_url: "<callback URL>"
# This entry is needed if you are using Rasa X. The entry represents credentials
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5002/api"
version: "2.0"
nlu:
- intent: greet
examples: |
- hey
- hello
- hi
- hello there
- good morning
- good evening
- moin
- hey there
- let's go
- hey dude
- goodmorning
- goodevening
- good afternoon
- Hi
- intent: goodbye
examples: |
- good afternoon
- cu
- good by
- cee you later
- good night
- bye
- goodbye
- have a nice day
- see you around
- bye bye
- see you later
- intent: affirm
examples: |
- yes
- y
- indeed
- of course
- that sounds good
- correct
- intent: deny
examples: |
- no
- n
- never
- I don't think so
- don't like that
- no way
- not really
- why should i give
- no i dont want to mention
- why do you need that
- no i dont provide
- why do you need this
- i wont
- wont
- intent: ask_id
examples: |
- tell me the id
- tell me the conversation id
- tell me the chat id
- tell me the session id
- what is my conversational id
- conversational id
- session id
- may i know my session id
- intent: mood_great
examples: |
- perfect
- great
- amazing
- feeling like a king
- wonderful
- I am feeling very good
- I am great
- I am amazing
- I am going to save the world
- super stoked
- extremely good
- so so perfect
- so good
- so perfect
- intent: mood_unhappy
examples: |
- my day was horrible
- I am sad
- I don't feel very well
- I am disappointed
- super sad
- I'm so sad
- sad
- very sad
- unhappy
- not good
- not very good
- extremly sad
- so saad
- so sad
- intent: bot_challenge
examples: |
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
- intent: glens
examples: |
- what is glens?
- tell me about glens?
- what is green lens?
- glens?
- glens
- intent: ilens
examples: |
- what is ilens?
- tell me about ilens?
- ilens?
- ilens
- intent: mlens
examples: |
- what is mlens?
- tell me about mlens?
- mlens?
- mlens
- intent: know_more
examples: |
- know more?
- I want to know more?
- tell me more?
- more?
- know more
- intent: name_entry
examples: |
- my name is [vamshi](name)
- [raju](name)
- [kevin](name) is my name
- my name is [tarun](name)
- [rajesh](name)
- my name is [mike](name)
- [stark](name)
- [vamshi](name)
- [shiva](name)
- [kiran](name)
- [yuvraj](name)
- [yuvaraj](name)
- intent: my_email
examples: |
- my email is [sai@gmail.com](email)
- [saivamshi@gmail.com](email)
- [r@gamil.com](email)
- my email is [d@gmail.com](email)
- [dash@knowledgelens.com](email)
- [saik@gmail.com](email)
- [yuv@gmail.com](email)
- intent: email_entry
examples: |
- [vamshi@knowledgelens.com](email) is my email
- my email id is [sai@knowledgelens.com](email)
- [v@yahoo.co.in](email)
- [sai@yahoo.co.in](email)
- [yuvraj.s@knowledgelens.com](email)
- intent: number_entry
examples: |
- my number is [1234567890](number)
- [1234567809](number)
- [1029384756](number) is my number
- my number is [1234509876](number)
- [1902873674](number)
- my number is [7687564789](number)
- [1076452288](number)
- [7799558890](number)
- intent: company_entry
examples: |
- i am from [google](company)
- [knowledgelens](company)
- [unemployed](company)
- [student](company)
- intent: query_entry
examples: |
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- intent: request_demo
examples: |
- request demo
- can we have a demo
- can i get demo
- demo
- request_demo
- intent: request_call_back
examples: |
- call back
- can we have a call
- can you call back
- request_call_back
- intent: signup_for_email_newsletter
examples: |
- signup
- signup for email newsletter
- email signup
- newsletter signup
- signup_for_email_newsletter
- intent: send_us_a_query
examples: |
- i have a question
- i have a query
- can i get a answer for my question
- send a query
- intent: out_of_scope
examples: |
- I want to order food
- 2 + 2?
- us president?
version: "2.0"
rules:
- rule: Say goodbye anytime the user says goodbye
steps:
- intent: goodbye
- action: utter_goodbye
- rule: Say 'I am a bot' anytime the user challenges
steps:
- intent: bot_challenge
- action: utter_iamabot
- rule: Id asked
steps:
- intent: ask_id
- action: action_session_id
- rule: Demo form Activate
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- rule: Call back Form Activate
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- rule: Email signup Form Activate
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- rule: Query form Activate
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- rule: Submit form Demo
condition:
# Condition that form is active.
- active_loop: user_details_form
steps:
# Form is deactivated
- action: user_details_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: action_submit
- action: demo_slot_reset
- action: utter_show_options2
- rule: Submit form Email
condition:
# Condition that form is active.
- active_loop: email_form
steps:
# Form is deactivated
- action: email_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: email_submit
- action: utter_show_options2
- rule: Submit form Query
condition:
# Condition that form is active.
- active_loop: query_form
steps:
# Form is deactivated
- action: query_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: query_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
- rule: Submit form Call letter
condition:
# Condition that form is active.
- active_loop: call_form
steps:
# Form is deactivated
- action: call_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: call_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
\ No newline at end of file
version: "2.0"
stories:
- story: happy path
steps:
- intent: greet
- action: utter_show_options
- story: bye
steps:
- intent: deny
- action: utter_goodbye
- story: user details form stop
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: query form stop
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: email form stop
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: call form stop
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
\ No newline at end of file
version: '3'
services:
rasa-shell:
image: "rasa-shell:v1.0"
container_name: "rasa-shell"
ports:
- "5005:5005"
restart: always
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
action-server:
image: "rasa-actions:v1.0"
container_name: "action-server"
ports:
- "5055:5055"
restart: always
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
rasa-flask:
image: "rasa-flask:v1.0"
container_name: "rasa-flask"
restart: always
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
networks:
default:
external:
name: "rasa-services"
\ No newline at end of file
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: false
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- glens
- ilens
- mlens
- show_options
- know_more
- ask_id
- request_demo
- request_call_back
- signup_for_email_newsletter
- send_us_a_query
- out_of_scope
- name_entry:
use_entities:
- name
- email_entry:
use_entities:
- email
- number_entry:
use_entities:
- number
- company_entry:
use_entities:
- company
- query_entry:
use_entities:
- query
- nlu_feedback
entities:
- name
- email
- number
- company
- query
slots:
demo:
type: unfeaturized
influence_conversation: false
name:
type: unfeaturized
influence_conversation: false
email:
type: unfeaturized
influence_conversation: false
number:
type: unfeaturized
influence_conversation: false
company:
type: unfeaturized
influence_conversation: false
query:
type: unfeaturized
influence_conversation: false
requested_slot:
type: unfeaturized
influence_conversation: false
responses:
utter_exit_form:
- text: I am sorry, I could not process your request.
utter_request_demo:
- text: You have requested for a demo.
utter_request_call_back:
- text: You have requested for a call back.
utter_signup_for_email_newsletter:
- text: You have requested for email newsletter signup.
utter_send_us_a_query:
- text: You have requested to send us a query.
utter_greet:
- text: Hello there, Welcome to KL bot.
utter_enter:
- text: Please enter your details
utter_cheer_up:
- image: https://i.imgur.com/nGF1K8f.jpg
text: 'Here is something to cheer you up:'
utter_did_that_help:
- text: Did that help you?
utter_happy:
- text: Great, carry on!
utter_goodbye:
- text: Thank you. Have a great day!
utter_iamabot:
- text: I am a bot, powered by Rasa.
utter_glens:
- text: GLens is Real-Time Data Acquisition, Monitoring and Analytics suite of Products
for Industrial Emissions, Effluent Discharges and Ambient Air Monitoring. GLens
DAS Software, GLens Server Platform, GLens Environ Data Logger provides a comprehensive
solution for all Industry Environmental needs.
utter_ilens:
- text: Intelligent IoT Solutions, built for Industry 4.0
utter_mlens:
- text: MLens is a one-stop solution for all your Big Data needs, from Automated
Disaster Recovery to Compute Workload Migration, and everything in between.
utter_show_options:
- buttons:
- payload: request_demo
title: Request a Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for our Montly Newsletter
- payload: send_us_a_query
title: Send us a query
text: Hello there! How may I assist you today?
utter_show_options2:
- buttons:
- payload: request_demo
title: Request Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for email newsletter
- payload: send_us_a_query
title: Send us a query
text: Is there anything else we can help you with?
utter_know_more:
- text: Please enter your email id for contacting you
utter_ask_name:
- text: Please enter your name to proceed.
utter_ask_email:
- text: Please enter your email id.
utter_ask_number:
- text: Please enter your mobile number.
utter_ask_company:
- text: Please enter your company name.
utter_thanks:
- text: Thanks for providing the values.
utter_ask_query:
- text: Please tell us your query.
utter_details_thanks:
- text: "Thanks for providing the details \n email: {email} \n name: {name} \n mobile:\
\ {number} \n company: {company}"
utter_out_of_scope:
- text: Sorry, I did'nt get what you said. Please rephrase what you said.
utter_ask_demo:
- buttons:
- payload: glens
title: "GLens"
- payload: ilens
title: "ILens"
- payload: mlens
title: "MLens"
text: Please select the product that you would like to schedule a demo for.
actions:
- action_submit
- email_submit
- query_submit
- call_submit
- action_slot_reset
- action_session_id
- validate_email_form
- validate_call_form
- validate_query_form
- validate_user_details_form
- demo_slot_reset
forms:
user_details_form:
demo:
- entity: None
type: from_text
not_intent: deny
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
call_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
email_form:
email:
- entity: None
type: from_text
not_intent: deny
query_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
query:
- entity: None
type: from_text
not_intent: deny
\ No newline at end of file
# This file contains the different endpoints your bot can use.
# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
#models:
# url: http://my-server.com/models/default_core@latest
# wait_time_between_pulls: 10 # [optional](default: 100)
# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions
action_endpoint:
url: "http://action-server:5055/webhook"
# Tracker store which is used to store pippithe conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/tracker-stores
#tracker_store:
# type: redis
# url: <host of the redis instance, e.g. localhost>
# port: <port of your redis instance, usually 6379>
# db: <number of your database within redis, e.g. 0>
# password: <password used for authentication>
# use_ssl: <whether or not the communication is encrypted, default false>
#tracker_store:
# type: mongod
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
# db: <name of the db within your mongo instance, e.g. rasa>
# username: <username used for authentication>
# password: <password used for authentication>
# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/event-brokers
#event_broker:
# url: localhost
# username: username
# password: password
# queue: queue
#### This file contains tests to evaluate that your bot behaves as expected.
#### If you want to learn more, please see the docs: https://rasa.com/docs/rasa/testing-your-assistant
stories:
- story: happy path 1
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- story: happy path 2
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: sad path 1
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
yes
intent: affirm
- action: utter_happy
- story: sad path 2
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
not really
intent: deny
- action: utter_goodbye
- story: sad path 3
steps:
- user: |
hi
intent: greet
- action: utter_greet
- user: |
very terrible
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
no
intent: deny
- action: utter_goodbye
- story: say goodbye
steps:
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: bot challenge
steps:
- user: |
are you a bot?
intent: bot_challenge
- action: utter_iamabot
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.6 (rasa_x)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Nosetests" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyChainedComparisonsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoreConstantInTheMiddle" value="true" />
</inspection_tool>
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="46">
<item index="0" class="java.lang.String" itemvalue="scikit-image" />
<item index="1" class="java.lang.String" itemvalue="scipy" />
<item index="2" class="java.lang.String" itemvalue="opencv-python" />
<item index="3" class="java.lang.String" itemvalue="torch" />
<item index="4" class="java.lang.String" itemvalue="torchvision" />
<item index="5" class="java.lang.String" itemvalue="absl-py" />
<item index="6" class="java.lang.String" itemvalue="protobuf" />
<item index="7" class="java.lang.String" itemvalue="rsa" />
<item index="8" class="java.lang.String" itemvalue="tensorflow-estimator" />
<item index="9" class="java.lang.String" itemvalue="opt-einsum" />
<item index="10" class="java.lang.String" itemvalue="python-dateutil" />
<item index="11" class="java.lang.String" itemvalue="cycler" />
<item index="12" class="java.lang.String" itemvalue="gast" />
<item index="13" class="java.lang.String" itemvalue="numpy" />
<item index="14" class="java.lang.String" itemvalue="pyasn1" />
<item index="15" class="java.lang.String" itemvalue="requests" />
<item index="16" class="java.lang.String" itemvalue="importlib-metadata" />
<item index="17" class="java.lang.String" itemvalue="pyasn1-modules" />
<item index="18" class="java.lang.String" itemvalue="requests-oauthlib" />
<item index="19" class="java.lang.String" itemvalue="tensorflow" />
<item index="20" class="java.lang.String" itemvalue="tensorboard-plugin-wit" />
<item index="21" class="java.lang.String" itemvalue="zipp" />
<item index="22" class="java.lang.String" itemvalue="oauthlib" />
<item index="23" class="java.lang.String" itemvalue="astunparse" />
<item index="24" class="java.lang.String" itemvalue="urllib3" />
<item index="25" class="java.lang.String" itemvalue="pyparsing" />
<item index="26" class="java.lang.String" itemvalue="Cython" />
<item index="27" class="java.lang.String" itemvalue="Markdown" />
<item index="28" class="java.lang.String" itemvalue="google-auth-oauthlib" />
<item index="29" class="java.lang.String" itemvalue="Werkzeug" />
<item index="30" class="java.lang.String" itemvalue="kiwisolver" />
<item index="31" class="java.lang.String" itemvalue="tqdm" />
<item index="32" class="java.lang.String" itemvalue="yolov5processor" />
<item index="33" class="java.lang.String" itemvalue="tensorboard" />
<item index="34" class="java.lang.String" itemvalue="future" />
<item index="35" class="java.lang.String" itemvalue="matplotlib" />
<item index="36" class="java.lang.String" itemvalue="cachetools" />
<item index="37" class="java.lang.String" itemvalue="grpcio" />
<item index="38" class="java.lang.String" itemvalue="Keras" />
<item index="39" class="java.lang.String" itemvalue="google-auth" />
<item index="40" class="java.lang.String" itemvalue="idna" />
<item index="41" class="java.lang.String" itemvalue="Pillow" />
<item index="42" class="java.lang.String" itemvalue="cython" />
<item index="43" class="java.lang.String" itemvalue="keras" />
<item index="44" class="java.lang.String" itemvalue="imgaug" />
<item index="45" class="java.lang.String" itemvalue="opencv-contrib-python" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N806" />
<option value="N801" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="cv2.imresize" />
<option value="detectron2.model_zoo.get_config_file" />
<option value="detectron2.model_zoo.get_checkpoint_url" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (rasa_x)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/KL-Bot.iml" filepath="$PROJECT_DIR$/.idea/KL-Bot.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3ade1139-54f0-423a-8d8a-8e1d4fc91729" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="ProjectId" id="1mN8oBxoHGeinS2XvQH12xIGEhY" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Admin\Desktop\Rasa" />
</key>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3ade1139-54f0-423a-8d8a-8e1d4fc91729" name="Default Changelist" comment="" />
<created>1609322860467</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1609322860467</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="566" y="252" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1609739904059">
<screen x="0" y="0" width="1600" height="900" />
</state>
<state x="566" y="252" key="#com.intellij.fileTypes.FileTypeChooser/0.0.1600.900@0.0.1600.900" timestamp="1609739904059" />
<state x="580" y="205" key="FileChooserDialogImpl" timestamp="1610446271799">
<screen x="0" y="0" width="1600" height="900" />
</state>
<state x="580" y="205" key="FileChooserDialogImpl/0.0.1600.900@0.0.1600.900" timestamp="1610446271799" />
<state x="301" y="95" key="SettingsEditor" timestamp="1609833928728">
<screen x="0" y="0" width="1600" height="900" />
</state>
<state x="301" y="95" key="SettingsEditor/0.0.1600.900@0.0.1600.900" timestamp="1609833928728" />
</component>
</project>
\ No newline at end of file
FROM python:3.6-stretch
RUN pip install rasa rasa-sdk
ADD . /opt/code
WORKDIR /opt/code
CMD rasa run -m models --enable-api --cors "*"
\ No newline at end of file
# Rasa_CustomUI-v_2.0
A Chat widget easy to connect to RASA bot to Custom Channel(a webpage).
Added Support for
- Buttons
- Images
Command to start the bot:
> rasa run -m models --enable-api --cors "*" --debug
## Screenshots:
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_1.PNG)
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_2.PNG)
<!DOCTYPE html>
<html>
<head>
<title>ChatBot</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<!--Main css-->
<link rel="stylesheet" type="text/css" href="static/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="container">
<div class="widget">
<div class="chat_header">
<!--Add the name of the bot here -->
<span style="color:white;margin-left: 5px;">KL Bot </span>
<!-- <span style="color:white;margin-right: 5px;float:right;margin-top: 5px;" id="close">
<i class="material-icons">close</i>
</span> -->
</div>
<!--Chatbot contents goes here -->
<div class="chats" id="chats">
<div class="clearfix"></div>
</div>
<!--user typing indicator -->
<div class="keypad">
<input type="text" id="keypad" class="usrInput browser-default" placeholder="Type a message..."
autocomplete="off">
</div>
</div>
<!--bot widget -->
<div class="profile_div" id="profile_div">
<img class="imgProfile" src="static/img/chat-bot.svg" />
</div>
<div class="profile_toggle" id="close">
<i class="material-icons bootToggle">keyboard_arrow_down</i>
</div>
</div>
<!--JavaScript at end of body for optimized loading-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="static/js/materialize.min.js"></script>
<!--Main Script -->
<script type="text/javascript" src="static/js/script.js"></script>
</body>
</html>
\ No newline at end of file
/*! Flickity v2.2.0
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled{position:relative}.flickity-enabled:focus{outline:0}.flickity-viewport{overflow:hidden;position:relative;height:100%}.flickity-slider{position:absolute;width:100%;height:100%}.flickity-enabled.is-draggable{-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.flickity-enabled.is-draggable .flickity-viewport{cursor:move;cursor:-webkit-grab;cursor:grab}.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down{cursor:-webkit-grabbing;cursor:grabbing}.flickity-button{position:absolute;background:hsla(0,0%,100%,.75);border:none;color:#333}.flickity-button:hover{background:#fff;cursor:pointer}.flickity-button:focus{outline:0;box-shadow:0 0 0 5px #19F}.flickity-button:active{opacity:.6}.flickity-button:disabled{opacity:.3;cursor:auto;pointer-events:none}.flickity-button-icon{fill:currentColor}.flickity-prev-next-button{top:50%;width:44px;height:44px;border-radius:50%;transform:translateY(-50%)}.flickity-prev-next-button.previous{left:10px}.flickity-prev-next-button.next{right:10px}.flickity-rtl .flickity-prev-next-button.previous{left:auto;right:10px}.flickity-rtl .flickity-prev-next-button.next{right:auto;left:10px}.flickity-prev-next-button .flickity-button-icon{position:absolute;left:20%;top:20%;width:60%;height:60%}.flickity-page-dots{position:absolute;width:100%;bottom:-25px;padding:0;margin:0;list-style:none;text-align:center;line-height:1}.flickity-rtl .flickity-page-dots{direction:rtl}.flickity-page-dots .dot{display:inline-block;width:10px;height:10px;margin:0 8px;background:#333;border-radius:50%;opacity:.25;cursor:pointer}.flickity-page-dots .dot.is-selected{opacity:1}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
.widget {
display: none;
width: 400px;
right: 15px;
height: 650px;
bottom: 9%;
position: fixed;
background: #f6f6f6;
border-radius: 10px 10px 10px 10px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
}
.chat_header {
height: 7%;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
/* #6072e6 */
border-radius: 10px 10px 0px 0px;
padding: 5px;
font-size: 20px;
}
.chats {
height: 520px;
padding: 5px;
margin-top: 5px;
border-radius: 1px;
overflow-y: auto;
transition: 0.2s;
}
/* div.chats::-webkit-scrollbar {
width: 0px;
/* remove scrollbar space /
background: transparent;
/ optional: just make scrollbar invisible */
} */
/* Track */
div.chats::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
div.chats::-webkit-scrollbar-thumb {
background: #c0bebe;
}
/* Handle on hover */
div.chats::-webkit-scrollbar-thumb:hover {
background: #918f8f;
}
#close {
cursor: pointer;
}
.clearfix {
margin-top: 2px;
margin-bottom: 2px;
}
.message {
margin-top: 5px;
margin-bottom: 5px;
margin-right: 0;
margin-left: 0;
}
.botAvatar {
/* border-radius: 50%; */
width: 1.5em;
height: 1.5em;
float: left;
margin-left: 5px;
/* border: 2px solid #6072e6; */
}
.botMsg {
float: left;
margin-top: 5px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #efeef5;
border: 1px solid #ffffff;
margin-left: 0.5em;
padding: 0.6em 1em;
border-radius: 1.5em;
max-width: 55%;
min-width: 25%;
font-size: 12px;
word-wrap: break-word;
}
.userMsg {
animation: animateElement linear 0.2s;
animation-iteration-count: 1;
margin-top: 5px;
word-wrap: break-word;
padding: 0.6em 1em;
float: right;
margin-right: 0.5em;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border: 1px solid transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
color: #fff;
border-radius: 1.5em;
margin-bottom: 0.15em;
font-size: 12px;
max-width: 55%;
min-width: 25%;
line-height: 1.5em;
}
.userAvatar {
animation: animateElement linear 0.3s;
animation-iteration-count: 1;
border-radius: 50%;
width: 1.5em;
height: 1.5em;
float: right;
margin-right: 5px;
border: 2px solid #6072e6;
}
.singleCard {
/* height: 200px; */
padding-left: 10%;
padding-right: 10px;
}
.suggestions {
padding: 5px;
width: 100%;
/* border-radius: 10px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #dbdade; */
}
.cardsImage {
width: 100%;
height: 80%;
border-radius: 10px 10px 0px 0px;
}
.keypad {
height: 45px;
position: absolute;
bottom: 10px;
width: 320px;
}
.usrInput {
background: #f1f0f0;
padding: 0.5em;
width: 90%;
margin-left: 4%;
border-radius: 20px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
border: 0;
padding-left: 15px;
height: 40px;
}
input:focus {
outline: none;
}
video:focus {
outline: none;
}
.menuTitle {
padding: 5px;
margin-top: 5px;
margin-bottom: 5px;
}
.menu {
padding: 5px;
}
.menuChips {
background: #85eb8aa3;
color: #188c33;
text-align: center;
padding: 8px;
border: #85eb8aa3;
margin: 5px;
cursor: pointer;
border-radius: 8px;
font-size: 14px;
word-wrap: break-word;
float: right;
}
.imgcard {
object-fit: cover;
width: 80%;
height: 90%;
border-radius: 10px 10px 10px 10px;
margin-left: 1%;
}
.chip {
background-color: #6072e6;
color: #fff;
font-weight: normal;
font-weight: 0;
text-align: center;
}
@keyframes animateElement {
0% {
opacity: 0;
transform: translate(0px, 10px);
}
100% {
opacity: 1;
transform: translate(0px, 0px);
}
}
.imgProfile {
box-shadow: 0 0px 1px 0 rgba(0, 0, 0, 0.16), 0 0px 10px 0 rgba(0, 0, 0, 0.12);
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border-radius: 22px;
width: 60px;
padding: 10px;
}
.profile_div {
/* display: none; */
position: fixed;
padding: 5px;
width: 10%;
bottom: 0;
right: -65px;
cursor: pointer;
}
.profile_toggle{
display: none;
position: fixed;
padding: 5px;
width: 5%;
bottom: 0;
right: 0;
cursor: pointer;
}
.profileIcon {
height: 15%;
align-items: center;
float: left;
margin-right: 10px;
}
.bootToggle{
padding: 2px;
margin: 10px;
border-radius: 30px;
color: #ffffff;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
font-size: 35px !important;
}
::-webkit-scrollbar {
width: 8px;
height: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px #605c5c;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: grey;
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42.18" viewBox="0 0 42 42.18">
<defs>
<style>
.cls-1 {
fill: #fff;
}
.cls-2 {
fill: none;
}
.cls-3 {
fill: #25d366;
}
</style>
</defs>
<g id="chat-bot" transform="translate(-0.332)">
<path id="Path_4" data-name="Path 4" class="cls-1" d="M18.865,35.363V32.33h14.27a2.416,2.416,0,0,0,1.836-.887A3.306,3.306,0,0,0,35.73,29.3V8.066a3.306,3.306,0,0,0-.759-2.146,2.416,2.416,0,0,0-1.836-.887H7.189a2.416,2.416,0,0,0-1.836.887,3.306,3.306,0,0,0-.759,2.146V29.3a3.306,3.306,0,0,0,.759,2.146,2.416,2.416,0,0,0,1.836.887H18.865v3.033H7.189C4.322,35.363,2,32.646,2,29.3V8.066C2,4.715,4.323,2,7.189,2H33.135C36,2,38.325,4.715,38.325,8.066V40.457c0,3.351-8.6-5.094-11.462-5.095h-8Z" transform="translate(0.595 -2)"/>
<rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-2" width="42" height="42" transform="translate(0.332 0.18)"/>
<rect id="Rectangle_1" data-name="Rectangle 1" class="cls-1" width="32" height="29" rx="4" transform="translate(4.332 2.18)"/>
<path id="Path_1" data-name="Path 1" class="cls-3" d="M17.734,20.259A9.069,9.069,0,0,1,10.167,16.2l2.161-1.437a6.487,6.487,0,0,0,10.812,0L25.3,16.2a9.069,9.069,0,0,1-7.567,4.059Z" transform="translate(3.023 3.313)"/>
<path id="Path_2" data-name="Path 2" class="cls-3" d="M20.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,20.595,8Z" transform="translate(5.352 1.302)"/>
<path id="Path_3" data-name="Path 3" class="cls-3" d="M12.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,12.595,8Z" transform="translate(2.973 1.302)"/>
</g>
</svg>
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
This source diff could not be displayed because it is too large. You can view the blob instead.
// on input/text enter--------------------------------------------------------------------------------------
$('.usrInput').on('keyup keypress', function (e) {
var keyCode = e.keyCode || e.which;
var text = $(".usrInput").val();
if (keyCode === 13) {
if (text == "" || $.trim(text) == '') {
e.preventDefault();
return false;
} else {
$(".usrInput").blur();
setUserResponse(text);
send(text);
e.preventDefault();
return false;
}
}
});
//------------------------------------- Set user response------------------------------------
function setUserResponse(val) {
var UserResponse = '<p class="userMsg">' + val + ' </p><div class="clearfix"></div>';
$(UserResponse).appendTo('.chats').show('slow');
$(".usrInput").val('');
scrollToBottomOfResults();
$('.suggestions').remove();
}
//---------------------------------- Scroll to the bottom of the chats-------------------------------
function scrollToBottomOfResults() {
var terminalResultsDiv = document.getElementById('chats');
terminalResultsDiv.scrollTop = terminalResultsDiv.scrollHeight;
}
function e3() {
var h='0123456789abcdef';
var k='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
/* same as e4() below */
}
function e4() {
var h=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var k=['x','x','x','x','x','x','x','x','-','x','x','x','x','-','4','x','x','x','-','y','x','x','x','-','x','x','x','x','x','x','x','x','x','x','x','x'];
var u='',i=0,rb=Math.random()*0xffffffff|0;
while(i++<36) {
var c=k[i-1],r=rb&0xf,v=c=='x'?r:(r&0x3|0x8);
u+=(c=='-'||c=='4')?c:h[v];rb=i%8==0?Math.random()*0xffffffff|0:rb>>4
}
return u
}
x = e4()
function send(message) {
console.log("User Message:", message)
$.ajax({
url: 'http://localhost:5005/webhooks/rest/webhook',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"message": message,
"sender": x
}),
success: function (data, textStatus) {
if(data != null){
setBotResponse(data);
}
console.log("Rasa Response: ", data, "\n Status:", textStatus)
},
error: function (errorMessage) {
setBotResponse("");
console.log('Error' + errorMessage);
}
});
}
send("Hi");
//------------------------------------ Set bot response -------------------------------------
function setBotResponse(val) {
setTimeout(function () {
if (val.length < 1) {
//if there is no response from Rasa
msg = 'I couldn\'t get that. Let\' try something else!';
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + msg + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
} else {
//if we get response from Rasa
for (i = 0; i < val.length; i++) {
//check if there is text message
if (val[i].hasOwnProperty("text")) {
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + val[i].text + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is image
if (val[i].hasOwnProperty("image")) {
var BotResponse = '<div class="singleCard">' +
'<img class="imgcard" src="' + val[i].image + '">' +
'</div><div class="clearfix">'
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is button message
if (val[i].hasOwnProperty("buttons")) {
addSuggestion(val[i].buttons);
}
}
scrollToBottomOfResults();
}
}, 500);
}
// ------------------------------------------ Toggle chatbot -----------------------------------------------
$('#profile_div').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
scrollToBottomOfResults();
});
$('#close').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
});
// ------------------------------------------ Suggestions -----------------------------------------------
function addSuggestion(textToAdd) {
setTimeout(function () {
var suggestions = textToAdd;
var suggLength = textToAdd.length;
$(' <div class="singleCard"> <div class="suggestions"><div class="menu"></div></div></diV>').appendTo('.chats').hide().fadeIn(1000);
// Loop through suggestions
for (i = 0; i < suggLength; i++) {
$('<button class="menuChips" data-payload=\''+(suggestions[i].payload)+'\'>' + suggestions[i].title + "</button>").appendTo(".menu");
}
scrollToBottomOfResults();
}, 1000);
}
// on click of suggestions, get the value and send to rasa
$(document).on("click", ".menu .menuChips", function () {
var text = this.innerText;
var payload= this.getAttribute('data-payload');
console.log("button payload: ",this.getAttribute('data-payload'))
setUserResponse(text);
send(payload);
$('.suggestions').remove(); //delete the suggestions
});
FROM python:3.6-stretch
RUN pip install rasa rasa-sdk
ADD . /opt/code
WORKDIR /opt/code
CMD rasa run actions
\ No newline at end of file
# Rasa_CustomUI-v_2.0
A Chat widget easy to connect to RASA bot to Custom Channel(a webpage).
Added Support for
- Buttons
- Images
Command to start the bot:
> rasa run -m models --enable-api --cors "*" --debug
## Screenshots:
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_1.PNG)
![ScreenShot](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0/blob/master/static/img/ui_2.PNG)
<!DOCTYPE html>
<html>
<head>
<title>ChatBot</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<!--Main css-->
<link rel="stylesheet" type="text/css" href="static/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="container">
<div class="widget">
<div class="chat_header">
<!--Add the name of the bot here -->
<span style="color:white;margin-left: 5px;">KL Bot </span>
<!-- <span style="color:white;margin-right: 5px;float:right;margin-top: 5px;" id="close">
<i class="material-icons">close</i>
</span> -->
</div>
<!--Chatbot contents goes here -->
<div class="chats" id="chats">
<div class="clearfix"></div>
</div>
<!--user typing indicator -->
<div class="keypad">
<input type="text" id="keypad" class="usrInput browser-default" placeholder="Type a message..."
autocomplete="off">
</div>
</div>
<!--bot widget -->
<div class="profile_div" id="profile_div">
<img class="imgProfile" src="static/img/chat-bot.svg" />
</div>
<div class="profile_toggle" id="close">
<i class="material-icons bootToggle">keyboard_arrow_down</i>
</div>
</div>
<!--JavaScript at end of body for optimized loading-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="static/js/materialize.min.js"></script>
<!--Main Script -->
<script type="text/javascript" src="static/js/script.js"></script>
</body>
</html>
\ No newline at end of file
/*! Flickity v2.2.0
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled{position:relative}.flickity-enabled:focus{outline:0}.flickity-viewport{overflow:hidden;position:relative;height:100%}.flickity-slider{position:absolute;width:100%;height:100%}.flickity-enabled.is-draggable{-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.flickity-enabled.is-draggable .flickity-viewport{cursor:move;cursor:-webkit-grab;cursor:grab}.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down{cursor:-webkit-grabbing;cursor:grabbing}.flickity-button{position:absolute;background:hsla(0,0%,100%,.75);border:none;color:#333}.flickity-button:hover{background:#fff;cursor:pointer}.flickity-button:focus{outline:0;box-shadow:0 0 0 5px #19F}.flickity-button:active{opacity:.6}.flickity-button:disabled{opacity:.3;cursor:auto;pointer-events:none}.flickity-button-icon{fill:currentColor}.flickity-prev-next-button{top:50%;width:44px;height:44px;border-radius:50%;transform:translateY(-50%)}.flickity-prev-next-button.previous{left:10px}.flickity-prev-next-button.next{right:10px}.flickity-rtl .flickity-prev-next-button.previous{left:auto;right:10px}.flickity-rtl .flickity-prev-next-button.next{right:auto;left:10px}.flickity-prev-next-button .flickity-button-icon{position:absolute;left:20%;top:20%;width:60%;height:60%}.flickity-page-dots{position:absolute;width:100%;bottom:-25px;padding:0;margin:0;list-style:none;text-align:center;line-height:1}.flickity-rtl .flickity-page-dots{direction:rtl}.flickity-page-dots .dot{display:inline-block;width:10px;height:10px;margin:0 8px;background:#333;border-radius:50%;opacity:.25;cursor:pointer}.flickity-page-dots .dot.is-selected{opacity:1}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
.widget {
display: none;
width: 400px;
right: 15px;
height: 650px;
bottom: 9%;
position: fixed;
background: #f6f6f6;
border-radius: 10px 10px 10px 10px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
}
.chat_header {
height: 7%;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
/* #6072e6 */
border-radius: 10px 10px 0px 0px;
padding: 5px;
font-size: 20px;
}
.chats {
height: 520px;
padding: 5px;
margin-top: 5px;
border-radius: 1px;
overflow-y: auto;
transition: 0.2s;
}
/* div.chats::-webkit-scrollbar {
width: 0px;
/* remove scrollbar space /
background: transparent;
/ optional: just make scrollbar invisible */
} */
/* Track */
div.chats::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
div.chats::-webkit-scrollbar-thumb {
background: #c0bebe;
}
/* Handle on hover */
div.chats::-webkit-scrollbar-thumb:hover {
background: #918f8f;
}
#close {
cursor: pointer;
}
.clearfix {
margin-top: 2px;
margin-bottom: 2px;
}
.message {
margin-top: 5px;
margin-bottom: 5px;
margin-right: 0;
margin-left: 0;
}
.botAvatar {
/* border-radius: 50%; */
width: 1.5em;
height: 1.5em;
float: left;
margin-left: 5px;
/* border: 2px solid #6072e6; */
}
.botMsg {
float: left;
margin-top: 5px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #efeef5;
border: 1px solid #ffffff;
margin-left: 0.5em;
padding: 0.6em 1em;
border-radius: 1.5em;
max-width: 55%;
min-width: 25%;
font-size: 12px;
word-wrap: break-word;
}
.userMsg {
animation: animateElement linear 0.2s;
animation-iteration-count: 1;
margin-top: 5px;
word-wrap: break-word;
padding: 0.6em 1em;
float: right;
margin-right: 0.5em;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border: 1px solid transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
color: #fff;
border-radius: 1.5em;
margin-bottom: 0.15em;
font-size: 12px;
max-width: 55%;
min-width: 25%;
line-height: 1.5em;
}
.userAvatar {
animation: animateElement linear 0.3s;
animation-iteration-count: 1;
border-radius: 50%;
width: 1.5em;
height: 1.5em;
float: right;
margin-right: 5px;
border: 2px solid #6072e6;
}
.singleCard {
/* height: 200px; */
padding-left: 10%;
padding-right: 10px;
}
.suggestions {
padding: 5px;
width: 100%;
/* border-radius: 10px;
background: #ffffff;
box-shadow: 2px 5px 5px 1px #dbdade; */
}
.cardsImage {
width: 100%;
height: 80%;
border-radius: 10px 10px 0px 0px;
}
.keypad {
height: 45px;
position: absolute;
bottom: 10px;
width: 320px;
}
.usrInput {
background: #f1f0f0;
padding: 0.5em;
width: 90%;
margin-left: 4%;
border-radius: 20px;
box-shadow: 0px 2px 10px 1px #b5b5b5;
border: 0;
padding-left: 15px;
height: 40px;
}
input:focus {
outline: none;
}
video:focus {
outline: none;
}
.menuTitle {
padding: 5px;
margin-top: 5px;
margin-bottom: 5px;
}
.menu {
padding: 5px;
}
.menuChips {
background: #85eb8aa3;
color: #188c33;
text-align: center;
padding: 8px;
border: #85eb8aa3;
margin: 5px;
cursor: pointer;
border-radius: 8px;
font-size: 14px;
word-wrap: break-word;
float: right;
}
.imgcard {
object-fit: cover;
width: 80%;
height: 90%;
border-radius: 10px 10px 10px 10px;
margin-left: 1%;
}
.chip {
background-color: #6072e6;
color: #fff;
font-weight: normal;
font-weight: 0;
text-align: center;
}
@keyframes animateElement {
0% {
opacity: 0;
transform: translate(0px, 10px);
}
100% {
opacity: 1;
transform: translate(0px, 0px);
}
}
.imgProfile {
box-shadow: 0 0px 1px 0 rgba(0, 0, 0, 0.16), 0 0px 10px 0 rgba(0, 0, 0, 0.12);
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
border-radius: 22px;
width: 60px;
padding: 10px;
}
.profile_div {
/* display: none; */
position: fixed;
padding: 5px;
width: 10%;
bottom: 0;
right: -65px;
cursor: pointer;
}
.profile_toggle{
display: none;
position: fixed;
padding: 5px;
width: 5%;
bottom: 0;
right: 0;
cursor: pointer;
}
.profileIcon {
height: 15%;
align-items: center;
float: left;
margin-right: 10px;
}
.bootToggle{
padding: 2px;
margin: 10px;
border-radius: 30px;
color: #ffffff;
background: transparent linear-gradient(180deg, #69D135 0%, #1ECA5D 100%) 0% 0% no-repeat padding-box;;
font-size: 35px !important;
}
::-webkit-scrollbar {
width: 8px;
height: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px #605c5c;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: grey;
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42.18" viewBox="0 0 42 42.18">
<defs>
<style>
.cls-1 {
fill: #fff;
}
.cls-2 {
fill: none;
}
.cls-3 {
fill: #25d366;
}
</style>
</defs>
<g id="chat-bot" transform="translate(-0.332)">
<path id="Path_4" data-name="Path 4" class="cls-1" d="M18.865,35.363V32.33h14.27a2.416,2.416,0,0,0,1.836-.887A3.306,3.306,0,0,0,35.73,29.3V8.066a3.306,3.306,0,0,0-.759-2.146,2.416,2.416,0,0,0-1.836-.887H7.189a2.416,2.416,0,0,0-1.836.887,3.306,3.306,0,0,0-.759,2.146V29.3a3.306,3.306,0,0,0,.759,2.146,2.416,2.416,0,0,0,1.836.887H18.865v3.033H7.189C4.322,35.363,2,32.646,2,29.3V8.066C2,4.715,4.323,2,7.189,2H33.135C36,2,38.325,4.715,38.325,8.066V40.457c0,3.351-8.6-5.094-11.462-5.095h-8Z" transform="translate(0.595 -2)"/>
<rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-2" width="42" height="42" transform="translate(0.332 0.18)"/>
<rect id="Rectangle_1" data-name="Rectangle 1" class="cls-1" width="32" height="29" rx="4" transform="translate(4.332 2.18)"/>
<path id="Path_1" data-name="Path 1" class="cls-3" d="M17.734,20.259A9.069,9.069,0,0,1,10.167,16.2l2.161-1.437a6.487,6.487,0,0,0,10.812,0L25.3,16.2a9.069,9.069,0,0,1-7.567,4.059Z" transform="translate(3.023 3.313)"/>
<path id="Path_2" data-name="Path 2" class="cls-3" d="M20.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,20.595,8Z" transform="translate(5.352 1.302)"/>
<path id="Path_3" data-name="Path 3" class="cls-3" d="M12.595,8a2.569,2.569,0,1,0,1.842.752A2.595,2.595,0,0,0,12.595,8Z" transform="translate(2.973 1.302)"/>
</g>
</svg>
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
This source diff could not be displayed because it is too large. You can view the blob instead.
// on input/text enter--------------------------------------------------------------------------------------
$('.usrInput').on('keyup keypress', function (e) {
var keyCode = e.keyCode || e.which;
var text = $(".usrInput").val();
if (keyCode === 13) {
if (text == "" || $.trim(text) == '') {
e.preventDefault();
return false;
} else {
$(".usrInput").blur();
setUserResponse(text);
send(text);
e.preventDefault();
return false;
}
}
});
//------------------------------------- Set user response------------------------------------
function setUserResponse(val) {
var UserResponse = '<p class="userMsg">' + val + ' </p><div class="clearfix"></div>';
$(UserResponse).appendTo('.chats').show('slow');
$(".usrInput").val('');
scrollToBottomOfResults();
$('.suggestions').remove();
}
//---------------------------------- Scroll to the bottom of the chats-------------------------------
function scrollToBottomOfResults() {
var terminalResultsDiv = document.getElementById('chats');
terminalResultsDiv.scrollTop = terminalResultsDiv.scrollHeight;
}
function e3() {
var h='0123456789abcdef';
var k='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
/* same as e4() below */
}
function e4() {
var h=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var k=['x','x','x','x','x','x','x','x','-','x','x','x','x','-','4','x','x','x','-','y','x','x','x','-','x','x','x','x','x','x','x','x','x','x','x','x'];
var u='',i=0,rb=Math.random()*0xffffffff|0;
while(i++<36) {
var c=k[i-1],r=rb&0xf,v=c=='x'?r:(r&0x3|0x8);
u+=(c=='-'||c=='4')?c:h[v];rb=i%8==0?Math.random()*0xffffffff|0:rb>>4
}
return u
}
x = e4()
function send(message) {
console.log("User Message:", message)
$.ajax({
url: 'http://localhost:5005/webhooks/rest/webhook',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"message": message,
"sender": x
}),
success: function (data, textStatus) {
if(data != null){
setBotResponse(data);
}
console.log("Rasa Response: ", data, "\n Status:", textStatus)
},
error: function (errorMessage) {
setBotResponse("");
console.log('Error' + errorMessage);
}
});
}
send("Hi");
//------------------------------------ Set bot response -------------------------------------
function setBotResponse(val) {
setTimeout(function () {
if (val.length < 1) {
//if there is no response from Rasa
msg = 'I couldn\'t get that. Let\' try something else!';
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + msg + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
} else {
//if we get response from Rasa
for (i = 0; i < val.length; i++) {
//check if there is text message
if (val[i].hasOwnProperty("text")) {
var BotResponse = '<img class="botAvatar" src="./static/img/botAvatar_1.png"><p class="botMsg">' + val[i].text + '</p><div class="clearfix"></div>';
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is image
if (val[i].hasOwnProperty("image")) {
var BotResponse = '<div class="singleCard">' +
'<img class="imgcard" src="' + val[i].image + '">' +
'</div><div class="clearfix">'
$(BotResponse).appendTo('.chats').hide().fadeIn(1000);
}
//check if there is button message
if (val[i].hasOwnProperty("buttons")) {
addSuggestion(val[i].buttons);
}
}
scrollToBottomOfResults();
}
}, 500);
}
// ------------------------------------------ Toggle chatbot -----------------------------------------------
$('#profile_div').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
scrollToBottomOfResults();
});
$('#close').click(function () {
$('.profile_div').toggle();
$('.profile_toggle').toggle();
$('.widget').toggle();
});
// ------------------------------------------ Suggestions -----------------------------------------------
function addSuggestion(textToAdd) {
setTimeout(function () {
var suggestions = textToAdd;
var suggLength = textToAdd.length;
$(' <div class="singleCard"> <div class="suggestions"><div class="menu"></div></div></diV>').appendTo('.chats').hide().fadeIn(1000);
// Loop through suggestions
for (i = 0; i < suggLength; i++) {
$('<button class="menuChips" data-payload=\''+(suggestions[i].payload)+'\'>' + suggestions[i].title + "</button>").appendTo(".menu");
}
scrollToBottomOfResults();
}, 1000);
}
// on click of suggestions, get the value and send to rasa
$(document).on("click", ".menu .menuChips", function () {
var text = this.innerText;
var payload= this.getAttribute('data-payload');
console.log("button payload: ",this.getAttribute('data-payload'))
setUserResponse(text);
send(payload);
$('.suggestions').remove(); //delete the suggestions
});
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
import re
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker, FormValidationAction
from rasa_sdk.events import SlotSet, EventType
from rasa_sdk.executor import CollectingDispatcher
import webbrowser
from rasa_sdk.events import AllSlotsReset
from rasa_sdk.events import Restarted
from rasa_sdk.types import DomainDict
from actions.email_utility import SMTPUtility
import requests
def hit_api(payload):
try:
url = "http://rasa-flask:2526/insert_into_mongo"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
except Exception as e:
print(e)
class DemoSlotReset(Action):
def name(self) -> Text:
return "demo_slot_reset"
def run(self, dispatcher, tracker, domain):
return [SlotSet("demo", None)]
class UserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "user_details_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "demo"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class ActionSubmit(FormValidationAction):
def name(self) -> Text:
return "action_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will contact you for "
"scheduling the demo.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"product\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("demo")),
str(tracker.get_slot("company")),
"Requesting a Demo of " + str(
tracker.get_slot("demo")))
payload = "{" + body + "}"
hit_api(payload)
class CallForm(FormValidationAction):
def name(self) -> Text:
return "call_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class CallSubmit(FormValidationAction):
def name(self) -> Text:
return "call_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will reach out to you in "
"a short while.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"company\":\"{3}\",\"request\":\"{4}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("company")),
"Requesting for a Call Back")
payload = "{" + body + "}"
hit_api(payload)
class QueryForm(FormValidationAction):
def name(self) -> Text:
return "query_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "query"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class QuerySubmit(FormValidationAction):
def name(self) -> Text:
return "query_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Your query has been registered with us. Our team of experts will follow up with a "
"resolution soon.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"query\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("query")),
str(tracker.get_slot("company")),
"Have a Query")
payload = "{" + body + "}"
hit_api(payload)
class ActionRestarted(Action):
def name(self):
return 'action_restarted'
def run(self, dispatcher, tracker, domain):
return [Restarted()]
class ActionSlotReset(Action):
def name(self):
return 'action_slot_reset'
def run(self, dispatcher, tracker, domain):
return [AllSlotsReset()]
class ActionSessionId(Action):
def name(self) -> Text:
return "action_session_id"
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
conversation_id = tracker.sender_id
dispatcher.utter_message("The conversation id is {}".format(conversation_id))
return []
class EmailForm(Action):
def name(self) -> Text:
return "email_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["email"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
return [SlotSet("requested_slot", None)]
class EmailSubmit(FormValidationAction):
def name(self) -> Text:
return "email_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
# dispatcher.utter_message("Your Details: " + "\n Email: " + tracker.get_slot("email"))
dispatcher.utter_message("You have successfully subscribed to our newsletter.")
body = "\"email\":\"{0}\",\"request\":\"{1}\"".format(str(tracker.get_slot("email")), "Email Signup")
payload = "{" + body + "}"
hit_api(payload)
class ValidateEmailForm(FormValidationAction):
def name(self) -> Text:
return "validate_email_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
class ValidateUserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "validate_user_details_form"
def validate_demo(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
myval = ['mlens', 'ilens', 'glens']
mylist = str(slot_value.lower()).split(" ")
a = set(myval)
b = set(mylist)
if a & b:
return {'demo': list(a & b)[0]}
else:
dispatcher.utter_message("Sorry we dont have support for that product.")
return {'demo': None}
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid.")
return {'number': None}
class ValidateQueryForm(FormValidationAction):
def name(self) -> Text:
return "validate_query_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid.")
return {'number': None}
class ValidateCallForm(FormValidationAction):
def name(self) -> Text:
return "validate_call_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid.")
return {'number': None}
import ssl
import smtplib
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class SMTPUtility:
def __init__(self):
self.from_address = "dasharatha.vamshi@knowledgelens.com"
self.to_address = ["saivamshi2309@gmail.com", "saivamshi.s16@iiits.in"]
self.msg = MIMEMultipart()
self.msg['From'] = self.from_address
self.msg['To'] = " ,".join(self.to_address)
self.filename = ""
self.smtp_server = "smtp.gmail.com"
self.username = "dasharatha.vamshi@knowledgelens.com"
self.password = "Salla$230999"
self.smtp_server_port = 587
self.ssl = False
def send_email(self, content, attach=False):
try:
self.msg['Subject'] = "KL Bot: " + content['subject']
self.msg['body'] = content['body']
self.msg.attach(MIMEText(self.msg['body'], 'plain'))
# give filename in self.filename to attach a document.
if attach:
attachment = open(self.filename, "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % self.filename)
self.msg.attach(p)
# starting the sever
if self.ssl:
context = ssl.create_default_context()
with smtplib.SMTP_SSL(self.smtp_server, self.smtp_server_port, context=context) as server:
server.login(self.username, self.password)
server.sendmail(self.from_address, self.to_address, self.msg.as_string())
else:
s = smtplib.SMTP(self.smtp_server, self.smtp_server_port)
s.starttls()
s.login(self.username, self.password)
s.sendmail(self.from_address, self.to_address, self.msg.as_string())
s.quit()
return True
except:
return False
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
# No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# If you'd like to customize it, uncomment and adjust the pipeline.
# See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 300
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# No configuration for policies was provided. The following default policies were used to train your model.
# If you'd like to customize them, uncomment and adjust the policies.
# See https://rasa.com/docs/rasa/policies for more information.
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 5
epochs: 300
- name: RulePolicy
- name: MappingPolicy
- name: FormPolicy
# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/messaging-and-voice-channels
rest:
# # you don't need to provide anything here - this channel doesn't
# # require any credentials
#facebook:
# verify: "<verify>"
# secret: "<your secret>"
# page-access-token: "<your page access token>"
#slack:
# slack_token: "<your slack token>"
# slack_channel: "<the slack channel>"
# slack_signing_secret: "<your slack signing secret>"
#socketio:
# user_message_evt: <event name for user message>
# bot_message_evt: <event name for bot messages>
# session_persistence: <true/false>
#mattermost:
# url: "https://<mattermost instance>/api/v4"
# token: "<bot token>"
# webhook_url: "<callback URL>"
# This entry is needed if you are using Rasa X. The entry represents credentials
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5002/api"
version: "2.0"
nlu:
- intent: greet
examples: |
- hey
- hello
- hi
- hello there
- good morning
- good evening
- moin
- hey there
- let's go
- hey dude
- goodmorning
- goodevening
- good afternoon
- Hi
- intent: goodbye
examples: |
- good afternoon
- cu
- good by
- cee you later
- good night
- bye
- goodbye
- have a nice day
- see you around
- bye bye
- see you later
- intent: affirm
examples: |
- yes
- y
- indeed
- of course
- that sounds good
- correct
- intent: deny
examples: |
- no
- n
- never
- I don't think so
- don't like that
- no way
- not really
- why should i give
- no i dont want to mention
- why do you need that
- no i dont provide
- why do you need this
- i wont
- wont
- intent: ask_id
examples: |
- tell me the id
- tell me the conversation id
- tell me the chat id
- tell me the session id
- what is my conversational id
- conversational id
- session id
- may i know my session id
- intent: mood_great
examples: |
- perfect
- great
- amazing
- feeling like a king
- wonderful
- I am feeling very good
- I am great
- I am amazing
- I am going to save the world
- super stoked
- extremely good
- so so perfect
- so good
- so perfect
- intent: mood_unhappy
examples: |
- my day was horrible
- I am sad
- I don't feel very well
- I am disappointed
- super sad
- I'm so sad
- sad
- very sad
- unhappy
- not good
- not very good
- extremly sad
- so saad
- so sad
- intent: bot_challenge
examples: |
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
- intent: glens
examples: |
- what is glens?
- tell me about glens?
- what is green lens?
- glens?
- glens
- intent: ilens
examples: |
- what is ilens?
- tell me about ilens?
- ilens?
- ilens
- intent: mlens
examples: |
- what is mlens?
- tell me about mlens?
- mlens?
- mlens
- intent: know_more
examples: |
- know more?
- I want to know more?
- tell me more?
- more?
- know more
- intent: name_entry
examples: |
- my name is [vamshi](name)
- [raju](name)
- [kevin](name) is my name
- my name is [tarun](name)
- [rajesh](name)
- my name is [mike](name)
- [stark](name)
- [vamshi](name)
- [shiva](name)
- [kiran](name)
- [yuvraj](name)
- [yuvaraj](name)
- intent: my_email
examples: |
- my email is [sai@gmail.com](email)
- [saivamshi@gmail.com](email)
- [r@gamil.com](email)
- my email is [d@gmail.com](email)
- [dash@knowledgelens.com](email)
- [saik@gmail.com](email)
- [yuv@gmail.com](email)
- intent: email_entry
examples: |
- [vamshi@knowledgelens.com](email) is my email
- my email id is [sai@knowledgelens.com](email)
- [v@yahoo.co.in](email)
- [sai@yahoo.co.in](email)
- [yuvraj.s@knowledgelens.com](email)
- intent: number_entry
examples: |
- my number is [1234567890](number)
- [1234567809](number)
- [1029384756](number) is my number
- my number is [1234509876](number)
- [1902873674](number)
- my number is [7687564789](number)
- [1076452288](number)
- [7799558890](number)
- intent: company_entry
examples: |
- i am from [google](company)
- [knowledgelens](company)
- [unemployed](company)
- [student](company)
- intent: query_entry
examples: |
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- intent: request_demo
examples: |
- request demo
- can we have a demo
- can i get demo
- demo
- request_demo
- intent: request_call_back
examples: |
- call back
- can we have a call
- can you call back
- request_call_back
- intent: signup_for_email_newsletter
examples: |
- signup
- signup for email newsletter
- email signup
- newsletter signup
- signup_for_email_newsletter
- intent: send_us_a_query
examples: |
- i have a question
- i have a query
- can i get a answer for my question
- send a query
- intent: out_of_scope
examples: |
- I want to order food
- 2 + 2?
- us president?
version: "2.0"
rules:
- rule: Say goodbye anytime the user says goodbye
steps:
- intent: goodbye
- action: utter_goodbye
- rule: Say 'I am a bot' anytime the user challenges
steps:
- intent: bot_challenge
- action: utter_iamabot
- rule: Id asked
steps:
- intent: ask_id
- action: action_session_id
- rule: Demo form Activate
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- rule: Call back Form Activate
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- rule: Email signup Form Activate
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- rule: Query form Activate
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- rule: Submit form Demo
condition:
# Condition that form is active.
- active_loop: user_details_form
steps:
# Form is deactivated
- action: user_details_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: action_submit
- action: demo_slot_reset
- action: utter_show_options2
- rule: Submit form Email
condition:
# Condition that form is active.
- active_loop: email_form
steps:
# Form is deactivated
- action: email_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: email_submit
- action: utter_show_options2
- rule: Submit form Query
condition:
# Condition that form is active.
- active_loop: query_form
steps:
# Form is deactivated
- action: query_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: query_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
- rule: Submit form Call letter
condition:
# Condition that form is active.
- active_loop: call_form
steps:
# Form is deactivated
- action: call_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: call_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
\ No newline at end of file
version: "2.0"
stories:
- story: happy path
steps:
- intent: greet
- action: utter_show_options
- story: bye
steps:
- intent: deny
- action: utter_goodbye
- story: user details form stop
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: query form stop
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: email form stop
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: call form stop
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
\ No newline at end of file
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: false
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- glens
- ilens
- mlens
- show_options
- know_more
- ask_id
- request_demo
- request_call_back
- signup_for_email_newsletter
- send_us_a_query
- out_of_scope
- name_entry:
use_entities:
- name
- email_entry:
use_entities:
- email
- number_entry:
use_entities:
- number
- company_entry:
use_entities:
- company
- query_entry:
use_entities:
- query
- nlu_feedback
entities:
- name
- email
- number
- company
- query
slots:
demo:
type: unfeaturized
influence_conversation: false
name:
type: unfeaturized
influence_conversation: false
email:
type: unfeaturized
influence_conversation: false
number:
type: unfeaturized
influence_conversation: false
company:
type: unfeaturized
influence_conversation: false
query:
type: unfeaturized
influence_conversation: false
requested_slot:
type: unfeaturized
influence_conversation: false
responses:
utter_exit_form:
- text: I am sorry, I could not process your request.
utter_request_demo:
- text: You have requested for a demo.
utter_request_call_back:
- text: You have requested for a call back.
utter_signup_for_email_newsletter:
- text: You have requested for email newsletter signup.
utter_send_us_a_query:
- text: You have requested to send us a query.
utter_greet:
- text: Hello there, Welcome to KL bot.
utter_enter:
- text: Please enter your details
utter_cheer_up:
- image: https://i.imgur.com/nGF1K8f.jpg
text: 'Here is something to cheer you up:'
utter_did_that_help:
- text: Did that help you?
utter_happy:
- text: Great, carry on!
utter_goodbye:
- text: Thank you. Have a great day!
utter_iamabot:
- text: I am a bot, powered by Rasa.
utter_glens:
- text: GLens is Real-Time Data Acquisition, Monitoring and Analytics suite of Products
for Industrial Emissions, Effluent Discharges and Ambient Air Monitoring. GLens
DAS Software, GLens Server Platform, GLens Environ Data Logger provides a comprehensive
solution for all Industry Environmental needs.
utter_ilens:
- text: Intelligent IoT Solutions, built for Industry 4.0
utter_mlens:
- text: MLens is a one-stop solution for all your Big Data needs, from Automated
Disaster Recovery to Compute Workload Migration, and everything in between.
utter_show_options:
- buttons:
- payload: request_demo
title: Request a Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for our Monthly Newsletter
- payload: send_us_a_query
title: Send us a query
text: Hello there! How may I assist you today?
utter_show_options2:
- buttons:
- payload: request_demo
title: Request a Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for our Monthly Newsletter
- payload: send_us_a_query
title: Send us a query
text: Is there anything else we can help you with?
utter_know_more:
- text: Please enter your email id for contacting you
utter_ask_name:
- text: Please enter your name to proceed.
utter_ask_email:
- text: Please enter your email id.
utter_ask_number:
- text: Please enter your mobile number.
utter_ask_company:
- text: Please enter your company name.
utter_thanks:
- text: Thanks for providing the values.
utter_ask_query:
- text: Please tell us your query.
utter_details_thanks:
- text: "Thanks for providing the details \n email: {email} \n name: {name} \n mobile:\
\ {number} \n company: {company}"
utter_out_of_scope:
- text: Sorry, I did'nt get what you said. Please rephrase what you said.
utter_ask_demo:
- buttons:
- payload: glens
title: "GLens"
- payload: ilens
title: "ILens"
- payload: mlens
title: "MLens"
text: Please select the product that you would like to schedule a demo for.
actions:
- action_submit
- email_submit
- query_submit
- call_submit
- action_slot_reset
- action_session_id
- validate_email_form
- validate_call_form
- validate_query_form
- validate_user_details_form
- demo_slot_reset
forms:
user_details_form:
demo:
- entity: None
type: from_text
not_intent: deny
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
call_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
email_form:
email:
- entity: None
type: from_text
not_intent: deny
query_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
query:
- entity: None
type: from_text
not_intent: deny
\ No newline at end of file
# This file contains the different endpoints your bot can use.
# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
#models:
# url: http://my-server.com/models/default_core@latest
# wait_time_between_pulls: 10 # [optional](default: 100)
# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions
action_endpoint:
url: "http://rasa-services:5055/webhook"
# Tracker store which is used to store pippithe conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/tracker-stores
#tracker_store:
# type: redis
# url: <host of the redis instance, e.g. localhost>
# port: <port of your redis instance, usually 6379>
# db: <number of your database within redis, e.g. 0>
# password: <password used for authentication>
# use_ssl: <whether or not the communication is encrypted, default false>
#tracker_store:
# type: mongod
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
# db: <name of the db within your mongo instance, e.g. rasa>
# username: <username used for authentication>
# password: <password used for authentication>
# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/event-brokers
#event_broker:
# url: localhost
# username: username
# password: password
# queue: queue
#### This file contains tests to evaluate that your bot behaves as expected.
#### If you want to learn more, please see the docs: https://rasa.com/docs/rasa/testing-your-assistant
stories:
- story: happy path 1
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- story: happy path 2
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: sad path 1
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
yes
intent: affirm
- action: utter_happy
- story: sad path 2
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
not really
intent: deny
- action: utter_goodbye
- story: sad path 3
steps:
- user: |
hi
intent: greet
- action: utter_greet
- user: |
very terrible
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
no
intent: deny
- action: utter_goodbye
- story: say goodbye
steps:
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: bot challenge
steps:
- user: |
are you a bot?
intent: bot_challenge
- action: utter_iamabot
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/custom-actions
# This is a simple example for a custom action which utters "Hello World!"
import re
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker, FormValidationAction
from rasa_sdk.events import SlotSet, EventType
from rasa_sdk.executor import CollectingDispatcher
import webbrowser
from rasa_sdk.events import AllSlotsReset
from rasa_sdk.events import Restarted
from rasa_sdk.types import DomainDict
from actions.email_utility import SMTPUtility
import requests
def hit_api(payload):
try:
url = "http://rasa-flask:2526/insert_into_mongo"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
except Exception as e:
print(e)
class DemoSlotReset(Action):
def name(self) -> Text:
return "demo_slot_reset"
def run(self, dispatcher, tracker, domain):
return [SlotSet("demo", None)]
class UserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "user_details_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "demo"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class ActionSubmit(FormValidationAction):
def name(self) -> Text:
return "action_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will contact you for "
"scheduling the demo.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"product\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("demo")),
str(tracker.get_slot("company")),
"Requesting a Demo of " + str(
tracker.get_slot("demo")))
payload = "{" + body + "}"
hit_api(payload)
class CallForm(FormValidationAction):
def name(self) -> Text:
return "call_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class CallSubmit(FormValidationAction):
def name(self) -> Text:
return "call_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Thanks for providing the details our team of experts will reach out to you in "
"a short while.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"company\":\"{3}\",\"request\":\"{4}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("company")),
"Requesting for a Call Back")
payload = "{" + body + "}"
hit_api(payload)
class QueryForm(FormValidationAction):
def name(self) -> Text:
return "query_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["name", "email", "number", "company", "query"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class QuerySubmit(FormValidationAction):
def name(self) -> Text:
return "query_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Your query has been registered with us. Our team of experts will follow up with a "
"resolution soon.")
body = "\"name\":\"{0}\",\"email\":\"{1}\",\"phoneNumber\":\"{2}\"," \
"\"query\":\"{3}\",\"company\":\"{4}\",\"request\":\"{5}\"".format(str(tracker.get_slot("name")),
str(tracker.get_slot("email")),
str(tracker.get_slot("number")),
str(tracker.get_slot("query")),
str(tracker.get_slot("company")),
"Have a Query")
payload = "{" + body + "}"
hit_api(payload)
class ActionRestarted(Action):
def name(self):
return 'action_restarted'
def run(self, dispatcher, tracker, domain):
return [Restarted()]
class ActionSlotReset(Action):
def name(self):
return 'action_slot_reset'
def run(self, dispatcher, tracker, domain):
return [AllSlotsReset()]
class ActionSessionId(Action):
def name(self) -> Text:
return "action_session_id"
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
conversation_id = tracker.sender_id
dispatcher.utter_message("The conversation id is {}".format(conversation_id))
return []
class EmailForm(Action):
def name(self) -> Text:
return "email_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["email"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
return [SlotSet("requested_slot", None)]
class EmailSubmit(FormValidationAction):
def name(self) -> Text:
return "email_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
# dispatcher.utter_message("Your Details: " + "\n Email: " + tracker.get_slot("email"))
dispatcher.utter_message("You have successfully subscribed to our newsletter.")
body = "\"email\":\"{0}\",\"request\":\"{1}\"".format(str(tracker.get_slot("email")), "Email Signup")
payload = "{" + body + "}"
hit_api(payload)
class ValidateEmailForm(FormValidationAction):
def name(self) -> Text:
return "validate_email_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
class ValidateUserDetailsForm(FormValidationAction):
def name(self) -> Text:
return "validate_user_details_form"
def validate_demo(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
myval = ['mlens', 'ilens', 'glens']
mylist = str(slot_value.lower()).split(" ")
a = set(myval)
b = set(mylist)
if a & b:
return {'demo': list(a & b)[0]}
else:
dispatcher.utter_message("Sorry we dont have support for that product.")
return {'demo': None}
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid.")
return {'number': None}
class ValidateQueryForm(FormValidationAction):
def name(self) -> Text:
return "validate_query_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid.")
return {'number': None}
class ValidateCallForm(FormValidationAction):
def name(self) -> Text:
return "validate_call_form"
def validate_email(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"\"?([-a-zA-Z0-9.`?{}]+@\w+\.\w+)\"?", str(i)):
return {'email': str(i)}
dispatcher.utter_message(text="The email you have entered is invalid.")
return {'email': None}
def validate_number(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
"""Validate cuisine value."""
my_list = str(slot_value).lower().split(" ")
for i in my_list:
if re.match(r"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", str(i)):
return {'number': str(i)}
dispatcher.utter_message(text="The mobile you have entered is invalid.")
return {'number': None}
import ssl
import smtplib
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class SMTPUtility:
def __init__(self):
self.from_address = "dasharatha.vamshi@knowledgelens.com"
self.to_address = ["saivamshi2309@gmail.com", "saivamshi.s16@iiits.in"]
self.msg = MIMEMultipart()
self.msg['From'] = self.from_address
self.msg['To'] = " ,".join(self.to_address)
self.filename = ""
self.smtp_server = "smtp.gmail.com"
self.username = "dasharatha.vamshi@knowledgelens.com"
self.password = "Salla$230999"
self.smtp_server_port = 587
self.ssl = False
def send_email(self, content, attach=False):
try:
self.msg['Subject'] = "KL Bot: " + content['subject']
self.msg['body'] = content['body']
self.msg.attach(MIMEText(self.msg['body'], 'plain'))
# give filename in self.filename to attach a document.
if attach:
attachment = open(self.filename, "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % self.filename)
self.msg.attach(p)
# starting the sever
if self.ssl:
context = ssl.create_default_context()
with smtplib.SMTP_SSL(self.smtp_server, self.smtp_server_port, context=context) as server:
server.login(self.username, self.password)
server.sendmail(self.from_address, self.to_address, self.msg.as_string())
else:
s = smtplib.SMTP(self.smtp_server, self.smtp_server_port)
s.starttls()
s.login(self.username, self.password)
s.sendmail(self.from_address, self.to_address, self.msg.as_string())
s.quit()
return True
except:
return False
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
# No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# If you'd like to customize it, uncomment and adjust the pipeline.
# See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 300
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# No configuration for policies was provided. The following default policies were used to train your model.
# If you'd like to customize them, uncomment and adjust the policies.
# See https://rasa.com/docs/rasa/policies for more information.
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 5
epochs: 300
- name: RulePolicy
- name: MappingPolicy
- name: FormPolicy
# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/messaging-and-voice-channels
rest:
# # you don't need to provide anything here - this channel doesn't
# # require any credentials
#facebook:
# verify: "<verify>"
# secret: "<your secret>"
# page-access-token: "<your page access token>"
#slack:
# slack_token: "<your slack token>"
# slack_channel: "<the slack channel>"
# slack_signing_secret: "<your slack signing secret>"
#socketio:
# user_message_evt: <event name for user message>
# bot_message_evt: <event name for bot messages>
# session_persistence: <true/false>
#mattermost:
# url: "https://<mattermost instance>/api/v4"
# token: "<bot token>"
# webhook_url: "<callback URL>"
# This entry is needed if you are using Rasa X. The entry represents credentials
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5002/api"
version: "2.0"
nlu:
- intent: greet
examples: |
- hey
- hello
- hi
- hello there
- good morning
- good evening
- moin
- hey there
- let's go
- hey dude
- goodmorning
- goodevening
- good afternoon
- Hi
- intent: goodbye
examples: |
- good afternoon
- cu
- good by
- cee you later
- good night
- bye
- goodbye
- have a nice day
- see you around
- bye bye
- see you later
- intent: affirm
examples: |
- yes
- y
- indeed
- of course
- that sounds good
- correct
- intent: deny
examples: |
- no
- n
- never
- I don't think so
- don't like that
- no way
- not really
- why should i give
- no i dont want to mention
- why do you need that
- no i dont provide
- why do you need this
- i wont
- wont
- intent: ask_id
examples: |
- tell me the id
- tell me the conversation id
- tell me the chat id
- tell me the session id
- what is my conversational id
- conversational id
- session id
- may i know my session id
- intent: mood_great
examples: |
- perfect
- great
- amazing
- feeling like a king
- wonderful
- I am feeling very good
- I am great
- I am amazing
- I am going to save the world
- super stoked
- extremely good
- so so perfect
- so good
- so perfect
- intent: mood_unhappy
examples: |
- my day was horrible
- I am sad
- I don't feel very well
- I am disappointed
- super sad
- I'm so sad
- sad
- very sad
- unhappy
- not good
- not very good
- extremly sad
- so saad
- so sad
- intent: bot_challenge
examples: |
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
- intent: glens
examples: |
- what is glens?
- tell me about glens?
- what is green lens?
- glens?
- glens
- intent: ilens
examples: |
- what is ilens?
- tell me about ilens?
- ilens?
- ilens
- intent: mlens
examples: |
- what is mlens?
- tell me about mlens?
- mlens?
- mlens
- intent: know_more
examples: |
- know more?
- I want to know more?
- tell me more?
- more?
- know more
- intent: name_entry
examples: |
- my name is [vamshi](name)
- [raju](name)
- [kevin](name) is my name
- my name is [tarun](name)
- [rajesh](name)
- my name is [mike](name)
- [stark](name)
- [vamshi](name)
- [shiva](name)
- [kiran](name)
- [yuvraj](name)
- [yuvaraj](name)
- intent: my_email
examples: |
- my email is [sai@gmail.com](email)
- [saivamshi@gmail.com](email)
- [r@gamil.com](email)
- my email is [d@gmail.com](email)
- [dash@knowledgelens.com](email)
- [saik@gmail.com](email)
- [yuv@gmail.com](email)
- intent: email_entry
examples: |
- [vamshi@knowledgelens.com](email) is my email
- my email id is [sai@knowledgelens.com](email)
- [v@yahoo.co.in](email)
- [sai@yahoo.co.in](email)
- [yuvraj.s@knowledgelens.com](email)
- intent: number_entry
examples: |
- my number is [1234567890](number)
- [1234567809](number)
- [1029384756](number) is my number
- my number is [1234509876](number)
- [1902873674](number)
- my number is [7687564789](number)
- [1076452288](number)
- [7799558890](number)
- intent: company_entry
examples: |
- i am from [google](company)
- [knowledgelens](company)
- [unemployed](company)
- [student](company)
- intent: query_entry
examples: |
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- [what is glnes](query)
- intent: request_demo
examples: |
- request demo
- can we have a demo
- can i get demo
- demo
- request_demo
- intent: request_call_back
examples: |
- call back
- can we have a call
- can you call back
- request_call_back
- intent: signup_for_email_newsletter
examples: |
- signup
- signup for email newsletter
- email signup
- newsletter signup
- signup_for_email_newsletter
- intent: send_us_a_query
examples: |
- i have a question
- i have a query
- can i get a answer for my question
- send a query
- intent: out_of_scope
examples: |
- I want to order food
- 2 + 2?
- us president?
version: "2.0"
rules:
- rule: Say goodbye anytime the user says goodbye
steps:
- intent: goodbye
- action: utter_goodbye
- rule: Say 'I am a bot' anytime the user challenges
steps:
- intent: bot_challenge
- action: utter_iamabot
- rule: Id asked
steps:
- intent: ask_id
- action: action_session_id
- rule: Demo form Activate
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- rule: Call back Form Activate
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- rule: Email signup Form Activate
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- rule: Query form Activate
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- rule: Submit form Demo
condition:
# Condition that form is active.
- active_loop: user_details_form
steps:
# Form is deactivated
- action: user_details_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: action_submit
- action: demo_slot_reset
- action: utter_show_options2
- rule: Submit form Email
condition:
# Condition that form is active.
- active_loop: email_form
steps:
# Form is deactivated
- action: email_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: email_submit
- action: utter_show_options2
- rule: Submit form Query
condition:
# Condition that form is active.
- active_loop: query_form
steps:
# Form is deactivated
- action: query_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: query_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
- rule: Submit form Call letter
condition:
# Condition that form is active.
- active_loop: call_form
steps:
# Form is deactivated
- action: call_form
- active_loop: null
- slot_was_set:
- requested_slot: null
# The actions we want to run when the form is submitted.
- action: call_submit
- action: utter_show_options2
- rule: out_of_scope
steps:
- intent: nlu_feedback
- action: utter_out_of_scope
\ No newline at end of file
version: "2.0"
stories:
- story: happy path
steps:
- intent: greet
- action: utter_show_options
- story: bye
steps:
- intent: deny
- action: utter_goodbye
- story: user details form stop
steps:
- intent: request_demo
- action: utter_request_demo
- action: user_details_form
- active_loop: user_details_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: query form stop
steps:
- intent: send_us_a_query
- action: utter_send_us_a_query
- action: query_form
- active_loop: query_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: email form stop
steps:
- intent: signup_for_email_newsletter
- action: utter_signup_for_email_newsletter
- action: email_form
- active_loop: email_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
- story: call form stop
steps:
- intent: request_call_back
- action: utter_request_call_back
- action: call_form
- active_loop: call_form
- intent: deny
- action: utter_exit_form
- action: utter_show_options2
- action: action_deactivate_loop
- active_loop: null
- action: action_slot_reset
\ No newline at end of file
version: '3'
services:
rasa-shell:
image: "rasa-shell:v1.0"
container_name: "rasa-shell"
ports:
- "5005:5005"
restart: always
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
action-server:
image: "rasa-actions:v1.0"
container_name: "action-server"
ports:
- "5055:5055"
restart: always
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
rasa-flask:
image: "rasa-flask:v1.0"
container_name: "rasa-flask"
restart: always
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
networks:
default:
external:
name: "rasa-services"
\ No newline at end of file
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: false
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- glens
- ilens
- mlens
- show_options
- know_more
- ask_id
- request_demo
- request_call_back
- signup_for_email_newsletter
- send_us_a_query
- out_of_scope
- name_entry:
use_entities:
- name
- email_entry:
use_entities:
- email
- number_entry:
use_entities:
- number
- company_entry:
use_entities:
- company
- query_entry:
use_entities:
- query
- nlu_feedback
entities:
- name
- email
- number
- company
- query
slots:
demo:
type: unfeaturized
influence_conversation: false
name:
type: unfeaturized
influence_conversation: false
email:
type: unfeaturized
influence_conversation: false
number:
type: unfeaturized
influence_conversation: false
company:
type: unfeaturized
influence_conversation: false
query:
type: unfeaturized
influence_conversation: false
requested_slot:
type: unfeaturized
influence_conversation: false
responses:
utter_exit_form:
- text: I am sorry, I could not process your request.
utter_request_demo:
- text: You have requested for a demo.
utter_request_call_back:
- text: You have requested for a call back.
utter_signup_for_email_newsletter:
- text: You have requested for email newsletter signup.
utter_send_us_a_query:
- text: You have requested to send us a query.
utter_greet:
- text: Hello there, Welcome to KL bot.
utter_enter:
- text: Please enter your details
utter_cheer_up:
- image: https://i.imgur.com/nGF1K8f.jpg
text: 'Here is something to cheer you up:'
utter_did_that_help:
- text: Did that help you?
utter_happy:
- text: Great, carry on!
utter_goodbye:
- text: Thank you. Have a great day!
utter_iamabot:
- text: I am a bot, powered by Rasa.
utter_glens:
- text: GLens is Real-Time Data Acquisition, Monitoring and Analytics suite of Products
for Industrial Emissions, Effluent Discharges and Ambient Air Monitoring. GLens
DAS Software, GLens Server Platform, GLens Environ Data Logger provides a comprehensive
solution for all Industry Environmental needs.
utter_ilens:
- text: Intelligent IoT Solutions, built for Industry 4.0
utter_mlens:
- text: MLens is a one-stop solution for all your Big Data needs, from Automated
Disaster Recovery to Compute Workload Migration, and everything in between.
utter_show_options:
- buttons:
- payload: request_demo
title: Request a Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for our Monthly Newsletter
- payload: send_us_a_query
title: Send us a query
text: Hello there! How may I assist you today?
utter_show_options2:
- buttons:
- payload: request_demo
title: Request a Demo
- payload: request_call_back
title: Request Call Back
- payload: signup_for_email_newsletter
title: Signup for our Monthly Newsletter
- payload: send_us_a_query
title: Send us a query
text: Is there anything else we can help you with?
utter_know_more:
- text: Please enter your email id for contacting you
utter_ask_name:
- text: Please enter your name to proceed.
utter_ask_email:
- text: Please enter your email id.
utter_ask_number:
- text: Please enter your mobile number.
utter_ask_company:
- text: Please enter your company name.
utter_thanks:
- text: Thanks for providing the values.
utter_ask_query:
- text: Please tell us your query.
utter_details_thanks:
- text: "Thanks for providing the details \n email: {email} \n name: {name} \n mobile:\
\ {number} \n company: {company}"
utter_out_of_scope:
- text: Sorry, I did'nt get what you said. Please rephrase what you said.
utter_ask_demo:
- buttons:
- payload: glens
title: "GLens"
- payload: ilens
title: "ILens"
- payload: mlens
title: "MLens"
text: Please select the product that you would like to schedule a demo for.
actions:
- action_submit
- email_submit
- query_submit
- call_submit
- action_slot_reset
- action_session_id
- validate_email_form
- validate_call_form
- validate_query_form
- validate_user_details_form
- demo_slot_reset
forms:
user_details_form:
demo:
- entity: None
type: from_text
not_intent: deny
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
call_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
email_form:
email:
- entity: None
type: from_text
not_intent: deny
query_form:
name:
- entity: None
type: from_text
not_intent: deny
email:
- entity: None
type: from_text
not_intent: deny
number:
- entity: None
type: from_text
not_intent: deny
company:
- entity: None
type: from_text
not_intent: deny
query:
- entity: None
type: from_text
not_intent: deny
\ No newline at end of file
# This file contains the different endpoints your bot can use.
# Server where the models are pulled from.
# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server
#models:
# url: http://my-server.com/models/default_core@latest
# wait_time_between_pulls: 10 # [optional](default: 100)
# Server which runs your custom actions.
# https://rasa.com/docs/rasa/custom-actions
action_endpoint:
url: "http://action-server:5055/webhook"
# Tracker store which is used to store pippithe conversations.
# By default the conversations are stored in memory.
# https://rasa.com/docs/rasa/tracker-stores
#tracker_store:
# type: redis
# url: <host of the redis instance, e.g. localhost>
# port: <port of your redis instance, usually 6379>
# db: <number of your database within redis, e.g. 0>
# password: <password used for authentication>
# use_ssl: <whether or not the communication is encrypted, default false>
#tracker_store:
# type: mongod
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
# db: <name of the db within your mongo instance, e.g. rasa>
# username: <username used for authentication>
# password: <password used for authentication>
# Event broker which all conversation events should be streamed to.
# https://rasa.com/docs/rasa/event-brokers
#event_broker:
# url: localhost
# username: username
# password: password
# queue: queue
#### This file contains tests to evaluate that your bot behaves as expected.
#### If you want to learn more, please see the docs: https://rasa.com/docs/rasa/testing-your-assistant
stories:
- story: happy path 1
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- story: happy path 2
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: sad path 1
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
yes
intent: affirm
- action: utter_happy
- story: sad path 2
steps:
- user: |
hello
intent: greet
- action: utter_greet
- user: |
not good
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
not really
intent: deny
- action: utter_goodbye
- story: sad path 3
steps:
- user: |
hi
intent: greet
- action: utter_greet
- user: |
very terrible
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
no
intent: deny
- action: utter_goodbye
- story: say goodbye
steps:
- user: |
bye-bye!
intent: goodbye
- action: utter_goodbye
- story: bot challenge
steps:
- user: |
are you a bot?
intent: bot_challenge
- action: utter_iamabot
################# MASTER #################
build-master:
stage: build
before_script:
- val=`echo $(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT COUNT(*) FROM $VERSION_DB.$DB_TABLE WHERE category='Server' AND type='Service' AND os='source' AND module_name='$CI_PROJECT_NAME' ") | cut -d " " -f2`
- if [ $val == 0 ]; then mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $VERSION_DB.$DB_TABLE values('Server','Service','$CI_PROJECT_NAME','source', '0', '0', '0')";fi
- DEV=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT dev FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- QA=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT qa FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- PROD=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT prod FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
script:
- PROD=$(expr $PROD + 1)
- QA="0"
- DEV="0"
- DEV=`expr $DEV + 1`
- tar czvf $CI_PROJECT_NAME.tar.gz *
- curl -u"$ARTIFACTORY_USER:$ARTIFACTORY_PASS" -T $CI_PROJECT_NAME.tar.gz $ARTIFACTORY_URL/$SUB_GROUP/$CI_PROJECT_NAME/x64/source/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME.tar.gz
- docker build -t $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME .
- docker tag $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- docker push ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $HISTORY_DB.$DB_TABLE values('$CI_JOB_ID','Server','Service', '$CI_PROJECT_NAME','source', '$PROD.$QA.$DEV', '$CI_COMMIT_SHA', '$GITLAB_USER_NAME', '$CI_COMMIT_REF_NAME')"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "UPDATE $VERSION_DB.$DB_TABLE SET prod='$PROD' ,qa='$QA', dev='$DEV' WHERE module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'"
- rm -f $CI_PROJECT_NAME.tar.gz
only:
- master
tags:
- shell
##################### TEST ######################
build-test:
stage: build
before_script:
- val=`echo $(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT COUNT(*) FROM $VERSION_DB.$DB_TABLE WHERE category='Server' AND type='Service' AND os='source' AND module_name='$CI_PROJECT_NAME' ") | cut -d " " -f2`
- if [ $val == 0 ]; then mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $VERSION_DB.$DB_TABLE values('Server','Service','$CI_PROJECT_NAME','source', '0', '0', '0')";fi
- DEV=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT dev FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- QA=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT qa FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- PROD=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT prod FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
script:
- QA=$(expr $QA + 1)
- DEV="0"
- tar czvf $CI_PROJECT_NAME.tar.gz *
- curl -u"$ARTIFACTORY_USER:$ARTIFACTORY_PASS" -T $CI_PROJECT_NAME.tar.gz $ARTIFACTORY_URL/$SUB_GROUP/$CI_PROJECT_NAME/x64/source/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME.tar.gz
- docker build -t $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME .
- docker tag $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- docker push ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $HISTORY_DB.$DB_TABLE values('$CI_JOB_ID','Server','Service', '$CI_PROJECT_NAME','source', '$PROD.$QA.$DEV', '$CI_COMMIT_SHA', '$GITLAB_USER_NAME', '$CI_COMMIT_REF_NAME')"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "UPDATE $VERSION_DB.$DB_TABLE SET prod='$PROD' ,qa='$QA', dev='$DEV' WHERE module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'"
only:
- test
tags:
- shell
############| DEV |############
build-dev:
stage: build
before_script:
- val=`echo $(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT COUNT(*) FROM $VERSION_DB.$DB_TABLE WHERE category='Server' AND type='Service' AND os='source' AND module_name='$CI_PROJECT_NAME' ") | cut -d " " -f2`
- if [ $val == 0 ]; then mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $VERSION_DB.$DB_TABLE values('Server','Service','$CI_PROJECT_NAME','source', '0', '0', '0')";fi
- DEV=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT dev FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- QA=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT qa FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- PROD=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT prod FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
script:
- DEV=$(expr $DEV + 1)
- tar czvf $CI_PROJECT_NAME.tar.gz *
- curl -u"$ARTIFACTORY_USER:$ARTIFACTORY_PASS" -T $CI_PROJECT_NAME.tar.gz $ARTIFACTORY_URL/$SUB_GROUP/$CI_PROJECT_NAME/x64/source/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME.tar.gz
- docker build -t $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME .
- docker tag "$CI_PROJECT_NAME":"$CI_COMMIT_REF_NAME" ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/"$CI_PROJECT_NAME"/"$CI_COMMIT_REF_NAME"/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- docker push ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/"$CI_PROJECT_NAME"/"$CI_COMMIT_REF_NAME"/"$PROD.$QA.$DEV"/"$CI_PROJECT_NAME":"$PROD.$QA.$DEV"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $HISTORY_DB.$DB_TABLE values('$CI_JOB_ID','Server','Service', '$CI_PROJECT_NAME','source', '$PROD.$QA.$DEV', '$CI_COMMIT_SHA', '$GITLAB_USER_NAME', '$CI_COMMIT_REF_NAME')"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "UPDATE $VERSION_DB.$DB_TABLE SET prod='$PROD' ,qa='$QA', dev='$DEV' WHERE module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'"
only:
- dev
tags:
- shell
############| CODE QUALITY (DEV) |############
build-dev-codequality:
stage: build
image:
name: ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/kl-it-operations/gitlab-runner/ubuntu:sonar-scanner
script:
- /opt/sonar-scanner/bin/sonar-scanner -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.projectName=$CI_PROJECT_NAME -Dsonar.typescript.node=./node/node -Dsonar.login=admin -Dsonar.password=admin -Dsonar.sources=.
- sleep 10
- python3 /opt/code_quality_report/static_code_quality_report_csv_v2.py $CI_PROJECT_NAME $GITLAB_USER_EMAIL,$EMAIL_TO $EMAIL_FROM $EMAIL_PASSWD False admin admin
only:
- dev
tags:
- docker-prod
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (thermal-app-ui-services)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyChainedComparisonsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoreConstantInTheMiddle" value="true" />
</inspection_tool>
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="46">
<item index="0" class="java.lang.String" itemvalue="scikit-image" />
<item index="1" class="java.lang.String" itemvalue="scipy" />
<item index="2" class="java.lang.String" itemvalue="opencv-python" />
<item index="3" class="java.lang.String" itemvalue="torch" />
<item index="4" class="java.lang.String" itemvalue="torchvision" />
<item index="5" class="java.lang.String" itemvalue="absl-py" />
<item index="6" class="java.lang.String" itemvalue="protobuf" />
<item index="7" class="java.lang.String" itemvalue="rsa" />
<item index="8" class="java.lang.String" itemvalue="tensorflow-estimator" />
<item index="9" class="java.lang.String" itemvalue="opt-einsum" />
<item index="10" class="java.lang.String" itemvalue="python-dateutil" />
<item index="11" class="java.lang.String" itemvalue="cycler" />
<item index="12" class="java.lang.String" itemvalue="gast" />
<item index="13" class="java.lang.String" itemvalue="numpy" />
<item index="14" class="java.lang.String" itemvalue="pyasn1" />
<item index="15" class="java.lang.String" itemvalue="requests" />
<item index="16" class="java.lang.String" itemvalue="importlib-metadata" />
<item index="17" class="java.lang.String" itemvalue="pyasn1-modules" />
<item index="18" class="java.lang.String" itemvalue="requests-oauthlib" />
<item index="19" class="java.lang.String" itemvalue="tensorflow" />
<item index="20" class="java.lang.String" itemvalue="tensorboard-plugin-wit" />
<item index="21" class="java.lang.String" itemvalue="zipp" />
<item index="22" class="java.lang.String" itemvalue="oauthlib" />
<item index="23" class="java.lang.String" itemvalue="astunparse" />
<item index="24" class="java.lang.String" itemvalue="urllib3" />
<item index="25" class="java.lang.String" itemvalue="pyparsing" />
<item index="26" class="java.lang.String" itemvalue="Cython" />
<item index="27" class="java.lang.String" itemvalue="Markdown" />
<item index="28" class="java.lang.String" itemvalue="google-auth-oauthlib" />
<item index="29" class="java.lang.String" itemvalue="Werkzeug" />
<item index="30" class="java.lang.String" itemvalue="kiwisolver" />
<item index="31" class="java.lang.String" itemvalue="tqdm" />
<item index="32" class="java.lang.String" itemvalue="yolov5processor" />
<item index="33" class="java.lang.String" itemvalue="tensorboard" />
<item index="34" class="java.lang.String" itemvalue="future" />
<item index="35" class="java.lang.String" itemvalue="matplotlib" />
<item index="36" class="java.lang.String" itemvalue="cachetools" />
<item index="37" class="java.lang.String" itemvalue="grpcio" />
<item index="38" class="java.lang.String" itemvalue="Keras" />
<item index="39" class="java.lang.String" itemvalue="google-auth" />
<item index="40" class="java.lang.String" itemvalue="idna" />
<item index="41" class="java.lang.String" itemvalue="Pillow" />
<item index="42" class="java.lang.String" itemvalue="cython" />
<item index="43" class="java.lang.String" itemvalue="keras" />
<item index="44" class="java.lang.String" itemvalue="imgaug" />
<item index="45" class="java.lang.String" itemvalue="opencv-contrib-python" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N806" />
<option value="N801" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="cv2.imresize" />
<option value="detectron2.model_zoo.get_config_file" />
<option value="detectron2.model_zoo.get_checkpoint_url" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (thermal-app-ui-services)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/KL-bot-services.iml" filepath="$PROJECT_DIR$/.idea/KL-bot-services.iml" />
</modules>
</component>
</project>
\ No newline at end of file
FROM python:3.6-stretch
RUN pip install flask requests flask-restplus
ADD . /opt/code
WORKDIR /opt/code
RUN pip install -r requirements.txt
RUN pip install --upgrade Werkzeug==0.16.1
CMD python app.py
\ No newline at end of file
from flask_cors import CORS
from flask import Flask
from flask_restplus import Api
from threading import Thread
from scripts.common.logsetup import logger
from scripts.common.config import SERVICE_HOST, SERVICE_PORT
# from scripts.blueprints.invoice_configurations import invoices_blueprint
from scripts.blueprints.bot_configurations import klbot_blueprint, init_thread
from models.model import *
app = Flask(__name__)
api = Api(app, title=app_constants.SwaggerClass.title)
api.add_namespace(klbot_namespace)
app.register_blueprint(klbot_blueprint)
# api.add_namespace(invoice_namespace)
# app.register_blueprint(invoices_blueprint)
# app.register_blueprint(alarms_blueprint)
CORS(app, orgins="*", resources={r"/*": {"origins": "*"}}, allow_headers=[
"Content-Type", "Authorization", "Access-Control-Allow-Credentials"],
supports_credentials=True, intercept_exceptions=False)
for rule in app.url_map.iter_rules():
logger.debug(rule)
# minio_obj = MinioClient('minioadmin', 'minioadmin', 'videobucket', '/home/svc-ilens/minio_files', '192.168.3.220:29000')
t = Thread(target=init_thread)
t.start()
app.run(host=SERVICE_HOST, port=2526, debug=False, threaded=True, use_reloader=False)
{
"registerId": "1",
"documentId":"1",
"modelDocumentId" : " ",
"scannedOn" : "2020-06-22T09:22:41Z",
"parsedData" : {
"totalPages" : "1",
"invoice number": {
"value" : "123123",
"page": "1"
},
"invoice date" : {
"value" : "2020-06-22T09:22:41Z",
"page": "1"
}
},
"azureData" : {
}
}
\ No newline at end of file
Data:
{
"register_id": "1",
"document_id":"1",
"modelId" : "210a73a6-16dc-4b39-8277-c372469d891d",
"scanned_on" : "2020-06-22T09:22:41Z",
"parsed_data" : {
"total_pages" : "1",
"invoice number": {
"value" : "123123",
"page": "1"
},
"invoice date" : {
"value" : "2020-06-22T09:22:41Z",
"page": "1"
}
},
"azure_data" : {
}
}
Models
{
"register_name" : "amazon",
"register_id" : "1",
"modelId": "210a73a6-16dc-4b39-8277-c372469d891d",
"createdDateTime": "2020-06-22T09:22:41Z",
"lastUpdatedDateTime": "2020-06-22T09:22:41Z",
"trained_documents" : "5",
"trained_labels":["invoice number","invoice date"]
}
\ No newline at end of file
{
"jobId": "",
"startedOn" : "",
"completedOn" : "",
"status" : ["completed/failed"],
"documentId" : ""
}
{
"documentId": "25308d2d",
"insertedOn": "Tue, 30 Jun 2020 15:20:35 GMT",
"jobId": "25308d2c",
"logisticsType": "outbound",
"registerId": "29af93d0",
"status": "Success",
"updatedOn": "Tue, 30 Jun 2020 15:20:58 GMT"
},
\ No newline at end of file
{
"modelDocumentId": "",
"modelId" : " ",
"createdDateTime" : " ",
"lastUpdatedDateTime" : " ",
"trainingDocuments" : "5",
"trainedlabels" : []
}
{
"createdDateTime": "Tue, 30 Jun 2020 06:19:19 GMT",
"lastUpdatedDateTime": "Tue, 30 Jun 2020 06:19:19 GMT",
"modelDocumentId": "a19c8a64",
"modelId": "c2c1a822-7083-455a-879d-c53aa9ff00c5",
"trainedDocuments": 5,
"trainedLabels": [
"Invoice Number",
"Invoice Due Date"
]
}
\ No newline at end of file
{
"registerName" : "amazon",
"registerId" : "1",
"modelDocumentId": "",
"createdDateTime": "2020-06-22T09:22:41Z",
"logistticsType" : "inbound/outbound"
}
{
"createdDateTime": "Tue, 30 Jun 2020 09:29:14 GMT",
"logistics": {
"inbound": {
"modelDocumentId": "a19c8a64"
},
"outbound": {
"modelDocumentId": "e37a3800"
}
},
"registerId": "29af93d0",
"registerName": "Microsoft"
}
\ No newline at end of file
[SERVICE]
HOST=0.0.0.0
PORT=2324
[ATTENDANCE MONGO]
HOST = 192.168.3.220
PORT = 21017
AUTH = false
USERNAME= admin
PASSWORD= password123
DATABASE= ilens_wps
INVOICE_COLLECTION = invoices_list
REGISTER_COLLECTION = register_list
JOB_COLLECTION = kl_bot_jobs
MODEL_COLLECTION = model_list
BOT_COLLECTION = kl_bot
#LOCAL_DATA_PATH = .
\ No newline at end of file
Register,RegisterType,File Name,From,Invoice Date,Invoice No,Motor Vehicle No,Quantity,Docket No
Nike,Docket,demo412.pdf,"PAGE INDUSTRIES LTD SY:49/1, 49/2, 50,51/1, 51/2, 51/3, 51/4, 51/5,, THATTANAHALLI VILLAGE, BYAGADENHALLI, GRAMAPANCHYA KASABA HOBLI ANEKAL ATTIBELE ROAD, ANEKAL TALUKA, BANGALORE-562107, KA",,,,,133089401
Nike,Docket,newdemo.pdf,"PAGE INDUSTRIES LTD SY:49/1, 49/2, 50,51/1, 51/2, 51/3, 51/4, 51/5,, THATTANAHALLI VILLAGE, BYAGADENHALLI, GRAMAPANCHYA KASABA HOBLI ANEKAL ATTIBELE ROAD, ANEKAL TALUKA, BANGALORE-562107,KA",,,,,133089401
{
"sample": "json"
}
\ No newline at end of file
7689302,6/29/2016,Jul 01 2020 16:05:44,8e9a1a81,04c84bf0,e37a3800,Outbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016
,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
7689302,6/29/2016,Jul 01 2020 16:05:44,8e9a1a81,04c84bf0,e37a3800,Outbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016
,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
[CLIENT-CONFIG]
publishers = MQTT:PUB_MQTT,VIDEOWRITE:PUB_VIDWRITE,MONGO:MONGO_WRITE
deviceid = $$$MQTT_TOPIC$$$
[STREAM-CONFIG]
stream-type=rtsp
width =$$$FRAME_WIDTH$$$
height=$$$FRAME_HEIGHT$$$
latency=
framerate =$$$FRAME_RATE$$$
fformat =
use-gstreamer=0
custom-pipeline=
uri =$$$RTSP_URL$$$
[PUB_MQTT]
broker = $$$MQTT_HOST$$$
port= $$$MQTT_PORT$$$
topic=$$$MQTT_TOPIC$$$
clientid=$$$MQTT_TOPIC$$$
[MYSQL]
host= 192.168.2.17
port= 3306
username= root
password= root
database= attendance
[FAISS]
HOST = 192.168.2.17
PORT = 2323
FAISS_SEARCH_EP = /faiss/search-array
FAISS_INSERT_EP = /faiss/insert
[MONGO]
HOST=192.168.0.211
PORT=27017
AUTH=False
USERNAME=admin
PASSWORD=admin
DATABASE=faiss_test
COLLECTION=vectors_bosch_dev
[EVENTS MONGO]
HOST=192.168.0.211
PORT=27017
DATABASE=bosch_dev
EVENT_COLLECTION=event_details
VIDEO_COLLECTION=video_recordings_details
[ILENS MONGO]
HOST = beta.ilens.io
PORT = 2717
DATABASE= ilens_metadata
RULES_COLLECTION = rules
[ILENS DEVICE]
DEVICE = virtual_device_567
TAG = tag_5761
[PUB_VIDWRITE]
basepath = ./base_vid_dir
format=mp4
filenameFormat = {EmpName}_{timestamp}
This source diff could not be displayed because it is too large. You can view the blob instead.
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras/add
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /_status
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /events
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /rules
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /
2020-04-23 16:58:00,335 INFO smartvision [MainThread:app.py:list_routes():29] --- /static/<path:filename>
2020-04-23 16:58:00,862 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras/add
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /_status
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /events
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /rules
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /static/<path:filename>
2020-04-23 16:58:29,468 INFO smartvision [Thread-2:app.py:status_():23] /_status/success
2020-04-23 16:58:59,235 INFO smartvision [Thread-6:app.py:status_():23] /_status/success
2020-04-23 16:59:05,406 INFO smartvision [Thread-7:app.py:status_():23] /_status/success
2020-04-23 16:59:06,247 INFO smartvision [Thread-8:app.py:status_():23] /_status/success
from scripts.constants import app_constants
from flask_restplus import fields, Namespace
#
klbot_namespace = Namespace("KL Bot Module", path=app_constants.APIEndPoints.base_url)
insert_to_mongo = klbot_namespace.model("insert_to_mongo", {
'name': fields.String(required=False),
'email': fields.String(required=False),
'phoneNumber': fields.String(required=False),
'company': fields.String(required=False),
'query': fields.String(required=False),
'request': fields.String(required=False),
'product': fields.String(required=False),
})
# invoice_namespace = Namespace("Invoice Module", path=app_constants.APIEndPoints.base_url)
# get_invoice_result = invoice_namespace.model("get_invoice_result", {
# 'documentId': fields.String(required=True)
# })
#
# # retry_invoice = invoice_namespace.model("get_invoice_result", {
# # 'documentId': fields.String(required=True)
# # })
#
# register_details = invoice_namespace.model("register_details", {
# 'registerId': fields.String(required=True)
# })
#
# download_report = invoice_namespace.model("download_report", {
# 'fromDate': fields.Date(required=True),
# 'toDate': fields.Date(required=True),
# 'toEmail': fields.String(required=True),
# 'registerIdList': fields.List(fields.String(required=True))
# })
#
# get_job_status = invoice_namespace.model("get_job_status", {
# 'jobId': fields.List(fields.String(required=True))
# })
# invoices_for_register = invoice_namespace.model("invoices_for_register", {
# 'registerId': fields.String(required=True)
# })
# create_register = invoice_namespace.model("create_register", {
# "registerName": fields.String(required=True),
# "inboundModelId": fields.String(required=True),
# "outboundModelId": fields.String(required=True),
# })
#
# create_model = invoice_namespace.model("create_model", {
#
# "modelId": fields.String(required=True),
# "trainedDocuments": fields.Integer(required=True),
# "trainedLabels": fields.List(fields.String(required=True))
#
# })
# site_namespace = Namespace("Site Module", path=app_constants.APIEndPoints.base_url)
# service_namespace = Namespace("Service Module", path=app_constants.APIEndPoints.base_url)
# event_namespace = Namespace("Event Module", path=app_constants.APIEndPoints.base_url)
# user_namespace = Namespace("User Module", path=app_constants.APIEndPoints.base_url)
# alarm_namespace = Namespace("Alarm Module", path=app_constants.APIEndPoints.base_url)
#
# # alarm--------
#
# create_alarm_configuration = alarm_namespace.model("create_alarm_configuration", {
# 'id': fields.String(required=True),
#
# })
# #done
# get_alarm_configuration = alarm_namespace.model("get_alarm_configuration", {
#
# 'id': fields.String(required=True)
# })
# # done
# get_alarm_list = alarm_namespace.model("get_alarm_list", {
#
# })
#
# delete_alarm_configuration = alarm_namespace.model("delete_alarm_configuration", {
# 'id': fields.String(required=True)
# })
# # end
# # user-----------
# add_users = user_namespace.model("add_users", {
# 'emp_id': fields.String(required=True),
# 'emp_name': fields.String(required=True),
# 'emp_desg': fields.String(required=True),
# 'emp_loc': fields.String(required=True),
# 'emp_site': fields.String(required=True)
# })
#
# find_user = user_namespace.model("find_user", {
# 'emp_id': fields.String(required=True),
# })
#
# update_users = user_namespace.model("update_users", {
# 'emp_id': fields.String(required=True),
# 'emp_name': fields.String(required=True),
# 'emp_desg': fields.String(required=True),
# 'emp_loc': fields.String(required=True),
# 'emp_site': fields.String(required=True)
# })
#
# delete_users = user_namespace.model("delete_users", {
# 'emp_id': fields.String(required=True),
# })
# # test it
# record_stream = user_namespace.model("record_stream", {
# 'emp_id': fields.String(required=True),
# 'mqtt_topic': fields.String(required=True),
# 'action': fields.String(required=True)
#
# })
# # test it
# get_users_image = user_namespace.model("get_users_image", {
# 'emp_id': fields.String(required=True),
#
# })
# # test it
# get_images = user_namespace.model("get_images", {
# 'emp_id': fields.String(required=True),
# 'n': fields.String(required=True)
# })
# # test it
# train_user = user_namespace.model("train_user", {
# 'emp_id': fields.String(required=True),
# })
#
# # end user--------------
# # event------
# query_events = event_namespace.model("query_events", {
#
# 'from_date': fields.String(required=True),
# 'to_date': fields.String(required=True),
# 'page': fields.Integer(required=True),
# 'eventNumber': fields.Integer(required=True)
#
# })
# download_report = event_namespace.model("download_report", {
#
# 'from_date': fields.String(required=True),
# 'to_date': fields.String(required=True)
#
# })
# last_n_events = event_namespace.model("last_n_events", {
#
# 'page': fields.Integer(required=True),
# 'eventNumber': fields.Integer(required=True)
#
# })
# find_filter = event_namespace.model("find_filter", {
# 'eventtype': fields.String(required=True),
# 'page': fields.Integer(required=True),
# 'eventNumber': fields.Integer(required=True)
#
# })
#
# # end event-----
#
# # site--------------
#
# # end site----------------
#
# # service-----
#
# # end services--
#
# # Camera-------------------------------------------------------------------------
#
# add_camera = camera_namespace.model("add_camera", {
#
# 'disable': fields.String(required=True),
# 'cameraName': fields.String(required=True),
# 'cameraMake': fields.String(required=True),
# 'cameraModelNumber': fields.String(required=True),
# 'siteName': fields.String(required=True),
# 'subSiteName': fields.String(required=True),
# 'cameraRTSPUrl': fields.String(required=True),
# 'frameRate': fields.String(required=True),
# 'description': fields.String(required=True),
# 'width': fields.Integer(required=True),
# 'height': fields.Integer(required=True),
# 'ilens_device_id': fields.String(required=True),
# 'physical_device_group_id': fields.String(required=True),
# 'model_id': fields.String(required=True)
#
# })
#
# delete_camera = camera_namespace.model("delete_camera", {
#
# 'cameraId': fields.String(required=True)
#
# })
#
# update_camera = camera_namespace.model("update_camera", {
# 'cameraId': fields.String(required=True),
# 'disable': fields.String(required=True),
# 'cameraName': fields.String(required=True),
# 'cameraMake': fields.String(required=True),
# 'cameraModelNumber': fields.String(required=True),
# 'siteName': fields.String(required=True),
# 'subSiteName': fields.String(required=True),
# 'cameraRTSPUrl': fields.String(required=True),
# 'frameRate': fields.String(required=True),
# 'description': fields.String(required=True),
# 'width': fields.Integer(required=True),
# 'height': fields.Integer(required=True),
# 'ilens_device_id': fields.String(required=True),
# 'physical_device_group_id': fields.String(required=True),
# 'model_id': fields.String(required=True)
#
# })
#
# find_camera = camera_namespace.model("find_camera", {
#
# 'deviceList': fields.List(fields.String(required=True))
#
# })
#
# # End Camera-------------------------------------------------------------------------
flask_cors
pyjwt
paho-mqtt
python-dateutil
python_logstash_async
pymongo
pandas
opencv-python
requests
minio
pdfkit
\ No newline at end of file
import queue
import traceback
import traceback
import uuid
import ssl
import smtplib
from datetime import datetime
from email import encoders
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from threading import Thread
from flask import request, Blueprint, jsonify
from flask_restplus import Resource, Api
from pymongo import MongoClient
from models.model import *
from scripts.common.config import ATTENDANCE_MONGO_HOST, ATTENDANCE_MONGO_PORT, ATTENDANCE_MONGO_DATABASE, \
ATTENDANCE_MONGO_AUTH, ATTENDANCE_MONGO_USERNAME, ATTENDANCE_MONGO_PASSWORD, \
KL_BOT_MONGO_COLLECTION, KL_BOT_JOB_COLLECTION
from scripts.common.logsetup import logger
from scripts.constants.app_constants import APIEndPoints, RequestMethods
klbot_blueprint = Blueprint('klbot_services', __name__)
api = Api(klbot_blueprint)
api.add_namespace(klbot_namespace)
if ATTENDANCE_MONGO_AUTH.lower() == 'false:':
attendance_mongo = MongoClient(ATTENDANCE_MONGO_HOST, int(ATTENDANCE_MONGO_PORT))
else:
attendance_mongo = MongoClient(host=ATTENDANCE_MONGO_HOST, port=int(ATTENDANCE_MONGO_PORT),
username=ATTENDANCE_MONGO_USERNAME, password=ATTENDANCE_MONGO_PASSWORD)
attendance_database = attendance_mongo[ATTENDANCE_MONGO_DATABASE]
klbot_collection = attendance_database[KL_BOT_MONGO_COLLECTION]
job_collection = attendance_database[KL_BOT_JOB_COLLECTION]
q = queue.Queue()
retry_queue = queue.Queue()
# @invoice_namespace.route(APIEndPoints.list_register)
# class list_register(Resource):
# def get(self):
# try:
# if request.method == RequestMethods.GET:
# all_registers = register_collection.find({}, {"_id": 0})
# data = {
# "status": True,
# "message": "success",
# "data": [
#
# ]
# }
# for task in all_registers:
# # print(task)
# task['lastUpdatedTime'] = task['lastUpdatedTime'].strftime("%d-%b-%Y %I:%M %p")
# data['data'].append(task)
# return jsonify(data)
# except Exception as e:
# logger.error(e)
# traceback.print_exc()
# return jsonify({'status': False, 'message': str(e)})
def insert_job(job):
jobValue = {
"insertedOn": datetime.now(),
"updatedOn": datetime.now(),
"status": "Queued"
}
jobValue.update(job)
logger.info("job inserted")
job_collection.insert(jobValue)
return "job inserted"
def update_job(job, status):
myQuery = {'jobId': job["jobId"]}
jobValue = {
"jobId": job["jobId"],
"updatedOn": datetime.now(),
"status": status,
}
logger.info("job updated")
job_collection.update_one(myQuery, {"$set": jobValue})
return "job updated inserted"
def add_to_queue(user_details):
job = {
"jobId": str(uuid.uuid1()).split('-')[0]
}
job.update(user_details)
q.put(job)
logger.info("job added to queue")
x = insert_job(job)
return job
def my_process():
while True:
try:
item = q.get()
if item is None:
continue
update_job(item, "Inprogress")
my_dict = {}
stringval = ""
for key, value in item.items():
if value is not None and key != "jobId" and key != "clinetId":
stringval = stringval + str(key).capitalize() + " : " + value + " , "
mail_dict = {'subject': item['request'], 'body': stringval[0:len(stringval)-2]}
print(mail_dict)
t = send_email(mail_dict)
if t:
update_job(item, "Completed")
item["sentmail"] = True
klbot_collection.insert(item)
else:
update_job(item, "Failed")
item["sentmail"] = False
klbot_collection.insert(item)
except:
pass
def send_email(content, attach=False):
from_address = "dasharatha.vamshi@knowledgelens.com"
to_address = ["sales@knowledgelens.com", "sneha@knowledgelens.com", "dasharatha.vamshi@knowledgelens.com"]
msg = MIMEMultipart()
msg['From'] = from_address
msg['To'] = " ,".join(to_address)
filename = ""
smtp_server = "smtp.gmail.com"
username = "dasharatha.vamshi@knowledgelens.com"
password = "Salla$230999"
smtp_server_port = 587
ssl_key = False
try:
msg['Subject'] = "KL Bot: " + content['subject']
msg['body'] = content['body']
msg.attach(MIMEText(msg['body'], 'plain'))
# give filename in self.filename to attach a document.
if attach:
attachment = open(filename, "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
msg.attach(p)
# starting the sever
if ssl_key:
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, smtp_server_port, context=context) as server:
server.login(username, password)
server.sendmail(from_address, to_address, msg.as_string())
else:
s = smtplib.SMTP(smtp_server, smtp_server_port)
s.starttls()
s.login(username, password)
s.sendmail(from_address, to_address, msg.as_string())
s.quit()
return True
except Exception as e:
print(e)
return False
@klbot_namespace.route(APIEndPoints.insert_to_mongo)
class insert_to_mongo(Resource):
@api.expect(insert_to_mongo)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
userID = str(uuid.uuid1()).split('-')[0]
user_details = {
"clinetId": userID,
"request": content.get("request", None),
"name": content.get("name", None),
"email": content.get("email", None),
"phoneNumber": content.get("phoneNumber", None),
"company": content.get("company", None),
"query": content.get("query", None),
"product": content.get("product", None),
}
# klbot_collection.insert(user_details)
job = add_to_queue(user_details)
# t = Thread(target=my_process)
# t.start()
return jsonify(
{"status": True, "message": "Client registered successfully", "job": job["jobId"]})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
def init_thread():
t = Thread(target=my_process)
t.start()
import datetime
import logging
import os
import traceback
import uuid
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import pymongo
import yagmail
import img2pdf
from PIL import Image
from flask import Flask, request, redirect, url_for, flash, render_template, send_from_directory
from flask import request, Blueprint, jsonify
from pymongo import MongoClient, DESCENDING
from scripts.common.config import ATTENDANCE_MONGO_HOST, ATTENDANCE_MONGO_PORT, ATTENDANCE_MONGO_DATABASE, \
ATTENDANCE_MONGO_INVOICES_COLLECTION, ATTENDANCE_MONGO_AUTH, ATTENDANCE_MONGO_USERNAME, ATTENDANCE_MONGO_PASSWORD, \
ATTENDANCE_MONGO_REGISTER_COLLECTION, ATTENDANCE_MONGO_JOB_COLLECTION, ATTENDANCE_MONGO_MODEL_COLLECTION
from scripts.handlers.test_invoices import test_invoices
from scripts.common.logsetup import logger
from flask_restplus import Resource, Api, reqparse
from scripts.constants.app_constants import APIEndPoints, RequestMethods
from models.model import *
from werkzeug.utils import secure_filename
from werkzeug.datastructures import FileStorage
import queue
from threading import Thread
from csv import DictWriter, writer
import csv
q = queue.Queue()
retry_queue = queue.Queue()
invoices_blueprint = Blueprint('invoices_services', __name__)
api = Api(invoices_blueprint)
api.add_namespace(invoice_namespace)
if ATTENDANCE_MONGO_AUTH.lower() == 'false:':
attendance_mongo = MongoClient(ATTENDANCE_MONGO_HOST, int(ATTENDANCE_MONGO_PORT))
else:
attendance_mongo = MongoClient(host=ATTENDANCE_MONGO_HOST, port=int(ATTENDANCE_MONGO_PORT),
username=ATTENDANCE_MONGO_USERNAME, password=ATTENDANCE_MONGO_PASSWORD)
attendance_database = attendance_mongo[ATTENDANCE_MONGO_DATABASE]
invoice_collection = attendance_database[ATTENDANCE_MONGO_INVOICES_COLLECTION]
register_collection = attendance_database[ATTENDANCE_MONGO_REGISTER_COLLECTION]
job_collection = attendance_database[ATTENDANCE_MONGO_JOB_COLLECTION]
model_collection = attendance_database[ATTENDANCE_MONGO_MODEL_COLLECTION]
ALLOWED_EXTENSIONS = set(['pdf', 'png', 'jpeg', 'jpg'])
UPLOAD_FOLDER = "data"
file_upload = Namespace(name="files")
upload_parser = reqparse.RequestParser(bundle_errors=True)
upload_parser.add_argument(
name="file",
type=FileStorage,
location="files", required=True
# action="append" # If this is removed it works with 1 file
)
upload_parser.add_argument(
name="registerId",
location='form', type='string', required=True
)
upload_parser.add_argument(
name="logisticsType",
location='form', type='string', required=True
)
retry_parser = reqparse.RequestParser(bundle_errors=True)
retry_parser.add_argument(
name="file",
type=FileStorage,
location="files", required=True
# action="append" # If this is removed it works with 1 file
)
retry_parser.add_argument(
name="documentId",
location='form', type='string', required=True
)
retry_parser.add_argument(
name="registerId",
location='form', type='string', required=True
)
retry_parser.add_argument(
name="logisticsType",
location='form', type='string', required=True
)
def append_dict_as_row(file_name, dict_of_elem, field_names):
# Open file in append mode
with open(file_name, 'a+', newline='') as write_obj:
# Create a writer object from csv module
dict_writer = DictWriter(write_obj, fieldnames=field_names)
# Add dictionary as wor in the csv
print(dict_writer)
dict_writer.writerow(dict_of_elem)
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
def insert_job(job):
jobValue = {
"jobId": job["jobId"],
"insertedOn": datetime.datetime.now(),
"updatedOn": datetime.datetime.now(),
"status": "Queued",
"documentId": job["documentId"],
"registerId": job["registerId"],
"logisticsType": job['logisticsType'],
"path": job['fileName'],
"fileName": job['fileName'],
"actualfile": job["actualfile"]
}
logger.info("job inserted")
job_collection.insert(jobValue)
return "job inserted"
def update_job(job, status):
myQuery = {'jobId': job["jobId"]}
jobValue = {
"jobId": job["jobId"],
"updatedOn": datetime.datetime.now(),
"status": status,
}
logger.info("job updated")
job_collection.update_one(myQuery, {"$set": jobValue})
return "job updated inserted"
def add_to_queue(filename, registerId, logisticsType, actualfile, documentId):
if len(documentId) == 0:
job = {
"jobId": str(uuid.uuid1()).split('-')[0],
"documentId": str(uuid.uuid1()).split('-')[0],
"path": os.path.join(UPLOAD_FOLDER, actualfile),
"fileName": filename,
"registerId": registerId,
"logisticsType": logisticsType,
"actualfile": actualfile
}
q.put(job)
else:
job = {
"jobId": str(uuid.uuid1()).split('-')[0],
"documentId": documentId,
"path": os.path.join(UPLOAD_FOLDER, actualfile),
"fileName": filename,
"registerId": registerId,
"logisticsType": logisticsType,
"actualfile": actualfile
}
q.put(job)
logger.info("job added to queue")
x = insert_job(job)
# print(x)
# print(q.unfinished_tasks)
# print(q.qsize())
# for n in list(q.queue):
# print(n, end="\n")
return job
def analyze_invoice():
while True:
try:
item = q.get()
if item is None:
continue
try:
update_job(item, "Inprogress")
check_failed = invoice_collection.find_one({'documentId': item['documentId']}, {'_id': 0})
# for task in check_failed:
# print(task)
print(check_failed)
data = register_collection.find_one({'registerId': item['registerId']}, {'_id': 0})
for i in range(len(data['logistics'])):
if data['logistics'][i]['logisticsType'] == item['logisticsType']:
labels = model_collection.find_one(
{'modelDocumentId': data['logistics'][i]['modelDocumentId']}, {'_id': 0})
if check_failed is None:
invoice_details1 = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Inprogress",
'analyzedResult': {}
}
invoice_collection.insert(invoice_details1)
print(data)
print(labels)
else:
myQuery = {'documentId': item['documentId']}
invoice_details1 = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Inprogress",
'analyzedResult': {}
}
invoice_collection.update_one(myQuery, {"$set": invoice_details1})
print(data)
print(labels)
try:
Result = test_invoices(item, labels)
except Exception as e:
print(e)
Result = 'Failed'
print("++dddddddddddddddd++", Result)
if Result == 'Failed':
update_job(item, "Failed")
invoice_details = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Failed",
'analyzedResult': {}
}
invoice_collection.update_one({'documentId': item['documentId']}, {"$set": invoice_details})
else:
update_job(item, "Success")
invoice_details = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Success",
'analyzedResult': {}
}
invoice_details['analyzedResult'].update(Result)
invoice_collection.update_one({'documentId': item['documentId']}, {"$set": invoice_details})
logger.info("invoice results inserted into mongo")
# invoice_collection.insert(invoice_details)
except Exception as e:
update_job(item, "Failed")
finally:
q.task_done()
except queue.Empty:
pass
except:
logging.exception('error while processing item')
@invoice_namespace.route('/<path:filename>')
class get_file(Resource):
def get(self, filename):
return send_from_directory(UPLOAD_FOLDER,
filename)
@invoice_namespace.route(APIEndPoints.get_invoices)
class get_invoices(Resource):
def get(self):
try:
if request.method == RequestMethods.GET:
all_invoices = invoice_collection.find({}, {"_id": 0}).sort('insertedOn', pymongo.DESCENDING)
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_invoices:
# print(task)
task['insertedOn'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@api.expect(upload_parser)
def post(self):
try:
if request.method == RequestMethods.POST:
# content = request.get_json()
# print(UPLOAD_FOLDER)
# print(request.files)
imd = request.files
registerId = request.form.get('registerId')
logisticsType = request.form.get('logisticsType')
print(registerId, logisticsType)
finaldict = imd.to_dict(flat=False)
# print(finaldict)
x = finaldict['file']
print(x)
if 'file' not in request.files:
# flash('No file part')
return jsonify({"status": "No file"})
file = request.files['file']
for file in x:
print(file)
print(file.filename)
if file.filename == '':
flash('No selected file')
return redirect(request.url)
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
x = filename.split('.')
print(x[0])
file.save(os.path.join(UPLOAD_FOLDER, filename))
finalpdfname = x[0] + '.pdf'
img_path = os.path.join(UPLOAD_FOLDER, filename)
pdf_path = os.path.join(UPLOAD_FOLDER, finalpdfname)
image = Image.open(img_path)
pdf_bytes = img2pdf.convert(image.filename)
file = open(pdf_path, "wb")
file.write(pdf_bytes)
image.close()
file.close()
#
#
# image1 = Image.open(os.path.join(UPLOAD_FOLDER, filename))
# im1 = image1.convert('RGB')
# finalpdfname = x[0] + '.pdf'
# im1.save(os.path.join(UPLOAD_FOLDER, finalpdfname))
else:
return jsonify({"status": "Not supported file format"})
documentId = ''
job = add_to_queue(finalpdfname, registerId, logisticsType, filename, documentId)
print(job)
# download_file(os.path.join(UPLOAD_FOLDER, filename))
logger.info("job added")
t = Thread(target=analyze_invoice)
t.start()
return jsonify({"status": True, "message": "Upload successful", "jobId": job["jobId"]})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.create_register)
class create_register(Resource):
@api.expect(create_register)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
print(content)
labelList = []
registerId = str(uuid.uuid1()).split('-')[0]
register_details = {
"registerName": content['registerName'],
"registerId": registerId,
"registerIconUrl": "",
"lastUpdatedTime": datetime.datetime.utcnow(),
"logistics": [
{"logisticsType": "Inbound",
"modelDocumentId": content['inboundModelId']
},
{
"modelDocumentId": content['outboundModelId'],
"logisticsType": "Outbound"
}
]
# {
# "inbound": {
# "modelDocumentId": content['inboundModelId']
# },
# "outbound": {
# "modelDocumentId": content['outboundModelId']
# }
# }
}
register_collection.insert(register_details)
return jsonify({"status": True, "message": "Register inserted successfully", "registerId": registerId})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.retry_invoice)
class retry_invoice(Resource):
@api.expect(retry_parser)
def post(self):
try:
if request.method == RequestMethods.POST:
# content = request.get_json()
# documentId = request.form.get('documentId')
imd = request.files
documentId = request.form.get('documentId')
registerId = request.form.get('registerId')
logisticsType = request.form.get('logisticsType')
finaldict = imd.to_dict(flat=False)
# print(finaldict)
x = finaldict['file']
job_results = job_collection.find({'documentId': documentId}, {"_id": 0})
print(x)
if 'file' not in request.files:
# flash('No file part')
return jsonify({"status": "No file"})
file = request.files['file']
for file in x:
print(file)
print(file.filename)
if file.filename == '':
flash('No selected file')
return redirect(request.url)
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
x = filename.split('.')
print(x[0])
file.save(os.path.join(UPLOAD_FOLDER, filename))
finalpdfname = x[0] + '.pdf'
img_path = os.path.join(UPLOAD_FOLDER, filename)
pdf_path = os.path.join(UPLOAD_FOLDER, finalpdfname)
image = Image.open(img_path)
pdf_bytes = img2pdf.convert(image.filename)
file = open(pdf_path, "wb")
file.write(pdf_bytes)
image.close()
file.close()
#
#
# image1 = Image.open(os.path.join(UPLOAD_FOLDER, filename))
# im1 = image1.convert('RGB')
# finalpdfname = x[0] + '.pdf'
# im1.save(os.path.join(UPLOAD_FOLDER, finalpdfname))
else:
return jsonify({"status": "Not supported file format"})
job = add_to_queue(finalpdfname, registerId, logisticsType, filename, documentId)
# print(job)
# download_file(os.path.join(UPLOAD_FOLDER, filename))
logger.info("job added")
t = Thread(target=analyze_invoice)
t.start()
return jsonify({"status": True, "message": "Upload successful", "jobId": job["jobId"]})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.list_register)
class list_register(Resource):
def get(self):
try:
if request.method == RequestMethods.GET:
all_registers = register_collection.find({}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_registers:
# print(task)
task['lastUpdatedTime'] = task['lastUpdatedTime'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.create_model)
class create_model(Resource):
@api.expect(create_model)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
modelDocumentId = str(uuid.uuid1()).split('-')[0]
# print(content)
labelList = []
model_details = {
"modelDocumentId": modelDocumentId,
"modelId": content['modelId'],
"createdDateTime": datetime.datetime.utcnow(),
"lastUpdatedDateTime": datetime.datetime.utcnow(),
"trainedDocuments": int(content['trainedDocuments']),
"trainedLabels": content['trainedLabels']
}
model_collection.insert(model_details)
return jsonify(
{"status": True, "message": "Model registered successfully", "modelDocumentId": modelDocumentId})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.list_model)
class list_model(Resource):
def get(self):
try:
if request.method == RequestMethods.GET:
all_models = model_collection.find({}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_models:
# print(task)
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.get_job_status)
class get_job_status(Resource):
@api.expect(get_job_status)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
# all_jobs = job_collection.find({'jobId': content['jobId']}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for i in content['jobId']:
all_jobs = job_collection.find({'jobId': i}, {"_id": 0})
for task in all_jobs:
# print(task)
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
def get(self):
try:
if request.method == RequestMethods.GET:
all_jobs = job_collection.find({}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_jobs:
# print(task)
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.invoices_for_register)
class invoices_for_register(Resource):
@api.expect(invoices_for_register)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
all_invoices = invoice_collection.find({'registerId': content['registerId']}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_invoices:
# print(task)
task['timestamp'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.searchOn)
@api.doc(params={'label': 'label', 'value': 'value'})
class searchOn(Resource):
def get(self):
if request.method == 'GET':
try:
label = request.args.get('label', "")
value = request.args.get('value', "")
# registerId = request.args.get('registerId', "")
search_list = invoice_collection.find({}, {'_id': 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in search_list:
# print(task['analyzedResult'][str(label)])
# print(len(task['analyzedResult']))
for key in task['analyzedResult']:
if key == str(label):
if task['analyzedResult'][key] == str(value):
task['timestamp'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.info(e)
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.get_invoice_result)
class get_invoice_result(Resource):
@api.expect(get_invoice_result)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
all_results = invoice_collection.find({'documentId': content['documentId']}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_results:
# print(task)
task['insertedOn'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.download_report)
class download_report(Resource):
@api.expect(download_report)
def post(self):
try:
if request.method == RequestMethods.POST:
try:
content = request.get_json()
file = open("data/report.csv", "w")
file.close()
field_names = ['analyzedResult', 'insertedOn', 'documentId', 'registerId',
'modelDocumentId', 'logisticsType', 'path', 'fileName']
field_names1 = ['Register', 'RegisterType', 'File Name', 'From', 'Invoice Date', 'Invoice No',
'Motor Vehicle No', 'Quantity', 'Docket No']
with open("data/report.csv", 'a+', newline='') as file:
writer = csv.writer(file)
writer.writerow(field_names1)
data = {
"status": True,
"message": "success",
"data": [
]
}
register = ""
from_date = content.get('fromDate', str(datetime.datetime.now().date().isoformat()))
to_date = content.get('toDate', str(datetime.datetime.now().date().isoformat()))
from_date = datetime.datetime.strptime(from_date + "T00:00:00.100Z", '%d/%m/%YT%H:%M:%S.%fZ')
to_date = datetime.datetime.strptime(to_date + "T23:59:59.100Z", '%d/%m/%YT%H:%M:%S.%fZ')
# print(from_date.isoformat())
toEmail = content['toEmail']
registerIdList = content['registerIdList']
print(from_date, to_date, toEmail, registerIdList)
for i in registerIdList:
print(i)
total_invoices = invoice_collection.find(
{'registerId': i, "insertedOn": {"$gte": from_date, "$lt": to_date}},
{"_id": 0}).sort('insertedOn', pymongo.DESCENDING)
registernames = register_collection.find_one({'registerId': i}, {"_id": 0})
register = register + ' ' + registernames['registerName'] + ', '
for task in total_invoices:
# print(task)
task['insertedOn'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
for key in task['analyzedResult']:
sendjosn = {'Register': registernames['registerName'],
'RegisterType': task['logisticsType'], 'File Name': task['fileName'],
'From': "",
'Invoice Date': "", 'Invoice No': "",
'Motor Vehicle No': "",
'Quantity': "", 'Docket No': ""}
if len(task['analyzedResult']) == 2:
sendjosn['From'] = task['analyzedResult']['From']
sendjosn['Docket No'] = task['analyzedResult'][key]
else:
sendjosn['From'] = task['analyzedResult']['From']
sendjosn['Invoice Date'] = task['analyzedResult']['Invoice Date']
sendjosn['Invoice No'] = task['analyzedResult']['Invoice No']
sendjosn['Motor Vehicle No'] = task['analyzedResult']['Motor Vehicle No']
sendjosn['Quantity'] = task['analyzedResult']['Quantity']
# append_dict_as_row('data/report.csv', sendjosn, field_names1)
# append_dict_as_row('data/report.csv', task, field_names)
append_dict_as_row('data/report.csv', sendjosn, field_names1)
data['data'].append(task)
# pdf_file = generate_pdf_report(from_date, to_date, eventtype)
# return send_file(pdf_file,
# as_attachment=True)
# Python code to illustrate Sending mail with attachments
# from your Gmail account
# libraries to be imported
fromaddr = "dasharatha.vamshi@knowledgelens.com"
toaddr = toEmail
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "Report Generated"
body = "Please find the report generated for " + register + " between " + content[
'fromDate'] + " and " + content['toDate']
msg.attach(MIMEText(body, 'plain'))
filename = "report.csv"
attachment = open("data/report.csv", "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload((attachment).read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
msg.attach(p)
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login(fromaddr, "Salla$230999")
text = msg.as_string()
s.sendmail(fromaddr, toaddr, text)
s.quit()
# receiver = toEmail
# body = "Pls find attached document"
# filename = "data/report.csv"
#
# yag = yagmail.SMTP("dasharatha.vamshi@knowledgelens.com")
# yag.send(
# to=receiver,
# subject="Report Generated",
# contents=body,
# attachments=filename,
# )
print(len(data['data']))
send_mail = jsonify(data)
print(data)
return jsonify({'status': True, 'message': "Email Sent"})
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.register_details)
class register_details(Resource):
@api.expect(register_details)
def post(self):
try:
if request.method == RequestMethods.POST:
try:
content = request.get_json()
data = {
"status": True,
"message": "success",
"data": [
]
}
all_register = register_collection.find({'registerId': content['registerId']}, {"_id": 0})
A = []
for task in all_register:
print(task)
for i in task['logistics']:
append = {"files": [], 'typeTitle': i['logisticsType'],
'lastUpdatedTime': task["lastUpdatedTime"].strftime("%d-%b-%Y %I:%M %p")}
all_invoices = invoice_collection.find(
{'registerId': content['registerId'], 'logisticsType': i['logisticsType']},
{"_id": 0}).sort('insertedOn', pymongo.DESCENDING)
for j in all_invoices:
j['insertedOn'] = j['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
append['files'].append(j)
data['data'].append(append)
return jsonify(data)
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
import base64
import configparser
import jwt
import os
import sys
# import paho.mqtt.client as mqtt
from datetime import datetime
from dateutil import parser
from scripts.common.constants import LicenseModule
def licence_validator(payload):
try:
dt = parser.parse(payload['valid_till'])
now = datetime.now()
if now > dt:
sys.stdout.write("Licence Expired \n".format())
sys.stdout.flush()
return True
return True
except KeyError as err:
sys.stdout.write(err)
sys.stderr.write("Error loading licence")
return True
CONFIGURATION_FILE = os.environ.get("CONF_PATH", os.path.join(os.getcwd(), "conf{0}settings.conf".format(os.sep)))
sys.stdout.write("Reading Config from {} \n".format(CONFIGURATION_FILE))
sys.stdout.flush()
__config = configparser.ConfigParser()
__config.read(CONFIGURATION_FILE)
BASE_LOG_PATH = os.environ.get('BASE_LOG_PATH',
__config.get('LOGGER', 'basepath', fallback=os.path.join(os.getcwd(), "logs".format())))
if not os.path.isdir(BASE_LOG_PATH):
os.mkdir(BASE_LOG_PATH)
DATA_PATH = os.environ.get('BASE_DATA_PATH', __config.get('CLIENT-CONFIG', 'basepath', fallback=os.path.normpath(
os.getcwd() + '{}data'.format(os.sep))))
sys.stdout.write("Data base path {} \n".format(DATA_PATH))
LICENCE_FILE = os.environ.get("LICENCE_FILE", __config.get('CLIENT-CONFIG', 'licence-life', fallback="license.lic"))
LICENCE_FILE = os.path.join(DATA_PATH, LICENCE_FILE)
sys.stdout.write("Loading Licence {} \n".format(LICENCE_FILE))
try:
private_key = LicenseModule.private_key
encoding_algorithm = LicenseModule.encoding_algorithm
LICENCE_PAYLOAD = jwt.decode(bytes(base64.b64decode(open(LICENCE_FILE, 'rb').read())), private_key,
algorithms=[encoding_algorithm])
except Exception as e:
sys.stderr.write("{}".format(e))
sys.stderr.write(" **Error loading licence** \n")
LOG_LEVEL = os.environ.get("LOG_LEVEL", __config.get('LOGGER', 'loglevel', fallback="DEBUG")).upper()
LOGSTASH_HOST = os.environ.get("LOGSTASH_HOST", __config.get('LOGGER', 'loglevel', fallback=None))
LOGSTASH_PORT = os.environ.get("LOGSTASH_PORT", __config.get('LOGGER', 'loglevel', fallback=None))
LOG_HANDLER_NAME = os.environ.get("LOG_HANDLER_NAME", __config.get('LOGGER', 'loglevel', fallback="face-id"))
ATTENDANCE_MONGO_HOST = __config.get('ATTENDANCE MONGO', 'HOST', fallback="0.0.0.0")
ATTENDANCE_MONGO_PORT = int(__config.get('ATTENDANCE MONGO', 'PORT', fallback="27017"))
ATTENDANCE_MONGO_DATABASE = __config.get('ATTENDANCE MONGO', 'DATABASE', fallback=" ")
ATTENDANCE_MONGO_AUTH = __config.get('ATTENDANCE MONGO', 'AUTH', fallback="false")
ATTENDANCE_MONGO_USERNAME = __config.get('ATTENDANCE MONGO', 'USERNAME', fallback=" ")
ATTENDANCE_MONGO_PASSWORD = __config.get('ATTENDANCE MONGO', 'PASSWORD', fallback=" ")
ATTENDANCE_MONGO_INVOICES_COLLECTION = __config.get('ATTENDANCE MONGO', 'INVOICE_COLLECTION', fallback=" ")
ATTENDANCE_MONGO_REGISTER_COLLECTION = __config.get('ATTENDANCE MONGO', 'REGISTER_COLLECTION', fallback=" ")
KL_BOT_JOB_COLLECTION = __config.get('ATTENDANCE MONGO', 'JOB_COLLECTION', fallback=" ")
ATTENDANCE_MONGO_MODEL_COLLECTION = __config.get('ATTENDANCE MONGO', 'MODEL_COLLECTION', fallback=" ")
KL_BOT_MONGO_COLLECTION = __config.get('ATTENDANCE MONGO', 'BOT_COLLECTION', fallback=" ")
# ATTENDANCE_MONGO_CAMERA_COLLECTION = __config.get('ATTENDANCE MONGO', 'CAMERA_COLLECTION', fallback=" ")
# ATTENDANCE_MONGO_EVENT_COLLECTION = __config.get('ATTENDANCE MONGO', 'EVENTS_COLLECTION', fallback=" ")
# ATTENDANCE_MONGO_SERVICE_COLLECTION = __config.get('ATTENDANCE MONGO', 'SERVICE_COLLECTION', fallback=" ")
# ATTENDANCE_MONGO_SITE_COLLECTION = __config.get('ATTENDANCE MONGO', 'SITE_COLLECTION', fallback=" ")
# ATTENDANCE_MONGO_THRESHOLD_COLLECTION = __config.get('ATTENDANCE MONGO', 'THRESHOLD_COLLECTION', fallback=" ")
# ATTENDANCE_MONGO_TAG_COLLECTION = __config.get('ATTENDANCE MONGO', 'TAG_COLLECTION', fallback=" ")
# ALARM_COLLECTION = __config.get('ATTENDANCE MONGO', 'ALARM_COLLECTION', fallback=" ")
# ALARM_PRIORITY_TYPE_COLLECTION = __config.get('ATTENDANCE MONGO', 'ALARM_PRIORITY_TYPE_COLLECTION', fallback=" ")
# STATIC_CONTENT_COLLECTION = __config.get('ATTENDANCE MONGO', 'STATIC_CONTENT_COLLECTION', fallback=" ")
# WORK_GROUP_COLLECTION = __config.get('ATTENDANCE MONGO', 'WORK_GROUP_COLLECTION', fallback=" ")
# USER_COLLECTION = __config.get('ATTENDANCE MONGO', 'USER_COLLECTION', fallback=" ")
# NOTIFICATIONS_COLLECTION = __config.get('ATTENDANCE MONGO', 'NOTIFICATIONS_COLLECTION', fallback=" ")
# AI_MODEL_COLLECTION = __config.get('ATTENDANCE MONGO', 'AI_MODEL_COLLECTION', fallback=" ")
# DEVICE_DATABASE = __config.get('ATTENDANCE MONGO', 'DEVICE_DATABASE', fallback=" ")
# DEVICE_COLLECTION = __config.get('ATTENDANCE MONGO', 'DEVICE_COLLECTION', fallback=" ")
# JANUS_DEPLOYMENT_COLLECTION = __config.get('ATTENDANCE MONGO', 'JANUS_DEPLOYMENT_COLLECTION', fallback=" ")
# CONTAINER_DEPLOYMENT_COLLECTION = __config.get('ATTENDANCE MONGO', 'CONTAINER_DEPLOYMENT_COLLECTION', fallback=" ")
SERVICE_HOST = __config.get('SERVICE', 'HOST', fallback="0.0.0.0")
SERVICE_PORT = int(__config.get('SERVICE', 'PORT', fallback="5000"))
# DEVICE = __config.get('ILENS DEVICE', 'DEVICE', fallback="")
# TAG = __config.get('ILENS DEVICE', 'TAG', fallback="")
#
# MODELSERVER_HOST = __config.get('MODELSERVER', 'HOST', fallback="")
# MODELSERVER_PORT = int(__config.get('MODELSERVER', 'PORT', fallback=""))
# MODELSERVER_TRAIN_EP = __config.get('MODELSERVER', 'TRAIN_EP', fallback="")
# IMAGE_DIRECTORY_BASEPATH = __config.get('TRAIN_USERS', 'DIRECTORY_BASEPATH', fallback="")
# ALLOWED_EXTENSIONS = {'png', 'jpeg', 'jpg'}
# MQTT_HOST = __config.get('RECORDINGS', 'MQTT_HOST', fallback="192.168.207")
# MQTT_PORT = int(__config.get('RECORDINGS', 'MQTT_PORT', fallback="31250"))
# MQTT_TOPIC = __config.get('RECORDINGS', 'MQTT_TOPIC', fallback="video_recording")
# THERMAL_ATTENDANCE_MONGO_HOST = __config.get('NEW ATTENDANCE', 'HOST', fallback="0.0.0.0")
# THERMAL_ATTENDANCE_MONGO_PORT = int(__config.get('NEW ATTENDANCE', 'PORT', fallback="27017"))
# THERMAL_ATTENDANCE_MONGO_DATABASE = __config.get('NEW ATTENDANCE', 'DATABASE', fallback=" ")
# THERMAL_ATTENDANCE_MONGO_AUTH = __config.get('NEW ATTENDANCE', 'AUTH', fallback="false")
# THERMAL_ATTENDANCE_MONGO_USERNAME = __config.get('NEW ATTENDANCE', 'USERNAME', fallback=" ")
# THERMAL_ATTENDANCE_MONGO_PASSWORD = __config.get('NEW ATTENDANCE', 'PASSWORD', fallback=" ")
# THERMAL_ATTENDANCE_MONGO_EVENT_COLLECTION = __config.get('NEW ATTENDANCE', 'THERMAL_COLLECTION', fallback=" ")
#
# JS_HOST = __config.get('JANUS_SERVER', 'HOST', fallback=" ")
# JS_PORT = int(__config.get('JANUS_SERVER', 'PORT', fallback=" "))
# JS_EP = __config.get('JANUS_SERVER', 'JANUS_EP', fallback=" ")
#
# MINIO_SECRET_KEY = __config.get('MINIO', 'SECRET_KEY', fallback=" ")
# MINIO_ACCESS_KEY = __config.get('MINIO', 'ACCESS_KEY', fallback=" ")
# MINIO_BUCKET_NAME = __config.get('MINIO', 'BUCKET_NAME', fallback=" ")
# MINIO_IP = __config.get('MINIO', 'MINIO_IP', fallback=" ")
# MINIO_LOCAL_DATA_PATH = __config.get('MINIO', 'LOCAL_DATA_PATH', fallback=" ")
class LicenseModule:
private_key = "3139343831323738414d47454e3936363538373136"
encoding_algorithm = "HS256"
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from scripts.common.config import LOG_LEVEL, LOGSTASH_HOST, LOGSTASH_PORT, LOG_HANDLER_NAME, BASE_LOG_PATH
import logging
from logstash_async.handler import AsynchronousLogstashHandler
from logging.handlers import RotatingFileHandler
from logging import WARNING,INFO,DEBUG,ERROR
import os
DEFAULT_FORMAT = '%(asctime)s %(levelname)5s %(name)s %(message)s'
DEBUG_FORMAT = '%(asctime)s %(levelname)5s %(name)s [%(threadName)5s:%(filename)5s:%(funcName)5s():%(lineno)s] %(message)s'
EXTRA = {}
FORMATTER = DEFAULT_FORMAT
if LOG_LEVEL.strip() == "DEBUG":
FORMATTER = DEBUG_FORMAT
def get_logger(log_handler_name, extra=EXTRA):
"""
Purpose : To create logger .
:param log_handler_name: Name of the log handler.
:param extra: extra args for the logger
:return: logger object.
"""
log_path = os.path.join(BASE_LOG_PATH, log_handler_name + ".log")
logstash_temp = os.path.join(BASE_LOG_PATH, log_handler_name + ".db")
logger = logging.getLogger(log_handler_name)
logger.setLevel(LOG_LEVEL.strip().upper())
log_handler = logging.StreamHandler()
log_handler.setLevel(LOG_LEVEL)
formatter = logging.Formatter(FORMATTER)
log_handler.setFormatter(formatter)
handler = RotatingFileHandler(log_path, maxBytes=10485760,
backupCount=5)
handler.setFormatter(formatter)
logger.addHandler(log_handler)
logger.addHandler(handler)
if LOGSTASH_PORT is not None and LOGSTASH_HOST is not None and LOGSTASH_PORT.isdigit():
logger.addHandler(AsynchronousLogstashHandler(LOGSTASH_HOST, int(LOGSTASH_PORT), database_path=logstash_temp))
logger = logging.LoggerAdapter(logger, extra)
return logger
logger = get_logger(LOG_HANDLER_NAME)
class APIEndPoints:
base_url = "/"
base_path = ""
# invoice
get_invoices = base_path + "/invoices"
get_all_jobs = base_path + "/jobs"
get_job_status = base_path + "/get_job_status"
list_register = base_path + '/list_register'
create_register = base_path + '/create_register'
list_model = base_path + '/list_model'
create_model = base_path + '/create_model'
invoices_for_register = base_path + '/invoices_for_register'
searchOn = base_path + '/searchOn'
get_invoice_result = base_path + '/get_invoice_result'
get_file = base_path + '/get_file/<path:filename>'
download_report = base_path + '/download_report'
register_details = base_path + '/register_details'
retry_invoice = base_path + '/retry_invoice'
insert_to_mongo = base_path + '/insert_into_mongo'
# camera
# list_cameras = base_path + "/cameras"
# delete_camera = base_path + "/cameras/delete"
# update_camera = base_path + "/cameras/update"
# find_camera = base_path + "/camera/findbyid"
# # sites
# get_sites = base_path + "/sites"
# get_cameras_per_site = base_path + "/sites/find"
#
# # service
# retrive_metadata = base_path + "/service_metadata"
# get_device_list = base_path + "/device/list"
# get_tags = base_path + "/tag"
# get_models = base_path + "/models"
# get_notifs = base_path + "/notification/list"
# get_devices = base_path + "/device"
# get_deployment_details = base_path + "/deployment"
#
# # events
# query_events = base_path + "/events"
# download_report = base_path + "/download_report"
# last_n_events = base_path + "/events/last_n"
# find_filter = base_path + "/events/filter"
# find_event_types = base_path + "/events/get_eventtypes"
#
# # users
#
# get_users = base_path + "/users" # get
# add_users = base_path + "/users/add"
# find_user = base_path + "/users/find"
# update_users = base_path + "/users/update"
# delete_users = base_path + "/users/delete"
# record_stream = base_path + "/users/record"
# get_users_image = base_path + "/users/upload"
# get_images = base_path + "/users/get_images"
# train_user = base_path + "/users/train"
#
# # alarm
# create_alarm_configuration = base_path + "/alarm_configuration/create"
# get_alarm_configuration = base_path + "/alarm_configuration/get"
# get_alarm_list = base_path + "/alarm_list/get"
# delete_alarm_configuration = base_path + "/alarm_configuration/delete"
class RequestMethods:
POST = "POST"
GET = "GET"
class SwaggerClass:
title = "KL BOT Services"
########### Python Form Recognizer Async Analyze #############
import json
import time
from requests import get, post
# Endpoint URL
def test_invoices(source, labels):
endpoint = r"https://form-recog1.cognitiveservices.azure.com/"
apim_key = "9747a2a5ce2f426793b3c05bc2b34c17"
# model_id = "c2c1a822-7083-455a-879d-c53aa9ff00c5"
model_id = labels['modelId']
print(model_id)
post_url = endpoint + "/formrecognizer/v2.0-preview/custom/models/%s/analyze" % model_id
print(source)
# source = r"Test/Invoice_6.pdf"
params = {
"includeTextDetails": True
}
headers = {
# Request headers
'Content-Type': 'application/pdf',
'Ocp-Apim-Subscription-Key': apim_key,
}
with open(source['path'], "rb") as f:
data_bytes = f.read()
try:
resp = post(url=post_url, data=data_bytes, headers=headers, params=params)
if resp.status_code != 202:
print("POST analyze failed:\n%s" % json.dumps(resp.json()))
quit()
print("POST analyze succeeded:\n%s" % resp.headers)
get_url = resp.headers["operation-location"]
except Exception as e:
print("POST analyze failed:\n%s" % str(e))
quit()
n_tries = 15
n_try = 0
wait_sec = 5
max_wait_sec = 60
while n_try < n_tries:
try:
resp = get(url=get_url, headers={"Ocp-Apim-Subscription-Key": apim_key})
resp_json = resp.json()
if resp.status_code != 200:
print("GET analyze results failed:\n%s" % json.dumps(resp_json))
return "Failed"
status = resp_json["status"]
if status == "succeeded":
# print(resp_json)
# print(
# "Analysis succeeded:\n%s" % json.dumps(resp_json))
Result = {}
num = resp_json['analyzeResult']['documentResults'][0]["fields"][labels['trainedLabels'][0]]["valueString"]
dt = resp_json['analyzeResult']['documentResults'][0]["fields"][labels['trainedLabels'][1]]["valueString"]
for i in labels['trainedLabels']:
Result[i] = resp_json['analyzeResult']['documentResults'][0]["fields"][i]["valueString"]
print(Result)
# print("Analysis succeeded:\n%s" % json.dumps(
# resp_json['analyzeResult']['documentResults'][0]["fields"]["Invoice Number"]["valueString"]))
# print("Analysis succeeded:\n%s" % json.dumps(
# resp_json['analyzeResult']['documentResults'][0]["fields"]["Invoice Due Date"]["valueString"]))
# quit()
return Result
if status == "failed":
print("Analysis failed:\n%s" % json.dumps(resp_json))
return "Failed"
# quit()
# Analysis still running. Wait and retry.
time.sleep(wait_sec)
n_try += 1
wait_sec = min(2 * wait_sec, max_wait_sec)
except Exception as e:
msg = "GET analyze results failed:\n%s" % str(e)
print(msg)
return "Failed"
print("Analyze operation did not complete within the allocated time.")
################# MASTER #################
build-master:
stage: build
before_script:
- val=`echo $(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT COUNT(*) FROM $VERSION_DB.$DB_TABLE WHERE category='Server' AND type='Service' AND os='source' AND module_name='$CI_PROJECT_NAME' ") | cut -d " " -f2`
- if [ $val == 0 ]; then mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $VERSION_DB.$DB_TABLE values('Server','Service','$CI_PROJECT_NAME','source', '0', '0', '0')";fi
- DEV=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT dev FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- QA=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT qa FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- PROD=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT prod FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
script:
- PROD=$(expr $PROD + 1)
- QA="0"
- DEV="0"
- DEV=`expr $DEV + 1`
- tar czvf $CI_PROJECT_NAME.tar.gz *
- curl -u"$ARTIFACTORY_USER:$ARTIFACTORY_PASS" -T $CI_PROJECT_NAME.tar.gz $ARTIFACTORY_URL/$SUB_GROUP/$CI_PROJECT_NAME/x64/source/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME.tar.gz
- docker build -t $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME .
- docker tag $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- docker push ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $HISTORY_DB.$DB_TABLE values('$CI_JOB_ID','Server','Service', '$CI_PROJECT_NAME','source', '$PROD.$QA.$DEV', '$CI_COMMIT_SHA', '$GITLAB_USER_NAME', '$CI_COMMIT_REF_NAME')"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "UPDATE $VERSION_DB.$DB_TABLE SET prod='$PROD' ,qa='$QA', dev='$DEV' WHERE module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'"
- rm -f $CI_PROJECT_NAME.tar.gz
only:
- master
tags:
- shell
##################### TEST ######################
build-test:
stage: build
before_script:
- val=`echo $(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT COUNT(*) FROM $VERSION_DB.$DB_TABLE WHERE category='Server' AND type='Service' AND os='source' AND module_name='$CI_PROJECT_NAME' ") | cut -d " " -f2`
- if [ $val == 0 ]; then mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $VERSION_DB.$DB_TABLE values('Server','Service','$CI_PROJECT_NAME','source', '0', '0', '0')";fi
- DEV=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT dev FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- QA=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT qa FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- PROD=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT prod FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
script:
- QA=$(expr $QA + 1)
- DEV="0"
- tar czvf $CI_PROJECT_NAME.tar.gz *
- curl -u"$ARTIFACTORY_USER:$ARTIFACTORY_PASS" -T $CI_PROJECT_NAME.tar.gz $ARTIFACTORY_URL/$SUB_GROUP/$CI_PROJECT_NAME/x64/source/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME.tar.gz
- docker build -t $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME .
- docker tag $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- docker push ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $HISTORY_DB.$DB_TABLE values('$CI_JOB_ID','Server','Service', '$CI_PROJECT_NAME','source', '$PROD.$QA.$DEV', '$CI_COMMIT_SHA', '$GITLAB_USER_NAME', '$CI_COMMIT_REF_NAME')"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "UPDATE $VERSION_DB.$DB_TABLE SET prod='$PROD' ,qa='$QA', dev='$DEV' WHERE module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'"
only:
- test
tags:
- shell
############| DEV |############
build-dev:
stage: build
before_script:
- val=`echo $(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "SELECT COUNT(*) FROM $VERSION_DB.$DB_TABLE WHERE category='Server' AND type='Service' AND os='source' AND module_name='$CI_PROJECT_NAME' ") | cut -d " " -f2`
- if [ $val == 0 ]; then mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $VERSION_DB.$DB_TABLE values('Server','Service','$CI_PROJECT_NAME','source', '0', '0', '0')";fi
- DEV=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT dev FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- QA=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT qa FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
- PROD=$(mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -N -e "SELECT prod FROM $VERSION_DB.$DB_TABLE where module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'")
script:
- DEV=$(expr $DEV + 1)
- tar czvf $CI_PROJECT_NAME.tar.gz *
- curl -u"$ARTIFACTORY_USER:$ARTIFACTORY_PASS" -T $CI_PROJECT_NAME.tar.gz $ARTIFACTORY_URL/$SUB_GROUP/$CI_PROJECT_NAME/x64/source/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME.tar.gz
- docker build -t $CI_PROJECT_NAME:$CI_COMMIT_REF_NAME .
- docker tag "$CI_PROJECT_NAME":"$CI_COMMIT_REF_NAME" ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/"$CI_PROJECT_NAME"/"$CI_COMMIT_REF_NAME"/"$PROD.$QA.$DEV"/$CI_PROJECT_NAME:"$PROD.$QA.$DEV"
- docker push ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/ilens-ai/service/"$CI_PROJECT_NAME"/"$CI_COMMIT_REF_NAME"/"$PROD.$QA.$DEV"/"$CI_PROJECT_NAME":"$PROD.$QA.$DEV"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "INSERT INTO $HISTORY_DB.$DB_TABLE values('$CI_JOB_ID','Server','Service', '$CI_PROJECT_NAME','source', '$PROD.$QA.$DEV', '$CI_COMMIT_SHA', '$GITLAB_USER_NAME', '$CI_COMMIT_REF_NAME')"
- mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -e "UPDATE $VERSION_DB.$DB_TABLE SET prod='$PROD' ,qa='$QA', dev='$DEV' WHERE module_name = '$CI_PROJECT_NAME' AND type = 'Service' AND category = 'Server' AND os = 'source'"
only:
- dev
tags:
- shell
############| CODE QUALITY (DEV) |############
build-dev-codequality:
stage: build
image:
name: ailens-registry.knowledgelens.com:9082/repository/kl-docker-repo/kl-it-operations/gitlab-runner/ubuntu:sonar-scanner
script:
- /opt/sonar-scanner/bin/sonar-scanner -Dsonar.projectKey=$CI_PROJECT_NAME -Dsonar.projectName=$CI_PROJECT_NAME -Dsonar.typescript.node=./node/node -Dsonar.login=admin -Dsonar.password=admin -Dsonar.sources=.
- sleep 10
- python3 /opt/code_quality_report/static_code_quality_report_csv_v2.py $CI_PROJECT_NAME $GITLAB_USER_EMAIL,$EMAIL_TO $EMAIL_FROM $EMAIL_PASSWD False admin admin
only:
- dev
tags:
- docker-prod
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (thermal-app-ui-services)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyChainedComparisonsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoreConstantInTheMiddle" value="true" />
</inspection_tool>
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="46">
<item index="0" class="java.lang.String" itemvalue="scikit-image" />
<item index="1" class="java.lang.String" itemvalue="scipy" />
<item index="2" class="java.lang.String" itemvalue="opencv-python" />
<item index="3" class="java.lang.String" itemvalue="torch" />
<item index="4" class="java.lang.String" itemvalue="torchvision" />
<item index="5" class="java.lang.String" itemvalue="absl-py" />
<item index="6" class="java.lang.String" itemvalue="protobuf" />
<item index="7" class="java.lang.String" itemvalue="rsa" />
<item index="8" class="java.lang.String" itemvalue="tensorflow-estimator" />
<item index="9" class="java.lang.String" itemvalue="opt-einsum" />
<item index="10" class="java.lang.String" itemvalue="python-dateutil" />
<item index="11" class="java.lang.String" itemvalue="cycler" />
<item index="12" class="java.lang.String" itemvalue="gast" />
<item index="13" class="java.lang.String" itemvalue="numpy" />
<item index="14" class="java.lang.String" itemvalue="pyasn1" />
<item index="15" class="java.lang.String" itemvalue="requests" />
<item index="16" class="java.lang.String" itemvalue="importlib-metadata" />
<item index="17" class="java.lang.String" itemvalue="pyasn1-modules" />
<item index="18" class="java.lang.String" itemvalue="requests-oauthlib" />
<item index="19" class="java.lang.String" itemvalue="tensorflow" />
<item index="20" class="java.lang.String" itemvalue="tensorboard-plugin-wit" />
<item index="21" class="java.lang.String" itemvalue="zipp" />
<item index="22" class="java.lang.String" itemvalue="oauthlib" />
<item index="23" class="java.lang.String" itemvalue="astunparse" />
<item index="24" class="java.lang.String" itemvalue="urllib3" />
<item index="25" class="java.lang.String" itemvalue="pyparsing" />
<item index="26" class="java.lang.String" itemvalue="Cython" />
<item index="27" class="java.lang.String" itemvalue="Markdown" />
<item index="28" class="java.lang.String" itemvalue="google-auth-oauthlib" />
<item index="29" class="java.lang.String" itemvalue="Werkzeug" />
<item index="30" class="java.lang.String" itemvalue="kiwisolver" />
<item index="31" class="java.lang.String" itemvalue="tqdm" />
<item index="32" class="java.lang.String" itemvalue="yolov5processor" />
<item index="33" class="java.lang.String" itemvalue="tensorboard" />
<item index="34" class="java.lang.String" itemvalue="future" />
<item index="35" class="java.lang.String" itemvalue="matplotlib" />
<item index="36" class="java.lang.String" itemvalue="cachetools" />
<item index="37" class="java.lang.String" itemvalue="grpcio" />
<item index="38" class="java.lang.String" itemvalue="Keras" />
<item index="39" class="java.lang.String" itemvalue="google-auth" />
<item index="40" class="java.lang.String" itemvalue="idna" />
<item index="41" class="java.lang.String" itemvalue="Pillow" />
<item index="42" class="java.lang.String" itemvalue="cython" />
<item index="43" class="java.lang.String" itemvalue="keras" />
<item index="44" class="java.lang.String" itemvalue="imgaug" />
<item index="45" class="java.lang.String" itemvalue="opencv-contrib-python" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N806" />
<option value="N801" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="cv2.imresize" />
<option value="detectron2.model_zoo.get_config_file" />
<option value="detectron2.model_zoo.get_checkpoint_url" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (thermal-app-ui-services)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/KL-bot-services.iml" filepath="$PROJECT_DIR$/.idea/KL-bot-services.iml" />
</modules>
</component>
</project>
\ No newline at end of file
FROM python:3.6-stretch
RUN pip install flask requests flask-restplus
ADD . /opt/code
WORKDIR /opt/code
RUN pip install -r requirements.txt
RUN pip install --upgrade Werkzeug==0.16.1
RUN pip install jwcrypto
CMD python app.py
\ No newline at end of file
# from scripts.blueprints.invoice_configurations import invoices_blueprint
import os
# os.environ['config'] = '{"MONGO_URI": "mongodb://svc-ilens:svc2345@192.168.3.220:21017", "MONGO_DB":"ilens_wps", ' \
# '"MONGO_COLL": "serviceConfiguration", "EMAIL_ID": "dasharatha.vamshi@knowledgelens.com", ' \
# '"EMAIL_PASSWORD": "-"}'
from threading import Thread
from flask import Flask
from flask_cors import CORS
from flask_restplus import Api
from models.model import *
from scripts.blueprints.bot_configurations import klbot_blueprint, init_thread
from scripts.common.config import SERVICE_HOST
from scripts.common.logsetup import logger
app = Flask(__name__)
api = Api(app, title=app_constants.SwaggerClass.title)
api.add_namespace(klbot_namespace)
app.register_blueprint(klbot_blueprint)
# api.add_namespace(invoice_namespace)
# app.register_blueprint(invoices_blueprint)
# app.register_blueprint(alarms_blueprint)
CORS(app, orgins="*", resources={r"/*": {"origins": "*"}}, allow_headers=[
"Content-Type", "Authorization", "Access-Control-Allow-Credentials"],
supports_credentials=True, intercept_exceptions=False)
for rule in app.url_map.iter_rules():
logger.debug(rule)
# minio_obj = MinioClient('minioadmin', 'minioadmin', 'videobucket', '/home/svc-ilens/minio_files', '192.168.3.220:29000')
t = Thread(target=init_thread)
t.start()
app.run(host=SERVICE_HOST, port=2526, debug=False, threaded=True, use_reloader=False)
{
"registerId": "1",
"documentId":"1",
"modelDocumentId" : " ",
"scannedOn" : "2020-06-22T09:22:41Z",
"parsedData" : {
"totalPages" : "1",
"invoice number": {
"value" : "123123",
"page": "1"
},
"invoice date" : {
"value" : "2020-06-22T09:22:41Z",
"page": "1"
}
},
"azureData" : {
}
}
\ No newline at end of file
Data:
{
"register_id": "1",
"document_id":"1",
"modelId" : "210a73a6-16dc-4b39-8277-c372469d891d",
"scanned_on" : "2020-06-22T09:22:41Z",
"parsed_data" : {
"total_pages" : "1",
"invoice number": {
"value" : "123123",
"page": "1"
},
"invoice date" : {
"value" : "2020-06-22T09:22:41Z",
"page": "1"
}
},
"azure_data" : {
}
}
Models
{
"register_name" : "amazon",
"register_id" : "1",
"modelId": "210a73a6-16dc-4b39-8277-c372469d891d",
"createdDateTime": "2020-06-22T09:22:41Z",
"lastUpdatedDateTime": "2020-06-22T09:22:41Z",
"trained_documents" : "5",
"trained_labels":["invoice number","invoice date"]
}
\ No newline at end of file
{
"jobId": "",
"startedOn" : "",
"completedOn" : "",
"status" : ["completed/failed"],
"documentId" : ""
}
{
"documentId": "25308d2d",
"insertedOn": "Tue, 30 Jun 2020 15:20:35 GMT",
"jobId": "25308d2c",
"logisticsType": "outbound",
"registerId": "29af93d0",
"status": "Success",
"updatedOn": "Tue, 30 Jun 2020 15:20:58 GMT"
},
\ No newline at end of file
{
"modelDocumentId": "",
"modelId" : " ",
"createdDateTime" : " ",
"lastUpdatedDateTime" : " ",
"trainingDocuments" : "5",
"trainedlabels" : []
}
{
"createdDateTime": "Tue, 30 Jun 2020 06:19:19 GMT",
"lastUpdatedDateTime": "Tue, 30 Jun 2020 06:19:19 GMT",
"modelDocumentId": "a19c8a64",
"modelId": "c2c1a822-7083-455a-879d-c53aa9ff00c5",
"trainedDocuments": 5,
"trainedLabels": [
"Invoice Number",
"Invoice Due Date"
]
}
\ No newline at end of file
{
"registerName" : "amazon",
"registerId" : "1",
"modelDocumentId": "",
"createdDateTime": "2020-06-22T09:22:41Z",
"logistticsType" : "inbound/outbound"
}
{
"createdDateTime": "Tue, 30 Jun 2020 09:29:14 GMT",
"logistics": {
"inbound": {
"modelDocumentId": "a19c8a64"
},
"outbound": {
"modelDocumentId": "e37a3800"
}
},
"registerId": "29af93d0",
"registerName": "Microsoft"
}
\ No newline at end of file
[SERVICE]
HOST=0.0.0.0
PORT=2324
[ATTENDANCE MONGO]
HOST = 192.168.3.220
PORT = 21017
AUTH = true
USERNAME= admin
PASSWORD= password123
DATABASE= ilens_wps
INVOICE_COLLECTION = invoices_list
REGISTER_COLLECTION = register_list
JOB_COLLECTION = kl_bot_jobs
MODEL_COLLECTION = model_list
BOT_COLLECTION = kl_bot
#LOCAL_DATA_PATH = .
\ No newline at end of file
Register,RegisterType,File Name,From,Invoice Date,Invoice No,Motor Vehicle No,Quantity,Docket No
Nike,Docket,demo412.pdf,"PAGE INDUSTRIES LTD SY:49/1, 49/2, 50,51/1, 51/2, 51/3, 51/4, 51/5,, THATTANAHALLI VILLAGE, BYAGADENHALLI, GRAMAPANCHYA KASABA HOBLI ANEKAL ATTIBELE ROAD, ANEKAL TALUKA, BANGALORE-562107, KA",,,,,133089401
Nike,Docket,newdemo.pdf,"PAGE INDUSTRIES LTD SY:49/1, 49/2, 50,51/1, 51/2, 51/3, 51/4, 51/5,, THATTANAHALLI VILLAGE, BYAGADENHALLI, GRAMAPANCHYA KASABA HOBLI ANEKAL ATTIBELE ROAD, ANEKAL TALUKA, BANGALORE-562107,KA",,,,,133089401
{
"sample": "json"
}
\ No newline at end of file
7689302,6/29/2016,Jul 01 2020 16:05:44,8e9a1a81,04c84bf0,e37a3800,Outbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016
,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
7689302,6/29/2016,Jul 01 2020 16:05:44,8e9a1a81,04c84bf0,e37a3800,Outbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 01 2020 16:18:54,6fbe223e,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:57:22,0aada825,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf,7689302,6/29/2016,Jul 02 2020 11:59:29,51f29440,04c84bf0,a19c8a64,Inbound,test_11.pdf,test_11.pdf
7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 12:27:43,3b545075,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:18:15,5bb56cce,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:21:05,c2370843,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:30:05,f8eb6812,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf
,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:38:56,3694a0a9,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,,,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016,Jul 02 2020 13:46:56,58e961a7,04c84bf0,a19c8a64,Inbound,test_10.pdf,test_10.pdf,7689302,6/29/2016
,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,,,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016,Jul 02 2020 14:01:36,6211087a,04c84bf0,e37a3800,Outbound,android_test.pdf,android_test.pdf,7689302,6/29/2016
,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:46:40,af3f9de2,04c84bf0,a19c8a64,Inbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,,,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016,Jul 02 2020 14:47:32,d27707a8,04c84bf0,e37a3800,Outbound,filetest.pdf,filetest.pdf,7689302,6/29/2016
[CLIENT-CONFIG]
publishers = MQTT:PUB_MQTT,VIDEOWRITE:PUB_VIDWRITE,MONGO:MONGO_WRITE
deviceid = $$$MQTT_TOPIC$$$
[STREAM-CONFIG]
stream-type=rtsp
width =$$$FRAME_WIDTH$$$
height=$$$FRAME_HEIGHT$$$
latency=
framerate =$$$FRAME_RATE$$$
fformat =
use-gstreamer=0
custom-pipeline=
uri =$$$RTSP_URL$$$
[PUB_MQTT]
broker = $$$MQTT_HOST$$$
port= $$$MQTT_PORT$$$
topic=$$$MQTT_TOPIC$$$
clientid=$$$MQTT_TOPIC$$$
[MYSQL]
host= 192.168.2.17
port= 3306
username= root
password= root
database= attendance
[FAISS]
HOST = 192.168.2.17
PORT = 2323
FAISS_SEARCH_EP = /faiss/search-array
FAISS_INSERT_EP = /faiss/insert
[MONGO]
HOST=192.168.0.211
PORT=27017
AUTH=False
USERNAME=admin
PASSWORD=admin
DATABASE=faiss_test
COLLECTION=vectors_bosch_dev
[EVENTS MONGO]
HOST=192.168.0.211
PORT=27017
DATABASE=bosch_dev
EVENT_COLLECTION=event_details
VIDEO_COLLECTION=video_recordings_details
[ILENS MONGO]
HOST = beta.ilens.io
PORT = 2717
DATABASE= ilens_metadata
RULES_COLLECTION = rules
[ILENS DEVICE]
DEVICE = virtual_device_567
TAG = tag_5761
[PUB_VIDWRITE]
basepath = ./base_vid_dir
format=mp4
filenameFormat = {EmpName}_{timestamp}
This source diff could not be displayed because it is too large. You can view the blob instead.
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras/add
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /_status
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /events
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /rules
2020-04-23 16:58:00,334 INFO smartvision [MainThread:app.py:list_routes():29] --- /
2020-04-23 16:58:00,335 INFO smartvision [MainThread:app.py:list_routes():29] --- /static/<path:filename>
2020-04-23 16:58:00,862 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras/add
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /cameras
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /_status
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /events
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /rules
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /
2020-04-23 16:58:00,864 INFO smartvision [MainThread:app.py:list_routes():29] --- /static/<path:filename>
2020-04-23 16:58:29,468 INFO smartvision [Thread-2:app.py:status_():23] /_status/success
2020-04-23 16:58:59,235 INFO smartvision [Thread-6:app.py:status_():23] /_status/success
2020-04-23 16:59:05,406 INFO smartvision [Thread-7:app.py:status_():23] /_status/success
2020-04-23 16:59:06,247 INFO smartvision [Thread-8:app.py:status_():23] /_status/success
from scripts.constants import app_constants
from flask_restplus import fields, Namespace
#
klbot_namespace = Namespace("KL Bot Module", path=app_constants.APIEndPoints.base_url)
insert_to_mongo = klbot_namespace.model("insert_to_mongo", {
'name': fields.String(required=False),
'email': fields.String(required=False),
'phoneNumber': fields.String(required=False),
'company': fields.String(required=False),
'query': fields.String(required=False),
'request': fields.String(required=False),
'product': fields.String(required=False),
})
# invoice_namespace = Namespace("Invoice Module", path=app_constants.APIEndPoints.base_url)
# get_invoice_result = invoice_namespace.model("get_invoice_result", {
# 'documentId': fields.String(required=True)
# })
#
# # retry_invoice = invoice_namespace.model("get_invoice_result", {
# # 'documentId': fields.String(required=True)
# # })
#
# register_details = invoice_namespace.model("register_details", {
# 'registerId': fields.String(required=True)
# })
#
# download_report = invoice_namespace.model("download_report", {
# 'fromDate': fields.Date(required=True),
# 'toDate': fields.Date(required=True),
# 'toEmail': fields.String(required=True),
# 'registerIdList': fields.List(fields.String(required=True))
# })
#
# get_job_status = invoice_namespace.model("get_job_status", {
# 'jobId': fields.List(fields.String(required=True))
# })
# invoices_for_register = invoice_namespace.model("invoices_for_register", {
# 'registerId': fields.String(required=True)
# })
# create_register = invoice_namespace.model("create_register", {
# "registerName": fields.String(required=True),
# "inboundModelId": fields.String(required=True),
# "outboundModelId": fields.String(required=True),
# })
#
# create_model = invoice_namespace.model("create_model", {
#
# "modelId": fields.String(required=True),
# "trainedDocuments": fields.Integer(required=True),
# "trainedLabels": fields.List(fields.String(required=True))
#
# })
# site_namespace = Namespace("Site Module", path=app_constants.APIEndPoints.base_url)
# service_namespace = Namespace("Service Module", path=app_constants.APIEndPoints.base_url)
# event_namespace = Namespace("Event Module", path=app_constants.APIEndPoints.base_url)
# user_namespace = Namespace("User Module", path=app_constants.APIEndPoints.base_url)
# alarm_namespace = Namespace("Alarm Module", path=app_constants.APIEndPoints.base_url)
#
# # alarm--------
#
# create_alarm_configuration = alarm_namespace.model("create_alarm_configuration", {
# 'id': fields.String(required=True),
#
# })
# #done
# get_alarm_configuration = alarm_namespace.model("get_alarm_configuration", {
#
# 'id': fields.String(required=True)
# })
# # done
# get_alarm_list = alarm_namespace.model("get_alarm_list", {
#
# })
#
# delete_alarm_configuration = alarm_namespace.model("delete_alarm_configuration", {
# 'id': fields.String(required=True)
# })
# # end
# # user-----------
# add_users = user_namespace.model("add_users", {
# 'emp_id': fields.String(required=True),
# 'emp_name': fields.String(required=True),
# 'emp_desg': fields.String(required=True),
# 'emp_loc': fields.String(required=True),
# 'emp_site': fields.String(required=True)
# })
#
# find_user = user_namespace.model("find_user", {
# 'emp_id': fields.String(required=True),
# })
#
# update_users = user_namespace.model("update_users", {
# 'emp_id': fields.String(required=True),
# 'emp_name': fields.String(required=True),
# 'emp_desg': fields.String(required=True),
# 'emp_loc': fields.String(required=True),
# 'emp_site': fields.String(required=True)
# })
#
# delete_users = user_namespace.model("delete_users", {
# 'emp_id': fields.String(required=True),
# })
# # test it
# record_stream = user_namespace.model("record_stream", {
# 'emp_id': fields.String(required=True),
# 'mqtt_topic': fields.String(required=True),
# 'action': fields.String(required=True)
#
# })
# # test it
# get_users_image = user_namespace.model("get_users_image", {
# 'emp_id': fields.String(required=True),
#
# })
# # test it
# get_images = user_namespace.model("get_images", {
# 'emp_id': fields.String(required=True),
# 'n': fields.String(required=True)
# })
# # test it
# train_user = user_namespace.model("train_user", {
# 'emp_id': fields.String(required=True),
# })
#
# # end user--------------
# # event------
# query_events = event_namespace.model("query_events", {
#
# 'from_date': fields.String(required=True),
# 'to_date': fields.String(required=True),
# 'page': fields.Integer(required=True),
# 'eventNumber': fields.Integer(required=True)
#
# })
# download_report = event_namespace.model("download_report", {
#
# 'from_date': fields.String(required=True),
# 'to_date': fields.String(required=True)
#
# })
# last_n_events = event_namespace.model("last_n_events", {
#
# 'page': fields.Integer(required=True),
# 'eventNumber': fields.Integer(required=True)
#
# })
# find_filter = event_namespace.model("find_filter", {
# 'eventtype': fields.String(required=True),
# 'page': fields.Integer(required=True),
# 'eventNumber': fields.Integer(required=True)
#
# })
#
# # end event-----
#
# # site--------------
#
# # end site----------------
#
# # service-----
#
# # end services--
#
# # Camera-------------------------------------------------------------------------
#
# add_camera = camera_namespace.model("add_camera", {
#
# 'disable': fields.String(required=True),
# 'cameraName': fields.String(required=True),
# 'cameraMake': fields.String(required=True),
# 'cameraModelNumber': fields.String(required=True),
# 'siteName': fields.String(required=True),
# 'subSiteName': fields.String(required=True),
# 'cameraRTSPUrl': fields.String(required=True),
# 'frameRate': fields.String(required=True),
# 'description': fields.String(required=True),
# 'width': fields.Integer(required=True),
# 'height': fields.Integer(required=True),
# 'ilens_device_id': fields.String(required=True),
# 'physical_device_group_id': fields.String(required=True),
# 'model_id': fields.String(required=True)
#
# })
#
# delete_camera = camera_namespace.model("delete_camera", {
#
# 'cameraId': fields.String(required=True)
#
# })
#
# update_camera = camera_namespace.model("update_camera", {
# 'cameraId': fields.String(required=True),
# 'disable': fields.String(required=True),
# 'cameraName': fields.String(required=True),
# 'cameraMake': fields.String(required=True),
# 'cameraModelNumber': fields.String(required=True),
# 'siteName': fields.String(required=True),
# 'subSiteName': fields.String(required=True),
# 'cameraRTSPUrl': fields.String(required=True),
# 'frameRate': fields.String(required=True),
# 'description': fields.String(required=True),
# 'width': fields.Integer(required=True),
# 'height': fields.Integer(required=True),
# 'ilens_device_id': fields.String(required=True),
# 'physical_device_group_id': fields.String(required=True),
# 'model_id': fields.String(required=True)
#
# })
#
# find_camera = camera_namespace.model("find_camera", {
#
# 'deviceList': fields.List(fields.String(required=True))
#
# })
#
# # End Camera-------------------------------------------------------------------------
flask_cors
pyjwt
paho-mqtt
python-dateutil
python_logstash_async
pymongo
pandas
opencv-python
requests
minio
pdfkit
\ No newline at end of file
import queue
import smtplib
import ssl
import traceback
import uuid
from datetime import datetime
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from threading import Thread
from flask import request, Blueprint, jsonify
from flask_restplus import Resource, Api
from models.model import *
# from scripts.common.config import ATTENDANCE_MONGO_HOST, ATTENDANCE_MONGO_PORT, ATTENDANCE_MONGO_DATABASE, \
# ATTENDANCE_MONGO_AUTH, ATTENDANCE_MONGO_USERNAME, ATTENDANCE_MONGO_PASSWORD, \
from scripts.common.config import KL_BOT_MONGO_COLLECTION, KL_BOT_JOB_COLLECTION, EMAIL_ID, \
EMAIL_PASSWORD, MONGO_URI, MONGO_SERVICE_DB, mongo_host, mongo_port
from scripts.common.logsetup import logger
from scripts.constants.app_constants import APIEndPoints, RequestMethods
klbot_blueprint = Blueprint('klbot_services', __name__)
api = Api(klbot_blueprint)
api.add_namespace(klbot_namespace)
from scripts.utils import mongo_utility
print(mongo_port,mongo_host)
my_obj = mongo_utility.MongoUtility(mongo_host, mongo_port)
# klbot_collection = MONGO_DB_OBJ[KL_BOT_MONGO_COLLECTION]
# job_collection = MONGO_DB_OBJ[KL_BOT_JOB_COLLECTION]
q = queue.Queue()
retry_queue = queue.Queue()
def insert_job(job):
jobValue = {
"insertedOn": datetime.now(),
"updatedOn": datetime.now(),
"status": "Queued"
}
jobValue.update(job)
logger.info("job inserted")
# job_collection.insert(jobValue)
my_obj.insert_one(jobValue, MONGO_SERVICE_DB, KL_BOT_JOB_COLLECTION)
return "job inserted"
def update_job(job, status):
myQuery = {'jobId': job["jobId"]}
jobValue = {
"jobId": job["jobId"],
"updatedOn": datetime.now(),
"status": status,
}
logger.info("job updated")
# job_collection.update_one(myQuery, {"$set": jobValue})
my_obj.update_one(myQuery, jobValue, MONGO_SERVICE_DB, KL_BOT_JOB_COLLECTION)
return "job updated inserted"
def add_to_queue(user_details):
job = {
"jobId": str(uuid.uuid1()).split('-')[0]
}
job.update(user_details)
q.put(job)
logger.info("job added to queue")
x = insert_job(job)
return job
def my_process():
while True:
try:
item = q.get()
if item is None:
continue
update_job(item, "Inprogress")
my_dict = {}
stringval = ""
for key, value in item.items():
if value is not None and key != "jobId" and key != "clinetId":
stringval = stringval + str(key).capitalize() + " : " + value + " , "
mail_dict = {'subject': item['request'], 'body': stringval[0:len(stringval) - 2]}
print(mail_dict)
t = send_email(mail_dict)
if t:
update_job(item, "Completed")
item["sentmail"] = True
# klbot_collection.insert(item)
my_obj.insert_one(item, MONGO_SERVICE_DB, KL_BOT_MONGO_COLLECTION)
else:
update_job(item, "Failed")
item["sentmail"] = False
# klbot_collection.insert(item)
my_obj.insert_one(item, MONGO_SERVICE_DB, KL_BOT_MONGO_COLLECTION)
except:
pass
def send_email(content, attach=False):
from_address = EMAIL_ID
to_address = ["sales@knowledgelens.com", "sneha@knowledgelens.com", "dasharatha.vamshi@knowledgelens.com"]
# to_address = ["dasharatha.vamshi@knowledgelens.com"]
msg = MIMEMultipart()
msg['From'] = from_address
msg['To'] = " ,".join(to_address)
filename = ""
smtp_server = "smtp.gmail.com"
username = EMAIL_ID
password = EMAIL_PASSWORD
smtp_server_port = 587
ssl_key = False
try:
msg['Subject'] = "KL Bot: " + content['subject']
msg['body'] = content['body']
msg.attach(MIMEText(msg['body'], 'plain'))
# give filename in self.filename to attach a document.
if attach:
attachment = open(filename, "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
msg.attach(p)
# starting the sever
if ssl_key:
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, smtp_server_port, context=context) as server:
server.login(username, password)
server.sendmail(from_address, to_address, msg.as_string())
else:
s = smtplib.SMTP(smtp_server, smtp_server_port)
s.starttls()
s.login(username, password)
s.sendmail(from_address, to_address, msg.as_string())
s.quit()
return True
except Exception as e:
print(e)
return False
@klbot_namespace.route(APIEndPoints.insert_to_mongo)
class insert_to_mongo(Resource):
@api.expect(insert_to_mongo)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
userID = str(uuid.uuid1()).split('-')[0]
user_details = {
"clinetId": userID,
"request": content.get("request", None),
"name": content.get("name", None),
"email": content.get("email", None),
"phoneNumber": content.get("phoneNumber", None),
"company": content.get("company", None),
"query": content.get("query", None),
"product": content.get("product", None),
}
# klbot_collection.insert(user_details)
job = add_to_queue(user_details)
# t = Thread(target=my_process)
# t.start()
return jsonify(
{"status": True, "message": "Client registered successfully", "job": job["jobId"]})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
def init_thread():
t = Thread(target=my_process)
t.start()
import datetime
import logging
import os
import traceback
import uuid
import requests
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import pymongo
import yagmail
import img2pdf
from PIL import Image
from flask import Flask, request, redirect, url_for, flash, render_template, send_from_directory
from flask import request, Blueprint, jsonify
from pymongo import MongoClient, DESCENDING
from scripts.common.config import ATTENDANCE_MONGO_HOST, ATTENDANCE_MONGO_PORT, ATTENDANCE_MONGO_DATABASE, \
ATTENDANCE_MONGO_INVOICES_COLLECTION, ATTENDANCE_MONGO_AUTH, ATTENDANCE_MONGO_USERNAME, ATTENDANCE_MONGO_PASSWORD, \
ATTENDANCE_MONGO_REGISTER_COLLECTION, ATTENDANCE_MONGO_JOB_COLLECTION, ATTENDANCE_MONGO_MODEL_COLLECTION
from scripts.handlers.test_invoices import test_invoices
from scripts.common.logsetup import logger
from flask_restplus import Resource, Api, reqparse
from scripts.constants.app_constants import APIEndPoints, RequestMethods
from models.model import *
from werkzeug.utils import secure_filename
from werkzeug.datastructures import FileStorage
import queue
from threading import Thread
from csv import DictWriter, writer
import csv
q = queue.Queue()
retry_queue = queue.Queue()
invoices_blueprint = Blueprint('invoices_services', __name__)
api = Api(invoices_blueprint)
api.add_namespace(invoice_namespace)
if ATTENDANCE_MONGO_AUTH.lower() == 'false:':
attendance_mongo = MongoClient(ATTENDANCE_MONGO_HOST, int(ATTENDANCE_MONGO_PORT))
else:
attendance_mongo = MongoClient(host=ATTENDANCE_MONGO_HOST, port=int(ATTENDANCE_MONGO_PORT),
username=ATTENDANCE_MONGO_USERNAME, password=ATTENDANCE_MONGO_PASSWORD)
attendance_database = attendance_mongo[ATTENDANCE_MONGO_DATABASE]
invoice_collection = attendance_database[ATTENDANCE_MONGO_INVOICES_COLLECTION]
register_collection = attendance_database[ATTENDANCE_MONGO_REGISTER_COLLECTION]
job_collection = attendance_database[ATTENDANCE_MONGO_JOB_COLLECTION]
model_collection = attendance_database[ATTENDANCE_MONGO_MODEL_COLLECTION]
ALLOWED_EXTENSIONS = set(['pdf', 'png', 'jpeg', 'jpg'])
UPLOAD_FOLDER = "data"
file_upload = Namespace(name="files")
upload_parser = reqparse.RequestParser(bundle_errors=True)
upload_parser.add_argument(
name="file",
type=FileStorage,
location="files", required=True
# action="append" # If this is removed it works with 1 file
)
upload_parser.add_argument(
name="registerId",
location='form', type='string', required=True
)
upload_parser.add_argument(
name="logisticsType",
location='form', type='string', required=True
)
retry_parser = reqparse.RequestParser(bundle_errors=True)
retry_parser.add_argument(
name="file",
type=FileStorage,
location="files", required=True
# action="append" # If this is removed it works with 1 file
)
retry_parser.add_argument(
name="documentId",
location='form', type='string', required=True
)
retry_parser.add_argument(
name="registerId",
location='form', type='string', required=True
)
retry_parser.add_argument(
name="logisticsType",
location='form', type='string', required=True
)
def append_dict_as_row(file_name, dict_of_elem, field_names):
# Open file in append mode
with open(file_name, 'a+', newline='') as write_obj:
# Create a writer object from csv module
dict_writer = DictWriter(write_obj, fieldnames=field_names)
# Add dictionary as wor in the csv
print(dict_writer)
dict_writer.writerow(dict_of_elem)
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
def insert_job(job):
jobValue = {
"jobId": job["jobId"],
"insertedOn": datetime.datetime.now(),
"updatedOn": datetime.datetime.now(),
"status": "Queued",
"documentId": job["documentId"],
"registerId": job["registerId"],
"logisticsType": job['logisticsType'],
"path": job['fileName'],
"fileName": job['fileName'],
"actualfile": job["actualfile"]
}
logger.info("job inserted")
job_collection.insert(jobValue)
return "job inserted"
def update_job(job, status):
myQuery = {'jobId': job["jobId"]}
jobValue = {
"jobId": job["jobId"],
"updatedOn": datetime.datetime.now(),
"status": status,
}
logger.info("job updated")
job_collection.update_one(myQuery, {"$set": jobValue})
return "job updated inserted"
def add_to_queue(filename, registerId, logisticsType, actualfile, documentId):
if len(documentId) == 0:
job = {
"jobId": str(uuid.uuid1()).split('-')[0],
"documentId": str(uuid.uuid1()).split('-')[0],
"path": os.path.join(UPLOAD_FOLDER, actualfile),
"fileName": filename,
"registerId": registerId,
"logisticsType": logisticsType,
"actualfile": actualfile
}
q.put(job)
else:
job = {
"jobId": str(uuid.uuid1()).split('-')[0],
"documentId": documentId,
"path": os.path.join(UPLOAD_FOLDER, actualfile),
"fileName": filename,
"registerId": registerId,
"logisticsType": logisticsType,
"actualfile": actualfile
}
q.put(job)
logger.info("job added to queue")
x = insert_job(job)
# print(x)
# print(q.unfinished_tasks)
# print(q.qsize())
# for n in list(q.queue):
# print(n, end="\n")
return job
def analyze_invoice():
while True:
try:
item = q.get()
if item is None:
continue
try:
update_job(item, "Inprogress")
check_failed = invoice_collection.find_one({'documentId': item['documentId']}, {'_id': 0})
# for task in check_failed:
# print(task)
print(check_failed)
data = register_collection.find_one({'registerId': item['registerId']}, {'_id': 0})
for i in range(len(data['logistics'])):
if data['logistics'][i]['logisticsType'] == item['logisticsType']:
labels = model_collection.find_one(
{'modelDocumentId': data['logistics'][i]['modelDocumentId']}, {'_id': 0})
if check_failed is None:
invoice_details1 = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Inprogress",
'analyzedResult': {}
}
invoice_collection.insert(invoice_details1)
print(data)
print(labels)
else:
myQuery = {'documentId': item['documentId']}
invoice_details1 = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Inprogress",
'analyzedResult': {}
}
invoice_collection.update_one(myQuery, {"$set": invoice_details1})
print(data)
print(labels)
try:
Result = test_invoices(item, labels)
except Exception as e:
print(e)
Result = 'Failed'
print("++dddddddddddddddd++", Result)
if Result == 'Failed':
update_job(item, "Failed")
invoice_details = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Failed",
'analyzedResult': {}
}
invoice_collection.update_one({'documentId': item['documentId']}, {"$set": invoice_details})
else:
update_job(item, "Success")
invoice_details = {
'insertedOn': datetime.datetime.now(),
'documentId': item['documentId'],
'registerId': data['registerId'],
'modelDocumentId': labels['modelDocumentId'],
'logisticsType': item['logisticsType'],
'path': item['fileName'],
'fileName': item['fileName'],
'status': "Success",
'analyzedResult': {}
}
invoice_details['analyzedResult'].update(Result)
invoice_collection.update_one({'documentId': item['documentId']}, {"$set": invoice_details})
logger.info("invoice results inserted into mongo")
# invoice_collection.insert(invoice_details)
except Exception as e:
update_job(item, "Failed")
finally:
q.task_done()
except queue.Empty:
pass
except:
logging.exception('error while processing item')
@invoice_namespace.route('/<path:filename>')
class get_file(Resource):
def get(self, filename):
return send_from_directory(UPLOAD_FOLDER,
filename)
@invoice_namespace.route(APIEndPoints.get_invoices)
class get_invoices(Resource):
def get(self):
try:
if request.method == RequestMethods.GET:
all_invoices = invoice_collection.find({}, {"_id": 0}).sort('insertedOn', pymongo.DESCENDING)
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_invoices:
# print(task)
task['insertedOn'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@api.expect(upload_parser)
def post(self):
try:
if request.method == RequestMethods.POST:
# content = request.get_json()
# print(UPLOAD_FOLDER)
# print(request.files)
imd = request.files
registerId = request.form.get('registerId')
logisticsType = request.form.get('logisticsType')
print(registerId, logisticsType)
finaldict = imd.to_dict(flat=False)
# print(finaldict)
x = finaldict['file']
print(x)
if 'file' not in request.files:
# flash('No file part')
return jsonify({"status": "No file"})
file = request.files['file']
for file in x:
print(file)
print(file.filename)
if file.filename == '':
flash('No selected file')
return redirect(request.url)
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
x = filename.split('.')
print(x[0])
file.save(os.path.join(UPLOAD_FOLDER, filename))
finalpdfname = x[0] + '.pdf'
img_path = os.path.join(UPLOAD_FOLDER, filename)
pdf_path = os.path.join(UPLOAD_FOLDER, finalpdfname)
image = Image.open(img_path)
pdf_bytes = img2pdf.convert(image.filename)
file = open(pdf_path, "wb")
file.write(pdf_bytes)
image.close()
file.close()
#
#
# image1 = Image.open(os.path.join(UPLOAD_FOLDER, filename))
# im1 = image1.convert('RGB')
# finalpdfname = x[0] + '.pdf'
# im1.save(os.path.join(UPLOAD_FOLDER, finalpdfname))
else:
return jsonify({"status": "Not supported file format"})
documentId = ''
job = add_to_queue(finalpdfname, registerId, logisticsType, filename, documentId)
print(job)
# download_file(os.path.join(UPLOAD_FOLDER, filename))
logger.info("job added")
t = Thread(target=analyze_invoice)
t.start()
return jsonify({"status": True, "message": "Upload successful", "jobId": job["jobId"]})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.create_register)
class create_register(Resource):
@api.expect(create_register)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
print(content)
labelList = []
registerId = str(uuid.uuid1()).split('-')[0]
register_details = {
"registerName": content['registerName'],
"registerId": registerId,
"registerIconUrl": "",
"lastUpdatedTime": datetime.datetime.utcnow(),
"logistics": [
{"logisticsType": "Inbound",
"modelDocumentId": content['inboundModelId']
},
{
"modelDocumentId": content['outboundModelId'],
"logisticsType": "Outbound"
}
]
# {
# "inbound": {
# "modelDocumentId": content['inboundModelId']
# },
# "outbound": {
# "modelDocumentId": content['outboundModelId']
# }
# }
}
register_collection.insert(register_details)
return jsonify({"status": True, "message": "Register inserted successfully", "registerId": registerId})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.retry_invoice)
class retry_invoice(Resource):
@api.expect(retry_parser)
def post(self):
try:
if request.method == RequestMethods.POST:
# content = request.get_json()
# documentId = request.form.get('documentId')
imd = request.files
documentId = request.form.get('documentId')
registerId = request.form.get('registerId')
logisticsType = request.form.get('logisticsType')
finaldict = imd.to_dict(flat=False)
# print(finaldict)
x = finaldict['file']
job_results = job_collection.find({'documentId': documentId}, {"_id": 0})
print(x)
if 'file' not in request.files:
# flash('No file part')
return jsonify({"status": "No file"})
file = request.files['file']
for file in x:
print(file)
print(file.filename)
if file.filename == '':
flash('No selected file')
return redirect(request.url)
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
x = filename.split('.')
print(x[0])
file.save(os.path.join(UPLOAD_FOLDER, filename))
finalpdfname = x[0] + '.pdf'
img_path = os.path.join(UPLOAD_FOLDER, filename)
pdf_path = os.path.join(UPLOAD_FOLDER, finalpdfname)
image = Image.open(img_path)
pdf_bytes = img2pdf.convert(image.filename)
file = open(pdf_path, "wb")
file.write(pdf_bytes)
image.close()
file.close()
#
#
# image1 = Image.open(os.path.join(UPLOAD_FOLDER, filename))
# im1 = image1.convert('RGB')
# finalpdfname = x[0] + '.pdf'
# im1.save(os.path.join(UPLOAD_FOLDER, finalpdfname))
else:
return jsonify({"status": "Not supported file format"})
job = add_to_queue(finalpdfname, registerId, logisticsType, filename, documentId)
# print(job)
# download_file(os.path.join(UPLOAD_FOLDER, filename))
logger.info("job added")
t = Thread(target=analyze_invoice)
t.start()
return jsonify({"status": True, "message": "Upload successful", "jobId": job["jobId"]})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.list_register)
class list_register(Resource):
def get(self):
try:
if request.method == RequestMethods.GET:
all_registers = register_collection.find({}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_registers:
# print(task)
task['lastUpdatedTime'] = task['lastUpdatedTime'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.create_model)
class create_model(Resource):
@api.expect(create_model)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
modelDocumentId = str(uuid.uuid1()).split('-')[0]
# print(content)
labelList = []
model_details = {
"modelDocumentId": modelDocumentId,
"modelId": content['modelId'],
"createdDateTime": datetime.datetime.utcnow(),
"lastUpdatedDateTime": datetime.datetime.utcnow(),
"trainedDocuments": int(content['trainedDocuments']),
"trainedLabels": content['trainedLabels']
}
model_collection.insert(model_details)
return jsonify(
{"status": True, "message": "Model registered successfully", "modelDocumentId": modelDocumentId})
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.list_model)
class list_model(Resource):
def get(self):
try:
if request.method == RequestMethods.GET:
all_models = model_collection.find({}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_models:
# print(task)
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.get_job_status)
class get_job_status(Resource):
@api.expect(get_job_status)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
# all_jobs = job_collection.find({'jobId': content['jobId']}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for i in content['jobId']:
all_jobs = job_collection.find({'jobId': i}, {"_id": 0})
for task in all_jobs:
# print(task)
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
def get(self):
try:
if request.method == RequestMethods.GET:
all_jobs = job_collection.find({}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_jobs:
# print(task)
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.invoices_for_register)
class invoices_for_register(Resource):
@api.expect(invoices_for_register)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
all_invoices = invoice_collection.find({'registerId': content['registerId']}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_invoices:
# print(task)
task['timestamp'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.searchOn)
@api.doc(params={'label': 'label', 'value': 'value'})
class searchOn(Resource):
def get(self):
if request.method == 'GET':
try:
label = request.args.get('label', "")
value = request.args.get('value', "")
# registerId = request.args.get('registerId', "")
search_list = invoice_collection.find({}, {'_id': 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in search_list:
# print(task['analyzedResult'][str(label)])
# print(len(task['analyzedResult']))
for key in task['analyzedResult']:
if key == str(label):
if task['analyzedResult'][key] == str(value):
task['timestamp'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.info(e)
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.get_invoice_result)
class get_invoice_result(Resource):
@api.expect(get_invoice_result)
def post(self):
try:
if request.method == RequestMethods.POST:
content = request.get_json()
all_results = invoice_collection.find({'documentId': content['documentId']}, {"_id": 0})
data = {
"status": True,
"message": "success",
"data": [
]
}
for task in all_results:
# print(task)
task['insertedOn'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
data['data'].append(task)
return jsonify(data)
except Exception as e:
logger.error(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.download_report)
class download_report(Resource):
@api.expect(download_report)
def post(self):
try:
if request.method == RequestMethods.POST:
try:
content = request.get_json()
file = open("data/report.csv", "w")
file.close()
field_names = ['analyzedResult', 'insertedOn', 'documentId', 'registerId',
'modelDocumentId', 'logisticsType', 'path', 'fileName']
field_names1 = ['Register', 'RegisterType', 'File Name', 'From', 'Invoice Date', 'Invoice No',
'Motor Vehicle No', 'Quantity', 'Docket No']
with open("data/report.csv", 'a+', newline='') as file:
writer = csv.writer(file)
writer.writerow(field_names1)
data = {
"status": True,
"message": "success",
"data": [
]
}
register = ""
from_date = content.get('fromDate', str(datetime.datetime.now().date().isoformat()))
to_date = content.get('toDate', str(datetime.datetime.now().date().isoformat()))
from_date = datetime.datetime.strptime(from_date + "T00:00:00.100Z", '%d/%m/%YT%H:%M:%S.%fZ')
to_date = datetime.datetime.strptime(to_date + "T23:59:59.100Z", '%d/%m/%YT%H:%M:%S.%fZ')
# print(from_date.isoformat())
toEmail = content['toEmail']
registerIdList = content['registerIdList']
print(from_date, to_date, toEmail, registerIdList)
for i in registerIdList:
print(i)
total_invoices = invoice_collection.find(
{'registerId': i, "insertedOn": {"$gte": from_date, "$lt": to_date}},
{"_id": 0}).sort('insertedOn', pymongo.DESCENDING)
registernames = register_collection.find_one({'registerId': i}, {"_id": 0})
register = register + ' ' + registernames['registerName'] + ', '
for task in total_invoices:
# print(task)
task['insertedOn'] = task['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
for key in task['analyzedResult']:
sendjosn = {'Register': registernames['registerName'],
'RegisterType': task['logisticsType'], 'File Name': task['fileName'],
'From': "",
'Invoice Date': "", 'Invoice No': "",
'Motor Vehicle No': "",
'Quantity': "", 'Docket No': ""}
if len(task['analyzedResult']) == 2:
sendjosn['From'] = task['analyzedResult']['From']
sendjosn['Docket No'] = task['analyzedResult'][key]
else:
sendjosn['From'] = task['analyzedResult']['From']
sendjosn['Invoice Date'] = task['analyzedResult']['Invoice Date']
sendjosn['Invoice No'] = task['analyzedResult']['Invoice No']
sendjosn['Motor Vehicle No'] = task['analyzedResult']['Motor Vehicle No']
sendjosn['Quantity'] = task['analyzedResult']['Quantity']
# append_dict_as_row('data/report.csv', sendjosn, field_names1)
# append_dict_as_row('data/report.csv', task, field_names)
append_dict_as_row('data/report.csv', sendjosn, field_names1)
data['data'].append(task)
# pdf_file = generate_pdf_report(from_date, to_date, eventtype)
# return send_file(pdf_file,
# as_attachment=True)
# Python code to illustrate Sending mail with attachments
# from your Gmail account
# libraries to be imported
fromaddr = "dasharatha.vamshi@knowledgelens.com"
toaddr = toEmail
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "Report Generated"
body = "Please find the report generated for " + register + " between " + content[
'fromDate'] + " and " + content['toDate']
msg.attach(MIMEText(body, 'plain'))
filename = "report.csv"
attachment = open("data/report.csv", "rb")
p = MIMEBase('application', 'octet-stream')
p.set_payload((attachment).read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
msg.attach(p)
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login(fromaddr, "Salla$230999")
text = msg.as_string()
s.sendmail(fromaddr, toaddr, text)
s.quit()
# receiver = toEmail
# body = "Pls find attached document"
# filename = "data/report.csv"
#
# yag = yagmail.SMTP("dasharatha.vamshi@knowledgelens.com")
# yag.send(
# to=receiver,
# subject="Report Generated",
# contents=body,
# attachments=filename,
# )
print(len(data['data']))
send_mail = jsonify(data)
print(data)
return jsonify({'status': True, 'message': "Email Sent"})
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
@invoice_namespace.route(APIEndPoints.register_details)
class register_details(Resource):
@api.expect(register_details)
def post(self):
try:
if request.method == RequestMethods.POST:
try:
content = request.get_json()
data = {
"status": True,
"message": "success",
"data": [
]
}
all_register = register_collection.find({'registerId': content['registerId']}, {"_id": 0})
A = []
for task in all_register:
print(task)
for i in task['logistics']:
append = {"files": [], 'typeTitle': i['logisticsType'],
'lastUpdatedTime': task["lastUpdatedTime"].strftime("%d-%b-%Y %I:%M %p")}
all_invoices = invoice_collection.find(
{'registerId': content['registerId'], 'logisticsType': i['logisticsType']},
{"_id": 0}).sort('insertedOn', pymongo.DESCENDING)
for j in all_invoices:
j['insertedOn'] = j['insertedOn'].strftime("%d-%b-%Y %I:%M %p")
append['files'].append(j)
data['data'].append(append)
return jsonify(data)
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
except Exception as e:
logger.info(e)
traceback.print_exc()
return jsonify({'status': False, 'message': str(e)})
import base64
import configparser
import json
import jwt
import os
import sys
# import paho.mqtt.client as mqtt
from pymongo import MongoClient
from datetime import datetime
from dateutil import parser
from scripts.common.constants import LicenseModule
def licence_validator(payload):
try:
dt = parser.parse(payload['valid_till'])
now = datetime.now()
if now > dt:
sys.stdout.write("Licence Expired \n".format())
sys.stdout.flush()
return True
return True
except KeyError as err:
sys.stdout.write(err)
sys.stderr.write("Error loading licence")
return True
CONFIGURATION_FILE = os.environ.get("CONF_PATH", os.path.join(os.getcwd(), "conf{0}settings.conf".format(os.sep)))
sys.stdout.write("Reading Config from {} \n".format(CONFIGURATION_FILE))
sys.stdout.flush()
__config = configparser.ConfigParser()
__config.read(CONFIGURATION_FILE)
BASE_LOG_PATH = os.environ.get('BASE_LOG_PATH',
__config.get('LOGGER', 'basepath', fallback=os.path.join(os.getcwd(), "logs".format())))
if not os.path.isdir(BASE_LOG_PATH):
os.mkdir(BASE_LOG_PATH)
DATA_PATH = os.environ.get('BASE_DATA_PATH', __config.get('CLIENT-CONFIG', 'basepath', fallback=os.path.normpath(
os.getcwd() + '{}data'.format(os.sep))))
sys.stdout.write("Data base path {} \n".format(DATA_PATH))
LICENCE_FILE = os.environ.get("LICENCE_FILE", __config.get('CLIENT-CONFIG', 'licence-life', fallback="license.lic"))
LICENCE_FILE = os.path.join(DATA_PATH, LICENCE_FILE)
sys.stdout.write("Loading Licence {} \n".format(LICENCE_FILE))
try:
private_key = LicenseModule.private_key
encoding_algorithm = LicenseModule.encoding_algorithm
LICENCE_PAYLOAD = jwt.decode(bytes(base64.b64decode(open(LICENCE_FILE, 'rb').read())), private_key,
algorithms=[encoding_algorithm])
except Exception as e:
sys.stderr.write("{}".format(e))
sys.stderr.write(" **Error loading licence** \n")
LOG_LEVEL = os.environ.get("LOG_LEVEL", __config.get('LOGGER', 'loglevel', fallback="DEBUG")).upper()
LOGSTASH_HOST = os.environ.get("LOGSTASH_HOST", __config.get('LOGGER', 'loglevel', fallback=None))
LOGSTASH_PORT = os.environ.get("LOGSTASH_PORT", __config.get('LOGGER', 'loglevel', fallback=None))
LOG_HANDLER_NAME = os.environ.get("LOG_HANDLER_NAME", __config.get('LOGGER', 'loglevel', fallback="face-id"))
MAIN_OS_VARIABLE = json.loads(os.environ.get('config'))
if MAIN_OS_VARIABLE is None:
sys.stderr.write("Configuration not found...")
sys.stderr.write("Exiting....")
sys.exit(1)
MONGO_URI = MAIN_OS_VARIABLE.get('MONGO_URI')
MONGO_SERVICE_DB = MAIN_OS_VARIABLE.get('MONGO_DB')
# MONGO_SERVICE_COLL = MAIN_OS_VARIABLE.get('MONGO_COLL')
# PASS_KEY = MAIN_OS_VARIABLE.get('PASS_KEY')
EMAIL_ID = MAIN_OS_VARIABLE.get('EMAIL_ID')
EMAIL_PASSWORD = MAIN_OS_VARIABLE.get('EMAIL_PASSWORD')
x = MONGO_URI.split('@')
y = x[1].split(':')
mongo_host = x[0] + '@' + y[0]
mongo_port = y[1]
# ATTENDANCE_MONGO_HOST = __config.get('ATTENDANCE MONGO', 'HOST', fallback="0.0.0.0")
# ATTENDANCE_MONGO_PORT = int(__config.get('ATTENDANCE MONGO', 'PORT', fallback="27017"))
# ATTENDANCE_MONGO_DATABASE = __config.get('ATTENDANCE MONGO', 'DATABASE', fallback=" ")
ATTENDANCE_MONGO_AUTH = __config.get('ATTENDANCE MONGO', 'AUTH', fallback="false")
# ATTENDANCE_MONGO_USERNAME = __config.get('ATTENDANCE MONGO', 'USERNAME', fallback=" ")
# ATTENDANCE_MONGO_PASSWORD = __config.get('ATTENDANCE MONGO', 'PASSWORD', fallback=" ")
# MONGO_DB_OBJ = MongoClient(MONGO_URI)[MONGO_SERVICE_DB]
ATTENDANCE_MONGO_INVOICES_COLLECTION = __config.get('ATTENDANCE MONGO', 'INVOICE_COLLECTION', fallback=" ")
ATTENDANCE_MONGO_REGISTER_COLLECTION = __config.get('ATTENDANCE MONGO', 'REGISTER_COLLECTION', fallback=" ")
KL_BOT_JOB_COLLECTION = __config.get('ATTENDANCE MONGO', 'JOB_COLLECTION', fallback=" ")
ATTENDANCE_MONGO_MODEL_COLLECTION = __config.get('ATTENDANCE MONGO', 'MODEL_COLLECTION', fallback=" ")
KL_BOT_MONGO_COLLECTION = __config.get('ATTENDANCE MONGO', 'BOT_COLLECTION', fallback=" ")
SERVICE_HOST = __config.get('SERVICE', 'HOST', fallback="0.0.0.0")
SERVICE_PORT = int(__config.get('SERVICE', 'PORT', fallback="5000"))
class LicenseModule:
private_key = "3139343831323738414d47454e3936363538373136"
encoding_algorithm = "HS256"
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from scripts.common.config import LOG_LEVEL, LOGSTASH_HOST, LOGSTASH_PORT, LOG_HANDLER_NAME, BASE_LOG_PATH
import logging
from logstash_async.handler import AsynchronousLogstashHandler
from logging.handlers import RotatingFileHandler
from logging import WARNING,INFO,DEBUG,ERROR
import os
DEFAULT_FORMAT = '%(asctime)s %(levelname)5s %(name)s %(message)s'
DEBUG_FORMAT = '%(asctime)s %(levelname)5s %(name)s [%(threadName)5s:%(filename)5s:%(funcName)5s():%(lineno)s] %(message)s'
EXTRA = {}
FORMATTER = DEFAULT_FORMAT
if LOG_LEVEL.strip() == "DEBUG":
FORMATTER = DEBUG_FORMAT
def get_logger(log_handler_name, extra=EXTRA):
"""
Purpose : To create logger .
:param log_handler_name: Name of the log handler.
:param extra: extra args for the logger
:return: logger object.
"""
log_path = os.path.join(BASE_LOG_PATH, log_handler_name + ".log")
logstash_temp = os.path.join(BASE_LOG_PATH, log_handler_name + ".db")
logger = logging.getLogger(log_handler_name)
logger.setLevel(LOG_LEVEL.strip().upper())
log_handler = logging.StreamHandler()
log_handler.setLevel(LOG_LEVEL)
formatter = logging.Formatter(FORMATTER)
log_handler.setFormatter(formatter)
handler = RotatingFileHandler(log_path, maxBytes=10485760,
backupCount=5)
handler.setFormatter(formatter)
logger.addHandler(log_handler)
logger.addHandler(handler)
if LOGSTASH_PORT is not None and LOGSTASH_HOST is not None and LOGSTASH_PORT.isdigit():
logger.addHandler(AsynchronousLogstashHandler(LOGSTASH_HOST, int(LOGSTASH_PORT), database_path=logstash_temp))
logger = logging.LoggerAdapter(logger, extra)
return logger
logger = get_logger(LOG_HANDLER_NAME)
class APIEndPoints:
base_url = "/"
base_path = ""
# invoice
get_invoices = base_path + "/invoices"
get_all_jobs = base_path + "/jobs"
get_job_status = base_path + "/get_job_status"
list_register = base_path + '/list_register'
create_register = base_path + '/create_register'
list_model = base_path + '/list_model'
create_model = base_path + '/create_model'
invoices_for_register = base_path + '/invoices_for_register'
searchOn = base_path + '/searchOn'
get_invoice_result = base_path + '/get_invoice_result'
get_file = base_path + '/get_file/<path:filename>'
download_report = base_path + '/download_report'
register_details = base_path + '/register_details'
retry_invoice = base_path + '/retry_invoice'
insert_to_mongo = base_path + '/insert_into_mongo'
# camera
# list_cameras = base_path + "/cameras"
# delete_camera = base_path + "/cameras/delete"
# update_camera = base_path + "/cameras/update"
# find_camera = base_path + "/camera/findbyid"
# # sites
# get_sites = base_path + "/sites"
# get_cameras_per_site = base_path + "/sites/find"
#
# # service
# retrive_metadata = base_path + "/service_metadata"
# get_device_list = base_path + "/device/list"
# get_tags = base_path + "/tag"
# get_models = base_path + "/models"
# get_notifs = base_path + "/notification/list"
# get_devices = base_path + "/device"
# get_deployment_details = base_path + "/deployment"
#
# # events
# query_events = base_path + "/events"
# download_report = base_path + "/download_report"
# last_n_events = base_path + "/events/last_n"
# find_filter = base_path + "/events/filter"
# find_event_types = base_path + "/events/get_eventtypes"
#
# # users
#
# get_users = base_path + "/users" # get
# add_users = base_path + "/users/add"
# find_user = base_path + "/users/find"
# update_users = base_path + "/users/update"
# delete_users = base_path + "/users/delete"
# record_stream = base_path + "/users/record"
# get_users_image = base_path + "/users/upload"
# get_images = base_path + "/users/get_images"
# train_user = base_path + "/users/train"
#
# # alarm
# create_alarm_configuration = base_path + "/alarm_configuration/create"
# get_alarm_configuration = base_path + "/alarm_configuration/get"
# get_alarm_list = base_path + "/alarm_list/get"
# delete_alarm_configuration = base_path + "/alarm_configuration/delete"
class RequestMethods:
POST = "POST"
GET = "GET"
class SwaggerClass:
title = "KL BOT Services"
########### Python Form Recognizer Async Analyze #############
import json
import time
from requests import get, post
# Endpoint URL
def test_invoices(source, labels):
endpoint = r"https://form-recog1.cognitiveservices.azure.com/"
apim_key = "9747a2a5ce2f426793b3c05bc2b34c17"
# model_id = "c2c1a822-7083-455a-879d-c53aa9ff00c5"
model_id = labels['modelId']
print(model_id)
post_url = endpoint + "/formrecognizer/v2.0-preview/custom/models/%s/analyze" % model_id
print(source)
# source = r"Test/Invoice_6.pdf"
params = {
"includeTextDetails": True
}
headers = {
# Request headers
'Content-Type': 'application/pdf',
'Ocp-Apim-Subscription-Key': apim_key,
}
with open(source['path'], "rb") as f:
data_bytes = f.read()
try:
resp = post(url=post_url, data=data_bytes, headers=headers, params=params)
if resp.status_code != 202:
print("POST analyze failed:\n%s" % json.dumps(resp.json()))
quit()
print("POST analyze succeeded:\n%s" % resp.headers)
get_url = resp.headers["operation-location"]
except Exception as e:
print("POST analyze failed:\n%s" % str(e))
quit()
n_tries = 15
n_try = 0
wait_sec = 5
max_wait_sec = 60
while n_try < n_tries:
try:
resp = get(url=get_url, headers={"Ocp-Apim-Subscription-Key": apim_key})
resp_json = resp.json()
if resp.status_code != 200:
print("GET analyze results failed:\n%s" % json.dumps(resp_json))
return "Failed"
status = resp_json["status"]
if status == "succeeded":
# print(resp_json)
# print(
# "Analysis succeeded:\n%s" % json.dumps(resp_json))
Result = {}
num = resp_json['analyzeResult']['documentResults'][0]["fields"][labels['trainedLabels'][0]]["valueString"]
dt = resp_json['analyzeResult']['documentResults'][0]["fields"][labels['trainedLabels'][1]]["valueString"]
for i in labels['trainedLabels']:
Result[i] = resp_json['analyzeResult']['documentResults'][0]["fields"][i]["valueString"]
print(Result)
# print("Analysis succeeded:\n%s" % json.dumps(
# resp_json['analyzeResult']['documentResults'][0]["fields"]["Invoice Number"]["valueString"]))
# print("Analysis succeeded:\n%s" % json.dumps(
# resp_json['analyzeResult']['documentResults'][0]["fields"]["Invoice Due Date"]["valueString"]))
# quit()
return Result
if status == "failed":
print("Analysis failed:\n%s" % json.dumps(resp_json))
return "Failed"
# quit()
# Analysis still running. Wait and retry.
time.sleep(wait_sec)
n_try += 1
wait_sec = min(2 * wait_sec, max_wait_sec)
except Exception as e:
msg = "GET analyze results failed:\n%s" % str(e)
print(msg)
return "Failed"
print("Analyze operation did not complete within the allocated time.")
# Constant Keys
key_encrypt_keys = "encrypt_keys"
key_exclude_encryption = "exclude_encryption"
product_encrypted = "product_encrypted"
# Product based configurable constants
private_jwe_key = {'k': '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEArVED5cr+tMtFtVmXl2O0cvQbEgoYSIFd8yvkmm6z7'
'XAdX6Eg\nYkKez0ydTl26KOdJ18A7Kn8etWGe8nTkSGheJl9rn/J+lE1zpo4Zg/T3wDnM8FM3\nyuM26vpIb+0oJmNc9'
'DkFXo4WtxRFZDytdETg/YyI+eJYDRDrZSrlqAzIDpAdLpv9\nUhsMhYQ+2n3PcauLeJb0dKPVTc6kSvGCs3LZ0WyTbRnQ'
'yJMCWnaxzpSIUcH7qaqO\nKC/fBCKsZmRjRNSmQ3gepz4VnQKyJCm7CJk+cQiQMQzrspRPvhmGouHZUM36KjsG\n6ylx2'
'Bu6OYy/HbrdRkJKNlv3u6BBL6Pn/ZJZGQIDAQABAoIBABI8eMhESnYbm1RI\nW8S8YzeIO1Pz13hDku7cArcEKG72kcSm'
'58knAN5HjbK59nVI1tJ6gc84JnNH1Qlm\nZsG+p49qkWC4S3zPxHg1MfaaPzpM6qUr4G4656OkV5xdTBDz+gshd9Dp6vZ'
'zDdUc\n9FRMTg8nqx79461mRxpzP8xloaQ0NcKBzFK9e3g/4i72LwgNP3E6xmESiu7goqJ1\nGOAI2mJie3TTY1z8sf4u'
'iSFLMaFrExkq4z4KkwS7qF2nOJxhv8H/g9TGPNWrnzAw\nyBHwINBoUaJwiOT51xxIDLgNQiNoIFuaMKVu2l+rWtoQWKG'
'iOnw1ZhYxeJCXByXC\nQqpAfgECgYEAwpzSfyot3PAlxm9iVK5Zc6lRdBq7Jazt7t91U6zeY7C4xzNG1Tuf\ncSYK3qRwl'
'Mw2uXl9auxyV41rziX9sZhtFUnm4jcGv9MHeaAaSSPSsvrtZDFBS7ky\nl2Ixk1078LTZCLMYmAKCAr2XLmShBPSVcuaL'
'kDRX4rvw7scWmMb86wECgYEA4/yC\nEAjXlL0WlOYDJ3J//Pg4iBtIedHXmn30goNuCBBaoYygXapeytEmU2q5hybQTMTX'
'\nVl/vIAFiu0TX81VQ7LDLJaber/7GEsIT3x+xm0jFvOxFYVhT5b0s0z1CQolnRFsA\ndIwQ5u5GkP65hyJUa3ZMh+L6Vi'
'sSCTKpAco9ZhkCgYAKFZ5CwKjHvhn3AmaSBMbV\n23xBC/GOrjtWGXY288pCWDH7AIk3G3PTpSkDCHpc+4gKbGU3WTFDoC'
'xp7kYLId7l\nL4MrTban0gOdJdK234hXhfEvM+4yQlKAzbHL9RTaEET+0mj/14FtKu3elZBSdWoZ\nHiE1Q8EaGqsNdHuT'
'RxxsAQKBgQCqw7enyveusPL5FE/IfDrhgArX55ehp0uWrEE4\ngLkp0RYRawOzJKlbwMy0LnxIfwoGdmnUiIbTsjYBjs8'
'xs/WpU8LVsOeba3lxE21O\n8q5VYWy61T4ia9ZrjgbFMl0u+TwgNwlgQolmb5Lrh9/vGAejdjhcj+ZyJFCeExQE\nAzd6'
'AQKBgBhe+FwMhTus961jqEKXBXm0/OaOgzOdgl/asuC8oLU7cAVD7sS2LFcU\nu7ofIVIG6cRWRruajIuCdlIcLOedTE4'
'YL5jAuRL1TyVvxMm0FsrkWPABFrHWhsZs\nTSzpiOFJkLJTVnT7hlW/+m0qrKiW0zrFza0JaFwP/lj+hRrYGkOl\n'
'-----END RSA PRIVATE KEY-----'}
enc_alg_header = {"alg": "RSA-OAEP", "enc": "A128CBC-HS256"}
collection1 = "collection1" # This is a sample collection
collection2 = "collection2" # This is a sample collection
# This is a sample mongo encryption dictionary
encrypt_collection_dict = {collection1: {key_encrypt_keys: ["*"], key_exclude_encryption: ["_id"]},
collection2: {key_encrypt_keys: ["key1", "key2"], key_exclude_encryption: []}}
MONGO001 = "Server was unable to eestablish connection with MongoDB"
MONGO002 = "Server faced a problem when inserting document(s) into MongoDB"
MONGO003 = "Server faced a problem to find the document(s) with the given condition"
MONGO004 = "Server faced a problem to delete the document(s) with the given condition"
MONGO005 = "Server faced a problem to update the document(s) with the given condition and given data"
MONGO006 = "Server faced a problem when aggregating the data"
MONGO007 = "Server faced a problem when closing the connection with MongoDB"
class MongoException(Exception):
pass
class MongoConnectionException(MongoException):
pass
class MongoQueryException(MongoException):
pass
class MongoEncryptionException(MongoException):
pass
class MongoRecordInsertionException(MongoQueryException):
pass
class MongoFindException(MongoQueryException):
pass
class MongoDeleteException(MongoQueryException):
pass
class MongoUpdateException(MongoQueryException):
pass
class MongoUnknownDatatypeException(MongoEncryptionException):
pass
import json
import copy
import base64
import traceback
import logging
from datetime import datetime
from uuid import UUID
from jwcrypto import jwk, jwe, jwt
from jwcrypto.common import json_decode
from operator import itemgetter
from bson import ObjectId
from pymongo import MongoClient
from scripts.utils.mongo_exceptions import MongoException, MongoConnectionException, MongoQueryException, MongoEncryptionException,\
MongoRecordInsertionException, MongoFindException, MongoDeleteException, MongoUpdateException,\
MongoUnknownDatatypeException
from scripts.utils.mongo_constants import private_jwe_key, enc_alg_header, product_encrypted, encrypt_collection_dict,\
key_encrypt_keys, key_exclude_encryption
from scripts.utils.mongo_exception_codes import MONGO001, MONGO002, MONGO003, MONGO004, MONGO005, MONGO006, MONGO007
from pymongo.errors import ConnectionFailure
from pymongo.errors import DuplicateKeyError as MongoDuplicateKeyError
# TODO: Use the respective product's logger class
logger = logging.getLogger("")
exclude_encryption_datatypes = (datetime, UUID,)
class MongoDataEncryption(object):
def __init__(self):
pass
@staticmethod
def create_encrypted_string(payload):
"""
Method to encrypt the payload given as input.
:param payload: The string to be encrypted.
:return: Encrypted payload
"""
cookie_string = ""
try:
existing_private_key = jwk.JWK.from_pem(private_jwe_key['k'].encode())
existing_public_key = jwk.JWK()
existing_public_key.import_key(**json_decode(existing_private_key.export_public()))
jwe_token = jwe.JWE(plaintext=json.dumps(payload).encode(), protected=enc_alg_header,
recipient=existing_public_key)
cookie_string = jwe_token.serialize(compact=True)
except Exception as e:
logger.exception("Exception in the create_encrypted_string definition: " + str(e))
traceback.print_exc()
return cookie_string
@staticmethod
def create_decrypted_string(encrypted_string):
"""
Method to decrypt the payload given as input
:param encrypted_string: The encrypted string to be decoded.
:return: The original value in string format
"""
decrypted_payload = ""
try:
existing_private_key = jwk.JWK.from_pem(private_jwe_key['k'].encode())
cookie_string = jwt.JWT(key=existing_private_key, jwt=encrypted_string)
decrypted_payload = cookie_string.claims
except Exception as e:
logger.exception("Exception in the create_decrypted_string definition: " + str(e))
traceback.print_exc()
return decrypted_payload
def encrypt_data(self, json_data, collection_name):
"""
Encrypt the data in mongo based on the collection and key to be encrypted.
:param json_data: The data to be encrypted
:param collection_name: The collection where the document is stored
:return: Encrypted document based on product defined configuration.
"""
# TODO: Automatically add an unsupported data type to the salt.
try:
if collection_name in encrypt_collection_dict.keys():
if type(json_data) is list:
encrypted_data = list()
for data in encrypted_data:
dict_data = self.encrypt_dict_data(doc=data, collection_name=collection_name)
encrypted_data.append(dict_data)
elif type(json_data) is dict:
encrypted_data = self.encrypt_dict_data(doc=json_data, collection_name=collection_name)
else:
raise MongoUnknownDatatypeException("Unsupported datatype '{}' is being inserted to mongodb.".
format(type(json_data)))
else:
logger.debug("Given data is not a part of the Mongo encryption setup. Skipping encryption")
encrypted_data = json_data
encrypted_data[product_encrypted] = False
return encrypted_data
except MongoException as e:
raise MongoException(str(e))
except Exception as e:
raise MongoException("Server faced a problem when encrypting the data --> {}".format(str(e)))
def encrypt_dict_data(self, doc, collection_name):
"""
This method crawls the document and encrypts the keys that are marked for encryption.
Skips encrypting the keys with values of the datatypes defines in the tuple 'exclude_encryption_datatypes'
Adds two new keys to the document 'product_encrypted' and 'encryption_salt'
Key product_encrypted - Is a boolean value which flags a document as encrypted by this utility.
Key encryption_salt - List of all the values that were excluded from encryption due to datatype constraints.
:param doc: The document considered for encryption
:param collection_name: The collection where the document resided.
This is needed for the utility to read the encryption configuration
:return: The input document with the relevant keys encrypted.
"""
try:
is_mlens_encrypted = False
encrypted_data = dict()
encrypted_data["encryption_salt"] = dict()
if '*' in encrypt_collection_dict[collection_name][key_encrypt_keys]:
# Forming encryption salt
for index, exclude_encryption_datatype in enumerate(exclude_encryption_datatypes):
if exclude_encryption_datatype not in [None, '']:
encrypted_data["encryption_salt"]["dt_{}".format(index)] = \
self.search_datatype(doc, exclude_encryption_datatype)
sorted_path = sorted(encrypted_data["encryption_salt"]["dt_{}".format(index)],
key=itemgetter('p'), reverse=True)
for path_index, _path in enumerate(sorted_path):
to_pop = self.remove_value_of_datatype_command(_path, "dict_data")
exec(to_pop)
for dt in encrypted_data["encryption_salt"]:
for path_index, _path in enumerate(encrypted_data["encryption_salt"][dt]):
encrypted_data["encryption_salt"][dt][path_index]['p'] = base64.b64encode(_path['p'].encode())
# Encrypting the data
for key in doc.keys():
if key not in encrypt_collection_dict[collection_name][key_exclude_encryption]:
encrypted_data[key] = {'d': self.create_encrypted_string(payload=self.convert(doc[key])),
't': base64.b64encode(type(doc[key]).__name__.encode())}
is_mlens_encrypted = True
else:
encrypted_data[key] = doc[key]
else:
for key in doc.keys():
if key in encrypt_collection_dict[collection_name][key_encrypt_keys]:
# Forming encryption salt
for index, exclude_encryption_datatype in enumerate(exclude_encryption_datatypes):
if exclude_encryption_datatype not in [None, '']:
temp_dict_data = dict()
temp_dict_data[key] = copy.deepcopy(doc[key])
encrypted_data["encryption_salt"]["dt_{}".format(index)] = \
self.search_datatype(temp_dict_data, exclude_encryption_datatype)
sorted_path = sorted(encrypted_data["encryption_salt"]["dt_{}".format(index)],
key=itemgetter('p'), reverse=True)
for path_index, _path in enumerate(sorted_path):
to_pop = self.remove_value_of_datatype_command(_path, "dict_data")
exec(to_pop)
for dt in encrypted_data["encryption_salt"]:
for path_index, _path in enumerate(encrypted_data["encryption_salt"][dt]):
encrypted_data["encryption_salt"][dt][path_index]['p'] = base64.b64encode(
_path['p'].encode())
# Encrypting the data
encrypted_data[key] = {'d': self.create_encrypted_string(payload=self.convert(doc[key])),
't': base64.b64encode(type(doc[key]).__name__.encode())}
is_mlens_encrypted = True
else:
encrypted_data[key] = doc[key]
encrypted_data[product_encrypted] = is_mlens_encrypted
if not encrypted_data[product_encrypted]:
del encrypted_data["encryption_salt"]
return encrypted_data
except MongoException as e:
raise MongoException(str(e))
except Exception as e:
raise MongoException("Server faced a problem when encrypting the data --> {}".format(str(e)))
def decrypt_data(self, encrypted_doc, collection_name):
"""
This method decrypts all the data that is encrypted.
Keys that were excluded during encryption and have been added to the encryption_salt
will be added back to their original positions.
:param encrypted_doc: The document that needs to be decrypted
:param collection_name: The collection to which the document belongs to.
:return: The decrypted data with the original data types intact
"""
try:
if collection_name in encrypt_collection_dict.keys():
if '*' in encrypt_collection_dict[collection_name][key_encrypt_keys]:
decrypted_data = self.decrypt_keys(encrypted_doc=encrypted_doc, collection_name=collection_name,
key_based=False)
else:
decrypted_data = self.decrypt_keys(encrypted_doc=encrypted_doc, collection_name=collection_name,
key_based=True)
else:
decrypted_data = encrypted_doc
if product_encrypted in encrypted_doc and encrypted_doc[product_encrypted]:
if "encryption_salt" in encrypted_doc:
for dt in encrypted_doc["encryption_salt"]:
for val_index, val in enumerate(encrypted_doc["encryption_salt"][dt]):
encrypted_doc["encryption_salt"][dt][val_index]['p'] = \
base64.b64decode(encrypted_doc["encryption_salt"][dt][val_index]['p'].decode()).decode()
for dt in encrypted_doc["encryption_salt"]:
for val_index, val in enumerate(sorted(encrypted_doc["encryption_salt"][dt],
key=itemgetter('p'))):
to_add = self.add_value_datatype_command(
add_value=encrypted_doc["encryption_salt"][dt][val_index],
var_name="decrypted_data",
value="dict_data[\"encryption_salt\"][dt][val_index]['v']")
exec(to_add)
else:
raise MongoEncryptionException("Encrypted data does not have encryption salt!"
" Unable to decrypt the data!")
if product_encrypted in decrypted_data:
del decrypted_data[product_encrypted]
if "encryption_salt" in decrypted_data:
del decrypted_data["encryption_salt"]
return decrypted_data
except MongoException as e:
raise MongoException(str(e))
except Exception as e:
raise MongoException("Server faced a problem when decrypting the data --> {}".format(str(e)))
def decrypt_keys(self, encrypted_doc, collection_name, key_based=False):
"""
This method loops through the document and decrypts all the keys.
:param encrypted_doc: The document that needs to be decrypted
:param collection_name: The collection to which the document belongs to.
:param key_based: If decryption should be done based on key or on all keys (*)
:return:
"""
try:
decrypted_data = dict()
if key_based:
condition_dict = encrypt_collection_dict[collection_name][key_encrypt_keys]
else:
condition_dict = encrypt_collection_dict[collection_name][key_exclude_encryption]
for key in encrypted_doc.keys():
if key in condition_dict and not isinstance(encrypted_doc[key], exclude_encryption_datatypes):
if type(encrypted_doc[key]) is dict:
if 'd' in encrypted_doc[key].keys() and 't' in encrypted_doc[key].keys():
decrypted_data[key] = self.decrypt_convert_proper_data_type(
data=self.create_decrypted_string(encrypted_string=encrypted_doc[key]['d']),
data_type=base64.b64decode(encrypted_doc[key]['t'].decode()).decode()
)
else:
decrypted_data[key] = encrypted_doc[key]
else:
decrypted_data[key] = encrypted_doc[key]
else:
decrypted_data[key] = encrypted_doc[key]
return decrypted_data
except Exception as e:
raise MongoException("Server faced a problem when decrypting the keys --> {}".format(str(e)))
@staticmethod
def decrypt_convert_proper_data_type(data, data_type):
"""
Convert the de-serialized JSON object to the original data-type
:param data: The de-serialized data
:param data_type: The original data type to which the de-serialized data should be converted to
:return: The de-serialized data with it's original data type.
"""
if data_type == "int":
return int(data)
elif data_type == "list":
return json.loads(data)
elif data_type == "dict":
return json.loads(data)
elif data_type == "bool":
if data == 'true':
return True
elif data == 'false':
return False
else:
raise MongoException("Received unknown bool value (only true/false accepted)")
else:
return data.lstrip('"').rstrip('"')
def convert(self, data):
"""
Convert all byte-like objects into the proper data types.
This supports conversion of nested dict, list and tuples.
:param data:
:return:
"""
if isinstance(data, bytes):
return data.decode('ascii')
if isinstance(data, dict):
return dict(map(self.convert, data.items()))
if isinstance(data, tuple):
return map(self.convert, data)
if isinstance(data, list):
return list(map(self.convert, data))
return data
def search_datatype(self, _input, search_type, prev_datapoint_path=''):
"""
Search for an excluded data type in a nested dictionary or list and record it's path in the document.
This does not support the exclusion of data of types dict and list.
:param _input: The input data
:param search_type: The data type to be searched for to exclude.
:param prev_datapoint_path: The path of a value in a nested dict or nested list.
:return: List of dictionaries, with each dictionary containing the true value and it's path.
"""
try:
output = []
current_datapoint = _input
current_datapoint_path = prev_datapoint_path
if search_type is dict:
raise Exception("Searching for datatype dict is not supported!")
elif search_type is list:
raise Exception("Searching for datatype list is not supported!")
else:
if isinstance(current_datapoint, dict):
for dkey in current_datapoint:
temp_datapoint_path = current_datapoint_path
temp_datapoint_path += "dict-{}.".format(dkey)
for index in self.search_datatype(current_datapoint[dkey], search_type, temp_datapoint_path):
output.append(index)
elif isinstance(current_datapoint, list):
for index in range(0, len(current_datapoint)):
temp_datapoint_path = current_datapoint_path
temp_datapoint_path += "list-{}.".format(index)
for index_1 in self.search_datatype(current_datapoint[index], search_type, temp_datapoint_path):
output.append(index_1)
elif isinstance(current_datapoint, search_type):
output.append(dict(p=current_datapoint_path, v=current_datapoint))
output = filter(None, output)
return list(output)
except Exception as e:
raise Exception("Server faced a problem when searching for instances of datatype '{}' --> ".
format(search_type, str(e)))
@staticmethod
def remove_value_of_datatype_command(remove_value, var_name):
"""
This method produces the command for the value to be removed from a nested dict or list,
when given the path of that value in the source variable.
:param remove_value: The value (it's path) to be removed.
:param var_name: The variable on which the exec function should run on to remove the non-serializable value.
:return: The final command that will run in the exec function to remove the value from a nested dict or list.
"""
temp_path = ''
individual_path_list = remove_value["p"].split('.')
individual_path_list.remove('')
if individual_path_list[len(individual_path_list) - 1].split('-')[0] == "dict":
orig_path = 'del {var_name}{path}'
elif individual_path_list[len(individual_path_list) - 1].split('-')[0] == "list":
pop_index = ".pop({})".format(individual_path_list[len(individual_path_list) - 1].split('-')[1])
orig_path = '{var_name}{path}' + pop_index
individual_path_list.pop(len(individual_path_list) - 1)
else:
return
for path_index, path in enumerate(individual_path_list):
if path.split('-')[0] == "dict":
temp_path += "[\"{}\"]".format(path.split('-')[1])
elif path.split('-')[0] == "list":
temp_path += "[{}]".format(path.split('-')[1])
orig_path = orig_path.format(path=temp_path, var_name=var_name)
return orig_path
@staticmethod
def add_value_datatype_command(add_value, var_name, value):
"""
This method produces the command for the value to be added back to a nested dict or list,
when given the path of that value in the source variable.
:param add_value: The value (it's path) to be added
:param var_name: The source variable name on which the exec function should run on.
:param value: The original non-serialized value.
:return: The command to be executed on the source variable.
"""
path_string = ''
temp_path_string = ''
individual_path_list = add_value["p"].split('.')
individual_path_list.remove('')
for path_index, path in enumerate(individual_path_list):
if path.split('-')[0] == "dict":
temp_path_string = "[\"{}\"]".format(path.split('-')[1])
elif path.split('-')[0] == "list":
temp_path_string = "[{}]".format(path.split('-')[1])
else:
raise Exception("Unsupported datatype given for add value")
path_string += temp_path_string
if individual_path_list[len(individual_path_list) - 1].split('-')[0] == "dict":
command = "{var_name}{path} = {value}".format(var_name=var_name, path=path_string, value=value)
elif individual_path_list[len(individual_path_list) - 1].split('-')[0] == "list":
command = "{var_name}{path}].append({value})".format(var_name=var_name,
path=path_string.rstrip(temp_path_string),
value=value)
else:
raise Exception("Unsupported datatype given for add value")
return command
class MongoUtility(MongoDataEncryption):
def __init__(self, _mongo_host, _mongo_port):
super().__init__()
try:
self.__mongo_OBJ__ = MongoClient(host=_mongo_host, port=int(_mongo_port))
try:
self.__mongo_OBJ__.admin.command('ismaster')
except ConnectionFailure:
raise MongoConnectionException("MLens was unable to create a connection with the metastore")
logger.debug("Mongo connection established")
except Exception as e:
logger.error("Error in establishing connection: " + str(e))
raise MongoConnectionException(MONGO001)
def fetch_last_records_with_limit(self, json_data, database_name, collection_name, condition_json, limit=1):
"""
Fetches the latest n records given a condition.
:param json_data: The condition by which the records need to be fetched from MongoDB
:param database_name: The database from which the documents need to be fetched.
:param collection_name: The collection from which the documents need to be fetched.
:param condition_json: The condition to filter the fetched records.
:param limit: The number of records to be found.
:return:
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find(json_data).sort(condition_json).limit(limit)
logger.debug("Fetched results from mongo")
mongo_response = self.fetch_records_from_object(mongo_response_obj=mongo_response,
collection_name=collection_name)
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def insert_one(self, json_data, database_name, collection_name):
"""
To insert single document in collection
:param json_data: The document data to be inserted.
:param database_name: The database to which the collection/ document belongs to.
:param collection_name: The collection to which the document belongs to.
:return: id
"""
try:
json_data = self.encrypt_data(json_data=json_data, collection_name=collection_name)
mongo_response = self.__mongo_OBJ__[database_name][collection_name].insert_one(json_data)
logger.debug("Inserted document in mongo")
return mongo_response.inserted_id
except MongoException as e:
raise MongoException(e)
except MongoDuplicateKeyError:
raise MongoDuplicateKeyError("Found an existing record with the same ID in MongoDB")
except Exception as e:
traceback.print_exc()
logger.error("Error in inserting document: " + str(e))
raise MongoRecordInsertionException(MONGO002)
def insert_many(self, json_data, collection_name, database_name):
"""
To insert multiple documents in collection
:param json_data: The document data to be inserted.
:param collection_name: The collection to which the documents belongs to.
:param database_name: The database to which the collection/ documents belongs to.
:return: response
"""
try:
json_data = self.encrypt_data(json_data=json_data, collection_name=collection_name)
mongo_response = self.__mongo_OBJ__[database_name][collection_name].insert_many(json_data)
json_mongo_response_object = json.loads(json.dumps(mongo_response))
logger.debug("Inserted documents in mongo")
return json_mongo_response_object
except Exception as e:
traceback.print_exc()
logger.error("Error in inserting document: " + str(e))
raise MongoRecordInsertionException(MONGO002)
def find_json(self, json_data, database_name, collection_name):
"""
To find single document in collection
:param json_data: The condition on which the documents are to be found.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: response object
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find(json_data)
mongo_response = self.fetch_records_from_object(mongo_response_obj=mongo_response,
collection_name=collection_name)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_all(self, database_name, collection_name):
"""
To find all the documents
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: response object
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find()
mongo_response = self.fetch_records_from_object(mongo_response_obj=mongo_response,
collection_name=collection_name)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_json_unencrypted(self, json_data, database_name, collection_name):
"""
To find single document in collection
:param json_data: Find a document without running the decryption module on it.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: response object
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find(json_data)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_all_unencrypted(self, database_name, collection_name):
"""
To find all the documents
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: response object
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find()
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_with_limit(self, json_data, database_name, collection_name, limit=1):
"""
Find n documents with a certain key/ value pair.
:param json_data: The key/ value pair based on which the documents should be fetched from Mongo.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:param limit: The number of records that the output should be restricted to.
:return: List of all the documents.
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongo_response = database_connection[collection_name].find(json_data)
mongo_response1 = mongo_response.limit(limit)
logger.debug("Fetched results from mongo")
mongo_response1 = self.fetch_records_from_object(mongo_response_obj=mongo_response1,
collection_name=collection_name)
return mongo_response1
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_with_keyword(self, keyword_dict, database_name, collection_name):
"""
To find and return all documents with selected keywords
:param keyword_dict: The keyword based on which the documents should be fetched.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: List of all the documents.
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongo_response = database_connection[collection_name].find({}, keyword_dict)
mongo_response = self.fetch_records_from_object(mongo_response_obj=mongo_response,
collection_name=collection_name)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_json_with_keyword(self, keyword_dict, json_data, database_name, collection_name):
"""
Find and return all documents with selected keywords and a key/ value pair.
:param keyword_dict: The keyword based on which the documents should be fetched.
:param json_data: The key/ value pair based on which the documents should be fetched.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: List of all the documents.
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongo_response = database_connection[collection_name].find(json_data, keyword_dict)
mongo_response = self.fetch_records_from_object(mongo_response_obj=mongo_response,
collection_name=collection_name)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def remove(self, json_data, database_name, collection_name):
"""
To delete document from collection
:param json_data: The key/ value pair based on which the documents should be deleted.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: Boolean value.
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongo_response = database_connection[collection_name].remove(json_data)
logger.debug("Deleted document from mongo. Message: {}".format(mongo_response))
return True
except Exception as e:
traceback.print_exc()
logger.error("Error in deleting document: " + str(e))
raise MongoDeleteException(MONGO004)
def update_one(self, condition, json_data, database_name, collection_name):
"""
To update single document
:param condition: The condition by which the documents should be updated.
:param json_data: The JSON data that should replace the previous document.
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: success
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
json_data = self.encrypt_data(json_data=json_data, collection_name=collection_name)
database_connection[collection_name].update_one(condition, {"$set": json_data})
logger.debug("Updated document from mongo")
return True
except Exception as e:
traceback.print_exc()
logger.error("Error in updating document: " + str(e))
raise MongoUpdateException(MONGO005)
def aggregate_query(self, json_data, database_name, collection_name):
"""
To search using aggregate query
:param json_data:
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return: response object
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongo_response = database_connection[collection_name].aggregate(json_data)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in aggreation query: " + str(e))
raise MongoQueryException(MONGO006)
def close_connection(self):
"""
To close the mongo connection
:return:
"""
try:
if self.__mongo_OBJ__ is not None:
self.__mongo_OBJ__.close()
logger.debug("Mongo connection closed")
except Exception as e:
traceback.print_exc()
logger.error("Error during closing of connection: " + str(e))
raise MongoConnectionException(MONGO007)
def find_item_containing_key_in_sub_json_object(self, condition_array, database_name, collection_name):
"""
This function return item which contains provided JSON key inside sub json of mongodb record.
:param: condition_array:
:param: database_name: The database to which the collection/ documents belongs to.
:param: collection_name: The collection to which the documents belongs to.
:return: This function return item which contains provided JSON key inside sub json of mongodb record.
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongodb_response = database_connection[collection_name].find({"$or": condition_array})
mongodb_response = list(mongodb_response)[0]
# mongo_response = self.fetch_records_from_object(body=mongodb_response, collection_name=collection_name)
return mongodb_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def find_item_containing_key_in_sub_json_object_list(self, condition_array, database_name, collection_name):
"""
This function return item which contains provided JSON key inside sub json of mongodb record.
:param: condition_array:
:param: database_name: The database to which the collection/ documents belongs to.
:param: collection_name: The collection to which the documents belongs to.
:return: This function return item which contains provided JSON key inside sub json of mongodb record.
"""
try:
database_connection = self.__mongo_OBJ__[database_name]
mongodb_response = database_connection[collection_name].find({"$or": condition_array})
mongodb_response = list(mongodb_response)
# mongo_response = self.fetch_records_from_object(body=mongodb_response, collection_name=collection_name)
return mongodb_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003 + " " + str(e))
def search_record_by_query(self, db_name, collection_name, query_json):
"""
Definition for searching the record by query json
:param db_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:param query_json:
:return:
"""
mg_response = {}
try:
response = {}
docid = self.__mongo_OBJ__[db_name][collection_name]
for key, value in query_json.items():
response = docid.find({key: value})
mg_response = self.fetch_records_from_object(response, collection_name=collection_name)
except Exception as es:
logger.exception(es)
return mg_response
def fetch_records_from_object(self, mongo_response_obj, collection_name):
"""
Fetches all the records from a Mongo object, decrypts them and returns and list of the documents.
:param mongo_response_obj: The Mongo response object that should be decrypted before returning.
:param collection_name: The collection to which the documents belongs to.
:return: List of all the decrypted documents.
"""
final_list = []
try:
for doc in mongo_response_obj:
final_json = doc
final_json = self.decrypt_data(encrypted_doc=final_json, collection_name=collection_name)
final_list.append(final_json)
except Exception as e:
logger.exception(e)
return final_list
@staticmethod
def object_id_deserializer(result_dict: dict):
"""
Definition for de-serializing object of type ObjectID found in results retrieved from Mongo DB
:param result_dict:
:return:
"""
try:
for key, value in result_dict.items():
if isinstance(value, ObjectId):
result_dict[key] = str(value)
return result_dict
except Exception as e:
logger.error('Encountered error while de-serializing object id: {}'.format(e))
raise
def find_count(self, json_data, database_name, collection_name):
"""
:param json_data:
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:return:
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find(json_data).count()
logger.debug("fetched result count from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def skip_docs(self, json_data, database_name, collection_name, condition_json, skip):
"""
:param json_data:
:param database_name: The database to which the collection/ documents belongs to.
:param collection_name: The collection to which the documents belongs to.
:param condition_json:
:param skip:
:return:
"""
try:
db = self.__mongo_OBJ__[database_name]
mongo_response = db[collection_name].find(json_data).sort(condition_json).skip(skip)
logger.debug("Fetched results from mongo")
return mongo_response
except Exception as e:
traceback.print_exc()
logger.error("Error in finding document: " + str(e))
raise MongoFindException(MONGO003)
def encrypt_unencrypted_docs(self, _database_name):
"""
This method encrypts all the documents in configured collections that are already present in MongoDB.
:param _database_name: The database to which the collection/ documents belongs to.
:return: True/ False based on the outcome of the process.
"""
try:
for collection in encrypt_collection_dict.keys():
all_docs = self.find_all_unencrypted(database_name=_database_name,
collection_name=collection)
for doc in all_docs:
if product_encrypted in doc and doc[product_encrypted]:
logger.debug("Document already encrypted by Product. Skipping...")
continue
if "_id" in doc:
_id = doc["_id"]
del doc["_id"]
else:
logger.warning("'_id' not found in document. Skipping...")
continue
logger.debug("Updating document with Product encryption")
try:
self.update_one(condition={"_id": _id},
json_data=doc,
database_name=_database_name,
collection_name=collection)
except Exception as e:
logger.error("Server faced problem when encrypting document with ID {} in collection {} -> {}".
format(_id, collection, str(e)))
continue
logger.debug("Document updated with MLens encryption")
return True
except Exception as e:
logger.error("Server faced a problem when encrypting existing metadata to MLens encryption formats --> {}".
format(str(e)))
return False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment