import{ao as e,aU as t,aP as L,aq as n,L as l,aw as P,bj as k,aX as T,ay as N,bs as R,az as y,aA as F,aC as U,aD as V,aZ as z,aF as _,f as D,e as O,bt as q,h as j,aE as M,a_ as $,av as W,bm as X}from"./app-k0jcl5PQ.js";import{A as Y}from"./DCdUbbLx.chunk.js";import{A as G}from"./t24_x3Gi.chunk.js";import{F as Z}from"./C7ozUncm.chunk.js";import{a as J,b as K}from"./AeV4ZsCs.chunk.js";import{u as Q}from"./CbdgrRVe.chunk.js";import{C as ee}from"./_XP6hjk3.chunk.js";import"./BojVbZw0.chunk.js";import"./UBCV9Jq8.chunk.js";import"./Boh3c6zT.chunk.js";import"./BFSC0Mx_.chunk.js";import"./BlKMjFEf.chunk.js";import"./D-iHOjjO.chunk.js";import"./C5n0s02L.chunk.js";import"./CqF9ND51.chunk.js";const p="assign.sharesAndAssignmentsEmptyState",c=l.encloseNamespace(p);function se(s){return e.jsxs(t,{className:"py-4",children:[e.jsx(t.Image,{size:"small",src:L.EmptyStates.Share.MY_SHARES}),e.jsx(t.Heading,{children:e.jsx(n,{phrase:"title",namespace:p})}),e.jsx(t.Info,{children:e.jsx(n,{phrase:"description",namespace:p})}),!s.hideAssignButton&&e.jsxs(e.Fragment,{children:[e.jsx(t.Cta,{icon:P,text:c("ctaAssign"),appLink:s.assignAppLink}),e.jsx(t.Cta,{className:"text-dark hover-text-underline mt-3 fw-medium",text:c("ctaShareLink"),appLink:s.shareLinkAppLink})]}),s.hideAssignButton&&e.jsx(t.Cta,{icon:k,text:c("ctaShare"),appLink:s.shareLinkAppLink})]})}const m="assign.sharesEmptyState",te=l.encloseNamespace(m);function ae(s){return e.jsxs(t,{className:"py-4",children:[e.jsx(t.Image,{size:"small",src:L.EmptyStates.Share.MY_SHARES}),e.jsx(t.Heading,{children:e.jsx(n,{phrase:"title",namespace:m})}),e.jsx(t.Info,{children:e.jsx(n,{phrase:"description",namespace:m})}),e.jsx(t.Cta,{icon:k,text:te("cta"),appLink:s.appLink})]})}const C="assign.showAssignmentsView",f=l.encloseNamespace(C),ne=400;function ie(s,a){if(!(!s||!a))return j.isSame(s.dateCreated,a.dateCreated)?0:j.isAfter(s.dateCreated,a.dateCreated)?1:-1}function re(s){return e.jsxs("a",{href:s.href,target:"_blank",className:"btn btn-link text-info",children:[e.jsx("span",{className:"pe-1",children:e.jsx(n,{phrase:"openInSchoolAnalytics",namespace:C})}),e.jsx($,{svg:X,size:W.Small})]})}function oe(s){return s.type==="assign-and-shares"?e.jsx(se,{assignAppLink:s.assignAppLink,shareLinkAppLink:s.shareAppLink,hideAssignButton:s.hideAssignButton}):e.jsx(ae,{appLink:s.shareAppLink})}function ke(s){var u,A,S;const a=Q({objectId:s.objectId,entityType:s.entityType}),{hasPermissions:I}=T(),{hasShareFlowV2:h}=N(null),w=R(),r=y(F.getSharesByObjectId(s.objectId)),i=((u=r.data)==null?void 0:u.sort(ie))||[],b=U.uniq(i.map(V.getClassroomIdFromShare).filter(o=>!!o)),d=y(r.hasCompleted&&ee.getClassroomsByIds(b,(A=a.currentUser.data)==null?void 0:A.customerId));function v(o){const x=M(o,null);if(x)return x}const g=Y.getObjectUrl((S=a.config.data)==null?void 0:S.analyticsWebUrl,a.entity.data,h),H=I(z.ViewSchoolAnalytics),B=h&&w?"shares":"assign-and-shares",E=a.loaded&&!!r.data&&!!d.data;return e.jsxs(_,{size:"lg",title:f("title"),showLoadingSpinner:!E,closePopup:s.closePopup,children:[!i.length&&e.jsx(oe,{assignAppLink:q.flowSelector({entityType:s.entityType,objectId:s.objectId}),shareAppLink:{application:O.SHARE,action:D.Share.SHARE,args:[s.objectId],params:{entityType:s.entityType}},type:B,hideAssignButton:G.hideAssignButtonOnVideoActions(a.currentUser.data)}),!!i.length&&e.jsxs(e.Fragment,{children:[e.jsx(J,{}),e.jsx(K,{assignments:i.reverse(),classrooms:d.data,getItemAppLink:v,scrollHeightMax:ne})]}),e.jsx(Z,{hideNextButton:!0,hideCreateClassroomButton:!0,onClickBack:s.closePopup,backButtonText:f("close"),leftComponent:!!g&&H&&e.jsx(re,{href:g})})]})}export{ke as ShowAssignmentsView};
//# sourceMappingURL=CJfj4Mir.chunk.js.map
