Gitlab CSE Unil

Commit af42d9d9 authored by Julien Furrer's avatar Julien Furrer
Browse files

New js build

parent c17ccead
......@@ -3,7 +3,7 @@
* Copyright (c) Université de Lausanne 2014 - Julien Furrer <Julien.Furrer@unil.ch>
* The graphics of unilogo is copyright of Unil, all rights reserved.
* The webfont was generated by IcoMoon App (https://icomoon.io/app/)
*/@font-face{font-family:'unilogo';src:url('../fonts/unilogo.eot?br90gl');src:url('../fonts/unilogo.eot?#iefixbr90gl') format('embedded-opentype'),url('../fonts/unilogo.woff?br90gl') format('woff'),url('../fonts/unilogo.ttf?br90gl') format('truetype'),url('../fonts/unilogo.svg?br90gl#unilogo') format('svg');font-weight:normal;font-style:normal}[class^="unilogo-"],[class*=" unilogo-"]{font-family:'unilogo';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;font-size:85px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.unilogo-unil-notext:before{content:"\e600"}.unilogo-unil:before{content:"\e601"}.unilogo-riset:before{content:"\e602"}#main-footer{bottom:0;width:100%;height:80px;overflow:auto;padding-top:5px;margin-top:0px;background-color:#333;box-shadow:0 3px 3px -1px rgba(0,0,0,0.25) inset}#main-footer .logo{margin-top:-3px;font-size:63px}#main-footer,#main-footer a,#main-footer a:visited{color:#e9e9e9;text-decoration:none}#main-footer a:hover,#main-footer a:active{color:#fff;text-decoration:none;border-bottom:dotted 1px #fff;text-shadow:0 0 2px rgba(255,255,255,0.25)}#main-footer .logo,#main-footer a.logo{line-height:75px;text-shadow:none}#main-footer .logo:hover,#main-footer a.logo:hover,#main-footer .logo:active,#main-footer a.logo:active{border-bottom:none !important;text-shadow:none}#main-footer ul a{line-height:1.8em}@font-face{font-family:'adim';src:url('../fonts/adim.eot?28abcp8');src:url('../fonts/adim.eot?#iefix28abcp8') format('embedded-opentype'),url('../fonts/adim.woff?28abcp8') format('woff'),url('../fonts/adim.ttf?28abcp8') format('truetype'),url('../fonts/adim.svg?28abcp8#adim') format('svg');font-weight:normal;font-style:normal}[class^="adim-icon-"],[class*=" adim-icon-"]{font-family:'adim';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.adim-icon-blank:before{content:" "}.adim-icon-clippy:before{content:"\f035"}.adim-icon-line-width:before{content:"\e600"}.adim-icon-opacity:before{content:"\e601"}.adim-icon-color:before{content:"\e602"}body{background-color:#424242;overflow:hidden;font-family:OpenSans,"Helvetica Neue",Helvetica,Arial,sans-serif}body.theme-light{background-color:#f2f2f2}body.theme-dark{background-color:#424242}html,body{height:100%}#page-loader{height:100%;width:100%;background-color:#424242;position:fixed;top:53px;left:0;z-index:1040}#page-loader div{text-align:center}#page-loader div:first-child{padding-top:33%}.theme-light #page-loader{background-color:#f2f2f2}#main-navbar{margin-bottom:10px}#main-navbar.navbar-default{background-color:#e5e5e5;box-shadow:0 0 2px 0 #3d3d3d}#main-navbar .adim-image-name{padding-top:10px;padding-bottom:10px}#main-navbar .adim-image-name .text{display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:18px;line-height:1.4em;font-weight:300;letter-spacing:.75px}#main-navbar .adim-image-name .glyphicon{opacity:0;padding-left:5px;top:-3px;transition:opacity 0s ease 0s}#main-navbar:hover .adim-image-name .glyphicon{opacity:0.75;transition:opacity 0.2s ease 0.3s}#main-navbar li.info{border-left:1px solid rgba(255,255,255,0.1)}.navbar-separator{background-color:rgba(255,255,255,0.1);margin:1px 15px 0;padding:15px 1px;line-height:1.5em;border-color:rgba(255,255,255,0.1);border-style:solid;border-width:0 1px;box-shadow:0 0 2px #333 inset}a:focus,.btn:focus,.btn.active:focus,input[type="radio"]:focus{outline:none}.navbar-inverse .navbar-text{color:#ddd}.navbar-inverse .navbar-nav>li>a{color:#ddd}body.home{overflow:auto;background-color:#333}body.home #main-navbar{display:none}@media (min-width:1200px){body.home #home-container{padding:40px 0 60px}body.home #home-image{padding-top:20px}}@media (min-width:992px) and (max-width:1199px){body.home #home-container{padding:20px 0 40px}body.home #home-image{padding-top:0px}}@media (min-width:768px) and (max-width:991px){body.home #home-container{padding:20px 0 20px}body.home #home-image{padding-top:15px;margin-bottom:10px}}#home-container{background:#424242;padding:20px 0 40px}#home-container h1{color:#efefef;font-weight:400;margin-top:5px}#home-container h1 small{color:#efefef;font-weight:300}#home-container #home-action-box .well{background:rgba(255,255,255,0.1);border-radius:5px;border-color:rgba(220,220,220,0.1);padding:7px 15px}#home-container #home-action-box .unilogo-unil-notext{font-size:25px;vertical-align:middle}@media (min-width:768px) and (max-width:991px){#home-container h1{font-size:28px}#home-container #home-action-box .well{margin-bottom:10px}#home-container #home-action-box .local-login-head{bottom:-10px}#home-container #home-action-box .panel-collapse{padding:0px}#home-container #home-action-box .btn-lg{border-radius:4px;font-size:14px;line-height:20px;padding:6px 12px}#home-container #home-action-box .lead{font-size:16px}#home-container #home-action-box .unilogo-unil-notext{font-size:21px}}#home-image{padding-top:20px;margin-bottom:40px}#home-image img{border-radius:6px;background:url("../img/image-home.jpg") 0 50% no-repeat}@media (min-width:1200px){#home-image img{background:url("../img/image-home-lg.jpg") 0 50% no-repeat;width:1140px;height:761px}}@media (min-width:992px) and (max-width:1199px){#home-image img{background:url("../img/image-home-md.jpg") 0 50% no-repeat;width:940px;height:628px}}@media (min-width:768px) and (max-width:991px){#home-image img{background:url("../img/image-home-sm.jpg") 0 50% no-repeat;width:720px;height:525px}}#home-content{color:#f2f2f2}#home-content dd,#home-content p{margin-bottom:0.66em;line-height:1.33;letter-spacing:0.03em;font-weight:300}#main-home{background-color:#eee;border-radius:6px;padding:48px 60px;color:#f2f2f2}#main-home .intro h1{color:#f2f2f2;font-size:32px;margin-top:0px;text-shadow:0 1px 0 #FFF}#main-home .intro .lead{font-size:18px;color:#fff}#login-mode{margin-bottom:0px}#login-mode .local-login-head{position:absolute;right:15px;bottom:0px}#login-mode .local-login-head a,#login-mode .local-login-head a:link,#login-mode .local-login-head a:active,#login-mode .local-login-head a:visited,#login-mode .local-login-head a:hover{font-size:12px;font-weight:300;color:rgba(255,255,255,0.25);text-decoration:none}#login-mode .local-login-head a:hover{color:#99c5ea}#login-mode #login-local-panel{background:transparent;border-color:transparent;box-shadow:none}#login-mode #login-local-panel .panel-collapse{background:transparent linear-gradient(to bottom, rgba(0,0,0,0.15) 0, rgba(0,0,0,0.1) 100%);border-radius:4px;margin-top:15px;margin-bottom:5px;border:solid 1px rgba(0,0,0,0.1);border-bottom-color:rgba(255,255,255,0.15);box-shadow:0 1px 3px rgba(0,0,0,0.05) inset,0 1px 0 rgba(255,255,255,0.05)}#login-mode #login-local-panel input.form-control{margin-bottom:2px;font-size:12px}#login-mode #login-local-panel input.form-control::-moz-placeholder{color:#aaa;opacity:1}#login-mode #login-local-panel input.form-control:-ms-input-placeholder{color:#aaa}#login-mode #login-local-panel input.form-control::-webkit-input-placeholder{color:#aaa}#dlg-about-adim .modal-footer{padding:5px}#dlg-about-adim .modal-footer p{margin:0}#dlg-about-adim .logo,#dlg-about-adim .logo:hover,#dlg-about-adim .logo:link,#dlg-about-adim .logo:active,#dlg-about-adim .logo:visited{color:#0096c7;text-decoration:none}#main-navbar{min-width:790px;margin-bottom:0px}#main{padding:0 15px;overflow:hidden;min-width:624px}#main.has-mod-nav .tool-top-row{margin-top:0;margin-bottom:10px;padding-top:5px;background-image:-webkit-linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2) 80%, rgba(0,0,0,0.3) 100%, rgba(0,0,0,0.3) 100%);background-image:-o-linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2) 80%, rgba(0,0,0,0.3) 100%, rgba(0,0,0,0.3) 100%);background-image:linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2) 80%, rgba(0,0,0,0.3) 100%, rgba(0,0,0,0.3) 100%);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4d000000', endColorstr='#4d000000', GradientType=0)}#main .tool-top-row{margin-top:5px;margin-bottom:5px}#main .tool-top-row>div{padding-right:0}#main .tool-top-row .adim-view-mod-tabs.nav-tabs{border-color:#686868;margin-bottom:0;margin-left:-15px;padding-left:15px}#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li a{padding:5px 15px;background-color:rgba(255,255,255,0);color:#96cdfd}#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li a:hover{background-color:#eee;border-bottom-color:#686868;color:#23527c}#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li.active a,#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li.active a:hover,#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li.active a:focus{color:#3c3c3c;background-color:#c9c9c9;border-color:#c9c9c9 #c9c9c9 #686868;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.adim-view.adim-view-review #tools-col,.adim-view.adim-view-review #annotation-sharing-panel{display:none}.adim-view.adim-view-edit #annotation-list-panel{display:none}#tools-col,#canvas-col,#side-col{min-height:1px;padding-left:15px;padding-right:15px;position:relative;float:left}#tools-col{width:60px;padding-left:20px}#canvas-col{width:auto;float:left}#side-col{width:225px;background-color:rgba(0,0,0,0.15);box-shadow:4px 0 3px -4px rgba(0,0,0,0.3) inset;margin-left:-10px;padding:0 10px;transition:margin 300ms ease 0s}#side-col>.row{margin:0}#side-col>.row>.container{width:100%;padding:0}#side-col .panel-group .panel{margin-bottom:15px}#side-col .panel-group .panel+.panel{margin-top:0}#side-col .panel .panel-heading{padding:0}#side-col .panel .panel-heading h1{font-size:14px;letter-spacing:0.06em;padding:5px;margin:0}#side-col .panel .panel-footer{padding:1px 0;line-height:0}#side-col .side-col-collapse-but{margin:0 -10px 15px}#side-col .side-col-collapse-but .btn{padding:0 5px;color:#444;text-shadow:0 1px 0 rgba(255,255,255,0.25);font-size:14px;border-color:transparent;border-radius:0;background-color:#898989}#side-col .side-col-collapse-but .btn:hover{color:#2b2b2b;background-color:#afafaf}#side-col .side-col-collapse-but .btn:focus{outline:none}#side-col.collapsed{margin:0 -250px 0 25px}#side-col.collapsed .side-col-collapse-but{margin-left:-40px}#side-col.collapsed .side-col-collapse-but .btn{border-radius:3px 0 0 3px;background-color:#afafaf}#side-col.collapsed .side-col-collapse-but .btn .icon-circleright:before{content:'\f3c6'}.adim-view-review #side-col{width:285px}.adim-view-review #side-col.collapsed{margin:0 -310px 0 25px}.theme-light #side-col .side-col-collapse-but .btn{background-color:#d0d0d0;border-color:#a0a0a0}.theme-light .panel.panel-default{border-color:#a0a0a0}.theme-light .panel.panel-default>.panel-heading{background-color:#d0d0d0}.theme-light .panel.panel-default .panel-tb{background-color:#d0d0d0}.panel.panel-dark{border-color:#6f6f6f;border-bottom-color:#a2a2a2;border-top-color:#565656;background-color:#6f6f6f}.panel.panel-dark>.panel-heading,.panel.panel-dark>.panel-footer{background-color:#898989;border-color:#565656;color:#444}.panel.panel-dark>.panel-heading .panel-title{color:#444;text-shadow:0 1px 0 rgba(255,255,255,0.25)}.panel.panel-dark .panel-tb{background-color:#898989}.panel.panel-dark .list-group .list-group-item{background-color:transparent;border-color:#494949}.panel.panel-dark label{color:#CACACA}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #565656}.panel-group .panel-heading a[data-toggle="collapse"]{text-decoration:none}.panel-group .panel-heading a[data-toggle="collapse"]:hover{text-decoration:none}.panel-group .panel-heading a[data-toggle="collapse"]:hover .icon-circleup{color:#2b2b2b}.panel-group .panel-heading a[data-toggle="collapse"].collapsed .icon-circleup:before{content:""}#display-type-panel #cimaf-display-type-selector{width:100%}#display-type-panel .panel-body{padding:4px 3px}.canvas-container{width:642px;height:482px;padding:0;position:relative;background:#aaa url(../img/adim/frame_background.jpg) 0 0}.canvas-container.well{margin-bottom:0;border-bottom-left-radius:0px;border-bottom-right-radius:0px;border-color:#ccc}.canvas-container .dropzone{display:block;position:absolute;width:100%;top:45%}.canvas-container .dropzone .progress,.canvas-container .dropzone .alert{margin:15px 0 0 0}.canvas-container .dropzone .alert{text-align:left}.canvas-container .dropzone .dropzone-inner-wrapper{background-color:transparent;width:400px;text-align:center;border-radius:12px;border:solid 8px rgba(0,0,0,0.2);margin:-55px auto 0}.canvas-container .dropzone .dropzone-inner-wrapper .dropzone-inner{padding:20px;border-radius:5px;background-color:rgba(255,255,255,0.55);border:solid 1px rgba(255,255,255,0.3)}canvas{border:1px solid #444;border-radius:3px}#canvas-bbar{background-color:#ccc;padding:2px 6px 0px;line-height:1px;border-top-right-radius:0;border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-top-left-radius:0}#canvas-bbar label{float:left;line-height:2em;font-size:12px;font-weight:normal}#canvas-bbar .toolbar-control{display:inline-block}#canvas-bbar .toolbar-control .sldr{margin-left:10px;margin-top:3px}#canvas-bbar .tb-sep{display:inline-block;width:20px}#canvas-bbar .form-control,#canvas-bbar .input-group-addon{border-color:#b3b3b3}#canvas-bbar #attr-zoom .input-group{float:left;width:95px}#canvas-bbar #attr-zoom .input-group .form-control,#canvas-bbar #attr-zoom .input-group .input-group-addon{font-size:12px;height:25px;padding:3px}#canvas-bbar #attr-zoom .sldr .tooltip.top{margin-left:-18px}.theme-light canvas{border-color:#888}.theme-light .canvas-container{background:#aaa url(../img/adim/frame_background-light.jpg) 0 0}.theme-light .canvas-container.well{border-color:#f2f2f2 #f2f2f2 #e0e0e0}.theme-light #canvas-bbar{background-color:#e0e0e0;border:solid #bababa;border-width:0 1px 1px}.theme-light #canvas-bbar .form-control,.theme-light #canvas-bbar .input-group-addon{border-color:#c7c7c7}#draw-tool-tb .btn{font-size:16px;text-shadow:0 -1px 0 rgba(0,0,0,0.33)}#draw-tool-tb .btn.active,#draw-tool-tb .btn.disabled{text-shadow:none}#draw-tool-tb .btn input[type="radio"],#draw-tool-tb .btn input[type="checkbox"]{display:none}#annotationSharingPanel .label{line-height:1.5em}#annotationSharingPanel .sha-publish-mode-state[data-publish-state="0"] .label[data-publish-mode="0"],#annotationSharingPanel .sha-publish-mode-state[data-publish-state="1"] .label[data-publish-mode="1"],#annotationSharingPanel .sha-publish-mode-state[data-publish-state="2"] .label[data-publish-mode="2"]{display:inline-block !important;visibility:visible !important}#dlg-publish-mode form .lead{margin:0;line-height:1}#annotation-list-panel header,#annotation-list-panel footer{border-width:0;line-height:0.5em}#annotation-list-container{padding:0 1px;overflow-y:auto;overflow-x:hidden}#annotation-list-container .list-group{margin-bottom:0}#annotation-list-container .list-group .list-group-item{border-width:1px 0;border-radius:0;cursor:default;padding:0px 0 0;white-space:nowrap}#annotation-list-container .list-group .list-group-item:first-child{border-top:0}#annotation-list-container .list-group .list-group-item:last-child{border-bottom:0}#annotation-list-container .list-group .list-group-item .layer-status,#annotation-list-container .list-group .list-group-item .layer-title{display:inline-block;line-height:25px;padding:0 5px 0 5px}#annotation-list-container .list-group .list-group-item .layer-status{border-right:1px solid #5b5b5b;font-size:13px}#annotation-list-container .list-group .list-group-item .layer-title{border-left:1px solid #7e7e7e}#annotation-list-container .list-group .list-group-item.layer-hidden span.layer-status{color:#555}#annotation-list-container .list-group .list-group-item.selected{box-shadow:0 0 1px 1px #FA0 inset}.theme-light #annotation-list-container .list-group .list-group-item .layer-status{border-right:1px solid #cdcdcd}.theme-light #annotation-list-container .list-group .list-group-item .layer-title{border-left:1px solid #f1f1f1}.theme-light #annotation-list-container .list-group .list-group-item.selected{box-shadow:0 0 1px 3px #FFA200 inset}.x-btn-group-2-col.btn-group .btn+.btn{margin-left:0}.x-btn-group-2-col .btn-block{width:50%}.x-btn-group-2-col .btn-block+.btn-block{margin-top:0}.x-btn-group-2-col .btn:first-child{border-bottom-left-radius:0px}.x-btn-group-2-col .btn:nth-child(2){border-top-right-radius:3px !important}.x-btn-group-2-col .btn:nth-child(odd){border-right:0}.x-btn-group-2-col .btn:nth-child(n+3){border-top:0}.x-btn-group-2-col .btn:nth-last-child(2){border-bottom-left-radius:3px !important}.x-btn-group-2-col .btn:last-child{border-top-right-radius:0}.x-btn-group-2-col .btn.btn-dummy{background-color:rgba(255,255,255,0.25)}#annotation-property-container{padding:5px 10px;color:#cacaca}#annotation-property-container label.control-label{color:#cacaca}#annotation-property-container .property-group{margin-bottom:5px}#annotation-property-container .property-group:last-child{margin-bottom:0}#annotation-property-container .property-group.confidence-prop .rating-input{display:inline-block;cursor:default}#annotation-property-container .property-group.confidence-prop .rating-input>span.rating-off{color:#444444;box-shadow:0 1px 2px -1px #555 inset,0 -1px 1px -1px #ccc inset}#annotation-property-container .property-group.confidence-prop .rating-input>span.glyphicon-star{color:#ED9C28}#annotation-property-container .property-group.comment-prop textarea{resize:vertical;padding:3px 3px 3px 6px;line-height:1.2em}#annotation-property-container .property-group.comment-prop textarea[disabled]{background-color:#bcbcbc}#annotation-property-container .property-group.processus-prop .processus-list label.btn-default{color:#333}#annotation-property-container .property-group.disabled{color:rgba(202,202,202,0.5)}#annotation-property-container .property-group.disabled label{font-style:italic;color:rgba(202,202,202,0.5)}#annotation-property-container .property-group.disabled.confidence-prop .rating-input{color:#fdfdfd;cursor:not-allowed}#annotation-property-container .property-group.disabled.confidence-prop .rating-input>span.rating-off{color:rgba(253,253,253,0.8);box-shadow:none;background-color:#848484}.theme-light #annotation-property-container label.control-label{color:#888}.theme-light #annotation-property-container .property-group.comment-prop textarea[disabled]{background-color:#ebebeb}.theme-light #annotation-property-container .property-group.disabled label{color:rgba(136,136,136,0.6)}.btn .tool-text{display:none}.btn-toolbar .group-title{font-size:12px;font-weight:normal}.btn-toolbar .btn.active,.btn-toolbar .btn:active{border-top:1px solid rgba(0,0,0,0.15) !important}#tool-colorselect>button{color:#FFF}#tool-colorselect .color-menu{min-width:78px;max-width:78px;padding:0 0 12px 12px;margin:-55px 0 0 50px;background-color:#333330;border:solid 1px #808080;box-shadow:0 5px 10px rgba(0,0,0,0.5) !important}#tool-colorselect .color-menu.right .arrow{border-right-color:#808080}#tool-colorselect .color-menu.right .arrow:after{border-right-color:#333330;left:2px}#tool-colorselect .color-menu>li{float:left}#tool-colorselect .color-menu>li>a{width:20px;height:20px;border-radius:11px;padding:0;margin:12px 12px 0 0;clear:none;box-shadow:0 2px 4px -1px rgba(0,0,0,0.66) inset,0 0 2px 0 rgba(255,255,255,0.5),0 2px 2px -1px rgba(255,255,255,0.33)}#tool-colorselect .color-menu>li>a:hover,#tool-colorselect .color-menu>li>a:focus{background-color:#333330;background-image:none;border-color:transparent}#tool-colorselect .color-menu>li>a.c1,#tool-colorselect .color-menu>li>a.c1:hover{background-color:#fff700}#tool-colorselect .color-menu>li>a.c1:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(255,247,0,0.9)}#tool-colorselect .color-menu>li>a.c2,#tool-colorselect .color-menu>li>a.c2:hover{background-color:#ff8017}#tool-colorselect .color-menu>li>a.c2:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(255,128,23,0.9)}#tool-colorselect .color-menu>li>a.c3,#tool-colorselect .color-menu>li>a.c3:hover{background-color:#00d400}#tool-colorselect .color-menu>li>a.c3:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(0,212,0,0.9)}#tool-colorselect .color-menu>li>a.c4,#tool-colorselect .color-menu>li>a.c4:hover{background-color:#1977ff}#tool-colorselect .color-menu>li>a.c4:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(25,119,255,0.9)}#tool-colorselect .color-menu>li>a.c5,#tool-colorselect .color-menu>li>a.c5:hover{background-color:#fc6ca2}#tool-colorselect .color-menu>li>a.c5:hover{box-shadow:0 1px 4px -1px rgba(23,0,9,0.66) inset,0 0 1px 3px rgba(252,108,162,0.9)}#tool-colorselect .color-menu>li>a.c6,#tool-colorselect .color-menu>li>a.c6:hover{background-color:#fa0000}#tool-colorselect .color-menu>li>a.c6:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(250,0,0,0.9)}#tool-colorselect .color-menu>li>a.cx{width:52px;overflow:hidden}#tool-fill-color .tool-fill-on{display:none}#tool-fill-color.active .tool-fill-on{display:inline !important}#tool-fill-color.active .tool-fill-off{display:none}.dropright .caret{border-width:4px 0 4px 4px}.dropright .btn-default .caret,.dropright .btn .caret{border-color:transparent #FFF}.dropright .dropdown-menu{right:-150%;top:-100%;left:auto}#param-tool-tb .btn{color:#444;padding-top:4px;padding-bottom:4px}#param-tool-tb .btn.sldr{padding-bottom:8px}.sldr{display:inline-block}.sldr .slider .slider-track{background:rgba(0,0,0,0.15);box-shadow:0 1px 2px 0 rgba(0,0,0,0.77) inset,0 1px 0 0 rgba(255,255,255,0.4)}.sldr .slider .slider-handle{opacity:1;box-shadow:none;background-color:transparent;background-repeat:no-repeat}.sldr .slider.slider-vertical .slider-handle{background-size:20px 10px;background-position:0 5px}.sldr .slider.slider-horizontal .slider-handle{background-size:10px 20px;background-position:5px 0px}.btn-group-vertical .sldr{width:40px;padding:2px 0 10px}.btn-group-vertical .sldr [class^="adim-icon-"],.btn-group-vertical .sldr [class*=" adim-icon-"]{display:block;line-height:1.4;font-size:16px}.btn-group-vertical .sldr.btn-default:active,.btn-group-vertical .sldr.btn-default:focus{background-image:-webkit-linear-gradient(top, #fff 0, #e0e0e0 100%);background-image:-o-linear-gradient(top, #fff 0, #e0e0e0 100%);background-image:linear-gradient(to bottom, #fff 0, #e0e0e0 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);box-shadow:none}.btn-group-vertical .sldr:hover{background-position:0 -50px}.btn-group-vertical .sldr.disabled{background-image:none;background-color:#e0e0e0}.btn-group-vertical .sldr .tooltip{text-shadow:none}.btn-group-vertical .sldr .tooltip.right,.btn-group-vertical .sldr .tooltip.left{margin-top:-12px}.btn-group-vertical .sldr .tooltip.in{opacity:0.75}.btn-group-vertical .sldr .tooltip.in .tooltip-inner{opacity:1}.btn-group-vertical .sldr .tool-title{color:#AAA;letter-spacing:-0.015em;font-size:11px;text-align:center;cursor:default}.btn-group-vertical .sldr .slider.slider-vertical{height:50px;margin:3px 0 0}.btn-group-vertical .sldr.sldr-lg{width:52px}.btn-group-vertical .sldr.sldr-lg .slider.slider-vertical{margin-left:16px}.btn-group-vertical .sldr.sldr-sm{width:34px}.btn-group-vertical .sldr.sldr-sm .slider.slider-vertical{margin-left:7px}.btn-group-vertical .sldr.sldr-xs{width:24px}.btn-group-vertical .sldr.sldr-xs .slider.slider-vertical{margin-left:2px}canvas{cursor:default}canvas.cursor-tool-drawing{cursor:crosshair}canvas.cursor-tool-lines{cursor:crosshair}canvas.cursor-tool-ellipse{cursor:crosshair}canvas.cursor-tool-rectangle{cursor:crosshair}canvas.cursor-tool-text{cursor:text}canvas.cursor-tool-pan{cursor:-moz-grab;cursor:-webkit-grab;cursor:grab}canvas.cursor-tool-pan-down{cursor:-moz-grabbing;cursor:-webkit-grabbing;cursor:grabbing}canvas.cursor-tool-select{cursor:default}canvas.cursor-tool-zoom{cursor:zoom-in}canvas.cursor-tool-concordantstr{cursor:crosshair}canvas.cursor-tool-discordantstr{cursor:crosshair}canvas.cursor-tool-arrow,canvas.cursor-tool-arrow2{cursor:crosshair}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav .nav-divider.divider-vertical{height:32px;width:1px;margin:9px 10px}.navbar-inverse .nav .nav-divider{background-color:#555}.tooltip-inner{box-shadow:0 0 0 1px rgba(255,255,255,0.2)}.modal .modal-content{background-image:-webkit-linear-gradient(top, #f6f6f6 0, #d0d0d0 50px);background-image:-o-linear-gradient(top, #f6f6f6 0, #d0d0d0 50px);background-image:linear-gradient(to bottom, #f6f6f6 0, #d0d0d0 50px);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff6f6f6', endColorstr='#ffd0d0d0', GradientType=0)}.modal .modal-content .modal-header{border-color:rgba(0,0,0,0.2)}.modal .modal-content .modal-header .modal-title{line-height:1;font-weight:700;color:#666;text-shadow:0 1px 0 rgba(255,255,255,0.66)}.modal .modal-content .modal-footer{border-color:rgba(0,0,0,0.2)}.modal .modal-content .modal-body{background-color:#fff}.modal .modal-content .modal-body .nav-tabs li{font-weight:600}.btn-adim-layertb{color:#555;background-color:#aaa;border-color:#777}.btn-adim-layertb:hover,.btn-adim-layertb:focus,.btn-adim-layertb.focus,.btn-adim-layertb:active,.btn-adim-layertb.active,.open>.dropdown-toggle.btn-adim-layertb{color:#555;background-color:#919191;border-color:#585858}.btn-adim-layertb:active,.btn-adim-layertb.active,.open>.dropdown-toggle.btn-adim-layertb{background-image:none}.btn-adim-layertb .badge{color:#aaa;background-color:#555}.theme-light .btn-adim-layertb{color:#555;background-color:#f0f0f0;border-color:#c0c0c0}.theme-light .btn-adim-layertb:hover,.theme-light .btn-adim-layertb:focus,.theme-light .btn-adim-layertb.focus,.theme-light .btn-adim-layertb:active,.theme-light .btn-adim-layertb.active,.open>.dropdown-toggle.theme-light .btn-adim-layertb{color:#555;background-color:#d7d7d7;border-color:#a1a1a1}.theme-light .btn-adim-layertb:active,.theme-light .btn-adim-layertb.active,.open>.dropdown-toggle.theme-light .btn-adim-layertb{background-image:none}.theme-light .btn-adim-layertb .badge{color:#f0f0f0;background-color:#555}.btn-adim-dark{color:#c4c4c4;background-color:#767676;border-color:#9c9c9c}.btn-adim-dark:hover,.btn-adim-dark:focus,.btn-adim-dark.focus,.btn-adim-dark:active,.btn-adim-dark.active,.open>.dropdown-toggle.btn-adim-dark{color:#c4c4c4;background-color:#5d5d5d;border-color:#7e7e7e}.btn-adim-dark:active,.btn-adim-dark.active,.open>.dropdown-toggle.btn-adim-dark{background-image:none}.btn-adim-dark .badge{color:#767676;background-color:#c4c4c4}.btn-cimaf-layer{color:#aaa;background-color:#696969;border-color:#909090}.btn-cimaf-layer:hover,.btn-cimaf-layer:focus,.btn-cimaf-layer.focus,.btn-cimaf-layer:active,.btn-cimaf-layer.active,.open>.dropdown-toggle.btn-cimaf-layer{color:#aaa;background-color:#505050;border-color:#717171}.btn-cimaf-layer:active,.btn-cimaf-layer.active,.open>.dropdown-toggle.btn-cimaf-layer{background-image:none}.btn-cimaf-layer .badge{color:#696969;background-color:#aaa}.btn-cimaf-layer:hover{background-color:#838383;border-color:#bbb}.btn-cimaf-layer.active{color:#fff;background-color:#68ac68;border-color:#4cae4c}.theme-light .btn-cimaf-layer{font-weight:bold;letter-spacing:0.3px}.form-control::-moz-placeholder{color:#ccc;opacity:1}.form-control:-ms-input-placeholder{color:#ccc}.form-control::-webkit-input-placeholder{color:#ccc}#aom-modal .modal-body{padding:10px 0 0}#aom-modal .modal-body .nav-tabs{margin-left:10px}#aom-modal .modal-body .tab-content{min-height:200px;border-right:solid 1px #e0e0e0}@media (min-height:370px){#aom-modal .aom-list-container{max-height:220px;height:auto}}@media (min-height:590px){#aom-modal .aom-list-container{max-height:440px;height:auto}}@media (min-height:810px){#aom-modal .aom-list-container{max-height:660px;height:auto}}@media (min-height:1030px){#aom-modal .aom-list-container{max-height:880px;height:auto}}@media (min-width:500px){#aom-modal .modal-dialog{width:420px}#aom-modal .modal-dialog .narrow-1{width:218px}#aom-modal .modal-dialog .narrow-2{width:auto}}@media (min-width:700px){#aom-modal .modal-dialog{width:620px}#aom-modal .modal-dialog .narrow-1{width:418px}#aom-modal .modal-dialog .narrow-2{width:218px}}@media (min-width:900px){#aom-modal .modal-dialog{width:820px}#aom-modal .modal-dialog .narrow-1{width:618px}#aom-modal .modal-dialog .narrow-2{width:418px}}@media (min-width:1100px){#aom-modal .modal-dialog{width:1020px}#aom-modal .modal-dialog .narrow-1{width:818px}#aom-modal .modal-dialog .narrow-2{width:618px}}@media (min-width:1300px){#aom-modal .modal-dialog{width:1220px}#aom-modal .modal-dialog .narrow-1{width:1018px}#aom-modal .modal-dialog .narrow-2{width:818px}}.aom-info-panel{float:right;width:401px;border:0;box-shadow:none;border-radius:0;margin-bottom:0;border-left:solid 1px #e0e0e0}.aom-info-panel .panel-heading{border:0;border-bottom:solid 1px #d0d0d0;border-radius:0;padding:5px 10px;background-color:#eaeaea;color:#666}.aom-info-panel .panel-heading h5{font-weight:600;padding:0;margin:0;font-size:12px}.aom-info-panel .panel-body{overflow-x:hidden;overflow-y:auto;font-size:12px;padding:0}@media (min-height:370px){.aom-info-panel .panel-body{max-height:196px;height:auto}}@media (min-height:590px){.aom-info-panel .panel-body{max-height:416px;height:auto}}@media (min-height:810px){.aom-info-panel .panel-body{max-height:636px;height:auto}}@media (min-height:1030px){.aom-info-panel .panel-body{max-height:856px;height:auto}}.aom-info-panel .panel-body .aom-image-thumb{width:180px;height:180px;background-color:rgba(128,128,128,0.1);border-color:#d0d0d0;border-style:solid;border-width:0 1px 1px 0;margin:0 10px 10px 0;float:left}.aom-info-panel .panel-body dl.aom-info-prop{margin-top:15px;padding-right:10px}.aom-info-panel .panel-body dl.aom-info-prop dd{margin-bottom:1.4em}.aom-info-panel .panel-body hr{clear:both;margin:5px}.aom-info-panel .panel-body .aom-prop-url{font-size:10px;color:#808080;height:24px;padding:4px}.aom-info-panel .panel-body .aom-prop-url-copy-but{padding:2px 4px 0px 6px;height:24px}.aom-info-panel .panel-body .aom-prop-url-copy-but .adim-icon-clippy{font-size:16px}.aom-info-panel .panel-body .tooltip{font-weight:200;letter-spacing:1px;font-size:10px}.aom-info-panel .panel-body .aom-info-share h5{margin:10px 15px}.aom-info-panel .panel-body .aom-info-share .control-label{text-align:left}.aom-info-panel .panel-body .aom-info-share .checkbox{padding-top:0}.aom-info-panel .panel-body .aom-info-share .checkbox input[type=checkbox]{top:-2px}.aom-info-panel .panel-body .aom-info-share .form-horizontal .form-group{margin-left:0;margin-right:0}.aom-info-panel .panel-body .aom-info-share .form-group label.col-sm-12{text-align:left;margin-bottom:5px}.aom-info-panel .panel-body .aom-info-share .aom-shm-ctrl-members-list{margin-top:5px;margin-bottom:5px}.aom-info-panel .panel-body .aom-info-share .aom-shm-ctrl-members-list .aom-shm-ctrl-unregistred-member{font-style:italic;color:#6f6f6f}.aom-info-panel .panel-body .aom-info-share .aom-prop-lock-but{margin-top:-5px}.aom-info-panel .panel-body .aom-info-share .aom-prop-unlocked-status,.aom-info-panel .panel-body .aom-info-share .aom-prop-locked-status{display:none}.aom-info-panel .panel-body .aom-info-share.aom-prop-unlocked .aom-prop-unlocked-status{display:inline}.aom-info-panel .panel-body .aom-info-share.aom-prop-unlocked .aom-prop-locked-status{display:none}.aom-info-panel .panel-body .aom-info-share.aom-prop-locked .aom-prop-unlocked-status{display:none}.aom-info-panel .panel-body .aom-info-share.aom-prop-locked .aom-prop-locked-status{display:inline}.aom-info-panel .panel-body .aom-info-share.aom-prop-locked .aom-prop-locked-status.alert{display:block;margin:5px 15px 10px;padding:10px}.aom-info-panel .panel-body .aom-info-share.aom-prop-locked .popover{color:#333;font-size:12px}.aom-info-panel .panel-body .aom-info-share.aom-prop-locked .popover-title{font-size:12px;font-weight:bold}.aom-info-panel .panel-body .aom-info-share.aom-prop-locked .help-block{display:none}.aom-info-panel .panel-body .aom-info-share form{position:relative;overflow:hidden}.aom-info-panel .panel-body .aom-info-share form .aom-shm-frontdrop{background:none repeat scroll 0 0 rgba(255,255,255,0.5);cursor:not-allowed;height:800px;left:0;position:absolute;top:0;width:100%;z-index:100}.aom-info-panel .panel-body .aom-info-share .aom-prop-locked-info{cursor:pointer}.aom-info-panel .panel-body .aom-info-share .aom-prop-locked-info:hover{text-decoration:underline}#aom-shared-images-list .aom-list-item .btn-toolbar .aom-item-sh-status{display:none}.aom-list-container{overflow-y:auto;overflow-x:hidden}.aom-list-container .popover .popover-title{font-size:12px;font-weight:500}.aom-list-container .popover .popover-content{font-size:12px}.aom-list-container .popover .popover-content .dl-horizontal dt{width:80px;font-weight:400;font-style:italic}.aom-list-container .popover .popover-content .dl-horizontal dd{margin-left:90px}.aom-list-container .aom-loader{text-align:center;margin-top:80px;opacity:0.66}.aom-list-container .aom-empty-list-msg{display:none;margin:50px}.aom-list-container .aom-empty-list-msg:last-child{display:block}#aom-dropzone{margin-top:20px}#aom-dropzone .lead{margin-bottom:0}#aom-dropzone.dragover .well{background:#999}.aom-image-thumb{width:150px;height:150px;background-position:50% 50%;background-repeat:no-repeat}.aom-list-item{border:1px solid #a4a4a4;border-radius:4px;display:inline-block;text-align:center;width:180px;height:200px;margin:10px 10px;background-color:rgba(128,128,128,0.1);color:#646464;cursor:pointer}.aom-list-item.selected{box-shadow:0 0 2px 2px #66afe9;border-color:#66afe9}.aom-list-item.current{box-shadow:0 0 0 1px #fa3 inset;border-color:#fa3}.aom-list-item.current.selected{box-shadow:0 0 2px 2px #fa3,0 0 0 1px #fa3 inset}.aom-list-item .close{font-size:16px;margin-right:2px;opacity:0.1}.aom-list-item .btn-toolbar{margin-left:3px;opacity:0.5}.aom-list-item a,.aom-list-item .item-body{color:#646464;text-decoration:none;display:block;margin-top:20px;cursor:pointer}.aom-list-item a:hover,.aom-list-item .item-body:hover{color:#505050}.aom-list-item a:focus,.aom-list-item .item-body:focus{outline:none}.aom-list-item img{width:150px;height:150px;background-position:50% 50%;background-repeat:no-repeat;opacity:0.8}.aom-list-item .name{display:block;padding:3px 0 5px;margin:0 3px;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.aom-list-item:hover{border-color:#8b8b8b;background-color:#fff}.aom-list-item:hover img{opacity:1}.aom-list-item:hover .close{opacity:.25}.aom-list-item:hover.current{border-color:#fa3}span.twitter-typeahead .tt-dropdown-menu {
*/@font-face{font-family:'unilogo';src:url('../fonts/unilogo.eot?br90gl');src:url('../fonts/unilogo.eot?#iefixbr90gl') format('embedded-opentype'),url('../fonts/unilogo.woff?br90gl') format('woff'),url('../fonts/unilogo.ttf?br90gl') format('truetype'),url('../fonts/unilogo.svg?br90gl#unilogo') format('svg');font-weight:normal;font-style:normal}[class^="unilogo-"],[class*=" unilogo-"]{font-family:'unilogo';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;font-size:85px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.unilogo-unil-notext:before{content:"\e600"}.unilogo-unil:before{content:"\e601"}.unilogo-riset:before{content:"\e602"}#main-footer{bottom:0;width:100%;height:80px;overflow:auto;padding-top:5px;margin-top:0px;background-color:#333;box-shadow:0 3px 3px -1px rgba(0,0,0,0.25) inset}#main-footer .logo{margin-top:-3px;font-size:63px}#main-footer,#main-footer a,#main-footer a:visited{color:#e9e9e9;text-decoration:none}#main-footer a:hover,#main-footer a:active{color:#fff;text-decoration:none;border-bottom:dotted 1px #fff;text-shadow:0 0 2px rgba(255,255,255,0.25)}#main-footer .logo,#main-footer a.logo{line-height:75px;text-shadow:none}#main-footer .logo:hover,#main-footer a.logo:hover,#main-footer .logo:active,#main-footer a.logo:active{border-bottom:none !important;text-shadow:none}#main-footer ul a{line-height:1.8em}@font-face{font-family:'adim';src:url('../fonts/adim.eot?28abcp8');src:url('../fonts/adim.eot?#iefix28abcp8') format('embedded-opentype'),url('../fonts/adim.woff?28abcp8') format('woff'),url('../fonts/adim.ttf?28abcp8') format('truetype'),url('../fonts/adim.svg?28abcp8#adim') format('svg');font-weight:normal;font-style:normal}[class^="adim-icon-"],[class*=" adim-icon-"]{font-family:'adim';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.adim-icon-blank:before{content:" "}.adim-icon-clippy:before{content:"\f035"}.adim-icon-line-width:before{content:"\e600"}.adim-icon-opacity:before{content:"\e601"}.adim-icon-color:before{content:"\e602"}body{background-color:#424242;overflow:hidden;font-family:OpenSans,"Helvetica Neue",Helvetica,Arial,sans-serif}body.theme-light{background-color:#f2f2f2}body.theme-dark{background-color:#424242}html,body{height:100%}#page-loader{height:100%;width:100%;background-color:#424242;position:fixed;top:53px;left:0;z-index:1040}#page-loader div{text-align:center}#page-loader div:first-child{padding-top:33%}.theme-light #page-loader{background-color:#f2f2f2}#main-navbar{margin-bottom:10px}#main-navbar.navbar-default{background-color:#e5e5e5;box-shadow:0 0 2px 0 #3d3d3d}#main-navbar .adim-image-name{padding-top:10px;padding-bottom:10px}#main-navbar .adim-image-name .text{display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:18px;line-height:1.4em;font-weight:300;letter-spacing:.75px}#main-navbar .adim-image-name .glyphicon{opacity:0;padding-left:5px;top:-3px;transition:opacity 0s ease 0s}#main-navbar:hover .adim-image-name .glyphicon{opacity:0.75;transition:opacity 0.2s ease 0.3s}#main-navbar li.info{border-left:1px solid rgba(255,255,255,0.1)}.navbar-separator{background-color:rgba(255,255,255,0.1);margin:1px 15px 0;padding:15px 1px;line-height:1.5em;border-color:rgba(255,255,255,0.1);border-style:solid;border-width:0 1px;box-shadow:0 0 2px #333 inset}a:focus,.btn:focus,.btn.active:focus,input[type="radio"]:focus{outline:none}.navbar-inverse .navbar-text{color:#ddd}.navbar-inverse .navbar-nav>li>a{color:#ddd}body.home{overflow:auto;background-color:#333}body.home #main-navbar{display:none}@media (min-width:1200px){body.home #home-container{padding:40px 0 60px}body.home #home-image{padding-top:20px}}@media (min-width:992px) and (max-width:1199px){body.home #home-container{padding:20px 0 40px}body.home #home-image{padding-top:0px}}@media (min-width:768px) and (max-width:991px){body.home #home-container{padding:20px 0 20px}body.home #home-image{padding-top:15px;margin-bottom:10px}}#home-container{background:#424242;padding:20px 0 40px}#home-container h1{color:#efefef;font-weight:400;margin-top:5px}#home-container h1 small{color:#efefef;font-weight:300}#home-container #home-action-box .well{background:rgba(255,255,255,0.1);border-radius:5px;border-color:rgba(220,220,220,0.1);padding:7px 15px}#home-container #home-action-box .unilogo-unil-notext{font-size:25px;vertical-align:middle}@media (min-width:768px) and (max-width:991px){#home-container h1{font-size:28px}#home-container #home-action-box .well{margin-bottom:10px}#home-container #home-action-box .local-login-head{bottom:-10px}#home-container #home-action-box .panel-collapse{padding:0px}#home-container #home-action-box .btn-lg{border-radius:4px;font-size:14px;line-height:20px;padding:6px 12px}#home-container #home-action-box .lead{font-size:16px}#home-container #home-action-box .unilogo-unil-notext{font-size:21px}}#home-image{padding-top:20px;margin-bottom:40px}#home-image img{border-radius:6px;background:url("../img/image-home.jpg") 0 50% no-repeat}@media (min-width:1200px){#home-image img{background:url("../img/image-home-lg.jpg") 0 50% no-repeat;width:1140px;height:761px}}@media (min-width:992px) and (max-width:1199px){#home-image img{background:url("../img/image-home-md.jpg") 0 50% no-repeat;width:940px;height:628px}}@media (min-width:768px) and (max-width:991px){#home-image img{background:url("../img/image-home-sm.jpg") 0 50% no-repeat;width:720px;height:525px}}#home-content{color:#f2f2f2}#home-content dd,#home-content p{margin-bottom:0.66em;line-height:1.33;letter-spacing:0.03em;font-weight:300}#main-home{background-color:#eee;border-radius:6px;padding:48px 60px;color:#f2f2f2}#main-home .intro h1{color:#f2f2f2;font-size:32px;margin-top:0px;text-shadow:0 1px 0 #FFF}#main-home .intro .lead{font-size:18px;color:#fff}#login-mode{margin-bottom:0px}#login-mode .local-login-head{position:absolute;right:15px;bottom:0px}#login-mode .local-login-head a,#login-mode .local-login-head a:link,#login-mode .local-login-head a:active,#login-mode .local-login-head a:visited,#login-mode .local-login-head a:hover{font-size:12px;font-weight:300;color:rgba(255,255,255,0.25);text-decoration:none}#login-mode .local-login-head a:hover{color:#99c5ea}#login-mode #login-local-panel{background:transparent;border-color:transparent;box-shadow:none}#login-mode #login-local-panel .panel-collapse{background:transparent linear-gradient(to bottom, rgba(0,0,0,0.15) 0, rgba(0,0,0,0.1) 100%);border-radius:4px;margin-top:15px;margin-bottom:5px;border:solid 1px rgba(0,0,0,0.1);border-bottom-color:rgba(255,255,255,0.15);box-shadow:0 1px 3px rgba(0,0,0,0.05) inset,0 1px 0 rgba(255,255,255,0.05)}#login-mode #login-local-panel input.form-control{margin-bottom:2px;font-size:12px}#login-mode #login-local-panel input.form-control::-moz-placeholder{color:#aaa;opacity:1}#login-mode #login-local-panel input.form-control:-ms-input-placeholder{color:#aaa}#login-mode #login-local-panel input.form-control::-webkit-input-placeholder{color:#aaa}#dlg-about-adim .modal-footer{padding:5px}#dlg-about-adim .modal-footer p{margin:0}#dlg-about-adim .logo,#dlg-about-adim .logo:hover,#dlg-about-adim .logo:link,#dlg-about-adim .logo:active,#dlg-about-adim .logo:visited{color:#0096c7;text-decoration:none}#main-navbar{min-width:790px;margin-bottom:0px}#main{padding:0 15px;overflow:hidden;min-width:624px}#main.has-mod-nav .tool-top-row{margin-top:0;margin-bottom:10px;padding-top:5px;background-image:-webkit-linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2) 80%, rgba(0,0,0,0.3) 100%, rgba(0,0,0,0.3) 100%);background-image:-o-linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2) 80%, rgba(0,0,0,0.3) 100%, rgba(0,0,0,0.3) 100%);background-image:linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2) 80%, rgba(0,0,0,0.3) 100%, rgba(0,0,0,0.3) 100%);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4d000000', endColorstr='#4d000000', GradientType=0)}#main .tool-top-row{margin-top:5px;margin-bottom:5px}#main .tool-top-row>div{padding-right:0}#main .tool-top-row .adim-view-mod-tabs.nav-tabs{border-color:#686868;margin-bottom:0;margin-left:-15px;padding-left:15px}#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li a{padding:5px 15px;background-color:rgba(255,255,255,0);color:#96cdfd}#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li a:hover{background-color:#eee;border-bottom-color:#686868;color:#23527c}#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li.active a,#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li.active a:hover,#main .tool-top-row .adim-view-mod-tabs.nav-tabs>li.active a:focus{color:#3c3c3c;background-color:#c9c9c9;border-color:#c9c9c9 #c9c9c9 #686868;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.adim-view.adim-view-review #tools-col,.adim-view.adim-view-review #annotation-sharing-panel{display:none}.adim-view.adim-view-edit #annotation-list-panel{display:none}#tools-col,#canvas-col,#side-col{min-height:1px;padding-left:15px;padding-right:15px;position:relative;float:left}#tools-col{width:60px;padding-left:20px}#canvas-col{width:auto;float:left}#side-col{width:225px;background-color:rgba(0,0,0,0.15);box-shadow:4px 0 3px -4px rgba(0,0,0,0.3) inset;margin-left:-10px;padding:0 10px;transition:margin 300ms ease 0s}#side-col>.row{margin:0}#side-col>.row>.container{width:100%;padding:0}#side-col .panel-group .panel{margin-bottom:15px}#side-col .panel-group .panel+.panel{margin-top:0}#side-col .panel .panel-heading{padding:0}#side-col .panel .panel-heading h1{font-size:14px;letter-spacing:0.06em;padding:5px;margin:0}#side-col .panel .panel-footer{padding:1px 0;line-height:0}#side-col .side-col-collapse-but{margin:0 -10px 15px}#side-col .side-col-collapse-but .btn{padding:0 5px;color:#444;text-shadow:0 1px 0 rgba(255,255,255,0.25);font-size:14px;border-color:transparent;border-radius:0;background-color:#898989}#side-col .side-col-collapse-but .btn:hover{color:#2b2b2b;background-color:#afafaf}#side-col .side-col-collapse-but .btn:focus{outline:none}#side-col.collapsed{margin:0 -250px 0 25px}#side-col.collapsed .side-col-collapse-but{margin-left:-40px}#side-col.collapsed .side-col-collapse-but .btn{border-radius:3px 0 0 3px;background-color:#afafaf}#side-col.collapsed .side-col-collapse-but .btn .icon-circleright:before{content:'\f3c6'}.adim-view-review #side-col{width:285px}.adim-view-review #side-col.collapsed{margin:0 -310px 0 25px}.theme-light #side-col .side-col-collapse-but .btn{background-color:#d0d0d0;border-color:#a0a0a0}.theme-light .panel.panel-default{border-color:#a0a0a0}.theme-light .panel.panel-default>.panel-heading{background-color:#d0d0d0}.theme-light .panel.panel-default .panel-tb{background-color:#d0d0d0}.panel.panel-dark{border-color:#6f6f6f;border-bottom-color:#a2a2a2;border-top-color:#565656;background-color:#6f6f6f}.panel.panel-dark>.panel-heading,.panel.panel-dark>.panel-footer{background-color:#898989;border-color:#565656;color:#444}.panel.panel-dark>.panel-heading .panel-title{color:#444;text-shadow:0 1px 0 rgba(255,255,255,0.25)}.panel.panel-dark .panel-tb{background-color:#898989}.panel.panel-dark .list-group .list-group-item{background-color:transparent;border-color:#494949}.panel.panel-dark label{color:#CACACA}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #565656}.panel-group .panel-heading a[data-toggle="collapse"]{text-decoration:none}.panel-group .panel-heading a[data-toggle="collapse"]:hover{text-decoration:none}.panel-group .panel-heading a[data-toggle="collapse"]:hover .icon-circleup{color:#2b2b2b}.panel-group .panel-heading a[data-toggle="collapse"].collapsed .icon-circleup:before{content:""}#display-type-panel #cimaf-display-type-selector{width:100%}#display-type-panel .panel-body{padding:4px 3px}.canvas-container{width:642px;height:482px;padding:0;position:relative;background:#aaa url(../img/adim/frame_background.jpg) 0 0}.canvas-container.well{margin-bottom:0;border-bottom-left-radius:0px;border-bottom-right-radius:0px;border-color:#ccc}.canvas-container .dropzone{display:block;position:absolute;width:100%;top:45%}.canvas-container .dropzone .progress,.canvas-container .dropzone .alert{margin:15px 0 0 0}.canvas-container .dropzone .alert{text-align:left}.canvas-container .dropzone .dropzone-inner-wrapper{background-color:transparent;width:400px;text-align:center;border-radius:12px;border:solid 8px rgba(0,0,0,0.2);margin:-55px auto 0}.canvas-container .dropzone .dropzone-inner-wrapper .dropzone-inner{padding:20px;border-radius:5px;background-color:rgba(255,255,255,0.55);border:solid 1px rgba(255,255,255,0.3)}canvas{border:1px solid #444;border-radius:3px}#canvas-bbar{background-color:#ccc;padding:2px 6px 0px;line-height:1px;border-top-right-radius:0;border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-top-left-radius:0}#canvas-bbar label{float:left;line-height:2em;font-size:12px;font-weight:normal}#canvas-bbar .toolbar-control{display:inline-block}#canvas-bbar .toolbar-control .sldr{margin-left:10px;margin-top:3px}#canvas-bbar .tb-sep{display:inline-block;width:20px}#canvas-bbar .form-control,#canvas-bbar .input-group-addon{border-color:#b3b3b3}#canvas-bbar #attr-zoom .input-group{float:left;width:95px}#canvas-bbar #attr-zoom .input-group .form-control,#canvas-bbar #attr-zoom .input-group .input-group-addon{font-size:12px;height:25px;padding:3px}#canvas-bbar #attr-zoom .sldr .tooltip.top{margin-left:-18px}.theme-light canvas{border-color:#888}.theme-light .canvas-container{background:#aaa url(../img/adim/frame_background-light.jpg) 0 0}.theme-light .canvas-container.well{border-color:#f2f2f2 #f2f2f2 #e0e0e0}.theme-light #canvas-bbar{background-color:#e0e0e0;border:solid #bababa;border-width:0 1px 1px}.theme-light #canvas-bbar .form-control,.theme-light #canvas-bbar .input-group-addon{border-color:#c7c7c7}#draw-tool-tb .btn{font-size:16px;text-shadow:0 -1px 0 rgba(0,0,0,0.33)}#draw-tool-tb .btn.active,#draw-tool-tb .btn.disabled{text-shadow:none}#draw-tool-tb .btn input[type="radio"],#draw-tool-tb .btn input[type="checkbox"]{display:none}#annotationSharingPanel .label{line-height:1.5em}#annotationSharingPanel .sha-publish-mode-state[data-publish-state="0"] .label[data-publish-mode="0"],#annotationSharingPanel .sha-publish-mode-state[data-publish-state="1"] .label[data-publish-mode="1"],#annotationSharingPanel .sha-publish-mode-state[data-publish-state="2"] .label[data-publish-mode="2"]{display:inline-block !important;visibility:visible !important}#dlg-publish-mode form .lead{margin:0;line-height:1}#annotation-list-panel header,#annotation-list-panel footer{border-width:0;line-height:0.5em}#annotation-list-container{padding:0 1px;overflow-y:auto;overflow-x:hidden}#annotation-list-container .list-group{margin-bottom:0}#annotation-list-container .list-group .list-group-item{border-width:1px 0;border-radius:0;cursor:default;padding:0px 0 0;white-space:nowrap}#annotation-list-container .list-group .list-group-item:first-child{border-top:0}#annotation-list-container .list-group .list-group-item:last-child{border-bottom:0}#annotation-list-container .list-group .list-group-item .layer-status,#annotation-list-container .list-group .list-group-item .layer-title{display:inline-block;line-height:25px;padding:0 5px 0 5px}#annotation-list-container .list-group .list-group-item .layer-status{border-right:1px solid #5b5b5b;font-size:13px}#annotation-list-container .list-group .list-group-item .layer-title{border-left:1px solid #7e7e7e}#annotation-list-container .list-group .list-group-item.layer-hidden span.layer-status{color:#555}#annotation-list-container .list-group .list-group-item.selected{box-shadow:0 0 1px 1px #FA0 inset}.theme-light #annotation-list-container .list-group .list-group-item .layer-status{border-right:1px solid #cdcdcd}.theme-light #annotation-list-container .list-group .list-group-item .layer-title{border-left:1px solid #f1f1f1}.theme-light #annotation-list-container .list-group .list-group-item.selected{box-shadow:0 0 1px 3px #FFA200 inset}.x-btn-group-2-col.btn-group .btn+.btn{margin-left:0}.x-btn-group-2-col .btn-block{width:50%}.x-btn-group-2-col .btn-block+.btn-block{margin-top:0}.x-btn-group-2-col .btn:first-child{border-bottom-left-radius:0px}.x-btn-group-2-col .btn:nth-child(2){border-top-right-radius:3px !important}.x-btn-group-2-col .btn:nth-child(odd){border-right:0}.x-btn-group-2-col .btn:nth-child(n+3){border-top:0}.x-btn-group-2-col .btn:nth-last-child(2){border-bottom-left-radius:3px !important}.x-btn-group-2-col .btn:last-child{border-top-right-radius:0}.x-btn-group-2-col .btn.btn-dummy{background-color:rgba(255,255,255,0.25)}#annotation-property-container{padding:5px 10px;color:#cacaca}#annotation-property-container label.control-label{color:#cacaca}#annotation-property-container .property-group{margin-bottom:5px}#annotation-property-container .property-group:last-child{margin-bottom:0}#annotation-property-container .property-group.confidence-prop .rating-input{display:inline-block;cursor:default}#annotation-property-container .property-group.confidence-prop .rating-input>span.rating-off{color:#444444;box-shadow:0 1px 2px -1px #555 inset,0 -1px 1px -1px #ccc inset}#annotation-property-container .property-group.confidence-prop .rating-input>span.glyphicon-star{color:#ED9C28}#annotation-property-container .property-group.comment-prop textarea{resize:vertical;padding:3px 3px 3px 6px;line-height:1.2em;font-size:12px}#annotation-property-container .property-group.comment-prop textarea[disabled]{background-color:#bcbcbc}#annotation-property-container .property-group.processus-prop .processus-list label.btn-default{color:#333}#annotation-property-container .property-group.disabled{color:rgba(202,202,202,0.5)}#annotation-property-container .property-group.disabled label{font-style:italic;color:rgba(202,202,202,0.5)}#annotation-property-container .property-group.disabled.confidence-prop .rating-input{color:#fdfdfd;cursor:not-allowed}#annotation-property-container .property-group.disabled.confidence-prop .rating-input>span.rating-off{color:rgba(253,253,253,0.8);box-shadow:none;background-color:#848484}.theme-light #annotation-property-container label.control-label{color:#888}.theme-light #annotation-property-container .property-group.comment-prop textarea[disabled]{background-color:#ebebeb}.theme-light #annotation-property-container .property-group.disabled label{color:rgba(136,136,136,0.6)}.btn .tool-text{display:none}.btn-toolbar .group-title{font-size:12px;font-weight:normal}.btn-toolbar .btn.active,.btn-toolbar .btn:active{border-top:1px solid rgba(0,0,0,0.15) !important}#tool-colorselect>button{color:#FFF}#tool-colorselect .color-menu{min-width:78px;max-width:78px;padding:0 0 12px 12px;margin:-55px 0 0 50px;background-color:#333330;border:solid 1px #808080;box-shadow:0 5px 10px rgba(0,0,0,0.5) !important}#tool-colorselect .color-menu.right .arrow{border-right-color:#808080}#tool-colorselect .color-menu.right .arrow:after{border-right-color:#333330;left:2px}#tool-colorselect .color-menu>li{float:left}#tool-colorselect .color-menu>li>a{width:20px;height:20px;border-radius:11px;padding:0;margin:12px 12px 0 0;clear:none;box-shadow:0 2px 4px -1px rgba(0,0,0,0.66) inset,0 0 2px 0 rgba(255,255,255,0.5),0 2px 2px -1px rgba(255,255,255,0.33)}#tool-colorselect .color-menu>li>a:hover,#tool-colorselect .color-menu>li>a:focus{background-color:#333330;background-image:none;border-color:transparent}#tool-colorselect .color-menu>li>a.c1,#tool-colorselect .color-menu>li>a.c1:hover{background-color:#fff700}#tool-colorselect .color-menu>li>a.c1:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(255,247,0,0.9)}#tool-colorselect .color-menu>li>a.c2,#tool-colorselect .color-menu>li>a.c2:hover{background-color:#ff8017}#tool-colorselect .color-menu>li>a.c2:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(255,128,23,0.9)}#tool-colorselect .color-menu>li>a.c3,#tool-colorselect .color-menu>li>a.c3:hover{background-color:#00d400}#tool-colorselect .color-menu>li>a.c3:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(0,212,0,0.9)}#tool-colorselect .color-menu>li>a.c4,#tool-colorselect .color-menu>li>a.c4:hover{background-color:#1977ff}#tool-colorselect .color-menu>li>a.c4:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(25,119,255,0.9)}#tool-colorselect .color-menu>li>a.c5,#tool-colorselect .color-menu>li>a.c5:hover{background-color:#fc6ca2}#tool-colorselect .color-menu>li>a.c5:hover{box-shadow:0 1px 4px -1px rgba(23,0,9,0.66) inset,0 0 1px 3px rgba(252,108,162,0.9)}#tool-colorselect .color-menu>li>a.c6,#tool-colorselect .color-menu>li>a.c6:hover{background-color:#fa0000}#tool-colorselect .color-menu>li>a.c6:hover{box-shadow:0 1px 4px -1px rgba(0,0,0,0.66) inset,0 0 1px 3px rgba(250,0,0,0.9)}#tool-colorselect .color-menu>li>a.cx{width:52px;overflow:hidden}#tool-fill-color .tool-fill-on{display:none}#tool-fill-color.active .tool-fill-on{display:inline !important}#tool-fill-color.active .tool-fill-off{display:none}.dropright .caret{border-width:4px 0 4px 4px}.dropright .btn-default .caret,.dropright .btn .caret{border-color:transparent #FFF}.dropright .dropdown-menu{right:-150%;top:-100%;left:auto}#param-tool-tb .btn{color:#444;padding-top:4px;padding-bottom:4px}#param-tool-tb .btn.sldr{padding-bottom:8px}.sldr{display:inline-block}.sldr .slider .slider-track{background:rgba(0,0,0,0.15);box-shadow:0 1px 2px 0 rgba(0,0,0,0.77) inset,0 1px 0 0 rgba(255,255,255,0.4)}.sldr .slider .slider-handle{opacity:1;box-shadow:none;background-color:transparent;background-repeat:no-repeat}.sldr .slider.slider-vertical .slider-handle{background-size:20px 10px;background-position:0 5px}.sldr .slider.slider-horizontal .slider-handle{background-size:10px 20px;background-position:5px 0px}.btn-group-vertical .sldr{width:40px;padding:2px 0 10px}.btn-group-vertical .sldr [class^="adim-icon-"],.btn-group-vertical .sldr [class*=" adim-icon-"]{display:block;line-height:1.4;font-size:16px}.btn-group-vertical .sldr.btn-default:active,.btn-group-vertical .sldr.btn-default:focus{background-image:-webkit-linear-gradient(top, #fff 0, #e0e0e0 100%);background-image:-o-linear-gradient(top, #fff 0, #e0e0e0 100%);background-image:linear-gradient(to bottom, #fff 0, #e0e0e0 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);box-shadow:none}.btn-group-vertical .sldr:hover{background-position:0 -50px}.btn-group-vertical .sldr.disabled{background-image:none;background-color:#e0e0e0}.btn-group-vertical .sldr .tooltip{text-shadow:none}.btn-group-vertical .sldr .tooltip.right,.btn-group-vertical .sldr .tooltip.left{margin-top:-12px}.btn-group-vertical .sldr .tooltip.in{opacity:0.75}.btn-group-vertical .sldr .tooltip.in .tooltip-inner{opacity:1}.btn-group-vertical .sldr .tool-title{color:#AAA;letter-spacing:-0.015em;font-size:11px;text-align:center;cursor:default}.btn-group-vertical .sldr .slider.slider-vertical{height:50px;margin:3px 0 0}.btn-group-vertical .sldr.sldr-lg{width:52px}.btn-group-vertical .sldr.sldr-lg .slider.slider-vertical{margin-left:16px}.btn-group-vertical .sldr.sldr-sm{width:34px}.btn-group-vertical .sldr.sldr-sm .slider.slider-vertical{margin-left:7px}.btn-group-vertical .sldr.sldr-xs{width:24px}.btn-group-vertical .sldr.sldr-xs .slider.slider-vertical{margin-left:2px}canvas{cursor:default}canvas.cursor-tool-drawing{cursor:crosshair}canvas.cursor-tool-lines{cursor:crosshair}canvas.cursor-tool-ellipse{cursor:crosshair}canvas.cursor-tool-rectangle{cursor:crosshair}canvas.cursor-tool-text{cursor:text}canvas.cursor-tool-pan{cursor:-moz-grab;cursor:-webkit-grab;cursor:grab}canvas.cursor-tool-pan-down{cursor:-moz-grabbing;cursor:-webkit-grabbing;cursor:grabbing}canvas.cursor-tool-select{cursor:default}canvas.cursor-tool-zoom{cursor:zoom-in}canvas.cursor-tool-concordantstr{cursor:crosshair}canvas.cursor-tool-discordantstr{cursor:crosshair}canvas.cursor-tool-arrow,canvas.cursor-tool-arrow2{cursor:crosshair}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav .nav-divider.divider-vertical{height:32px;width:1px;margin:9px 10px}.navbar-inverse .nav .nav-divider{background-color:#555}.tooltip-inner{box-shadow:0 0 0 1px rgba(255,255,255,0.2)}.modal .modal-content{background-image:-webkit-linear-gradient(top, #f6f6f6 0, #d0d0d0 50px);background-image:-o-linear-gradient(top, #f6f6f6 0, #d0d0d0 50px);background-image:linear-gradient(to bottom, #f6f6f6 0, #d0d0d0 50px);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff6f6f6', endColorstr='#ffd0d0d0', GradientType=0)}.modal .modal-content .modal-header{border-color:rgba(0,0,0,0.2)}.modal .modal-content .modal-header .modal-title{line-height:1;font-weight:700;color:#666;text-shadow:0 1px 0 rgba(255,255,255,0.66)}.modal .modal-content .modal-footer{border-color:rgba(0,0,0,0.2)}.modal .modal-content .modal-body{background-color:#fff}.modal .modal-content .modal-body .nav-tabs li{font-weight:600}.btn-adim-layertb{color:#555;background-color:#aaa;border-color:#777}.btn-adim-layertb:hover,.btn-adim-layertb:focus,.btn-adim-layertb.focus,.btn-adim-layertb:active,.btn-adim-layertb.active,.open>.dropdown-toggle.btn-adim-layertb{color:#555;background-color:#919191;border-color:#585858}.btn-adim-layertb:active,.btn-adim-layertb.active,.open>.dropdown-toggle.btn-adim-layertb{background-image:none}.btn-adim-layertb .badge{color:#aaa;background-color:#555}.theme-light .btn-adim-layertb{color:#555;background-color:#f0f0f0;border-color:#c0c0c0}.theme-light .btn-adim-layertb:hover,.theme-light .btn-adim-layertb:focus,.theme-light .btn-adim-layertb.focus,.theme-light .btn-adim-layertb:active,.theme-light .btn-adim-layertb.active,.open>.dropdown-toggle.theme-light .btn-adim-layertb{color:#555;background-color:#d7d7d7;border-color:#a1a1a1}.theme-light .btn-adim-layertb:active,.theme-light .btn-adim-layertb.active,.open>.dropdown-toggle.theme-light .btn-adim-layertb{background-image:none}.theme-light .btn-adim-layertb .badge{color:#f0f0f0;background-color:#555}.btn-adim-dark{color:#c4c4c4;background-color:#767676;border-color:#9c9c9c}.btn-adim-dark:hover,.btn-adim-dark:focus,.btn-adim-dark.focus,.btn-adim-dark:active,.btn-adim-dark.active,.open>.dropdown-toggle.btn-adim-dark{color:#c4c4c4;background-color:#5d5d5d;border-color:#7e7e7e}.btn-adim-dark:active,.btn-adim-dark.active,.open>.dropdown-toggle.btn-adim-dark{background-image:none}.btn-adim-dark .badge{color:#767676;background-color:#c4c4c4}.btn-cimaf-layer{color:#aaa;background-color:#696969;border-color:#909090}.btn-cimaf-layer:hover,.btn-cimaf-layer:focus,.btn-cimaf-layer.focus,.btn-cimaf-layer:active,.btn-cimaf-layer.active,.open>.dropdown-toggle.btn-cimaf-layer{color:#aaa;background-color:#505050;border-color:#717171}.btn-cimaf-layer:active,.btn-cimaf-layer.active,.open>.dropdown-toggle.btn-cimaf-layer{background-image:none}.btn-cimaf-layer .badge{color:#696969;background-color:#aaa}.btn-cimaf-layer:hover{background-color:#838383;border-color:#bbb}.btn-cimaf-layer.active{color:#fff;background-color:#68ac68;border-color:#4cae4c}.theme-light .btn-cimaf-layer{font-weight:bold;letter-spacing:0.3px}.form-control::-moz-placeholder{color:#ccc;opacity:1}.form-control:-ms-input-placeholder{color:#ccc}.form-control::-webkit-input-placeholder{color:#ccc}#aom-modal .modal-body{padding:10px 0 0}#aom-modal .modal-body .nav-tabs{margin-left:10px}#aom-modal .modal-body .tab-content{min-height:200px;border-right:solid 1px #e0e0e0}@media (min-height:370px){#aom-modal .aom-list-container{max-height:220px;height:auto}}@media (min-height:590px){#aom-modal .aom-list-container{max-height:440px;height:auto}}@media (min-height:810px){#aom-modal .aom-list-container{max-height:660px;height:auto}}@media (min-height:1030px){#aom-modal .aom-list-container{max-height:880px;height:auto}}@media (min-width:500px){#aom-modal .modal-dialog{width:420px}#aom-modal .modal-dialog .narrow-1{width:218px}#aom-modal .modal-dialog .narrow-2{width:auto}}@media (min-width:700px){#aom-modal .modal-dialog{width:620px}#aom-modal .modal-dialog .narrow-1{width:418px}#aom-modal .modal-dialog .narrow-2{width:218px}}@media (min-width:900px){#aom-modal .modal-dialog{width:820px}#aom-modal .modal-dialog .narrow-1{width:618px}#aom-modal .modal-dialog .narrow-2{width:418px}}@media (min-width:1100px){#aom-modal .modal-dialog{width:1020px}#aom-modal .modal-dialog .narrow-1{width:818px}#aom-modal .modal-dialog .narrow-2{width:618px}}@media (min-width:1300px){#aom-modal .modal-dialog{width:1220px}#aom-modal .modal-dialog .narrow-1{width:1018px}#aom-modal .modal-dialog .narrow-2{width:818px}}.aom-info-panel{float:right;width:401px;border:0;box-shadow:none;border-radius:0;margin-bottom:0;border-left:solid 1px #e0e0e0}.aom-info-panel .panel-heading{border:0;border-bottom:solid 1px #d0d0d0;border-radius:0;padding:5px 10px;background-color:#eaeaea;color:#666}.aom-info-panel .panel-heading h5{font-weight:600;padding:0;margin:0;font-size:12px}.aom-info-panel .panel-body{overflow-x:hidden;overflow-y:auto;font-size:12px;padding:0}@media (min-height:370px){.aom-info-panel .panel-body{max-height:196px;height:auto}}@media (min-height:590px){.aom-info-panel .panel-body{max-height:416px;height:auto}}@media (min-height:810px){.aom-info-panel .panel-body{max-height:636px;height:auto}}@media (min-height:1030px){.aom-info-panel .panel-body{max-height:856px;height:auto}}.aom-info-panel .panel-body .aom-image-thumb{width:180px;height:180px;background-color:rgba(128,128,128,0.1);border-color:#d0d0d0;border-style:solid;border-width:0 1px 1px 0;margin:0 10px 10px 0;float:left}.aom-info-panel .panel-body dl.aom-info-prop{margin-top:15px;padding-right:10px}.aom-info-panel .panel-body dl.aom-info-prop dd{margin-bottom:1.4em}.aom-info-panel .panel-body hr{clear:both;margin:5px}.aom-info-panel .panel-body .aom-prop-url{font-size:10px;color:#808080;height:24px;padding:4px}.aom-info-panel .panel-body .aom-prop-url-copy-but{padding:2px 4px 0px 6px;height:24px}.aom-info-panel .panel-body .aom-prop-url-copy-but .adim-icon-clippy{font-size:16px}.aom-info-panel .panel-body .tooltip{font-weight:200;letter-spacing:1px;font-size:10px}.aom-info-panel .panel-body .aom-prop-lock-but{margin-top:-5px}.aom-info-panel .panel-body .aom-prop-unlocked-status,.aom-info-panel .panel-body .aom-prop-locked-status{display:none}.aom-info-panel .panel-body .aom-prop-unlocked .aom-prop-unlocked-status{display:inline}.aom-info-panel .panel-body .aom-prop-unlocked .aom-prop-locked-status{display:none}.aom-info-panel .panel-body .aom-prop-locked .aom-prop-unlocked-status{display:none}.aom-info-panel .panel-body .aom-prop-locked .aom-prop-locked-status{display:inline}.aom-info-panel .panel-body .aom-prop-locked .aom-prop-locked-status.alert{display:block;margin:5px 15px 10px;padding:10px}.aom-info-panel .panel-body .aom-prop-locked .popover{color:#333;font-size:12px}.aom-info-panel .panel-body .aom-prop-locked .popover-title{font-size:12px;font-weight:bold}.aom-info-panel .panel-body .aom-prop-locked .help-block{display:none}.aom-info-panel .panel-body .aom-prop-locked-info{cursor:pointer}.aom-info-panel .panel-body .aom-prop-locked-info:hover{text-decoration:underline}.aom-info-panel .panel-body .aom-info-share h5{margin:10px 15px}.aom-info-panel .panel-body .aom-info-share .control-label{text-align:left}.aom-info-panel .panel-body .aom-info-share .checkbox{padding-top:0}.aom-info-panel .panel-body .aom-info-share .checkbox input[type=checkbox]{top:-2px}.aom-info-panel .panel-body .aom-info-share .form-horizontal .form-group{margin-left:0;margin-right:0}.aom-info-panel .panel-body .aom-info-share .form-group label.col-sm-12{text-align:left;margin-bottom:5px}.aom-info-panel .panel-body .aom-info-share .aom-shm-ctrl-members-list{margin-top:5px;margin-bottom:5px}.aom-info-panel .panel-body .aom-info-share .aom-shm-ctrl-members-list .aom-shm-ctrl-unregistred-member{font-style:italic;color:#6f6f6f}.aom-info-panel .panel-body .aom-info-share form{position:relative;overflow:hidden}.aom-info-panel .panel-body .aom-info-share form .aom-shm-frontdrop{background:none repeat scroll 0 0 rgba(255,255,255,0.5);cursor:not-allowed;height:800px;left:0;position:absolute;top:0;width:100%;z-index:100}#aom-shared-images-list .aom-list-item .btn-toolbar .aom-item-sh-status{display:none}.aom-list-container{overflow-y:auto;overflow-x:hidden}.aom-list-container .popover .popover-title{font-size:12px;font-weight:500}.aom-list-container .popover .popover-content{font-size:12px}.aom-list-container .popover .popover-content .dl-horizontal dt{width:80px;font-weight:400;font-style:italic}.aom-list-container .popover .popover-content .dl-horizontal dd{margin-left:90px}.aom-list-container .aom-loader{text-align:center;margin-top:80px;opacity:0.66}.aom-list-container .aom-empty-list-msg{display:none;margin:50px}.aom-list-container .aom-empty-list-msg:last-child{display:block}#aom-dropzone{margin-top:20px}#aom-dropzone .lead{margin-bottom:0}#aom-dropzone.dragover .well{background:#999}.aom-image-thumb{width:150px;height:150px;background-position:50% 50%;background-repeat:no-repeat}.aom-list-item{border:1px solid #a4a4a4;border-radius:4px;display:inline-block;text-align:center;width:180px;height:200px;margin:10px 10px;background-color:rgba(128,128,128,0.1);color:#646464;cursor:pointer}.aom-list-item.selected{box-shadow:0 0 2px 2px #66afe9;border-color:#66afe9}.aom-list-item.current{box-shadow:0 0 0 1px #fa3 inset;border-color:#fa3}.aom-list-item.current.selected{box-shadow:0 0 2px 2px #fa3,0 0 0 1px #fa3 inset}.aom-list-item .close{font-size:16px;margin-right:2px;opacity:0.1}.aom-list-item .btn-toolbar{margin-left:3px;opacity:0.5}.aom-list-item a,.aom-list-item .item-body{color:#646464;text-decoration:none;display:block;margin-top:20px;cursor:pointer}.aom-list-item a:hover,.aom-list-item .item-body:hover{color:#505050}.aom-list-item a:focus,.aom-list-item .item-body:focus{outline:none}.aom-list-item img{width:150px;height:150px;background-position:50% 50%;background-repeat:no-repeat;opacity:0.8}.aom-list-item .name{display:block;padding:3px 0 5px;margin:0 3px;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.aom-list-item:hover{border-color:#8b8b8b;background-color:#fff}.aom-list-item:hover img{opacity:1}.aom-list-item:hover .close{opacity:.25}.aom-list-item:hover.current{border-color:#fa3}span.twitter-typeahead .tt-dropdown-menu {
position: absolute;
top: 100%;
left: 0;
......
......@@ -12671,7 +12671,7 @@ _addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b
!0,b,c)},remove:function(a,b){g(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams=
b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var f=e;f.Signal=e;typeof define==="function"&&define.amd?define('signals',[],function(){return f}):typeof module!=="undefined"&&module.exports?module.exports=f:i.signals=
f})(this);
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/config',["jquery"],function(a){var b="ADIM_CONFIG",c=a.extend(!0,{MODE_EDIT:"edit",MODE_REVIEW:"review",MODE_ANALYSIS:"analysis",adim_global_varname:"ADIM",annotable:{image:"image/",thumbnail:"thumb/"},image_url:"",autoSaveThumbnail:!0,io:{},userEngine:{limit:7,remoteUrl:"http://path/to/suggestion/url/?q=%QUERY",rateLimitWait:300},ui:{show_side_col:!0,show_users_results:!1,show_annot_properties:!0},uploadMaxFileSize:2},window[b]||{},!0);return c.csrfToken&&a.ajaxSetup({beforeSend:function(a){a.setRequestHeader("X-CSRFToken",c.csrfToken)}}),c});
// Underscore.js 1.7.0
// http://underscorejs.org
......@@ -13417,35 +13417,35 @@ define("bloodhound", ["jquery"], (function (global) {
};
}(this)));
 
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/users',["jquery","underscore","bloodhound","adim/config"],function(a,b,c,d){function e(){i=new c({datumTokenizer:function(a){return c.tokenizers.nonword(a.username)},queryTokenizer:c.tokenizers.whitespace,limit:d.userEngine.limit,remote:{url:d.userEngine.remoteUrl,rateLimitWait:d.userEngine.rateLimitWait}}),i.initialize()}function f(b){a.isArray(b)&&b.length>=0&&i.add(b)}function g(a){var c=b.find(i.index.datums,function(b){return b.id==a});return c?c.username:""}function h(c){var d=a.Deferred(),e=b.find(i.index.datums,function(a){return a.id==c});return e?d.resolve(e.username):d.reject(),d}var i=null;return e(),{engine:i,addUsers:f,getById:g,searchById:h}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('helper/utils',["paper"],function(a){function b(a,b){b=b===!0,a&&(a.data&&a.data.selectListeners&&a.attach(a.data.selectListeners),b&&"function"==typeof a.setSelected&&a.setSelected(!0))}function c(b,c){c=c?c:a.project.getSelectedItems(),b=b===!0;for(var d,e=0;d=c[e];e++)d.data&&d.data.selectListeners&&d.detach(d.data.selectListeners),b&&(d.fullySelected=d.selected=!1)}function d(){var b=[];return a.project.getSelectedItems().map(function(a){a.parent&&a.parent.data&&a.parent.data.type&&-1===b.indexOf(a.parent)?b.push(a.parent):a.data&&a.data.type&&-1===b.indexOf(a)&&b.push(a)}),b}return{addSelectListeners:b,removeSelectListeners:c,getSelectedAnnotations:d}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/select',["paper","adim/config","helper/utils"],function(a,b,c){function d(a,b){var c=a.hitTest(b.point,n);switch(i=j=k=null,v=w=x=y=null,c.type){case"handle-in":case"handle-out":if(a.selected){var d=c.type.split("-");k=d[1],i=c.segment}break;case"segment":i=c.segment;break;case"fill":case"stroke":b.modifiers.shift||(a.data&&"function"==typeof a.data.setDragMode?a.data.setDragMode("FULL_DRAG",{item:c.item}):j=!0);break;case"bounds":var e=c.name.split("-");if(["shape","ellipse","rectangle","circle"].indexOf(c.item.type)>-1)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else{var f="bottom"===e[0]?"top":"bottom";f+="left"===e[1]?"Right":"Left";var g=["right"===e[1]?1:-1,"bottom"===e[0]?1:-1];c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e,item:c.item,fixedPt:c.item.bounds[f],resizeDir:g})}else if("arrow"===c.item.data.type&&"right"===e[1])try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e})}catch(h){}else if("text"===c.item.data.type)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{item:c.item,nameStr:c.name,nameParts:e})}catch(h){}}}function e(a){var b=a.point.subtract(i.point),c=a.lastPoint.subtract(i.point),d=b.angle-c.angle,e=!a.modifiers.option;"in"===k?(i.handleIn=b,e&&(i.handleOut.angle+=d)):(i.handleOut=b,e&&(i.handleIn.angle+=d))}function f(b){var c,d,e;c=new a.Rectangle({from:w,to:b.point}).size,b.event.shiftKey&&(e=v.bounds.size.width/v.bounds.size.height,c.height=c.width/e),d=c.subtract(v.bounds.size).multiply(x).divide(2),v.size=c,v.translate(d.width,d.height)}function g(a,b){a.data&&"function"==typeof a.data.itemMouseDrag?a.data.itemMouseDrag.call(a,b):v?f(b):k&&i.path.id===a.id?e(b):i&&i.path.id===a.id?i.point=b.point:j&&a.translate(b.delta),r=!0}function h(){}var i,j,k,l="select",m={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!1,handles:!1},n={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!0,handles:!0},o=b.mode===b.MODE_EDIT,p=!o,q=null,r=!1,s=null,t={annotationAdded:null,annotationChanged:null,annotationSelected:null},u=null,v=null,w=null,x=[1,1],y=null,z={tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0},A={onMouseDown:function(b){i=j=k=v=w=null;var e=p?a.project.hitTest(b.point,m):a.project.activeLayer.hitTest(b.point,z);if(e||(e=p?a.project.hitTest(b.point,m):a.project.activeLayer.hitTest(b.point,m)),!o)return a.project.deselectAll(),t.annotationSelected.dispatch(null),a.view.draw(),void("pixel"!==e.type&&(q=e&&e.item,q&&q.parent.data.type&&(q=q.parent),q.data.type&&(q.selected=!0),t.annotationSelected.dispatch(q)));var f=c.getSelectedAnnotations();if(1===f.length&&(!e||"pixel"===e.type||e.item.id!==f[0].id)){var g=a.project.activeLayer.hitTest(b.point,n);g&&g.item===f[0]&&(e=g)}var h=b.modifiers.shift&&o;if(q=e&&e.item,q&&q.parent&&q.parent.data&&q.parent.data.type&&(q=q.parent),q&&(q.selected||h)||(a.project.deselectAll(),t.annotationSelected.dispatch(null)),q){if(q.layer&&"image"===q.layer.name)return;q.selected?(r=!1,h&&"bounds"!==e.type?q.fullySelected=!1:q.responds("mousedown")&&"bounds"!==e.type||d(q,b)):("group"===q.type?"function"==typeof q.oSetSelected?!q.selected&&q.oSetSelected(!0):q.children.map(function(a){a.selected=!0}):-1===["handle-in","handle-out"].indexOf(e.type)&&(q.selected=!0,q.responds("mousedown")&&q.onMouseDown(b)),o&&q.selected&&"path"===q.type),t.annotationSelected.dispatch(q)}},onMouseDrag:function(a){if(o){var b=c.getSelectedAnnotations();if(1===b.length)q.responds("mousedrag")||g(q,a);else{r=!0;for(var d,e=0;d=b[e];e++)d.parent&&d.parent.data&&d.parent.data.type&&(d=d.parent),d.data.type&&(d===q&&d.responds("mousedrag")||d.translate(a.delta)),d=null}}},onMouseUp:function(b){u&&(u.remove(),u=null);var c=[];a.project.getSelectedItems().map(function(a){-1===c.indexOf(a)&&(a.data.type?c.push(a):a.parent.data.type&&-1===c.indexOf(a.parent)&&c.push(a.parent))}),o&&(q&&1===c.length&&(q.responds("mouseup")||h(q,b)),r&&(t.annotationChanged.dispatch(c),r=!1))},onKeyDown:function(b){var c=a.project.getSelectedItems();if(o)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyDown){d.onKeyDown(b);break}},onKeyUp:function(b){var c=a.project.getSelectedItems();if(o)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyUp){d.onKeyUp(b);break}}};return s=new a.Tool(A),{name:l,tool:s,registerEvent:function(a,b){t[a]=b},_tools:null}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/select',["paper","adim/config","helper/utils"],function(a,b,c){function d(a,b){var c=a.hitTest(b.point,p);switch(k=l=m=null,w=x=y=z=null,c.type){case"handle-in":case"handle-out":if(a.selected){var d=c.type.split("-");m=d[1],k=c.segment}break;case"segment":k=c.segment;break;case"fill":case"stroke":b.modifiers.shift||(a.data&&"function"==typeof a.data.setDragMode?a.data.setDragMode("FULL_DRAG",{item:c.item}):l=!0);break;case"bounds":var e=c.name.split("-");if(["shape","ellipse","rectangle","circle"].indexOf(c.item.type)>-1)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else{var f="bottom"===e[0]?"top":"bottom";f+="left"===e[1]?"Right":"Left";var g=["right"===e[1]?1:-1,"bottom"===e[0]?1:-1];c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e,item:c.item,fixedPt:c.item.bounds[f],resizeDir:g})}else if("arrow"===c.item.data.type&&"right"===e[1])try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e})}catch(h){}else if("text"===c.item.data.type)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{item:c.item,nameStr:c.name,nameParts:e})}catch(h){}}}function e(a){var b=a.point.subtract(k.point),c=a.lastPoint.subtract(k.point),d=b.angle-c.angle,e=!a.modifiers.option;"in"===m?(k.handleIn=b,e&&(k.handleOut.angle+=d)):(k.handleOut=b,e&&(k.handleIn.angle+=d))}function f(b){var c,d,e;c=new a.Rectangle({from:x,to:b.point}).size,b.event.shiftKey&&(e=w.bounds.size.width/w.bounds.size.height,c.height=c.width/e),d=c.subtract(w.bounds.size).multiply(y).divide(2),w.size=c,w.translate(d.width,d.height)}function g(a,b){a.data&&"function"==typeof a.data.itemMouseDrag?a.data.itemMouseDrag.call(a,b):w?f(b):m&&k.path.id===a.id?e(b):k&&k.path.id===a.id?k.point=b.point:l&&a.translate(b.delta),t=!0}function h(){}function i(a){return r=a,q=!a,a}var j,k,l,m,n="select",o={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!1,handles:!1},p={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!0,handles:!0},q=b.mode===b.MODE_EDIT,r=!q,s=null,t=!1,u={annotationAdded:null,annotationChanged:null,annotationSelected:null},v=null,w=null,x=null,y=[1,1],z=null,A={tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0},B={onMouseDown:function(b){k=l=m=w=x=null;var e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,A);if(e||(e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,o)),!q)return a.project.deselectAll(),u.annotationSelected.dispatch(null),a.view.draw(),void("pixel"!==e.type&&(s=e&&e.item,s&&s.parent.data.type&&(s=s.parent),s.data.type&&(s.selected=!0),u.annotationSelected.dispatch(s)));var f=c.getSelectedAnnotations();if(1===f.length&&(!e||"pixel"===e.type||e.item.id!==f[0].id)){var g=a.project.activeLayer.hitTest(b.point,p);g&&g.item===f[0]&&(e=g)}var h=b.modifiers.shift&&q;if(s=e&&e.item,s&&s.parent&&s.parent.data&&s.parent.data.type&&(s=s.parent),s&&(s.selected||h)||(a.project.deselectAll(),u.annotationSelected.dispatch(null)),s){if(s.layer&&"image"===s.layer.name)return;s.selected?(t=!1,h&&"bounds"!==e.type?s.fullySelected=!1:s.responds("mousedown")&&"bounds"!==e.type||d(s,b)):("group"===s.type?"function"==typeof s.oSetSelected?!s.selected&&s.oSetSelected(!0):s.children.map(function(a){a.selected=!0}):-1===["handle-in","handle-out"].indexOf(e.type)&&(s.selected=!0,s.responds("mousedown")&&s.onMouseDown(b)),q&&s.selected&&"path"===s.type),u.annotationSelected.dispatch(s)}},onMouseDrag:function(a){if(q){var b=c.getSelectedAnnotations();if(1===b.length)s.responds("mousedrag")||g(s,a);else{t=!0;for(var d,e=0;d=b[e];e++)d.parent&&d.parent.data&&d.parent.data.type&&(d=d.parent),d.data.type&&(d===s&&d.responds("mousedrag")||d.translate(a.delta)),d=null}}},onMouseUp:function(b){v&&(v.remove(),v=null);var c=[];a.project.getSelectedItems().map(function(a){-1===c.indexOf(a)&&(a.data.type?c.push(a):a.parent.data.type&&-1===c.indexOf(a.parent)&&c.push(a.parent))}),q&&(s&&1===c.length&&(s.responds("mouseup")||h(s,b)),t&&(u.annotationChanged.dispatch(c),t=!1))},onKeyDown:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyDown){d.onKeyDown(b);break}},onKeyUp:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyUp){d.onKeyUp(b);break}}};return j=new a.Tool(B),{name:n,tool:j,setRo:i,registerEvent:function(a,b){u[a]=b},_tools:null}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/pan',["paper"],function(a){var b={onMouseDrag:function(b){var c=b.point.subtract(b.downPoint).multiply(-1);a.project.view.scrollBy(c),a.project.view.draw()},onMouseDown:function(){jQuery(a.view.element).addClass("cursor-tool-pan-down")},onMouseUp:function(){jQuery(a.view.element).removeClass("cursor-tool-pan-down")}};return{name:"pan",tool:new a.Tool(b)}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/drawing',["paper"],function(a){function b(b){b.data.prop="object"==typeof b.data.prop?b.data.prop:{};for(var d in i)b.data.prop.hasOwnProperty(d)||(b.data.prop[d]=i[d]);b.onPropertyChange=c,b.onDoubleClick=function(){this.selected=!1,this.fullySelected=!0,a.view.draw()}}function c(b,c){"confidence"===b?(this.style=j[c],a.view.draw()):"processus"===b||"fill"===b&&(this.closed=c,a.view.draw())}function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,c){var d=c.importJSON(a);return b(d),d}var f="drawing",g=null,h={annotationAdded:null,annotationSelected:null},i={comment:"",confidence:3,fill:!1},j={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}},k={onMouseDown:function(b){a.project.deselectAll(),g=new a.Path({fillColor:null,strokeCap:"round"}),g.add(b.point)},minDistance:5,onMouseDrag:function(a){g&&g.add(a.point)},onMouseUp:function(){if(g){g.simplify(20);var c=g.clone();g.remove(),g=null,c.data.type=f,c.data.tId="a"+c._id,b(c),a.view.draw(),c.fullySelected=!0,"function"==typeof h.annotationSelected.dispatch&&h.annotationSelected.dispatch(c),"function"==typeof h.annotationAdded.dispatch&&h.annotationAdded.dispatch(c)}}};return{name:f,tool:new a.Tool(k),registerEvent:function(a,b){h[a]=b},exportJSON:d,importJSON:e}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/drawing',["paper"],function(a){function b(b){b.data.prop="object"==typeof b.data.prop?b.data.prop:{};for(var d in k)b.data.prop.hasOwnProperty(d)||(b.data.prop[d]=k[d]);b.onPropertyChange=c,b.onDoubleClick=function(){i||(this.selected=!1,this.fullySelected=!0,a.view.draw())}}function c(b,c){"fill"===b&&(this.closed=c,a.view.draw())}function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,c){var d=c.importJSON(a);return b(d),d}function f(a){return a!==i&&(i=a),i}var g="drawing",h=null,i=!1,j={annotationAdded:null,annotationSelected:null},k={comment:"",confidence:3,fill:!1},l={onMouseDown:function(b){a.project.deselectAll(),h=new a.Path({fillColor:null,strokeCap:"round"}),h.add(b.point)},minDistance:5,onMouseDrag:function(a){h&&h.add(a.point)},onMouseUp:function(){if(h){h.simplify(20);var c=h.clone();h.remove(),h=null,c.data.type=g,c.data.tId="a"+c._id,b(c),a.view.draw(),c.fullySelected=!0,"function"==typeof j.annotationSelected.dispatch&&j.annotationSelected.dispatch(c),"function"==typeof j.annotationAdded.dispatch&&j.annotationAdded.dispatch(c)}}};return{name:g,tool:new a.Tool(l),setRo:f,registerEvent:function(a,b){j[a]=b},exportJSON:d,importJSON:e}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/lines',["paper","helper/utils"],function(a){function b(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(a,b){var c=b.importJSON(a);return d(c),c}function d(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in p)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=p[b]);a.onPropertyChange=e}function e(b,c){"confidence"===b?(this.style=q[c],a.view.draw()):"processus"===b||"fill"===b&&(this.closed=c,a.view.draw())}function f(){if(n=null,k&&k.remove(),i=!1,h.length>l){var b=h.clone();b.style=a.project.currentStyle,b.strokeCap="round",b.strokeJoin="round",b.fillColor=null,b.data.type=g,b.data.tId="a"+b._id,d(b),b.selected=!0,"function"==typeof o.annotationSelected.dispatch&&o.annotationSelected.dispatch(b),"function"==typeof o.annotationAdded.dispatch&&o.annotationAdded.dispatch(b)}h.remove()}var g="lines",h=null,i=!1,j=!1,k=null,l=5,m=!1,n=null,o={annotationAdded:null,annotationChanged:null},p={comment:"",confidence:3,fill:!1},q={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}},r={segments:!0,stroke:!0,tolerance:5},s={onMouseDown:function(b){if(i){if(h){if(b.point.subtract(b.lastPoint).length<l)return void f();k&&k.remove(),h.add(b.point)}}else{var c=a.project.activeLayer.hitTest(b.point,r);if(c&&c.item&&c.item.selected&&c.item.data.type===g)if(h=c.item,"stroke"===c.type){var d=c.location;k=h.insert(d.index+1,b.point),j=!0}else"segment"===c.type&&(b.modifiers.option?(c.segment.remove(),o.annotationChanged.dispatch(c.item)):(k=c.segment,j=!0));else a.project.deselectAll(),h=new a.Path({strokeColor:a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor,fillColor:null,strokeCap:"round",strokeJoin:"round"}),i=!0,h.add(b.point)}},onMouseMove:function(b){i?(n=b.point,k&&k.remove(),k=new a.Path(b.downPoint,b.point),k.strokeColor=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor):j&&k&&(m=!0,k.point=b.point)},onMouseUp:function(){j&&(j=!1,k&&(m&&(m=!1,o.annotationChanged.dispatch(k.path)),k=null))},onKeyDown:function(a){switch(a.key){case"enter":i&&h&&(n&&h.add(n),f());break;case"escape":i&&h&&f()}}};return{name:g,tool:new a.Tool(s),registerEvent:function(a,b){o[a]=b},exportJSON:b,importJSON:c}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/Shape.class',["paper"],function(){return function(a,b){function c(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function d(a,b){var c=b.importJSON(a);return h(c),c}function e(a){var b=["ellipse","rectangle"];return!!a&&a.data&&a.data.type&&b.indexOf(a.data.type)>-1}function f(b,c){var d;if(b.modifiers.shift)var e=o.subtract(p).length/1.414213,f=p.subtract(o).quadrant,g=2===f||3===f?-e:e,h=3===f||4===f?-e:e;switch(a){case"circle":d=new paper.Shape.Circle({center:o,radius:o.subtract(p).length});break;case"ellipse":d=new paper.Shape.Ellipse(b.modifiers.shift?{point:o,size:[g,h]}:{from:o,to:p});break;case"rectangle":d=new paper.Shape.Rectangle(b.modifiers.shift?{point:o,size:[g,h]}:{from:o,to:p})}return d.data.type=a,c&&d.set("style",c),d}function g(a){n&&n.remove(),q&&(n=f(a))}function h(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in v)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=v[b]);a.onPropertyChange=i,a.data.exportJSON=function(a){return function(b){return c.call(a,b)}}(a),a.data.setDragMode=l,a.data.itemMouseDrag=m}function i(a,b){"confidence"===a&&(this.style=w[b],paper.view.draw())}function j(a){var c,d;if(c=paper.project.activeLayer.hitTest(a,{tolerance:7,fill:!0,stroke:!0,bounds:!0,selected:!0}),c||(c=paper.project.activeLayer.hitTest(a,{fill:!0,stroke:!0})),!c||!e(c.item))return!1;if(d=c.item,d.selected||(paper.project.deselectAll(),d.selected=!0,b.annotationSelected.dispatch(d)),"bounds"===c.type&&"center"!==c.name.split("-")[1]){var f=c.name.split("-"),g="bottom"===f[0]?"top":"bottom";g+="left"===f[1]?"Right":"Left";var h=["right"===f[1]?1:-1,"bottom"===f[0]?1:-1];l("DRAG_HANDLE",{nameStr:c.name,nameParts:f,item:c.item,fixedPt:c.item.bounds[g],resizeDir:h})}else l("FULL_DRAG",{item:d});return!0}function k(a){var b,c,d;b=new paper.Rectangle({from:s.fixedPt,to:a.point}).size,a.event.shiftKey&&(d=s.item.bounds.size.width/s.item.bounds.size.height,b.height=b.width/d),c=b.subtract(s.item.bounds.size).multiply(s.resizeDir).divide(2),s.item.size=b,s.item.translate(c.width,c.height)}function l(a,b){!a in u?(r=null,s={},t=!1):(r=u[a],s=b)}function m(a){switch(t=!0,r){case u.FULL_DRAG:this.translate(a.delta);break;case u.DRAG_HANDLE:k(a)}}var n,o,p,q=!1,r=null,s={},t=!1,u={FULL_DRAG:1,DRAG_HANDLE:4},v={comment:"",confidence:3,fill:!0},w={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}};return{exportJSON:c,importJSON:d,onKeyDown:function(a){n&&g(a)},onKeyUp:function(a){g(a)},onMouseDown:function(a){q=t=!1,j(a.point)||(paper.project.deselectAll(),b.annotationSelected.dispatch(null),paper.project.deselectAll(),q=!0,o=a.point,p=o)},onMouseDrag:function(a){q?(p=a.point,g(a)):r&&s.item&&m.call(s.item,a)},onMouseUp:function(a){if(q){if(p=a.point,g(a),q=!1,n&&n.remove(),n=null,a.delta.length>5){var c=f(a);c.data.tId="a"+c._id,c.selected=!0,h(c),b&&"function"==typeof b.annotationAdded.dispatch&&b.annotationAdded.dispatch(c)}paper.view.draw()}else t&&s.item&&(b.annotationChanged.dispatch(s.item),t=!1)}}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/ellipse',["paper","tools/Shape.class"],function(a,b){var c="ellipse",d={annotationAdded:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/rectangle',["paper","tools/Shape.class"],function(a,b){var c="rectangle",d={annotationAdded:null,annotationSelected:null,annotationChanged:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/text',["paper","jquery"],function(a,b){function c(a,b){!a in u?(v=null,w={},x=!1):(v=u[a],w=b)}function d(a){switch(v){case u.DRAG_HANDLE:if("center"===w.nameParts[1])return;var b=w.item.bounds,c="top"===w.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===w.nameParts[0]&&(e[1]=c-b.height),d>9&&999>d&&i.call(w.item,d),w.item.translate(e);break;case u.FULL_DRAG:default:this.translate(a.delta)}}function e(a){a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=c,a.data.itemMouseDrag=d}function f(c){n&&g(!1),n=!0,p||(p=b("<input>",{type:"text","class":"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){n&&g()}).on("keydown",function(a){(27===a.which||13==a.which)&&g()}).autoGrowInput(),q=q||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){g()}),p.before(q)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;p.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),q.show();var f=p.nextAll("tester");f.css({fontSize:p.css("fontSize"),fontFamily:p.css("fontFamily"),fontWeight:p.css("fontWeight"),letterSpacing:p.css("letterSpacing")}),f.text(""===c.data.content?p.attr("placeholder"):c.data.content),p.width(f.width()+30),o=c,setTimeout(function(){p.focus()},100)}function g(b){if(b=!(b===!1),n=!1,o){var c=p.val();if(c&&""!==c){var d=""===o.data.content;o.data.content=c,o.children[0].content=c,o.children[1].content=c,o.visible=!0,b&&r.annotationSelected&&"function"==typeof r.annotationSelected.dispatch&&r.annotationSelected.dispatch(o),d?(e(o),r.annotationAdded&&"function"==typeof r.annotationAdded.dispatch&&r.annotationAdded.dispatch(o)):r.annotationChanged&&"function"==typeof r.annotationChanged.dispatch&&r.annotationChanged.dispatch(o),o.oSetSelected(b),a.project.view.draw()}else o.remove(),o=null}q.hide(),p.val("").blur().hide()}function h(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function i(a){var b=this,c=a/10;3>c&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function j(){return this.children[0].fontSize}function k(a,c,d){var g=c.importJSON(a);return b.extend(g.data,{setColor:h,setFill:t,setStrokeWidth:t,setFontSize:i,getFontSize:j}),e(g),d&&g.children[1].on("doubleclick",function(){f(this.parent)}),g}function l(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}var m="text",n=!1,o=null,p=null,q=null,r={annotationAdded:null,annotationChanged:null,annotationSelected:null},s={type:"point-text",tolerance:5,fill:!0},t=function(){},u={FULL_DRAG:1,DRAG_HANDLE:4},v=null,w={},x=!1,y={onMouseDown:function(b){var c=a.project.activeLayer.hitTest(b.point,s);if(c){var d=c.item.parent;f(d)}else{var e=a.project.currentStyle.fontSize;if(n)g();else{a.project.deselectAll();var k=b.point,l=new a.PointText({point:k,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),p=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;p=p.toCSS();var q=new a.PointText({point:k,fillColor:p,strokeColor:p,strokeWidth:0,content:""});q.on("doubleclick",function(){f(this.parent)}),o=new a.Group({children:[l,q],data:{type:m,setColor:h,setFill:t,setStrokeWidth:t,setFontSize:i,getFontSize:j,content:"",color:p}}),o.data.tId="a"+o._id,o.data.content="",f(o)}}}};return{name:m,tool:new a.Tool(y),exportJSON:l,importJSON:k,registerEvent:function(a,b){r[a]=b}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/arrow',["paper"],function(a){function b(a){var b=(this.data.from,this.data.to,this.exportJSON({asString:!1}));try{b[1][1].data.from=[this.data.from.x,this.data.from.y],b[1][1].data.to=[this.data.to.x,this.data.to.y]}catch(c){}return a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1][1],f=b[0][1][e.symbol][1][1],h=f.fillColor&&(f.fillColor.length<3||0!==f.fillColor[3]),i=parseFloat(e.opacity)||1,k=a.project.activeLayer;c.activate(),e.data.from.length>2&&(e.data.from=e.data.from.splice(1)),e.data.to.length>2&&(e.data.to=e.data.to.splice(1));var m=g({from:new a.Point(e.data.from),prop:e.data.prop,scale:e.data.scale||{h:1,v:1}},d);return m.opacity=i,j.call(m,f.strokeColor),l.call(m,h),n.call(m,f.strokeWidth),u(m,{from:m.data.from,to:new a.Point(e.data.to)}),k.activate(),m}function d(){if(!x){var b=new a.Path({segments:[[0,-5],[0,5],new a.Segment([20,5]),[10,30],new a.Segment([50,0]),[10,-30],new a.Segment([20,-5])],strokeJoin:"round",strokeScaling:!1,closed:!0});y=1,z=3,A=4,B=b.segments[z].point.x-b.segments[y].point.x,x=new a.Symbol(b),b.remove()}}function e(a,b){b=b||this;var c=b.symbol.definition.segments[2].point.x,d=b.symbol.definition.segments[A].point.x,e=b.globalToLocal(a).x;return(e-c)/(d-c)>.1}function f(a,b){b=b||this,a=a||b.symbol.definition.segments[A].point.x-b.symbol.definition.segments[y].point.x;var c=b.symbol.definition.segments[A].point.x-b.symbol.definition.segments[z].point.x;return B>a-c}function g(b,c){var e,f,g,h,v;d(),e=new a.PlacedSymbol(x.clone()),f=e.symbol.definition.bounds.width,g=new a.Point(b.from),h=new a.Point([g.x+f,g.y]),v=b.scale||{h:1,v:1},e.pivot=[-f/2,0],u(e,{from:g,to:h}),i.call(e,v),l.call(e,a.project.currentStyle.fillColor),j.call(e,a.project.currentStyle.strokeColor),n.call(e,a.project.currentStyle.strokeWidth),b.prop="object"==typeof b.prop?b.prop:{};for(var w in E)b.prop.hasOwnProperty(w)||(b.prop[w]=E[w]);return e.data={tId:"a"+e._id,type:C,prop:b.prop,from:g,to:h,scale:v,setColor:j,getColor:k,setFill:l,getFill:m,setStrokeWidth:n,getStrokeWidth:o,setDragMode:p,itemMouseDrag:r},c!==!1&&(e.onMouseDown=q,e.onMouseUp=s,e.onPropertyChange=t),e}function h(){this.data.from=this.position,this.data.to=this.data.from.add(new a.Point({length:this.symbol.definition.bounds.width,angle:this.rotation}))}function i(a){var b=x.definition.bounds.width;this.symbol.definition.scale(a.h,a.v,[-b/2,0]),this.data.scale||(this.data.scale={h:1,v:1}),this.data.scale.h*=a.h,this.data.scale.v*=a.v,h.call(this)}function j(a){this.symbol.definition.strokeColor=a,this.symbol.definition.fillColor.alpha>0&&(this.symbol.definition.fillColor=a)}function k(){return this.symbol.definition.strokeColor}function l(a){this.symbol.definition.fillColor=a?this.symbol.definition.strokeColor:F}function m(){return this.symbol.definition.fillColor.alpha>0}function n(a){this.symbol.definition.strokeWidth=a}function o(){return this.symbol.definition.strokeWidth}function p(a,b){!a in G?(H=null,I={},J=!1):(H=G[a],I=b)}function q(a){if(this.selected){H=G.FULL_DRAG;var b=this.data.to,c=this.data.from;e.call(this,a.point)?p("DRAG_TO",{delta:b.subtract(a.point)}):c.getDistance(a.point)<30&&p("DRAG_FROM",{delta:c.subtract(a.point)}),this.attach("mousedrag",r)}}function r(a){J=!0;var b={from:this.data.from,to:this.data.to};switch(H){case G.FULL_DRAG:this.translate(a.delta),h.call(this);break;case G.DRAG_TO:b.to=I.delta?a.point.add(I.delta):a.point,delete b.from,u(this,b);break;case G.DRAG_FROM:b.from=I.delta?a.point.add(I.delta):a.point,delete b.to,u(this,b);break;case G.DRAG_HANDLE:if("right"!==I.nameParts[1])J=!1;else{var c=a.point.subtract(b.from).project(b.to.subtract(b.from)),d=c.length/this.symbol.definition.bounds.width,e=a.event.shiftKey?d:a.point.subtract(c.add(b.from)).length/this.symbol.definition.bounds.height*2;i.call(this,{h:d,v:e})}break;default:J=!1}}function s(){this.detach("mousedrag",r),h.call(this),H=null,J&&D.annotationChanged.dispatch(this),J=!1}function t(){}function u(b,c){var d,e,g,h,i="";if(c.from||(c.from=b.data.from,i="to"),c.to||(c.to=b.data.to,i="from"),d=c.to.subtract(c.from),e=d.angle,g=b.symbol.definition.bounds.width,h=d.length-g,f.call(b,g+h)&&(h=0,"from"===i&&(c.from=c.to.subtract(new a.Point({length:g,angle:e})))),b.rotation=e,b.position=c.from,0!==h)for(var j,k=2;j=b.symbol.definition.segments[k];k++)j.point.x+=h;b.data.from=c.from,b.data.to=c.to}function v(a){return a.data&&a.data.type===C?a:a.parent?v(a.parent):null}function w(b){var c,d;if(c=a.project.activeLayer.hitTest(b,{tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0}),c||(c=a.project.activeLayer.hitTest(b,{fill:!0,stroke:!0})),!c||!c.item)return!1;if(d=v(c.item),!d)return!1;if(d.selected=!0,"bounds"===c.type){var e=c.name.split("-");"right"===e[1]&&p("DRAG_HANDLE",{nameStr:c.name,nameParts:c.name.split("-"),item:d})}return!0}var x,y,z,A,B,C="arrow",D={annotationAdded:null,annotationSelected:null,annotationChanged:null},E={comment:"",fill:!0},F=new a.Color([0,0,0,0]),G={FULL_DRAG:1,DRAG_TO:2,DRAG_FROM:3,DRAG_HANDLE:4},H=null,I={},J=!1,K=!1,L=null,M=null,N={onMouseDown:function(b){K=!1,M=null,w(b.point)||(a.project.deselectAll(),D.annotationSelected.dispatch(null),K=!0,L=b.point,M=g({from:L},!0),M.visible=!1)},onMouseDrag:function(a){K&&M?(u(M,{from:L,to:a.point}),M.visible=!0):H===G.DRAG_HANDLE&&I.item&&r.call(I.item,a)},onMouseUp:function(){p(null),K&&M&&(D.annotationAdded.dispatch(M),K=!1,M.selected=!0,M.visible=!0,M=null)}};return{name:C,tool:new a.Tool(N),registerEvent:function(a,b){D[a]=b},exportJSON:b,importJSON:c,listeners:{}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/tools',["signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow"],function(a){function b(a,b){return b.importJSON(a)}function c(a){return this.exportJSON(a)}function d(){return l}function e(a){return k[a]?k[a].tool:null}function f(a){if(a&&k[a]){var b=e(a);b?(l=a,b.activate(),m.activated.dispatch(a)):console&&console.warn&&void 0}}function g(a){return k[a]&&"function"==typeof k[a].importJSON?k[a].importJSON:n}function h(a){return k[a]&&"function"==typeof k[a].exportJSON?k[a].exportJSON:n}function i(a,b){var c=h(a.data.type);return c.call(a,$.extend({asString:!0},b))}for(var j,k={},l=null,m={activated:new a,annotationAdded:new a,annotationChanged:new a,annotationSelected:new a},n=function(){},o=1;j=arguments[o];o++)k[j.name]={tool:j.tool,importJSON:j.importJSON||b,exportJSON:j.exportJSON||c,listeners:j.listeners||{}},"function"==typeof j.registerEvent&&(j.registerEvent("annotationAdded",m.annotationAdded),j.registerEvent("annotationChanged",m.annotationChanged),j.registerEvent("annotationSelected",m.annotationSelected)),j.listeners&&"function"==typeof j.listeners.onToolActivated&&m.activated.add(j.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:n,onMouseUp:n,onMouseDrag:n,onKeyDown:n,onKeyUp:n});a.activate()}(),{events:m,tools:k,getTool:e,getToolJSONImporter:g,getToolJSONExporter:h,activateTool:f,getActiveTool:d,serializeItem:i}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=E[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,E[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),E[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),B.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&-1===a.indexOf(b.parent)?a.push(b.parent):b.data&&b.data.type&&-1===a.indexOf(b)&&a.push(b)}),a}function n(b,c){var d,e,f;try{d="string"==typeof b.item?JSON.parse(b.item):b.item}catch(h){throw"Unable to parse annotation's item"}if(!a.isArray(d)||d.length<2)return null;if("string"==typeof d[0]?e=d[1].data:a.isArray(d[0])&&(e=d[1][1].data),!e)return null;f=e.type;var i=k(b.owner),j=g.getToolJSONImporter(f)(d,i,c);return j&&(j.data.id=b.id,j.selected=!1),j}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;f>e;e++)for(var g=b[e].children,h=0,i=g.length;i>h;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)B.annotationRemoved.dispatch(a.data.id),a.remove();c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b?!0:!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,b){b=void 0===b?!0:!!b;for(var d,e=0,f=c.project.layers;d=f[e];e++)for(var h,i=0,j=d.children;h=j[i];i++)h.data&&h.data.prop&&h.data.prop[a.prop]===a.val&&(h.selected&&(h.selected=!1,g.events.annotationSelected.dispatch(null)),h.visible=b);c.view.draw()}function u(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),B.annotationPropertyChanged.dispatch(a,b,c))),d}function v(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=u(e,a,b)&&f;return f}function w(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function x(a){var b=c.project.getSelectedItems();return 1===b.length?w(b[0],a):null}var y=null,z=null,A=null,B={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},C=e.users,D={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},E={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),y=a(b),0===y.length?(console&&console.warn&&void 0,!1):(c.setup(y.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,D),A=k(e.user.id,e.user.username),A.opacity=1,!0)},events:B,loadUserDict:function(){C=e.users},updateUserDict:function(b){a.extend(C,b)},resize:function(a,b){y&&(a=parseInt(a,10)||y.width(),b=parseInt(b,10)||y.height(),y.width(a).height(b),c.view.viewSize=[a,b],z&&(z.position=[z.bounds.width/2,z.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),z=new c.Raster,z.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(z.width/2,z.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[z.width,z.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),B.imageLoaded.dispatch({raster:z}),"function"==typeof d&&d.call(e,z)},z.source=b.url,z.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=b.length-1;f=b[i];i--){var j=f.owner===d;(e.ui.show_users_results||j)&&n(f,j)}if(d){var k=h("user_"+d);if(k){var l=c.project.layers,m=l.splice(k._index,1);l.push(m[0]),a.each(l,function(a,b){b._index=a}),k=h("user_"+d),k.activate(),c.view.draw()}}B.annotationsLoaded.dispatch(),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setSelectedItemProperty:v,getSelectedItemProperty:x,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:function(a,b){s(a,b)},toggleItemsByProp:function(a,b){t(a,b)},getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(A.id,!0),A.activate())}}(),_raster:function(){return z}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/io',["jquery","paper","signals","adim/config","adim/view"],function(a,b,c,d,e){function f(){}function g(b,c,e,f){b=parseInt(b,10);var g=!b;f=parseInt(f,10)||0;var h={item:c,order:f};if(e)for(var i in e)h[i]=e[i];var j,k=d.api.annotations;g?(j="POST",a.extend(h,{annotable:d.annotable.id,owner:d.user.id,owner_id:d.user.id})):(j="PATCH",k+=b+"/"),a.ajax({url:k,type:j,dataType:"json",data:h,success:function(a,b,c){201===c.status?l.annotationAdded.dispatch(a):200===c.status&&l.annotationSaved.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Erreur lors de l'enregistrement d'une annotation"})}})}function h(b,c){var e=new FormData;return e.append("aid",b),e.append("file",c),a.ajax({type:"POST",url:d.annotable.thumbnail,data:e,processData:!1,contentType:!1}).done(function(){})}function i(a){for(var b,c=0;b=a[c];c++)g(b.id,b.itemStr,b.prop,b.index)}function j(b){a.ajax({url:d.api.annotations+parseInt(b,10)+"/",type:"DELETE",success:function(a,c,d){204===d.status&&l.annotationRemoved.dispatch(b)},error:function(a){404!==a.status&&l.loadingError.dispatch({msg:"Erreur lors de la suppression d'une annotation"})}})}function k(b,c){return a.ajax({url:d.api.annotables+parseInt(b,10)+"/",type:"PATCH",dataType:"json",data:{name:c},success:function(a){l.annotableChanged.dispatch(a)}})}var l={annotableLoaded:new c,annotableChanged:new c,annotationsLoaded:new c,loadingError:new c,annotationAdded:new c,annotationSaved:new c,annotationRemoved:new c},m=!1;return{init:f,events:l,setAutoSave:function(a){return m=!!a},getAutoSave:function(){return m},loadData:function(b){a.ajax({url:b,dataType:"json",success:function(a){l.annotableLoaded.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Une erreur est survenue lors du chargement des données."})}})},loadSharedAnnotations:function(b){var c=a.Deferred();return a.ajax({url:b,dataType:"json",success:function(a){c.resolve(a)},error:function(){var a={msg:"Une erreur est survenue lors du chargement des données."};l.loadingError.dispatch(a),c.reject(a)}}),c},saveUserAnnotations:function(a){a=a||d.user.id;var b=e.getUserAnnnotationsSerialized(a);return i(b),!0},saveAnnotations:function(a,b){if(!m&&!b)return!1;var c=e.getAnnotationsSerialized(a);return i(c),!0},removeAnnotation:j,saveThumbnail:h,setAnnotableName:k}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/text',["paper","jquery"],function(a,b){function c(a,b){!a in w?(x=null,y={},z=!1):(x=w[a],y=b)}function d(a){switch(x){case w.DRAG_HANDLE:if("center"===y.nameParts[1])return;var b=y.item.bounds,c="top"===y.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===y.nameParts[0]&&(e[1]=c-b.height),d>9&&999>d&&i.call(y.item,d),y.item.translate(e);break;case w.FULL_DRAG:default:this.translate(a.delta)}}function e(a){a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=c,a.data.itemMouseDrag=d}function f(c){if(o&&g(!1),!s){o=!0,q||(q=b("<input>",{type:"text","class":"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){o&&g()}).on("keydown",function(a){(27===a.which||13==a.which)&&g()}).autoGrowInput(),r=r||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){g()}),q.before(r)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;q.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),r.show();var f=q.nextAll("tester");f.css({fontSize:q.css("fontSize"),fontFamily:q.css("fontFamily"),fontWeight:q.css("fontWeight"),letterSpacing:q.css("letterSpacing")}),f.text(""===c.data.content?q.attr("placeholder"):c.data.content),q.width(f.width()+30),p=c,setTimeout(function(){q.focus()},100)}}function g(b){if(b=!(b===!1),o=!1,p){var c=q.val();if(c&&""!==c){var d=""===p.data.content;p.data.content=c,p.children[0].content=c,p.children[1].content=c,p.visible=!0,b&&t.annotationSelected&&"function"==typeof t.annotationSelected.dispatch&&t.annotationSelected.dispatch(p),d?(e(p),t.annotationAdded&&"function"==typeof t.annotationAdded.dispatch&&t.annotationAdded.dispatch(p)):t.annotationChanged&&"function"==typeof t.annotationChanged.dispatch&&t.annotationChanged.dispatch(p),p.oSetSelected(b),a.project.view.draw()}else p.remove(),p=null}r.hide(),q.val("").blur().hide()}function h(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function i(a){var b=this,c=a/10;3>c&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function j(){return this.children[0].fontSize}function k(a,c,d){var g=c.importJSON(a);return b.extend(g.data,{setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j}),e(g),d&&g.children[1].on("doubleclick",function(){f(this.parent)}),g}function l(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}function m(a){return a!==s&&(s=a),s}var n="text",o=!1,p=null,q=null,r=null,s=!1,t={annotationAdded:null,annotationChanged:null,annotationSelected:null},u={type:"point-text",tolerance:5,fill:!0},v=function(){},w={FULL_DRAG:1,DRAG_HANDLE:4},x=null,y={},z=!1,A={onMouseDown:function(b){if(!s){var c=a.project.activeLayer.hitTest(b.point,u);if(c){var d=c.item.parent;f(d)}else{var e=a.project.currentStyle.fontSize;if(o)g();else{a.project.deselectAll();var k=b.point,l=new a.PointText({point:k,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),m=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;m=m.toCSS();var q=new a.PointText({point:k,fillColor:m,strokeColor:m,strokeWidth:0,content:""});q.on("doubleclick",function(){f(this.parent)}),p=new a.Group({children:[l,q],data:{type:n,setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j,content:"",color:m}}),p.data.tId="a"+p._id,p.data.content="",f(p)}}}}};return{name:n,tool:new a.Tool(A),setRo:m,exportJSON:l,importJSON:k,registerEvent:function(a,b){t[a]=b}}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/arrow',["paper"],function(a){function b(a){var b=(this.data.from,this.data.to,this.exportJSON({asString:!1}));try{b[1][1].data.from=[this.data.from.x,this.data.from.y],b[1][1].data.to=[this.data.to.x,this.data.to.y]}catch(c){console.error(c)}return a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1][1],f=b[0][1][e.symbol][1][1],h=f.fillColor&&(f.fillColor.length<3||0!==f.fillColor[3]),i=parseFloat(e.opacity)||1,k=a.project.activeLayer;c.activate(),e.data.from.length>2&&(e.data.from=e.data.from.splice(1)),e.data.to.length>2&&(e.data.to=e.data.to.splice(1));var m=g({from:new a.Point(e.data.from),prop:e.data.prop,scale:e.data.scale||{h:1,v:1}},d);return m.opacity=i,j.call(m,f.strokeColor),l.call(m,h),n.call(m,f.strokeWidth),u(m,{from:m.data.from,to:new a.Point(e.data.to)}),k.activate(),m}function d(){if(!y){var b=new a.Path({segments:[[0,-5],[0,5],new a.Segment([20,5]),[10,30],new a.Segment([50,0]),[10,-30],new a.Segment([20,-5])],strokeJoin:"round",strokeScaling:!1,closed:!0});z=1,A=3,B=4,C=b.segments[A].point.x-b.segments[z].point.x,y=new a.Symbol(b),b.remove()}}function e(a,b){b=b||this;var c=b.symbol.definition.segments[2].point.x,d=b.symbol.definition.segments[B].point.x,e=b.globalToLocal(a).x;return(e-c)/(d-c)>.1}function f(a,b){b=b||this,a=a||b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[z].point.x;var c=b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[A].point.x;return C>a-c}function g(b,c){var e,f,g,h,v;d(),e=new a.PlacedSymbol(y.clone()),f=e.symbol.definition.bounds.width,g=new a.Point(b.from),h=new a.Point([g.x+f,g.y]),v=b.scale||{h:1,v:1},e.pivot=[-f/2,0],u(e,{from:g,to:h}),i.call(e,v),l.call(e,a.project.currentStyle.fillColor),j.call(e,a.project.currentStyle.strokeColor),n.call(e,a.project.currentStyle.strokeWidth),b.prop="object"==typeof b.prop?b.prop:{};for(var w in G)b.prop.hasOwnProperty(w)||(b.prop[w]=G[w]);return e.data={tId:"a"+e._id,type:D,prop:b.prop,from:g,to:h,scale:v,setColor:j,getColor:k,setFill:l,getFill:m,setStrokeWidth:n,getStrokeWidth:o,setDragMode:p,itemMouseDrag:r},c!==!1&&(e.onMouseDown=q,e.onMouseUp=s,e.onPropertyChange=t),e}function h(){this.data.from=this.position,this.data.to=this.data.from.add(new a.Point({length:this.symbol.definition.bounds.width,angle:this.rotation}))}function i(a){var b=y.definition.bounds.width;this.symbol.definition.scale(a.h,a.v,[-b/2,0]),this.data.scale||(this.data.scale={h:1,v:1}),this.data.scale.h*=a.h,this.data.scale.v*=a.v,h.call(this)}function j(a){this.symbol.definition.strokeColor=a,this.symbol.definition.fillColor.alpha>0&&(this.symbol.definition.fillColor=a)}function k(){return this.symbol.definition.strokeColor}function l(a){this.symbol.definition.fillColor=a?this.symbol.definition.strokeColor:H}function m(){return this.symbol.definition.fillColor.alpha>0}function n(a){this.symbol.definition.strokeWidth=a}function o(){return this.symbol.definition.strokeWidth}function p(a,b){!a in I?(J=null,K={},L=!1):(J=I[a],K=b)}function q(a){if(this.selected&&!E){J=I.FULL_DRAG;var b=this.data.to,c=this.data.from;e.call(this,a.point)?p("DRAG_TO",{delta:b.subtract(a.point)}):c.getDistance(a.point)<30&&p("DRAG_FROM",{delta:c.subtract(a.point)}),this.attach("mousedrag",r)}}function r(a){if(!E){L=!0;var b={from:this.data.from,to:this.data.to};switch(J){case I.FULL_DRAG:this.translate(a.delta),h.call(this);break;case I.DRAG_TO:b.to=K.delta?a.point.add(K.delta):a.point,delete b.from,u(this,b);break;case I.DRAG_FROM:b.from=K.delta?a.point.add(K.delta):a.point,delete b.to,u(this,b);break;case I.DRAG_HANDLE:if("right"!==K.nameParts[1])L=!1;else{var c=a.point.subtract(b.from).project(b.to.subtract(b.from)),d=c.length/this.symbol.definition.bounds.width,e=a.event.shiftKey?d:a.point.subtract(c.add(b.from)).length/this.symbol.definition.bounds.height*2;i.call(this,{h:d,v:e})}break;default:L=!1}}}function s(){this.detach("mousedrag",r),h.call(this),J=null,L&&F.annotationChanged.dispatch(this),L=!1}function t(){}function u(b,c){var d,e,g,h,i="";if(c.from||(c.from=b.data.from,i="to"),c.to||(c.to=b.data.to,i="from"),d=c.to.subtract(c.from),e=d.angle,g=b.symbol.definition.bounds.width,h=d.length-g,f.call(b,g+h)&&(h=0,"from"===i&&(c.from=c.to.subtract(new a.Point({length:g,angle:e})))),b.rotation=e,b.position=c.from,0!==h)for(var j,k=2;j=b.symbol.definition.segments[k];k++)j.point.x+=h;b.data.from=c.from,b.data.to=c.to}function v(a){return a.data&&a.data.type===D?a:a.parent?v(a.parent):null}function w(b){var c,d;if(c=a.project.activeLayer.hitTest(b,{tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0}),c||(c=a.project.activeLayer.hitTest(b,{fill:!0,stroke:!0})),!c||!c.item)return!1;if(d=v(c.item),!d)return!1;if(d.selected=!0,"bounds"===c.type){var e=c.name.split("-");"right"===e[1]&&p("DRAG_HANDLE",{nameStr:c.name,nameParts:c.name.split("-"),item:d})}return!0}function x(a){return a!==E&&(E=a),E}var y,z,A,B,C,D="arrow",E=!1,F={annotationAdded:null,annotationSelected:null,annotationChanged:null},G={comment:"",fill:!0},H=new a.Color([0,0,0,0]),I={FULL_DRAG:1,DRAG_TO:2,DRAG_FROM:3,DRAG_HANDLE:4},J=null,K={},L=!1,M=!1,N=null,O=null,P={onMouseDown:function(b){if(!E){M=!1,O=null,w(b.point)||(a.project.deselectAll(),F.annotationSelected.dispatch(null),M=!0,N=b.point,O=g({from:N},!0),O.visible=!1)}},onMouseDrag:function(a){E||(M&&O?(u(O,{from:N,to:a.point}),O.visible=!0):J===I.DRAG_HANDLE&&K.item&&r.call(K.item,a))},onMouseUp:function(){p(null),M&&O&&(F.annotationAdded.dispatch(O),M=!1,O.selected=!0,O.visible=!0,O=null)}};return{name:D,tool:new a.Tool(P),setRo:x,registerEvent:function(a,b){F[a]=b},exportJSON:b,importJSON:c,listeners:{}}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(a);b?(n=a,b.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=!1,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=E[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,E[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),E[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),B.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&-1===a.indexOf(b.parent)?a.push(b.parent):b.data&&b.data.type&&-1===a.indexOf(b)&&a.push(b)}),a}function n(b,c){var d,e,f;try{d="string"==typeof b.item?JSON.parse(b.item):b.item}catch(h){throw"Unable to parse annotation's item"}if(!a.isArray(d)||d.length<2)return null;if("string"==typeof d[0]?e=d[1].data:a.isArray(d[0])&&(e=d[1][1].data),!e)return null;f=e.type;var i=k(b.owner),j=g.getToolJSONImporter(f)(d,i,c);return j&&(j.data.id=b.id,j.selected=!1),j}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;f>e;e++)for(var g=b[e].children,h=0,i=g.length;i>h;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)B.annotationRemoved.dispatch(a.data.id),a.remove();c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b?!0:!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,b){b=void 0===b?!0:!!b;for(var d,e=0,f=c.project.layers;d=f[e];e++)for(var h,i=0,j=d.children;h=j[i];i++)h.data&&h.data.prop&&h.data.prop[a.prop]===a.val&&(h.selected&&(h.selected=!1,g.events.annotationSelected.dispatch(null)),h.visible=b);c.view.draw()}function u(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),B.annotationPropertyChanged.dispatch(a,b,c))),d}function v(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=u(e,a,b)&&f;return f}function w(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function x(a){var b=c.project.getSelectedItems();return 1===b.length?w(b[0],a):null}var y=null,z=null,A=null,B={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},C=e.users,D={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},E={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),y=a(b),0===y.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(y.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,D),A=k(e.user.id,e.user.username),A.opacity=1,!0)},events:B,loadUserDict:function(){C=e.users},updateUserDict:function(b){a.extend(C,b)},resize:function(a,b){y&&(a=parseInt(a,10)||y.width(),b=parseInt(b,10)||y.height(),y.width(a).height(b),c.view.viewSize=[a,b],z&&(z.position=[z.bounds.width/2,z.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),z=new c.Raster,z.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(z.width/2,z.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[z.width,z.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),B.imageLoaded.dispatch({raster:z}),"function"==typeof d&&d.call(e,z)},z.source=b.url,z.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=b.length-1;f=b[i];i--){var j=f.owner===d;(e.ui.show_users_results||j)&&n(f,j)}if(d){var k=h("user_"+d);if(k){var l=c.project.layers,m=l.splice(k._index,1);l.push(m[0]),a.each(l,function(a,b){b._index=a}),k=h("user_"+d),k.activate(),c.view.draw()}}B.annotationsLoaded.dispatch(),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setSelectedItemProperty:v,getSelectedItemProperty:x,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:function(a,b){s(a,b)},toggleItemsByProp:function(a,b){t(a,b)},getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(A.id,!0),A.activate())}}(),_raster:function(){return z}}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/io',["jquery","paper","signals","adim/config","adim/view"],function(a,b,c,d,e){function f(){}function g(b,c,e,f){b=parseInt(b,10);var g=!b;f=parseInt(f,10)||0;var h={item:c,order:f};if(e)for(var i in e)h[i]=e[i];var j,k=d.api.annotations;g?(j="POST",a.extend(h,{annotable:d.annotable.id,owner:d.user.id,owner_id:d.user.id})):(j="PATCH",k+=b+"/"),a.ajax({url:k,type:j,dataType:"json",data:h,success:function(a,b,c){201===c.status?l.annotationAdded.dispatch(a):200===c.status&&l.annotationSaved.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Erreur lors de l'enregistrement d'une annotation"})}})}function h(b,c){var e=new FormData;return e.append("aid",b),e.append("file",c),a.ajax({type:"POST",url:d.annotable.thumbnail,data:e,processData:!1,contentType:!1}).done(function(){})}function i(a){for(var b,c=0;b=a[c];c++)g(b.id,b.itemStr,b.prop,b.index)}function j(b){a.ajax({url:d.api.annotations+parseInt(b,10)+"/",type:"DELETE",success:function(a,c,d){204===d.status&&l.annotationRemoved.dispatch(b)},error:function(a){404!==a.status&&l.loadingError.dispatch({msg:"Erreur lors de la suppression d'une annotation"})}})}function k(b,c){return a.ajax({url:d.api.annotables+parseInt(b,10)+"/",type:"PATCH",dataType:"json",data:{name:c},success:function(a){l.annotableChanged.dispatch(a)}})}var l={annotableLoaded:new c,annotableChanged:new c,annotationsLoaded:new c,loadingError:new c,annotationAdded:new c,annotationSaved:new c,annotationRemoved:new c},m=!1;return{init:f,events:l,setAutoSave:function(a){return m=!!a},getAutoSave:function(){return m},loadData:function(b){console.time("loadData"),a.ajax({url:b,dataType:"json",success:function(a){console.timeEnd("loadData"),l.annotableLoaded.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Une erreur est survenue lors du chargement des données."})}})},loadSharedAnnotations:function(b){var c=a.Deferred();return a.ajax({url:b,dataType:"json",success:function(a){c.resolve(a)},error:function(){var a={msg:"Une erreur est survenue lors du chargement des données."};l.loadingError.dispatch(a),c.reject(a)}}),c},saveUserAnnotations:function(a){a=a||d.user.id;var b=e.getUserAnnnotationsSerialized(a);return i(b),!0},saveAnnotations:function(a,b){if(!m&&!b)return!1;var c=e.getAnnotationsSerialized(a);return i(c),!0},removeAnnotation:j,saveThumbnail:h,setAnnotableName:k}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/attributes',["paper","signals","adim/view"],function(a,b,c){function d(b){b=b||a.project.currentStyle,z.colorChanged.add(function(a,b){i(a,b)}),z.fillChanged.add(function(a,b){l(a,b)}),z.fontSizeChanged.add(function(a,b){o(a,b)}),z.strokeWidthChanged.add(function(a,b){r(a,b)}),z.opacityChanged.add(function(a,b){u(a,b)}),g(b.strokeColor),m(b.fontSize),p(b.strokeWidth),x(1),j(!!b.isFill)}function e(b,d){for(var e,f=c.getSelectedAnnotations(),g=[],h=0;e=f[h];h++)e.data&&e.data.type&&("function"==typeof e.data[b.setCallbackName]?e.data[b.setCallbackName].call(e,b.attrValue):b.setAttrCallback.call(e,b.attrValue),g.push(e));d!==!1&&z.annotationChanged.dispatch(g),a.view.draw()}function f(b){var d=c.getSelectedAnnotations();if(d.length>0){var e=d[0],f=e.index,g=null,h=null,i=[];if("front"===b?e.bringToFront():"frontward"===b?e.nextSibling&&e.insertAbove(e.nextSibling):"back"===b?e.sendToBack():"backward"===b&&e.previousSibling&&e.insertBelow(e.previousSibling),f!==e.index){g=Math.min(f,e.index),h=Math.max(f,e.index);for(var j=g;h>=j;j++)i.push(e.layer.children[j]);z.annotationChanged.dispatch(i),a.view.draw()}}}function g(b,c,d){A=new a.Color(b),a.project.currentStyle.strokeColor=A,a.project.currentStyle.fillColor=C?A:null,d!==!0&&z.colorChanged.dispatch(b,c)}function h(){return A}function i(a,b){e({setCallbackName:"setColor",attrValue:a,setAttrCallback:function(a){this.fillColor&&(this.fillColor=a),this.strokeColor=a}},b)}function j(b,c,d){C=!!b,a.project.currentStyle.fillColor=C?A:null,d!==!0&&z.fillChanged.dispatch(C,c)}function k(){return C}function l(a,b){e({setCallbackName:"setFill",attrValue:a,setAttrCallback:function(a){var b=this.fillColor||this.strokeColor;this.fillColor=a?b:null}},b)}function m(b,c,d){D=b,a.project.currentStyle.fontSize=b,d!==!0&&z.fontSizeChanged.dispatch(b,c)}function n(){return a.project.currentStyle.fontSize}function o(a,b){e({setCallbackName:"setFontSize",attrValue:a},b)}function p(b,c,d){E=b>H?H:I>b?I:b,a.project.currentStyle.strokeWidth=E,d!==!0&&z.strokeWidthChanged.dispatch(b,c)}function q(){return E}function r(a,b){e({setCallbackName:"setStrokeWidth",attrValue:a,setAttrCallback:function(a){this.strokeWidth=a}},b)}function s(a,b,c){B=Math.max(0,Math.min(100,a)),c!==!0&&z.opacityChanged.dispatch(a,b)}function t(){return B}function u(a,b){e({setCallbackName:"setOpacity",attrValue:a,setAttrCallback:function(a){this.opacity=a/100}},b)}function v(b){b=Math.max(0,Math.min(100,b)),F=b,c._raster().opacity=b/100,a.view.draw()}function w(){return F}function x(b,d){var e,f,g;b=Math.max(K,Math.min(J,b)),a.project.view.zoom!==b&&(d&&("center"===d?(G=G||c.getLayerByName("image"),g=G?G.localToGlobal(G.bounds.center).subtract(a.view.center):[0,0]):(d=a.view.viewToProject(d),e=a.view.zoom/b,f=d.subtract(a.view.center),g=d.subtract(f.multiply(e)).subtract(a.view.center))),a.project.view.zoom=b,g&&a.view.setCenter(a.view.center.add(g)),z.zoomChanged.dispatch(b))}function y(b,c){var d=20,e=5;if(0!==b){var f=Math.abs(b),g=f/b;b=g*(f>d?d:e>f?e:f);var h=a.project.view.zoom;h+=a.project.view.zoom*b/100,x(h,c)}}var z={colorChanged:new b,fillChanged:new b,fontSizeChanged:new b,strokeWidthChanged:new b,opacityChanged:new b,zoomChanged:new b,annotationChanged:new b},A=null,B=1,C=!1,D=48,E=7,F=100,G=null,H=50,I=1,J=10,K=.1;return{init:d,events:z,setColor:g,getColor:h,setFill:j,getFill:k,setFontSize:m,getFontSize:n,setStrokeWidth:p,getStrokeWidth:q,setOpacity:s,getOpacity:t,setZoom:x,deltaZoom:y,setImageOpacity:v,getImageOpacity:w,bringToFront:function(){f("front")},bringFrontward:function(){f("frontward")},sendToBack:function(){f("back")},sendBacktward:function(){f("backward")}}});
/* FileSaver.js
* A saveAs() FileSaver implementation.
......@@ -13692,7 +13692,7 @@ if (typeof module !== "undefined" && module !== null) {
}
;
!function(a){var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){d&&b.toDataURL&&f?a(f(this.toDataURL(c,d))):a(this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define('canvasToBlob',[],function(){return f}):a.dataURLtoBlob=f}(this);
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('helper/exporter',["jquery","paper","FileSaver","adim/view","adim/config","canvasToBlob"],function(a,b,c,d,e){function f(a,e){var f,g,h,i=d.getLayerByName("image").children.filter(function(a){return!!a.image});if(i.length>0&&e.linkImages)require(["zip"],function(d){j||(d.workerScriptsPath=requirejs.toUrl("zip").split("/").slice(0,-1).join("/")+"/",j=!0),g=i[0].toDataURL,h=function(){return this._image&&this._image.src};for(var k,l=0;k=i[l];l++)k.toDataURL=h;f=b.project.exportSVG({asString:!0});for(var k,l=0;k=i[l];l++)k.toDataURL=g;for(var m,n=(i.map(function(a){return a.source}),[]),o=0;m=i[o];o++){var p=m.source,q=p.split("/").pop();f=f.replace(p,q),n.push([q,m])}var r=a+" directory";return d.createWriter(new d.BlobWriter("application/zip"),function(b){function g(){var a=n[i++];a?a[1].canvas.toBlob(function(c){b.add(r+"/"+a[0],new d.BlobReader(c),function(){g()})},"image/jpeg",e.quality||.9):h()}function h(){b.close(function(b){c(b,a+"_svg.zip"),e&&e.callback&&"function"==typeof e.callback&&e.callback()})}var i=0;b.add(r+"/image.svg",new d.TextReader(f),function(){g()})}),null});else{if(0===i.length||"png"===e.imageType)f=b.project.exportSVG({asString:!0});else{g=i[0].toDataURL,h=function(){var a=this._image&&this._image.src;if(/^data:/.test(a))return a;var b=this.getCanvas();return b?b.toDataURL("image/jpeg",e.quality||.9):null};for(var k,l=0;k=i[l];l++)k.toDataURL=h;f=b.project.exportSVG({asString:!0});for(var k,l=0;k=i[l];l++)k.toDataURL=g}var m=new Blob([f],{type:"image/svg+xml;charset=utf-8"});c(m,a+".svg"),e&&e.callback&&"function"==typeof e.callback&&e.callback()}}function g(e,f){var g=a.Deferred(),h=b.view.zoom,i=b.view.viewSize,j=b.view.center,k=d.getLayerByName("image").children[1].size,l=d.getSelectedAnnotations(),m=a.map(l,function(a){return a.fullySelected?a:null});b.project.deselectAll();var n,o,p=[];if(f&&f.thumbnailSize){for(p=b.project.getItems({data:{type:"arrow"}}),o=0,n;n=p[o];o++)n.symbol.definition.strokeScaling=!0;b.view.zoom=f.thumbnailSize/Math.max(k.width,k.height),d.resize(k.width*b.view.zoom,k.height*b.view.zoom)}else b.view.zoom=1,d.resize(k.width,k.height);for(b.view.center=k.multiply(.5),b.view.element.toBlob(function(a){g.resolve({blob:a}),f&&f.thumbnailSize||c(a,e+".png")}),a.each(l,function(a,b){b.selected=!0}),a.each(m,function(a,b){b.fullySelected=!0}),o=0,n;n=p[o];o++)n.symbol.definition.strokeScaling=!1;return b.view.viewSize=i,b.view.zoom=h,b.view.center=j,f&&f.callback&&"function"==typeof f.callback&&f.callback(),g}function h(a){return a.thumbnailSize=parseInt(e.thumbnailSize,10)||150,g(null,a)}function i(a,b,c){switch(b){case"png":return g(a,c);case"svg":c=c||{},c.linkImages=!1,c.imageType="jpeg",c.quality=.9,f(a,c)}}var j=!1;return{exportSVG:f,"export":i,getThumbnail:h}});
(function(t,e){if(typeof define==="function"&&define.amd){define('backbone',["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};q(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}q(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
 
......@@ -14103,8 +14103,18 @@ define('anobj-mgr/views/anobj/properties-panel',[
this.sharingPropEl
.toggleClass("aom-prop-locked", locked)
.toggleClass("aom-prop-unlocked", !locked);
this.propListEl
.toggleClass("aom-prop-locked", locked)
.toggleClass("aom-prop-unlocked", !locked);
 
this.sharingPropEl.find("[name=aom-prop-shared]").val([sharingMode]);
var sharingModeSelect = this.sharingPropEl.find("[name=aom-prop-shared]");
console.log("sharingMode", sharingMode);
if (_.isUndefined(sharingMode) || sharingMode === "" ) {
sharingModeSelect.attr("disabled", "disabled");
} else {
sharingModeSelect.removeAttr("disabled");
}
sharingModeSelect.val([sharingMode]);
this.publicPublishEl.val([publicPublish]);
this.propShMdParamsAll.addClass("hidden");
if (sharingMode) {
......@@ -14914,9 +14924,9 @@ jQuery.fn.mousehold = function (f) {
 
define("bootstrap.spinedit", ["jquery.bootstrap"], function(){});
 
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/ui',["jquery","underscore","signals","paper","adim/config","adim/view","adim/io","adim/tools","adim/attributes","adim/users","helper/exporter","anobj-mgr/views/AnObjMgr","jquery.bootstrap","jquery.mousewheel","bootstrap.colorpicker","bootstrap.slider","jquery.autoGrowInput","bootstrap.spinedit","FileSaver"],function($,_,Signal,paper,config,view,io,tools,attributes,Users,exporter,AnObjMgr){function init(a){function b(a){"boolean"!=typeof a&&(a=!e),io.setAutoSave(a),_events.autoSaveChanged.dispatch(a),e=a}function c(){e?(f.attr("disabled","disabled"),g.addClass("active btn-success").removeClass("btn-primary")):(f.removeAttr("disabled"),g.removeClass("active btn-success").addClass("btn-primary"))}var d=this;_$w=$(window),_canvas=$("#my-canvas"),_canvasCtnr=$(".canvas-container"),_canvasToolBar=$("#canvas-bbar"),_sideCol=$("#side-col"),_toolsCol=$("#tools-col"),_annotationListCtnr=$("#annotation-list-container"),_canvasCtnrTop=_canvasCtnr.offset().top+_canvasToolBar.outerHeight(),view.events.imageLoaded.add(function(a){adjustCanvasToImage(a.raster),$("#page-loader").remove()}),view.events.annotationsLoaded.add(function(){zoomFitContent(),updateUserLayers(),e=!0,io.setAutoSave(e),c()}),view.events.userLayerVisibilityChanged.add(onUserLayerVisChange),tools.events.annotationSelected.add(function(a){var b=!!a&&1===view.getSelectedAnnotations().length;if(b){displayProperties(a);var c="function"==typeof a.data.getStrokeWidth?a.data.getStrokeWidth.call(a):"undefined"!=typeof a.data.strokeWidth?a.data.strokeWidth:"undefined"!=typeof a.strokeWidth?a.strokeWidth:0;c&&(_widthSlider.slider("setValue",c),attributes.setStrokeWidth(c,!1,!0)),"undefined"!=typeof a.opacity&&(_opacitySlider.slider("setValue",100*a.opacity),attributes.setOpacity(a.opacity,!1,!0));var d="function"==typeof a.data.getColor?a.data.getColor.call(a):a.data.color?a.data.color:a.strokeColor?a.strokeColor:a.fillColor;d&&(updateColorSelector(d),attributes.setColor(d,!1,!0));var e="function"==typeof a.data.getFill?a.data.getFill.call(a):!!a.fillColor;$("#tool-fill-color").toggleClass("active",e),attributes.setFill(e,!1,!0);var f="function"==typeof a.data.getFontSize?a.data.getFontSize.call(a):attributes.getFontSize();$("#attr-font-size").val(f),attributes.setFontSize(f,!1,!0)}else disableProperties(!0),$("*:focus").blur();if(a&&a.layer){var g=a.layer.id,h=$("#annotation-list-container .list-group-item").filter(function(a,b){return $(b).data("layerId")==g});selectLayerListItem(h,!1)}}),io.events.loadingError.add(function(a){var b=$("#page-loader");if(b.length)b.html('<div class="text-danger lead">Erreur de chargement</div><div class="text-danger">'+a.msg+"</div>");else{var c=$('<div class="alert alert-danger in"><button data-dismiss="alert" class="close" type="button">×</button><h4>Erreur de chargement</h4><p>'+a.msg+"</p></div>");$("#main").prepend(c.alert())}});var e=io.getAutoSave(),f=$("#save-but"),g=$("#autosave-but");f.click(function(){io.saveUserAnnotations(),_events.saveButClick.dispatch()}),g.click(function(){b(),c()}),config.mode===config.MODE_EDIT?c():(f.hide(),g.hide(),_toolsCol.hide()),config.ui.show_side_col?_sideCol.find(".side-col-collapse-but .btn").on("click",function(){toggleSideCol()}):_sideCol.hide(),updateReservedSpace();var h=$("#main-navbar"),i=function(){var a,b=h.find(".navbar-header"),c=h.find(".navbar-right"),d=h.find(".adim-image-name");return a=b.offset().left+b.outerWidth()+c.outerWidth()+(d.outerWidth()-d.width())+25,d.find(".text").css("max-width",_$w.width()-a),a}();!function(){var a=$("body"),b=a.outerWidth(),c=a.outerHeight(),d=_.debounce(function(){a.data("resize-fixed")||(a.css({width:b,maxWidth:b,minWidth:b,height:c,maxHeight:c,minHeight:c}),a.data("resize-fixed",!0))},50,!0),e=_.debounce(function(){a.css({width:"auto",maxWidth:"none",minWidth:0,height:"auto",maxHeight:"none",minHeight:0}),a.data("resize-fixed",!1),b=a.outerWidth(),c=a.outerHeight(),adjustCanvasToImage(),h.find(".adim-image-name .text").css("max-width",_$w.width()-i)},100);_$w.on("resize",function(){d(),e()})}(),$("#side-col-panel-group .panel-collapse").on("hidden.bs.collapse shown.bs.collapse",function(){_adjustCanvasFrame()}),$(".adim-view-mod-tabs li").on("click","a",function(a){a.preventDefault();var b=$(a.target),c=$(a.delegateTarget),d=b.data("adimMode");return c.hasClass("active")?!1:void updateViewMode(d)}),$(".adim-view-mod-tabs").find("[data-toggle=tooltip]").tooltip({placement:"bottom",delay:{show:500,hide:50}}),$("#but-zoom-fit").on("click",zoomFitContent),$("#but-zoom-100").on("click",function(a){a.preventDefault(),attributes.setZoom(1,"center")}),config.user.guest||(this._anObjNameModal=$("#adim-name-modal").modal({show:!1}),this._anObjNameModal.find("button.btn-primary").on("click",function(a){a.preventDefault(),io.setAnnotableName(config.annotable.id,d._anObjNameModal.find("input[name=imageName]").val()).done(function(){d._anObjNameModal.modal("hide")}).fail(function(a,b){var c=a.responseJSON.name||a.responseJSON.detail||b;d._anObjNameModal.find(".errors").removeClass("hide").find(".error-text").text(c)})}),this._anObjName=$("a.adim-image-name").on("click submit",function(a){a.preventDefault(),d._anObjNameModal.find(".errors").addClass("hide").end().find("input[name=imageName]").val(d._anObjName.find(".text").text()).end().modal("show")}).append($('<span style="font-size: 12px;" class="glyphicon glyphicon-pencil"></span>'))),$(".aom-show-but").on("click",function(a){_showAnObjMgr.call(d,a)}),function(){var a=$("#dlg-publish-mode").modal({show:!1}),b=$("#annotationSharingPanel");b.find("[data-toggle=tooltip]").tooltip({viewport:"#annotation-sharing-container",container:"#annotation-sharing-container",placement:"bottom",delay:{show:500,hide:100}}).end().find(".adim-sha-publish-mode-but").on("click",function(){var b;try{b=config.user.membership.publish_mode}catch(c){b=0}a.find("form input[name=publish-mode]").val([b]),a.modal("show")}),a.find(".modal-footer .save-publish-mode-but").on("click",function(){var c=b.find(".sha-publish-mode-state").data("publishState"),d=a.find("form input[name=publish-mode]:checked").val();return c==d?void a.modal("hide"):void $.ajax({url:config.api.annotables+config.annotable.id+"/set_publish_mode/",type:"PATCH",contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({publish_mode:d})}).done(function(a){config.user.membership.publish_mode=a.publish_mode,b.find(".sha-publish-mode-state").data("publishState",a.publish_mode).attr("data-publish-state",a.publish_mode)}).fail(function(){}).always(function(){a.modal("hide"),a.find("form input[name=publish-mode]").val([config.user.membership.publish_mode])})})}(),io.events.annotableChanged.add(function(a){a.id===config.annotable.id&&d._anObjName.find(".text").text(a.name);var b=d._anObjMgr.anobjs.findWhere({id:a.id});b&&b.set("name",a.name)}),$("#btn-export-image-png").on("click",function(a){a.preventDefault(),_export("png")}),$("#btn-export-image-svg").on("click",function(a){a.preventDefault(),_export("svg")}),$("#adim-about-but").on("click",function(a){a.preventDefault(),$("#dlg-about-adim").modal()}),initPropertiesPanel();var j=config.mode===config.MODE_EDIT&&!(a&&a.ro===!0);initTools({disabled:!j}),initAttributes({disabled:!j}),updateViewMode(),tools.activateTool("select")}function updateViewMode(a){var b,c=$(".adim-view-mod-tabs"),d=document.location.hash;0!==c.length&&(-1===["edit","review"].indexOf(a)&&(b=c.find("a[href='"+d+"']"),a=1===b.length?b.data("adimMode"):"edit"),b&&b.length||(b=c.find("a[data-adim-mode="+a+"]")),c.find("li.active").removeClass("active"),b.closest("li").addClass("active"),window.history.replaceState(null,"",b.attr("href")),$(".adim-view").removeClass("adim-view-review adim-view-edit").addClass("adim-view-"+a),updateReservedSpace(),adjustCanvasToImage(),tools.activateTool("select"),"review"===a?c.data("loaded")?view.toggleMembersLayers(!0):io.loadSharedAnnotations(config.api.annotables+config.annotable.id+"/shared/annotations/").done(function(a){c.data("loaded",!0),$.ajax({url:config.api.annotables+config.annotable.id+"/members/",dataType:"json"}).done(function(a){Users.addUsers(a.users)}).always(function(){view.loadAnnotations(a,null)})}):"edit"===a&&view.toggleMembersLayers(!1))}function toggleSideCol(a){if(_sideCol.is(":visible")){var b,c=!1;"undefined"==typeof a&&(a=_sideCol.is(".collapsed"),c=["width",_sideCol.css("transition-duration"),_sideCol.css("transition-timing-function"),_sideCol.css("transition-delay")].join(" ")),_sideCol.toggleClass("collapsed",!a),updateReservedSpace(),c&&(_canvasCtnr.css("transition",c),_canvasToolBar.css("transition",c),b=_canvas.css("border-color"),_canvas.css("border-right-color","transparent")),adjustCanvasToImage(),c&&setTimeout(function(){_canvasCtnr.css("transition",""),_canvasToolBar.css("transition",""),_canvas.css("border-right-color",b)},300)}}function initTools(a){a=$.extend({},{disabled:!1},a||{}),$("[data-tool-name]").each(function(){var b=$(this),c=b.data("toolName");a.disabled||void 0===tools.getTool(c)?b.attr("disabled","disabled").parent(".btn").addClass("disabled"):b.on("change",function(){var a=$(this).data("toolName");tools.activateTool(a)}),$(this).data("toolName")===config.ui.initial_tool&&$(this).click()})}function initAttributes(a){a=$.extend({},{disabled:!1},a||{});var b=$("#attr-orderup"),c=$("#attr-orderdown");a.disabled?(b.attr("disabled","disabled"),c.attr("disabled","disabled")):(b.click(function(a){a.shiftKey?attributes.bringFrontward():attributes.bringToFront()}),c.click(function(a){a.shiftKey?attributes.sendBacktward():attributes.sendToBack()})),setupColorSelector(a.disabled),a.disabled?$("#tool-fill-color").attr("disabled","disabled"):$("#tool-fill-color").removeAttr("disabled").click(function(){var a=!$(this).is(".active");attributes.setFill(a)}),a.disabled?$("#attr-font").attr("disabled","disabled"):$("#attr-font").removeAttr("disabled").popover({title:'Propriétés des textes <button type="button" class="close" style="margin:-9px">&times;</button>',html:!0,container:"body",trigger:"click",delay:0,content:'<div style="width:160px"><label style="float:left; line-height: 35px" class="small text-muted">Taille: &nbsp;</label><div class="input-group" style="width: 70px;"><input type="text" size="10" class="form-control" name="fontSize" id="attr-font-size"></div></div>'}).on("shown.bs.popover",function(){var a=this,b=$(a).data("bs.popover").$tip,c=b.find("input[name=fontSize]").focus();c.spinedit({value:attributes.getFontSize(),minimum:9,maximum:999,step:1,numberOfDecimals:0}).on("valueChanged",function(a){attributes.setFontSize(parseInt(a.value,10))});var d=function(c){var d=c.target===a||$(c.target).closest(".popover").get(0)===b.get(0);d||e()},e=function(){$(document).unbind("click",d),$("#attr-font").popover("hide")};b.find(".close").on("click",e),$(document).bind("click",d)}),_widthSlider=$("#attr-size-slider").toggleClass("disabled",a.disabled).find(".slider").slider({min:1,max:50,step:1,orientation:"vertical",value:paper&&paper.projet?paper.project.currentStyle.strokeWidth:5,tooltip:a.disabled?"hide":"show",selection:"none",reversed:!0,enabled:!a.disabled}).on("slide",function(a){attributes.setStrokeWidth(a.value,!1)}).on("slideStop",function(a){attributes.setStrokeWidth(a.value,!0)}),attributes.events.strokeWidthChanged.add(function(a){_widthSlider.slider("setValue",a)}),_opacitySlider=$("#attr-opacity-slider").toggleClass("disabled",a.disabled).find(".slider").slider({min:0,max:100,step:10,orientation:"vertical",value:100,tooltip:a.disabled?"hide":"show",formatter:function(a){return a+" %"},selection:"none",reversed:!0,enabled:!a.disabled}).on("slide",function(a){attributes.setOpacity(a.value,!1)}).on("slideStop",function(a){attributes.setOpacity(a.value,!0)});var d,e=$("#attr-zoom"),f=e.find("input[name=zoomLevel]").val(100).on("blur",function(){var a=$(this);a.val(parseInt(parseFloat($(this).val()))+" %")}).on("focus",function(){var a=$(this);a.val(parseInt(parseFloat($(this).val())))}).on("change",function(){var a=parseInt(parseFloat($(this).val()));isNaN(a)||attributes.setZoom(a/100)}),g=e.find(".slider").slider({selection:"none",value:100,enabled:!a.disabled,tooltip:a.disabled?"hide":"show",formater:function(a){return a+"%"}}).on("slide",function(a){var b=parseInt(a.value,10);attributes.setZoom(b/100)});_canvas.on("mousewheel",function(b){if(b.ctrlKey){if(b.preventDefault(),!a.disabled){var c=_widthSlider.slider("getValue")+Math.min(1,Math.max(-1,b.deltaY));_widthSlider.slider("setValue",c),attributes.setStrokeWidth(c,!1),d&&clearTimeout(d),d=setTimeout(function(){attributes.setStrokeWidth(c,!0)},500)}}else b.altKey||b.metaKey?(b.preventDefault(),attributes.deltaZoom(b.deltaY/20,[b.offsetX,b.offsetY])):(b.preventDefault(),attributes.deltaZoom(b.deltaY,[b.offsetX,b.offsetY]))}),attributes.events.zoomChanged.add(function(a){var b=Math.floor(100*a);f.val(b+" %"),g.slider("setValue",b)})}function zoomFitContent(){var a=view.getLayerByName("image"),b=a.children[1];if(b){var c=paper.view.viewSize.divide(b.size);attributes.setZoom(Math.min(c.width,c.height),"center"),paper.view.draw()}}function updateUserLayers(){config.ui.show_users_results&&$.each(view.getAllUsersLayers(),function(a,b){0==annotList.find("li[data-layer-id="+b.id+"]").length&&$(layerListItemTpl({id:b.id,visibleClass:visibleClass,name:b.data.owner||b.name})).prependTo(annotList)})}function onUserLayerVisChange(a,b){updateUserLayerState(getListItem(a),b)}function selectLayerListItem(a,b){var c=$(a),d=annotList.find(".list-group-item.selected");b&&(d.each(function(a,b){toggleLayer($(b),!1)}),toggleLayer(c,!0)),d.removeClass("selected"),c.addClass("selected");var e=view.getLayerByName(c.data("layerId"));e&&e.activate()}function updateUserLayerState(a,b){a.toggleClass("layer-hidden",!b).find(".layer-status").toggleClass(hiddenClass,!b).toggleClass(visibleClass,b)}function toggleLayer(a,b){view.toggleLayer(a.data("layerId"),b)}function toggleAll(a){var b=a;annotList.find(".list-group-item").each(function(c,d){b=$(d).is(".selected")?!0:a,toggleLayer($(d),b)})}function _adjustCanvasFrame(){var a=_canvas.width(),b=_canvas.height();if(_canvasToolBar.css("width",a+4),_canvasCtnr.width(a+2).height(b+2),_sideCol.height(b+_canvasToolBar.outerHeight()+5),_annotationListCtnr.length>0){var c=b+_canvasCtnrTop-_annotationListCtnr.offset().top;_annotationListCtnr.css("maxHeight",Math.max(c,80))}}function updateColorSelector(a){if("string"!=typeof a){if(!a||"function"!=typeof a.toCSS)return;a=a.toCSS()}_colorSelector.find(" > button").css("color",a),$("#tool-fill-color").css("color",a)}function setupColorSelector(a){if(a)_colorSelector.find(".tinter").attr("disabled","disabled"),updateColorSelector("#999");else{var b=null;_colorSelector.find(".tinter").removeAttr("disabled"),_colorSelector.find(".picker").colorpicker().on("mouseup",function(){var a=$(this).data("colorpicker"),b=a.picker;if(b.hasClass("colorpicker-visible")){var c=a.color.toRGB(),d="rgba("+c.r+", "+c.g+", "+c.b+", "+c.a+")";updateColorSelector(d),attributes.setColor(d),setTimeout(function(){_colorSelector.find(".picker").colorpicker("hide"),_colorSelector.find(".color-menu").dropdown("toggle")},100)}}).on("changeColor",function(a){var c=a.color.toRGB(),d="rgba("+c.r+", "+c.g+", "+c.b+", "+c.a+")";updateColorSelector(d),_colorSelector.find(".color-menu .cx").css("background-color",d),attributes.setColor(d,!1),b&&clearTimeout(b),b=setTimeout(function(a){return function(){attributes.setColor(a,!0)}}(d),1e3)}),_colorSelector.find(".color-menu > li > a").click(function(a){var b=$(this);if(a.preventDefault(),!b.is(".cx")){var c=b.css("background-color");updateColorSelector(c),attributes.setColor(c)}}),attributes.getColor()&&updateColorSelector(attributes.getColor().toCSS())}}function disableProperties(a){for(var b in itemProperties)a&&itemProperties[b].setValue(""),itemProperties[b].enable(!1)}function displayProperties(a){var b=!1;if(a&&a.data&&a.data.prop)for(var c in itemProperties)b=a.data.prop.hasOwnProperty(c)||"fill"===c,b?itemProperties[c].enable().setValue(a.data.prop[c]):itemProperties[c].enable(!1);else disableProperties()}function updateSelectedItemProp(a){if(a&&"string"==typeof a){var b=itemProperties[a].getValue(),c=!1;return null!==b&&void 0!==b&&(c=view.setSelectedItemProperty(a,b,!0)),c}}function onPropertyChange(a){updateSelectedItemProp(a.data.pName)}function onPropertyBlur(){}function initPropertiesPanel(){for(var a in itemProperties)if("string"==typeof itemProperties[a].el){var b=$(itemProperties[a].el);1===b.length?(itemProperties[a].el=b,"function"==typeof itemProperties[a].init&&itemProperties[a].init(),"function"==typeof itemProperties[a].onChange?b.on("change",itemProperties[a].onChange):b.on("change",null,{pName:a},onPropertyChange),"function"==typeof itemProperties[a].onBlur?b.on("blur",itemProperties[a].onBlur):b.on("blur",null,{pName:a},onPropertyBlur)):delete itemProperties[a]}disableProperties(!0),$(document).on("keydown",function(a){$("*:focus");switch(a.which){case 49:case 50:case 51:}})}function onToolActivated(a){var b=$("[data-tool-name]").filter("[checked=checked]"),c=$("[data-tool-name="+a+"]");$("[data-tool-name]").button(),b.get(0)!==c.get(0)&&(b.removeAttr("checked").parent(".btn").removeClass("active"),c.attr("checked","checked").parent(".btn").addClass("active")),_canvas.removeClass(function(a,b){var c=b.split(" ").filter(function(a){return a.match(/cursor-tool-/)});return c&&c.join(" ")}).addClass("cursor-tool-"+a)}function adjustCanvasToImage(){var a=_$w.width(),b=_$w.height(),c=a-_reservedWidth,d=320,e=b-_reservedHeight,f=240;a=Math.max(Math.min(a,c),d),b=Math.max(Math.min(b,e),f),view.resize(a,b),_adjustCanvasFrame()}function _showAnObjMgr(a){var b=this;a.preventDefault(),b._anObjMgr||(b._anObjMgr=new AnObjMgr({el:"#aom-modal",aomListCtner:$("#aom-user-images-list .aom-list-container"),sharedAomListCtner:$("#aom-shared-images-list .aom-list-container")})),b._anObjMgrModal||(b._anObjMgrModal=$("#aom-modal").data("loaded",!1).modal({show:!1})),b._anObjMgrModal.modal("show"),b._anObjMgrModal.data("loaded")||b._anObjMgr.loadAnObjs({success:function(){b._anObjMgrModal&&(b._anObjMgrModal.find(".aom-loader").remove(),b._anObjMgrModal.data("loaded",!0)),b._anObjMgr.selectCurrent()}})}function updateCurrentThumbnail(thumbnailPath){if(this._anObjMgrModal){var curItemImg=this._anObjMgrModal.find(".aom-list-item.current img");curItemImg&&0!==curItemImg.length&&(thumbnailPath&&""!==thumbnailPath||(thumbnailPath=eval("(function(){function url(u){return u}return "+curItemImg.css("backgroundImage")+"})()").split("?")[0]),curItemImg.css("backgroundImage",'url("'+thumbnailPath+"?nc=_"+(""+Math.random()).substr(3)+'")'))}}function _export(a){var b=config.annotable.slug+"__"+(config.mode===config.MODE_EDIT?config.user.username:"review");switch(a){case"png":exporter.export(b,"png",{callback:function(){adjustCanvasToImage()}}).done(function(){});break;case"svg":exporter.export(b,"svg")}}function setState(a){switch(a){case"thumbNotSaved":break;case"thumbSaved":this.updateCurrentThumbnail()}}var _$w=$(window),_canvas=null,_canvasCtnr=null,_canvasToolBar=null,_sideCol=null,_toolsCol=null,_annotationListCtnr=null,_canvasCtnrTop,_colorSelector=$("#tool-colorselect"),_opacitySlider,_widthSlider,_reservedWidth=0,_reservedHeight=0,_events={saveButClick:new Signal,autoSaveChanged:new Signal},updateReservedSpace=function(){var a=$("#canvas-col").offset().top,b=_toolsCol.outerWidth(),c=_canvasToolBar.outerHeight();(updateReservedSpace=function(){_reservedWidth=(_toolsCol.is(":visible")?b:0)+(config.ui.show_side_col?_sideCol.is(".collapsed")?32:_sideCol.outerWidth():50)+24,_reservedHeight=a+c+20})()},annotListCtr=$("#annotation-list-container"),annotList=annotListCtr.find(" > ul"),hiddenClass="icon-eye-close",visibleClass="icon-eye-open",layerListItemTpl=_.template(['<li class="list-group-item" data-layer-id="<%= id %>">','<span class="layer-status <%= visibleClass %>"></span>','<span class="layer-title"><%= name %></span>',"</li>"].join("")),getListItem=_.memoize(function(a){return annotList.find("li[data-layer-id="+a.id+"]")},function(a){return a.id});annotList.on("click",".layer-status",function(a){a.stopPropagation();var b=$(this),c=b.parent(".list-group-item");toggleLayer(c)}),annotList.on("click",".list-group-item",function(){selectLayerListItem(this,!0),toggleLayer($(this),!0)}),$("#btn-layers-hideall").click(function(){toggleAll(!1)}),$("#btn-layers-showall").click(function(){toggleAll(!0)}),$("#btn-layers-next").click(function(){var a=annotList.find(".list-group-item.selected").next();1===a.length&&selectLayerListItem(a,!0)}),$("#btn-layers-prev").click(function(){var a=annotList.find(".list-group-item.selected").prev();1===a.length&&selectLayerListItem(a,!0)});var transparentColor=new paper.Color(1,1,1,0),itemProperties={confidence:{el:"#confidence-input",enable:function(a){return a=void 0!==a?!!a:!0,this.el.attr("disabled")&&!a?this:(this.el.rating(a?"enable":"disable"),this.el.closest(".property-group").toggleClass("disabled",!a),config.mode!==config.MODE_EDIT&&this.el.rating("disable"),this)},setValue:function(a){return a=parseInt(a,10),isNaN(a)?void 0:(config.mode===config.MODE_EDIT?this.el.val(a).siblings("[data-value]").trigger("mouseleave"):this.el.siblings("[data-value]").each(function(b,c){var d=$(c);d.toggleClass("label-warning rating-on",d.data("value")<=a).toggleClass("rating-off",d.data("value")>a)}),this)},getValue:function(){var a=parseInt(this.el.val(),10);return isNaN(a)?null:a},init:function(){}},fill:{el:"#fill-check",enable:function(a){return a=void 0!==a?!!a:!0,config.mode!==config.MODE_EDIT&&(a=!1),a?this.el.removeAttr("disabled"):this.el.attr("disabled","disabled"),this.el.closest(".property-group").toggleClass("disabled",!a),this},setValue:function(a){return a=!!a,this.el.prop("checked",a),this},getValue:function(){return!!this.el.prop("checked")},onChange:function(){for(var a,b=$(this).is(":checked"),c=!1,d=view.getSelectedAnnotations(),e=0;a=d[e];e++)if("function"!=typeof a.data.setColor){if(a.data&&a.data.prop&&a.data.prop.fill===b)continue;c=!0,a.fillColor=b?paper.project.currentStyle.fillColor:null,paper.view.draw()}var f=updateSelectedItemProp("fill");c&&!f&&tools.events.annotationChanged.dispatch(d)},init:function(){}},comment:{el:"#prop-annot-comment",enable:function(a){return a=void 0!==a?!!a:!0,config.mode!==config.MODE_EDIT&&(a=!1),a?this.el.removeAttr("disabled"):this.el.attr("disabled","disabled"),this.el.closest(".property-group").toggleClass("disabled",!a),this},setValue:function(a){return this.el.val(a),this},getValue:function(){return this.el.val()},init:function(){var a=this,b=null;a.el.on("keyup",function(){b&&clearTimeout(b),b=setTimeout(function(){updateSelectedItemProp("comment"),b=null},500)})}}};tools.events.activated.add(onToolActivated);var _raster=null;return{init:init,events:_events,updateUserLayers:updateUserLayers,displayProperties:displayProperties,updateReservedSpace:updateReservedSpace,adjustCanvasToImage:adjustCanvasToImage,exporter:exporter,updateCurrentThumbnail:updateCurrentThumbnail,setState:setState}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/ui',["jquery","underscore","signals","paper","adim/config","adim/view","adim/io","adim/tools","adim/attributes","adim/users","helper/exporter","anobj-mgr/views/AnObjMgr","jquery.bootstrap","jquery.mousewheel","bootstrap.colorpicker","bootstrap.slider","jquery.autoGrowInput","bootstrap.spinedit","FileSaver"],function($,_,Signal,paper,config,view,io,tools,attributes,Users,exporter,AnObjMgr){function init(a){function b(a){"boolean"!=typeof a&&(a=!e),io.setAutoSave(a),_events.autoSaveChanged.dispatch(a),e=a}function c(){e?(f.attr("disabled","disabled"),g.addClass("active btn-success").removeClass("btn-primary")):(f.removeAttr("disabled"),g.removeClass("active btn-success").addClass("btn-primary"))}var d=this;_$w=$(window),_canvas=$("#my-canvas"),_canvasCtnr=$(".canvas-container"),_canvasToolBar=$("#canvas-bbar"),_sideCol=$("#side-col"),_toolsCol=$("#tools-col"),_annotationListCtnr=$("#annotation-list-container"),_canvasCtnrTop=_canvasCtnr.offset().top+_canvasToolBar.outerHeight(),window.DBG=tools,view.events.imageLoaded.add(function(a){adjustCanvasToImage(a.raster),$("#page-loader").remove(),console.timeEnd("complete app")}),view.events.annotationsLoaded.add(function(){zoomFitContent(),updateUserLayers(),e=!0,io.setAutoSave(e),c()}),view.events.userLayerVisibilityChanged.add(onUserLayerVisChange),tools.events.annotationSelected.add(function(a){var b=!!a&&1===view.getSelectedAnnotations().length;if(b){displayProperties(a);var c="function"==typeof a.data.getStrokeWidth?a.data.getStrokeWidth.call(a):"undefined"!=typeof a.data.strokeWidth?a.data.strokeWidth:"undefined"!=typeof a.strokeWidth?a.strokeWidth:0;c&&(_widthSlider.slider("setValue",c),attributes.setStrokeWidth(c,!1,!0)),"undefined"!=typeof a.opacity&&(_opacitySlider.slider("setValue",100*a.opacity),attributes.setOpacity(a.opacity,!1,!0));var d="function"==typeof a.data.getColor?a.data.getColor.call(a):a.data.color?a.data.color:a.strokeColor?a.strokeColor:a.fillColor;d&&(updateColorSelector(d),attributes.setColor(d,!1,!0));var e="function"==typeof a.data.getFill?a.data.getFill.call(a):!!a.fillColor;$("#tool-fill-color").toggleClass("active",e),attributes.setFill(e,!1,!0);var f="function"==typeof a.data.getFontSize?a.data.getFontSize.call(a):attributes.getFontSize();$("#attr-font-size").val(f),attributes.setFontSize(f,!1,!0)}else disableProperties(!0),$("*:focus").blur();if(a&&a.layer){var g=a.layer.id,h=$("#annotation-list-container .list-group-item").filter(function(a,b){return $(b).data("layerId")==g});selectLayerListItem(h,!1)}}),io.events.loadingError.add(function(a){var b=$("#page-loader");if(b.length)b.html('<div class="text-danger lead">Erreur de chargement</div><div class="text-danger">'+a.msg+"</div>");else{var c=$('<div class="alert alert-danger in"><button data-dismiss="alert" class="close" type="button">×</button><h4>Erreur de chargement</h4><p>'+a.msg+"</p></div>");$("#main").prepend(c.alert())}});var e=io.getAutoSave(),f=$("#save-but"),g=$("#autosave-but");f.click(function(){io.saveUserAnnotations(),_events.saveButClick.dispatch()}),g.click(function(){b(),c()}),config.mode===config.MODE_EDIT?c():(f.hide(),g.hide(),_toolsCol.hide()),config.ui.show_side_col?_sideCol.find(".side-col-collapse-but .btn").on("click",function(){toggleSideCol()}):_sideCol.hide(),updateReservedSpace();var h=$("#main-navbar"),i=function(){var a,b=h.find(".navbar-header"),c=h.find(".navbar-right"),d=h.find(".adim-image-name");return a=b.offset().left+b.outerWidth()+c.outerWidth()+(d.outerWidth()-d.width())+25,d.find(".text").css("max-width",_$w.width()-a),a}();!function(){var a=$("body"),b=a.outerWidth(),c=a.outerHeight(),d=_.debounce(function(){a.data("resize-fixed")||(a.css({width:b,maxWidth:b,minWidth:b,height:c,maxHeight:c,minHeight:c}),a.data("resize-fixed",!0))},50,!0),e=_.debounce(function(){a.css({width:"auto",maxWidth:"none",minWidth:0,height:"auto",maxHeight:"none",minHeight:0}),a.data("resize-fixed",!1),b=a.outerWidth(),c=a.outerHeight(),adjustCanvasToImage(),h.find(".adim-image-name .text").css("max-width",_$w.width()-i)},100);_$w.on("resize",function(){d(),e()})}(),$("#side-col-panel-group .panel-collapse").on("hidden.bs.collapse shown.bs.collapse",function(){_adjustCanvasFrame()}),$(".adim-view-mod-tabs li").on("click","a",function(a){a.preventDefault();var b=$(a.target),c=$(a.delegateTarget),d=b.data("adimMode");return c.hasClass("active")?!1:void updateViewMode(d)}),$(".adim-view-mod-tabs").find("[data-toggle=tooltip]").tooltip({placement:"bottom",delay:{show:500,hide:50}}),$("#but-zoom-fit").on("click",zoomFitContent),$("#but-zoom-100").on("click",function(a){a.preventDefault(),attributes.setZoom(1,"center")}),config.user.guest||(this._anObjNameModal=$("#adim-name-modal").modal({show:!1}),this._anObjNameModal.find("button.btn-primary").on("click",function(a){a.preventDefault(),io.setAnnotableName(config.annotable.id,d._anObjNameModal.find("input[name=imageName]").val()).done(function(){d._anObjNameModal.modal("hide")}).fail(function(a,b){var c=a.responseJSON.name||a.responseJSON.detail||b;d._anObjNameModal.find(".errors").removeClass("hide").find(".error-text").text(c)})}),this._anObjName=$("a.adim-image-name").on("click submit",function(a){a.preventDefault(),d._anObjNameModal.find(".errors").addClass("hide").end().find("input[name=imageName]").val(d._anObjName.find(".text").text()).end().modal("show")}).append($('<span style="font-size: 12px;" class="glyphicon glyphicon-pencil"></span>'))),$(".aom-show-but").on("click",function(a){_showAnObjMgr.call(d,a)}),function(){var a=$("#dlg-publish-mode").modal({show:!1}),b=$("#annotationSharingPanel");b.find("[data-toggle=tooltip]").tooltip({viewport:"#annotation-sharing-container",container:"#annotation-sharing-container",placement:"bottom",delay:{show:500,hide:100}}).end().find(".adim-sha-publish-mode-but").on("click",function(){var b;try{b=config.user.membership.publish_mode}catch(c){b=0}a.find("form input[name=publish-mode]").val([b]),a.modal("show")}),a.find(".modal-footer .save-publish-mode-but").on("click",function(){var c=b.find(".sha-publish-mode-state").data("publishState"),d=a.find("form input[name=publish-mode]:checked").val();return c==d?void a.modal("hide"):void $.ajax({url:config.api.annotables+config.annotable.id+"/set_publish_mode/",type:"PATCH",contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({publish_mode:d})}).done(function(a){config.user.membership.publish_mode=a.publish_mode,b.find(".sha-publish-mode-state").data("publishState",a.publish_mode).attr("data-publish-state",a.publish_mode)}).fail(function(){}).always(function(){a.modal("hide"),a.find("form input[name=publish-mode]").val([config.user.membership.publish_mode])})})}(),io.events.annotableChanged.add(function(a){a.id===config.annotable.id&&d._anObjName.find(".text").text(a.name);var b=d._anObjMgr.anobjs.findWhere({id:a.id});b&&b.set("name",a.name)}),$("#btn-export-image-png").on("click",function(a){a.preventDefault(),_export("png")}),$("#btn-export-image-svg").on("click",function(a){a.preventDefault(),_export("svg")}),$("#adim-about-but").on("click",function(a){a.preventDefault(),$("#dlg-about-adim").modal()}),initPropertiesPanel();var j=config.mode===config.MODE_EDIT&&!(a&&a.ro===!0);initTools({disabled:!j}),initAttributes({disabled:!j}),updateViewMode(),tools.activateTool("select")}function updateViewMode(a){var b,c=$(".adim-view-mod-tabs"),d=document.location.hash;0!==c.length&&(-1===["edit","review"].indexOf(a)&&(b=c.find("a[href='"+d+"']"),a=1===b.length?b.data("adimMode"):"edit"),b&&b.length||(b=c.find("a[data-adim-mode="+a+"]")),c.find("li.active").removeClass("active"),b.closest("li").addClass("active"),window.history.replaceState(null,"",b.attr("href")),$(".adim-view").removeClass("adim-view-review adim-view-edit").addClass("adim-view-"+a),config.mode=a,updateReservedSpace(),adjustCanvasToImage(),tools.activateTool("select"),tools.setRo(config.annotable.locked||"review"===a),"review"===a?c.data("loaded")?view.toggleMembersLayers(!0):io.loadSharedAnnotations(config.api.annotables+config.annotable.id+"/shared/annotations/").done(function(a){c.data("loaded",!0),$.ajax({url:config.api.annotables+config.annotable.id+"/members/",dataType:"json"}).done(function(a){Users.addUsers(a.users)}).always(function(){view.loadAnnotations(a,null)})}):"edit"===a&&view.toggleMembersLayers(!1))}function toggleSideCol(a){if(_sideCol.is(":visible")){var b,c=!1;"undefined"==typeof a&&(a=_sideCol.is(".collapsed"),c=["width",_sideCol.css("transition-duration"),_sideCol.css("transition-timing-function"),_sideCol.css("transition-delay")].join(" ")),_sideCol.toggleClass("collapsed",!a),updateReservedSpace(),c&&(_canvasCtnr.css("transition",c),_canvasToolBar.css("transition",c),b=_canvas.css("border-color"),_canvas.css("border-right-color","transparent")),adjustCanvasToImage(),c&&setTimeout(function(){_canvasCtnr.css("transition",""),_canvasToolBar.css("transition",""),_canvas.css("border-right-color",b)},300)}}function initTools(a){a=$.extend({},{disabled:!1},a||{}),tools.setRo(a.disabled),$("[data-tool-name]").each(function(){var b=$(this),c=b.data("toolName");a.disabled||void 0===tools.getTool(c)?b.attr("disabled","disabled").parent(".btn").addClass("disabled"):b.on("change",function(){var a=$(this).data("toolName");tools.activateTool(a)}),$(this).data("toolName")===config.ui.initial_tool&&$(this).click()})}function initAttributes(a){a=$.extend({},{disabled:!1},a||{});var b=$("#attr-orderup"),c=$("#attr-orderdown");a.disabled?(b.attr("disabled","disabled"),c.attr("disabled","disabled")):(b.click(function(a){a.shiftKey?attributes.bringFrontward():attributes.bringToFront()}),c.click(function(a){a.shiftKey?attributes.sendBacktward():attributes.sendToBack()})),setupColorSelector(a.disabled),a.disabled?$("#tool-fill-color").attr("disabled","disabled"):$("#tool-fill-color").removeAttr("disabled").click(function(){var a=!$(this).is(".active");attributes.setFill(a)}),a.disabled?$("#attr-font").attr("disabled","disabled"):$("#attr-font").removeAttr("disabled").popover({title:'Propriétés des textes <button type="button" class="close" style="margin:-9px">&times;</button>',html:!0,container:"body",trigger:"click",delay:0,content:'<div style="width:160px"><label style="float:left; line-height: 35px" class="small text-muted">Taille: &nbsp;</label><div class="input-group" style="width: 70px;"><input type="text" size="10" class="form-control" name="fontSize" id="attr-font-size"></div></div>'}).on("shown.bs.popover",function(){var a=this,b=$(a).data("bs.popover").$tip,c=b.find("input[name=fontSize]").focus();c.spinedit({value:attributes.getFontSize(),minimum:9,maximum:999,step:1,numberOfDecimals:0}).on("valueChanged",function(a){attributes.setFontSize(parseInt(a.value,10))});var d=function(c){var d=c.target===a||$(c.target).closest(".popover").get(0)===b.get(0);d||e()},e=function(){$(document).unbind("click",d),$("#attr-font").popover("hide")};b.find(".close").on("click",e),$(document).bind("click",d)}),_widthSlider=$("#attr-size-slider").toggleClass("disabled",a.disabled).find(".slider").slider({min:1,max:50,step:1,orientation:"vertical",value:paper&&paper.projet?paper.project.currentStyle.strokeWidth:5,tooltip:a.disabled?"hide":"show",selection:"none",reversed:!0,enabled:!a.disabled}).on("slide",function(a){attributes.setStrokeWidth(a.value,!1)}).on("slideStop",function(a){attributes.setStrokeWidth(a.value,!0)}),attributes.events.strokeWidthChanged.add(function(a){_widthSlider.slider("setValue",a)}),_opacitySlider=$("#attr-opacity-slider").toggleClass("disabled",a.disabled).find(".slider").slider({min:0,max:100,step:10,orientation:"vertical",value:100,tooltip:a.disabled?"hide":"show",formatter:function(a){return a+" %"},selection:"none",reversed:!0,enabled:!a.disabled}).on("slide",function(a){attributes.setOpacity(a.value,!1)}).on("slideStop",function(a){attributes.setOpacity(a.value,!0)});var d,e=$("#attr-zoom"),f=e.find("input[name=zoomLevel]").val(100).on("blur",function(){var a=$(this);a.val(parseInt(parseFloat($(this).val()))+" %")}).on("focus",function(){var a=$(this);a.val(parseInt(parseFloat($(this).val())))}).on("change",function(){var a=parseInt(parseFloat($(this).val()));isNaN(a)||attributes.setZoom(a/100)}),g=e.find(".slider").slider({selection:"none",value:100,enabled:!a.disabled,tooltip:a.disabled?"hide":"show",formater:function(a){return a+"%"}}).on("slide",function(a){var b=parseInt(a.value,10);attributes.setZoom(b/100)});_canvas.on("mousewheel",function(b){if(b.ctrlKey){if(b.preventDefault(),!a.disabled){var c=_widthSlider.slider("getValue")+Math.min(1,Math.max(-1,b.deltaY));_widthSlider.slider("setValue",c),attributes.setStrokeWidth(c,!1),d&&clearTimeout(d),d=setTimeout(function(){attributes.setStrokeWidth(c,!0)},500)}}else b.altKey||b.metaKey?(b.preventDefault(),attributes.deltaZoom(b.deltaY/20,[b.offsetX,b.offsetY])):(b.preventDefault(),attributes.deltaZoom(b.deltaY,[b.offsetX,b.offsetY]))}),attributes.events.zoomChanged.add(function(a){var b=Math.floor(100*a);f.val(b+" %"),g.slider("setValue",b)})}function zoomFitContent(){var a=view.getLayerByName("image"),b=a.children[1];if(b){var c=paper.view.viewSize.divide(b.size);attributes.setZoom(Math.min(c.width,c.height),"center"),paper.view.draw()}}function updateUserLayers(){config.ui.show_users_results&&$.each(view.getAllUsersLayers(),function(a,b){0==annotList.find("li[data-layer-id="+b.id+"]").length&&$(layerListItemTpl({id:b.id,visibleClass:visibleClass,name:b.data.owner||b.name})).prependTo(annotList)})}function onUserLayerVisChange(a,b){updateUserLayerState(getListItem(a),b)}function selectLayerListItem(a,b){var c=$(a),d=annotList.find(".list-group-item.selected");b&&(d.each(function(a,b){toggleLayer($(b),!1)}),toggleLayer(c,!0)),d.removeClass("selected"),c.addClass("selected");var e=view.getLayerByName(c.data("layerId"));e&&e.activate()}function updateUserLayerState(a,b){a.toggleClass("layer-hidden",!b).find(".layer-status").toggleClass(hiddenClass,!b).toggleClass(visibleClass,b)}function toggleLayer(a,b){view.toggleLayer(a.data("layerId"),b)}function toggleAll(a){var b=a;annotList.find(".list-group-item").each(function(c,d){b=$(d).is(".selected")?!0:a,toggleLayer($(d),b)})}function _adjustCanvasFrame(){var a=_canvas.width(),b=_canvas.height();if(_canvasToolBar.css("width",a+4),_canvasCtnr.width(a+2).height(b+2),_sideCol.height(b+_canvasToolBar.outerHeight()+5),_annotationListCtnr.length>0){var c=b+_canvasCtnrTop-_annotationListCtnr.offset().top;_annotationListCtnr.css("maxHeight",Math.max(c,80))}}function updateColorSelector(a){if("string"!=typeof a){if(!a||"function"!=typeof a.toCSS)return;a=a.toCSS()}_colorSelector.find(" > button").css("color",a),$("#tool-fill-color").css("color",a)}function setupColorSelector(a){if(a)_colorSelector.find(".tinter").attr("disabled","disabled"),updateColorSelector("#999");else{var b=null;_colorSelector.find(".tinter").removeAttr("disabled"),_colorSelector.find(".picker").colorpicker().on("mouseup",function(){var a=$(this).data("colorpicker"),b=a.picker;if(b.hasClass("colorpicker-visible")){var c=a.color.toRGB(),d="rgba("+c.r+", "+c.g+", "+c.b+", "+c.a+")";updateColorSelector(d),attributes.setColor(d),setTimeout(function(){_colorSelector.find(".picker").colorpicker("hide"),_colorSelector.find(".color-menu").dropdown("toggle")},100)}}).on("changeColor",function(a){var c=a.color.toRGB(),d="rgba("+c.r+", "+c.g+", "+c.b+", "+c.a+")";updateColorSelector(d),_colorSelector.find(".color-menu .cx").css("background-color",d),attributes.setColor(d,!1),b&&clearTimeout(b),b=setTimeout(function(a){return function(){attributes.setColor(a,!0)}}(d),1e3)}),_colorSelector.find(".color-menu > li > a").click(function(a){var b=$(this);if(a.preventDefault(),!b.is(".cx")){var c=b.css("background-color");updateColorSelector(c),attributes.setColor(c)}}),attributes.getColor()&&updateColorSelector(attributes.getColor().toCSS())}}function disableProperties(a){for(var b in itemProperties)a&&itemProperties[b].setValue(""),itemProperties[b].enable(!1)}function displayProperties(a){var b=!1;if(a&&a.data&&a.data.prop)for(var c in itemProperties)b=a.data.prop.hasOwnProperty(c)||"fill"===c,b?itemProperties[c].enable().setValue(a.data.prop[c]):itemProperties[c].enable(!1);else disableProperties()}function updateSelectedItemProp(a){if(a&&"string"==typeof a){var b=itemProperties[a].getValue(),c=!1;return null!==b&&void 0!==b&&(c=view.setSelectedItemProperty(a,b,!0)),c}}function onPropertyChange(a){updateSelectedItemProp(a.data.pName)}function onPropertyBlur(){}function initPropertiesPanel(){for(var a in itemProperties)if("string"==typeof itemProperties[a].el){var b=$(itemProperties[a].el);1===b.length?(itemProperties[a].el=b,"function"==typeof itemProperties[a].init&&itemProperties[a].init(),"function"==typeof itemProperties[a].onChange?b.on("change",itemProperties[a].onChange):b.on("change",null,{pName:a},onPropertyChange),"function"==typeof itemProperties[a].onBlur?b.on("blur",itemProperties[a].onBlur):b.on("blur",null,{pName:a},onPropertyBlur)):delete itemProperties[a]}disableProperties(!0),$(document).on("keydown",function(a){$("*:focus");switch(a.which){case 49:case 50:case 51:}})}function onToolActivated(a){var b=$("[data-tool-name]").filter("[checked=checked]"),c=$("[data-tool-name="+a+"]");$("[data-tool-name]").button(),b.get(0)!==c.get(0)&&(b.removeAttr("checked").parent(".btn").removeClass("active"),c.attr("checked","checked").parent(".btn").addClass("active")),_canvas.removeClass(function(a,b){var c=b.split(" ").filter(function(a){return a.match(/cursor-tool-/)});return c&&c.join(" ")}).addClass("cursor-tool-"+a)}function adjustCanvasToImage(){var a=_$w.width(),b=_$w.height(),c=a-_reservedWidth,d=320,e=b-_reservedHeight,f=240;a=Math.max(Math.min(a,c),d),b=Math.max(Math.min(b,e),f),view.resize(a,b),_adjustCanvasFrame()}function _showAnObjMgr(a){var b=this;a.preventDefault(),b._anObjMgr||(b._anObjMgr=new AnObjMgr({el:"#aom-modal",aomListCtner:$("#aom-user-images-list .aom-list-container"),sharedAomListCtner:$("#aom-shared-images-list .aom-list-container")})),b._anObjMgrModal||(b._anObjMgrModal=$("#aom-modal").data("loaded",!1).modal({show:!1})),b._anObjMgrModal.modal("show"),b._anObjMgrModal.data("loaded")||b._anObjMgr.loadAnObjs({success:function(){b._anObjMgrModal&&(b._anObjMgrModal.find(".aom-loader").remove(),b._anObjMgrModal.data("loaded",!0)),b._anObjMgr.selectCurrent()}})}function updateCurrentThumbnail(thumbnailPath){if(this._anObjMgrModal){var curItemImg=this._anObjMgrModal.find(".aom-list-item.current img");curItemImg&&0!==curItemImg.length&&(thumbnailPath&&""!==thumbnailPath||(thumbnailPath=eval("(function(){function url(u){return u}return "+curItemImg.css("backgroundImage")+"})()").split("?")[0]),curItemImg.css("backgroundImage",'url("'+thumbnailPath+"?nc=_"+(""+Math.random()).substr(3)+'")'))}}function _export(a){var b=config.annotable.slug+"__"+(config.mode===config.MODE_EDIT?config.user.username:"review");switch(a){case"png":exporter.export(b,"png",{callback:function(){adjustCanvasToImage()}}).done(function(){});break;case"svg":exporter.export(b,"svg")}}function setState(a){switch(a){case"thumbNotSaved":break;case"thumbSaved":this.updateCurrentThumbnail()}}var _$w=$(window),_canvas=null,_canvasCtnr=null,_canvasToolBar=null,_sideCol=null,_toolsCol=null,_annotationListCtnr=null,_canvasCtnrTop,_colorSelector=$("#tool-colorselect"),_opacitySlider,_widthSlider,_reservedWidth=0,_reservedHeight=0,_events={saveButClick:new Signal,autoSaveChanged:new Signal},updateReservedSpace=function(){var a=$("#canvas-col").offset().top,b=_toolsCol.outerWidth(),c=_canvasToolBar.outerHeight();(updateReservedSpace=function(){_reservedWidth=(_toolsCol.is(":visible")?b:0)+(config.ui.show_side_col?_sideCol.is(".collapsed")?32:_sideCol.outerWidth():50)+24,_reservedHeight=a+c+20})()},annotListCtr=$("#annotation-list-container"),annotList=annotListCtr.find(" > ul"),hiddenClass="icon-eye-close",visibleClass="icon-eye-open",layerListItemTpl=_.template(['<li class="list-group-item" data-layer-id="<%= id %>">','<span class="layer-status <%= visibleClass %>"></span>','<span class="layer-title"><%= name %></span>',"</li>"].join("")),getListItem=_.memoize(function(a){return annotList.find("li[data-layer-id="+a.id+"]")},function(a){return a.id});annotList.on("click",".layer-status",function(a){a.stopPropagation();var b=$(this),c=b.parent(".list-group-item");toggleLayer(c)}),annotList.on("click",".list-group-item",function(){selectLayerListItem(this,!0),toggleLayer($(this),!0)}),$("#btn-layers-hideall").click(function(){toggleAll(!1)}),$("#btn-layers-showall").click(function(){toggleAll(!0)}),$("#btn-layers-next").click(function(){var a=annotList.find(".list-group-item.selected").next();1===a.length&&selectLayerListItem(a,!0)}),$("#btn-layers-prev").click(function(){var a=annotList.find(".list-group-item.selected").prev();1===a.length&&selectLayerListItem(a,!0)});var transparentColor=new paper.Color(1,1,1,0),itemProperties={confidence:{el:"#confidence-input",enable:function(a){return a=void 0!==a?!!a:!0,this.el.attr("disabled")&&!a?this:(this.el.rating(a?"enable":"disable"),this.el.closest(".property-group").toggleClass("disabled",!a),config.mode!==config.MODE_EDIT&&this.el.rating("disable"),this)},setValue:function(a){return a=parseInt(a,10),isNaN(a)?void 0:(config.mode===config.MODE_EDIT?this.el.val(a).siblings("[data-value]").trigger("mouseleave"):this.el.siblings("[data-value]").each(function(b,c){var d=$(c);d.toggleClass("label-warning rating-on",d.data("value")<=a).toggleClass("rating-off",d.data("value")>a)}),this)},getValue:function(){var a=parseInt(this.el.val(),10);return isNaN(a)?null:a},init:function(){}},fill:{el:"#fill-check",enable:function(a){return a=void 0!==a?!!a:!0,config.mode!==config.MODE_EDIT&&(a=!1),a?this.el.removeAttr("disabled"):this.el.attr("disabled","disabled"),this.el.closest(".property-group").toggleClass("disabled",!a),this},setValue:function(a){return a=!!a,this.el.prop("checked",a),this},getValue:function(){return!!this.el.prop("checked")},onChange:function(){for(var a,b=$(this).is(":checked"),c=!1,d=view.getSelectedAnnotations(),e=0;a=d[e];e++)if("function"!=typeof a.data.setColor){if(a.data&&a.data.prop&&a.data.prop.fill===b)continue;c=!0,a.fillColor=b?paper.project.currentStyle.fillColor:null,paper.view.draw()}var f=updateSelectedItemProp("fill");c&&!f&&tools.events.annotationChanged.dispatch(d)},init:function(){}},comment:{el:"#prop-annot-comment",enable:function(a){return a=void 0!==a?!!a:!0,("review"===config.mode||config.annotable&&config.annotable.locked)&&(a=!1),a?this.el.removeAttr("disabled"):this.el.attr("disabled","disabled"),this.el.closest(".property-group").toggleClass("disabled",!a),this},setValue:function(a){return this.el.val(a),this},getValue:function(){return this.el.val()},init:function(){var a=this,b=null;a.el.on("keyup",function(){b&&clearTimeout(b),b=setTimeout(function(){updateSelectedItemProp("comment"),b=null},500)})}}};tools.events.activated.add(onToolActivated);var _raster=null;return{init:init,events:_events,updateUserLayers:updateUserLayers,displayProperties:displayProperties,updateReservedSpace:updateReservedSpace,adjustCanvasToImage:adjustCanvasToImage,exporter:exporter,updateCurrentThumbnail:updateCurrentThumbnail,setState:setState}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('helper/theme',["jquery"],function(a){var b={updateTheme:function(b){b=b||localStorage.getItem("adimTheme")||"dark",a("body").toggleClass("theme-light","light"===b).toggleClass("theme-dark","dark"===b),a("#main-navbar").toggleClass("navbar-inverse","dark"===b).toggleClass("navbar-default","light"===b).find(".btn-adim-dark, .btn-default").toggleClass("btn-adim-dark","dark"===b).toggleClass("btn-default","light"===b),a("#side-col").find(".panel").toggleClass("panel-dark","dark"===b).toggleClass("panel-default","light"===b)},setTheme:function(a){return!a||"dark"!==a&&"light"!==a||(localStorage.setItem("adimTheme",a),updateTheme()),!1}};return b});
/*!
* jQuery UI Widget 1.10.4+amd
......@@ -17295,10 +17305,10 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
 
}));
 
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('helper/fileUploader',["jquery","jquery.fileupload","jquery.iframe-transport","jquery.fileupload-proc"],function(a){function b(b){b=a.extend(!0,{elem:"#fileupload",progBar:".progress-bar",alertBox:".adim-fu-error-box",acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,maxFileSize:2*Math.pow(2,20),dropZone:a(document),onStart:null,processstart:null,autoUpload:!0,add:null},b),a(function(){function c(a){a.preventDefault()}var d=a(b.elem),e=a(b.progBar),f=a(b.alertBox);d.fileupload({dataType:"json",dropZone:b.dropZone,autoUpload:b.autoUpload,done:function(a,b){!b.result.error&&b.result.next&&document.location.assign(b.result.next)},processstart:function(){"function"==typeof b.processstart&&b.processstart(b)},start:function(){f.find("[class^=adim-fu-error-]").addClass("hide").end().addClass("hide"),e.closest(".progress-wrapper").removeClass("hide"),a("#fileupload").fileupload("disable"),a(document).on("drop dragover",c),"function"==typeof b.onStart&&b.onStart(b)},progressall:function(a,b){var c=parseInt(b.loaded/b.total*100,10),d=c+"%";e.text(d).css("width",d)},processQueue:[{action:"validate",always:!0,acceptFileTypes:b.acceptFileTypes,maxFileSize:b.maxFileSize}],processfail:function(b,d){var e=d.files[d.index].error;f.find("[class^=adim-fu-error-]").addClass("hide"),f.removeClass("hide").find(".adim-fu-error-"+e).removeClass("hide"),a(document).off("drop dragover",c),a("#fileupload").fileupload("enable")}}),"function"==typeof b.add&&d.fileupload("option","add",b.add)})}return a.widget("blueimp.fileupload",a.blueimp.fileupload,{processActions:{validate:function(b,c){if(c.disabled)return b;var d=a.Deferred(),e=b.files[b.index];return c.acceptFileTypes.test(e.type)?e.size>c.maxFileSize?(b.files[b.index].error="maxFileSize",d.rejectWith(this,b)):d.resolveWith(this,b):(b.files[b.index].error="acceptFileTypes",d.rejectWith(this,b)),d.promise()}}}),{initialize:b,init:b}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/main-newao',["jquery","paper","signals","adim/config","adim/view","adim/io","adim/tools","adim/attributes","adim/ui","helper/theme","helper/fileUploader"],function(a,b,c,d,e,f,g,h,i,j,k){a(function(){return j.updateTheme(),e.init("my-canvas")?(i.init({ro:!0}),i.adjustCanvasToImage(1),a("#page-loader").fadeOut(100),k.init({elem:"#fileupload",progBar:".adim-fu-status .progress-bar",alertBox:".adim-fu-status .adim-fu-error-box",acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,maxFileSize:d.uploadMaxFileSize,dropZone:a(document)}),void k.init({elem:"#fileupload-alt",progBar:"#adim-fu-alt-status .progress-bar",alertBox:"#adim-fu-alt-status .adim-fu-error-box",acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,maxFileSize:d.uploadMaxFileSize,dropZone:null,processstart:function(){a("#adim-fu-alt-status").modal("show")}})):void(console&&console.error&&void 0)})});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/main-newao',["jquery","paper","signals","adim/config","adim/view","adim/io","adim/tools","adim/attributes","adim/ui","helper/theme","helper/fileUploader"],function(a,b,c,d,e,f,g,h,i,j,k){a(function(){return j.updateTheme(),e.init("my-canvas")?(i.init({ro:!0}),i.adjustCanvasToImage(1),a("#page-loader").fadeOut(100),k.init({elem:"#fileupload",progBar:".adim-fu-status .progress-bar",alertBox:".adim-fu-status .adim-fu-error-box",acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,maxFileSize:d.uploadMaxFileSize,dropZone:a(document)}),void k.init({elem:"#fileupload-alt",progBar:"#adim-fu-alt-status .progress-bar",alertBox:"#adim-fu-alt-status .adim-fu-error-box",acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,maxFileSize:d.uploadMaxFileSize,dropZone:null,processstart:function(){a("#adim-fu-alt-status").modal("show")}})):void(console&&console.error&&console.error("View not initialized. Abort."))})});
/**
* Copyright (C) 2014 Université de Lausanne, RISET,
* < http://www.unil.ch/riset/ >
......
......@@ -12671,7 +12671,7 @@ _addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b
!0,b,c)},remove:function(a,b){g(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams=
b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var f=e;f.Signal=e;typeof define==="function"&&define.amd?define('signals',[],function(){return f}):typeof module!=="undefined"&&module.exports?module.exports=f:i.signals=
f})(this);
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/config',["jquery"],function(a){var b="ADIM_CONFIG",c=a.extend(!0,{MODE_EDIT:"edit",MODE_REVIEW:"review",MODE_ANALYSIS:"analysis",adim_global_varname:"ADIM",annotable:{image:"image/",thumbnail:"thumb/"},image_url:"",autoSaveThumbnail:!0,io:{},userEngine:{limit:7,remoteUrl:"http://path/to/suggestion/url/?q=%QUERY",rateLimitWait:300},ui:{show_side_col:!0,show_users_results:!1,show_annot_properties:!0},uploadMaxFileSize:2},window[b]||{},!0);return c.csrfToken&&a.ajaxSetup({beforeSend:function(a){a.setRequestHeader("X-CSRFToken",c.csrfToken)}}),c});
// Underscore.js 1.7.0
// http://underscorejs.org
......@@ -13417,35 +13417,35 @@ define("bloodhound", ["jquery"], (function (global) {
};
}(this)));
 
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/users',["jquery","underscore","bloodhound","adim/config"],function(a,b,c,d){function e(){i=new c({datumTokenizer:function(a){return c.tokenizers.nonword(a.username)},queryTokenizer:c.tokenizers.whitespace,limit:d.userEngine.limit,remote:{url:d.userEngine.remoteUrl,rateLimitWait:d.userEngine.rateLimitWait}}),i.initialize()}function f(b){a.isArray(b)&&b.length>=0&&i.add(b)}function g(a){var c=b.find(i.index.datums,function(b){return b.id==a});return c?c.username:""}function h(c){var d=a.Deferred(),e=b.find(i.index.datums,function(a){return a.id==c});return e?d.resolve(e.username):d.reject(),d}var i=null;return e(),{engine:i,addUsers:f,getById:g,searchById:h}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('helper/utils',["paper"],function(a){function b(a,b){b=b===!0,a&&(a.data&&a.data.selectListeners&&a.attach(a.data.selectListeners),b&&"function"==typeof a.setSelected&&a.setSelected(!0))}function c(b,c){c=c?c:a.project.getSelectedItems(),b=b===!0;for(var d,e=0;d=c[e];e++)d.data&&d.data.selectListeners&&d.detach(d.data.selectListeners),b&&(d.fullySelected=d.selected=!1)}function d(){var b=[];return a.project.getSelectedItems().map(function(a){a.parent&&a.parent.data&&a.parent.data.type&&-1===b.indexOf(a.parent)?b.push(a.parent):a.data&&a.data.type&&-1===b.indexOf(a)&&b.push(a)}),b}return{addSelectListeners:b,removeSelectListeners:c,getSelectedAnnotations:d}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/select',["paper","adim/config","helper/utils"],function(a,b,c){function d(a,b){var c=a.hitTest(b.point,n);switch(i=j=k=null,v=w=x=y=null,c.type){case"handle-in":case"handle-out":if(a.selected){var d=c.type.split("-");k=d[1],i=c.segment}break;case"segment":i=c.segment;break;case"fill":case"stroke":b.modifiers.shift||(a.data&&"function"==typeof a.data.setDragMode?a.data.setDragMode("FULL_DRAG",{item:c.item}):j=!0);break;case"bounds":var e=c.name.split("-");if(["shape","ellipse","rectangle","circle"].indexOf(c.item.type)>-1)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else{var f="bottom"===e[0]?"top":"bottom";f+="left"===e[1]?"Right":"Left";var g=["right"===e[1]?1:-1,"bottom"===e[0]?1:-1];c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e,item:c.item,fixedPt:c.item.bounds[f],resizeDir:g})}else if("arrow"===c.item.data.type&&"right"===e[1])try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e})}catch(h){}else if("text"===c.item.data.type)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{item:c.item,nameStr:c.name,nameParts:e})}catch(h){}}}function e(a){var b=a.point.subtract(i.point),c=a.lastPoint.subtract(i.point),d=b.angle-c.angle,e=!a.modifiers.option;"in"===k?(i.handleIn=b,e&&(i.handleOut.angle+=d)):(i.handleOut=b,e&&(i.handleIn.angle+=d))}function f(b){var c,d,e;c=new a.Rectangle({from:w,to:b.point}).size,b.event.shiftKey&&(e=v.bounds.size.width/v.bounds.size.height,c.height=c.width/e),d=c.subtract(v.bounds.size).multiply(x).divide(2),v.size=c,v.translate(d.width,d.height)}function g(a,b){a.data&&"function"==typeof a.data.itemMouseDrag?a.data.itemMouseDrag.call(a,b):v?f(b):k&&i.path.id===a.id?e(b):i&&i.path.id===a.id?i.point=b.point:j&&a.translate(b.delta),r=!0}function h(){}var i,j,k,l="select",m={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!1,handles:!1},n={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!0,handles:!0},o=b.mode===b.MODE_EDIT,p=!o,q=null,r=!1,s=null,t={annotationAdded:null,annotationChanged:null,annotationSelected:null},u=null,v=null,w=null,x=[1,1],y=null,z={tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0},A={onMouseDown:function(b){i=j=k=v=w=null;var e=p?a.project.hitTest(b.point,m):a.project.activeLayer.hitTest(b.point,z);if(e||(e=p?a.project.hitTest(b.point,m):a.project.activeLayer.hitTest(b.point,m)),!o)return a.project.deselectAll(),t.annotationSelected.dispatch(null),a.view.draw(),void("pixel"!==e.type&&(q=e&&e.item,q&&q.parent.data.type&&(q=q.parent),q.data.type&&(q.selected=!0),t.annotationSelected.dispatch(q)));var f=c.getSelectedAnnotations();if(1===f.length&&(!e||"pixel"===e.type||e.item.id!==f[0].id)){var g=a.project.activeLayer.hitTest(b.point,n);g&&g.item===f[0]&&(e=g)}var h=b.modifiers.shift&&o;if(q=e&&e.item,q&&q.parent&&q.parent.data&&q.parent.data.type&&(q=q.parent),q&&(q.selected||h)||(a.project.deselectAll(),t.annotationSelected.dispatch(null)),q){if(q.layer&&"image"===q.layer.name)return;q.selected?(r=!1,h&&"bounds"!==e.type?q.fullySelected=!1:q.responds("mousedown")&&"bounds"!==e.type||d(q,b)):("group"===q.type?"function"==typeof q.oSetSelected?!q.selected&&q.oSetSelected(!0):q.children.map(function(a){a.selected=!0}):-1===["handle-in","handle-out"].indexOf(e.type)&&(q.selected=!0,q.responds("mousedown")&&q.onMouseDown(b)),o&&q.selected&&"path"===q.type),t.annotationSelected.dispatch(q)}},onMouseDrag:function(a){if(o){var b=c.getSelectedAnnotations();if(1===b.length)q.responds("mousedrag")||g(q,a);else{r=!0;for(var d,e=0;d=b[e];e++)d.parent&&d.parent.data&&d.parent.data.type&&(d=d.parent),d.data.type&&(d===q&&d.responds("mousedrag")||d.translate(a.delta)),d=null}}},onMouseUp:function(b){u&&(u.remove(),u=null);var c=[];a.project.getSelectedItems().map(function(a){-1===c.indexOf(a)&&(a.data.type?c.push(a):a.parent.data.type&&-1===c.indexOf(a.parent)&&c.push(a.parent))}),o&&(q&&1===c.length&&(q.responds("mouseup")||h(q,b)),r&&(t.annotationChanged.dispatch(c),r=!1))},onKeyDown:function(b){var c=a.project.getSelectedItems();if(o)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyDown){d.onKeyDown(b);break}},onKeyUp:function(b){var c=a.project.getSelectedItems();if(o)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyUp){d.onKeyUp(b);break}}};return s=new a.Tool(A),{name:l,tool:s,registerEvent:function(a,b){t[a]=b},_tools:null}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/select',["paper","adim/config","helper/utils"],function(a,b,c){function d(a,b){var c=a.hitTest(b.point,p);switch(k=l=m=null,w=x=y=z=null,c.type){case"handle-in":case"handle-out":if(a.selected){var d=c.type.split("-");m=d[1],k=c.segment}break;case"segment":k=c.segment;break;case"fill":case"stroke":b.modifiers.shift||(a.data&&"function"==typeof a.data.setDragMode?a.data.setDragMode("FULL_DRAG",{item:c.item}):l=!0);break;case"bounds":var e=c.name.split("-");if(["shape","ellipse","rectangle","circle"].indexOf(c.item.type)>-1)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else{var f="bottom"===e[0]?"top":"bottom";f+="left"===e[1]?"Right":"Left";var g=["right"===e[1]?1:-1,"bottom"===e[0]?1:-1];c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e,item:c.item,fixedPt:c.item.bounds[f],resizeDir:g})}else if("arrow"===c.item.data.type&&"right"===e[1])try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{nameStr:c.name,nameParts:e})}catch(h){}else if("text"===c.item.data.type)if("center"===e[0]||"center"===e[1])a.data.setDragMode("FULL_DRAG",{item:a});else try{c.item.data.setDragMode.call(c.item,"DRAG_HANDLE",{item:c.item,nameStr:c.name,nameParts:e})}catch(h){}}}function e(a){var b=a.point.subtract(k.point),c=a.lastPoint.subtract(k.point),d=b.angle-c.angle,e=!a.modifiers.option;"in"===m?(k.handleIn=b,e&&(k.handleOut.angle+=d)):(k.handleOut=b,e&&(k.handleIn.angle+=d))}function f(b){var c,d,e;c=new a.Rectangle({from:x,to:b.point}).size,b.event.shiftKey&&(e=w.bounds.size.width/w.bounds.size.height,c.height=c.width/e),d=c.subtract(w.bounds.size).multiply(y).divide(2),w.size=c,w.translate(d.width,d.height)}function g(a,b){a.data&&"function"==typeof a.data.itemMouseDrag?a.data.itemMouseDrag.call(a,b):w?f(b):m&&k.path.id===a.id?e(b):k&&k.path.id===a.id?k.point=b.point:l&&a.translate(b.delta),t=!0}function h(){}function i(a){return r=a,q=!a,a}var j,k,l,m,n="select",o={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!1,handles:!1},p={segments:!0,stroke:!0,fill:!0,tolerance:5,bounds:!0,handles:!0},q=b.mode===b.MODE_EDIT,r=!q,s=null,t=!1,u={annotationAdded:null,annotationChanged:null,annotationSelected:null},v=null,w=null,x=null,y=[1,1],z=null,A={tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0},B={onMouseDown:function(b){k=l=m=w=x=null;var e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,A);if(e||(e=r?a.project.hitTest(b.point,o):a.project.activeLayer.hitTest(b.point,o)),!q)return a.project.deselectAll(),u.annotationSelected.dispatch(null),a.view.draw(),void("pixel"!==e.type&&(s=e&&e.item,s&&s.parent.data.type&&(s=s.parent),s.data.type&&(s.selected=!0),u.annotationSelected.dispatch(s)));var f=c.getSelectedAnnotations();if(1===f.length&&(!e||"pixel"===e.type||e.item.id!==f[0].id)){var g=a.project.activeLayer.hitTest(b.point,p);g&&g.item===f[0]&&(e=g)}var h=b.modifiers.shift&&q;if(s=e&&e.item,s&&s.parent&&s.parent.data&&s.parent.data.type&&(s=s.parent),s&&(s.selected||h)||(a.project.deselectAll(),u.annotationSelected.dispatch(null)),s){if(s.layer&&"image"===s.layer.name)return;s.selected?(t=!1,h&&"bounds"!==e.type?s.fullySelected=!1:s.responds("mousedown")&&"bounds"!==e.type||d(s,b)):("group"===s.type?"function"==typeof s.oSetSelected?!s.selected&&s.oSetSelected(!0):s.children.map(function(a){a.selected=!0}):-1===["handle-in","handle-out"].indexOf(e.type)&&(s.selected=!0,s.responds("mousedown")&&s.onMouseDown(b)),q&&s.selected&&"path"===s.type),u.annotationSelected.dispatch(s)}},onMouseDrag:function(a){if(q){var b=c.getSelectedAnnotations();if(1===b.length)s.responds("mousedrag")||g(s,a);else{t=!0;for(var d,e=0;d=b[e];e++)d.parent&&d.parent.data&&d.parent.data.type&&(d=d.parent),d.data.type&&(d===s&&d.responds("mousedrag")||d.translate(a.delta)),d=null}}},onMouseUp:function(b){v&&(v.remove(),v=null);var c=[];a.project.getSelectedItems().map(function(a){-1===c.indexOf(a)&&(a.data.type?c.push(a):a.parent.data.type&&-1===c.indexOf(a.parent)&&c.push(a.parent))}),q&&(s&&1===c.length&&(s.responds("mouseup")||h(s,b)),t&&(u.annotationChanged.dispatch(c),t=!1))},onKeyDown:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyDown){d.onKeyDown(b);break}},onKeyUp:function(b){var c=a.project.getSelectedItems();if(q)for(var d,e=0;d=c[e];e++)if(d.data.type&&"function"==typeof d.onKeyUp){d.onKeyUp(b);break}}};return j=new a.Tool(B),{name:n,tool:j,setRo:i,registerEvent:function(a,b){u[a]=b},_tools:null}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/pan',["paper"],function(a){var b={onMouseDrag:function(b){var c=b.point.subtract(b.downPoint).multiply(-1);a.project.view.scrollBy(c),a.project.view.draw()},onMouseDown:function(){jQuery(a.view.element).addClass("cursor-tool-pan-down")},onMouseUp:function(){jQuery(a.view.element).removeClass("cursor-tool-pan-down")}};return{name:"pan",tool:new a.Tool(b)}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/drawing',["paper"],function(a){function b(b){b.data.prop="object"==typeof b.data.prop?b.data.prop:{};for(var d in i)b.data.prop.hasOwnProperty(d)||(b.data.prop[d]=i[d]);b.onPropertyChange=c,b.onDoubleClick=function(){this.selected=!1,this.fullySelected=!0,a.view.draw()}}function c(b,c){"confidence"===b?(this.style=j[c],a.view.draw()):"processus"===b||"fill"===b&&(this.closed=c,a.view.draw())}function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,c){var d=c.importJSON(a);return b(d),d}var f="drawing",g=null,h={annotationAdded:null,annotationSelected:null},i={comment:"",confidence:3,fill:!1},j={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}},k={onMouseDown:function(b){a.project.deselectAll(),g=new a.Path({fillColor:null,strokeCap:"round"}),g.add(b.point)},minDistance:5,onMouseDrag:function(a){g&&g.add(a.point)},onMouseUp:function(){if(g){g.simplify(20);var c=g.clone();g.remove(),g=null,c.data.type=f,c.data.tId="a"+c._id,b(c),a.view.draw(),c.fullySelected=!0,"function"==typeof h.annotationSelected.dispatch&&h.annotationSelected.dispatch(c),"function"==typeof h.annotationAdded.dispatch&&h.annotationAdded.dispatch(c)}}};return{name:f,tool:new a.Tool(k),registerEvent:function(a,b){h[a]=b},exportJSON:d,importJSON:e}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/drawing',["paper"],function(a){function b(b){b.data.prop="object"==typeof b.data.prop?b.data.prop:{};for(var d in k)b.data.prop.hasOwnProperty(d)||(b.data.prop[d]=k[d]);b.onPropertyChange=c,b.onDoubleClick=function(){i||(this.selected=!1,this.fullySelected=!0,a.view.draw())}}function c(b,c){"fill"===b&&(this.closed=c,a.view.draw())}function d(a){var b=this.selected,c=this.fullySelected;this.selected=this.fullySelected=!1;var d=this.exportJSON({asString:!1});return delete d[1].fontFamily,delete d[1].font,delete d[1].fontSize,delete d[1].leading,d=a&&a.asString===!1?d:JSON.stringify(d),this.fullySelected=c,this.selected=b,d}function e(a,c){var d=c.importJSON(a);return b(d),d}function f(a){return a!==i&&(i=a),i}var g="drawing",h=null,i=!1,j={annotationAdded:null,annotationSelected:null},k={comment:"",confidence:3,fill:!1},l={onMouseDown:function(b){a.project.deselectAll(),h=new a.Path({fillColor:null,strokeCap:"round"}),h.add(b.point)},minDistance:5,onMouseDrag:function(a){h&&h.add(a.point)},onMouseUp:function(){if(h){h.simplify(20);var c=h.clone();h.remove(),h=null,c.data.type=g,c.data.tId="a"+c._id,b(c),a.view.draw(),c.fullySelected=!0,"function"==typeof j.annotationSelected.dispatch&&j.annotationSelected.dispatch(c),"function"==typeof j.annotationAdded.dispatch&&j.annotationAdded.dispatch(c)}}};return{name:g,tool:new a.Tool(l),setRo:f,registerEvent:function(a,b){j[a]=b},exportJSON:d,importJSON:e}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/lines',["paper","helper/utils"],function(a){function b(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function c(a,b){var c=b.importJSON(a);return d(c),c}function d(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in p)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=p[b]);a.onPropertyChange=e}function e(b,c){"confidence"===b?(this.style=q[c],a.view.draw()):"processus"===b||"fill"===b&&(this.closed=c,a.view.draw())}function f(){if(n=null,k&&k.remove(),i=!1,h.length>l){var b=h.clone();b.style=a.project.currentStyle,b.strokeCap="round",b.strokeJoin="round",b.fillColor=null,b.data.type=g,b.data.tId="a"+b._id,d(b),b.selected=!0,"function"==typeof o.annotationSelected.dispatch&&o.annotationSelected.dispatch(b),"function"==typeof o.annotationAdded.dispatch&&o.annotationAdded.dispatch(b)}h.remove()}var g="lines",h=null,i=!1,j=!1,k=null,l=5,m=!1,n=null,o={annotationAdded:null,annotationChanged:null},p={comment:"",confidence:3,fill:!1},q={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}},r={segments:!0,stroke:!0,tolerance:5},s={onMouseDown:function(b){if(i){if(h){if(b.point.subtract(b.lastPoint).length<l)return void f();k&&k.remove(),h.add(b.point)}}else{var c=a.project.activeLayer.hitTest(b.point,r);if(c&&c.item&&c.item.selected&&c.item.data.type===g)if(h=c.item,"stroke"===c.type){var d=c.location;k=h.insert(d.index+1,b.point),j=!0}else"segment"===c.type&&(b.modifiers.option?(c.segment.remove(),o.annotationChanged.dispatch(c.item)):(k=c.segment,j=!0));else a.project.deselectAll(),h=new a.Path({strokeColor:a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor,fillColor:null,strokeCap:"round",strokeJoin:"round"}),i=!0,h.add(b.point)}},onMouseMove:function(b){i?(n=b.point,k&&k.remove(),k=new a.Path(b.downPoint,b.point),k.strokeColor=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor):j&&k&&(m=!0,k.point=b.point)},onMouseUp:function(){j&&(j=!1,k&&(m&&(m=!1,o.annotationChanged.dispatch(k.path)),k=null))},onKeyDown:function(a){switch(a.key){case"enter":i&&h&&(n&&h.add(n),f());break;case"escape":i&&h&&f()}}};return{name:g,tool:new a.Tool(s),registerEvent:function(a,b){o[a]=b},exportJSON:b,importJSON:c}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/Shape.class',["paper"],function(){return function(a,b){function c(a){var b=this.exportJSON({asString:!1});return delete b[1].fontFamily,delete b[1].font,delete b[1].fontSize,delete b[1].leading,a&&a.asString?JSON.stringify(b):b}function d(a,b){var c=b.importJSON(a);return h(c),c}function e(a){var b=["ellipse","rectangle"];return!!a&&a.data&&a.data.type&&b.indexOf(a.data.type)>-1}function f(b,c){var d;if(b.modifiers.shift)var e=o.subtract(p).length/1.414213,f=p.subtract(o).quadrant,g=2===f||3===f?-e:e,h=3===f||4===f?-e:e;switch(a){case"circle":d=new paper.Shape.Circle({center:o,radius:o.subtract(p).length});break;case"ellipse":d=new paper.Shape.Ellipse(b.modifiers.shift?{point:o,size:[g,h]}:{from:o,to:p});break;case"rectangle":d=new paper.Shape.Rectangle(b.modifiers.shift?{point:o,size:[g,h]}:{from:o,to:p})}return d.data.type=a,c&&d.set("style",c),d}function g(a){n&&n.remove(),q&&(n=f(a))}function h(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in v)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=v[b]);a.onPropertyChange=i,a.data.exportJSON=function(a){return function(b){return c.call(a,b)}}(a),a.data.setDragMode=l,a.data.itemMouseDrag=m}function i(a,b){"confidence"===a&&(this.style=w[b],paper.view.draw())}function j(a){var c,d;if(c=paper.project.activeLayer.hitTest(a,{tolerance:7,fill:!0,stroke:!0,bounds:!0,selected:!0}),c||(c=paper.project.activeLayer.hitTest(a,{fill:!0,stroke:!0})),!c||!e(c.item))return!1;if(d=c.item,d.selected||(paper.project.deselectAll(),d.selected=!0,b.annotationSelected.dispatch(d)),"bounds"===c.type&&"center"!==c.name.split("-")[1]){var f=c.name.split("-"),g="bottom"===f[0]?"top":"bottom";g+="left"===f[1]?"Right":"Left";var h=["right"===f[1]?1:-1,"bottom"===f[0]?1:-1];l("DRAG_HANDLE",{nameStr:c.name,nameParts:f,item:c.item,fixedPt:c.item.bounds[g],resizeDir:h})}else l("FULL_DRAG",{item:d});return!0}function k(a){var b,c,d;b=new paper.Rectangle({from:s.fixedPt,to:a.point}).size,a.event.shiftKey&&(d=s.item.bounds.size.width/s.item.bounds.size.height,b.height=b.width/d),c=b.subtract(s.item.bounds.size).multiply(s.resizeDir).divide(2),s.item.size=b,s.item.translate(c.width,c.height)}function l(a,b){!a in u?(r=null,s={},t=!1):(r=u[a],s=b)}function m(a){switch(t=!0,r){case u.FULL_DRAG:this.translate(a.delta);break;case u.DRAG_HANDLE:k(a)}}var n,o,p,q=!1,r=null,s={},t=!1,u={FULL_DRAG:1,DRAG_HANDLE:4},v={comment:"",confidence:3,fill:!0},w={1:{dashArray:[10,10]},2:{dashArray:[30,10]},3:{dashArray:null}};return{exportJSON:c,importJSON:d,onKeyDown:function(a){n&&g(a)},onKeyUp:function(a){g(a)},onMouseDown:function(a){q=t=!1,j(a.point)||(paper.project.deselectAll(),b.annotationSelected.dispatch(null),paper.project.deselectAll(),q=!0,o=a.point,p=o)},onMouseDrag:function(a){q?(p=a.point,g(a)):r&&s.item&&m.call(s.item,a)},onMouseUp:function(a){if(q){if(p=a.point,g(a),q=!1,n&&n.remove(),n=null,a.delta.length>5){var c=f(a);c.data.tId="a"+c._id,c.selected=!0,h(c),b&&"function"==typeof b.annotationAdded.dispatch&&b.annotationAdded.dispatch(c)}paper.view.draw()}else t&&s.item&&(b.annotationChanged.dispatch(s.item),t=!1)}}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/ellipse',["paper","tools/Shape.class"],function(a,b){var c="ellipse",d={annotationAdded:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/rectangle',["paper","tools/Shape.class"],function(a,b){var c="rectangle",d={annotationAdded:null,annotationSelected:null,annotationChanged:null},e=new b(c,d),f=e.exportJSON;delete e.exportJSON;var g=e.importJSON;return delete e.importJSON,{name:c,tool:new a.Tool(e),exportJSON:f,importJSON:g,registerEvent:function(a,b){d[a]=b}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/text',["paper","jquery"],function(a,b){function c(a,b){!a in u?(v=null,w={},x=!1):(v=u[a],w=b)}function d(a){switch(v){case u.DRAG_HANDLE:if("center"===w.nameParts[1])return;var b=w.item.bounds,c="top"===w.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===w.nameParts[0]&&(e[1]=c-b.height),d>9&&999>d&&i.call(w.item,d),w.item.translate(e);break;case u.FULL_DRAG:default:this.translate(a.delta)}}function e(a){a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=c,a.data.itemMouseDrag=d}function f(c){n&&g(!1),n=!0,p||(p=b("<input>",{type:"text","class":"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){n&&g()}).on("keydown",function(a){(27===a.which||13==a.which)&&g()}).autoGrowInput(),q=q||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){g()}),p.before(q)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;p.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),q.show();var f=p.nextAll("tester");f.css({fontSize:p.css("fontSize"),fontFamily:p.css("fontFamily"),fontWeight:p.css("fontWeight"),letterSpacing:p.css("letterSpacing")}),f.text(""===c.data.content?p.attr("placeholder"):c.data.content),p.width(f.width()+30),o=c,setTimeout(function(){p.focus()},100)}function g(b){if(b=!(b===!1),n=!1,o){var c=p.val();if(c&&""!==c){var d=""===o.data.content;o.data.content=c,o.children[0].content=c,o.children[1].content=c,o.visible=!0,b&&r.annotationSelected&&"function"==typeof r.annotationSelected.dispatch&&r.annotationSelected.dispatch(o),d?(e(o),r.annotationAdded&&"function"==typeof r.annotationAdded.dispatch&&r.annotationAdded.dispatch(o)):r.annotationChanged&&"function"==typeof r.annotationChanged.dispatch&&r.annotationChanged.dispatch(o),o.oSetSelected(b),a.project.view.draw()}else o.remove(),o=null}q.hide(),p.val("").blur().hide()}function h(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function i(a){var b=this,c=a/10;3>c&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function j(){return this.children[0].fontSize}function k(a,c,d){var g=c.importJSON(a);return b.extend(g.data,{setColor:h,setFill:t,setStrokeWidth:t,setFontSize:i,getFontSize:j}),e(g),d&&g.children[1].on("doubleclick",function(){f(this.parent)}),g}function l(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}var m="text",n=!1,o=null,p=null,q=null,r={annotationAdded:null,annotationChanged:null,annotationSelected:null},s={type:"point-text",tolerance:5,fill:!0},t=function(){},u={FULL_DRAG:1,DRAG_HANDLE:4},v=null,w={},x=!1,y={onMouseDown:function(b){var c=a.project.activeLayer.hitTest(b.point,s);if(c){var d=c.item.parent;f(d)}else{var e=a.project.currentStyle.fontSize;if(n)g();else{a.project.deselectAll();var k=b.point,l=new a.PointText({point:k,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),p=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;p=p.toCSS();var q=new a.PointText({point:k,fillColor:p,strokeColor:p,strokeWidth:0,content:""});q.on("doubleclick",function(){f(this.parent)}),o=new a.Group({children:[l,q],data:{type:m,setColor:h,setFill:t,setStrokeWidth:t,setFontSize:i,getFontSize:j,content:"",color:p}}),o.data.tId="a"+o._id,o.data.content="",f(o)}}}};return{name:m,tool:new a.Tool(y),exportJSON:l,importJSON:k,registerEvent:function(a,b){r[a]=b}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('tools/arrow',["paper"],function(a){function b(a){var b=(this.data.from,this.data.to,this.exportJSON({asString:!1}));try{b[1][1].data.from=[this.data.from.x,this.data.from.y],b[1][1].data.to=[this.data.to.x,this.data.to.y]}catch(c){}return a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1][1],f=b[0][1][e.symbol][1][1],h=f.fillColor&&(f.fillColor.length<3||0!==f.fillColor[3]),i=parseFloat(e.opacity)||1,k=a.project.activeLayer;c.activate(),e.data.from.length>2&&(e.data.from=e.data.from.splice(1)),e.data.to.length>2&&(e.data.to=e.data.to.splice(1));var m=g({from:new a.Point(e.data.from),prop:e.data.prop,scale:e.data.scale||{h:1,v:1}},d);return m.opacity=i,j.call(m,f.strokeColor),l.call(m,h),n.call(m,f.strokeWidth),u(m,{from:m.data.from,to:new a.Point(e.data.to)}),k.activate(),m}function d(){if(!x){var b=new a.Path({segments:[[0,-5],[0,5],new a.Segment([20,5]),[10,30],new a.Segment([50,0]),[10,-30],new a.Segment([20,-5])],strokeJoin:"round",strokeScaling:!1,closed:!0});y=1,z=3,A=4,B=b.segments[z].point.x-b.segments[y].point.x,x=new a.Symbol(b),b.remove()}}function e(a,b){b=b||this;var c=b.symbol.definition.segments[2].point.x,d=b.symbol.definition.segments[A].point.x,e=b.globalToLocal(a).x;return(e-c)/(d-c)>.1}function f(a,b){b=b||this,a=a||b.symbol.definition.segments[A].point.x-b.symbol.definition.segments[y].point.x;var c=b.symbol.definition.segments[A].point.x-b.symbol.definition.segments[z].point.x;return B>a-c}function g(b,c){var e,f,g,h,v;d(),e=new a.PlacedSymbol(x.clone()),f=e.symbol.definition.bounds.width,g=new a.Point(b.from),h=new a.Point([g.x+f,g.y]),v=b.scale||{h:1,v:1},e.pivot=[-f/2,0],u(e,{from:g,to:h}),i.call(e,v),l.call(e,a.project.currentStyle.fillColor),j.call(e,a.project.currentStyle.strokeColor),n.call(e,a.project.currentStyle.strokeWidth),b.prop="object"==typeof b.prop?b.prop:{};for(var w in E)b.prop.hasOwnProperty(w)||(b.prop[w]=E[w]);return e.data={tId:"a"+e._id,type:C,prop:b.prop,from:g,to:h,scale:v,setColor:j,getColor:k,setFill:l,getFill:m,setStrokeWidth:n,getStrokeWidth:o,setDragMode:p,itemMouseDrag:r},c!==!1&&(e.onMouseDown=q,e.onMouseUp=s,e.onPropertyChange=t),e}function h(){this.data.from=this.position,this.data.to=this.data.from.add(new a.Point({length:this.symbol.definition.bounds.width,angle:this.rotation}))}function i(a){var b=x.definition.bounds.width;this.symbol.definition.scale(a.h,a.v,[-b/2,0]),this.data.scale||(this.data.scale={h:1,v:1}),this.data.scale.h*=a.h,this.data.scale.v*=a.v,h.call(this)}function j(a){this.symbol.definition.strokeColor=a,this.symbol.definition.fillColor.alpha>0&&(this.symbol.definition.fillColor=a)}function k(){return this.symbol.definition.strokeColor}function l(a){this.symbol.definition.fillColor=a?this.symbol.definition.strokeColor:F}function m(){return this.symbol.definition.fillColor.alpha>0}function n(a){this.symbol.definition.strokeWidth=a}function o(){return this.symbol.definition.strokeWidth}function p(a,b){!a in G?(H=null,I={},J=!1):(H=G[a],I=b)}function q(a){if(this.selected){H=G.FULL_DRAG;var b=this.data.to,c=this.data.from;e.call(this,a.point)?p("DRAG_TO",{delta:b.subtract(a.point)}):c.getDistance(a.point)<30&&p("DRAG_FROM",{delta:c.subtract(a.point)}),this.attach("mousedrag",r)}}function r(a){J=!0;var b={from:this.data.from,to:this.data.to};switch(H){case G.FULL_DRAG:this.translate(a.delta),h.call(this);break;case G.DRAG_TO:b.to=I.delta?a.point.add(I.delta):a.point,delete b.from,u(this,b);break;case G.DRAG_FROM:b.from=I.delta?a.point.add(I.delta):a.point,delete b.to,u(this,b);break;case G.DRAG_HANDLE:if("right"!==I.nameParts[1])J=!1;else{var c=a.point.subtract(b.from).project(b.to.subtract(b.from)),d=c.length/this.symbol.definition.bounds.width,e=a.event.shiftKey?d:a.point.subtract(c.add(b.from)).length/this.symbol.definition.bounds.height*2;i.call(this,{h:d,v:e})}break;default:J=!1}}function s(){this.detach("mousedrag",r),h.call(this),H=null,J&&D.annotationChanged.dispatch(this),J=!1}function t(){}function u(b,c){var d,e,g,h,i="";if(c.from||(c.from=b.data.from,i="to"),c.to||(c.to=b.data.to,i="from"),d=c.to.subtract(c.from),e=d.angle,g=b.symbol.definition.bounds.width,h=d.length-g,f.call(b,g+h)&&(h=0,"from"===i&&(c.from=c.to.subtract(new a.Point({length:g,angle:e})))),b.rotation=e,b.position=c.from,0!==h)for(var j,k=2;j=b.symbol.definition.segments[k];k++)j.point.x+=h;b.data.from=c.from,b.data.to=c.to}function v(a){return a.data&&a.data.type===C?a:a.parent?v(a.parent):null}function w(b){var c,d;if(c=a.project.activeLayer.hitTest(b,{tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0}),c||(c=a.project.activeLayer.hitTest(b,{fill:!0,stroke:!0})),!c||!c.item)return!1;if(d=v(c.item),!d)return!1;if(d.selected=!0,"bounds"===c.type){var e=c.name.split("-");"right"===e[1]&&p("DRAG_HANDLE",{nameStr:c.name,nameParts:c.name.split("-"),item:d})}return!0}var x,y,z,A,B,C="arrow",D={annotationAdded:null,annotationSelected:null,annotationChanged:null},E={comment:"",fill:!0},F=new a.Color([0,0,0,0]),G={FULL_DRAG:1,DRAG_TO:2,DRAG_FROM:3,DRAG_HANDLE:4},H=null,I={},J=!1,K=!1,L=null,M=null,N={onMouseDown:function(b){K=!1,M=null,w(b.point)||(a.project.deselectAll(),D.annotationSelected.dispatch(null),K=!0,L=b.point,M=g({from:L},!0),M.visible=!1)},onMouseDrag:function(a){K&&M?(u(M,{from:L,to:a.point}),M.visible=!0):H===G.DRAG_HANDLE&&I.item&&r.call(I.item,a)},onMouseUp:function(){p(null),K&&M&&(D.annotationAdded.dispatch(M),K=!1,M.selected=!0,M.visible=!0,M=null)}};return{name:C,tool:new a.Tool(N),registerEvent:function(a,b){D[a]=b},exportJSON:b,importJSON:c,listeners:{}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/tools',["signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow"],function(a){function b(a,b){return b.importJSON(a)}function c(a){return this.exportJSON(a)}function d(){return l}function e(a){return k[a]?k[a].tool:null}function f(a){if(a&&k[a]){var b=e(a);b?(l=a,b.activate(),m.activated.dispatch(a)):console&&console.warn&&void 0}}function g(a){return k[a]&&"function"==typeof k[a].importJSON?k[a].importJSON:n}function h(a){return k[a]&&"function"==typeof k[a].exportJSON?k[a].exportJSON:n}function i(a,b){var c=h(a.data.type);return c.call(a,$.extend({asString:!0},b))}for(var j,k={},l=null,m={activated:new a,annotationAdded:new a,annotationChanged:new a,annotationSelected:new a},n=function(){},o=1;j=arguments[o];o++)k[j.name]={tool:j.tool,importJSON:j.importJSON||b,exportJSON:j.exportJSON||c,listeners:j.listeners||{}},"function"==typeof j.registerEvent&&(j.registerEvent("annotationAdded",m.annotationAdded),j.registerEvent("annotationChanged",m.annotationChanged),j.registerEvent("annotationSelected",m.annotationSelected)),j.listeners&&"function"==typeof j.listeners.onToolActivated&&m.activated.add(j.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:n,onMouseUp:n,onMouseDrag:n,onKeyDown:n,onKeyUp:n});a.activate()}(),{events:m,tools:k,getTool:e,getToolJSONImporter:g,getToolJSONExporter:h,activateTool:f,getActiveTool:d,serializeItem:i}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=E[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,E[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),E[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),B.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&-1===a.indexOf(b.parent)?a.push(b.parent):b.data&&b.data.type&&-1===a.indexOf(b)&&a.push(b)}),a}function n(b,c){var d,e,f;try{d="string"==typeof b.item?JSON.parse(b.item):b.item}catch(h){throw"Unable to parse annotation's item"}if(!a.isArray(d)||d.length<2)return null;if("string"==typeof d[0]?e=d[1].data:a.isArray(d[0])&&(e=d[1][1].data),!e)return null;f=e.type;var i=k(b.owner),j=g.getToolJSONImporter(f)(d,i,c);return j&&(j.data.id=b.id,j.selected=!1),j}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;f>e;e++)for(var g=b[e].children,h=0,i=g.length;i>h;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)B.annotationRemoved.dispatch(a.data.id),a.remove();c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b?!0:!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,b){b=void 0===b?!0:!!b;for(var d,e=0,f=c.project.layers;d=f[e];e++)for(var h,i=0,j=d.children;h=j[i];i++)h.data&&h.data.prop&&h.data.prop[a.prop]===a.val&&(h.selected&&(h.selected=!1,g.events.annotationSelected.dispatch(null)),h.visible=b);c.view.draw()}function u(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),B.annotationPropertyChanged.dispatch(a,b,c))),d}function v(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=u(e,a,b)&&f;return f}function w(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function x(a){var b=c.project.getSelectedItems();return 1===b.length?w(b[0],a):null}var y=null,z=null,A=null,B={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},C=e.users,D={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},E={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),y=a(b),0===y.length?(console&&console.warn&&void 0,!1):(c.setup(y.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,D),A=k(e.user.id,e.user.username),A.opacity=1,!0)},events:B,loadUserDict:function(){C=e.users},updateUserDict:function(b){a.extend(C,b)},resize:function(a,b){y&&(a=parseInt(a,10)||y.width(),b=parseInt(b,10)||y.height(),y.width(a).height(b),c.view.viewSize=[a,b],z&&(z.position=[z.bounds.width/2,z.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),z=new c.Raster,z.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(z.width/2,z.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[z.width,z.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),B.imageLoaded.dispatch({raster:z}),"function"==typeof d&&d.call(e,z)},z.source=b.url,z.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=b.length-1;f=b[i];i--){var j=f.owner===d;(e.ui.show_users_results||j)&&n(f,j)}if(d){var k=h("user_"+d);if(k){var l=c.project.layers,m=l.splice(k._index,1);l.push(m[0]),a.each(l,function(a,b){b._index=a}),k=h("user_"+d),k.activate(),c.view.draw()}}B.annotationsLoaded.dispatch(),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setSelectedItemProperty:v,getSelectedItemProperty:x,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:function(a,b){s(a,b)},toggleItemsByProp:function(a,b){t(a,b)},getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(A.id,!0),A.activate())}}(),_raster:function(){return z}}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
define('adim/io',["jquery","paper","signals","adim/config","adim/view"],function(a,b,c,d,e){function f(){}function g(b,c,e,f){b=parseInt(b,10);var g=!b;f=parseInt(f,10)||0;var h={item:c,order:f};if(e)for(var i in e)h[i]=e[i];var j,k=d.api.annotations;g?(j="POST",a.extend(h,{annotable:d.annotable.id,owner:d.user.id,owner_id:d.user.id})):(j="PATCH",k+=b+"/"),a.ajax({url:k,type:j,dataType:"json",data:h,success:function(a,b,c){201===c.status?l.annotationAdded.dispatch(a):200===c.status&&l.annotationSaved.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Erreur lors de l'enregistrement d'une annotation"})}})}function h(b,c){var e=new FormData;return e.append("aid",b),e.append("file",c),a.ajax({type:"POST",url:d.annotable.thumbnail,data:e,processData:!1,contentType:!1}).done(function(){})}function i(a){for(var b,c=0;b=a[c];c++)g(b.id,b.itemStr,b.prop,b.index)}function j(b){a.ajax({url:d.api.annotations+parseInt(b,10)+"/",type:"DELETE",success:function(a,c,d){204===d.status&&l.annotationRemoved.dispatch(b)},error:function(a){404!==a.status&&l.loadingError.dispatch({msg:"Erreur lors de la suppression d'une annotation"})}})}function k(b,c){return a.ajax({url:d.api.annotables+parseInt(b,10)+"/",type:"PATCH",dataType:"json",data:{name:c},success:function(a){l.annotableChanged.dispatch(a)}})}var l={annotableLoaded:new c,annotableChanged:new c,annotationsLoaded:new c,loadingError:new c,annotationAdded:new c,annotationSaved:new c,annotationRemoved:new c},m=!1;return{init:f,events:l,setAutoSave:function(a){return m=!!a},getAutoSave:function(){return m},loadData:function(b){a.ajax({url:b,dataType:"json",success:function(a){l.annotableLoaded.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Une erreur est survenue lors du chargement des données."})}})},loadSharedAnnotations:function(b){var c=a.Deferred();return a.ajax({url:b,dataType:"json",success:function(a){c.resolve(a)},error:function(){var a={msg:"Une erreur est survenue lors du chargement des données."};l.loadingError.dispatch(a),c.reject(a)}}),c},saveUserAnnotations:function(a){a=a||d.user.id;var b=e.getUserAnnnotationsSerialized(a);return i(b),!0},saveAnnotations:function(a,b){if(!m&&!b)return!1;var c=e.getAnnotationsSerialized(a);return i(c),!0},removeAnnotation:j,saveThumbnail:h,setAnnotableName:k}});
/*! AdIm - v0.0.0 - 2014-11-25 - Copyright (C) 2014 Université de Lausanne - see licence */
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/text',["paper","jquery"],function(a,b){function c(a,b){!a in w?(x=null,y={},z=!1):(x=w[a],y=b)}function d(a){switch(x){case w.DRAG_HANDLE:if("center"===y.nameParts[1])return;var b=y.item.bounds,c="top"===y.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===y.nameParts[0]&&(e[1]=c-b.height),d>9&&999>d&&i.call(y.item,d),y.item.translate(e);break;case w.FULL_DRAG:default:this.translate(a.delta)}}function e(a){a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=c,a.data.itemMouseDrag=d}function f(c){if(o&&g(!1),!s){o=!0,q||(q=b("<input>",{type:"text","class":"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){o&&g()}).on("keydown",function(a){(27===a.which||13==a.which)&&g()}).autoGrowInput(),r=r||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){g()}),q.before(r)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;q.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),r.show();var f=q.nextAll("tester");f.css({fontSize:q.css("fontSize"),fontFamily:q.css("fontFamily"),fontWeight:q.css("fontWeight"),letterSpacing:q.css("letterSpacing")}),f.text(""===c.data.content?q.attr("placeholder"):c.data.content),q.width(f.width()+30),p=c,setTimeout(function(){q.focus()},100)}}function g(b){if(b=!(b===!1),o=!1,p){var c=q.val();if(c&&""!==c){var d=""===p.data.content;p.data.content=c,p.children[0].content=c,p.children[1].content=c,p.visible=!0,b&&t.annotationSelected&&"function"==typeof t.annotationSelected.dispatch&&t.annotationSelected.dispatch(p),d?(e(p),t.annotationAdded&&"function"==typeof t.annotationAdded.dispatch&&t.annotationAdded.dispatch(p)):t.annotationChanged&&"function"==typeof t.annotationChanged.dispatch&&t.annotationChanged.dispatch(p),p.oSetSelected(b),a.project.view.draw()}else p.remove(),p=null}r.hide(),q.val("").blur().hide()}function h(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function i(a){var b=this,c=a/10;3>c&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function j(){return this.children[0].fontSize}function k(a,c,d){var g=c.importJSON(a);return b.extend(g.data,{setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j}),e(g),d&&g.children[1].on("doubleclick",function(){f(this.parent)}),g}function l(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}function m(a){return a!==s&&(s=a),s}var n="text",o=!1,p=null,q=null,r=null,s=!1,t={annotationAdded:null,annotationChanged:null,annotationSelected:null},u={type:"point-text",tolerance:5,fill:!0},v=function(){},w={FULL_DRAG:1,DRAG_HANDLE:4},x=null,y={},z=!1,A={onMouseDown:function(b){if(!s){var c=a.project.activeLayer.hitTest(b.point,u);if(c){var d=c.item.parent;f(d)}else{var e=a.project.currentStyle.fontSize;if(o)g();else{a.project.deselectAll();var k=b.point,l=new a.PointText({point:k,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),m=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;m=m.toCSS();var q=new a.PointText({point:k,fillColor:m,strokeColor:m,strokeWidth:0,content:""});q.on("doubleclick",function(){f(this.parent)}),p=new a.Group({children:[l,q],data:{type:n,setColor:h,setFill:v,setStrokeWidth:v,setFontSize:i,getFontSize:j,content:"",color:m}}),p.data.tId="a"+p._id,p.data.content="",f(p)}}}}};return{name:n,tool:new a.Tool(A),setRo:m,exportJSON:l,importJSON:k,registerEvent:function(a,b){t[a]=b}}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('tools/arrow',["paper"],function(a){function b(a){var b=(this.data.from,this.data.to,this.exportJSON({asString:!1}));try{b[1][1].data.from=[this.data.from.x,this.data.from.y],b[1][1].data.to=[this.data.to.x,this.data.to.y]}catch(c){console.error(c)}return a&&a.asString?JSON.stringify(b):b}function c(b,c,d){var e=b[1][1],f=b[0][1][e.symbol][1][1],h=f.fillColor&&(f.fillColor.length<3||0!==f.fillColor[3]),i=parseFloat(e.opacity)||1,k=a.project.activeLayer;c.activate(),e.data.from.length>2&&(e.data.from=e.data.from.splice(1)),e.data.to.length>2&&(e.data.to=e.data.to.splice(1));var m=g({from:new a.Point(e.data.from),prop:e.data.prop,scale:e.data.scale||{h:1,v:1}},d);return m.opacity=i,j.call(m,f.strokeColor),l.call(m,h),n.call(m,f.strokeWidth),u(m,{from:m.data.from,to:new a.Point(e.data.to)}),k.activate(),m}function d(){if(!y){var b=new a.Path({segments:[[0,-5],[0,5],new a.Segment([20,5]),[10,30],new a.Segment([50,0]),[10,-30],new a.Segment([20,-5])],strokeJoin:"round",strokeScaling:!1,closed:!0});z=1,A=3,B=4,C=b.segments[A].point.x-b.segments[z].point.x,y=new a.Symbol(b),b.remove()}}function e(a,b){b=b||this;var c=b.symbol.definition.segments[2].point.x,d=b.symbol.definition.segments[B].point.x,e=b.globalToLocal(a).x;return(e-c)/(d-c)>.1}function f(a,b){b=b||this,a=a||b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[z].point.x;var c=b.symbol.definition.segments[B].point.x-b.symbol.definition.segments[A].point.x;return C>a-c}function g(b,c){var e,f,g,h,v;d(),e=new a.PlacedSymbol(y.clone()),f=e.symbol.definition.bounds.width,g=new a.Point(b.from),h=new a.Point([g.x+f,g.y]),v=b.scale||{h:1,v:1},e.pivot=[-f/2,0],u(e,{from:g,to:h}),i.call(e,v),l.call(e,a.project.currentStyle.fillColor),j.call(e,a.project.currentStyle.strokeColor),n.call(e,a.project.currentStyle.strokeWidth),b.prop="object"==typeof b.prop?b.prop:{};for(var w in G)b.prop.hasOwnProperty(w)||(b.prop[w]=G[w]);return e.data={tId:"a"+e._id,type:D,prop:b.prop,from:g,to:h,scale:v,setColor:j,getColor:k,setFill:l,getFill:m,setStrokeWidth:n,getStrokeWidth:o,setDragMode:p,itemMouseDrag:r},c!==!1&&(e.onMouseDown=q,e.onMouseUp=s,e.onPropertyChange=t),e}function h(){this.data.from=this.position,this.data.to=this.data.from.add(new a.Point({length:this.symbol.definition.bounds.width,angle:this.rotation}))}function i(a){var b=y.definition.bounds.width;this.symbol.definition.scale(a.h,a.v,[-b/2,0]),this.data.scale||(this.data.scale={h:1,v:1}),this.data.scale.h*=a.h,this.data.scale.v*=a.v,h.call(this)}function j(a){this.symbol.definition.strokeColor=a,this.symbol.definition.fillColor.alpha>0&&(this.symbol.definition.fillColor=a)}function k(){return this.symbol.definition.strokeColor}function l(a){this.symbol.definition.fillColor=a?this.symbol.definition.strokeColor:H}function m(){return this.symbol.definition.fillColor.alpha>0}function n(a){this.symbol.definition.strokeWidth=a}function o(){return this.symbol.definition.strokeWidth}function p(a,b){!a in I?(J=null,K={},L=!1):(J=I[a],K=b)}function q(a){if(this.selected&&!E){J=I.FULL_DRAG;var b=this.data.to,c=this.data.from;e.call(this,a.point)?p("DRAG_TO",{delta:b.subtract(a.point)}):c.getDistance(a.point)<30&&p("DRAG_FROM",{delta:c.subtract(a.point)}),this.attach("mousedrag",r)}}function r(a){if(!E){L=!0;var b={from:this.data.from,to:this.data.to};switch(J){case I.FULL_DRAG:this.translate(a.delta),h.call(this);break;case I.DRAG_TO:b.to=K.delta?a.point.add(K.delta):a.point,delete b.from,u(this,b);break;case I.DRAG_FROM:b.from=K.delta?a.point.add(K.delta):a.point,delete b.to,u(this,b);break;case I.DRAG_HANDLE:if("right"!==K.nameParts[1])L=!1;else{var c=a.point.subtract(b.from).project(b.to.subtract(b.from)),d=c.length/this.symbol.definition.bounds.width,e=a.event.shiftKey?d:a.point.subtract(c.add(b.from)).length/this.symbol.definition.bounds.height*2;i.call(this,{h:d,v:e})}break;default:L=!1}}}function s(){this.detach("mousedrag",r),h.call(this),J=null,L&&F.annotationChanged.dispatch(this),L=!1}function t(){}function u(b,c){var d,e,g,h,i="";if(c.from||(c.from=b.data.from,i="to"),c.to||(c.to=b.data.to,i="from"),d=c.to.subtract(c.from),e=d.angle,g=b.symbol.definition.bounds.width,h=d.length-g,f.call(b,g+h)&&(h=0,"from"===i&&(c.from=c.to.subtract(new a.Point({length:g,angle:e})))),b.rotation=e,b.position=c.from,0!==h)for(var j,k=2;j=b.symbol.definition.segments[k];k++)j.point.x+=h;b.data.from=c.from,b.data.to=c.to}function v(a){return a.data&&a.data.type===D?a:a.parent?v(a.parent):null}function w(b){var c,d;if(c=a.project.activeLayer.hitTest(b,{tolerance:7,fill:!0,stroke:!0,segments:!0,handles:!0,ends:!0,bounds:!0,selected:!0}),c||(c=a.project.activeLayer.hitTest(b,{fill:!0,stroke:!0})),!c||!c.item)return!1;if(d=v(c.item),!d)return!1;if(d.selected=!0,"bounds"===c.type){var e=c.name.split("-");"right"===e[1]&&p("DRAG_HANDLE",{nameStr:c.name,nameParts:c.name.split("-"),item:d})}return!0}function x(a){return a!==E&&(E=a),E}var y,z,A,B,C,D="arrow",E=!1,F={annotationAdded:null,annotationSelected:null,annotationChanged:null},G={comment:"",fill:!0},H=new a.Color([0,0,0,0]),I={FULL_DRAG:1,DRAG_TO:2,DRAG_FROM:3,DRAG_HANDLE:4},J=null,K={},L=!1,M=!1,N=null,O=null,P={onMouseDown:function(b){if(!E){M=!1,O=null,w(b.point)||(a.project.deselectAll(),F.annotationSelected.dispatch(null),M=!0,N=b.point,O=g({from:N},!0),O.visible=!1)}},onMouseDrag:function(a){E||(M&&O?(u(O,{from:N,to:a.point}),O.visible=!0):J===I.DRAG_HANDLE&&K.item&&r.call(K.item,a))},onMouseUp:function(){p(null),M&&O&&(F.annotationAdded.dispatch(O),M=!1,O.selected=!0,O.visible=!0,O=null)}};return{name:D,tool:new a.Tool(P),setRo:x,registerEvent:function(a,b){F[a]=b},exportJSON:b,importJSON:c,listeners:{}}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(a);b?(n=a,b.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=!1,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=E[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,E[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),E[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),B.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&-1===a.indexOf(b.parent)?a.push(b.parent):b.data&&b.data.type&&-1===a.indexOf(b)&&a.push(b)}),a}function n(b,c){var d,e,f;try{d="string"==typeof b.item?JSON.parse(b.item):b.item}catch(h){throw"Unable to parse annotation's item"}if(!a.isArray(d)||d.length<2)return null;if("string"==typeof d[0]?e=d[1].data:a.isArray(d[0])&&(e=d[1][1].data),!e)return null;f=e.type;var i=k(b.owner),j=g.getToolJSONImporter(f)(d,i,c);return j&&(j.data.id=b.id,j.selected=!1),j}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;f>e;e++)for(var g=b[e].children,h=0,i=g.length;i>h;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)B.annotationRemoved.dispatch(a.data.id),a.remove();c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b?!0:!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,b){b=void 0===b?!0:!!b;for(var d,e=0,f=c.project.layers;d=f[e];e++)for(var h,i=0,j=d.children;h=j[i];i++)h.data&&h.data.prop&&h.data.prop[a.prop]===a.val&&(h.selected&&(h.selected=!1,g.events.annotationSelected.dispatch(null)),h.visible=b);c.view.draw()}function u(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),B.annotationPropertyChanged.dispatch(a,b,c))),d}function v(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=u(e,a,b)&&f;return f}function w(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function x(a){var b=c.project.getSelectedItems();return 1===b.length?w(b[0],a):null}var y=null,z=null,A=null,B={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},C=e.users,D={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},E={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),y=a(b),0===y.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(y.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,D),A=k(e.user.id,e.user.username),A.opacity=1,!0)},events:B,loadUserDict:function(){C=e.users},updateUserDict:function(b){a.extend(C,b)},resize:function(a,b){y&&(a=parseInt(a,10)||y.width(),b=parseInt(b,10)||y.height(),y.width(a).height(b),c.view.viewSize=[a,b],z&&(z.position=[z.bounds.width/2,z.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),z=new c.Raster,z.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(z.width/2,z.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[z.width,z.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),B.imageLoaded.dispatch({raster:z}),"function"==typeof d&&d.call(e,z)},z.source=b.url,z.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=b.length-1;f=b[i];i--){var j=f.owner===d;(e.ui.show_users_results||j)&&n(f,j)}if(d){var k=h("user_"+d);if(k){var l=c.project.layers,m=l.splice(k._index,1);l.push(m[0]),a.each(l,function(a,b){b._index=a}),k=h("user_"+d),k.activate(),c.view.draw()}}B.annotationsLoaded.dispatch(),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setSelectedItemProperty:v,getSelectedItemProperty:x,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:function(a,b){s(a,b)},toggleItemsByProp:function(a,b){t(a,b)},getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(A.id,!0),A.activate())}}(),_raster:function(){return z}}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/io',["jquery","paper","signals","adim/config","adim/view"],function(a,b,c,d,e){function f(){}function g(b,c,e,f){b=parseInt(b,10);var g=!b;f=parseInt(f,10)||0;var h={item:c,order:f};if(e)for(var i in e)h[i]=e[i];var j,k=d.api.annotations;g?(j="POST",a.extend(h,{annotable:d.annotable.id,owner:d.user.id,owner_id:d.user.id})):(j="PATCH",k+=b+"/"),a.ajax({url:k,type:j,dataType:"json",data:h,success:function(a,b,c){201===c.status?l.annotationAdded.dispatch(a):200===c.status&&l.annotationSaved.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Erreur lors de l'enregistrement d'une annotation"})}})}function h(b,c){var e=new FormData;return e.append("aid",b),e.append("file",c),a.ajax({type:"POST",url:d.annotable.thumbnail,data:e,processData:!1,contentType:!1}).done(function(){})}function i(a){for(var b,c=0;b=a[c];c++)g(b.id,b.itemStr,b.prop,b.index)}function j(b){a.ajax({url:d.api.annotations+parseInt(b,10)+"/",type:"DELETE",success:function(a,c,d){204===d.status&&l.annotationRemoved.dispatch(b)},error:function(a){404!==a.status&&l.loadingError.dispatch({msg:"Erreur lors de la suppression d'une annotation"})}})}function k(b,c){return a.ajax({url:d.api.annotables+parseInt(b,10)+"/",type:"PATCH",dataType:"json",data:{name:c},success:function(a){l.annotableChanged.dispatch(a)}})}var l={annotableLoaded:new c,annotableChanged:new c,annotationsLoaded:new c,loadingError:new c,annotationAdded:new c,annotationSaved:new c,annotationRemoved:new c},m=!1;return{init:f,events:l,setAutoSave:function(a){return m=!!a},getAutoSave:function(){return m},loadData:function(b){console.time("loadData"),a.ajax({url:b,dataType:"json",success:function(a){console.timeEnd("loadData"),l.annotableLoaded.dispatch(a)},error:function(){l.loadingError.dispatch({msg:"Une erreur est survenue lors du chargement des données."})}})},loadSharedAnnotations:function(b){var c=a.Deferred();return a.ajax({url:b,dataType:"json",success:function(a){c.resolve(a)},error:function(){var a={msg:"Une erreur est survenue lors du chargement des données."};l.loadingError.dispatch(a),c.reject(a)}}),c},saveUserAnnotations:function(a){a=a||d.user.id;var b=e.getUserAnnnotationsSerialized(a);return i(b),!0},saveAnnotations:function(a,b){if(!m&&!b)return!1;var c=e.getAnnotationsSerialized(a);return i(c),!0},removeAnnotation:j,saveThumbnail:h,setAnnotableName:k}});
/*! AdIm - v0.0.0 - 2015-01-27 - Copyright (C) 2015 Université de Lausanne - see licence */
define('adim/attributes',["paper","signals","adim/view"],function(a,b,c){function d(b){b=b||a.project.currentStyle,z.colorChanged.add(function(a,b){i(a,b)}),z.fillChanged.add(function(a,b){l(a,b)}),z.fontSizeChanged.add(function(a,b){o(a,b)}),z.strokeWidthChanged.add(function(a,b){r(a,b)}),z.opacityChanged.add(function(a,b){u(a,b)}),g(b.strokeColor),m(b.fontSize),p(b.strokeWidth),x(1),j(!!b.isFill)}function e(b,d){for(var e,f=c.getSelectedAnnotations(),g=[],h=0;e=f[h];h++)e.data&&e.data.type&&("function"==typeof e.data[b.setCallbackName]?e.data[b.setCallbackName].call(e,b.attrValue):b.setAttrCallback.call(e,b.attrValue),g.push(e));d!==!1&&z.annotationChanged.dispatch(g),a.view.draw()}function f(b){var d=c.getSelectedAnnotations();if(d.length>0){var e=d[0],f=e.index,g=null,h=null,i=[];if("front"===b?e.bringToFront():"frontward"===b?e.nextSibling&&e.insertAbove(e.nextSibling):"back"===b?e.sendToBack():"backward"===b&&e.previousSibling&&e.insertBelow(e.previousSibling),f!==e.index){g=Math.min(f,e.index),h=Math.max(f,e.index);for(var j=g;h>=j;j++)i.push(e.layer.children[j]);z.annotationChanged.dispatch(i),a.view.draw()}}}function g(b,c,d){A=new a.Color(b),a.project.currentStyle.strokeColor=A,a.project.currentStyle.fillColor=C?A:null,d!==!0&&z.colorChanged.dispatch(b,c)}function h(){return A}function i(a,b){e({setCallbackName:"setColor",attrValue:a,setAttrCallback:function(a){this.fillColor&&(this.fillColor=a),this.strokeColor=a}},b)}function j(b,c,d){C=!!b,a.project.currentStyle.fillColor=C?A:null,d!==!0&&z.fillChanged.dispatch(C,c)}function k(){return C}function l(a,b){e({setCallbackName:"setFill",attrValue:a,setAttrCallback:function(a){var b=this.fillColor||this.strokeColor;this.fillColor=a?b:null}},b)}function m(b,c,d){D=b,a.project.currentStyle.fontSize=b,d!==!0&&z.fontSizeChanged.dispatch(b,c)}function n(){return a.project.currentStyle.fontSize}function o(a,b){e({setCallbackName:"setFontSize",attrValue:a},b)}function p(b,c,d){E=b>H?H:I>b?I:b,a.project.currentStyle.strokeWidth=E,d!==!0&&z.strokeWidthChanged.dispatch(b,c)}function q(){return E}function r(a,b){e({setCallbackName:"setStrokeWidth",attrValue:a,setAttrCallback:function(a){this.strokeWidth=a}},b)}function s(a,b,c){B=Math.max(0,Math.min(100,a)),c!==!0&&z.opacityChanged.dispatch(a,b)}function t(){return B}function u(a,b){e({setCallbackName:"setOpacity",attrValue:a,setAttrCallback:function(a){this.opacity=a/100}},b)}function v(b){b=Math.max(0,Math.min(100,b)),F=b,c._raster().opacity=b/100,a.view.draw()}function w(){return F}function x(b,d){var e,f,g;b=Math.max(K,Math.min(J,b)),a.project.view.zoom!==b&&(d&&("center"===d?(G=G||c.getLayerByName("image"),g=G?G.localToGlobal(G.bounds.center).subtract(a.view.center):[0,0]):(d=a.view.viewToProject(d),e=a.view.zoom/b,f=d.subtract(a.view.center),g=d.subtract(f.multiply(e)).subtract(a.view.center))),a.project.view.zoom=b,g&&a.view.setCenter(a.view.center.add(g)),z.zoomChanged.dispatch(b))}function y(b,c){var d=20,e=5;if(0!==b){var f=Math.abs(b),g=f/b;b=g*(f>d?d:e>f?e:f);var h=a.project.view.zoom;h+=a.project.view.zoom*b/100,x(h,c)}}var z={colorChanged:new b,fillChanged:new b,fontSizeChanged:new b,strokeWidthChanged:new b,opacityChanged:new b,zoomChanged:new b,annotationChanged:new b},A=null,B=1,C=!1,D=48,E=7,F=100,G=null,H=50,I=1,J=10,K=.1;return{init:d,events:z,setColor:g,getColor:h,setFill:j,getFill:k,setFontSize:m,getFontSize:n,setStrokeWidth:p,getStrokeWidth:q,setOpacity:s,getOpacity:t,setZoom:x,deltaZoom:y,setImageOpacity:v,getImageOpacity:w,bringToFront:function(){f("front")},bringFrontward:function(){f("frontward")},sendToBack:function(){f("back")},sendBacktward:function(){f("backward")}}});
/* FileSaver.js
* A saveAs() FileSaver implementation.
......@@ -13692,7 +13692,7 @@ if (typeof module !== "undefined" && module !== null) {
}
;
!function(a){var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){d&&b.toDataURL&&f?a(f(this.toDataURL(c,d))):a(this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define('canvasToBlob',[],function(){return f}):a.dataURLtoBlo