{"size": 126834, "ext": "js", "max_stars_repo_path": "dist/production/js/dataset-view.js", "max_stars_repo_name": "aga3134/CommuTag", "max_stars_repo_stars_event_min_datetime": "2020-03-23T08:20:49.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-21T03:38:56.000Z", "max_issues_repo_path": "dist/production/js/dataset-view.js", "max_issues_repo_name": "aga3134/CommuTag", "max_issues_repo_issues_event_min_datetime": "2020-07-18T03:11:50.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-23T13:50:30.000Z", "max_forks_repo_path": "dist/production/js/dataset-view.js", "max_forks_repo_name": "aga3134/CommuTag", "max_forks_repo_forks_event_min_datetime": "2020-04-17T02:58:16.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-26T12:02:25.000Z"}
{"max_stars_count": 6, "max_issues_count": 5, "max_forks_count": 5, "avg_line_length": 126834.0, "max_line_length": 126834, "alphanum_fraction": 0.6907453837}
!function(t){var e={};function i(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,a){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(a,n,function(e){return t[e]}.bind(null,n));return a},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/production",i(i.s=116)}([function(t,e,i){"use strict";function a(t,e,i,a,n,s,r,o){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=i,c._compiled=!0),a&&(c.functional=!0),s&&(c._scopeId="data-v-"+s),r?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},c._ssrRegister=l):n&&(l=o?function(){n.call(this,this.$root.$options.shadowRoot)}:n),l)if(c.functional){c._injectStyles=l;var u=c.render;c.render=function(t,e){return l.call(e),u(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,l):[l]}return{exports:t,options:c}}i.d(e,"a",(function(){return a}))},function(t,e,i){"use strict";var a,n=function(){return void 0===a&&(a=Boolean(window&&document&&document.all&&!window.atob)),a},s=function(){var t={};return function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}t[e]=i}return t[e]}}(),r={};function o(t,e,i){for(var a=0;a<e.length;a++){var n={css:e[a][1],media:e[a][2],sourceMap:e[a][3]};r[t][a]?r[t][a](n):r[t].push(p(n,i))}}function l(t){var e=document.createElement("style"),a=t.attributes||{};if(void 0===a.nonce){var n=i.nc;n&&(a.nonce=n)}if(Object.keys(a).forEach((function(t){e.setAttribute(t,a[t])})),"function"==typeof t.insert)t.insert(e);else{var r=s(t.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(e)}return e}var c,u=(c=[],function(t,e){return c[t]=e,c.filter(Boolean).join("\n")});function d(t,e,i,a){var n=i?"":a.css;if(t.styleSheet)t.styleSheet.cssText=u(e,n);else{var s=document.createTextNode(n),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(s,r[e]):t.appendChild(s)}}function h(t,e,i){var a=i.css,n=i.media,s=i.sourceMap;if(n?t.setAttribute("media",n):t.removeAttribute("media"),s&&btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleSheet)t.styleSheet.cssText=a;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(a))}}var f=null,m=0;function p(t,e){var i,a,n;if(e.singleton){var s=m++;i=f||(f=l(e)),a=d.bind(null,i,s,!1),n=d.bind(null,i,s,!0)}else i=l(e),a=h.bind(null,i,e),n=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(i)};return a(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;a(t=e)}else n()}}t.exports=function(t,e,i){return(i=i||{}).singleton||"boolean"==typeof i.singleton||(i.singleton=n()),t=i.base?t+i.base:t,e=e||[],r[t]||(r[t]=[]),o(t,e,i),function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){r[t]||(r[t]=[]),o(t,e,i);for(var a=e.length;a<r[t].length;a++)r[t][a]();r[t].length=e.length,0===r[t].length&&delete r[t]}}}},function(t,e,i){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=function(t,e){var i=t[1]||"",a=t[3];if(!a)return i;if(e&&"function"==typeof btoa){var n=(r=a,o=btoa(unescape(encodeURIComponent(JSON.stringify(r)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),"/*# ".concat(l," */")),s=a.sources.map((function(t){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(t," */")}));return[i].concat(s).concat([n]).join("\n")}var r,o,l;return[i].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(i,"}"):i})).join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var a=0;a<t.length;a++){var n=[].concat(t[a]);i&&(n[2]?n[2]="".concat(i," and ").concat(n[2]):n[2]=i),e.push(n)}},e}},function(t,e,i){"use strict";var a={GetUrlParameter:function(){for(var t=window.location.search.substring(1).split("&"),e={},i=0;i<t.length;i++){var a=t[i].split("=");e[a[0]]=a[1]}return e},GetUrlHash:function(){for(var t=window.location.hash.substr(1).split("&"),e={},i=0;i<t.length;i++){var a=t[i].split("=");e[a[0]]=a[1]}return e},ValidateEmail:function(t){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)},PadLeft:function(t,e,i){var a=e-String(t).length+1;return a>0?new Array(a).join(i||"0")+t:t}};e.a=a},function(t,e,i){var a=i(1),n=i(31);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(42);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(44);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){"use strict";var a=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"location-select"},[e("div",{ref:"map",staticClass:"map"})])};a._withStripped=!0;var n={name:"location-select",props:{mode:String},components:{},data:function(){return{loc:null,status:"",OnGPSReady:null,map:null,locMarker:null,rangeMarker:null,range:10}},mounted:function(){this.InitMap()},methods:{InitMap:function(){switch(this.map=L.map(this.$refs.map).setView([23.682094,120.7764642],7),L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'<a href="https://www.openstreetmap.org/">OSM</a>',maxZoom:18}).addTo(this.map),this.mode){case"selectLoc":this.map.on("click",function(t){var e=t.latlng;this.SetPosition(e.lat,e.lng)}.bind(this));break;case"selectRange":this.map.on("click",function(t){var e=t.latlng;this.SetRange(e.lat,e.lng,this.range)}.bind(this))}},SetPosition:function(t,e,i){t&&e&&(this.loc={lat:t,lng:e},this.status="座標: "+t.toFixed(5)+" "+e.toFixed(5),this.locMarker?this.locMarker.setLatLng(this.loc,{draggable:"selectLoc"==this.mode}).bindPopup(this.status).update():(this.locMarker=L.marker(this.loc,{draggable:"selectLoc"==this.mode}),this.locMarker.on("dragend",function(t){var e=this.locMarker.getLatLng();this.SetPosition(e.lat,e.lng)}.bind(this)),this.locMarker.addTo(this.map)),i&&this.map.setView([t,e],12),this.$emit("change"))},SetRange:function(t,e,i){t&&e&&(this.range=i,this.loc={lat:t,lng:e},this.status="座標: "+t.toFixed(5)+" "+e.toFixed(5),this.rangeMarker?(this.rangeMarker.setLatLng(this.loc),this.rangeMarker.setRadius(1e3*this.range)):(this.rangeMarker=L.circle(this.loc,{weight:1,color:"#ff0000",fillColor:"#ff3333",fillOpacity:.3,radius:1e3*this.range}),this.rangeMarker.addTo(this.map)),this.locMarker?this.locMarker.setLatLng(this.loc,{draggable:"selectRange"==this.mode}).bindPopup(this.status).update():(this.locMarker=L.marker(this.loc,{draggable:"selectRange"==this.mode}),this.locMarker.on("drag",function(t){var e=t.target.getLatLng();this.rangeMarker.setLatLng(e)}.bind(this)),this.locMarker.on("dragend",function(t){var e=this.locMarker.getLatLng();this.rangeMarker.setLatLng(e),this.loc={lat:e.lat,lng:e.lng},this.$emit("change")}.bind(this)),this.locMarker.addTo(this.map)),this.$emit("change"))},GetGPS:function(){this.status="無GPS-請點選位置",navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){switch(this.map.setView([t.coords.latitude,t.coords.longitude],12),this.mode){case"selectLoc":this.SetPosition(t.coords.latitude,t.coords.longitude);break;case"selectRange":this.SetRange(t.coords.latitude,t.coords.longitude,this.range)}this.OnGPSReady&&this.OnGPSReady()}.bind(this),function(t){this.status="讀取GPS失敗-請點選位置"}.bind(this)):this.status="瀏覽器不支援GPS-請點選位置"},RemoveMarker:function(){this.locMarker&&(this.map.removeLayer(this.locMarker),this.locMarker=null),this.rangeMarker&&(this.map.removeLayer(this.rangeMarker),this.rangeMarker=null)}}},s=(i(43),i(0)),r=Object(s.a)(n,a,[],!1,null,null,null);r.options.__file="src/vue/location-select.vue";e.a=r.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("q-card",{staticClass:"dataset-select full-width q-pa-sm"},[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("選擇資料集")]),t._v(" "),t.lastDataset?i("div",[i("div",{staticClass:"text-subtitle2"},[t._v("上次使用")]),t._v(" "),i("q-item",{attrs:{clickable:"",active:-1==t.selectIndex,"active-class":"bg-green-2"},on:{click:function(e){return t.SelectItem(-1)},dblclick:function(e){return t.ConfirmSelect()}}},[i("q-item-section",{attrs:{avatar:""}},[i("q-avatar",{attrs:{square:"",rounded:""}},[i("img",{staticStyle:{"object-fit":"cover"},attrs:{src:t.lastDataset.picCover||"/static/image/logo-16-9.png"}})])],1),t._v(" "),i("q-item-section",[i("q-item-label",[t._v(t._s(t.lastDataset.name))])],1)],1)],1):t._e(),t._v(" "),i("q-scroll-area",{staticStyle:{height:"300px"}},[i("q-infinite-scroll",{ref:"datasetScroll",on:{load:t.LoadMoreDataset},scopedSlots:t._u([{key:"loading",fn:function(){return[i("div",{staticClass:"row justify-center q-my-md"},[i("q-spinner-dots",{attrs:{color:"primary",size:"40px"}})],1)]},proxy:!0}])},[i("q-input",{attrs:{placeholder:"輸入篩選文字",outlined:"",dense:"",square:""},on:{change:function(e){return t.ReloadDataset()}},model:{value:t.searchKey,callback:function(e){t.searchKey=e},expression:"searchKey"}}),t._v(" "),i("q-list",{attrs:{bordered:"",separator:""}},t._l(t.datasetArr,(function(e,a){return i("q-item",{key:a,attrs:{clickable:"",active:t.selectIndex==a,"active-class":"bg-green-2"},on:{click:function(e){return t.SelectItem(a)},dblclick:function(e){return t.ConfirmSelect()}}},[i("q-item-section",{attrs:{avatar:""}},[i("q-avatar",{attrs:{square:"",rounded:""}},[i("img",{staticStyle:{"object-fit":"cover"},attrs:{src:e.picCover||"/static/image/logo-16-9.png"}})])],1),t._v(" "),i("q-item-section",[i("q-item-label",[t._v(t._s(e.name))])],1)],1)})),1)],1)],1)],1),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){return t.ConfirmSelect()}}}),t._v(" "),i("q-btn",{attrs:{flat:"",label:"取消"},on:{click:function(e){return t.CancelSelect()}}})],1)],1)};a._withStripped=!0;var n={name:"dataset-select",props:{forUpload:Boolean,forAnnotation:Boolean},components:{},data:function(){return{searchKey:"",datasetArr:[],hasMore:!0,selectIndex:-1,lastDataset:{}}},created:function(){this.GetLastDataset()},methods:{GetLastDataset:function(){window.localStorage;this.lastDataset=JSON.parse(localStorage.getItem("lastDataset"))},SetLastDataset:function(t){window.localStorage;localStorage.setItem("lastDataset",JSON.stringify(t))},LoadMoreDataset:function(t,e){var i="/dataset/list-dataset";i+="?page="+(t-1),i+="&sort=updatedAt",i+="&orderType=desc",this.forUpload&&(i+="&enableUpload=1"),this.forAnnotation&&(i+="&enableAnnotation=1"),i+="&keyword="+this.searchKey,$.get(i,function(t){"ok"==t.status&&(this.hasMore=t.data.hasMore,this.hasMore||this.$refs.datasetScroll.stop(),this.datasetArr=this.datasetArr.concat(t.data.dataset),e())}.bind(this))},ReloadDataset:function(){this.datasetArr=[],this.$refs.datasetScroll.reset(),this.$refs.datasetScroll.resume(),this.selectIndex=-1},GetSelectDataset:function(){return-1==this.selectIndex&&this.lastDataset?this.lastDataset:this.selectIndex<0||this.selectIndex>=this.datasetArr.length?null:this.datasetArr[this.selectIndex]},SelectItem:function(t){this.selectIndex=t,this.$emit("change")},ConfirmSelect:function(){return-1==this.selectIndex&&this.lastDataset?this.$emit("confirm"):this.selectIndex<0||this.selectIndex>=this.datasetArr.length?alert("請選擇資料集"):(this.SetLastDataset(this.datasetArr[this.selectIndex]),void this.$emit("confirm"))},CancelSelect:function(){this.$emit("cancel")}}},s=(i(41),i(0)),r=Object(s.a)(n,a,[],!1,null,null,null);r.options.__file="src/vue/dataset-select.vue";e.a=r.exports},function(t,e,i){var a=i(1),n=i(47);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(49);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(51);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(53);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(55);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(57);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(59);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(61);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(63);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(65);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(67);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(69);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"topbar bg-grey-8 text-white"},[i("q-toolbar",{staticClass:"q-px-md",attrs:{square:""}},[t.useMenu?i("q-btn",{attrs:{flat:"",round:"",icon:"menu"},on:{click:function(e){return t.ToggleMenu()}}}):t._e(),t._v(" "),i("a",{attrs:{href:"/"}},[i("q-btn",{attrs:{flat:"","no-caps":""}},[i("q-avatar",{attrs:{size:"md",square:""}},[i("img",{attrs:{src:t.logo}})]),t._v(" "),i("div",{staticClass:"gt-xs q-px-md text-white text-h5 inline"},[t._v(t._s(t.title))])],1)],1),t._v(" "),i("q-space"),t._v(" "),t.user?i("q-item",{attrs:{clickable:"",tag:"a",href:"/account"}},[i("q-avatar",{attrs:{size:"lg"}},[i("img",{staticStyle:{"object-fit":"cover"},attrs:{src:t.user.icon}})]),t._v(" "),i("q-item-section",{staticClass:"q-px-sm"},[i("q-item-label",{staticClass:"text-h6"},[t._v(t._s(t.user.name))])],1)],1):i("q-item",{attrs:{clickable:"",tag:"a",href:"/login"}},[i("q-icon",{attrs:{size:"md",name:"account_box"}}),t._v(" "),i("q-item-section",[i("q-item-label",{staticClass:"text-h6"},[t._v("登入")])],1)],1)],1)],1)};a._withStripped=!0;var n={name:"topbar",props:{user:Object,useMenu:Boolean},data:function(){return{title:"",logo:"/static/image/logo.png"}},created:function(){$.get("/site-info",function(t){"ok"==t.status&&(this.title=t.data.title,this.logo=t.data.logo)}.bind(this))},methods:{ToggleMenu:function(){this.$emit("toggleMenu")}}},s=(i(30),i(0)),r=Object(s.a)(n,a,[],!1,null,null,null);r.options.__file="src/vue/topbar.vue";e.a=r.exports},function(t,e,i){"use strict";var a=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"image-upload"},[e("img",{directives:[{name:"show",rawName:"v-show",value:this.showPreview,expression:"showPreview"}],attrs:{src:this.imageData}}),this._v(" "),e("input",{ref:"uploadBt",attrs:{type:"file",hidden:""},on:{change:this.UpdateFile}})])};a._withStripped=!0;var n={name:"image-upload",props:{maxResW:{type:Number,default:1024},maxResH:{type:Number,default:1024},showPreview:Boolean,src:String},data:function(){return{file:null,imageData:null,url:"",additionData:{},OnSucc:null,OnFail:null,OnProgress:null,OnChange:null,maxW:1024,maxH:1024,uploading:!1,exif:{}}},created:function(){this.src&&(this.imageData=this.src),this.maxResW&&(this.maxW=this.maxResW),this.maxResH&&(this.maxH=this.maxResH)},methods:{SetMaxRes:function(t,e){this.maxW=t,this.maxH=e},SelectFile:function(){this.$refs.uploadBt.click()},UpdateFile:function(t){var e=t.target.files;if(FileReader&&e&&e.length){var i=new FileReader;i.onload=function(){var t=function(t){for(var e=atob(t),i=e.length,a=new Uint8Array(i),n=0;n<i;n++)a[n]=e.charCodeAt(n);return a.buffer}(i.result.split(",")[1]),e=ExifReader.load(t);if(this.exif={},e.GPSLatitude&&e.GPSLongitude){var a=parseFloat(e.GPSLatitude.description),n=parseFloat(e.GPSLongitude.description);a&&n&&(this.exif.lat=a,this.exif.lng=n)}if(e.DateTime){var s=e.DateTime.description.split(" "),r=s[0].replace(/:/g,"-");this.exif.time=r+" "+s[1]}var o=function(t){var e=new Image;e.onload=function(){this.FitCanvasFromImage(e),this.OnChange&&this.OnChange()}.bind(this),e.onerror=function(){this.OnFail&&this.OnFail("Load File fail")}.bind(this),e.src=t}.bind(this);".heic"==this.file.name.substr(this.file.name.length-5).toLowerCase()&&this.$q.platform.is.desktop?heic2any({blob:this.file,toType:"image/jpeg"}).then((function(t){var e=URL.createObjectURL(t);o(e)})):o(i.result)}.bind(this),this.file=e[0],this.$emit("loading"),i.readAsDataURL(e[0])}},FitCanvasFromImage:function(t){var e=document.createElement("canvas");e.width=t.width,e.height=t.height;var i=e.getContext("2d");i.save(),i.drawImage(t,0,0),i.restore();var a=this.maxW/t.width,n=this.maxH/t.height,s=Math.min(a,n),r=t.width*s,o=t.height*s,l=this.ResizeImage(e,r,o);this.imageData=l.toDataURL("image/jpeg",.9)},FitCanvasFromCanvas:function(t){var e=this.maxW/t.width,i=this.maxH/t.height,a=Math.min(e,i),n=t.width*a,s=t.height*a,r=this.ResizeImage(t,n,s);this.imageData=r.toDataURL("image/jpeg",.9)},CropImage:function(t,e,i,a,n){var s=document.createElement("canvas");s.width=a,s.height=n;var r=s.getContext("2d");return r.save(),r.drawImage(t,e,i,a,n,0,0,a,n),r.restore(),s},ResizeImage:function(t,e,i){for(var a=Math.max(.5*t.width,e),n=Math.max(.5*t.height,i),s=t;a>e||n>i;){(r=document.createElement("canvas")).width=a,r.height=n,r.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,a,n),s=r,a=Math.max(.5*s.width,e),n=Math.max(.5*s.height,i)}var r;return(r=document.createElement("canvas")).width=e,r.height=i,r.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,e,i),r},UploadImage:function(){if(!this.uploading){this.uploading=!0;var t=$("meta[name='csrf-token']").attr("content"),e=new FormData;for(var i in this.additionData)e.append(i,this.additionData[i]);e.append("uploadImage",this.imageData),$.ajax({url:this.url,headers:{"csrf-token":t},type:"POST",data:e,processData:!1,contentType:!1,xhr:function(){var t=$.ajaxSettings.xhr();return t.upload&&this.OnProgress&&t.upload.addEventListener("progress",this.OnProgress,!1),t}.bind(this),success:function(t){if(this.uploading=!1,"ok"!=t.status)switch(t.message){case"blacklist":return alert("黑名單使用者無此權限");default:return alert("上傳影像失敗")}if(this.OnSucc)return this.OnSucc(t)}.bind(this),error:function(t,e,i){if(this.uploading=!1,this.OnFail)return this.OnFail(i)}.bind(this)})}}}},s=(i(46),i(0)),r=Object(s.a)(n,a,[],!1,null,null,null);r.options.__file="src/vue/image-upload.vue";e.a=r.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"annotator-bbox"},[i("img",{ref:"srcImage",staticClass:"hidden",attrs:{src:t.image.url},on:{load:t.ChangeImage}}),t._v(" "),"view"==t.task?i("div",{staticClass:"column fit"},[i("div",{ref:"viewCanvas",staticClass:"col"})]):i("div",{staticClass:"column fit"},[i("div",{staticClass:"col q-ma-auto relative-position"},[i("div",{ref:"editCanvas",staticClass:"fit"}),t._v(" "),"annotate"==t.task?i("div",{staticClass:"tool-set"},[i("q-btn-toggle",{attrs:{glossy:"",size:"sm",options:t.toolOption,color:"grey-1","text-color":"grey-6"},on:{input:function(e){return t.ChangeTool()}},scopedSlots:t._u([{key:"bbox",fn:function(){return[i("q-icon",{attrs:{name:"aspect_ratio"}})]},proxy:!0},{key:"move",fn:function(){return[i("q-icon",{attrs:{name:"pan_tool"}})]},proxy:!0}],null,!1,1866943705),model:{value:t.tool,callback:function(e){t.tool=e},expression:"tool"}})],1):t._e()]),t._v(" "),"annotate"==t.task?i("q-banner",{staticClass:"bg-grey-6 text-white col-shrink",attrs:{"inline-actions":""},scopedSlots:t._u([{key:"action",fn:function(){return[i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"確定"},on:{click:function(e){return t.SetAnnotation()}}}),t._v(" "),i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"略過"},on:{click:function(e){return t.SkipTask()}}})]},proxy:!0}],null,!1,2135591169)},[i("div",{staticClass:"text-h6 inline-block"},[t._v("\n\t\t\t\t請框選出影像中的物件並給予標籤\n\t\t\t")])]):t._e(),t._v(" "),"verify"==t.task?i("q-banner",{staticClass:"bg-grey-6 text-white col-shrink",attrs:{"inline-actions":""},scopedSlots:t._u([{key:"action",fn:function(){return[i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"是"},on:{click:function(e){return t.SetVerification(!0)}}}),t._v(" "),i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"否"},on:{click:function(e){return t.SetVerification(!1)}}}),t._v(" "),i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"略過"},on:{click:function(e){return t.SkipTask()}}})]},proxy:!0}],null,!1,767176183)},[i("div",{staticClass:"text-h6 inline-block"},[t._v("\n\t\t\t\t請驗證此影像框選的物件及標籤是否正確?\n\t\t\t")])]):t._e()],1),t._v(" "),i("q-dialog",{attrs:{persistent:""},model:{value:t.openTagSelect,callback:function(e){t.openTagSelect=e},expression:"openTagSelect"}},[i("q-card",[i("q-card-section",[i("div",{staticClass:"text-h6 q-py-sm"},[t._v("請選擇標籤")]),t._v(" "),i("tag-select",{ref:"tagSelect",attrs:{dataset:t.dataset}})],1),t._v(" "),i("q-separator"),t._v(" "),i("q-card-actions",{attrs:{align:"around"}},[t.newRect?i("q-btn",{attrs:{flat:"",label:"新增"},on:{click:function(e){return t.AddAnnotation()}}}):i("q-btn",{attrs:{flat:"",label:"修改"},on:{click:function(e){return t.ConfirmTagSelect()}}}),t._v(" "),i("q-btn",{attrs:{flat:"",label:"取消"},on:{click:function(e){return t.CancelTagSelect()}}}),t._v(" "),t.target?i("q-btn",{attrs:{flat:"",label:"刪除"},on:{click:function(e){return t.RemoveAnnotation()}}}):t._e()],1)],1)],1),t._v(" "),i("q-dialog",{model:{value:t.openHelp,callback:function(e){t.openHelp=e},expression:"openHelp"}},[i("q-card",{staticClass:"full-width q-pa-sm"},[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("如何標註")]),t._v(" "),i("ul",{staticClass:"text-subtitle2"},[i("li",[t._v("框選出影像中所有符合標籤的物件並選擇對應的標籤，完成後按「確定」送出。")]),t._v(" "),i("li",[t._v("優良的標註應符合以下條件：\n\t\t\t\t\t\t"),i("ol",[i("li",[t._v("框選出所有符合標籤的物件並選擇正確的物件標籤")]),t._v(" "),i("li",[t._v("方框應完整涵蓋該物件可以看到的範圍(不包含被遮住的部分)，並且盡量逼近該物件的大小")]),t._v(" "),i("li",[t._v("一個方框只能框一個物件，若有多個物件請分不同方框框選")])])])]),t._v(" "),i("div",{staticClass:"text-h6"},[t._v("如何驗證")]),t._v(" "),i("ol",{staticClass:"text-subtitle2"},[i("li",[t._v("確認影像中框選出的物件標籤是否正確")]),t._v(" "),i("li",[t._v("確認方框是否完整涵蓋該物件可以看到的範圍(不包含被遮住的部分)，並且盡量逼近該物件的大小")]),t._v(" "),i("li",[t._v("確認一個方框只能框一個物件，若有多個物件需分成不同方框框選")]),t._v(" "),i("li",[t._v("確認是否已框選出所有符合標籤的物件")]),t._v(" "),i("li",[t._v("若以上條件皆符合即為優良的標註，按「是」送出。反之按「否」。")])]),t._v(" "),i("div",{staticClass:"text-h6"},[t._v("參考資料")]),t._v(" "),i("ul",[i("li",[i("a",{attrs:{href:"http://vision.stanford.edu/pdf/bbox_submission.pdf",target:"_blank"}},[t._v("Su, H., Deng, J., & Fei-Fei, L. (2012). Crowdsourcing annotations for visual object detection. In AAAI human computation workshop.")])]),t._v(" "),i("li",[i("a",{attrs:{href:"https://chtseng.wordpress.com/2019/03/10/ai%e9%a0%98%e5%9f%9f%e7%9a%84%e8%97%8d%e9%a0%98%e5%b7%a5%e4%bd%9c-image-labeling/",target:"_blank"}},[t._v("AI領域的藍領工作- Image Labeling")])])])]),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{flat:"",label:"確定"}})],1)],1)],1)],1)};a._withStripped=!0;var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"tag-select"},[i("q-select",{attrs:{filled:"",dense:"","bg-color":"grey-2","use-input":"","hide-selected":"","fill-input":"","input-debounce":"0",options:t.tagArr},on:{filter:t.FilterTag,input:t.SelectTag},model:{value:t.selectTag,callback:function(e){t.selectTag=e},expression:"selectTag"}})],1)};n._withStripped=!0;var s={name:"tag-select",props:{dataset:Object},components:{},data:function(){return{tagArr:[],selectTag:""}},created:function(){},methods:{FilterTag:function(t,e,i){e(function(){this.tagArr=this.dataset.tagArr.filter(function(e){return e.indexOf(t)>-1}.bind(this))}.bind(this))},SelectTag:function(t){this.selectTag=t,this.$emit("change")}}},r=(i(64),i(0)),o=Object(r.a)(s,n,[],!1,null,null,null);o.options.__file="src/vue/tag-select.vue";var l={name:"annotator-bbox",components:{"tag-select":o.exports},props:{dataset:Object,image:Object,task:String},data:function(){return{openHelp:!1,openTagSelect:!1,tool:"move",toolOption:[{value:"bbox",slot:"bbox"},{value:"move",slot:"move"}],container:null,stage:null,imageLayer:null,bboxLayer:null,imageNode:null,annotationArr:[],gesture:"",lastTouch:null,newRect:null,target:null,labelColor:{}}},mounted:function(){this.GenLabelColor(),this.InitCanvas()},methods:{GetRelativeMousePos:function(t){var e=t.getAbsoluteTransform().copy();e.invert();var i=t.getStage().getPointerPosition();return e.point(i)},HSVtoRGB:function(t,e,i,a){var n,s,r,o,l,c,u,d;switch(1===arguments.length&&(e=t.s,i=t.v,t=t.h),c=i*(1-e),u=i*(1-(l=6*t-(o=Math.floor(6*t)))*e),d=i*(1-(1-l)*e),o%6){case 0:n=i,s=d,r=c;break;case 1:n=u,s=i,r=c;break;case 2:n=c,s=i,r=d;break;case 3:n=c,s=u,r=i;break;case 4:n=d,s=c,r=i;break;case 5:n=i,s=c,r=u}return"rgba("+(n=Math.round(255*n))+","+(s=Math.round(255*s))+","+(r=Math.round(255*r))+","+a+")"},GenLabelColor:function(){this.labelColor={};for(var t=this.dataset.tagArr.length,e=0;e<t;e++){var i=e%5*.2,a=1-parseInt(.2*e)%5*.2,n=1-parseInt(.2*e*.2)%5*.2,s=this.HSVtoRGB(i,a,n,1),r=n>=.5?"#000000":"#ffffff",o=this.dataset.tagArr[e];this.labelColor[o]={fg:r,bg:s}}},BoundInImage:function(t){var e=this.imageNode.absolutePosition(),i=this.imageNode.size(),a=this.imageNode.getAbsoluteScale();return t.x<e.x&&(t.x=e.x),t.x>=e.x+i.width*a.x&&(t.x=e.x+i.width*a.x),t.y<e.y&&(t.y=e.y),t.y>=e.y+i.height*a.y&&(t.y=e.y+i.height*a.y),t},BoundStage:function(t){var e=this.stage.size(),i=this.imageNode.size(),a=this.stage.scale(),n=.5*(e.width-i.width)*a.x,s=.5*(e.height-i.height)*a.y,r=.5*(e.width+i.width)*a.x,o=.5*(e.height+i.height)*a.y;return i.width*a.x>e.width?t.x+n>0?t.x=-n:t.x+r<e.width&&(t.x=e.width-r):t.x+n<0?t.x=-n:t.x+r>e.width&&(t.x=e.width-r),i.height*a.y>e.height?t.y+s>0?t.y=-s:t.y+o<e.height&&(t.y=e.height-o):t.y+s<0?t.y=-s:t.y+o>e.height&&(t.y=e.height-o),t},InitCanvas:function(){this.container="view"==this.task?this.$refs.viewCanvas:this.$refs.editCanvas,this.stage=new Konva.Stage({container:this.container,width:this.container.clientWidth,height:this.container.clientHeight,draggable:!1,dragBoundFunc:this.BoundStage}),this.stage.content.style.margin="auto",this.tool="annotate"==this.task?"bbox":"move",this.ChangeTool(),this.stage.on("wheel",function(t){t.evt.preventDefault();var e=this.stage.scaleX(),i=t.evt.deltaY>0?.95*e:e/.95;i<1&&(i=1);var a=this.stage.getPointerPosition(),n=(a.x-this.stage.x())/e,s=(a.y-this.stage.y())/e;this.stage.scale({x:i,y:i});var r={x:-n*i+a.x,y:-s*i+a.y};r=this.BoundStage(r),this.stage.position(r),this.stage.batchDraw()}.bind(this)),this.stage.on("mousedown touchstart",function(t){if("touchstart"==t.type&&2==t.evt.touches.length)this.gesture="pinch",this.lastTouch=t;else if(this.gesture="drag","bbox"==this.tool){if(""!=t.target.name())return;var e=this.GetRelativeMousePos(this.stage);e=this.BoundInImage(e),this.lastTouch=this.stage.getPointerPosition(),this.newRect&&this.newRect.destroy(),this.newRect=new Konva.Rect({x:e.x,y:e.y,width:0,height:0,fill:"rgba(0,0,0,0)",stroke:"#ffffff"}),this.bboxLayer.add(this.newRect)}this.stage.batchDraw()}.bind(this)),this.stage.on("mousemove touchmove",function(t){if("pinch"==this.gesture){var e=this.lastTouch.evt.touches[0],i=this.lastTouch.evt.touches[1],a=t.evt.touches[0],n=t.evt.touches[1];if(this.lastTouch=t,!(e&&i&&a&&n))return;function s(t,e){var i=t.clientX-e.clientX,a=t.clientY-e.clientY;return Math.sqrt(i*i+a*a)}var r=s(e,i),o=s(a,n),l=this.stage.scaleX(),c=o/r;c>1.1?c=1.1:c<.9&&(c=.9);var u=l*c;u<1&&(u=1);var d={x:.5*(a.clientX+n.clientX),y:.5*(a.clientY+n.clientY)},h={x:(d.x-this.stage.x())/l,y:(d.y-this.stage.y())/l};this.stage.scale({x:u,y:u});var f={x:-h.x*u+d.x,y:-h.y*u+d.y};f=this.BoundStage(f),this.stage.position(f)}else if("drag"==this.gesture)if("bbox"==this.tool){if(!this.newRect)return;var m=this.GetRelativeMousePos(this.stage);m=this.BoundInImage(m);var p=this.newRect.position();this.newRect.setAttrs({width:m.x-p.x,height:m.y-p.y})}else if("move"==this.tool){m=this.stage.getPointerPosition();if(!this.lastTouch)return void(this.lastTouch=m);var v=this.stage.position();f={x:v.x+m.x-this.lastTouch.x,y:v.y+m.y-this.lastTouch.y};this.lastTouch=m,f=this.BoundStage(f),this.stage.position(f)}this.stage.batchDraw()}.bind(this)),this.stage.on("mouseup touchend",function(t){if(this.lastTouch=null,"pinch"==this.gesture)this.gesture="";else if("drag"==this.gesture){if(this.gesture="","bbox"!=this.tool)return;if(!this.newRect)return;var e=this.newRect.size();if(Math.abs(e.width)<10||Math.abs(e.height)<10)return this.CancelTagSelect();this.openTagSelect=!0}}.bind(this)),this.imageLayer=new Konva.Layer,this.bboxLayer=new Konva.Layer,this.stage.add(this.imageLayer),this.stage.add(this.bboxLayer)},ChangeTool:function(){switch(this.tool){case"move":this.container.style.cursor="grab";break;case"bbox":this.container.style.cursor="default"}},ConfirmTagSelect:function(){if(this.target){var t=this.$refs.tagSelect.selectTag;if(!t||""==t)return alert("請選擇標籤");this.target.tag=t;var e=this.labelColor[t].bg,i=this.labelColor[t].fg;this.target.node.find("Rect")[0].setAttr("stroke",e);var a=this.target.node.find("Label")[0];a.getTag().setAttr("fill",e),a.getText().setAttr("fill",i).text(t),this.target=null,this.openTagSelect=!1,this.stage.batchDraw()}},CancelTagSelect:function(){this.openTagSelect=!1,this.target=null,this.newRect&&(this.newRect.destroy(),this.newRect=null),this.stage.batchDraw()},GenBBox:function(t,e,i,a,n,s){var r=new Konva.Group;this.bboxLayer.add(r);var o=new Konva.Rect({x:t,y:e,width:i,height:a,fill:"rgba(0,0,0,0)",stroke:this.labelColor[n].bg,strokeWidth:1});r.add(o);var l=new Konva.Label({});l.add(new Konva.Tag({fill:this.labelColor[n].bg})),l.add(new Konva.Text({text:n,padding:3,fontSize:10,fill:this.labelColor[n].fg,name:"BBoxLabel"})),l.on("click tap",function(t){this.openTagSelect=!0,this.target=d,Vue.nextTick(function(){this.$refs.tagSelect.selectTag=d.tag}.bind(this))}.bind(this)),l.position({x:t,y:e-l.height()}),r.add(l);var c=function(t,e,i){return function(a){i.scaleX(1.5),i.scaleY(1.5),i.y(e.y()-1.5*i.height()),i.draw(),e.strokeWidth(3),t.moveToTop()}},u=function(t,e,i){return function(t){i.scaleX(1),i.scaleY(1),i.y(e.y()-i.height()),i.draw(),e.strokeWidth(1)}};r.on("mouseover",c(r,o,l)),r.on("mouseout",u(0,o,l));var d={tag:n,x:t,y:e,width:i,height:a,node:r,index:this.annotationArr.length};if(this.annotationArr.push(d),s){var h=function(t){var e=r.find(".LT")[0],i=r.find(".RT")[0],a=r.find(".RB")[0],n=r.find(".LB")[0];switch(t.getName()){case"LT":n.x(t.x()),i.y(t.y());break;case"RT":a.x(t.x()),e.y(t.y());break;case"RB":i.x(t.x()),n.y(t.y());break;case"LB":e.x(t.x()),a.y(t.y())}for(var s=[e,i,a,n],h=Number.MAX_VALUE,f=Number.MAX_VALUE,m=Number.MIN_VALUE,p=Number.MIN_VALUE,v=0;v<s.length;v++){var g=s[v].position(),b=s[v].size(),_=g.x+.5*b.width,x=g.y+.5*b.height;_<h&&(h=_),_>m&&(m=_),x<f&&(f=x),x>p&&(p=x)}var y=m-h,k=p-f;o.setAttrs({x:h,y:f,width:y,height:k}),d.x=h,d.y=f,d.width=y,d.height=k,l.setAttrs({x:h,y:f-l.height()}),r.on("mouseover",c(r,o,l)),r.on("mouseout",u(0,o,l)),this.stage.batchDraw()}.bind(this),f=function(t,e,i,a){var n=new Konva.Rect({x:e-5,y:i-5,width:10,height:10,fill:"#ffffff",stroke:"#3333ff",name:a,draggable:!0,dragBoundFunc:function(t){return t.x+=5,t.y+=5,(t=this.BoundInImage(t)).x-=5,t.y-=5,t}.bind(this)});n.on("dragmove",function(){h(n)}.bind(this)),t.add(n)}.bind(this);f(r,t,e,"LT"),f(r,t+i,e,"RT"),f(r,t+i,e+a,"RB"),f(r,t,e+a,"LB")}},AddAnnotation:function(){if(this.newRect){var t=this.$refs.tagSelect.selectTag;if(!t||""==t)return alert("請選擇標籤");var e=this.newRect.position(),i=this.newRect.size();i.width<0&&(e.x=e.x+i.width,i.width=-i.width),i.height<0&&(e.y=e.y+i.height,i.height=-i.height),this.GenBBox(e.x,e.y,i.width,i.height,t,!0),this.openTagSelect=!1,this.newRect.destroy(),this.newRect=null,this.stage.batchDraw()}},RemoveAnnotation:function(){this.target&&(this.target.node.destroy(),this.annotationArr.splice(this.target.index,1),this.target=null,this.openTagSelect=!1,this.stage.batchDraw())},ChangeImage:function(){this.imageNode&&this.imageNode.destroy();for(var t=0;t<this.annotationArr.length;t++){this.annotationArr[t].node.destroy()}this.annotationArr=[];var e=this.$refs.srcImage,i=this.container.clientWidth,a=this.container.clientHeight,n=i/e.width,s=a/e.height,r=Math.min(n,s),o=e.width*r,l=e.height*r;this.imageNode=new Konva.Image({x:.5*(i-o),y:.5*(a-l),width:o,height:l,image:e}),this.imageLayer.add(this.imageNode),"view"!=this.task&&"verify"!=this.task||this.DrawAnnotation(),this.tool="annotate"==this.task?"bbox":"move",this.ChangeTool(),this.stage.batchDraw()},DrawAnnotation:function(){if(this.image.annotation){for(var t=this.imageNode.position(),e=this.imageNode.size(),i=this.$refs.srcImage,a=0;a<this.image.annotation.annotation.length;a++){var n=this.image.annotation.annotation[a],s=parseFloat(n.x),r=parseFloat(n.y),o={x:s,y:r},l={x:s+parseFloat(n.width),y:r+parseFloat(n.height)};o.x=o.x*e.width/i.width+t.x,o.y=o.y*e.height/i.height+t.y,l.x=l.x*e.width/i.width+t.x,l.y=l.y*e.height/i.height+t.y,this.GenBBox(o.x,o.y,l.x-o.x,l.y-o.y,n.tag,!1)}this.stage.batchDraw()}},SetAnnotation:function(){if(0==this.annotationArr.length)return alert("請至少新增一個標籤");this.$emit("setAnnotation")},SetVerification:function(t){this.$emit("setVerification",t)},GetAnnotation:function(){for(var t=[],e=this.imageNode.position(),i=this.imageNode.size(),a=this.$refs.srcImage,n=0;n<this.annotationArr.length;n++){var s=this.annotationArr[n],r={},o={x:s.x,y:s.y},l={x:s.x+s.width,y:s.y+s.height};o.x=(o.x-e.x)*a.width/i.width,o.y=(o.y-e.y)*a.height/i.height,l.x=(l.x-e.x)*a.width/i.width,l.y=(l.y-e.y)*a.height/i.height,r.x=o.x,r.y=o.y,r.width=l.x-o.x,r.height=l.y-o.y,r.tag=s.tag,t.push(r)}return t},SkipTask:function(){this.$emit("skipTask")}}},c=(i(66),Object(r.a)(l,a,[],!1,null,null,null));c.options.__file="src/vue/annotator-bbox.vue";e.a=c.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"annotator-image"},["view"==t.task?i("div",{staticClass:"column fit"},[i("q-img",{staticClass:"col",attrs:{contain:"",src:t.image.url}},[t.image.annotation?i("div",{staticClass:"absolute-bottom text-subtitle1 text-center"},[t._v("\n\t\t\t\t"+t._s(t.GetSelectTag(t.image.annotation.annotation))+"\n\t\t\t")]):t._e()])],1):i("div",{staticClass:"column fit"},[i("q-img",{staticClass:"col q-my-md",attrs:{contain:"",src:t.image.url}}),t._v(" "),"annotate"==t.task?i("q-banner",{staticClass:"bg-grey-6 text-white col-shrink",attrs:{"inline-actions":""},scopedSlots:t._u([{key:"action",fn:function(){return[i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"確定"},on:{click:function(e){return t.SetAnnotation()}}}),t._v(" "),i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"略過"},on:{click:function(e){return t.SkipTask()}}})]},proxy:!0}],null,!1,2135591169)},[i("div",{staticClass:"row items-center"},[i("div",{staticClass:"text-h6 inline-block"},[t._v("\n\t\t\t\t\t請選擇符合此影像的標籤\n\t\t\t\t")]),t._v(" "),i("tag-checkbox",{ref:"tagCheckbox",attrs:{dataset:t.dataset}})],1)]):t._e(),t._v(" "),"verify"==t.task?i("q-banner",{staticClass:"bg-grey-6 text-white col-shrink",attrs:{"inline-actions":""},scopedSlots:t._u([{key:"action",fn:function(){return[i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"是"},on:{click:function(e){return t.SetVerification(!0)}}}),t._v(" "),i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"否"},on:{click:function(e){return t.SetVerification(!1)}}}),t._v(" "),i("q-btn",{staticClass:"q-ma-xs bg-primary",attrs:{label:"略過"},on:{click:function(e){return t.SkipTask()}}})]},proxy:!0}],null,!1,767176183)},[i("div",{staticClass:"text-h6 inline-block"},[t._v("\n\t\t\t\t請驗證此影像是否為 "+t._s(t.GetSelectTag(t.image.annotation.annotation))+"?\n\t\t\t")])]):t._e()],1),t._v(" "),i("q-dialog",{model:{value:t.openHelp,callback:function(e){t.openHelp=e},expression:"openHelp"}},[i("q-card",{staticClass:"full-width q-pa-sm"},[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("如何標註")]),t._v(" "),i("ul",{staticClass:"text-subtitle2"},[i("li",[t._v("選擇符合此影像的標籤並按「確定」。")])]),t._v(" "),i("div",{staticClass:"text-h6"},[t._v("如何驗證")]),t._v(" "),i("ul",{staticClass:"text-subtitle2"},[i("li",[t._v("若此影像符合選擇的標籤，按「是」。反之按「否」。")])])]),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{flat:"",label:"確定"}})],1)],1)],1)],1)};a._withStripped=!0;var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"tag-checkbox"},[i("q-btn",{staticClass:"q-ma-sm bg-brown-8",on:{click:function(e){t.openTagSelect=!0}}},[t._v(t._s(t.btTitle))]),t._v(" "),i("q-dialog",{model:{value:t.openTagSelect,callback:function(e){t.openTagSelect=e},expression:"openTagSelect"}},[i("q-card",[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("選擇標籤")]),t._v(" "),t._l(t.tagSelect,(function(e){return i("q-checkbox",{key:e.name,attrs:{label:e.name},on:{input:function(e){return t.UpdateSelect()}},model:{value:e.value,callback:function(i){t.$set(e,"value",i)},expression:"tag.value"}})}))],2),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){return t.ConfirmSelect()}}})],1)],1)],1)],1)};n._withStripped=!0;var s={name:"tag-checkbox",props:{dataset:Object},components:{},data:function(){return{btTitle:"選擇標籤",tagSelect:[],openTagSelect:!1}},created:function(){this.tagSelect=[];for(var t=0;t<this.dataset.tagArr.length;t++){var e=this.dataset.tagArr[t];this.tagSelect.push({name:e,value:!1})}},methods:{UpdateSelect:function(){for(var t=0,e=0;e<this.tagSelect.length;e++){this.tagSelect[e].value&&t++}this.btTitle=0==t?"選擇標籤":t+"個選擇"},ConfirmSelect:function(){this.openTagSelect=!1,this.$emit("confirm")}}},r=(i(60),i(0)),o=Object(r.a)(s,n,[],!1,null,null,null);o.options.__file="src/vue/tag-checkbox.vue";var l={name:"annotator-image",components:{"tag-checkbox":o.exports},props:{dataset:Object,image:Object,task:String,status:String},data:function(){return{openHelp:!1}},mounted:function(){},methods:{SetAnnotation:function(){this.$emit("setAnnotation")},SetVerification:function(t){this.$emit("setVerification",t)},GetAnnotation:function(){return this.$refs.tagCheckbox.tagSelect},SkipTask:function(){this.$emit("skipTask")},GetSelectTag:function(t){for(var e="",i=0;i<t.length;i++){var a=t[i];"true"==a.value&&(e+="#"+a.name+" ")}return e}}},c=(i(62),Object(r.a)(l,a,[],!1,null,null,null));c.options.__file="src/vue/annotator-image.vue";e.a=c.exports},function(t,e,i){var a=i(1),n=i(26);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){(e=i(2)(!1)).push([t.i,'html,body{height:100%;margin:0;padding:0;background-color:#edffef}*{box-sizing:border-box;font-family:"微軟正黑體", "Microsoft JhengHei"}\n',""]),t.exports=e},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return t.dataset?i("q-card",{staticClass:"image-info full-width q-pa-sm"},[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("選擇資料時間")]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.dataTime,expression:"dataTime"}],staticClass:"q-pa-sm",attrs:{type:"datetime-local"},domProps:{value:t.dataTime},on:{change:function(e){return t.$emit("change")},input:function(e){e.target.composing||(t.dataTime=e.target.value)}}})]),t._v(" "),t.dataset.enableGPS?i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("選擇資料地點")]),t._v(" "),i("location-select",{ref:"locationSelect",attrs:{mode:"selectLoc"}}),t._v(" "),t.$refs.locationSelect?i("div",{staticClass:"text-center"},[t._v(t._s(t.$refs.locationSelect.status))]):t._e()],1):t._e(),t._v(" "),t.dataset.form?i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("填寫表單")]),t._v(" "),i("form-reply",{ref:"formReply",attrs:{formData:t.dataset.form,formReply:t.initReply}})],1):t._e(),t._v(" "),i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("資料備註說明(若無備註說明請直接按確定)")]),t._v(" "),i("q-input",{attrs:{filled:"",type:"textarea"},on:{input:function(e){return t.$emit("change")}},model:{value:t.remark,callback:function(e){t.remark=e},expression:"remark"}})],1),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){return t.ConfirmSelect()}}}),t._v(" "),i("q-btn",{attrs:{flat:"",label:"取消"},on:{click:function(e){return t.CancelSelect()}}})],1)],1):t._e()};a._withStripped=!0;var n=i(7),s=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"form-reply"},[i("q-list",{attrs:{bordered:""}},t._l(t.formData.itemArr,(function(e,a){return i("q-item",{key:e.id},[i("q-item-section",[i("div",["true"==e.canNotEmpty?i("span",{staticClass:"text-red"},[t._v("*")]):t._e(),t._v("\n\t\t\t\t\t"+t._s(a+1)+". "+t._s(e.quest)+"\n\t\t\t\t")]),t._v(" "),i("div",["text"==e.type?i("div",[i("q-input",{ref:e.id,refInFor:!0,attrs:{dense:"",placeholder:"請輸入文字",rules:e.rule},model:{value:t.editReply[e.id].value,callback:function(i){t.$set(t.editReply[e.id],"value",i)},expression:"editReply[item.id].value"}})],1):t._e(),t._v(" "),"radio"==e.type?i("div",t._l(e.option,(function(a,n){return i("q-radio",{key:a,attrs:{label:a,val:a},model:{value:t.editReply[e.id].value,callback:function(i){t.$set(t.editReply[e.id],"value",i)},expression:"editReply[item.id].value"}})})),1):t._e(),t._v(" "),"checkbox"==e.type?i("div",[i("div",{staticClass:"text-subtitle2 text-red row"},[e.attr.minCheck?i("div",{staticClass:"q-mx-sm"},[t._v("最少選"+t._s(e.attr.minCheck)+"項")]):t._e(),t._v(" "),e.attr.maxCheck?i("div",{staticClass:"q-mx-sm"},[t._v("最多選"+t._s(e.attr.maxCheck)+"項")]):t._e()]),t._v(" "),t._l(e.option,(function(a,n){return i("q-checkbox",{key:a,attrs:{label:a,val:a},model:{value:t.editReply[e.id].value,callback:function(i){t.$set(t.editReply[e.id],"value",i)},expression:"editReply[item.id].value"}})}))],2):t._e(),t._v(" "),"number"==e.type?i("div",[i("div",{staticClass:"text-subtitle2 text-red row"},[e.attr.minValue?i("div",{staticClass:"q-mx-sm"},[t._v("最小數值"+t._s(e.attr.minValue))]):t._e(),t._v(" "),e.attr.maxValue?i("div",{staticClass:"q-mx-sm"},[t._v("最大數值"+t._s(e.attr.maxValue))]):t._e()]),t._v(" "),i("q-input",{ref:e.id,refInFor:!0,attrs:{type:"number",dense:"",placeholder:"請輸入數字",rules:e.rule},model:{value:t.editReply[e.id].value,callback:function(i){t.$set(t.editReply[e.id],"value",i)},expression:"editReply[item.id].value"}})],1):t._e()])])],1)})),1)],1)};s._withStripped=!0;var r={name:"form-editor",props:{formData:Object,formReply:Object},components:{},data:function(){return{editReply:{}}},created:function(){if(this.formReply)this.editReply=Object.assign({},this.formReply);else{for(var t={},e=0;e<this.formData.itemArr.length;e++){var i={};"checkbox"==(a=this.formData.itemArr[e]).type&&(i.value=[]),t[a.id]=i}this.editReply=t}for(e=0;e<this.formData.itemArr.length;e++){var a;if((a=this.formData.itemArr[e]).attr||(a.attr={}),a.option||(a.option=[]),!this.editReply[a.id]){i={};"checkbox"==a.type&&(i.value=[]),Vue.set(this.editReply,a.id,i)}switch(a.rule=[],a.type){case"text":"true"==a.canNotEmpty&&a.rule.push(t=>!!t||"文字不能空白");break;case"number":a.rule.push(function(){var t=parseFloat(a.attr.minValue),e=parseFloat(a.attr.maxValue),i="true"==a.canNotEmpty;return function(a){return i&&null==a?"數字不能空白":NaN!=t&&a<t?"數值不能小於"+t:!(NaN!=e&&a>e)||"數值不能大於"+e}}())}}},methods:{ValidateReply:function(){for(var t=!0,e=0;e<this.formData.itemArr.length;e++){var i=this.formData.itemArr[e],a=this.editReply[i.id].value;switch(i.type){case"text":case"number":var n=this.$refs[i.id][0];n.validate(),n.hasError&&(this.$q.notify({color:"negative",message:"欄位"+(e+1)+" 格式不符"}),t=!1);break;case"radio":"true"==i.canNotEmpty&&null==a&&(this.$q.notify({color:"negative",message:"欄位"+(e+1)+" 不能空白"}),t=!1);break;case"checkbox":if(a||(a=[]),"true"!=i.canNotEmpty||a.length||(this.$q.notify({color:"negative",message:"欄位"+(e+1)+" 不能空白"}),t=!1),a.length>0){var s=parseFloat(i.attr.minCheck),r=parseFloat(i.attr.maxCheck);(NaN!=s&&a.length<s||NaN!=r&&a.length>r)&&(this.$q.notify({color:"negative",message:"欄位"+(e+1)+" 選擇數量不符規定"}),t=!1)}}}return t}}},o=(i(56),i(0)),l=Object(o.a)(r,s,[],!1,null,null,null);l.options.__file="src/vue/form-reply.vue";var c=l.exports,u={name:"image-info",props:{dataset:Object,initDataTime:String,initLat:Number,initLng:Number,initRemark:String,initReply:Object},components:{"location-select":n.a,"form-reply":c},data:function(){return{dataTime:null,remark:""}},mounted:function(){var t=spacetime().name;this.initDataTime?this.dataTime=spacetime(this.initDataTime).goto(t).unixFmt("yyyy-MM-ddTHH:mm"):this.dataTime=spacetime.now().unixFmt("yyyy-MM-ddTHH:mm"),this.$refs.locationSelect&&(this.initLat&&this.initLng?this.$refs.locationSelect.SetPosition(this.initLat,this.initLng,!0):this.dataset.enableGPS&&this.$refs.locationSelect.GetGPS()),this.initRemark&&(this.remark=this.initRemark)},methods:{GetImageInfo:function(){var t={},e=spacetime.now();return t.dataTime=spacetime(this.dataTime,e.timezone().name).format("iso"),t.remark=this.remark,this.$refs.formReply&&(t.formReply=this.$refs.formReply.editReply),this.$refs.locationSelect&&(t.loc=this.$refs.locationSelect.loc),t},ConfirmSelect:function(){var t=this.$refs.formReply;t&&!t.ValidateReply()||this.$emit("confirm")},CancelSelect:function(){this.$emit("cancel")}}},d=(i(58),Object(o.a)(u,a,[],!1,null,null,null));d.options.__file="src/vue/image-info.vue";e.a=d.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("q-card",{staticClass:"user-select full-width q-pa-sm"},[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("選擇使用者")]),t._v(" "),i("q-scroll-area",{staticStyle:{height:"300px"}},[i("q-infinite-scroll",{ref:"userScroll",on:{load:t.LoadMoreUser},scopedSlots:t._u([{key:"loading",fn:function(){return[i("div",{staticClass:"row justify-center q-my-md"},[i("q-spinner-dots",{attrs:{color:"primary",size:"40px"}})],1)]},proxy:!0}])},[i("q-input",{attrs:{placeholder:"輸入篩選文字",outlined:"",dense:"",square:""},on:{change:function(e){return t.ReloadUser()}},model:{value:t.searchKey,callback:function(e){t.searchKey=e},expression:"searchKey"}}),t._v(" "),i("q-list",{attrs:{bordered:"",separator:""}},t._l(t.userArr,(function(e,a){return i("q-item",{key:a,attrs:{clickable:"",active:t.selectIndex==a,"active-class":"bg-green-2"},on:{click:function(e){return t.SelectItem(a)},dblclick:function(e){return t.ConfirmSelect()}}},[i("q-item-section",{attrs:{avatar:""}},[i("q-avatar",[i("img",{attrs:{src:e.icon}})])],1),t._v(" "),i("q-item-section",[i("q-item-label",[t._v(t._s(e.name))]),t._v(" "),i("q-item-label",{attrs:{caption:"",lines:"1"}},[t._v(t._s(e.contactEmail))])],1)],1)})),1)],1)],1)],1),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){return t.ConfirmSelect()}}}),t._v(" "),i("q-btn",{attrs:{flat:"",label:"取消"},on:{click:function(e){return t.CancelSelect()}}})],1)],1)};a._withStripped=!0;var n={name:"user-select",props:{},components:{},data:function(){return{searchKey:"",userArr:[],hasMore:!0,selectIndex:-1}},created:function(){},methods:{LoadMoreUser:function(t,e){var i="/user/list-user";i+="?page="+(t-1),i+="&keyword="+this.searchKey,$.get(i,function(t){"ok"==t.status&&(this.hasMore=t.data.hasMore,this.hasMore||this.$refs.userScroll.stop(),this.userArr=this.userArr.concat(t.data.user),e())}.bind(this))},ReloadUser:function(){this.userArr=[],this.$refs.userScroll.reset(),this.$refs.userScroll.resume(),this.selectIndex=-1},GetSelectUser:function(){return this.selectIndex<0||this.selectIndex>=this.userArr.length?null:this.userArr[this.selectIndex]},SelectItem:function(t){this.selectIndex=t,this.$emit("change")},ConfirmSelect:function(){if(this.selectIndex<0||this.selectIndex>=this.userArr.length)return alert("請選擇使用者");this.$emit("confirm")},CancelSelect:function(){this.$emit("cancel")}}},s=(i(48),i(0)),r=Object(s.a)(n,a,[],!1,null,null,null);r.options.__file="src/vue/user-select.vue";e.a=r.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"user-list q-pa-sm"},[i("div",{staticClass:"row items-center"},[t.enableAdd?i("div",{staticClass:"col-shrink q-pr-lg"},[i("q-btn",{staticClass:"bg-grey-8 text-white",attrs:{icon:"add",label:"新增名單"},on:{click:function(e){t.openUserSelect=!0}}})],1):t._e(),t._v(" "),t.enableSearch?i("div",{staticClass:"col-12 col-sm-6 col-md-3"},[i("q-input",{attrs:{label:"搜尋名單"},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.ReloadUserList()}},scopedSlots:t._u([{key:"append",fn:function(){return[i("q-btn",{staticClass:"bg-grey-8 text-white",attrs:{icon:"search"},on:{click:function(e){return t.ReloadUserList()}}})]},proxy:!0}],null,!1,1309159698),model:{value:t.searchKey,callback:function(e){t.searchKey=e},expression:"searchKey"}})],1):t._e()]),t._v(" "),i("q-list",{staticClass:"q-my-md",attrs:{bordered:""}},t._l(t.userArr,(function(e,a){return i("q-item",{key:e._id},[i("q-item-section",{attrs:{avatar:""}},[i("q-avatar",[i("img",{attrs:{src:e.icon}})])],1),t._v(" "),i("q-item-section",[i("q-item-label",[t._v(t._s(e.name))]),t._v(" "),i("q-item-label",{attrs:{caption:"",lines:"1"}},[t._v(t._s(e.contactEmail))])],1),t._v(" "),t.enableRemove?i("q-item-section",{attrs:{side:""}},[i("q-btn",{staticClass:"text-gray-8",attrs:{flat:"",icon:"close"},on:{click:function(e){return t.RemoveUser(a)}}})],1):t._e()],1)})),1),t._v(" "),t.list?t._e():i("q-btn",{directives:[{name:"show",rawName:"v-show",value:t.hasMoreUser,expression:"hasMoreUser"}],staticClass:"full-width bg-grey-4 q-ma-sm",attrs:{label:"載入更多"},on:{click:function(e){return t.LoadMoreUserList()}}}),t._v(" "),i("q-dialog",{model:{value:t.openUserSelect,callback:function(e){t.openUserSelect=e},expression:"openUserSelect"}},[i("user-select",{ref:"userSelect",on:{confirm:function(e){return t.AddUser()},cancel:function(e){t.openUserSelect=!1}}})],1)],1)};a._withStripped=!0;var n=i(28),s={name:"user-list",props:{enableAdd:Boolean,enableSearch:Boolean,enableRemove:Boolean,userAuth:String,userStatus:String,list:Array},components:{"user-select":n.a},data:function(){return{searchKey:"",userArr:[],userPage:0,hasMoreUser:!0,openUserSelect:!1}},created:function(){this.list?this.userArr=this.list:this.LoadMoreUserList()},methods:{LoadMoreUserList:function(){var t="/user/list-user";t+="?page="+this.userPage,t+="&keyword="+this.searchKey,this.userAuth&&(t+="&authType="+this.userAuth),this.userStatus&&(t+="&status="+this.userStatus),$.get(t,function(t){"ok"==t.status&&(this.hasMoreUser=t.data.hasMore,this.userArr=this.userArr.concat(t.data.user),this.userPage++)}.bind(this))},ClearUserList:function(){this.userArr=[],this.userPage=0},ReloadUserList:function(){this.ClearUserList(),this.list?this.userArr=this.list.filter((function(t){return-1!=t.name.indexOf(this.searchKey)||-1!=t.contactEmail.indexOf(this.searchKey)})):this.LoadMoreUserList()},AddUser:function(){this.openUserSelect=!1;var t=this.$refs.userSelect.GetSelectUser();t&&this.$emit("add",t)},RemoveUser:function(t){this.$emit("remove",t)}}},r=(i(50),i(0)),o=Object(r.a)(s,a,[],!1,null,null,null);o.options.__file="src/vue/user-list.vue";e.a=o.exports},function(t,e,i){"use strict";var a=i(4);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".topbar{width:100%}.topbar a{text-decoration:none}\n",""]),t.exports=e},,function(t,e,i){var a=i(1),n=i(88);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(90);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(92);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(94);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(96);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){var a=i(1),n=i(98);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("q-card",{staticClass:"dataset-editor"},[i("q-card-section",[i("div",{staticClass:"text-h6"},[t._v("編輯資料集")])]),t._v(" "),i("q-card-section",[i("q-form",[i("q-item",[i("div",{staticClass:"cover-container bg-grey-7"},[i("image-upload",{ref:"uploader",attrs:{src:t.info.picCover||"/static/image/logo-16-9.png",showPreview:"",maxResW:parseInt(t.info.maxWidth),maxResH:parseInt(t.info.maxHeight)}}),t._v(" "),i("q-btn",{staticClass:"change-bt",attrs:{loading:t.uploadCover,flat:"",label:"變更封面"},on:{click:function(e){return t.ChangeCover()}}})],1)]),t._v(" "),i("div",{staticClass:"row"},[i("q-input",{ref:"name",staticClass:"col-12 q-pa-sm",attrs:{label:"資料集名稱",rules:[function(t){return!!t||"資料集名稱不能空白"}]},model:{value:t.info.name,callback:function(e){t.$set(t.info,"name",e)},expression:"info.name"}}),t._v(" "),i("q-input",{staticClass:"full-width q-px-sm",attrs:{label:"資料集簡介",filled:"",type:"textarea"},model:{value:t.info.desc,callback:function(e){t.$set(t.info,"desc",e)},expression:"info.desc"}}),t._v(" "),i("q-input",{ref:"maxWidth",staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{type:"number",label:"最大寬度",rules:[function(t){return!!t||"最大寬度不能空白"},function(t){return t>=32||"最大寬度不能小於32"},function(t){return t<=1920||"最大寬度不能大於1920"}]},model:{value:t.info.maxWidth,callback:function(e){t.$set(t.info,"maxWidth",e)},expression:"info.maxWidth"}}),t._v(" "),i("q-input",{ref:"maxHeight",staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{type:"number",label:"最大高度",rules:[function(t){return!!t||"最大高度不能空白"},function(t){return t>=32||"最大高度不能小於32"},function(t){return t<=1920||"最大高度不能大於1920"}]},model:{value:t.info.maxHeight,callback:function(e){t.$set(t.info,"maxHeight",e)},expression:"info.maxHeight"}}),t._v(" "),i("q-toggle",{staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{label:"公開資料集"},model:{value:t.info.isPublic,callback:function(e){t.$set(t.info,"isPublic",e)},expression:"info.isPublic"}}),t._v(" "),i("q-toggle",{staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{label:"開放上傳影像"},model:{value:t.info.enableUpload,callback:function(e){t.$set(t.info,"enableUpload",e)},expression:"info.enableUpload"}}),t._v(" "),i("q-toggle",{staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{label:"開放下載資料集"},model:{value:t.info.enableDownload,callback:function(e){t.$set(t.info,"enableDownload",e)},expression:"info.enableDownload"}}),t._v(" "),i("q-toggle",{staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{label:"儲存位置資訊"},model:{value:t.info.enableGPS,callback:function(e){t.$set(t.info,"enableGPS",e)},expression:"info.enableGPS"}}),t._v(" "),i("q-toggle",{staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{label:"開放編輯標註"},model:{value:t.info.enableAnnotation,callback:function(e){t.$set(t.info,"enableAnnotation",e)},expression:"info.enableAnnotation"}}),t._v(" "),i("q-select",{ref:"annotationType",staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{options:t.annotationTypeOption,"option-value":"value","option-label":"label","emit-value":"","map-options":"",label:"標註方式",rules:[function(t){return!!t||"標註方式不能空白"}]},model:{value:t.info.annotationType,callback:function(e){t.$set(t.info,"annotationType",e)},expression:"info.annotationType"}}),t._v(" "),i("q-input",{staticClass:"col-12 q-pa-sm",attrs:{label:"新增標籤"},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.AddTag()}},scopedSlots:t._u([{key:"append",fn:function(){return[i("q-btn",{attrs:{round:"",dense:"",flat:"",icon:"add"},on:{click:function(e){return t.AddTag()}}})]},proxy:!0}]),model:{value:t.tagName,callback:function(e){t.tagName=e},expression:"tagName"}}),t._v(" "),i("div",{staticClass:"full-width"},t._l(t.info.tagArr,(function(e,a){return i("q-chip",{key:e,attrs:{removable:""},on:{remove:function(e){return t.RemoveTag(a)}}},[t._v(t._s(e))])})),1),t._v(" "),i("div",{staticClass:"full-width q-pa-md"},[i("div",{staticClass:"text-h6"},[t._v("表單欄位")]),t._v(" "),i("div",{staticClass:"text-subtitle2"},[t._v("使用者上傳影像時將被要求填寫此表單")]),t._v(" "),i("form-editor",{ref:"formEditor",attrs:{data:t.info.form},on:{update:function(e){return t.UpdateForm()}}})],1),t._v(" "),t.info.isPublic?t._e():i("div",{staticClass:"full-width q-pa-md"},[i("div",{staticClass:"text-h6"},[t._v("私密成員")]),t._v(" "),i("div",{staticClass:"text-subtitle2"},[t._v("不公開的資料集只有管理員跟私密成員能看到")]),t._v(" "),i("user-list",{ref:"memberList",attrs:{enableAdd:"",enableRemove:"",list:t.info.member},on:{add:t.AddMember,remove:t.RemoveMember}})],1),t._v(" "),i("div",{staticClass:"full-width q-pa-md"},[i("div",{staticClass:"text-h6"},[t._v("資料集版主")]),t._v(" "),i("div",{staticClass:"text-subtitle2"},[t._v("版主擁有修改此資料集的完整權限")]),t._v(" "),i("user-list",{ref:"masterList",attrs:{enableAdd:"",enableRemove:"",list:t.info.master},on:{add:t.AddMaster,remove:t.RemoveMaster}})],1),t._v(" "),i("q-select",{ref:"annotationType",staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{options:t.externalLinkOption,"option-value":"value","option-label":"label","emit-value":"","map-options":"",label:"外部連結"},model:{value:t.info.externalLink,callback:function(e){t.$set(t.info,"externalLink",e)},expression:"info.externalLink"}})],1)],1)],1),t._v(" "),i("q-card-actions",{attrs:{align:"right"}},[i("q-btn",{attrs:{flat:"",label:"儲存",color:"primary"},on:{click:function(e){return t.UpdateDataset()}}}),t._v(" "),i("q-btn",{attrs:{flat:"",label:"取消",color:"primary"},on:{click:function(e){return t.$emit("cancel")}}})],1)],1)};a._withStripped=!0;var n=i(22),s=i(29),r=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"form-editor q-pa-sm"},[i("div",{staticClass:"row items-center"},[i("div",{staticClass:"col-shrink q-pr-lg"},[i("q-btn",{staticClass:"bg-grey-8 text-white",attrs:{icon:"add",label:"新增欄位"},on:{click:function(e){return t.OpenAddItem()}}})],1)]),t._v(" "),i("q-list",{staticClass:"q-my-md",attrs:{bordered:""}},t._l(t.editData.itemArr,(function(e,a){return i("q-item",{key:e.id},[i("q-item-section",[i("div",["true"==e.canNotEmpty?i("span",{staticClass:"text-red"},[t._v("*")]):t._e(),t._v("\n\t\t\t\t\t"+t._s(e.quest)+"\n\t\t\t\t")])]),t._v(" "),i("q-item-section",{attrs:{side:""}},[i("div",{staticClass:"row"},[i("q-btn",{staticClass:"text-gray-8",attrs:{flat:"",dense:"",icon:"arrow_circle_up"},on:{click:function(e){return t.MoveItemUp(a)}}}),t._v(" "),i("q-btn",{staticClass:"text-gray-8",attrs:{flat:"",dense:"",icon:"arrow_circle_down"},on:{click:function(e){return t.MoveItemDown(a)}}}),t._v(" "),i("q-btn",{staticClass:"text-gray-8",attrs:{flat:"",dense:"",icon:"edit"},on:{click:function(e){return t.EditItem(a)}}}),t._v(" "),i("q-btn",{staticClass:"text-gray-8",attrs:{flat:"",dense:"",icon:"close"},on:{click:function(e){return t.RemoveItem(a)}}})],1)])],1)})),1),t._v(" "),i("q-dialog",{model:{value:t.openEditItem,callback:function(e){t.openEditItem=e},expression:"openEditItem"}},[i("q-card",{staticClass:"full-width"},[i("q-card-section",[t.editItem.id?i("div",{staticClass:"text-h6"},[t._v("新增欄位")]):i("div",{staticClass:"text-h6"},[t._v("編輯欄位")]),t._v(" "),i("div",{staticClass:"row"},[i("q-select",{ref:"type",staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{dense:"",options:t.typeOption,"option-value":"value","option-label":"label","emit-value":"","map-options":"",label:"填答類型",disable:null!=t.editItem.id,rules:[function(t){return!!t||"填答類型不能空白"}]},model:{value:t.editItem.type,callback:function(e){t.$set(t.editItem,"type",e)},expression:"editItem.type"}}),t._v(" "),i("q-toggle",{staticClass:"col-12 col-sm-6 q-pa-sm",attrs:{label:"必填欄位","true-value":"true","false-value":"false"},model:{value:t.editItem.canNotEmpty,callback:function(e){t.$set(t.editItem,"canNotEmpty",e)},expression:"editItem.canNotEmpty"}}),t._v(" "),i("q-input",{ref:"quest",staticClass:"col-12 q-pa-sm",attrs:{label:"欄位名稱",rules:[function(t){return!!t||"欄位名稱不能空白"}]},model:{value:t.editItem.quest,callback:function(e){t.$set(t.editItem,"quest",e)},expression:"editItem.quest"}}),t._v(" "),"radio"==t.editItem.type||"checkbox"==t.editItem.type?i("div",[i("q-input",{staticClass:"col-12 q-pa-sm",attrs:{label:"新增選項"},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.AddItemOption()}},scopedSlots:t._u([{key:"append",fn:function(){return[i("q-btn",{attrs:{round:"",dense:"",flat:"",icon:"add"},on:{click:function(e){return t.AddItemOption()}}})]},proxy:!0}],null,!1,876527129),model:{value:t.optionName,callback:function(e){t.optionName=e},expression:"optionName"}}),t._v(" "),i("div",{staticClass:"full-width"},t._l(t.editItem.option,(function(e,a){return i("q-chip",{key:e,attrs:{removable:""},on:{remove:function(e){return t.RemoveItemOption(a)}}},[t._v(t._s(e))])})),1)],1):t._e(),t._v(" "),"checkbox"==t.editItem.type?i("div",{staticClass:"col-12 row"},[i("q-input",{staticClass:"col q-ma-sm",attrs:{type:"number",label:"最少選幾項",min:0,max:t.editItem.option.length},model:{value:t.editItem.attr.minCheck,callback:function(e){t.$set(t.editItem.attr,"minCheck",t._n(e))},expression:"editItem.attr.minCheck"}}),t._v(" "),i("q-input",{staticClass:"col q-ma-sm",attrs:{type:"number",label:"最多選幾項",min:0,max:t.editItem.option.length},model:{value:t.editItem.attr.maxCheck,callback:function(e){t.$set(t.editItem.attr,"maxCheck",t._n(e))},expression:"editItem.attr.maxCheck"}})],1):t._e(),t._v(" "),"number"==t.editItem.type?i("div",{staticClass:"col-12 row"},[i("q-input",{staticClass:"col q-ma-sm",attrs:{type:"number",label:"最小數值"},model:{value:t.editItem.attr.minValue,callback:function(e){t.$set(t.editItem.attr,"minValue",t._n(e))},expression:"editItem.attr.minValue"}}),t._v(" "),i("q-input",{staticClass:"col q-ma-sm",attrs:{type:"number",label:"最大數值"},model:{value:t.editItem.attr.maxValue,callback:function(e){t.$set(t.editItem.attr,"maxValue",t._n(e))},expression:"editItem.attr.maxValue"}})],1):t._e()],1)]),t._v(" "),i("q-card-actions",{staticClass:"justify-center"},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){return t.ConfirmEdit()}}}),t._v(" "),i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{flat:"",label:"取消"}})],1)],1)],1)],1)};r._withStripped=!0;var o={name:"form-editor",props:{data:Object},components:{},data:function(){return{openEditItem:!1,editData:{},editItem:{},editIndex:-1,typeOption:[{label:"文字",value:"text"},{label:"單選",value:"radio"},{label:"多選",value:"checkbox"},{label:"數字",value:"number"}],optionName:""}},created:function(){this.editData=Object.assign({},this.data)},methods:{OpenAddItem:function(){this.openEditItem=!0,this.editItem={type:"text",canNotEmpty:"false",option:[],attr:{}}},AddItemOption:function(){this.editItem.option||Vue.set(this.editItem,"option",[]),this.editItem.option.includes(this.optionName)?alert("此選項已存在"):this.editItem.option.push(this.optionName),this.optionName=""},RemoveItemOption:function(t){this.editItem.option.splice(t,1)},MoveItemUp:function(t){if(!(t<=0)){var e=this.editData.itemArr[t-1];this.editData.itemArr[t-1]=this.editData.itemArr[t],this.editData.itemArr[t]=e,this.$forceUpdate(),this.$emit("update")}},MoveItemDown:function(t){if(!(t>=this.editData.itemArr.length-1)){var e=this.editData.itemArr[t+1];this.editData.itemArr[t+1]=this.editData.itemArr[t],this.editData.itemArr[t]=e,this.$forceUpdate(),this.$emit("update")}},EditItem:function(t){this.editIndex=t,this.editItem=Object.assign({},this.editData.itemArr[t]),this.editItem.attr||(this.editItem.attr={}),this.openEditItem=!0},RemoveItem:function(t){this.editData.itemArr.splice(t,1),this.$emit("update")},GenerateID:function(){return Math.random().toString(36).substring(2,15)},ConfirmEdit:function(){return this.$refs.type.validate(),this.$refs.type.hasError?this.$q.notify({color:"negative",message:"填答類型不能空白"}):(this.$refs.quest.validate(),this.$refs.quest.hasError?this.$q.notify({color:"negative",message:"欄位名稱不能空白"}):"radio"!=this.editItem.type&&"checkbox"!=this.editItem.type||0!=this.editItem.option.length?this.editItem.attr.minCheck&&(this.editItem.attr.minCheck<1||this.editItem.attr.minCheck>this.editItem.option.length)?this.$q.notify({color:"negative",message:"最少選幾項超出選項範圍"}):this.editItem.attr.maxCheck&&(this.editItem.attr.maxCheck<1||this.editItem.attr.maxCheck>this.editItem.option.length)?this.$q.notify({color:"negative",message:"最多選幾項超出選項範圍"}):this.editItem.attr.minCheck&&this.editItem.attr.maxCheck&&this.editItem.attr.minCheck>this.editItem.attr.maxCheck?this.$q.notify({color:"negative",message:"最少選幾項不能大於最多選幾項"}):this.editItem.attr.minValue&&this.editItem.attr.maxValue&&this.editItem.attr.minValue>this.editItem.attr.maxValue?this.$q.notify({color:"negative",message:"最小數值不能大於最大數值"}):(this.openEditItem=!1,this.editData.itemArr||(this.editData.itemArr=[]),this.editItem.id?(this.editData.itemArr[this.editIndex]=Object.assign({},this.editItem),this.editIndex=-1):(this.editItem.id=this.GenerateID(),this.editData.itemArr.push(this.editItem)),void this.$emit("update")):this.$q.notify({color:"negative",message:"請新增選項"}))}}},l=(i(52),i(0)),c=Object(l.a)(o,r,[],!1,null,null,null);c.options.__file="src/vue/form-editor.vue";var u=c.exports,d={name:"dataset-editor",props:{info:Object},components:{"image-upload":n.a,"user-list":s.a,"form-editor":u},data:function(){return{annotationTypeOption:[{label:"框選標註",value:"bbox"},{label:"整張標註",value:"image"}],externalLinkOption:[{label:"無",value:""},{label:"山河事件簿",value:"riverlog"},{label:"紫豹在哪裡",value:"purbao"}],tagName:"",uploadCover:!1}},created:function(){},methods:{ChangeCover:function(){if(!this.uploadCover){var t=this.$refs.uploader;t.OnSucc=function(t){if("ok"!=t.status)return alert("更新圖片失敗");this.uploadCover=!1,this.$emit("updateCover")}.bind(this),t.OnFail=function(t){switch(console.log(t),t){case"Request Entity Too Large":return alert("影像資料過大")}}.bind(this),t.OnChange=function(){this.uploadCover=!0,t.UploadImage()}.bind(this),t.url="/dataset/change-cover",t.additionData={dataset:this.info._id},t.SelectFile()}},UpdateDataset:function(){if(this.$refs.name.validate(),this.$refs.name.hasError)return this.$q.notify({color:"negative",message:"資料集名稱無效"});if(this.$refs.maxWidth.validate(),this.$refs.maxWidth.hasError)return this.$q.notify({color:"negative",message:"最大寬度無效"});if(this.$refs.maxHeight.validate(),this.$refs.maxHeight.hasError)return this.$q.notify({color:"negative",message:"最大高度無效"});if(this.$refs.annotationType.validate(),this.$refs.annotationType.hasError)return this.$q.notify({color:"negative",message:"標註方式無效"});if(0==this.info.tagArr.length)return this.$q.notify({color:"negative",message:"請至少新增一個標籤"});var t=$("meta[name='csrf-token']").attr("content"),e={};e.dataset=this.info._id,e.info=this.info,e._csrf=t,$.post("/dataset/update-dataset",e,function(t){if("ok"!=t.status)return alert("修改失敗");this.$q.notify("修改成功"),this.$emit("confirm")}.bind(this))},AddTag:function(){this.info.tagArr||Vue.set(this.info,"tagArr",[]),this.info.tagArr.includes(this.tagName)?alert("此標籤已存在"):this.info.tagArr.push(this.tagName),this.tagName=""},RemoveTag:function(t){this.info.tagArr.splice(t,1)},AddMember:function(t){0==this.info.member.filter((function(e){return e._id==t._id})).length?this.info.member.unshift(t):this.$q.notify("此使用者已是私密成員")},RemoveMember:function(t){this.info.member.splice(t,1)},AddMaster:function(t){0==this.info.master.filter((function(e){return e._id==t._id})).length?this.info.master.unshift(t):this.$q.notify("此使用者已是私密成員")},RemoveMaster:function(t){this.info.master.splice(t,1)},UpdateForm:function(){var t=this.$refs.formEditor.editData;this.info.form=Object.assign({},t)}}},h=(i(54),Object(l.a)(d,a,[],!1,null,null,null));h.options.__file="src/vue/dataset-editor.vue";e.a=h.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"annotator bg-grey-9"},[t.datasetSelect&&t.imageSelect&&t.taskSelect?i("div",{staticClass:"fit"},["image"==t.datasetSelect.annotationType?i("annotator-image",{ref:"annotatorImage",attrs:{dataset:t.datasetSelect,image:t.imageSelect,task:t.taskSelect},on:{setAnnotation:t.UploadAnnotation,setVerification:t.UploadVerification,skipTask:t.SkipTask}}):t._e(),t._v(" "),"bbox"==t.datasetSelect.annotationType?i("annotator-bbox",{ref:"annotatorBBox",attrs:{dataset:t.datasetSelect,image:t.imageSelect,task:t.taskSelect},on:{setAnnotation:t.UploadAnnotation,setVerification:t.UploadVerification,skipTask:t.SkipTask}}):t._e()],1):i("div",{staticClass:"fit row justify-center items-center"},[i("div",{staticClass:"text-h5 text-white"},[t._v(t._s(t.status))])]),t._v(" "),i("q-dialog",{model:{value:t.openDatasetSelect,callback:function(e){t.openDatasetSelect=e},expression:"openDatasetSelect"}},[i("dataset-select",{ref:"datasetSelect",attrs:{forAnnotation:""},on:{confirm:function(e){return t.ChangeDataset()},cancel:function(e){t.openDatasetSelect=!1}}})],1),t._v(" "),i("q-page-sticky",{attrs:{position:"top-left",offset:[18,18]}},[i("div",{staticClass:"column q-gutter-sm"},[i("q-btn",{staticClass:"bg-primary text-white",attrs:{flat:"",round:"",size:"md",icon:"help",disable:null==t.imageSelect},on:{click:function(e){return t.OpenHelp()}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("如何標註")])],1),t._v(" "),i("q-btn",{staticClass:"bg-primary text-white",attrs:{flat:"",round:"",size:"md",icon:"view_quilt",disable:null!=t.dataset},on:{click:function(e){t.openDatasetSelect=!0}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("選擇資料集")])],1)],1)])],1)};a._withStripped=!0;var n=i(8),s=i(24),r=i(23),o={name:"annotator",components:{"dataset-select":n.a,"annotator-image":s.a,"annotator-bbox":r.a},props:{user:Object,dataset:Object,image:Object,autoTask:Boolean},data:function(){return{datasetSelect:null,imageSelect:null,taskSelect:"",openDatasetSelect:!1,imageArr:[],status:"",verify:null}},mounted:function(){this.user||(window.location.href="/login?intentUrl="+encodeURIComponent(window.location.pathname+window.location.search)),this.datasetSelect=this.dataset,this.imageSelect=this.image,this.dataset?this.GenerateTask():(this.status="請選擇資料集",this.openDatasetSelect=!0)},methods:{ChangeDataset:function(){this.openDatasetSelect=!1,this.datasetSelect=this.$refs.datasetSelect.GetSelectDataset();var t="/dataset/list-image-for-annotation";t+="?dataset="+this.datasetSelect._id,$.get(t,function(t){if("ok"==t.status){for(var e=0;e<t.data.length;e++){var i=t.data[e];i.url="/static/upload/dataset/"+this.datasetSelect._id+"/image/"+i._id+".jpg"}this.imageArr=t.data,this.GenerateTask()}}.bind(this))},GenerateTask:function(){if(this.imageSelect=null,this.datasetSelect){if(this.image){if(this.image.annotation)if(this.image.verification.filter(function(t){return t.user==this.user._id}.bind(this)).length>0)return void(this.status="您已驗證過此影像，感謝您的協助");this.imageSelect=this.image}else{if(0==this.imageArr.length)return void(this.status="此資料集影像皆已標註完成");for(var t=[],e=0;e<this.imageArr.length;e++){var i=this.imageArr[e];if(i.annotation)0==i.verification.filter(function(t){return t.user==this.user._id}.bind(this)).length&&t.push(i);else t.push(i)}if(0==t.length)return void(this.status="您已驗證過此資料集所有資料，感謝您的協助");var a=function(){if(0==t.length)return null;var e=Math.floor(Math.random()*t.length);return t[e]}.bind(this);this.imageSelect=a()}var n=function(){this.imageSelect.annotation?this.imageSelect.verifyNum<this.verify.sample?this.taskSelect="verify":this.imageSelect.agreeNum<this.imageSelect.verifyNum*this.verify.reject?this.taskSelect="annotate":this.taskSelect="verify":this.taskSelect="annotate"}.bind(this);this.verify?n():$.get("/dataset/verify-condition",function(t){if("ok"!=t.status)return alert("讀取驗證條件失敗");this.verify=t.data,n()}.bind(this))}else this.status="請選擇資料集"},GetAnnotator:function(){if(!this.datasetSelect)return null;var t=null;switch(this.datasetSelect.annotationType){case"image":t=this.$refs.annotatorImage;break;case"bbox":t=this.$refs.annotatorBBox}return t},UploadAnnotation:function(){var t=this.GetAnnotator();if(t){var e=$("meta[name='csrf-token']").attr("content"),i={};i.dataset=t.dataset._id,i.image=t.image._id,i.annotation=t.GetAnnotation(),i._csrf=e,$.post("/dataset/set-annotation",i,function(t){if("ok"!=t.status)switch(t.message){case"blacklist":return alert("黑名單使用者無此權限");default:return alert("標註失敗")}this.imageSelect.annotation={user:this.user._id,annotation:i.annotation},this.$q.notify("標註成功"),this.autoTask?this.GenerateTask():this.$emit("done")}.bind(this))}},UploadVerification:function(t){var e=this.GetAnnotator();if(e){var i=$("meta[name='csrf-token']").attr("content"),a={};a.dataset=e.dataset._id,a.image=e.image._id,a.agree=t?"1":"0",a._csrf=i,$.post("/dataset/add-verification",a,function(t){if("ok"!=t.status)switch(t.message){case"verification duplicate":this.$q.notify("您之前已驗證過這個標註");break;case"blacklist":alert("黑名單使用者無此權限");break;default:alert("驗證失敗")}else this.$q.notify("驗證成功");this.imageSelect.verification.push({user:this.user._id,agree:a.agree}),this.autoTask?this.GenerateTask():this.$emit("done")}.bind(this))}},OpenHelp:function(){var t=this.GetAnnotator();t&&(t.openHelp=!0)},SkipTask:function(){this.autoTask?this.GenerateTask():this.$emit("skip")}}},l=(i(68),i(0)),c=Object(l.a)(o,a,[],!1,null,null,null);c.options.__file="src/vue/annotator.vue";e.a=c.exports},function(t,e,i){"use strict";var a=i(5);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".dataset-select{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(6);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".location-select{width:100%}.location-select .map{width:100%;height:300px}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"image-info-filter q-pa-sm"},[t.disableTag?t._e():i("div",[i("div",{staticClass:"text-h6"},[t._v("標籤篩選")]),t._v(" "),i("div",{staticClass:"row items-center"},[i("q-checkbox",{staticClass:"text-bold",attrs:{label:"全選"},on:{input:function(e){return t.ToggleTagSelectAll()}},model:{value:t.filter.selectAll,callback:function(e){t.$set(t.filter,"selectAll",e)},expression:"filter.selectAll"}}),t._v(" "),t._l(t.filter.tag,(function(e){return i("q-checkbox",{key:e.name,attrs:{label:e.name},on:{input:function(e){return t.UpdateFilterResult()}},model:{value:e.value,callback:function(i){t.$set(e,"value",i)},expression:"tag.value"}})}))],2),t._v(" "),i("q-separator",{staticClass:"q-my-sm"})],1),t._v(" "),t.disableTime?t._e():i("div",[i("div",{staticClass:"text-h6 q-mb-lg"},[t._v("時間篩選")]),t._v(" "),i("div",{staticClass:"q-px-md"},[i("q-range",{attrs:{min:t.filter.timeLimit.rangeMin,max:t.filter.timeLimit.rangeMax,step:1,"left-label-value":t.minTimeLabel,"right-label-value":t.maxTimeLabel,"left-label-color":"grey-8","right-label-color":"grey-8","label-always":""},on:{change:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.time,callback:function(e){t.$set(t.filter,"time",e)},expression:"filter.time"}})],1),t._v(" "),i("q-separator",{staticClass:"q-my-sm"})],1),t._v(" "),t.disableLocation?t._e():i("div",[i("div",{staticClass:"row items-center"},[i("div",{staticClass:"text-h6"},[t._v("地點篩選")]),t._v(" "),i("q-btn",{staticClass:"bg-grey-8 text-white q-ma-sm",attrs:{label:"選擇範圍"},on:{click:function(e){return t.OpenRangeSelect()}}})],1),t._v(" "),i("div",{staticClass:"row text-subtitle2 q-gutter-xs"},[i("div",[t._v(t._s(t.filter.loc.enable?"已啟用":"未啟用"))]),t._v(" "),t.filter.loc.enable&&t.filter.loc.lat&&t.filter.loc.lng?i("div",[t._v("中心點: ("+t._s(t.filter.loc.lat.toFixed(5)+" "+t.filter.loc.lng.toFixed(5))+")")]):t._e(),t._v(" "),t.filter.loc.enable&&t.filter.loc.range?i("div",[t._v("範圍:"+t._s(t.filter.loc.range+"公里"))]):t._e()]),t._v(" "),i("q-separator",{staticClass:"q-my-sm"})],1),t._v(" "),!t.disableForm&&t.dataset&&t.dataset.form?i("div",[i("div",{staticClass:"text-h6"},[t._v("表單篩選")]),t._v(" "),t.dataset.form?i("div",t._l(t.dataset.form.itemArr,(function(e,a){return i("div",[i("div",{staticClass:"text-subtitle2"},[i("q-checkbox",{key:e.quest,attrs:{label:a+1+"."+e.quest},on:{input:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.form[e.id].use,callback:function(i){t.$set(t.filter.form[e.id],"use",i)},expression:"filter.form[item.id].use"}})],1),t._v(" "),t.filter.form[e.id].use?i("div",{staticClass:"q-mx-md"},["text"==e.type?i("div",[i("q-input",{ref:e.id,refInFor:!0,attrs:{dense:"",placeholder:"請輸入篩選文字"},on:{blur:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.form[e.id].value,callback:function(i){t.$set(t.filter.form[e.id],"value",i)},expression:"filter.form[item.id].value"}})],1):t._e(),t._v(" "),"radio"==e.type?i("div",t._l(e.option,(function(a,n){return i("q-radio",{key:a,attrs:{label:a,val:a},on:{input:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.form[e.id].value,callback:function(i){t.$set(t.filter.form[e.id],"value",i)},expression:"filter.form[item.id].value"}})})),1):t._e(),t._v(" "),"checkbox"==e.type?i("div",t._l(e.option,(function(a,n){return i("q-checkbox",{key:a,attrs:{label:a,val:a},on:{input:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.form[e.id].value,callback:function(i){t.$set(t.filter.form[e.id],"value",i)},expression:"filter.form[item.id].value"}})})),1):t._e(),t._v(" "),"number"==e.type?i("div",[i("div",{staticClass:"q-mt-lg q-mx-md"},[i("q-range",{attrs:{min:t.filter.form[e.id].minValue,max:t.filter.form[e.id].maxValue,step:1,"label-always":""},on:{change:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.form[e.id].value,callback:function(i){t.$set(t.filter.form[e.id],"value",i)},expression:"filter.form[item.id].value"}})],1)]):t._e()]):t._e()])})),0):t._e(),t._v(" "),i("q-separator",{staticClass:"q-my-sm"})],1):t._e(),t._v(" "),t.disableRemark?t._e():i("div",[i("div",{staticClass:"text-h6"},[t._v("備註篩選")]),t._v(" "),i("q-input",{staticClass:"q-ma-sm",attrs:{dense:""},on:{blur:function(e){return t.UpdateFilterResult()}},model:{value:t.filter.remark,callback:function(e){t.$set(t.filter,"remark",e)},expression:"filter.remark"}}),t._v(" "),i("q-separator",{staticClass:"q-my-sm"})],1),t._v(" "),t.imageArr&&t.filterArr?i("div",{staticClass:"row justify-center q-gutter-sm text-red"},[i("div",[t._v("原始資料 "+t._s(t.imageArr.length)+" 筆")]),t._v(" "),i("div",[t._v("篩選後 "+t._s(t.filterArr.length)+" 筆")])]):t._e(),t._v(" "),i("q-dialog",{model:{value:t.openRangeSelect,callback:function(e){t.openRangeSelect=e},expression:"openRangeSelect"}},[i("q-card",{staticClass:"full-width q-pa-sm"},[i("div",{staticClass:"text-h6"},[t._v("選擇範圍")]),t._v(" "),i("q-toggle",{attrs:{"left-label":"",label:"啟用範圍篩選"},on:{input:function(e){return t.UpdateRangeSelectMap()}},model:{value:t.filter.loc.enable,callback:function(e){t.$set(t.filter.loc,"enable",e)},expression:"filter.loc.enable"}}),t._v(" "),i("div",{staticClass:"text-subtitle2"},[t._v("\n\t\t\t\t半徑(公里)\n\t\t\t\t"),i("q-slider",{attrs:{label:"",min:10,max:400},on:{change:function(e){return t.UpdateRangeSelectMap()}},model:{value:t.filter.loc.range,callback:function(e){t.$set(t.filter.loc,"range",e)},expression:"filter.loc.range"}})],1),t._v(" "),i("location-select",{ref:"locationSelect",attrs:{mode:"selectRange"},on:{change:function(e){return t.UpdateLoc()}}}),t._v(" "),t.$refs.locationSelect?i("div",{staticClass:"text-center"},[t._v(t._s(t.$refs.locationSelect.status))]):t._e(),t._v(" "),i("q-card-actions",{attrs:{align:"center"}},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){t.openRangeSelect=!1,t.UpdateFilterResult()}}})],1)],1)],1)],1)};a._withStripped=!0;var n=i(7),s={name:"image-info-filter",props:{disableTag:Boolean,disableTime:Boolean,disableLocation:Boolean,disableRemark:Boolean,disableForm:Boolean,initFilter:Object},components:{"location-select":n.a},data:function(){return{dataset:null,imageArr:null,filter:{selectAll:!0,tag:[],time:{min:null,max:null},loc:{enable:!1,lat:null,lng:null,range:50},remark:"",timeLimit:{min:null,max:null,rangeMin:0,rangeMax:0},form:{}},openRangeSelect:!1,rangeTarget:null,filterArr:[]}},mounted:function(){this.initFilter&&(this.filter=Object.assign({},this.initFilter)),Vue.nextTick(function(){this.UpdateRangeSelectMap()}.bind(this))},methods:{SetData:function(t,e){this.dataset=t,this.imageArr=e,this.initFilter||(this.InitTimeSelect(),this.InitTagSelect(),this.InitFormSelect()),Vue.nextTick(function(){this.UpdateFilterResult()}.bind(this))},InitTimeSelect:function(){if(!this.disableTime){for(var t=spacetime.now(),e=0;e<this.imageArr.length;e++){var i=spacetime(this.imageArr[e].dataTime).goto(t.timezone().name);this.filter.timeLimit.min&&!this.filter.timeLimit.min.isAfter(i)||(this.filter.timeLimit.min=i.clone().last("day")),this.filter.timeLimit.max&&!this.filter.timeLimit.max.isBefore(i)||(this.filter.timeLimit.max=i.clone().next("day"))}this.filter.timeLimit.min&&this.filter.timeLimit.max&&(this.filter.timeLimit.rangeMin=0,this.filter.timeLimit.rangeMax=this.filter.timeLimit.min.diff(this.filter.timeLimit.max,"day")+1,this.filter.time.min=this.filter.timeLimit.rangeMin,this.filter.time.max=this.filter.timeLimit.rangeMax)}},InitTagSelect:function(){if(!this.disableTag&&this.dataset){this.filter.tag=[],this.filter.tag.push({name:"未標註",value:!0});for(var t=0;t<this.dataset.tagArr.length;t++){var e=this.dataset.tagArr[t];this.filter.tag.push({name:e,value:!0})}}},InitFormSelect:function(){if(this.dataset.form){for(var t={},e=0;e<this.dataset.form.itemArr.length;e++){var i=this.dataset.form.itemArr[e],a={id:i.id,use:!1};if("checkbox"==i.type&&(a.value=[]),"number"==i.type){for(var n=Number.MAX_VALUE,s=Number.MIN_VALUE,r=0;r<this.imageArr.length;r++)if(this.imageArr[r].formReply){var o=this.imageArr[r].formReply[i.id];if(o){var l=parseFloat(o.value);l>s&&(s=l),l<n&&(n=l)}}a.minValue=n,a.maxValue=s}t[i.id]=a}this.filter.form=t}},ToggleTagSelectAll:function(){if(!this.disableTag){for(var t=0;t<this.filter.tag.length;t++){this.filter.tag[t].value=this.filter.selectAll}this.UpdateFilterResult()}},OpenRangeSelect:function(){this.openRangeSelect=!0,Vue.nextTick(function(){this.$refs.locationSelect.range=this.filter.loc.range,this.UpdateRangeSelectMap()}.bind(this))},UpdateRangeSelectMap:function(){if(!this.disableLocation){var t=this.$refs.locationSelect;t&&(t.range=this.filter.loc.range,this.filter.loc.enable?(this.filter.loc.lat&&this.filter.loc.lng||t.GetGPS(),t.SetRange(this.filter.loc.lat,this.filter.loc.lng,this.filter.loc.range)):t.RemoveMarker(),this.UpdateFilterResult())}},UpdateLoc(){if(!this.disableLocation){this.filter.loc.enable=!0;var t=this.$refs.locationSelect.loc;this.filter.loc.lat=t.lat,this.filter.loc.lng=t.lng,this.UpdateFilterResult()}},UpdateFilterResult:function(){if(this.imageArr){var t=this.imageArr;if(!this.disableTag){for(var e={},i=0;i<this.filter.tag.length;i++){var a=this.filter.tag[i];e[a.name]=a.value}t=t.filter(function(t){if(!t.annotation)return e["未標註"];switch(this.dataset.annotationType){case"image":for(var i=t.annotation.annotation,a=0;a<i.length;a++){var n=i[a];if(e[n.name]&&"true"==n.value)return!0}break;case"bbox":var s=t.annotation.annotation;for(a=0;a<s.length;a++){n=s[a].tag;if(e[n])return!0}}return!1}.bind(this))}if(!this.disableTime){var n=spacetime.now();t=t.filter(function(t){var e=spacetime(t.dataTime).goto(n.timezone().name),i=this.filter.timeLimit.min.add(this.filter.time.min,"day"),a=this.filter.timeLimit.min.add(this.filter.time.max,"day");return e.isAfter(i)&&e.isBefore(a)}.bind(this))}this.disableLocation||this.filter.loc.enable&&(t=t.filter(function(t){var e=this.filter.loc,i=e.range/111,a=t.lat-e.lat,n=t.lng-e.lng;return a*a+n*n<=i*i}.bind(this))),this.disableForm||(t=t.filter(function(t){if(!this.dataset.form)return!0;for(var e=0;e<this.dataset.form.itemArr.length;e++){var i=this.dataset.form.itemArr[e],a=this.filter.form[i.id];if(a.use){if(!t.formReply||!t.formReply[i.id])return!1;var n=t.formReply[i.id].value;switch(i.type){case"text":if(!a.value)continue;if(-1==a.value.indexOf(n))return!1;break;case"radio":if(a.value!=n)return!1;break;case"checkbox":for(var s=!1,r=0;r<a.value.length;r++)if(n.includes(a.value[r])){s=!0;break}if(!s)return!1;break;case"number":if(!a.value)continue;if(a.value.min>n)return!1;if(a.value.max<n)return!1}}}return!0}.bind(this))),this.disableRemark||(t=t.filter(function(t){return""==this.filter.remark||!!t.remark&&-1!=t.remark.indexOf(this.filter.remark)}.bind(this))),this.filterArr=t,this.$emit("update")}}},computed:{minTimeLabel:function(){return this.disableTime?"":this.filter.timeLimit.min?this.filter.timeLimit.min.add(this.filter.time.min,"day").unixFmt("yyyy-MM-dd"):""},maxTimeLabel:function(){return this.disableTime?"":this.filter.timeLimit.min?this.filter.timeLimit.min.add(this.filter.time.max,"day").unixFmt("yyyy-MM-dd"):""}}},r=(i(97),i(0)),o=Object(r.a)(s,a,[],!1,null,null,null);o.options.__file="src/vue/image-info-filter.vue";e.a=o.exports},function(t,e,i){"use strict";var a=i(9);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".image-upload{width:100%;height:100%}.image-upload img{width:100%;height:100%;object-fit:cover}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(10);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".user-select{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(11);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".user-list{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(12);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".form-editor{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(13);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".dataset-editor{width:100%}.dataset-editor .cover-container{width:320px;height:240px;position:relative}.dataset-editor .cover-container .change-bt{position:absolute;bottom:0px;left:0px;width:100%;background-color:rgba(0,0,0,0.5);color:#ffffff}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(14);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".form-reply{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(15);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".image-info{width:100%;height:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(16);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".tag-select{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(17);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".annotator-image{width:100%;height:100%}.annotator-image .image{margin:auto;max-width:800px;max-height:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(18);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".tag-select{width:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(19);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".annotator-bbox{width:100%;height:100%;position:relative}.annotator-bbox .tool-set{position:absolute;display:inline-block;bottom:10px;left:10px}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(20);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".annotator{width:100%;height:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"camera-capture bg-grey-8"},[i("div",{directives:[{name:"show",rawName:"v-show",value:t.stepArr[t.step]&&"capture"==t.stepArr[t.step].id,expression:"stepArr[step] && stepArr[step].id == 'capture' "}],staticClass:"full-width"},[i("camera-capture",{ref:"cam"}),t._v(" "),i("q-page-sticky",{attrs:{position:"bottom",offset:[18,18]}},[i("q-btn",{staticClass:"bg-white text-grey-8",attrs:{round:"",push:"",disable:"ok"!=t.camStatus,size:"lg",icon:"camera_alt"},on:{click:function(e){return t.CaptureCameraImage()}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("拍照上傳")])],1)],1),t._v(" "),i("q-page-sticky",{attrs:{position:"bottom-right",offset:[18,18]}},[i("div",{staticClass:"column q-gutter-sm"},[i("q-btn",{staticClass:"bg-primary text-white",attrs:{flat:"",round:"",size:"md",icon:"flip_camera_ios"},on:{click:function(e){return t.ChangeCamera()}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("切換相機")])],1),t._v(" "),i("q-btn",{staticClass:"bg-primary text-white",attrs:{flat:"",round:"",size:"md",icon:"folder"},on:{click:function(e){return t.SelectFile()}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("檔案上傳")])],1)],1)])],1),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.stepArr[t.step]&&"crop"==t.stepArr[t.step].id,expression:"stepArr[step] && stepArr[step].id == 'crop' "}],staticClass:"full-width"},[i("image-edit",{ref:"imageEdit",on:{confirm:function(e){return t.NextStep()},cancel:function(e){return t.PrevStep()}}})],1),t._v(" "),i("q-dialog",{model:{value:t.stepArr[t.step]&&"dataset"==t.stepArr[t.step].id,callback:function(e){t.$set(t.stepArr[t.step]&&t.stepArr[t.step],"id == 'dataset'",e)},expression:"stepArr[step] && stepArr[step].id == 'dataset'"}},[i("dataset-select",{ref:"datasetSelect",attrs:{forUpload:""},on:{change:function(e){return t.DatasetChange()},confirm:function(e){return t.NextStep()},cancel:function(e){return t.PrevStep()}}})],1),t._v(" "),i("q-dialog",{model:{value:t.stepArr[t.step]&&"info"==t.stepArr[t.step].id,callback:function(e){t.$set(t.stepArr[t.step]&&t.stepArr[t.step],"id == 'info'",e)},expression:"stepArr[step] && stepArr[step].id == 'info'"}},[i("image-info",{ref:"imageInfo",attrs:{dataset:t.datasetSelect,initLat:t.initLoc.lat,initLng:t.initLoc.lng,initDataTime:t.initDataTime},on:{confirm:function(e){t.UpdateImageInfo(),t.NextStep()},cancel:function(e){return t.PrevStep()}}})],1),t._v(" "),i("image-upload",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"uploader",on:{loading:function(e){return t.$q.loading.show()}}}),t._v(" "),t.stepArr[t.step]?i("q-page-sticky",{attrs:{position:"bottom-left",offset:[9,9]}},[i("q-badge",{attrs:{color:"secondary q-pa-sm"}},[t._v("\n\t\t\t"+t._s(t.stepArr[t.step].name+" ("+(t.step+1)+"/"+t.stepArr.length+")")+"\n\t\t")])],1):t._e()],1)};a._withStripped=!0;var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"camera-capture bg-grey-9"},[i("video",{ref:"video",attrs:{autoplay:"",playsinline:"",muted:""},domProps:{muted:!0,srcObject:t.camStream}}),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:"ok"!=t.camStatus,expression:"camStatus !='ok' "}],staticClass:"fixed-center text-white text-h5"},[t._v(t._s(t.camStatus))]),t._v(" "),i("q-dialog",{model:{value:t.openCameraSelect,callback:function(e){t.openCameraSelect=e},expression:"openCameraSelect"}},[i("q-card",{staticClass:"full-width"},[i("div",{staticClass:"text-h6 q-pa-md"},[t._v("選擇相機")]),t._v(" "),t.lastCamera?i("div",{staticClass:"q-px-md"},[i("div",{staticClass:"text-subtitle2"},[t._v("上次使用")]),t._v(" "),i("q-item",{attrs:{clickable:""},on:{click:function(e){return t.SelectCamera(t.lastCamera)}}},[t._v(t._s(t.lastCamera.name))])],1):t._e(),t._v(" "),i("q-list",{attrs:{bordered:"",separator:""}},t._l(t.cameraList,(function(e){return i("q-item",{key:e.id,attrs:{clickable:""},on:{click:function(i){return t.SelectCamera(e)}}},[t._v(t._s(e.name))])})),1)],1)],1)],1)};n._withStripped=!0;var s={name:"camera-capture",props:{},data:function(){return{selectCamerea:null,cameraList:[],camStatus:"無相機",camStream:null,openCameraSelect:!1,OnCamSelect:null,OnCamStart:null,OnCamCapture:null,imageData:null}},created:function(){this.GetLastCamera()},beforeDestroy:function(){this.StopCamera()},methods:{GetLastCamera:function(){window.localStorage;this.lastCamera=JSON.parse(localStorage.getItem("lastCamera"))},SetLastCamera:function(t){window.localStorage;localStorage.setItem("lastCamera",JSON.stringify(t))},OpenCameraSelect:function(){navigator.mediaDevices?navigator.mediaDevices.enumerateDevices().then(function(t){this.cameraList=[];for(var e=0;e<t.length;e++){var i=t[e],a=i.label;""==a&&(a="相機"+(this.cameraList.length+1)),"videoinput"===i.kind&&this.cameraList.push({id:i.deviceId,name:a})}this.cameraList.length>0&&(this.selectCamera=this.cameraList[0].id),this.openCameraSelect=!0}.bind(this)):this.camStatus="無法讀取裝置列表，請開啟權限或使用右下角的檔案上傳功能"},SelectCamera(t){this.SetLastCamera(t),this.selectCamera=t.id,this.StartCamera(),this.OnCamSelect&&this.OnCamSelect()},StartCamera:function(){this.camStatus="無相機";var t={video:{}};this.selectCamera?t.video.deviceId={exact:this.selectCamera}:t.video.facingMode="environment",navigator.getUserMedia?navigator.getUserMedia(t,function(t){this.camStream=t,this.camStatus="ok",this.OnCamStart&&this.OnCamStart()}.bind(this),function(t){this.camStatus="讀取相機失敗"}.bind(this)):this.camStatus="瀏覽器不支援相機",this.openCameraSelect=!1},StopCamera:function(){this.camStream&&(this.camStream.getTracks()[0].stop(),this.camStream=null)},CaptureImage:function(){var t=this.$refs.video,e=document.createElement("canvas");e.width=t.videoWidth,e.height=t.videoHeight;var i=e.getContext("2d");i.save(),i.drawImage(t,0,0),i.restore(),this.imageData=e.toDataURL("image/jpeg",.9),this.OnCamCapture&&this.OnCamCapture()}}},r=(i(87),i(0)),o=Object(r.a)(s,n,[],!1,null,null,null);o.options.__file="src/vue/camera-capture.vue";var l=o.exports,c=i(22),u=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"image-edit bg-grey-9"},[i("img",{ref:"image",attrs:{src:t.imageData}}),t._v(" "),i("q-page-sticky",{attrs:{position:"top",offset:[9,9]}},[i("q-btn",{attrs:{dense:"",color:"primary",icon:"rotate_left"},on:{click:function(e){return t.cropper.rotate(-90)}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("逆時針旋轉90°")])],1),t._v(" "),i("q-btn",{attrs:{dense:"",color:"primary",icon:"rotate_right"},on:{click:function(e){return t.cropper.rotate(90)}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("順時針旋轉90°")])],1),t._v(" "),i("q-btn",{directives:[{name:"show",rawName:"v-show",value:"move"==t.mode,expression:"mode=='move' "}],attrs:{dense:"",color:"primary",icon:"crop"},on:{click:function(e){return t.ChangeMode("crop")}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("框選裁切")])],1),t._v(" "),i("q-btn",{directives:[{name:"show",rawName:"v-show",value:"crop"==t.mode,expression:"mode=='crop' "}],attrs:{dense:"",color:"primary",icon:"gamepad"},on:{click:function(e){return t.ChangeMode("move")}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("移動影像")])],1),t._v(" "),i("q-btn",{attrs:{dense:"",color:"primary",icon:"clear"},on:{click:function(e){return t.ClearEdit()}}},[i("q-tooltip",{attrs:{"content-class":"bg-primary"}},[t._v("重設影像")])],1)],1),t._v(" "),i("q-page-sticky",{attrs:{position:"bottom",offset:[9,9]}},[i("q-btn",{attrs:{color:"primary",label:"確定"},on:{click:function(e){return t.ConfirmEdit()}}}),t._v(" "),i("q-btn",{attrs:{color:"primary",label:"取消"},on:{click:function(e){return t.CancelEdit()}}})],1)],1)};u._withStripped=!0;var d={name:"image-edit",props:{maxResW:{type:Number,default:1024},maxResH:{type:Number,default:1024}},data:function(){return{imageData:null,cropper:null,mode:"move"}},mounted:function(){},methods:{SetImage:function(t){this.cropper&&this.cropper.destroy();var e=this.$refs.image;e.onload=function(){this.cropper=new Cropper(e,{viewMode:2,dragMode:this.mode,autoCrop:!1})}.bind(this),this.imageData=t},ChangeMode:function(t){this.mode=t,this.cropper.setDragMode(t)},ClearEdit:function(){confirm("確定清除所有編輯動作?")&&(this.cropper.clear(),this.cropper.reset())},GetCanvasData:function(){return this.cropper.getCroppedCanvas()},ConfirmEdit:function(){this.$emit("confirm")},CancelEdit:function(){this.$emit("cancel")}}},h=(i(89),Object(r.a)(d,u,[],!1,null,null,null));h.options.__file="src/vue/image-edit.vue";var f=h.exports,m=i(8),p=i(27),v={name:"uploader",components:{"camera-capture":l,"image-upload":c.a,"image-edit":f,"dataset-select":m.a,"image-info":p.a},props:{user:Object,dataset:Object},data:function(){return{camStatus:"",stepArr:[],step:0,datasetSelect:null,imageInfo:null,initLoc:{},initDataTime:null}},mounted:function(){this.user||(window.location.href="/login?intentUrl="+encodeURIComponent(window.location.pathname+window.location.search)),this.stepArr=[],this.stepArr.push({id:"capture",name:"拍照選檔"}),this.stepArr.push({id:"crop",name:"旋轉裁切"}),this.dataset?this.datasetSelect=this.dataset:this.stepArr.push({id:"dataset",name:"選擇資料集"}),this.stepArr.push({id:"info",name:"影像資訊"}),this.ChangeCamera()},methods:{ChangeCamera:function(){var t=this.$refs.cam;t.OnCamStart=function(){this.camStatus=t.camStatus}.bind(this),t.OpenCameraSelect()},CaptureCameraImage:function(){var t=this.$refs.cam;t.OnCamCapture=function(){this.$refs.imageEdit.SetImage(t.imageData),this.NextStep()}.bind(this),t.CaptureImage()},SelectFile:function(){var t=this.$refs.uploader;t.OnChange=function(){this.initLoc={lat:t.exif.lat,lng:t.exif.lng},this.initDataTime=t.exif.time,this.$refs.imageEdit.SetImage(t.imageData),this.$q.loading.hide(),this.NextStep()}.bind(this),t.OnFail=function(t){this.$q.notify("無法讀取檔案"),this.$q.loading.hide()}.bind(this),t.SelectFile()},NextStep:function(){this.step++,this.step>=this.stepArr.length&&this.UploadImageToDataset()},PrevStep:function(){this.step--,this.step<0&&(this.step=0)},DatasetChange:function(){this.dataset||(this.datasetSelect=this.$refs.datasetSelect.GetSelectDataset(),this.$refs.uploader.SetMaxRes(this.datasetSelect.maxWidth,this.datasetSelect.maxHeight))},UpdateImageInfo:function(){this.imageInfo=this.$refs.imageInfo.GetImageInfo()},UploadImageToDataset:function(){var t,e,i,a,n=this.dataset||this.datasetSelect;this.imageInfo&&(t=this.imageInfo.loc,e=this.imageInfo.remark,i=this.imageInfo.dataTime,a=this.imageInfo.formReply);var s=this.$refs.uploader;s.OnSucc=function(t){if("ok"!=t.status)switch(t.message){case"blacklist":return alert("黑名單使用者無此權限");default:return alert("上傳圖片失敗")}this.step=0,this.$q.notify("已將影像上傳至"+n.name),this.$emit("uploaded")}.bind(this),s.OnFail=function(t){switch(console.log(t),t){case"Request Entity Too Large":return alert("影像資料過大")}}.bind(this),s.url="/dataset/upload-image";var r={};r.dataset=n._id,t&&(r.lat=t.lat,r.lng=t.lng),e&&""!=e&&(r.remark=e),i&&(r.dataTime=i),a&&(r.formReply=JSON.stringify(a)),s.additionData=r;var o=this.$refs.imageEdit.GetCanvasData();s.FitCanvasFromCanvas(o),s.UploadImage()}}},g=(i(91),Object(r.a)(v,a,[],!1,null,null,null));g.options.__file="src/vue/uploader.vue";e.a=g.exports},function(t,e,i){"use strict";var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return t.dataset&&t.image?i("div",{staticClass:"image-control"},[i("q-card",{staticClass:"full-width",attrs:{flat:""}},[i("div",{staticStyle:{height:"60vh"}},[i("annotator-view",{attrs:{dataset:t.dataset,image:t.image}})],1),t._v(" "),i("q-card-section",[t.image.time?i("q-chip",{staticClass:"transparent",attrs:{dense:"",icon:"access_time"}},[t._v(t._s(t.image.time))]):t._e(),t._v(" "),t.image.lat&&t.image.lng?i("q-chip",{staticClass:"transparent",attrs:{dense:"",clickable:"",icon:"room"},on:{click:function(e){return t.ViewLocation()}}},[t._v("觀看地點")]):t._e(),t._v(" "),t.image.annotation?i("q-chip",{staticClass:"transparent",attrs:{dense:""}},[t._v(t._s("認同數 / 驗證數 : "+t.AgreeVerifyRatio))]):t._e(),t._v(" "),i("div",{staticClass:"row"},[t.uploader?i("div",{staticClass:"q-pa-sm",on:{click:function(e){return t.OpenUserInfo(t.uploader)}}},[t._v("上傳者:\n\t\t\t\t\t"),i("span",{staticClass:"cursor-pointer text-blue-10"},[t._v(t._s(t.uploader.name))])]):t._e(),t._v(" "),t.annotator?i("div",{staticClass:"q-pa-sm",on:{click:function(e){return t.OpenUserInfo(t.annotator)}}},[t._v("標註者:\n\t\t\t\t\t"),i("span",{staticClass:"cursor-pointer  text-blue-10"},[t._v(t._s(t.annotator.name))])]):t._e()]),t._v(" "),t.image.remark&&""!=t.image.remark?i("div",{staticClass:"q-mx-sm q-my-none",staticStyle:{"white-space":"pre-line","word-wrap":"break-word"}},[t._v(t._s(t.image.remark))]):t._e(),t._v(" "),t.dataset.form&&t.image.formReply?i("div",{staticClass:"form-area"},[i("div",{staticClass:"text-subtitle1"},[t._v("表單資料")]),t._v(" "),t._l(t.dataset.form.itemArr,(function(e,a){return i("div",{staticClass:"row q-gutter-sm"},[i("div",[t._v(t._s(a+1)+". "+t._s(e.quest))]),t._v(" "),t.image.formReply[e.id]?i("div",[t._v("\n\t\t\t\t\t\t"+t._s("checkbox"==e.type?t.image.formReply[e.id].value.join(", "):t.image.formReply[e.id].value)+"\n\t\t\t\t\t")]):t._e()])}))],2):t._e()],1),t._v(" "),i("q-card-actions",[t.editable?i("div",[t.dataset&&t.dataset.enableAnnotation?i("q-btn",{attrs:{flat:"",label:t.image.annotation?"協助驗證":"協助標註"},on:{click:function(e){return t.AnnotateImage()}}}):t._e(),t._v(" "),i("q-btn",{attrs:{flat:"",label:"影像網址"},on:{click:function(e){return t.GoToImageUrl()}}}),t._v(" "),i("q-btn",{attrs:{flat:"",label:"下載影像"},on:{click:function(e){return t.DownloadImage()}}}),t._v(" "),t.CheckAnnotationDelete?i("q-btn",{attrs:{flat:"",label:"刪除標註"},on:{click:function(e){return t.DeleteAnnotation()}}}):t._e(),t._v(" "),t.CheckEditAuth?i("q-btn",{attrs:{flat:"",label:"編輯資訊"},on:{click:function(e){return t.OpenInfoEditor()}}}):t._e(),t._v(" "),t.CheckEditAuth?i("q-btn",{attrs:{flat:"",label:"刪除影像"},on:{click:function(e){return t.DeleteImage()}}}):t._e()],1):t._e(),t._v(" "),t.dataset&&"riverlog"==t.dataset.externalLink?i("q-btn",{attrs:{flat:"",label:"前往山河事件簿"},on:{click:function(e){return t.GoToExternalLink()}}}):t._e(),t._v(" "),t.dataset&&"purbao"==t.dataset.externalLink?i("q-btn",{attrs:{flat:"",label:"前往紫豹在哪裡"},on:{click:function(e){return t.GoToExternalLink()}}}):t._e()],1)],1),t._v(" "),t.showNavigate?i("div",[i("q-page-sticky",{attrs:{position:"left",offset:[9,0]}},[i("q-btn",{attrs:{round:"",color:"accent",icon:"arrow_back"},on:{click:function(e){return t.GoToPrev()}}})],1),t._v(" "),i("q-page-sticky",{attrs:{position:"right",offset:[9,0]}},[i("q-btn",{staticClass:"rotate-90",attrs:{round:"",color:"accent",icon:"arrow_upward"},on:{click:function(e){return t.GoToNext()}}})],1),t._v(" "),i("q-page-sticky",{attrs:{position:"top-right",offset:[9,-9]}},[i("q-btn",{attrs:{round:"",color:"primary",icon:"close"},on:{click:function(e){return t.CloseView()}}})],1)],1):t._e(),t._v(" "),t.dataset?i("q-dialog",{attrs:{maximized:"",persistent:""},model:{value:t.openAnnotator,callback:function(e){t.openAnnotator=e},expression:"openAnnotator"}},[i("annotator",{attrs:{user:t.user,dataset:t.dataset,image:t.image},on:{done:function(e){return t.FinishAnnotation()},skip:function(e){t.openAnnotator=!1}}}),t._v(" "),i("div",[i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],staticClass:"bg-teal text-white q-ma-md absolute-top-right",attrs:{round:"",icon:"close"}})],1)],1):t._e(),t._v(" "),t.editImage?i("q-dialog",{model:{value:t.openInfoEdit,callback:function(e){t.openInfoEdit=e},expression:"openInfoEdit"}},[i("image-info",{ref:"imageInfo",attrs:{dataset:t.dataset,initDataTime:t.editImage.dataTime,initLat:t.editImage.lat,initLng:t.editImage.lng,initRemark:t.editImage.remark,initReply:t.editImage.formReply},on:{confirm:function(e){return t.UpdateImageInfo()},cancel:function(e){t.openInfoEdit=!1}}})],1):t._e(),t._v(" "),t.image&&t.image.lat&&t.image.lng?i("q-dialog",{model:{value:t.openLocationView,callback:function(e){t.openLocationView=e},expression:"openLocationView"}},[i("q-card",{staticClass:"full-width q-pa-sm"},[i("div",{staticClass:"text-h6"},[t._v("資料地點")]),t._v(" "),i("location-select",{ref:"locationSelect",attrs:{mode:"view"}}),t._v(" "),i("div",{staticClass:"text-center"},[t._v("座標: "+t._s(t.image.lat.toFixed(5)+" "+t.image.lng.toFixed(5)))]),t._v(" "),i("q-card-actions",{attrs:{align:"center"}},[i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{flat:"",label:"確定"}})],1)],1)],1):t._e(),t._v(" "),t.user&&t.targetUser?i("q-dialog",{model:{value:t.openUserInfo,callback:function(e){t.openUserInfo=e},expression:"openUserInfo"}},[i("q-card",{staticClass:"q-pa-lg"},[i("div",{staticClass:"row justify-center q-pa-sm"},[i("q-avatar",{attrs:{size:"150px"}},[i("img",{staticStyle:{"object-fit":"cover"},attrs:{src:t.targetUser.photo}})])],1),t._v(" "),i("div",{staticClass:"column q-pa-sm"},[i("div",[t._v(t._s(t.targetUser.name))]),t._v(" "),i("div",[t._v(t._s(t.targetUser.contactEmail))])]),t._v(" "),i("q-card-actions",{attrs:{align:"center"}},[i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{flat:"",label:"確定"}})],1)],1)],1):t._e()],1):t._e()};a._withStripped=!0;var n=i(40),s=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"annotator-view bg-grey-7"},[t.dataset&&t.image?i("div",{staticClass:"fit"},["image"==t.dataset.annotationType?i("annotator-image",{attrs:{dataset:t.dataset,image:t.image,task:"view"}}):t._e(),t._v(" "),"bbox"==t.dataset.annotationType?i("annotator-bbox",{attrs:{dataset:t.dataset,image:t.image,task:"view"}}):t._e()],1):i("div",{staticClass:"fit row justify-center items-center"},[i("div",{staticClass:"text-h5 text-white"},[t._v("無影像")])])])};s._withStripped=!0;var r=i(24),o=i(23),l={name:"annotator-view",components:{"annotator-image":r.a,"annotator-bbox":o.a},props:{dataset:Object,image:Object},data:function(){return{}},mounted:function(){},methods:{}},c=(i(93),i(0)),u=Object(c.a)(l,s,[],!1,null,null,null);u.options.__file="src/vue/annotator-view.vue";var d=u.exports,h=i(7),f=i(27),m={name:"image-control",props:{user:Object,dataset:Object,image:Object,showNavigate:Boolean,editable:Boolean},components:{annotator:n.a,"annotator-view":d,"location-select":h.a,"image-info":f.a},data:function(){return{openAnnotator:!1,openLocationView:!1,openInfoEdit:!1,editImage:null,uploader:null,annotator:null,openUserInfo:!1,targetUser:null}},mounted:function(){this.UpdateContributer()},methods:{GoToPrev:function(){this.$emit("goToPrev")},GoToNext:function(){this.$emit("goToNext")},CloseView:function(){this.$emit("closeView")},AnnotateImage:function(){this.openAnnotator=!0},FinishAnnotation:function(){this.openAnnotator=!1,this.openViewImage=!1,this.$emit("reload")},ViewLocation:function(){this.openLocationView=!0,Vue.nextTick(function(){this.$refs.locationSelect.SetPosition(this.image.lat,this.image.lng,!0)}.bind(this))},OpenInfoEditor:function(){$.get("/dataset/view-image?dataset="+this.dataset._id+"&image="+this.image._id,function(t){if("ok"!=t.status)return window.location.href="/?message="+encodeURIComponent("無法顯示影像");var e=spacetime().name;if(this.editImage=t.data,this.editImage.dataTime){var i=spacetime(this.editImage.dataTime).goto(e);this.editImage.time=i.unixFmt("yyyy-MM-dd HH:mm:ss")}this.editImage.url="/static/upload/dataset/"+this.dataset._id+"/image/"+this.image._id+".jpg",this.openInfoEdit=!0}.bind(this))},OpenUserInfo:function(t){this.targetUser=t,this.openUserInfo=!0},UpdateContributer:function(){Vue.nextTick(function(){this.uploader=null,this.annotator=null;var t=[],e="user"==this.image.uploadFrom&&this.image.uploader,i=this.image.annotation&&this.image.annotation.user;e&&t.push(this.image.uploader),i&&t.push(this.image.annotation.user),0!=t.length&&$.get("/user/list-name?id="+t.join(),function(t){if("ok"!=t.status)return alert("取得貢獻者資料失敗");for(var a={},n=0;n<t.data.length;n++){var s=t.data[n];a[s._id]=s}e&&(this.uploader=a[this.image.uploader]),i&&(this.annotator=a[this.image.annotation.user])}.bind(this))}.bind(this))},UpdateImageInfo:function(){var t=$("meta[name='csrf-token']").attr("content"),e=this.$refs.imageInfo.GetImageInfo(),i={};i.dataset=this.dataset._id,i.image=this.image._id,i.dataTime=e.dataTime,i.remark=e.remark,i.formReply=e.formReply,e.loc&&(i.lat=e.loc.lat,i.lng=e.loc.lng),i._csrf=t,$.post("/dataset/update-image-info",i,function(t){if("ok"!=t.status)return alert("更新失敗");this.$emit("reload"),this.openInfoEdit=!1,this.$q.notify("更新成功")}.bind(this))},DeleteImage:function(){if(confirm("確定刪除此影像?")){var t=$("meta[name='csrf-token']").attr("content"),e={};e.dataset=this.dataset._id,e.image=this.image._id,e._csrf=t,$.post("/dataset/delete-image",e,function(t){if("ok"!=t.status)return alert("刪除失敗");this.$emit("reload"),this.$q.notify("刪除成功")}.bind(this))}},DownloadImage:function(){if(this.image){var t=$("<a>").attr("href",this.image.url).attr("download",this.image._id+".jpg").appendTo("body");t[0].click(),t.remove()}},GoToExternalLink:function(){var t=spacetime.now(),e=spacetime(this.image.dataTime).goto(t.timezone().name);switch(e=e.subtract(e.minute()%10,"minute"),this.dataset.externalLink){case"riverlog":var i="https://riverlog.lass-net.org/";i+="#year="+e.year(),i+="&date="+e.unixFmt("MM-dd"),i+="&time="+e.unixFmt("HH:mm"),i+="&lat="+this.image.lat,i+="&lng="+this.image.lng,i+="&marker="+this.image.lat+","+this.image.lng,i+="&zoom=16",window.open(i,"_blank");break;case"purbao":i="https://purbao.lass-net.org/";i+="?year="+e.year(),i+="&date="+e.unixFmt("M/d"),i+="&lat="+this.image.lat,i+="&lng="+this.image.lng,i+="&marker="+this.image.lat+","+this.image.lng,i+="&zoom=16",window.open(i,"_blank")}},GoToImageUrl:function(){this.image&&window.open("/image?dataset="+this.dataset._id+"&image="+this.image._id,"_blank")},DeleteAnnotation:function(){if(confirm("確定刪除此影像的標註?")){this.openViewImage=!1;var t=$("meta[name='csrf-token']").attr("content"),e={};e.dataset=this.dataset._id,e.image=this.image._id,e._csrf=t,$.post("/dataset/set-annotation",e,function(t){if("ok"!=t.status)return alert("刪除標註失敗");this.$q.notify("刪除標註成功"),this.$emit("reload")}.bind(this))}}},computed:{AgreeVerifyRatio:function(){var t=this.image.agreeNum+" / "+this.image.verifyNum;return this.image.verifyNum>0&&(t+=" ("+(100*this.image.agreeNum/this.image.verifyNum).toFixed(0)+"%)"),t},CheckAnnotationDelete:function(){return!!this.user&&(!!this.image&&(!!this.image.annotation&&("admin"==this.user.authType||(this.image.annotation.user==this.user._id||!!this.dataset&&this.dataset.master.filter(function(t){return t._id==this.user._id}.bind(this)).length>0))))},CheckEditAuth:function(){return!!this.user&&("admin"==this.user.authType||(this.image.uploader==this.user._id||!!this.dataset&&this.dataset.master.filter(function(t){return t._id==this.user._id}.bind(this)).length>0))}}},p=(i(95),Object(c.a)(m,a,[],!1,null,null,null));p.options.__file="src/vue/image-control.vue";e.a=p.exports},,,,,,,,,function(t,e,i){var a=i(1),n=i(118);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[t.i,n,""]]);var s={insert:"head",singleton:!1},r=(a(t.i,n,s),n.locals?n.locals:{});t.exports=r},,,,,,,function(t,e,i){"use strict";var a=i(33);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".camera-capture{width:100%;height:100%;position:relative;display:flex;justify-content:center}.camera-capture video{width:auto;height:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(34);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".image-edit{width:100%;height:100%;position:relative;display:flex;justify-content:center}.image-edit img{width:100%;height:100%;object-fit:contain}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(35);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".camera-capture{width:100%;height:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(36);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".annotator-view{width:100%;height:100%}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(37);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".image-control{width:100%;padding:5px;background-color:#eeeeee}.image-control .form-area{margin:5px;padding:5px 10px;border:1px solid #888888;border-radius:5px}\n",""]),t.exports=e},function(t,e,i){"use strict";var a=i(38);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".image-info-filter{width:100%}\n",""]),t.exports=e},,,,,,,,,,,,,,,,,,function(t,e,i){t.exports=i(132)},function(t,e,i){"use strict";var a=i(80);i.n(a).a},function(t,e,i){(e=i(2)(!1)).push([t.i,".dataset-view{width:100%;height:100%}\n",""]),t.exports=e},,,,,,,,,,,,,,function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("q-layout",{staticClass:"dataset-view bg-grey-1 shadow-2",attrs:{view:"lHh lpr lFf",container:""}},[i("q-header",[i("topbar",{attrs:{user:t.user}})],1),t._v(" "),i("q-page-container",[t.info?i("div",{staticClass:"q-pa-md"},[i("div",{staticClass:"text-h4 q-ma-sm"},[t._v("\n\t\t\t\t"+t._s(t.info.name)+"\n\t\t\t\t"),t._l(t.badgeArr,(function(t){return i("q-badge",{key:t,staticClass:"q-ma-xs",attrs:{outline:"",color:"primary",label:t}})})),t._v(" "),i("div",{staticClass:"text-subtitle2 q-ma-sm",staticStyle:{"white-space":"pre-line","word-wrap":"break-word"},domProps:{innerHTML:t._s(t.info.descWithLink)}})],2),t._v(" "),i("q-chip",{attrs:{icon:"image"}},[t._v("影像數: "+t._s(t.info.picNum))]),t._v(" "),i("q-chip",{attrs:{icon:"aspect_ratio"}},[t._v("標註數: "+t._s(t.info.annotationNum))]),t._v(" "),i("div",{staticClass:"q-pa-sm"},[i("span",{staticClass:"text-bold"},[t._v("標籤:")]),t._v("\n\t\t\t\t"+t._s(t.info.tagArr.join(", "))+"\n\t\t\t")])],1):t._e(),t._v(" "),i("div",{staticClass:"row q-px-md q-gutter-sm"},[t.info?i("q-btn",{attrs:{dense:"",icon:"filter_alt",label:"篩選",flat:""},on:{click:function(e){return t.OpenFilterPanel()}}}):t._e(),t._v(" "),t.info&&t.info.enableUpload?i("q-btn",{attrs:{dense:"",icon:"add_photo_alternate",label:"新增照片",flat:""},on:{click:function(e){t.openUploader=!0}}}):t._e(),t._v(" "),t.info&&t.info.enableDownload&&t.user?i("q-btn",{attrs:{dense:"",icon:"cloud_download",label:"整包下載",flat:""},on:{click:function(e){return t.OpenBatchDownload()}}}):t._e(),t._v(" "),t.favorite?i("q-btn",{attrs:{dense:"",icon:"star",label:"取消收藏",flat:""},on:{click:function(e){return t.RemoveFavorite()}}}):i("q-btn",{attrs:{dense:"",icon:"star_border",label:"收藏",flat:""},on:{click:function(e){return t.AddFavorite()}}}),t._v(" "),i("q-btn",{attrs:{dense:"",icon:"bar_chart",label:"統計分析",flat:""},on:{click:function(e){return t.GoToStatistic()}}}),t._v(" "),t.CheckMasterAuth?i("q-btn",{attrs:{dense:"",icon:"edit",label:"修改",flat:""},on:{click:function(e){return t.ModifyDataset()}}}):t._e()],1),t._v(" "),i("q-infinite-scroll",{ref:"imageScroll",staticClass:"q-pa-md",on:{load:t.ShowMoreImage},scopedSlots:t._u([{key:"loading",fn:function(){return[i("div",{staticClass:"row justify-center q-my-md"},[i("q-spinner-dots",{attrs:{color:"primary",size:"40px"}})],1)]},proxy:!0}])},[i("div",{staticClass:"row q-col-gutter-md"},t._l(t.showArr,(function(e,a){return i("div",{key:a,staticClass:"col-12 col-sm-6 col-md-3 cursor-pointer",attrs:{transition:"scale"}},[i("q-card",{staticClass:"bg-grey-7 text-white",on:{click:function(i){return t.ViewImage(e,a)}}},[i("q-img",{attrs:{src:e.url,ratio:16/9}},[e.verifyFinish?i("div",{staticClass:"absolute-bottom"},[t._v("\n\t\t\t\t\t\t\t\t驗證完成\n\t\t\t\t\t\t\t")]):e.annotation?i("div",{staticClass:"absolute-bottom"},[t._v("\n\t\t\t\t\t\t\t\t已標註\n\t\t\t\t\t\t\t")]):t._e()])],1)],1)})),0)]),t._v(" "),0==t.filterArr.length?i("div",{staticClass:"row justify-center q-ma-xl"},[i("div",{staticClass:"text-h5"},[t._v("無資料")])]):t._e(),t._v(" "),t.targetImage?i("q-dialog",{attrs:{"full-width":""},model:{value:t.openViewImage,callback:function(e){t.openViewImage=e},expression:"openViewImage"}},[i("image-control",{ref:"imageControl",attrs:{showNavigate:"",editable:"",user:t.user,dataset:t.info,image:t.targetImage},on:{reload:function(e){return t.ReloadDataset()},goToPrev:function(e){return t.GoToPrev()},goToNext:function(e){return t.GoToNext()},closeView:function(e){t.openViewImage=!1}}})],1):t._e(),t._v(" "),t.info&&t.info.enableUpload?i("q-page-sticky",{attrs:{position:"bottom-left",offset:[18,18]}},[i("q-btn",{staticClass:"bg-teal text-white",attrs:{round:"",icon:"add_photo_alternate"},on:{click:function(e){t.openUploader=!0}}},[i("q-tooltip",{attrs:{"content-class":"bg-grey-8"},on:{click:function(e){t.openUploader=!0}}},[t._v("拍照上傳")])],1)],1):t._e(),t._v(" "),i("q-dialog",{attrs:{maximized:""},model:{value:t.openUploader,callback:function(e){t.openUploader=e},expression:"openUploader"}},[i("uploader",{attrs:{user:t.user,dataset:t.info},on:{uploaded:function(e){return t.LoadDatasetInfo()}}}),t._v(" "),i("div",[i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],staticClass:"bg-teal text-white q-ma-md absolute-top-right",attrs:{round:"",icon:"close"}})],1)],1),t._v(" "),i("q-dialog",{model:{value:t.openBatchDownload,callback:function(e){t.openBatchDownload=e},expression:"openBatchDownload"}},[i("q-card",{staticClass:"full-width"},[i("q-card-section",[i("div",{staticClass:"text-h6 text-center"},[t._v("整包下載")]),t._v(" "),i("div",{staticClass:"row items-center"},[i("div",{staticClass:"col-shrink text-subtitle2"},[t._v("影像篩選")]),t._v(" "),i("q-select",{staticClass:"col q-pa-sm",attrs:{dense:"",options:t.downloadFilter,"option-value":"value","option-label":"label","emit-value":"","map-options":""},model:{value:t.downloadOption.filter,callback:function(e){t.$set(t.downloadOption,"filter",e)},expression:"downloadOption.filter"}})],1),t._v(" "),i("div",{staticClass:"row items-center"},[i("div",{staticClass:"col-shrink text-subtitle2"},[t._v("下載格式")]),t._v(" "),i("q-select",{staticClass:"col q-pa-sm",attrs:{dense:"",options:t.downloadFormat,"option-value":"value","option-label":"label","emit-value":"","map-options":""},model:{value:t.downloadOption.format,callback:function(e){t.$set(t.downloadOption,"format",e)},expression:"downloadOption.format"}})],1)]),t._v(" "),i("q-card-actions",{attrs:{align:"center"}},[i("q-btn",{attrs:{flat:"",label:"下載"},on:{click:function(e){return t.BatchDownload()}}}),t._v(" "),i("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{flat:"",label:"取消"}})],1)],1)],1),t._v(" "),i("q-dialog",{model:{value:t.openDatasetEditor,callback:function(e){t.openDatasetEditor=e},expression:"openDatasetEditor"}},[i("dataset-editor",{attrs:{info:t.editInfo},on:{confirm:function(e){return t.ReloadDataset()},cancel:function(e){t.openDatasetEditor=!1}}})],1),t._v(" "),i("q-dialog",{model:{value:t.openFilterPanel,callback:function(e){t.openFilterPanel=e},expression:"openFilterPanel"}},[i("q-card",{staticClass:"full-width q-px-md"},[i("q-card-section",{staticClass:"column"},[i("image-info-filter",{ref:"imageInfoFilter",attrs:{initFilter:t.curFilter},on:{update:function(e){return t.UpdateFilterResult()}}})],1),t._v(" "),i("q-card-actions",{attrs:{align:"center"}},[i("q-btn",{attrs:{flat:"",label:"確定"},on:{click:function(e){t.openFilterPanel=!1}}})],1)],1)],1)],1),t._v(" "),i("q-footer",[i("q-btn",{staticClass:"full-width bg-grey-8",attrs:{icon:"home",label:"回首頁"},on:{click:function(e){return t.GoHome()}}})],1)],1)};a._withStripped=!0;var n=i(3),s=(i(25),i(21)),r=i(70),o=i(39),l=i(71),c=i(45),u={name:"dataset-view",components:{topbar:s.a,uploader:r.a,"dataset-editor":o.a,"image-control":l.a,"image-info-filter":c.a},data:function(){return{tab:"",user:null,downloadFilter:[{label:"全部",value:"all"},{label:"標註完成",value:"annotateFinish"},{label:"驗證完成",value:"verifyFinish"}],downloadFormat:[],downloadOption:{filter:"all",format:""},curFilter:null,datasetID:null,info:null,badgeArr:[],imageArr:[],filterArr:[],showArr:[],targetImage:null,targetIndex:-1,openViewImage:!1,openFilterPanel:!1,openUploader:!1,openDatasetEditor:!1,openBatchDownload:!1,editInfo:null,favorite:!1,verifyCond:null}},created:function(){var t=n.a.GetUrlParameter();this.datasetID=t.id,$.get("/dataset/verify-condition",function(t){"ok"==t.status&&(this.verifyCond=t.data,this.CheckVerifyFinish())}.bind(this)),$.get("/user/info",function(t){"ok"==t.status&&(this.user=t.data)}.bind(this)),$.get("/favorite/list-my-favorite?dataset="+this.datasetID,function(t){"ok"==t.status&&t.data.length>0&&(this.favorite=!0)}.bind(this)),this.LoadDatasetInfo()},methods:{OpenFilterPanel:function(){this.openFilterPanel=!0,Vue.nextTick(function(){this.$refs.imageInfoFilter.SetData(this.info,this.imageArr)}.bind(this))},LoadDatasetInfo:function(){$.get("/dataset/view-dataset?id="+this.datasetID,function(t){if("ok"!=t.status)return window.location.href="/?message="+encodeURIComponent("無法顯示資料集");if(this.info=t.data,this.info.desc){this.info.descWithLink=this.info.desc.replace(/(?![^<]*>|[^<>]*<\/)((https?:)\/\/[a-z0-9&#=.\/\-?_]+)/gi,'<a href="$1" target="_blank">$1</a>')}if(this.badgeArr=[],this.info.isPublic||this.badgeArr.push("不公開"),this.info.enableGPS&&this.badgeArr.push("GPS"),this.info.enableAnnotation)switch(this.info.annotationType){case"bbox":this.badgeArr.push("框選標註");break;case"image":this.badgeArr.push("整張標註")}else this.badgeArr.push("暫停標註");var e="/dataset/list-image";e+="?all=1&dataset="+this.datasetID,$.get(e,function(t){if("ok"==t.status){this.imageArr=[];for(var e=spacetime().name,i=0;i<t.data.length;i++){var a=t.data[i];if(a.dataTime){var n=spacetime(a.dataTime).goto(e);a.time=n.unixFmt("yyyy-MM-dd HH:mm:ss")}a.url="/static/upload/dataset/"+this.datasetID+"/image/"+a._id+".jpg",this.imageArr.push(a)}this.filterArr=this.imageArr,this.ResetShowArr(),this.CheckVerifyFinish()}}.bind(this))}.bind(this))},ModifyDataset:function(){this.openDatasetEditor=!0,this.editInfo=Object.assign({},this.info)},ReloadDataset:function(){window.location.reload()},GoHome:function(){window.location.href="/"},GoToStatistic:function(){window.location.href="/statistic?id="+this.datasetID},ResetShowArr:function(){this.showArr=[],this.$refs.imageScroll.reset(),this.$refs.imageScroll.resume(),this.$refs.imageScroll.poll(),this.targetImage=null,this.openViewImage=!1},ShowMoreImage:function(t,e){for(var i=10*(t-1),a=Math.min(10*t,this.filterArr.length),n=i;n<a;n++)this.showArr.push(this.filterArr[n]);a==this.filterArr.length&&this.$refs.imageScroll.stop(),e()},UpdateFilterResult:function(){var t=this.$refs.imageInfoFilter;this.curFilter=t.filter,this.filterArr=t.filterArr,this.ResetShowArr()},CheckVerifyFinish:function(){for(var t=0;t<this.imageArr.length;t++){var e=this.imageArr[t];if(e.annotation)if(e.verification.length<this.verifyCond.sample)e.verifyFinish=!1;else{for(var i=0,a=0;a<e.verification.length;a++){"1"==e.verification[a].agree&&i++}i/e.verification.length>this.verifyCond.accept?e.verifyFinish=!0:e.verifyFinish=!1}else e.verifyFinish=!1}},ViewImage:function(t,e){this.targetImage=t,this.targetIndex=e,this.openViewImage=!0},GoToPrev:function(){this.targetIndex--,this.targetIndex<0&&(this.targetIndex=0),this.targetImage=this.filterArr[this.targetIndex],this.$refs.imageControl.UpdateContributer()},GoToNext:function(){this.targetIndex++,this.targetIndex>=this.filterArr.length&&(this.targetIndex=this.filterArr.length-1),this.targetImage=this.filterArr[this.targetIndex],this.$refs.imageControl.UpdateContributer()},AddFavorite:function(){var t=$("meta[name='csrf-token']").attr("content"),e={};e.dataset=this.datasetID,e._csrf=t,$.post("/favorite/add-favorite",e,function(t){if("ok"!=t.status)return alert("收藏失敗");this.favorite=!0,this.$q.notify("收藏成功")}.bind(this))},RemoveFavorite:function(){var t=$("meta[name='csrf-token']").attr("content"),e={};e.dataset=this.datasetID,e._csrf=t,$.post("/favorite/remove-favorite",e,function(t){if("ok"!=t.status)return alert("取消收藏失敗");this.favorite=!1,this.$q.notify("取消收藏成功")}.bind(this))},OpenBatchDownload:function(){switch(this.openBatchDownload=!0,this.downloadFormat=[],this.info.annotationType){case"image":this.downloadFormat.push({label:"依標籤分資料夾",value:"folder"});break;case"bbox":this.downloadFormat.push({label:"VOC",value:"voc"})}this.downloadOption.format=this.downloadFormat[0].value},BatchDownload:function(){var t=$("meta[name='csrf-token']").attr("content"),e={};e.dataset=this.datasetID,e.filter=this.downloadOption.filter,e.format=this.downloadOption.format,e._csrf=t,$.post("/dataset/batch-download",e,function(t){if("ok"!=t.status)return alert("整包下載失敗");var e=document.createElement("a");e.href=t.data,e.download="",e.click(),this.openBatchDownload=!1}.bind(this))}},computed:{CheckMasterAuth:function(){return!!this.user&&("admin"==this.user.authType||!!this.info&&this.info.master.filter(function(t){return t._id==this.user._id}.bind(this)).length>0)}}},d=(i(117),i(0)),h=Object(d.a)(u,a,[],!1,null,null,null);h.options.__file="src/vue/dataset-view.vue";var f=h.exports;new Vue({el:"#datasetViewApp",components:{"dataset-view":f}})}]);