1import {l}from'./chunk-Bx2LSSF2.js';import {Z,q as C,C as C$1,P as ee,J as K,cS as kr,be as $u,bf as B,av as Dn,aE as Ie,bX as Lu,aZ as Hu,aA as _u,au as Am,aX as Gm,N as Ne,gS as Rh,bb as E,gT as I,bc as A,M as M$1,cO as Qi,Q as fi,cg as Tt,cU as Lv,U as F$1,W as E$1,a0 as be,g as E$2,an as km,as as Fe,aC as Lm,X as XD,c9 as Uh,cP as $n,aQ as Gn,aR as dn,dt as W,br as _e,p,j as Yi,k as KT,_ as _b,O as Ol,l as cg,a5 as pg,aV as lD,a6 as gb,D as DI,o as Og,S as Sb,m as ag,bA as yb,a3 as pb,n as hb,aW as dD,f as db,cV as m,cF as v,cw as I$1,dG as Ee,cp as Mu,at as Ms,cq as Cu,b9 as te,b8 as St}from'./main-LEFCVYTE.js';import {F as Fi}from'./chunk-0w6Cc7Uq.js';var D=(()=>{let i=class i extends C{constructor(){super({}),this._route=C$1(ee),this._router=C$1(K),this._aisopService=C$1(kr),this.applicationId$=this._router.events.pipe($u(new B(0,this._router.url,this._router.url)),Dn(t=>t instanceof B),Ie(()=>{let t=parseInt(Ne.run(Rh,this._route.snapshot,"applicationId"));return isNaN(t)?null:t}),Lu(),Hu(1)),this.wordings$=this.applicationId$.pipe(_u(t=>t==null?Am([]):Gm(()=>this._aisopService.queryApplicationWordings(t))),Hu(1)),this.applicationDetail$=this.applicationId$.pipe(_u(t=>t==null?Am(null):Gm(()=>this._aisopService.queryApplicationDetail(t))),Hu(1)),this.isGeometryConfigEnabled$=this.applicationDetail$.pipe(Ie(t=>{var r;return ((r=t==null?void 0:t.features)==null?void 0:r.includes("geometry_config"))??false}),Hu(1)),this.applicationConfigSchema$=this.applicationId$.pipe(_u(t=>t==null?Am(null):Gm(()=>this._aisopService.queryApplicationConfigSchema(t))),Hu(1));}};i.\u0275fac=function(r){return new(r||i)},i.\u0275prov=Z({token:i,factory:i.\u0275fac});let p=i;return p})();var M=(()=>{let E=class E{};E.COLORS=["#004397","#059DDE","#0B9FA9","#829A21","#A29170","#954B02","#EB6301","#F31E77","#990099","#E600E6"],E.MAX_GEOMETRY_CONFIG_NUM=20,E.MAX_GEOMETRY_NAME_LENGTH=255,E.MAX_GEOMETRY_TAG_NUM=10,E.MAX_GEOMETRY_TAG_LENGTH=32,E.MAX_POLYGON_POINTS_NUM=30,E.LINE_POINTS_NUM=2,E.DETECTION_LIST_PAGE_SIZE=5,E.DETECTION_LIST_SEARCH_DEBOUNCE_MS=500,E.DETECTION_LIST_MAX_ITEMS=1e3;let T=E;return T})();var Bt=(()=>{let i=class i extends E{constructor(){super(...arguments),this._route=C$1(ee),this._aiAppByAiStudioStore=C$1(D),this._aisopService=C$1(kr),this.appTitle$=this._aiAppByAiStudioStore.applicationDetail$.pipe(Ie(e=>(e==null?void 0:e.name)??null),Hu(1)),this.rootPath$=this._aiAppByAiStudioStore.applicationId$.pipe(Ie(e=>e!=null?`/ai-app-by-ai-studio/${e}`:"/ai-app-by-ai-studio"),Hu(1)),this.menu$=this._aiAppByAiStudioStore.applicationDetail$.pipe(_u(e=>{if(e==null)return Am({mainMenuItemGroups:[]});let{applicationId:o,features:a}=e;return a.includes("event")||a.includes("object")?Fe(this._aisopService.queryDevices({applicationId:o,permission:["analyze_result_view"],limit:1})).pipe(Ie(v=>{let u=[];return v.total>0&&u.push({id:"detection_list",label:translate("ai-app-by-ai-studio.navigation.detection-list"),url:`/ai-app-by-ai-studio/${o}/detection-list`,icon:{default:"st-svg-icon-v1-message-square-exclamationmark-outline",selected:"st-svg-icon-v1-message-square-exclamationmark-fill"}}),u.push({id:"device_list",label:translate("ai-app-by-ai-studio.navigation.device-list"),url:`/ai-app-by-ai-studio/${o}/device-list`,icon:{default:"st-svg-icon-v1-video-outline",selected:"st-svg-icon-v1-video-fill"}}),u.push({id:"notification_setting",label:translate("ai-app-by-ai-studio.navigation.notification-setting"),url:`/ai-app-by-ai-studio/${o}/setting/notification`,icon:{default:"st-svg-icon-v1-bell-outline",selected:"st-svg-icon-v1-bell-fill"}}),{mainMenuItemGroups:[{menuItems:u}]}})):Am({mainMenuItemGroups:[{menuItems:[{id:"device_list",label:translate("ai-app-by-ai-studio.navigation.device-list"),url:`/ai-app-by-ai-studio/${o}/device-list`,icon:{default:"st-svg-icon-v1-video-outline",selected:"st-svg-icon-v1-video-fill"}}]}]})}),Hu(1));}onBack(e){let o=Ne.run(Rh,this._route.snapshot,"applicationId");return o==null?"/ai-app-by-ai-studio":e.startsWith(`/ai-app-by-ai-studio/${o}/detection-list`)?`/ai-app-by-ai-studio/${o}/detection-list`:e.startsWith(`/ai-app-by-ai-studio/${o}/device-list`)?`/ai-app-by-ai-studio/${o}/device-list`:e.startsWith(`/ai-app-by-ai-studio/${o}/setting/notification`)?`/ai-app-by-ai-studio/${o}/setting/notification`:`/ai-app-by-ai-studio/${o}/detection-list`}};i.\u0275fac=(()=>{let e;return function(a){return (e||(e=Lv(i)))(a||i)}})(),i.\u0275prov=Z({token:i,factory:i.\u0275fac});let t=i;return t})();var Et=()=>M$1(null,null,function*(){let t=C$1(K),i=C$1(Qi),s=C$1(fi);try{return (yield i.isLoggedIn("viewer"))?(yield i.getUserServices()).ai_solution_portal?!0:(yield s.show(F$1(E$1({},be),{title:translate("common.error"),descriptions:translate("ai-app-by-ai-studio.ai-app-by-ai-studio-guard.no-permission")})),t.parseUrl("/")):!0}catch(e){return yield s.show(F$1(E$1({},be),{title:translate("common.error"),descriptions:e.message})),t.parseUrl("/")}});var Dt=10*1e3,Gt="M-020-0001";function F(t){return M$1(this,null,function*(){return E$2.isStaging?km(Fe(t).pipe(Lm(Dt))):t})}function j(t){return M$1(this,null,function*(){let{alertService:i,router:s,fallbackUrl:e,error:o}=t,a=o,n;
1return E$2.isStaging&&(a==null?void 0:a.name)==="TimeoutError"?n=translate("ai-app-by-ai-studio.ai-app-by-ai-studio-guard.vpn-error"):(a==null?void 0:a.code)===Gt?n=translate("ai-app-by-ai-studio.ai-app-by-ai-studio-guard.application-not-found"):n=a.message,yield i.show(F$1(E$1({},be),{title:translate("common.error"),descriptions:n})),s.parseUrl(e)})}var Lt=()=>M$1(null,null,function*(){let t=C$1(K),i=C$1(Qi),s=C$1(fi),e=C$1(kr);try{return (yield i.isLoggedIn("viewer"))&&(yield F(e.queryApplications(void 0,["portal"]))),!0}catch(o){return j({alertService:s,router:t,fallbackUrl:"/",error:o})}});var Rt="https://bucket.safie.link/doc/terms-of-ai-app.pdf",N=(()=>{let i=class i extends te{constructor(){super({applicationId:null,agreed:false}),this._aisopService=C$1(kr),this.$agreed=this.select(e=>e.agreed),this.$termsUrl=St(()=>Rt);}setApplicationId(e){this.setState({applicationId:e});}setAgreed(e){this.setState({agreed:e});}agreeToTerms(){return Gm(()=>this._aisopService.createApplicationUseConsent(this.$state().applicationId,"v1"))}};i.\u0275fac=function(o){return new(o||i)},i.\u0275prov=Z({token:i,factory:i.\u0275fac});let t=i;return t})();var Nt=(t,i)=>({agreed:t,termsUrl:i}),Vt=()=>["st-svg-icon-v1-doc-text-outline st-svg-size-6"],Wt=()=>["st-svg-icon-v1-square-and-arrow-up-forward"],qt=(t,i,s,e)=>({text:t,leftIconClasses:i,rightIconClasses:s,url:e}),zt=t=>({label:t}),Kt=()=>({standalone:true}),Ft=(()=>{let i=class i extends m{constructor(){super(...arguments),this.localStore=C$1(N),this._dialogStore=C$1(v),this._alertService=C$1(fi),this._loadingService=C$1(I$1);}set properties(e){this.localStore.setApplicationId(e.applicationId);}onInit(){this._dialogStore.setTitle(translate("ai-app-by-ai-studio.dialog.use-consent.title")),this._dialogStore.setSize("medium"),this._dialogStore.setShowCloseButton(false),this._dialogStore.setButtons([{label:translate("common.ok"),key:"ok",type:"primary",disabled:true}]),this._dialogStore.setStatus("loaded"),this.registerEffect(()=>{let e=this.localStore.$agreed();Ee(()=>this._dialogStore.setButtonDisabled([{key:"ok",disabled:!e}]));});}onClick(){this._loadingService.show(),this.registerSubscription(this.localStore.agreeToTerms().pipe(Mu(()=>this._dialogStore.close()),Ms(e=>Gm(()=>this._alertService.show(F$1(E$1({},be),{title:translate("common.error"),descriptions:e.message})))),Cu(()=>this._loadingService.hide())).subscribe());}};i.\u0275fac=(()=>{let e;return function(a){return (e||(e=Lv(i)))(a||i)}})(),i.\u0275cmp=XD({type:i,selectors:[["sf-use-consent"]],features:[db([N]),Uh],decls:13,vars:27,consts:[[1,"st-flex","st-flex-col","st-gap-6","st-p-6"],["name","text_terms_description",1,"st-text-16px","st-text-label-alpha-base-primary"],[1,"st-flex","st-w-full","st-items-center","st-rounded-lg","st-border","st-border-border-neutral-tertiary","st-bg-surface-base-primary","st-px-6","st-py-4"],["name","link_terms",3,"config"],["name","check_ai_app_terms_agree",3,"ngModelChange","config","ngModel","ngModelOptions"]],template:function(o,a){if(o&1&&(Yi(0,"div",0)(1,"div",1)(2,"div"),KT(3),_b(4,"translate"),Ol(),Yi(5,"div"),KT(6),_b(7,"translate"),Ol()(),Yi(8,"div",2),cg(9,"sf-link-text",3),_b(10,"translate"),Ol(),Yi(11,"sf-check-box-v1",4),_b(12,"translate"),pg("ngModelChange",function(v){return a.localStore.setAgreed(v)}),Ol(),lD(),Ol()),o&2){let n=gb(14,Nt,a.localStore.$agreed(),a.localStore.$termsUrl());DI(3),Og(Sb(4,6,"ai-app-by-ai-studio.dialog.use-consent.description1")),DI(3),Og(Sb(7,8,"ai-app-by-ai-studio.dialog.use-consent.description2")),DI(3),ag("config",yb(19,qt,Sb(10,10,"ai-app-by-ai-studio.dialog.use-consent.link-label"),pb(17,Vt),pb(18,Wt),n.termsUrl)),DI(2),ag("config",hb(24,zt,Sb(12,12,"ai-app-by-ai-studio.dialog.use-consent.agree")))("ngModel",n.agreed)("ngModelOptions",pb(26,Kt)),dD();}},dependencies:[$n,Gn,dn,W,_e,p],encapsulation:2});let t=i;return t})();var jt=t=>M$1(null,null,function*(){var n,v,u,V,W;let i=C$1(K),s=C$1(Qi),e=C$1(fi),o=C$1(kr),a=C$1(Tt);try{if(!(yield s.isLoggedIn("viewer")))return !0;let z=t.paramMap.get("applicationId"),p=z?parseInt(z,10):null;if(p==null||isNaN(p))return i.parseUrl("/ai-app-by-ai-studio");let Ot=yield F(o.queryApplicationDetail(p)),K=yield o.queryApplicationUseConsent(p,"v1");!K.isTrial&&K.timestamp==null&&(yield a.showDialog(Ft,{applicationId:p},{closeByInteraction:!1}));let I=Ot.features,x=(v=(n=t.firstChild)==null?void 0:n.routeConfig)==null?void 0:v.path,Y=(W=(V=(u=t.firstChild)==null?void 0:u.firstChild)==null?void 0:V.routeConfig)==null?void 0:W.path;if(x==="device-list"||x==="setting/notification"||x==="setting/notification/:deviceId")return !0;if(!I.includes("event")&&!I.includes("object"))return i.parseUrl(`/ai-app-by-ai-studio/${p}/device-list`);
1if(x==="detection-list"){if((yield o.queryDevices({applicationId:p,permission:["analyze_result_view"],limit:1})).total===0)return i.parseUrl(`/ai-app-by-ai-studio/${p}/device-list`);if(Y==="event"&&!I.includes("event"))return i.parseUrl(`/ai-app-by-ai-studio/${p}/detection-list/object`);if(Y==="object"&&!I.includes("object"))return i.parseUrl(`/ai-app-by-ai-studio/${p}/detection-list/event`)}return !0}catch(q){return j({alertService:e,router:i,fallbackUrl:"/ai-app-by-ai-studio",error:q})}});var si=[{path:"",canActivate:[I,Et],component:Fi,data:{[A]:"AIStudio"},providers:[D,{provide:E,useClass:Bt}],children:[{path:"",canActivate:[Lt],loadComponent:()=>import('./chunk-SfYfRaDm.js').then(t=>t.AppListComponent)},{path:":applicationId",canActivate:[jt],loadComponent:()=>import('./chunk-95LiLv77.js').then(t=>t.AppPageComponent),children:[{path:"",redirectTo:"detection-list",pathMatch:"full"},{path:"detection-list",loadComponent:()=>import('./chunk-D2s0Jx_R.js').then(t=>t.DetectionListComponent),children:[{path:"",redirectTo:"event",pathMatch:"full"},{path:"event",loadComponent:()=>import('./chunk-DAP11VRn.js').then(t=>t.EventResultComponent)},{path:"object",loadComponent:()=>import('./chunk-D6Vs-67a.js').then(t=>t.ObjectResultComponent)},{path:"**",redirectTo:"event"}]},{path:"device-list",loadComponent:()=>import('./chunk-C5aZ3tbI.js').then(t=>t.DeviceListPageComponent)},{path:"setting/notification",loadComponent:()=>import('./chunk-BLXnAUln.js').then(t=>t.NotificationSettingsComponent)},{path:"setting/notification/:deviceId",canDeactivate:[l],loadComponent:()=>import('./chunk-BiynvVsA.js').then(function(n){return n.c}).then(t=>t.NotificationDetailComponent)},{path:"**",redirectTo:"detection-list"}]}]},{path:"**",redirectTo:""}]; 2var chunkETWT5ZBH=/*#__PURE__*/Object.freeze({__proto__:null,routes:si});export{D,M,chunkETWT5ZBH as c};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.