1import{f as Ne}from"./chunk-7RZLV3T2.js";import"./chunk-IR637DQS.js";import{b as De}from"./chunk-YEQIOV6M.js";import{a as Ze}from"./chunk-OIMMO64W.js";import"./chunk-E5YI2WH3.js";import"./chunk-NMVQPV6A.js";import{a as Ee}from"./chunk-OKGVRUYD.js";import"./chunk-X2MCVCX5.js";import"./chunk-6WICFCA4.js";import"./chunk-COAHZKQI.js";import"./chunk-2X4UM7C5.js";import"./chunk-NGLC225S.js";import"./chunk-RBLGCLKT.js";import{c as ke,d as Me}from"./chunk-YIDY57SP.js";import"./chunk-BIOGUYPW.js";import"./chunk-A6XTRDWV.js";import"./chunk-CPHPYD7K.js";import"./chunk-JF3UXG35.js";import"./chunk-K2SQJPRE.js";import"./chunk-KJDNGKZP.js";import"./chunk-33BB3HZO.js";import"./chunk-F6672RJD.js";import{Ha as j,Rb as Te,Tb as ve,Ub as q,ca as Le,eb as H,ha as Pe,ra as Ce,va as Ie}from"./chunk-RTV3XH63.js";import"./chunk-GQUHUKTX.js";import{Ma as _e,Na as fe,Nb as ye,t as ge,w as me}from"./chunk-H2ZYJM6X.js";import{D as le,Fb as he,Ha as Be,Ia as U,J as pe,Ma as W,Oa as f,Rb as Se,Va as ce,ea as ue,h as ne,o as ae}from"./chunk-P7B5WLP2.js";import{a as E}from"./chunk-3R5M7XEQ.js";import{$ as we,G as re,S as se,_ as de,k as te,v as ie}from"./chunk-Z3W52P33.js";import{a as be}from"./chunk-U2NXPT35.js";import{Ac as p,Ae as oe,Bc as M,Fd as u,Gd as c,Ic as Z,Lb as a,Ma as m,Mc as S,Oc as L,Qd as O,Rd as x,Wa as h,Xa as b,Yc as K,_b as J,a as G,bd as N,dc as A,dd as X,fb as w,gb as I,ha as Q,id as y,jd as P,kd as C,ld as z,md as T,nd as v,rc as R,tc as B,vd as Y,wd as D,xd as _,yc as r,yd as $,zc as d,zd as ee}from"./chunk-JIXA2FWJ.js";import{a as k,b as V,g as Re}from"./chunk-QDSGMOWV.js";var Ae=Re(Be());var Oe=(i,g)=>({itemId:i.requestId+i.id+i.timestamp,columns:[{id:"status",value:i.status,valueType:"badge",width:"120px",valueTypeOptions:{badgeType:"tag",badgeSize:"sm",contextType:g.transform(+i.status),leftIcon:i.cacheAction==="HIT"?"check-circle":void 0,title:i.cacheAction==="HIT"?"Cache HIT":"Cache MISS"}},{id:"timestamp",value:i.timestamp,valueType:"date",width:"200px"},{id:"remote-ip",value:i.remoteIP,valueTypeOptions:{country:i.country},width:"200px"},{id:"size",value:i.size,valueType:"metric",valueTypeOptions:{unit:"B"},width:"150px"},{id:"path",hasEllipsis:!0,value:i.path,valueType:"link",valueTypeOptions:{href:i.path,tooltip:`<div><strong>Datacenter:</strong></div><div class="mb-2 text-dark-3 bn-logs-reporting__tooltip-text">${E.sanitize(i.datacenter,{USE_PROFILES:{html:!1}})}</div><div><strong>Request ID:</strong></div><div class="mb-2 text-dark-3 bn-logs-reporting__tooltip-text">${E.sanitize(i.requestId,{USE_PROFILES:{html:!1}})}</div><div><strong>User-Agent:</strong></div><div class="mb-2 text-dark-3 bn-logs-reporting__tooltip-text">${E.sanitize(i.userAgent,{USE_PROFILES:{html:!1}})}</div><div><strong>Referrer URL:</strong></div><div class="text-dark-3 bn-logs-reporting__tooltip-text">${E.sanitize(i.refererUrl,{USE_PROFILES:{html:!1}})}</div>`,tooltipPlacement:"auto",tooltipContainerClass:"tooltip--xl tooltip--html"}}]});var ze=()=>({align:"end",size:"sm",closeOnItemClick:!0}),xe=()=>({icon:"magnifying-glass",size:"sm"}),Fe=i=>[i],Ve=i=>({rightAddons:i,isRounded:!0}),Ue=(i,g)=>({title:i,description:g,fileName:"bunny-bot.svg"}),We=()=>({isAbsolute:!0,height:"140px",right:"30px",top:"15px",fileName:"bunny-bot.svg"}),je=i=>({title:"No logs found for the selection",description:"It looks like there was not enough traffic on this zone to display any data. Please try again after more request logs are available.",size:"lg",height:"180px",imageOptions:i}),He=i=>({isLoading:i}),qe=(i,g,e)=>({hasMoreData:i,startToken:g,endToken:e});function Ge(i,g){if(i&1){let e=Z();d(0,"button",22),S("click",function(){h(e);let t=L();return b(t.onDownloadLogs())}),N(1," Download "),p()}if(i&2){let e=L();r("disabled",!(e.tableData!=null&&e.tableData.length)||e.downloading())("loading",e.downloading())}}function Qe(i,g){}function Je(i,g){i&1&&A(0,Qe,0,0,"ng-template")}function Ke(i,g){if(i&1&&(A(0,Je,1,0,null,23),u(1,"translate"),u(2,"translate")),i&2){L();let e=K(38);r("ngTemplateOutlet",e.logs())("ngTemplateOutletContext",$(6,Ue,c(1,2,"NOT-AVAILABLE.TITLE.LOGS"),c(2,4,"NOT-AVAILABLE.DESCRIPTION.LOGS")))}}function Xe(i,g){if(i&1){let e=Z();d(0,"bn-web-ui-table",24),S("prevNextStorePageChange",function(t){h(e);let l=L();return b(l.onPageChange(t))}),p()}if(i&2){let e=L(),n=v(0),t=v(32),l=v(33),s=v(34);r("columns",e.tableColumns)("isLoading",e.logsStore.showSkeleton()?!1:n)("noDataOptions",_(7,je,D(6,We)))("paginationOptions",_(9,He,n))("prevNextPage",ee(11,qe,t,l,s))("tableDataSource",e.logsStore.showSkeleton()?null:e.tableData)}}var Ot=(()=>{class i{#t;#i;#e;#o;#n;#a;constructor(){this.logsStore=m(H),this.pullZoneVirtualScrollStore=m(q),this.#t=m(be),this.#i=m(j),this.#e=m(Se),this.#o=m(me),this.#n=m(Ce),this.#a=m(oe),this.page=1,this.user=x(()=>this.#i.userDetails()),this.pullzoneSelectItems=x(()=>{let e=ce(ue);return W.getPullZonesSelectList(this.pullZoneVirtualScrollStore.entities().map(n=>V(k({},n),{group:n.VideoLibraryId>0?"Video Library":String(e[n.OriginType]),translatedName:W.getPullZoneTranslatedName(n)})).sort((n,t)=>n.Name.localeCompare(t.Name)))}),this.pullZoneId=w(NaN),this.selectedPullZone=w(void 0),this.noPullZones=x(()=>this.pullZoneVirtualScrollStore.callStatus()==="loaded"&&!this.pullZoneVirtualScrollStore.entities().length),this.datePickerValue=f.dayjsNow().toDate(),this.status=w(void 0),this.search=w(void 0),this.datePickerConfig={minDate:f.dayjsNow().subtract(2,"d").toDate(),maxDate:f.dayjsNow().toDate()},this.statusItems=ge,this.countries={},this.pullZonesSelectList=[],this.tableColumns=[{id:"status",name:"Status",mobileWidth:"half",mobileOrder:1},{id:"timestamp",name:"Timestamp",mobileWidth:"half",mobileOrder:2},{id:"remote-ip",name:"Remote IP",styleClasses:"do-not-break",mobileWidth:"half",mobileOrder:3},{id:"size",name:"Size",mobileWidth:"half",mobileOrder:4},{id:"path",name:"Path",mobileWidth:"full",mobileOrder:5}],this.dropdownItemsMobile=[{type:"link",label:"Download",icon:"download",action:"download"},{type:"link",label:"Report",route:`/${he.Logs}/report`,icon:"chart-user"}],this.tableData=null,this.enableDownloadButton=!1,this.downloading=w(!1),this.pageItemsPerPage=50,this.onSelectPaginationSearch=Te,this.onSelectPaginationScroll=ve,this.subscriptions=new G,m(Ie).getSingletonsState().subscribe(({countries:e})=>this.countries=e),this.setInitialValues(),this.subscribeToStoreSignals(),this.pullZoneVirtualScrollStore.filterEntities({filter:{addStreamZones:!0,addMagicContainerZones:!0},patch:!0})}ngOnDestroy(){this.subscriptions.unsubscribe()}applyEventStoreFilter(){let e=this.logsStore.entitiesFilter()?.pullZoneId!==this.pullZoneId(),n=this.logsStore.entitiesFilter()?.search!==this.search(),t=this.logsStore.entitiesFilter()?.status!==this.status();e&&this.search.set(void 0),(n||t)&&(this.page=1),O(()=>{this.logsStore.filterEntities({filter:{page:this.page||1,pullZoneId:this.pullZoneId(),status:this.status(),search:this.search()},patch:!0})})}getQueryParams(){let e=k({},this.logsStore.entitiesFilter());return e.pullZone=e.pullZoneId,delete e.pullZoneId,e}onPageChange(e){this.page=e?Number(e):1,this.logsStore.filterEntities({filter:{page:this.page},patch:!0})}onDropdownClick({action:e}){e==="download"&&this.onDownloadLogs()}onDatePickerChange(e){this.page=1,this.logsStore.filterEntities({filter:{date:(0,Ae.default)(e).format(U.DatePickerDate),page:1},patch:!0})}onButtonRefresh(){this.logsStore.filterEntities({filter:{},forceLoad:!0,patch:!0})}onClearFilters(){this.status.set(void 0),this.search.set(void 0),this.datePickerValue=f.dayjsNow().toDate(),this.logsStore.filterEntities({filter:{date:f.dayjsNow().format(U.DatePickerDate),status:void 0,search:void 0,page:1},patch:!0})}onDownloadLogs(){let e=this.logsStore.entitiesFilter()??{},n=this.pullZoneId();if(!n){this.#e.danger("Missing query data, can't download at the moment");return}e.date&&(e.date=ke.getIsoDateformatOrFallback(e.date));let t=this.#n.getExportLogUrl(V(k({},e),{pullZoneId:n}),this.getMetadata()),l=`${n}.log`;this.downloading.set(!0),this.#a.get(t,{responseType:"blob"}).pipe(Q(()=>this.downloading.set(!1))).subscribe({next:s=>{let o=URL.createObjectURL(s),F=document.createElement("a");F.href=o,F.download=l,F.click(),URL.revokeObjectURL(o)},error:()=>this.#e.danger("Failed to download logs")})}getMetadata(){return this.pullZoneId()&&!isNaN(this.pullZoneId())?{parentEntityId:this.pullZoneId()}:{}}setInitialValues(){let e=this.logsStore.entitiesFilter(),n=e?.pullZoneId?e.pullZoneId:NaN;this.pullZoneId.set(n),e.search&&this.search.set(e.search),e.status&&this.status.set(e.status),e.page&&(this.page=e.page),this.datePickerValue=f.toLocalTime(e.date).toDate()||this.datePickerValue,this.pageItemsPerPage=this.#t.pageItemsPerPage.cdnLoggingView}subscribeToStoreSignals(){I(()=>{let e=this.pullZoneId();O(()=>{e&&this.selectedPullZone.set(this.pullZoneVirtualScrollStore.entityMap()[this.pullZoneId()])}),(e||this.status()||this.search())&&this.applyEventStoreFilter()}),I(()=>{let e=this.logsStore.entitiesFilter()?.pullZoneId,n=this.pullZoneVirtualScrollStore.entities(),t=n[0]?.Id;e||O(()=>{this.logsStore.filterEntities({filter:{pullZoneId:n[0]?.Id||NaN},patch:!0}),this.pullZoneId.set(t||NaN)})}),I(()=>{this.tableData=this.logsStore.entities().map(e=>Oe(e,this.#o))}),I(()=>{this.user()&&(this.enableDownloadButton=!this.user().Roles?.includes(pe.Subuser),this.dropdownItemsMobile[0].hide=!this.enableDownloadButton)})}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=J({type:i,selectors:[["ng-component"]],features:[Y([H,j,q])],decls:39,vars:72,consts:[["notAvailable",""],["heading","Log explorer"],["header","",1,"w-100","w-lg-auto","d-flex","justify-content-end"],["bn-web-ui-button","","data-e2e","LogsReportButton","itemStyle","secondary","leftIcon","chart-user","routerLink","/logs/report",1,"me-2","d-none","d-md-inline-block",3,"queryParams"],["bn-web-ui-button","","data-e2e","LogsDownloadButton","itemStyle","secondary","leftIcon","download",1,"d-none","d-md-inline-block",3,"disabled","loading"],["data-e2e","LogsDropdownMenu",1,"d-inline-block","d-lg-none","ms-2",3,"clickAction","aboveLoader","items","options"],["trigger",""],["bn-web-ui-button","","itemStyle","stroke",3,"lessPadding"],["icon","ellipsis"],[1,"d-flex","w-100","align-content-center","align-items-center","mb-2","justify-content-between"],[1,"row","align-items-center","g-2"],["data-e2e","LogsFilterLogDateInput","itemStyle","secondary","size","xxs",1,"col-auto",3,"ngModelChange","bsConfig","placeholder","readonly","ngModel"],["bindLabel","Name","bindValue","Id","data-e2e","LogsFilterLogStatusCodeInput","dropdownWidth","150px","id","status-code-dropdown","itemStyle","secondary","size","xxs",1,"col-auto",3,"ngModelChange","closeOnSelect","innerLabel","isMultipleSelect","items","placeholder","readonly","showEndSelectedIcon","showFirstNPlusMore","ngModel"],["bindLabel","Name","bindValue","Id","data-e2e","LogsFilterLogPullZoneInput","dropdownWidth","250px","groupBy","group","id","pull-zone-dropdown","itemStyle","secondary","size","xxs",1,"col-auto",3,"ngModelChange","scroll","search","clearable","disableInternalSearch","headerText","innerLabel","isExternalSearch","isLoading","items","placeholder","readonly","searchable","virtualScroll","ngModel"],["itemStyle","link","size","sm","type","button",1,"col-auto","text-200-semi-bold",3,"click","disabled","lessPadding"],[1,"d-inline-flex","justify-content-between","align-items-center","gap-2"],["containerExtraClass","border-dark-3","itemStyle","primary","placeholder","Search","size","xxs",1,"col-auto","d-none","d-xl-block",3,"ngModelChange","options","ngModel"],["aria-label","Reload action","itemStyle","stroke","size","sm","type","button",1,"bn-button--circle","flex-shrink-0",3,"click","loading"],["containerClass","m-1","icon","arrows-rotate",3,"tooltip"],[1,"d-block","d-xl-none","mb-2","w-100"],["containerExtraClass","border-dark-3","itemStyle","primary","placeholder","Search","size","xxs",3,"ngModelChange","options","ngModel"],["data-e2e","LogsTable","paginationType","prev-next-store",1,"z-0","position-relative",3,"columns","isLoading","noDataOptions","paginationOptions","prevNextPage","tableDataSource"],["bn-web-ui-button","","data-e2e","LogsDownloadButton","itemStyle","secondary","leftIcon","download",1,"d-none","d-md-inline-block",3,"click","disabled","loading"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["data-e2e","LogsTable","paginationType","prev-next-store",1,"z-0","position-relative",3,"prevNextStorePageChange","columns","isLoading","noDataOptions","paginationOptions","prevNextPage","tableDataSource"]],template:function(n,t){if(n&1){let l=Z();z(0),d(1,"bn-web-ui-content",1)(2,"div",2)(3,"button",3),N(4," Report "),p(),R(5,Ge,2,2,"button",4),d(6,"bn-web-ui-dropdown-menu",5),S("clickAction",function(o){return t.onDropdownClick(o)}),d(7,"span",6)(8,"button",7),M(9,"fa-icon",8),p()()()(),d(10,"div",9)(11,"div")(12,"div",10)(13,"bn-web-ui-datepicker",11),u(14,"translate"),C("ngModelChange",function(o){return h(l),P(t.datePickerValue,o)||(t.datePickerValue=o),b(o)}),S("ngModelChange",function(o){return t.onDatePickerChange(o)}),p(),d(15,"bn-web-ui-prime-select",12),u(16,"translate"),u(17,"translate"),C("ngModelChange",function(o){return h(l),P(t.status,o)||(t.status=o),b(o)}),p(),d(18,"bn-web-ui-prime-select",13),u(19,"translate"),u(20,"translate"),u(21,"translate"),C("ngModelChange",function(o){return h(l),P(t.pullZoneId,o)||(t.pullZoneId=o),b(o)}),S("scroll",function(o){return t.onSelectPaginationScroll(t.pullZoneVirtualScrollStore,o)})("search",function(o){return t.onSelectPaginationSearch(t.pullZoneVirtualScrollStore,{search:o})}),p(),d(22,"bn-web-ui-button",14),S("click",function(){return t.onClearFilters()}),N(23),u(24,"translate"),p()()(),d(25,"div",15)(26,"bn-web-ui-input",16),C("ngModelChange",function(o){return h(l),P(t.search,o)||(t.search=o),b(o)}),p(),d(27,"bn-web-ui-button",17),S("click",function(){return t.onButtonRefresh()}),M(28,"fa-icon",18),u(29,"translate"),p()()(),d(30,"div",19)(31,"bn-web-ui-input",20),C("ngModelChange",function(o){return h(l),P(t.search,o)||(t.search=o),b(o)}),p()(),z(32)(33)(34),R(35,Ke,3,9)(36,Xe,1,15,"bn-web-ui-table",21),M(37,"bn-web-ui-not-available-template",null,0),p()}if(n&2){let l=T(!t.logsStore.isLoaded()&&!t.logsStore.error());a(3),r("queryParams",t.getQueryParams()),a(2),B(t.enableDownloadButton?5:-1),a(),r("aboveLoader",!0)("items",t.dropdownItemsMobile)("options",D(61,ze)),a(2),r("lessPadding",!0),a(5),r("bsConfig",t.datePickerConfig)("placeholder",c(14,42,"FILTER.DATE-PICKER.PLACEHOLDER"))("readonly",l),y("ngModel",t.datePickerValue),a(2),r("closeOnSelect",!1)("innerL
1abel",c(16,44,"LABELS.STATUS-CODE"))("isMultipleSelect",!0)("items",t.statusItems)("placeholder",c(17,46,"LABELS.STATUS-CODE"))("readonly",l)("showEndSelectedIcon",!0)("showFirstNPlusMore",1),y("ngModel",t.status),a(3),r("clearable",!1)("disableInternalSearch",!0)("headerText",c(19,48,"DROPDOWNS.HEADER-TEXT.SELECT-PULL-ZONE"))("innerLabel",c(20,50,"LABELS.PULL-ZONE"))("isExternalSearch",!0)("isLoading",t.pullZoneVirtualScrollStore.isLoading())("items",t.pullzoneSelectItems())("placeholder",c(21,52,"LABELS.PULL-ZONE"))("readonly",l&&!!t.pullZoneId())("searchable",!0)("virtualScroll",!0),y("ngModel",t.pullZoneId),a(4),r("disabled",l)("lessPadding",!0),a(),X(" ",c(24,54,"FILTER.CLEAR-FILTERS")," "),a(3),r("options",_(65,Ve,_(63,Fe,D(62,xe)))),y("ngModel",t.search),a(),r("loading",l),a(),r("tooltip",c(29,56,"BUTTONS.REFRESH")),a(3),r("options",_(70,Ve,_(68,Fe,D(67,xe)))),y("ngModel",t.search),a(),T(t.logsStore.hasMoreItems()??!1),a(),T(t.page!==1?(t.page-1).toString():""),a(),T(t.logsStore.hasMoreItems()?(t.page+1).toString():""),a(),B(t.noPullZones()?35:36)}},dependencies:[ie,te,we,Ee,Me,De,re,le,ne,ae,ye,Pe,fe,_e,de,se,Ze,Ne,Le],styles:[".bn-logs__not-available[_ngcontent-%COMP%]{padding-top:160px}"]})}}return i})();export{Ot as LogsPage};
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.