cft-builder 0.2.326 → 0.2.327

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { E as s, D as o, F as a, G as d, R as i, T as u, C as m, A as B, z as k, B as l } from "./main-7qwhE7Xm.js";
1
+ import { E as s, D as o, F as a, G as d, R as i, T as u, C as m, A as B, z as k, B as l } from "./main-b--hPc8_.js";
2
2
  export {
3
3
  s as BuilderItems,
4
4
  o as BuilderItemsRender,
@@ -2286,7 +2286,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2286
2286
  position: relative;
2287
2287
  }
2288
2288
  }
2289
- `}}),Zr=b.forwardRef(function(t,e){var n=Kn(),r=b.useContext(ar),i=_3.getProps(t,r),a=b.useState(i.id),s=pN(a,2),l=s[0],c=s[1],u=b.useState(i.collapsed),d=pN(u,2),f=d[0],h=d[1],g=b.useRef(null),v=b.useRef(null),m=i.toggleable?i.onToggle?i.collapsed:f:!1,A=l+"_header",w=l+"_content",C=_3.setMetaData({props:i,state:{id:l,collapsed:m}}),S=C.ptm,T=C.cx,x=C.isUnstyled;ci(_3.css.styles,x,{name:"panel"});var E=function(X){i.toggleable&&(m?_(X):M(X),X&&(i.onToggle&&i.onToggle({originalEvent:X,value:!m}),X.preventDefault()))},_=function(X){i.onToggle||h(!1),i.onExpand&&X&&i.onExpand(X)},M=function(X){i.onToggle||h(!0),i.onCollapse&&X&&i.onCollapse(X)};b.useImperativeHandle(e,function(){return{props:i,toggle:E,expand:_,collapse:M,getElement:function(){return g.current},getContent:function(){return v.current}}}),Li(function(){l||c(So())});var O=function(){if(i.toggleable){var X=l+"_label",ce=n({className:T("toggler"),onClick:E,id:X,"aria-controls":w,"aria-expanded":!m,type:"button",role:"button","aria-label":i.header},S("toggler")),Y=n(S("togglericon")),ae=m?i.expandIcon||b.createElement(Mm,Y):i.collapseIcon||b.createElement(n8,Y),re=nr.getJSXIcon(ae,Y,{props:i,collapsed:m});return b.createElement("button",ce,re,b.createElement(Qt,null))}return null},F=function(){var X=ke.getJSXElement(i.header,i),ce=ke.getJSXElement(i.icons,i),Y=O(),ae=n({id:A,className:T("title")},S("title")),re=b.createElement("span",ae,X),Z=n({className:T("icons")},S("icons")),K=b.createElement("div",Z,ce,Y),W=n({className:T("header")},S("header")),ge=b.createElement("div",W,re,K);if(i.headerTemplate){var ve={className:"p-panel-header",titleClassName:"p-panel-title",iconsClassName:"p-panel-icons",togglerClassName:"p-panel-header-icon p-panel-toggler p-link",onTogglerClick:E,titleElement:re,iconsElement:K,togglerElement:Y,element:ge,id:l+"_header",props:i,collapsed:m};return ke.getJSXElement(i.headerTemplate,ve)}else if(i.header||i.toggleable)return ge;return null},P=function(){var X=ke.getJSXElement(i.footer,i),ce=n({className:T("footer")},S("footer")),Y=b.createElement("div",ce,X);if(i.footerTemplate){var ae={className:T("footer"),element:Y,props:i};return ke.getJSXElement(i.footerTemplate,ae)}else if(i.footer)return Y;return null},H=function(){var X=n({ref:v,className:T("toggleableContent"),"aria-hidden":m,role:"region",id:w,"aria-labelledby":A},S("toggleablecontent")),ce=n({className:T("content")},S("content")),Y=n({classNames:T("transition"),timeout:{enter:1e3,exit:450},in:!m,unmountOnExit:!0,options:i.transitionOptions},S("transition"));return b.createElement(Ro,v7({nodeRef:v},Y),b.createElement("div",X,b.createElement("div",ce,i.children)))},N=n({id:l,ref:g,style:i.style,className:ft(i.className,T("root"))},_3.getOtherProps(i),S("root")),$=F(),U=H(),le=P();return b.createElement("div",N,$,U,le)});Zr.displayName="Panel";const ese=t=>{var v;const{fieldState:e,setFieldState:n,pageIndex:r,formBuilderFormLayout:i,pageSettingUpdate:a}=t,s=(m,A)=>{const w=`${m.className} justify-content-start`,C=`${m.titleClassName} pl-1`;return o.jsxs("div",{className:w,children:[o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:m.togglerClassName,onClick:()=>c(A),"aria-label":"Submit"}),o.jsx("span",{className:C,children:`Rule ${A+1}`})]})},l=(m,A)=>{var C;const w=[...((C=e==null?void 0:e.conditionalTabRules)==null?void 0:C.rules)||[]];w[m].conditions=w[m].conditions.filter((S,T)=>A!==T),n(S=>({...S,conditionalTabRules:{...S.conditionalTabRules,rules:w}}))},c=m=>{var S;const A=[...(e==null?void 0:e.conditionalTabRules.rules)||[]],w=A.filter((T,x)=>m!==x);n(T=>({...T,conditionalTabRules:{...T.conditionalTabRules,rules:w}}));const C=A[m];(S=C==null?void 0:C.conditions)==null||S.map(T=>{const x=i?_t.findIndex(i,_=>{var M;return(_==null?void 0:_.uuid)===((M=T==null?void 0:T.tab)==null?void 0:M.uuid)}):-1,E=i[x];E&&(E.isHidden=!1,a(x,E))})};let u=[...i].filter(function(m,A){return A!==r});u.map(m=>({uuid:m==null?void 0:m.uuid,title:m==null?void 0:m.title}));const d=(m,A,w)=>{const C=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];C[A].conditions[w].option=m==null?void 0:m.value,n(S=>({...S,conditionalTabRules:{...S.conditionalTabRules,rules:C}}))},f=(m,A,w)=>{const C=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];C[A].conditions[w].tab=m==null?void 0:m.value,n(x=>({...x,conditionalTabRules:{...x.conditionalTabRules,rules:C}}));const S=_t.findIndex(i,x=>{var E;return(x==null?void 0:x.uuid)===((E=m==null?void 0:m.value)==null?void 0:E.uuid)}),T=i[S];T&&(T.isHidden=!0,a(S,T))},h=()=>{n(m=>({...m,conditionalTabRules:{...m.conditionalTabRules,rules:[...m.conditionalTabRules.rules,{conditions:[]}]}}))},g=m=>{const A=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];A[m].conditions=[...A[m].conditions,{option:null,tab:null}],n(w=>({...w,conditionalTabRules:{...w.conditionalTabRules,rules:[...A]}}))};return o.jsxs("div",{children:[o.jsx("h4",{children:"Conditional Tabs"}),i&&(i==null?void 0:i.length)>1&&((v=e==null?void 0:e.conditionalTabRules)==null?void 0:v.rules.map((m,A)=>o.jsx(Zr,{className:"mb-3",header:`Rule ${A+1}`,headerTemplate:w=>s(w,A),children:o.jsxs("div",{children:[m==null?void 0:m.conditions.map((w,C)=>o.jsx("div",{className:"p-field pb-6",children:o.jsxs("div",{className:"grid",children:[o.jsx("div",{className:"col-2",children:o.jsxs("label",{children:["Show tab",w.value]})}),o.jsx("div",{className:"col-3 p-fluid",children:o.jsx(Pa,{value:w.tab,options:u,onChange:S=>f(S,A,C),optionLabel:"title.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-3",children:"when option is selected"}),o.jsx("div",{className:"col-3 p-fluid",children:o.jsx(Pa,{value:w==null?void 0:w.option,options:e==null?void 0:e.options,onChange:S=>d(S,A,C),optionLabel:"optionText.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-1",children:o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>l(A,C),tooltipOptions:{position:"top"}})})]})},C)),o.jsx(Ot,{text:!0,size:"small",onClick:()=>g(A),icon:"pi pi-plus",className:"p-mt-4",label:"Add Condition"})]})},"conditional_tab_rule"+A))),i&&(i==null?void 0:i.length)>1&&o.jsx(Ot,{text:!0,onClick:()=>h(),className:"p-mt-4",icon:"pi pi-plus",label:"Add Rule",size:"small"}),i&&(i==null?void 0:i.length)<2&&o.jsx("p",{className:"error",children:"Please needs to have two or more tabs to enable the conditional tabs"})]})},tse=t=>{var S;const{fieldState:e,setFieldState:n,section:r,formBuilderFormLayout:i,sectionSettingUpdate:a,page:s}=t,[l]=k.useState([]),{schemaBuilderUpdate:c,formBuilderFormSchema:u}=sn(),d=(T,x)=>{const E=`${T.className} justify-content-start`,_=`${T.titleClassName} pl-1`;return o.jsxs("div",{className:E,children:[o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:T.togglerClassName,onClick:()=>f(x),"aria-label":"Submit"}),o.jsx("span",{className:_,children:`Rule ${x+1}`})]})},f=T=>{var M;const x=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]],E=x[T];(M=E==null?void 0:E.conditions)==null||M.map(O=>{var H;const F=_t.findIndex(i,N=>{var $;return(N==null?void 0:N.uuid)===(($=O==null?void 0:O.tab)==null?void 0:$.uuid)}),P=i?_t.findIndex(i[F].children,N=>{var $;return(N==null?void 0:N.uuid)===(($=O==null?void 0:O.section)==null?void 0:$.uuid)}):-1;if(P>=0){const N=(H=i[F])==null?void 0:H.children[P];N&&(N.isHidden=!1,a(F,P,N))}});const _=x.filter((O,F)=>T!==F);n(O=>({...O,conditionalSectionRules:{...O.conditionalSectionRules,rules:_}}))},h=T=>{var _;let x=!1;const E=i?i.filter(function(M){return(M==null?void 0:M.uuid)===(T==null?void 0:T.uuid)}):[];return(E==null?void 0:E.length)>0&&((_=E[0].children)==null?void 0:_.length)>1&&(x=!0),x},g=(T,x,E)=>{const _=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];_[x].conditions[E].option=T==null?void 0:T.value,n(M=>({...M,conditionalSectionRules:{...M.conditionalSectionRules,rules:_}}))},v=(T,x)=>{var M;const E=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]],_=E[T];(M=_==null?void 0:_.conditions)==null||M.map(O=>{var N;const F=_t.findIndex(i,$=>{var U;return($==null?void 0:$.uuid)===((U=O==null?void 0:O.tab)==null?void 0:U.uuid)}),P=i?_t.findIndex(i[F].children,$=>{var U;return($==null?void 0:$.uuid)===((U=O==null?void 0:O.section)==null?void 0:U.uuid)}):-1,H=(N=i[F])==null?void 0:N.children[P];console.log("sectionData",H),H&&(H.isHidden=!1,console.log("sectionData",H),a(F,P,H))}),E[T].conditions=E[T].conditions.filter((O,F)=>x!==F),n(O=>({...O,conditionalSectionRules:{...O.conditionalSectionRules,rules:E}}))},m=(T,x,E)=>{var H,N;const _=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];_[x].conditions[E].section=T==null?void 0:T.value;const M=(N=(H=_[x].conditions[E])==null?void 0:H.tab)==null?void 0:N.uuid,O=_t.findIndex(i,$=>($==null?void 0:$.uuid)===M);n($=>({...$,conditionalSectionRules:{...$.conditionalSectionRules,rules:_}}));const F=i?_t.findIndex(i[O].children,$=>{var U;return($==null?void 0:$.uuid)===((U=T==null?void 0:T.value)==null?void 0:U.uuid)}):-1,P=i[O].children[F];P&&(P.isHidden=!0,a(O,F,P))},A=T=>{const x=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];x[T].conditions=[...x[T].conditions,{option:null,tab:{title:s==null?void 0:s.title,uuid:s==null?void 0:s.uuid},section:null}],n(E=>({...E,conditionalSectionRules:{...E.conditionalSectionRules,rules:x}}))},w=()=>{n(x=>({...x,conditionalSectionRules:{...x.conditionalSectionRules,rules:[...x.conditionalSectionRules.rules,{uuid:nt(),conditions:[]}]}}));const T=[...(u==null?void 0:u.conditionalSectionsRules)||[]];c({conditionalSectionsRules:[...T,{fieldId:e==null?void 0:e.uuid,uuid:nt(),conditions:[]}]})},C=T=>{var E;const x=i==null?void 0:i.filter(function(_){return(_==null?void 0:_.uuid)===(T==null?void 0:T.uuid)});if(x&&(x==null?void 0:x.length)>0){const _=(E=x[0])==null?void 0:E.children.filter(function(M){return(M==null?void 0:M.uuid)!==(r==null?void 0:r.uuid)});if((_==null?void 0:_.length)>0)return _}return l};return o.jsxs("div",{children:[o.jsx("h4",{children:"Conditional Sections"}),(S=e==null?void 0:e.conditionalSectionRules)==null?void 0:S.rules.map((T,x)=>o.jsx(Zr,{className:"mb-3",header:`Rule ${x+1}`,headerTemplate:E=>d(E,x),children:o.jsxs("div",{children:[T==null?void 0:T.conditions.map((E,_)=>{var M,O;return o.jsx("div",{className:"p-field pb-2",children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:"col-3 p-fluid",children:[o.jsx("label",{children:"In Tab"}),o.jsx("p",{children:(O=(M=E==null?void 0:E.tab)==null?void 0:M.title)==null?void 0:O.english})]}),o.jsxs("div",{className:"col-3 p-fluid",children:[o.jsxs("label",{children:["Select section",E.value]}),o.jsx(Pa,{disabled:!h(E==null?void 0:E.tab),value:E.section,options:C(E.tab),onChange:F=>m(F,x,_),optionLabel:"heading.english",placeholder:"Select option"})]}),o.jsxs("div",{className:"col-4 p-fluid",children:["when option is selected",o.jsx(Pa,{disabled:!h(E==null?void 0:E.tab),value:E==null?void 0:E.option,options:e==null?void 0:e.options,onChange:F=>g(F,x,_),optionLabel:"optionText.english",placeholder:"Select option"})]}),o.jsxs("div",{className:"col-1",children:[o.jsx("br",{}),o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>v(x,_),tooltipOptions:{position:"top"}})]}),!h(E.tab)&&o.jsx("div",{className:"col-12",children:o.jsxs("p",{className:"error",children:[" ","At least two or more sections should exist in a page"]})})]})},_)}),o.jsx("div",{children:o.jsx("div",{className:"flex",children:o.jsx(Ot,{text:!0,className:"btn-sm mt-3 ",label:"+ Add Condition",onClick:()=>A(x),size:"small"})})})]})},x)),o.jsx(Ot,{text:!0,icon:"pi pi-plus",onClick:()=>w(),className:"p-mt-4",label:"Add Rule",size:"small"})]})},nse=t=>{var u;const{fieldState:e,setFieldState:n}=t,r=d=>{var g;const h=[...((g=e==null?void 0:e.inlineConditionalRules)==null?void 0:g.rules)||[]].filter((v,m)=>d!==m);n(v=>({...v,inlineConditionalRules:{...v.inlineConditionalRules,rules:h}}))},i=(d,f)=>{const h=`${d.className} justify-content-start`,g=`${d.titleClassName} pl-1`;return o.jsxs("div",{className:h,children:[o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:d.togglerClassName,onClick:()=>r(f),"aria-label":"Submit"}),o.jsx("span",{className:g,children:`Rule ${f+1}`})]})},a=(d,f,h)=>{const g=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];g[f].conditions[h].value=d==null?void 0:d.value,n(v=>({...v,inlineConditionalRules:{...v.inlineConditionalRules,rules:g}}))},s=(d,f)=>{const h=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];h[d].conditions=h[d].conditions.filter((g,v)=>f!==v),n(g=>({...g,inlineConditionalRules:{...g.inlineConditionalRules,rules:h}}))},l=d=>{const f=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];f[d].conditions=[...f[d].conditions,{value:"",children:[]}],n(h=>({...h,inlineConditionalRules:{...h.inlineConditionalRules,rules:f}}))},c=()=>{n(d=>({...d,inlineConditionalRules:{...d.inlineConditionalRules,rules:[...d.inlineConditionalRules.rules,{conditions:[]}]}}))};return o.jsxs("div",{children:[o.jsx("h4",{children:"Inline Conditions"}),(u=e==null?void 0:e.inlineConditionalRules)==null?void 0:u.rules.map((d,f)=>o.jsx(Zr,{className:"mb-3",header:`Rule ${f+1}`,headerTemplate:h=>i(h,f),children:o.jsxs("div",{children:[d==null?void 0:d.conditions.map((h,g)=>o.jsx("div",{className:"p-field p-pt-2",children:o.jsxs("div",{className:"grid",children:[o.jsx("label",{className:"block",children:"Show when selected option is:"}),o.jsx("div",{className:" p-fluid col-11",children:o.jsx(Pa,{value:h.value,options:e==null?void 0:e.options,onChange:v=>a(v,f,g),optionLabel:"optionText.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-1",children:o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>s(f,g),tooltipOptions:{position:"top"}})})]})},"inline-rules-"+g)),o.jsx(Ot,{text:!0,onClick:()=>l(f),className:"p-mt-4",icon:"pi pi-plus",label:"Add Condition",size:"small"})]})},f)),o.jsx(Ot,{text:!0,onClick:()=>c(),className:"p-mt-4",icon:"pi pi-plus",label:"Add Rule",size:"small"})]})},rse=t=>{const{fieldState:e,pageIndex:n,section:r,setFieldState:i,page:a}=t,{pageSettingUpdate:s,formBuilderFormLayout:l,sectionSettingUpdate:c}=sn();return o.jsx(o.Fragment,{children:o.jsxs("div",{className:" scroll-height-250",children:[o.jsx(nse,{fieldState:e,setFieldState:i}),o.jsx("hr",{}),o.jsx(ese,{fieldState:e,setFieldState:i,pageIndex:n,formBuilderFormLayout:l,pageSettingUpdate:s}),o.jsx("hr",{}),o.jsx(tse,{fieldState:e,setFieldState:i,section:r,formBuilderFormLayout:l,sectionSettingUpdate:c,page:a}),o.jsx("hr",{})]})})},ise=t=>{const{fieldState:e,setFieldState:n}=t,[r,i]=k.useState(""),[a,s]=k.useState([""]),[l,c]=k.useState(!1),[u,d]=k.useState(0),[f,h]=k.useState(!1),{updateGlobalToast:g}=Ht(),v=()=>{h(!0)},m=()=>{var $;const H=(($=e==null?void 0:e.reviewerChecklist)==null?void 0:$.length)>=0?[...e.reviewerChecklist]:[];H.push({uuid:nt(),checklist:r,action:a,agree:null,selectAction:[],other:{isOther:!1,description:""},reviewerComments:""});const N={...e,reviewerChecklist:H};n(U=>({...U,...N})),h(!1),i(""),s([""])},A=()=>{h(!1),i(""),s([""])},w=H=>{const N=[...e.reviewerChecklist];N.splice(H,1);const $={...e,reviewerChecklist:N};n(U=>({...U,...$}))},C=(H,N)=>{c(!0);const{checklist:$,action:U}=H;h(!0),d(N),setTimeout(()=>{i($),s(U)},1e3)},S=(H,N)=>o.jsxs(o.Fragment,{children:[o.jsx(Ot,{text:!0,type:"button",className:"p-button-info",icon:"pi pi-pencil",onClick:()=>C(H,N==null?void 0:N.rowIndex)}),o.jsx(Ot,{text:!0,type:"button",className:"p-button-danger",icon:"pi pi-trash",onClick:()=>w(N==null?void 0:N.rowIndex)})]}),T=H=>{var N;return o.jsx(o.Fragment,{children:(N=H==null?void 0:H.action)==null?void 0:N.length})},x=H=>{const N=[...a];N.splice(H,1),s(N)},E=()=>{const H=[...e.reviewerChecklist];H[u]={checklist:r,action:a};const N={...e,reviewerChecklist:H};n($=>({...$,...N})),h(!1),c(!1)},_=()=>o.jsx("div",{children:l?o.jsx(Ot,{text:!0,className:"mb-5 p-button-success",label:"Edit Checklist",onClick:()=>{E()}}):o.jsx(Ot,{text:!0,className:"mb-5 p-button-success",label:"Add Checklist",onClick:()=>{m()}})}),M=H=>{n(N=>({...N,reviewerChecklist:H==null?void 0:H.value}))},O=H=>{navigator.clipboard.writeText(JSON.stringify(H))};function F(H){try{JSON.parse(H)}catch{return!1}return!0}const P=async()=>{var $;const H=await navigator.clipboard.readText();let N="";if(F(H)){const U=JSON.parse(H);if(($=U[0])!=null&&$.checklist){const le={..._t.cloneDeep(e),reviewerChecklist:U};n(G=>({...G,...le}));return}else N="Empty or Invalid Schema"}else N="Invalid Schema";g({showToast:!0,toastMessage:N,toastDetail:"",toastType:"error"})};return o.jsxs("div",{children:[o.jsx(Os,{maximizable:!0,header:"Add Checklist options for admin to reveiw",visible:f,style:{width:"30vw"},onHide:()=>A(),footer:_(),children:o.jsxs("div",{className:"scroll-height-500",children:[o.jsx("h5",{children:"Checklist"}),o.jsx(so,{rows:2,cols:50,value:r,onChange:H=>{var N;i((N=H==null?void 0:H.target)==null?void 0:N.value)}}),o.jsx("h5",{children:"Actions when admin selects NO as invalid"}),a.map((H,N)=>o.jsxs("div",{children:[N+1,"."," ",o.jsx(so,{value:H,onChange:$=>{var le;const U=[...a];U[N]=(le=$==null?void 0:$.target)==null?void 0:le.value,s(U)},rows:2,cols:50})," ",o.jsx(Ot,{text:!0,type:"button",icon:"pi pi-trash",className:"p-button-danger",onClick:()=>x(N)}),o.jsx("br",{}),o.jsx("br",{})]},`actionIndex-${N}`)),o.jsx(Ot,{outlined:!0,className:" p-button-primary mr-2",onClick:()=>{s([...a,""])},children:"Add Action"})]})})," ",o.jsx("h5",{children:"Reviewer Checklist"}),o.jsx(Ot,{className:"mb-5 mr-2 p-button-success",label:"Add Review Checklist",onClick:()=>{v()}}),o.jsx(Ot,{outlined:!0,label:"Copy Schema ",onClick:()=>{O([...(e==null?void 0:e.reviewerChecklist)||[]])},className:"mb-5 mr-2"}),o.jsx(Ot,{outlined:!0,label:"Paste Checklist ",onClick:()=>{P()},className:"mb-5 p-button-info"}),o.jsx("div",{className:"card",children:o.jsxs(ro,{value:e==null?void 0:e.reviewerChecklist,reorderableRows:!0,onRowReorder:M,scrollable:!0,children:[o.jsx(Sr,{rowReorder:!0,style:{width:"3em"}}),o.jsx(Sr,{field:"checklist",header:"Checklist"}),o.jsx(Sr,{field:"actions",header:"Actions",body:H=>T(H)}),o.jsx(Sr,{header:"",body:(H,N)=>S(H,N)})]})})]})},ase=t=>{const{onHandleChangeLayoutSettings:e,fieldState:n}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"isFieldAnFilterOption",checked:(n==null?void 0:n.isFieldAnFilterOption)||!1,onChange:r=>e("isFieldAnFilterOption",r.checked)}),o.jsx("label",{htmlFor:"isFieldAnFilterOption",children:"Is field an filter option to filter data"}),"     ",o.jsx(cn,{target:".isFieldAnFilterOption",content:"Make the field a filter for sorting data"}),o.jsx("i",{className:"isFieldAnFilterOption pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"isSortable",checked:(n==null?void 0:n.isSortable)||!1,onChange:r=>e("isSortable",r.checked)}),o.jsx("label",{htmlFor:"isSortable",children:"Enable sortable"}),"     ",o.jsx(cn,{target:".isSortable",content:"Make the field as column sortable"}),o.jsx("i",{className:"isSortable pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"isFilterable",checked:(n==null?void 0:n.isFilterable)||!1,onChange:r=>e("isFilterable",r.checked)}),o.jsx("label",{htmlFor:"isFilterable",children:"Enable filter"}),"     ",o.jsx(cn,{target:".isFilterable",content:"Filter the column data"}),o.jsx("i",{className:"isFilterable pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"resizableColumns",checked:n==null?void 0:n.resizableColumns,onChange:r=>e("resizableColumns",r.checked)}),o.jsx("label",{htmlFor:"resizableColumns",children:"Enable resizable columns"}),"     ",o.jsx(cn,{target:".resizableColumns",content:"Column width can be increase or decreased by dragging"}),o.jsx("i",{className:"resizableColumns pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"reorderableColumns",checked:n==null?void 0:n.reorderableColumns,onChange:r=>e("reorderableColumns",r.checked)}),o.jsx("label",{htmlFor:"reorderableColumns",children:"Enable reorderable columns"}),"     ",o.jsx(cn,{target:".reorderableColumns",content:"Column can ordered to show as first or last"}),o.jsx("i",{className:"reorderableColumns pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"colToggle",checked:(n==null?void 0:n.colToggle)||!1,onChange:r=>e("colToggle",r.checked)}),o.jsx("label",{htmlFor:"colToggle",children:"Enable column toggle"}),"     ",o.jsx(cn,{target:".colToggle",content:"Column can be shown and hide by settings by user"}),o.jsx("i",{className:"colToggle pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"freezeColumn",checked:(n==null?void 0:n.freezeColumn)||!1,onChange:r=>e("freezeColumn",r.checked)}),o.jsx("label",{htmlFor:"freezeColumn",children:"Enable freeze columns"}),"     ",o.jsx(cn,{target:".freezeColumn",content:"Column can sticky so the important can be in view all the time"}),o.jsx("i",{className:"freezeColumn pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]})]})},sse=t=>{var c,u,d;const{fieldState:e,setFieldState:n}=t,{formBuilderSchemaLanguages:r}=sn(),i=()=>{n(f=>Object.assign({},f,{options:[...f.options,{uuid:nt(),optionText:{english:""},value:"",score:0,hyperlinkText:{english:""},abbreviationText:{english:""},custom_values:{}}]}))},a=f=>{n(h=>({...h,fieldType:{...h==null?void 0:h.fieldType,type:f}}))},s=(f,h)=>{n(g=>({...g,[f]:h}))},l=[{label:"Employee",api:"/employees/list",availableId:["user_id","employee_id"],optionValue:"employee_id",optionLabel:"first_name"},{label:"Departments",api:"/department/",availableId:["department_id"],optionValue:"department_id",optionLabel:"department_name"}];return o.jsxs("div",{className:"p-fluid",children:[o.jsx("h4",{children:"Render Type"}),o.jsxs("div",{className:"flex flex-wrap gap-3 my-2",children:[o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"renderType1",name:"renderType",value:"radio",onChange:f=>{a(f==null?void 0:f.value)},checked:((c=e==null?void 0:e.fieldType)==null?void 0:c.type)==="radio"}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:"Radio"})]}),o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"renderType2",name:"renderType",value:"dropdown",onChange:f=>{a(f==null?void 0:f.value)},checked:((u=e==null?void 0:e.fieldType)==null?void 0:u.type)==="dropdown"}),o.jsx("label",{htmlFor:"ingredient2",className:"ml-2",children:"Dropdown"})]})]}),o.jsx("label",{htmlFor:"",className:"pb-2",children:"Data Source"}),o.jsxs("div",{className:"flex flex-wrap gap-3 mt-2",children:[o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"dataSourceType1",name:"dataSourceType",value:"custom",onChange:f=>{s("dataSourceType",f==null?void 0:f.value)},checked:(e==null?void 0:e.dataSourceType)==="custom"}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:"Custom"})]}),o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"dataSourceType2",name:"dataSourceType",value:"database",onChange:f=>{s("dataSourceType",f==null?void 0:f.value)},checked:(e==null?void 0:e.dataSourceType)==="database"}),o.jsx("label",{htmlFor:"ingredient2",className:"ml-2",children:"Database"})]})]}),(e==null?void 0:e.dataSourceType)==="database"&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Select Data Source"}),o.jsx("div",{children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:"col-6",children:[o.jsx("div",{className:"py-2",children:o.jsx("label",{children:"Datasources"})}),o.jsx(Pa,{value:e==null?void 0:e.dataSource,onChange:f=>{var h;s("optionLabel",(h=f.value)==null?void 0:h.optionLabel),s("dataSource",f.value)},options:l,placeholder:"Select a Data Source",className:"w-full "})]}),o.jsxs("div",{className:"col-6",children:[o.jsx("div",{className:"py-2",children:o.jsx("label",{htmlFor:"",className:"py-2",children:"Select Datasource Id"})}),o.jsx(Pa,{value:e==null?void 0:e.optionValue,onChange:f=>s("optionValue",f.value),options:(d=e==null?void 0:e.dataSource)==null?void 0:d.availableId,placeholder:"Source Id",className:"w-full "})]})]})})]}),(e==null?void 0:e.dataSourceType)==="custom"&&o.jsx(o.Fragment,{children:(e==null?void 0:e.options)!==void 0&&e.componentType!=="grid-component"&&e.componentType!=="matrix-dropdown"&&e.componentType!=="table"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"scroll-height-300 pt-5",children:o.jsx(ao,{activeIndex:0,children:r!=null&&r.length?r.map((f,h)=>o.jsx(io,{tabIndex:h,header:f==null?void 0:f.language,children:o.jsx(fN,{enableCopyPaste:!0,isCustomValue:!0,fieldState:e,setFieldState:n,language:f})},h)):""})}),o.jsx(Ot,{text:!0,className:"mr-3",label:"Add",icon:"pi pi-plus",onClick:()=>i(),"aria-label":"Add"})]})})]})},ose=t=>{var u,d;const{option:e,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a}=t,{userSelectedLanguage:s}=sn(),l=[{type:"radio",label:"Radio"},{type:"text",label:"Input Text"},{type:"text-area",label:"Text Area"},{type:"date",label:"Date Field"}],c=(f,h)=>{var g;return o.jsxs("div",{onClick:f.onClick,className:f.className,children:[o.jsx("span",{children:f.titleElement}),e.children&&((g=e.children)==null?void 0:g.length)>1&&o.jsx(Ot,{text:!0,icon:"pi pi-trash",size:"small",onClick:()=>{console.log("field",h==null?void 0:h.uuid),a(h==null?void 0:h.uuid)},"aria-label":"Filter"})]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"field-checkbox mt-3",children:[o.jsx(Yr,{inputId:"showConditionalFields",onChange:f=>{n(e==null?void 0:e.uuid,f.checked,{enableConditionalField:f.checked})},checked:e==null?void 0:e.enableConditionalField}),o.jsx("label",{htmlFor:"showConditionalFields",children:"Enable Conditional Field"})]}),(e==null?void 0:e.enableConditionalField)===!0&&o.jsxs(o.Fragment,{children:[o.jsx(Ot,{text:!0,label:"Add Field",onClick:()=>{i(e==null?void 0:e.uuid)}}),o.jsx(ss,{children:((u=e.children)==null?void 0:u.length)&&((d=e.children)==null?void 0:d.map((f,h)=>{var g,v;return o.jsx(Cr,{header:(g=f.label)==null?void 0:g[s==null?void 0:s.type],headerTemplate:m=>c(m,f),children:o.jsxs("div",{className:"card",children:[o.jsx("p",{children:"Choose Field Type"}),o.jsx("div",{className:"flex mb-3",children:(l==null?void 0:l.length)&&(l==null?void 0:l.map(m=>o.jsxs("div",{className:"mr-3",children:[o.jsx(ia,{inputId:"ingredient1",name:"fieldType",value:m==null?void 0:m.type,onChange:()=>r(f==null?void 0:f.uuid,{type:m==null?void 0:m.type}),checked:(f==null?void 0:f.type)===(m==null?void 0:m.type)}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:m==null?void 0:m.label})]},`field_type_${f==null?void 0:f.uuid}`)))}),o.jsxs("div",{className:"field-checkbox mt-3",children:[o.jsx(Yr,{inputId:"isRequired",onChange:m=>{r(f==null?void 0:f.uuid,{attributes:{required:m.checked}})},checked:(v=f==null?void 0:f.attributes)==null?void 0:v.required}),o.jsxs("label",{htmlFor:"showConditionalFields",children:["Is Required"," "]})]}),o.jsxs(ss,{children:[o.jsx(Cr,{header:"Text",children:o.jsx(Zr,{header:"Text Settings",toggleable:!0,collapsed:!0,children:o.jsx("div",{className:"",children:o.jsx(nD,{language:s,fieldState:f,onHandleChange:(m,A,w)=>{r(f==null?void 0:f.uuid,{[m]:{[A==null?void 0:A.type]:w}})}})})})}),(f==null?void 0:f.type)==="radio"&&o.jsx(Cr,{header:"Radio",children:o.jsx("div",{style:{width:"100%"},children:o.jsx(b7,{option:e,fieldState:f,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a})})})]})]})},`field-tab-${h}-${f==null?void 0:f.uuid}-${e==null?void 0:e.uuid}`)}))})]})]})},b7=t=>{var s,l;const{fieldState:e,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a}=t;return o.jsx(o.Fragment,{children:o.jsx(ss,{children:((s=e==null?void 0:e.options)==null?void 0:s.length)&&((l=e==null?void 0:e.options)==null?void 0:l.map((c,u)=>o.jsx(Cr,{header:`Option - ${c==null?void 0:c.label}`,children:o.jsx(ose,{option:c,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a})},`hirarchey-option-${u}`)))})})};var gN={},lse=Fi&&Fi.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),D3=Fi&&Fi.__assign||function(){return D3=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},D3.apply(this,arguments)},cse=Fi&&Fi.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),use=Fi&&Fi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mN=Fi&&Fi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&cse(e,t,n);return use(e,t),e},dse=Fi&&Fi.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},fse=Fi&&Fi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gN,"__esModule",{value:!0});var y7=mN(k),hse=fse(RI),Zu=mN(la);function vN(t){return t&&t.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>")}function pse(t){var e=document.createTextNode("");t.appendChild(e);var n=document.activeElement===t;if(e!==null&&e.nodeValue!==null&&n){var r=window.getSelection();if(r!==null){var i=document.createRange();i.setStart(e,e.nodeValue.length),i.collapse(!0),r.removeAllRanges(),r.addRange(i)}t instanceof HTMLElement&&t.focus()}}var gse=function(t){lse(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.lastHtml=n.props.html,n.el=typeof n.props.innerRef=="function"?{current:null}:y7.createRef(),n.getEl=function(){return(n.props.innerRef&&typeof n.props.innerRef!="function"?n.props.innerRef:n.el).current},n.emitChange=function(r){var i=n.getEl();if(i){var a=i.innerHTML;if(n.props.onChange&&a!==n.lastHtml){var s=Object.assign({},r,{target:{value:a}});n.props.onChange(s)}n.lastHtml=a}},n}return e.prototype.render=function(){var n=this,r=this.props,i=r.tagName,a=r.html,s=r.innerRef,l=dse(r,["tagName","html","innerRef"]);return y7.createElement(i||"div",D3(D3({},l),{ref:typeof s=="function"?function(c){s(c),n.el.current=c}:s||this.el,onInput:this.emitChange,onBlur:this.props.onBlur||this.emitChange,onKeyUp:this.props.onKeyUp||this.emitChange,onKeyDown:this.props.onKeyDown||this.emitChange,contentEditable:!this.props.disabled,dangerouslySetInnerHTML:{__html:a}}),this.props.children)},e.prototype.shouldComponentUpdate=function(n){var r=this.props,i=this.getEl();return!i||vN(n.html)!==vN(i.innerHTML)?!0:r.disabled!==n.disabled||r.tagName!==n.tagName||r.className!==n.className||r.innerRef!==n.innerRef||r.placeholder!==n.placeholder||!(0,hse.default)(r.style,n.style)},e.prototype.componentDidUpdate=function(){var n=this.getEl();n&&(this.props.html!==n.innerHTML&&(n.innerHTML=this.props.html),this.lastHtml=this.props.html,pse(n))},e.propTypes={html:Zu.string.isRequired,onChange:Zu.func,disabled:Zu.bool,tagName:Zu.string,className:Zu.string,style:Zu.object,innerRef:Zu.oneOfType([Zu.object,Zu.func])},e}(y7.Component),N3=gN.default=gse;const mse=t=>{var w;const e=k.useRef(null),{field:n,fieldIndex:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:l,path:c}=t,[u,d]=k.useState(n),{userSelectedLanguage:f,fieldSettingUpdate:h,fieldSettingUpdateInlineConditional:g,gridComponentFieldSettingUpdate:v}=sn(),m=(C,S,T)=>{d(x=>({...x,[C]:{...x[C],[S==null?void 0:S.type]:T}}))};k.useEffect(()=>(A(),()=>{}),[u]);const A=()=>{const C=c.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?g(C[fa],C[ha],C[Ca],C[xa],C[Ta],C[Fa],C[Go],C[wo],u):(C==null?void 0:C.length)>Fa&&(C==null?void 0:C.length)===Vl+1&&(n!=null&&n.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?v(C[fa],C[ha],C[Ca],C[xa],C[Ta],C[5],C[6],C[7],u):h(i,a,s,l,r,{...n,label:u==null?void 0:u.label})};return o.jsx(o.Fragment,{children:o.jsx(N3,{style:{display:"inline-block"},className:"builder-input-label-edit",innerRef:e,html:(w=n==null?void 0:n.label)==null?void 0:w[f==null?void 0:f.type],disabled:!1,onChange:C=>{var S;m("label",f,(S=C==null?void 0:C.target)==null?void 0:S.value)},tagName:"article"})})},ca=t=>{const{sectionIndex:e,fieldIndex:n}=t,{formBuilderFormSchema:r}=sn();return(r==null?void 0:r.enableFieldEnumeration)===!0?o.jsx("span",{className:"mr-2",children:o.jsx(F8,{classes:"font-medium p-1 bg-primary",level:"purple",value:`${e+1}.${n+1}`})}):o.jsx(o.Fragment,{})},A7=t=>{var f,h,g,v,m,A,w,C,S,T,x,E,_,M;const{field:e,update:n,value:r,isFirst:i,isDisabled:a}=t,{isBuilderMode:s,isAdmin:l}=Ht(),{selectedLanguage:c}=sn(),[u,d]=k.useState(0);return k.useEffect(()=>{const O=Rt.addListener("onSubmitUserForm",()=>{var P;(P=e==null?void 0:e.attributes)!=null&&P.required?r!=null&&r[e.uuid]?e.isValid=t3:e.isValid=D8:e.isValid=1}),F=Rt.addListener("OnInvalidFieldCatch",P=>{(e==null?void 0:e.uuid)===(P==null?void 0:P.fieldId)?d(N8):d(O8)});return()=>{O.remove(),F.remove()}}),o.jsxs("div",{className:"",children:[(e==null?void 0:e.type)===yZ&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex align-items-center mb-3",children:[" ",i===!0&&o.jsx(ca,{...t}),((f=e==null?void 0:e.attributes)==null?void 0:f.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",s?o.jsx(mse,{...t}):o.jsx("div",{className:"text-gray-900 font-bold text-xl",children:(h=e==null?void 0:e.label)==null?void 0:h[c]})]}),((g=e==null?void 0:e.options)==null?void 0:g.length)&&((v=e==null?void 0:e.options)==null?void 0:v.map(O=>{var F,P;return o.jsxs("div",{children:[o.jsxs("div",{className:"flex align-items-center mb-2",children:[o.jsx(ia,{inputId:O.uuid,name:e==null?void 0:e.uuid,value:O.uuid,onChange:H=>{(!l||!a)&&n(e==null?void 0:e.uuid,H==null?void 0:H.value)},checked:(r==null?void 0:r[e.uuid])===O.uuid,disabled:l||a}),o.jsx("label",{htmlFor:O.uuid,className:"ml-2",children:O.label})]}),(O==null?void 0:O.enableConditionalField)===!0&&(r==null?void 0:r[e==null?void 0:e.uuid])===(O==null?void 0:O.uuid)&&(O==null?void 0:O.children)&&((F=O==null?void 0:O.children)==null?void 0:F.length)>0&&((P=O==null?void 0:O.children)==null?void 0:P.map(()=>o.jsx(A7,{...t},`radio_child_${r==null?void 0:r[e==null?void 0:e.uuid]}`)))]},`${O.uuid}-radio-wrapper-${e==null?void 0:e.uuid}`)}))]}),(e==null?void 0:e.type)===AZ&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((m=e==null?void 0:e.attributes)==null?void 0:m.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[c]]}),o.jsx(wn,{className:"mt-2",onChange:O=>{var F;return n(e==null?void 0:e.uuid,(F=O==null?void 0:O.target)==null?void 0:F.value)},value:r==null?void 0:r.uuid,placeholder:(A=e==null?void 0:e.placeholder)==null?void 0:A[c],disabled:l||a})]})}),(e==null?void 0:e.type)===wZ&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((w=e==null?void 0:e.attributes)==null?void 0:w.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[c]]}),o.jsx(ef,{className:"mt-2",onChange:O=>{var F;return n(e==null?void 0:e.uuid,(F=O==null?void 0:O.target)==null?void 0:F.value)},value:r==null?void 0:r.uuid,placeholder:(C=e==null?void 0:e.placeholder)==null?void 0:C[c],disabled:l||a})]})}),(e==null?void 0:e.type)===SZ&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[c]]}),o.jsx(so,{className:"mt-2",onChange:O=>{var F;return n(e==null?void 0:e.uuid,(F=O==null?void 0:O.target)==null?void 0:F.value)},value:r==null?void 0:r.uuid,placeholder:(T=e==null?void 0:e.placeholder)==null?void 0:T[c],disabled:l||a})]})}),o.jsx("div",{children:((x=e==null?void 0:e.helperText)==null?void 0:x[c])!==""&&o.jsx("small",{children:(E=e==null?void 0:e.helperText)==null?void 0:E[c]})}),o.jsx("div",{children:((_=e==null?void 0:e.attributes)==null?void 0:_.required)&&o.jsx("small",{className:"error",children:u===1&&!(r!=null&&r[e.uuid])?(M=e==null?void 0:e.validationMesssage)==null?void 0:M.language:""})})]},`${e==null?void 0:e.uuid}-radio`)},vse=t=>{const{hirarechicalRadioSchemaState:e}=t,[n,r]=k.useState({});return o.jsx("div",{children:o.jsx(A7,{schema:e,field:e,update:(i,a)=>{const s={...n};s[i]=a,r(s)},value:n,sectionIndex:0,fieldIndex:0,pageIndex:0,rowIndex:0,columnIndex:0,path:""})})},w7={showHeaderText:!1,showHelperText:!1,showToolTip:!1,showLabel:!0,label:{english:"Field label"},abbreviationLabel:{english:""},helperText:{english:"Helper Text"},guidelines:{english:""},headerText:{english:"Header text"},textTable:{english:""},toolTip:{english:""},validationMesssage:{english:"This field is required"},placeholder:{english:""},enableConditionalField:!0},bse={uuid:nt(),...w7,type:"radio",value:null,options:[{uuid:nt(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:nt(),label:"No",value:null,enableConditionalField:!0,children:[]}]};({uuid:nt(),...w7,options:(nt(),{uuid:nt(),...w7,options:(nt(),nt())},nt())});const yse=t=>{const{fieldState:e,setFieldState:n}=t,r=(f,h,g)=>g==null?void 0:g.map(v=>{var m;return v.uuid===f?{...v,...h}:{...v,children:v!=null&&v.children&&((m=v==null?void 0:v.children)==null?void 0:m.length)>0?[...v.children.map(A=>A.type==="radio"?{...A,options:r(f,h,(A==null?void 0:A.options)||[])}:{...A})]:[]}}),i=(f,h,g)=>{const v=r(f,g,e.options);n(m=>({...m,options:v}))},a=(f,h,g)=>g==null?void 0:g.map(v=>{var m;return{...v,children:v!=null&&v.children&&((m=v==null?void 0:v.children)==null?void 0:m.length)>0?[...v.children.map(A=>A.uuid===f?{...A,...h}:{...A,options:a(f,h,A==null?void 0:A.options)})]:[]}}),s=(f,h)=>{const g=a(f,h,e.options);n(v=>({...v,options:g}))},l=(f,h)=>h==null?void 0:h.map(g=>{var v;return{...g,children:g!=null&&g.children&&((v=g==null?void 0:g.children)==null?void 0:v.length)>0?[...g.children.filter(m=>{if(m.uuid!==f)return{...m,options:l(f,m==null?void 0:m.options)}})]:[]}}),c=(f,h,g)=>g==null?void 0:g.map(v=>{var m;return v.children&&v.uuid===f?{...v,children:[...v.children,h]}:{...v,children:v!=null&&v.children&&((m=v==null?void 0:v.children)==null?void 0:m.length)>0?[...v.children.map(A=>({...A,options:c(f,h,A==null?void 0:A.options)}))]:[]}}),u=f=>{const h=c(f,{...bse,isValid:0,uuid:nt(),options:[{uuid:nt(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:nt(),label:"No",value:null,enableConditionalField:!0,children:[]}],isPostField:!1,showAlphabetList:!1,showButtonLayout:!1,answerOptions:[],isExternalSource:!1,underLined:!1,noOfMultpleAnswer:void 0,isAllowMultipleAnswer:!1,isIcon:!1,isTodayBtn:!1,resizableColumns:!1,isFilterable:!1,freezeColumn:!1,colToggle:!1,isFieldAnFilterOption:!1,isSortable:!1,reorderableColumns:!1,timeLimit:0,score:0,subject_id:0,course_category_id:0,TextEditorProps:!1,fieldData:void 0},e.options);n(g=>({...g,options:h}))},d=f=>{const h=l(f,e.options);n(g=>({...g,options:h}))};return o.jsx("div",{children:o.jsx("div",{className:" px-4",children:o.jsxs("div",{className:"grid",children:[o.jsx("div",{className:"col-6 scroll-height-200",children:(e==null?void 0:e.isHierarchalCondionalTabEnabled)===!0&&o.jsx(b7,{fieldState:e,updateCondtionOption:i,updateChildrenField:s,addChildrenField:u,removeChildrenField:d})}),o.jsxs("div",{className:"col-6 p-3 scroll-height-200",children:[o.jsx("h4",{className:"flex justify-content-center align-items-center",children:"Preview"}),o.jsx(vse,{hirarechicalRadioSchemaState:e})]})]})})})},Qi=t=>{var Z;const{formBuilderFormSchema:e,fieldSettingUpdate:n,fieldSettingUpdateInlineConditional:r,formBuilderSchemaLanguages:i,pageSettingUpdate:a,formBuilderFormLayout:s,formBuilderPublishedStatus:l,gridComponentFieldSettingUpdate:c}=sn(),{renderType:u}=Ht(),{visibilty:d,field:f,closeSettingFieldSidebar:h,pageIndex:g,sectionIndex:v,rowIndex:m,columnIndex:A,fieldIndex:w,path:C,row:S,typeName:T}=t,{updateGlobalToast:x}=Ht(),[E,_]=k.useState(f),M=C.split("-"),O=()=>{const K=C.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?r(K[fa],K[ha],K[Ca],K[xa],K[Ta],K[Fa],K[Go],K[wo],E):(K==null?void 0:K.length)>Fa&&(K==null?void 0:K.length)===Vl+1&&(E!=null&&E.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?c(K[fa],K[ha],K[Ca],K[xa],K[Ta],K[5],K[6],K[7],E):(n(g,v,m,A,w,{...E}),setTimeout(()=>{Rt.emit("OnSignatureSettingChange",{})},1e3),setTimeout(()=>{Rt.emit("onUpdateField",{})},1e3)),x({showToast:!0,toastMessage:"Updated",toastDetail:`${T} updated`,toastType:"success"})},F=(K,W,ge)=>{_(ve=>({...ve,[K]:{...ve[K],[W==null?void 0:W.type]:ge}}))},P=(K,W)=>{_(ge=>({...ge,attributes:{...ge.attributes,[K]:W}}))},H=(K,W)=>{_(ge=>({...ge,[K]:W}))},N=(K,W)=>{_(ge=>({...ge,inlineConditional:{...ge.inlineConditional,[K]:W}}))},$=()=>{},U=()=>{_(K=>({...K,data:[...K.data,{uuid:nt(),dataKey:"",value:""}]}))},le=()=>{_(K=>Object.assign({},K,{options:[...K.options,{uuid:nt(),optionText:{english:""},value:"",score:0,hyperlinkText:{english:""},abbreviationText:{english:""},custom_values:{}}]}))},G=()=>{},X=()=>{},ce=()=>{},Y=()=>{},ae=K=>{var Ie;const W=[...(E==null?void 0:E.conditionalTabRules.rules)||[]],ge=W.filter((be,de)=>K!==de);_(be=>({...be,conditionalTabRules:{...be.conditionalTabRules,rules:ge}}));const ve=W[K];(Ie=ve==null?void 0:ve.conditions)==null||Ie.map(be=>{const de=_t.findIndex(s,q=>{var ee;return(q==null?void 0:q.uuid)===((ee=be==null?void 0:be.tab)==null?void 0:ee.uuid)}),ne=s[de];ne&&(ne.isHidden=!1,a(de,ne))})},re=(K,W)=>{const ge=[...(E==null?void 0:E.conditionalTabRules.rules)||[]];ge[K].conditions=ge[K].conditions.filter((ve,Ie)=>W!==Ie),_(ve=>({...ve,conditionalTabRules:{...ve.conditionalTabRules,rules:ge}}))};return o.jsx(o.Fragment,{children:o.jsxs(To,{style:{width:"80vw",zIndex:7e3},visible:d,position:"left",className:"p-sidebar-lg",onHide:()=>h(),header:()=>{var K;return o.jsx("div",{className:"flex align-items-center gap-2 justify-content-between",children:o.jsxs("div",{className:"text-gray-900 font-bold text-2xl",children:[(K=f==null?void 0:f.label)==null?void 0:K.english," "]})})},"aria-label":"Field Setting Sidebar",children:[o.jsx("div",{className:"",children:o.jsxs(ss,{children:[o.jsx(Cr,{header:"Text",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(ao,{activeIndex:0,children:i!=null&&i.length?i.map((K,W)=>o.jsx(io,{tabIndex:W,header:K==null?void 0:K.language,children:o.jsx(nD,{language:K,fieldState:E,onHandleChange:F,...t})},W)):""})})}),(E==null?void 0:E.isValidationTabEnabled)===!0&&o.jsx(Cr,{header:"Validation",children:o.jsx(xte,{fieldState:E,onHandleChangeLayoutSettings:H,onHandleChangeAttributesSetttings:P,...t})}),o.jsx(Cr,{header:"Attributes",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(Tte,{fieldState:E,onHandleChangeLayoutSettings:H,onHandleChangeAttributesSetttings:P})})}),(E==null?void 0:E.isLayoutTabEnabled)===!0&&o.jsx(Cr,{header:"Layout",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(Bte,{fieldState:E,onHandleChangeLayoutSettings:H})})}),(E==null?void 0:E.isDynamicListingTabEnabled)===!0&&o.jsx(Cr,{header:"Dynamic Options",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(sse,{fieldState:E,setFieldState:_})})}),(E==null?void 0:E.options)!==void 0&&(E==null?void 0:E.data)&&o.jsx(Cr,{header:"Data",children:o.jsxs("div",{className:"scroll-height-200",children:[o.jsx(Vte,{onHandleChangeLayoutSettings:H,fieldState:E,setFieldState:_}),o.jsx(Ot,{className:"mr-3",label:"Data Option",icon:"pi pi-plus",onClick:()=>U(),"aria-label":"Add"})]})}),o.jsx(Cr,{header:"Table view options",children:o.jsx(ase,{fieldState:E,onHandleChangeLayoutSettings:H})}),(E==null?void 0:E.componentType)!=="radio-hierarchal"&&(E==null?void 0:E.options)!==void 0&&f.componentType!=="grid-component"&&f.componentType!=="matrix-dropdown"&&f.componentType!=="table"&&o.jsxs(Cr,{header:"Options",children:[(E==null?void 0:E.componentType)!=="radio-hierarchal"&&o.jsx("div",{className:"flex justify-content-end",children:o.jsx(Ot,{className:"mr-3 mb-2",label:"Option",icon:"pi pi-plus",onClick:()=>le(),"aria-label":"Option"})}),o.jsxs("div",{className:"scroll-height-200 px-4",children:[o.jsx(ao,{activeIndex:0,children:i!=null&&i.length?i.map((K,W)=>o.jsx(io,{tabIndex:W,header:K==null?void 0:K.language,children:o.jsx(fN,{enableAbbreviationColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableHyperTextColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableAddNewColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableCopyPaste:(E==null?void 0:E.componentType)!=="radio-hierarchal",isCustomValue:!1,fieldState:E,setFieldState:_,language:K})},W)):""}),(E==null?void 0:E.isHierarchalCondionalTabEnabled)===!0&&o.jsx(b7,{fieldState:E,onHandleChangeLayoutSettings:H,removeChildrenField:Y,addChildrenField:ce,updateChildrenField:X,updateCondtionOption:G})]})]}),(E==null?void 0:E.componentType)==="radio-hierarchal"&&(E==null?void 0:E.options)!==void 0&&f.componentType!=="grid-component"&&f.componentType!=="matrix-dropdown"&&f.componentType!=="table"&&o.jsx(Cr,{header:"Hierarchal Options",children:o.jsx(yse,{fieldState:E,setFieldState:_})}),u===e3&&(E==null?void 0:E.inlineConditionalRules)!==void 0&&!(S!=null&&S.rowIsRepeatable)&&(M==null?void 0:M.length)<wo+1&&o.jsx(Cr,{header:"Conditional",children:o.jsx(rse,{handleRemoveConditionalTabRule:ae,handleRemoveConditionalTabRuleCondition:re,onHandleSelectInlineConditionalOption:$,onHandleChangeLayoutSettings:H,onHandleChangeInlineConditionaltSetttings:N,fieldState:E,setFieldState:_,pageIndex:g,sectionIndex:v,...t})}),!((Z=t==null?void 0:t.row)!=null&&Z.rowIsRepeatable)&&(e==null?void 0:e.enableReviewTask)===!0&&o.jsx(Cr,{header:"Admin reviewer checklist",children:o.jsx(ise,{fieldState:E,setFieldState:_})})]})}),o.jsx("div",{className:"w-full px-4 py-3 surface-100 sidebar-footer",children:o.jsxs("div",{className:"flex flex-row gap-2 align-items-center justify-content-end",children:[o.jsx(Ot,{text:!0,label:"Close",type:"button",icon:"pi pi-times",onClick:()=>h(),"aria-label":"Close",size:"small",className:"p-button-danger"}),!l&&o.jsx(Ot,{size:"small",label:"Update",type:"button",outlined:!0,onClick:()=>O(),"aria-label":"Update"})]})})]})})},ki=t=>{const[e,n]=k.useState(null),{field:r}=t,{userTaskSubmitFormData:i,updateUserFormDataSubmit:a}=mr();k.useEffect(()=>{var h,g;if(i!==null&&e===null){let v=0;r!=null&&r.rowIsRepeatable?v=i.findIndex(m=>(m==null?void 0:m.rowId)===(r==null?void 0:r.uuid)):v=i.findIndex(m=>(m==null?void 0:m.fieldId)===(r==null?void 0:r.uuid)),n((h=i[v])!=null&&h.reviewerChecklist?(g=i[v])==null?void 0:g.reviewerChecklist:[])}return()=>{}},[r==null?void 0:r.rowIsRepeatable,r==null?void 0:r.uuid,e,i]);const s=h=>{const g=i.findIndex(m=>(m==null?void 0:m.fieldId)===(r==null?void 0:r.uuid)),v=[...i];v[g]={...v[g],reviewerChecklist:h},a(v)},l=(h,g)=>{const v=e;v[g]={...v[g],agree:h==null?void 0:h.value},n([...v]),s(v)},c=(h,g)=>{const v=e;if(g!=null&&g.checked)v[h].selectAction.push(g==null?void 0:g.value);else{const m=v[h].selectAction.findIndex(A=>A===(g==null?void 0:g.value));v[h].selectAction.splice(m,1)}n([...v]),s(v)},u=(h,g)=>{const v=e;h!=null&&h.checked?v[g]={...v[g],other:{...v[g].other,isOther:!0}}:v[g]={...v[g],other:{...v[g].other,isOther:!1}},n([...v]),s(v)},d=(h,g)=>{var m;const v=e;v[g]={...v[g],other:{...v[g].other,description:(m=h==null?void 0:h.target)==null?void 0:m.value}},n([...v]),s(v)},f=(h,g,v)=>{var A;const m=e;m[v]={...m[v],[g]:(A=h==null?void 0:h.target)==null?void 0:A.value},n([...m]),s(m)};return o.jsx(o.Fragment,{children:e!==null&&(e==null?void 0:e.length)>0?o.jsx(o.Fragment,{children:o.jsx(Zr,{header:"Reviewer Checklist",toggleable:!0,collapsed:!0,children:o.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:e==null?void 0:e.map((h,g)=>{var v,m,A,w,C;return o.jsxs("div",{className:"card p-fluid",style:{width:250},children:[o.jsx("h6",{className:"mb-2",children:h==null?void 0:h.checklist}),o.jsx("br",{}),o.jsxs("div",{className:"flex flex-row gap-3 mb-2",children:[o.jsxs("div",{className:"field-radiobutton",children:[o.jsx(ia,{inputId:`yes-${g}`,name:"action",value:!0,onChange:S=>{l(S,g)},checked:(h==null?void 0:h.agree)===!0}),o.jsx("label",{htmlFor:`yes-${g}`,children:"Yes"})]}),o.jsxs("div",{className:"field-radiobutton",children:[o.jsx(ia,{inputId:`no-${g}`,name:"action",value:!1,onChange:S=>{l(S,g)},checked:(h==null?void 0:h.agree)===!1}),o.jsx("label",{htmlFor:`no-${g}`,children:"No"})]})]}),(h==null?void 0:h.agree)===!1&&o.jsxs("div",{className:"px-5 mb-3",children:[(h==null?void 0:h.action)&&Array.isArray(h.action)&&((v=h==null?void 0:h.action)==null?void 0:v.length)>0&&((m=h==null?void 0:h.action)==null?void 0:m.map((S,T)=>{var x;return o.jsxs("div",{children:[o.jsx(Yr,{value:S,checked:((x=h==null?void 0:h.selectAction)==null?void 0:x.length)>0?h==null?void 0:h.selectAction.some(E=>E===S):!1,onChange:E=>{c(g,E)}})," ",S," ",o.jsx("br",{}),o.jsx("br",{})]},`action-${g}-${T}`)})),o.jsx(Yr,{checked:(A=h==null?void 0:h.other)==null?void 0:A.isOther,onChange:S=>{u(S,g)}})," Other ",o.jsx("br",{}),o.jsx("br",{}),((w=h==null?void 0:h.other)==null?void 0:w.isOther)===!0&&o.jsxs("div",{className:"",children:[o.jsx("label",{children:"If other please specify the action point"}),o.jsx("br",{}),o.jsx(so,{className:"mt-3",value:(C=h==null?void 0:h.other)==null?void 0:C.description,onChange:S=>d(S,g)})]})]}),(h==null?void 0:h.agree)===!1&&o.jsxs("div",{className:"",children:[o.jsx("label",{children:"Reviewer Feedback "}),o.jsx("br",{}),o.jsx(so,{className:"mt-3",value:h==null?void 0:h.reviewerFeedback,onChange:S=>f(S,"reviewerFeedback",g)})]}),o.jsxs("div",{className:"",children:[o.jsx("label",{children:"Reviewer Comments / Notes (internal use only)"}),o.jsx("br",{}),o.jsx(so,{className:"mt-3",value:h==null?void 0:h.reviewerComments,onChange:S=>f(S,"reviewerComments",g)})]})]},`checklistIndex-${g}`)})})})}):o.jsx(o.Fragment,{})})},xi=t=>{const{isPreview:e,field:n,isAdmin:r,fieldWrap:i}=t,{userSelectedLanguage:a}=sn(),{globalAlignment:s}=Ht(),l=g=>{const v=g.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",m=`${g.className} justify-content-start`,A=`${g.titleClassName} pl-1`;return o.jsxs("div",{className:m,children:[o.jsxs("button",{className:g.togglerClassName,onClick:g.onTogglerClick,children:[o.jsx("span",{className:v}),o.jsx(Qt,{})]}),o.jsx("span",{className:A,children:d})]})},{TASK_PUBLISHED:c,task_status:u}=mr(),[d,f]=k.useState("");k.useEffect(()=>{var g;f((g=n==null?void 0:n.label)==null?void 0:g[a==null?void 0:a.type])},[n,a==null?void 0:a.type]);const h=()=>{let g="";return e||(g=g+" field-form-builder"),u===c&&r===!0&&(g=g+" card"),g};return o.jsx(o.Fragment,{children:o.jsx("div",{dir:s,className:h(),children:u===c&&r===!0?o.jsx(Zr,{headerTemplate:l,toggleable:!0,children:i}):i})})};/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:bN,setPrototypeOf:yN,isFrozen:Ase,getPrototypeOf:wse,getOwnPropertyDescriptor:Sse}=Object;let{freeze:Eo,seal:zl,create:AN}=Object,{apply:S7,construct:C7}=typeof Reflect<"u"&&Reflect;Eo||(Eo=function(e){return e}),zl||(zl=function(e){return e}),S7||(S7=function(e,n,r){return e.apply(n,r)}),C7||(C7=function(e,n){return new e(...n)});const O3=vl(Array.prototype.forEach),wN=vl(Array.prototype.pop),Jp=vl(Array.prototype.push),F3=vl(String.prototype.toLowerCase),x7=vl(String.prototype.toString),SN=vl(String.prototype.match),Zp=vl(String.prototype.replace),Cse=vl(String.prototype.indexOf),xse=vl(String.prototype.trim),Tc=vl(Object.prototype.hasOwnProperty),Io=vl(RegExp.prototype.test),e2=Tse(TypeError);function vl(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S7(t,e,r)}}function Tse(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return C7(t,n)}}function hi(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:F3;yN&&yN(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const a=n(i);a!==i&&(Ase(e)||(e[r]=a),i=a)}t[i]=!0}return t}function Ese(t){for(let e=0;e<t.length;e++)Tc(t,e)||(t[e]=null);return t}function J0(t){const e=AN(null);for(const[n,r]of bN(t))Tc(t,n)&&(Array.isArray(r)?e[n]=Ese(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=J0(r):e[n]=r);return e}function t2(t,e){for(;t!==null;){const r=Sse(t,e);if(r){if(r.get)return vl(r.get);if(typeof r.value=="function")return vl(r.value)}t=wse(t)}function n(){return null}return n}const CN=Eo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T7=Eo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),E7=Eo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ise=Eo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),I7=Eo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_se=Eo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xN=Eo(["#text"]),TN=Eo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),_7=Eo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),EN=Eo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),k3=Eo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Dse=zl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Nse=zl(/<%[\w\W]*|[\w\W]*%>/gm),Ose=zl(/\${[\w\W]*}/gm),Fse=zl(/^data-[\-\w.\u00B7-\uFFFF]/),kse=zl(/^aria-[\-\w]+$/),IN=zl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pse=zl(/^(?:\w+script|data):/i),Mse=zl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_N=zl(/^html$/i),Lse=zl(/^[a-z][.\w]*(-[.\w]+)+$/i);var DN=Object.freeze({__proto__:null,MUSTACHE_EXPR:Dse,ERB_EXPR:Nse,TMPLIT_EXPR:Ose,DATA_ATTR:Fse,ARIA_ATTR:kse,IS_ALLOWED_URI:IN,IS_SCRIPT_OR_DATA:Pse,ATTR_WHITESPACE:Mse,DOCTYPE_NAME:_N,CUSTOM_ELEMENT:Lse});const n2={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Bse=function(){return typeof window>"u"?null:window},Vse=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function NN(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bse();const e=It=>NN(It);if(e.version="3.1.7",e.removed=[],!t||!t.document||t.document.nodeType!==n2.document)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:g}=t,v=c.prototype,m=t2(v,"cloneNode"),A=t2(v,"remove"),w=t2(v,"nextSibling"),C=t2(v,"childNodes"),S=t2(v,"parentNode");if(typeof s=="function"){const It=n.createElement("template");It.content&&It.content.ownerDocument&&(n=It.content.ownerDocument)}let T,x="";const{implementation:E,createNodeIterator:_,createDocumentFragment:M,getElementsByTagName:O}=n,{importNode:F}=r;let P={};e.isSupported=typeof bN=="function"&&typeof S=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:N,TMPLIT_EXPR:$,DATA_ATTR:U,ARIA_ATTR:le,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:X,CUSTOM_ELEMENT:ce}=DN;let{IS_ALLOWED_URI:Y}=DN,ae=null;const re=hi({},[...CN,...T7,...E7,...I7,...xN]);let Z=null;const K=hi({},[...TN,..._7,...EN,...k3]);let W=Object.seal(AN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ge=null,ve=null,Ie=!0,be=!0,de=!1,ne=!0,q=!1,ee=!0,oe=!1,pe=!1,Ce=!1,De=!1,me=!1,Te=!1,Pe=!0,Ee=!1;const j="user-content-";let he=!0,ye=!1,se={},fe=null;const Ae=hi({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ne=null;const Le=hi({},["audio","video","img","source","image","track"]);let ze=null;const tt=hi({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),it="http://www.w3.org/1998/Math/MathML",ht="http://www.w3.org/2000/svg",Ut="http://www.w3.org/1999/xhtml";let fn=Ut,$t=!1,mn=null;const En=hi({},[it,ht,Ut],x7);let Tt=null;const je=["application/xhtml+xml","text/html"],He="text/html";let ot=null,rn=null;const nn=n.createElement("form"),Jt=function(Fe){return Fe instanceof RegExp||Fe instanceof Function},_n=function(){let Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rn&&rn===Fe)){if((!Fe||typeof Fe!="object")&&(Fe={}),Fe=J0(Fe),Tt=je.indexOf(Fe.PARSER_MEDIA_TYPE)===-1?He:Fe.PARSER_MEDIA_TYPE,ot=Tt==="application/xhtml+xml"?x7:F3,ae=Tc(Fe,"ALLOWED_TAGS")?hi({},Fe.ALLOWED_TAGS,ot):re,Z=Tc(Fe,"ALLOWED_ATTR")?hi({},Fe.ALLOWED_ATTR,ot):K,mn=Tc(Fe,"ALLOWED_NAMESPACES")?hi({},Fe.ALLOWED_NAMESPACES,x7):En,ze=Tc(Fe,"ADD_URI_SAFE_ATTR")?hi(J0(tt),Fe.ADD_URI_SAFE_ATTR,ot):tt,Ne=Tc(Fe,"ADD_DATA_URI_TAGS")?hi(J0(Le),Fe.ADD_DATA_URI_TAGS,ot):Le,fe=Tc(Fe,"FORBID_CONTENTS")?hi({},Fe.FORBID_CONTENTS,ot):Ae,ge=Tc(Fe,"FORBID_TAGS")?hi({},Fe.FORBID_TAGS,ot):{},ve=Tc(Fe,"FORBID_ATTR")?hi({},Fe.FORBID_ATTR,ot):{},se=Tc(Fe,"USE_PROFILES")?Fe.USE_PROFILES:!1,Ie=Fe.ALLOW_ARIA_ATTR!==!1,be=Fe.ALLOW_DATA_ATTR!==!1,de=Fe.ALLOW_UNKNOWN_PROTOCOLS||!1,ne=Fe.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=Fe.SAFE_FOR_TEMPLATES||!1,ee=Fe.SAFE_FOR_XML!==!1,oe=Fe.WHOLE_DOCUMENT||!1,De=Fe.RETURN_DOM||!1,me=Fe.RETURN_DOM_FRAGMENT||!1,Te=Fe.RETURN_TRUSTED_TYPE||!1,Ce=Fe.FORCE_BODY||!1,Pe=Fe.SANITIZE_DOM!==!1,Ee=Fe.SANITIZE_NAMED_PROPS||!1,he=Fe.KEEP_CONTENT!==!1,ye=Fe.IN_PLACE||!1,Y=Fe.ALLOWED_URI_REGEXP||IN,fn=Fe.NAMESPACE||Ut,W=Fe.CUSTOM_ELEMENT_HANDLING||{},Fe.CUSTOM_ELEMENT_HANDLING&&Jt(Fe.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=Fe.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Fe.CUSTOM_ELEMENT_HANDLING&&Jt(Fe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=Fe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Fe.CUSTOM_ELEMENT_HANDLING&&typeof Fe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=Fe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(be=!1),me&&(De=!0),se&&(ae=hi({},xN),Z=[],se.html===!0&&(hi(ae,CN),hi(Z,TN)),se.svg===!0&&(hi(ae,T7),hi(Z,_7),hi(Z,k3)),se.svgFilters===!0&&(hi(ae,E7),hi(Z,_7),hi(Z,k3)),se.mathMl===!0&&(hi(ae,I7),hi(Z,EN),hi(Z,k3))),Fe.ADD_TAGS&&(ae===re&&(ae=J0(ae)),hi(ae,Fe.ADD_TAGS,ot)),Fe.ADD_ATTR&&(Z===K&&(Z=J0(Z)),hi(Z,Fe.ADD_ATTR,ot)),Fe.ADD_URI_SAFE_ATTR&&hi(ze,Fe.ADD_URI_SAFE_ATTR,ot),Fe.FORBID_CONTENTS&&(fe===Ae&&(fe=J0(fe)),hi(fe,Fe.FORBID_CONTENTS,ot)),he&&(ae["#text"]=!0),oe&&hi(ae,["html","head","body"]),ae.table&&(hi(ae,["tbody"]),delete ge.tbody),Fe.TRUSTED_TYPES_POLICY){if(typeof Fe.TRUSTED_TYPES_POLICY.createHTML!="function")throw e2('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Fe.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw e2('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=Fe.TRUSTED_TYPES_POLICY,x=T.createHTML("")}else T===void 0&&(T=Vse(g,i)),T!==null&&typeof x=="string"&&(x=T.createHTML(""));Eo&&Eo(Fe),rn=Fe}},wt=hi({},["mi","mo","mn","ms","mtext"]),Ke=hi({},["annotation-xml"]),st=hi({},["title","style","font","a","script"]),vt=hi({},[...T7,...E7,...Ise]),Vt=hi({},[...I7,..._se]),On=function(Fe){let Qe=S(Fe);(!Qe||!Qe.tagName)&&(Qe={namespaceURI:fn,tagName:"template"});const At=F3(Fe.tagName),jt=F3(Qe.tagName);return mn[Fe.namespaceURI]?Fe.namespaceURI===ht?Qe.namespaceURI===Ut?At==="svg":Qe.namespaceURI===it?At==="svg"&&(jt==="annotation-xml"||wt[jt]):!!vt[At]:Fe.namespaceURI===it?Qe.namespaceURI===Ut?At==="math":Qe.namespaceURI===ht?At==="math"&&Ke[jt]:!!Vt[At]:Fe.namespaceURI===Ut?Qe.namespaceURI===ht&&!Ke[jt]||Qe.namespaceURI===it&&!wt[jt]?!1:!Vt[At]&&(st[At]||!vt[At]):!!(Tt==="application/xhtml+xml"&&mn[Fe.namespaceURI]):!1},$n=function(Fe){Jp(e.removed,{element:Fe});try{S(Fe).removeChild(Fe)}catch{A(Fe)}},lr=function(Fe,Qe){try{Jp(e.removed,{attribute:Qe.getAttributeNode(Fe),from:Qe})}catch{Jp(e.removed,{attribute:null,from:Qe})}if(Qe.removeAttribute(Fe),Fe==="is"&&!Z[Fe])if(De||me)try{$n(Qe)}catch{}else try{Qe.setAttribute(Fe,"")}catch{}},Wn=function(Fe){let Qe=null,At=null;if(Ce)Fe="<remove></remove>"+Fe;else{const Zt=SN(Fe,/^[\r\n\t ]+/);At=Zt&&Zt[0]}Tt==="application/xhtml+xml"&&fn===Ut&&(Fe='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Fe+"</body></html>");const jt=T?T.createHTML(Fe):Fe;if(fn===Ut)try{Qe=new h().parseFromString(jt,Tt)}catch{}if(!Qe||!Qe.documentElement){Qe=E.createDocument(fn,"template",null);try{Qe.documentElement.innerHTML=$t?x:jt}catch{}}const Xt=Qe.body||Qe.documentElement;return Fe&&At&&Xt.insertBefore(n.createTextNode(At),Xt.childNodes[0]||null),fn===Ut?O.call(Qe,oe?"html":"body")[0]:oe?Qe.documentElement:Xt},br=function(Fe){return _.call(Fe.ownerDocument||Fe,Fe,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Nr=function(Fe){return Fe instanceof f&&(typeof Fe.nodeName!="string"||typeof Fe.textContent!="string"||typeof Fe.removeChild!="function"||!(Fe.attributes instanceof d)||typeof Fe.removeAttribute!="function"||typeof Fe.setAttribute!="function"||typeof Fe.namespaceURI!="string"||typeof Fe.insertBefore!="function"||typeof Fe.hasChildNodes!="function")},yn=function(Fe){return typeof l=="function"&&Fe instanceof l},lt=function(Fe,Qe,At){P[Fe]&&O3(P[Fe],jt=>{jt.call(e,Qe,At,rn)})},ut=function(Fe){let Qe=null;if(lt("beforeSanitizeElements",Fe,null),Nr(Fe))return $n(Fe),!0;const At=ot(Fe.nodeName);if(lt("uponSanitizeElement",Fe,{tagName:At,allowedTags:ae}),Fe.hasChildNodes()&&!yn(Fe.firstElementChild)&&Io(/<[/\w]/g,Fe.innerHTML)&&Io(/<[/\w]/g,Fe.textContent)||Fe.nodeType===n2.progressingInstruction||ee&&Fe.nodeType===n2.comment&&Io(/<[/\w]/g,Fe.data))return $n(Fe),!0;if(!ae[At]||ge[At]){if(!ge[At]&&Nt(At)&&(W.tagNameCheck instanceof RegExp&&Io(W.tagNameCheck,At)||W.tagNameCheck instanceof Function&&W.tagNameCheck(At)))return!1;if(he&&!fe[At]){const jt=S(Fe)||Fe.parentNode,Xt=C(Fe)||Fe.childNodes;if(Xt&&jt){const Zt=Xt.length;for(let Sn=Zt-1;Sn>=0;--Sn){const Ln=m(Xt[Sn],!0);Ln.__removalCount=(Fe.__removalCount||0)+1,jt.insertBefore(Ln,w(Fe))}}}return $n(Fe),!0}return Fe instanceof c&&!On(Fe)||(At==="noscript"||At==="noembed"||At==="noframes")&&Io(/<\/no(script|embed|frames)/i,Fe.innerHTML)?($n(Fe),!0):(q&&Fe.nodeType===n2.text&&(Qe=Fe.textContent,O3([H,N,$],jt=>{Qe=Zp(Qe,jt," ")}),Fe.textContent!==Qe&&(Jp(e.removed,{element:Fe.cloneNode()}),Fe.textContent=Qe)),lt("afterSanitizeElements",Fe,null),!1)},yt=function(Fe,Qe,At){if(Pe&&(Qe==="id"||Qe==="name")&&(At in n||At in nn))return!1;if(!(be&&!ve[Qe]&&Io(U,Qe))){if(!(Ie&&Io(le,Qe))){if(!Z[Qe]||ve[Qe]){if(!(Nt(Fe)&&(W.tagNameCheck instanceof RegExp&&Io(W.tagNameCheck,Fe)||W.tagNameCheck instanceof Function&&W.tagNameCheck(Fe))&&(W.attributeNameCheck instanceof RegExp&&Io(W.attributeNameCheck,Qe)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(Qe))||Qe==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&Io(W.tagNameCheck,At)||W.tagNameCheck instanceof Function&&W.tagNameCheck(At))))return!1}else if(!ze[Qe]){if(!Io(Y,Zp(At,X,""))){if(!((Qe==="src"||Qe==="xlink:href"||Qe==="href")&&Fe!=="script"&&Cse(At,"data:")===0&&Ne[Fe])){if(!(de&&!Io(G,Zp(At,X,"")))){if(At)return!1}}}}}}return!0},Nt=function(Fe){return Fe!=="annotation-xml"&&SN(Fe,ce)},An=function(Fe){lt("beforeSanitizeAttributes",Fe,null);const{attributes:Qe}=Fe;if(!Qe)return;const At={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z};let jt=Qe.length;for(;jt--;){const Xt=Qe[jt],{name:Zt,namespaceURI:Sn,value:Ln}=Xt,zn=ot(Zt);let at=Zt==="value"?Ln:xse(Ln);if(At.attrName=zn,At.attrValue=at,At.keepAttr=!0,At.forceKeepAttr=void 0,lt("uponSanitizeAttribute",Fe,At),at=At.attrValue,At.forceKeepAttr||(lr(Zt,Fe),!At.keepAttr))continue;if(!ne&&Io(/\/>/i,at)){lr(Zt,Fe);continue}q&&O3([H,N,$],Me=>{at=Zp(at,Me," ")});const ie=ot(Fe.nodeName);if(yt(ie,zn,at)){if(Ee&&(zn==="id"||zn==="name")&&(lr(Zt,Fe),at=j+at),ee&&Io(/((--!?|])>)|<\/(style|title)/i,at)){lr(Zt,Fe);continue}if(T&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Sn)switch(g.getAttributeType(ie,zn)){case"TrustedHTML":{at=T.createHTML(at);break}case"TrustedScriptURL":{at=T.createScriptURL(at);break}}try{Sn?Fe.setAttributeNS(Sn,Zt,at):Fe.setAttribute(Zt,at),Nr(Fe)?$n(Fe):wN(e.removed)}catch{}}}lt("afterSanitizeAttributes",Fe,null)},Nn=function It(Fe){let Qe=null;const At=br(Fe);for(lt("beforeSanitizeShadowDOM",Fe,null);Qe=At.nextNode();)lt("uponSanitizeShadowNode",Qe,null),!ut(Qe)&&(Qe.content instanceof a&&It(Qe.content),An(Qe));lt("afterSanitizeShadowDOM",Fe,null)};return e.sanitize=function(It){let Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Qe=null,At=null,jt=null,Xt=null;if($t=!It,$t&&(It="<!-->"),typeof It!="string"&&!yn(It))if(typeof It.toString=="function"){if(It=It.toString(),typeof It!="string")throw e2("dirty is not a string, aborting")}else throw e2("toString is not a function");if(!e.isSupported)return It;if(pe||_n(Fe),e.removed=[],typeof It=="string"&&(ye=!1),ye){if(It.nodeName){const Ln=ot(It.nodeName);if(!ae[Ln]||ge[Ln])throw e2("root node is forbidden and cannot be sanitized in-place")}}else if(It instanceof l)Qe=Wn("<!---->"),At=Qe.ownerDocument.importNode(It,!0),At.nodeType===n2.element&&At.nodeName==="BODY"||At.nodeName==="HTML"?Qe=At:Qe.appendChild(At);else{if(!De&&!q&&!oe&&It.indexOf("<")===-1)return T&&Te?T.createHTML(It):It;if(Qe=Wn(It),!Qe)return De?null:Te?x:""}Qe&&Ce&&$n(Qe.firstChild);const Zt=br(ye?It:Qe);for(;jt=Zt.nextNode();)ut(jt)||(jt.content instanceof a&&Nn(jt.content),An(jt));if(ye)return It;if(De){if(me)for(Xt=M.call(Qe.ownerDocument);Qe.firstChild;)Xt.appendChild(Qe.firstChild);else Xt=Qe;return(Z.shadowroot||Z.shadowrootmode)&&(Xt=F.call(r,Xt,!0)),Xt}let Sn=oe?Qe.outerHTML:Qe.innerHTML;return oe&&ae["!doctype"]&&Qe.ownerDocument&&Qe.ownerDocument.doctype&&Qe.ownerDocument.doctype.name&&Io(_N,Qe.ownerDocument.doctype.name)&&(Sn="<!DOCTYPE "+Qe.ownerDocument.doctype.name+`>
2289
+ `}}),Zr=b.forwardRef(function(t,e){var n=Kn(),r=b.useContext(ar),i=_3.getProps(t,r),a=b.useState(i.id),s=pN(a,2),l=s[0],c=s[1],u=b.useState(i.collapsed),d=pN(u,2),f=d[0],h=d[1],g=b.useRef(null),v=b.useRef(null),m=i.toggleable?i.onToggle?i.collapsed:f:!1,A=l+"_header",w=l+"_content",C=_3.setMetaData({props:i,state:{id:l,collapsed:m}}),S=C.ptm,T=C.cx,x=C.isUnstyled;ci(_3.css.styles,x,{name:"panel"});var E=function(X){i.toggleable&&(m?_(X):M(X),X&&(i.onToggle&&i.onToggle({originalEvent:X,value:!m}),X.preventDefault()))},_=function(X){i.onToggle||h(!1),i.onExpand&&X&&i.onExpand(X)},M=function(X){i.onToggle||h(!0),i.onCollapse&&X&&i.onCollapse(X)};b.useImperativeHandle(e,function(){return{props:i,toggle:E,expand:_,collapse:M,getElement:function(){return g.current},getContent:function(){return v.current}}}),Li(function(){l||c(So())});var O=function(){if(i.toggleable){var X=l+"_label",ce=n({className:T("toggler"),onClick:E,id:X,"aria-controls":w,"aria-expanded":!m,type:"button",role:"button","aria-label":i.header},S("toggler")),Y=n(S("togglericon")),ae=m?i.expandIcon||b.createElement(Mm,Y):i.collapseIcon||b.createElement(n8,Y),re=nr.getJSXIcon(ae,Y,{props:i,collapsed:m});return b.createElement("button",ce,re,b.createElement(Qt,null))}return null},F=function(){var X=ke.getJSXElement(i.header,i),ce=ke.getJSXElement(i.icons,i),Y=O(),ae=n({id:A,className:T("title")},S("title")),re=b.createElement("span",ae,X),Z=n({className:T("icons")},S("icons")),K=b.createElement("div",Z,ce,Y),W=n({className:T("header")},S("header")),ge=b.createElement("div",W,re,K);if(i.headerTemplate){var ve={className:"p-panel-header",titleClassName:"p-panel-title",iconsClassName:"p-panel-icons",togglerClassName:"p-panel-header-icon p-panel-toggler p-link",onTogglerClick:E,titleElement:re,iconsElement:K,togglerElement:Y,element:ge,id:l+"_header",props:i,collapsed:m};return ke.getJSXElement(i.headerTemplate,ve)}else if(i.header||i.toggleable)return ge;return null},P=function(){var X=ke.getJSXElement(i.footer,i),ce=n({className:T("footer")},S("footer")),Y=b.createElement("div",ce,X);if(i.footerTemplate){var ae={className:T("footer"),element:Y,props:i};return ke.getJSXElement(i.footerTemplate,ae)}else if(i.footer)return Y;return null},H=function(){var X=n({ref:v,className:T("toggleableContent"),"aria-hidden":m,role:"region",id:w,"aria-labelledby":A},S("toggleablecontent")),ce=n({className:T("content")},S("content")),Y=n({classNames:T("transition"),timeout:{enter:1e3,exit:450},in:!m,unmountOnExit:!0,options:i.transitionOptions},S("transition"));return b.createElement(Ro,v7({nodeRef:v},Y),b.createElement("div",X,b.createElement("div",ce,i.children)))},N=n({id:l,ref:g,style:i.style,className:ft(i.className,T("root"))},_3.getOtherProps(i),S("root")),$=F(),U=H(),le=P();return b.createElement("div",N,$,U,le)});Zr.displayName="Panel";const ese=t=>{var v;const{fieldState:e,setFieldState:n,pageIndex:r,formBuilderFormLayout:i,pageSettingUpdate:a}=t,s=(m,A)=>{const w=`${m.className} justify-content-start`,C=`${m.titleClassName} pl-1`;return o.jsxs("div",{className:w,children:[o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:m.togglerClassName,onClick:()=>c(A),"aria-label":"Submit"}),o.jsx("span",{className:C,children:`Rule ${A+1}`})]})},l=(m,A)=>{var C;const w=[...((C=e==null?void 0:e.conditionalTabRules)==null?void 0:C.rules)||[]];w[m].conditions=w[m].conditions.filter((S,T)=>A!==T),n(S=>({...S,conditionalTabRules:{...S.conditionalTabRules,rules:w}}))},c=m=>{var S;const A=[...(e==null?void 0:e.conditionalTabRules.rules)||[]],w=A.filter((T,x)=>m!==x);n(T=>({...T,conditionalTabRules:{...T.conditionalTabRules,rules:w}}));const C=A[m];(S=C==null?void 0:C.conditions)==null||S.map(T=>{const x=i?_t.findIndex(i,_=>{var M;return(_==null?void 0:_.uuid)===((M=T==null?void 0:T.tab)==null?void 0:M.uuid)}):-1,E=i[x];E&&(E.isHidden=!1,a(x,E))})};let u=[...i].filter(function(m,A){return A!==r});u.map(m=>({uuid:m==null?void 0:m.uuid,title:m==null?void 0:m.title}));const d=(m,A,w)=>{const C=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];C[A].conditions[w].option=m==null?void 0:m.value,n(S=>({...S,conditionalTabRules:{...S.conditionalTabRules,rules:C}}))},f=(m,A,w)=>{const C=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];C[A].conditions[w].tab=m==null?void 0:m.value,n(x=>({...x,conditionalTabRules:{...x.conditionalTabRules,rules:C}}));const S=_t.findIndex(i,x=>{var E;return(x==null?void 0:x.uuid)===((E=m==null?void 0:m.value)==null?void 0:E.uuid)}),T=i[S];T&&(T.isHidden=!0,a(S,T))},h=()=>{n(m=>({...m,conditionalTabRules:{...m.conditionalTabRules,rules:[...m.conditionalTabRules.rules,{conditions:[]}]}}))},g=m=>{const A=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];A[m].conditions=[...A[m].conditions,{option:null,tab:null}],n(w=>({...w,conditionalTabRules:{...w.conditionalTabRules,rules:[...A]}}))};return o.jsxs("div",{children:[o.jsx("h4",{children:"Conditional Tabs"}),i&&(i==null?void 0:i.length)>1&&((v=e==null?void 0:e.conditionalTabRules)==null?void 0:v.rules.map((m,A)=>o.jsx(Zr,{className:"mb-3",header:`Rule ${A+1}`,headerTemplate:w=>s(w,A),children:o.jsxs("div",{children:[m==null?void 0:m.conditions.map((w,C)=>o.jsx("div",{className:"p-field pb-6",children:o.jsxs("div",{className:"grid",children:[o.jsx("div",{className:"col-2",children:o.jsxs("label",{children:["Show tab",w.value]})}),o.jsx("div",{className:"col-3 p-fluid",children:o.jsx(Pa,{value:w.tab,options:u,onChange:S=>f(S,A,C),optionLabel:"title.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-3",children:"when option is selected"}),o.jsx("div",{className:"col-3 p-fluid",children:o.jsx(Pa,{value:w==null?void 0:w.option,options:e==null?void 0:e.options,onChange:S=>d(S,A,C),optionLabel:"optionText.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-1",children:o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>l(A,C),tooltipOptions:{position:"top"}})})]})},C)),o.jsx(Ot,{text:!0,size:"small",onClick:()=>g(A),icon:"pi pi-plus",className:"p-mt-4",label:"Add Condition"})]})},"conditional_tab_rule"+A))),i&&(i==null?void 0:i.length)>1&&o.jsx(Ot,{text:!0,onClick:()=>h(),className:"p-mt-4",icon:"pi pi-plus",label:"Add Rule",size:"small"}),i&&(i==null?void 0:i.length)<2&&o.jsx("p",{className:"error",children:"Please needs to have two or more tabs to enable the conditional tabs"})]})},tse=t=>{var S;const{fieldState:e,setFieldState:n,section:r,formBuilderFormLayout:i,sectionSettingUpdate:a,page:s}=t,[l]=k.useState([]),{schemaBuilderUpdate:c,formBuilderFormSchema:u}=sn(),d=(T,x)=>{const E=`${T.className} justify-content-start`,_=`${T.titleClassName} pl-1`;return o.jsxs("div",{className:E,children:[o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:T.togglerClassName,onClick:()=>f(x),"aria-label":"Submit"}),o.jsx("span",{className:_,children:`Rule ${x+1}`})]})},f=T=>{var M;const x=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]],E=x[T];(M=E==null?void 0:E.conditions)==null||M.map(O=>{var H;const F=_t.findIndex(i,N=>{var $;return(N==null?void 0:N.uuid)===(($=O==null?void 0:O.tab)==null?void 0:$.uuid)}),P=i?_t.findIndex(i[F].children,N=>{var $;return(N==null?void 0:N.uuid)===(($=O==null?void 0:O.section)==null?void 0:$.uuid)}):-1;if(P>=0){const N=(H=i[F])==null?void 0:H.children[P];N&&(N.isHidden=!1,a(F,P,N))}});const _=x.filter((O,F)=>T!==F);n(O=>({...O,conditionalSectionRules:{...O.conditionalSectionRules,rules:_}}))},h=T=>{var _;let x=!1;const E=i?i.filter(function(M){return(M==null?void 0:M.uuid)===(T==null?void 0:T.uuid)}):[];return(E==null?void 0:E.length)>0&&((_=E[0].children)==null?void 0:_.length)>1&&(x=!0),x},g=(T,x,E)=>{const _=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];_[x].conditions[E].option=T==null?void 0:T.value,n(M=>({...M,conditionalSectionRules:{...M.conditionalSectionRules,rules:_}}))},v=(T,x)=>{var M;const E=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]],_=E[T];(M=_==null?void 0:_.conditions)==null||M.map(O=>{var N;const F=_t.findIndex(i,$=>{var U;return($==null?void 0:$.uuid)===((U=O==null?void 0:O.tab)==null?void 0:U.uuid)}),P=i?_t.findIndex(i[F].children,$=>{var U;return($==null?void 0:$.uuid)===((U=O==null?void 0:O.section)==null?void 0:U.uuid)}):-1,H=(N=i[F])==null?void 0:N.children[P];console.log("sectionData",H),H&&(H.isHidden=!1,console.log("sectionData",H),a(F,P,H))}),E[T].conditions=E[T].conditions.filter((O,F)=>x!==F),n(O=>({...O,conditionalSectionRules:{...O.conditionalSectionRules,rules:E}}))},m=(T,x,E)=>{var H,N;const _=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];_[x].conditions[E].section=T==null?void 0:T.value;const M=(N=(H=_[x].conditions[E])==null?void 0:H.tab)==null?void 0:N.uuid,O=_t.findIndex(i,$=>($==null?void 0:$.uuid)===M);n($=>({...$,conditionalSectionRules:{...$.conditionalSectionRules,rules:_}}));const F=i?_t.findIndex(i[O].children,$=>{var U;return($==null?void 0:$.uuid)===((U=T==null?void 0:T.value)==null?void 0:U.uuid)}):-1,P=i[O].children[F];P&&(P.isHidden=!0,a(O,F,P))},A=T=>{const x=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];x[T].conditions=[...x[T].conditions,{option:null,tab:{title:s==null?void 0:s.title,uuid:s==null?void 0:s.uuid},section:null}],n(E=>({...E,conditionalSectionRules:{...E.conditionalSectionRules,rules:x}}))},w=()=>{n(x=>({...x,conditionalSectionRules:{...x.conditionalSectionRules,rules:[...x.conditionalSectionRules.rules,{uuid:nt(),conditions:[]}]}}));const T=[...(u==null?void 0:u.conditionalSectionsRules)||[]];c({conditionalSectionsRules:[...T,{fieldId:e==null?void 0:e.uuid,uuid:nt(),conditions:[]}]})},C=T=>{var E;const x=i==null?void 0:i.filter(function(_){return(_==null?void 0:_.uuid)===(T==null?void 0:T.uuid)});if(x&&(x==null?void 0:x.length)>0){const _=(E=x[0])==null?void 0:E.children.filter(function(M){return(M==null?void 0:M.uuid)!==(r==null?void 0:r.uuid)});if((_==null?void 0:_.length)>0)return _}return l};return o.jsxs("div",{children:[o.jsx("h4",{children:"Conditional Sections"}),(S=e==null?void 0:e.conditionalSectionRules)==null?void 0:S.rules.map((T,x)=>o.jsx(Zr,{className:"mb-3",header:`Rule ${x+1}`,headerTemplate:E=>d(E,x),children:o.jsxs("div",{children:[T==null?void 0:T.conditions.map((E,_)=>{var M,O;return o.jsx("div",{className:"p-field pb-2",children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:"col-3 p-fluid",children:[o.jsx("label",{children:"In Tab"}),o.jsx("p",{children:(O=(M=E==null?void 0:E.tab)==null?void 0:M.title)==null?void 0:O.english})]}),o.jsxs("div",{className:"col-3 p-fluid",children:[o.jsxs("label",{children:["Select section",E.value]}),o.jsx(Pa,{disabled:!h(E==null?void 0:E.tab),value:E.section,options:C(E.tab),onChange:F=>m(F,x,_),optionLabel:"heading.english",placeholder:"Select option"})]}),o.jsxs("div",{className:"col-4 p-fluid",children:["when option is selected",o.jsx(Pa,{disabled:!h(E==null?void 0:E.tab),value:E==null?void 0:E.option,options:e==null?void 0:e.options,onChange:F=>g(F,x,_),optionLabel:"optionText.english",placeholder:"Select option"})]}),o.jsxs("div",{className:"col-1",children:[o.jsx("br",{}),o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>v(x,_),tooltipOptions:{position:"top"}})]}),!h(E.tab)&&o.jsx("div",{className:"col-12",children:o.jsxs("p",{className:"error",children:[" ","At least two or more sections should exist in a page"]})})]})},_)}),o.jsx("div",{children:o.jsx("div",{className:"flex",children:o.jsx(Ot,{text:!0,className:"btn-sm mt-3 ",label:"+ Add Condition",onClick:()=>A(x),size:"small"})})})]})},x)),o.jsx(Ot,{text:!0,icon:"pi pi-plus",onClick:()=>w(),className:"p-mt-4",label:"Add Rule",size:"small"})]})},nse=t=>{var u;const{fieldState:e,setFieldState:n}=t,r=d=>{var g;const h=[...((g=e==null?void 0:e.inlineConditionalRules)==null?void 0:g.rules)||[]].filter((v,m)=>d!==m);n(v=>({...v,inlineConditionalRules:{...v.inlineConditionalRules,rules:h}}))},i=(d,f)=>{const h=`${d.className} justify-content-start`,g=`${d.titleClassName} pl-1`;return o.jsxs("div",{className:h,children:[o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:d.togglerClassName,onClick:()=>r(f),"aria-label":"Submit"}),o.jsx("span",{className:g,children:`Rule ${f+1}`})]})},a=(d,f,h)=>{const g=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];g[f].conditions[h].value=d==null?void 0:d.value,n(v=>({...v,inlineConditionalRules:{...v.inlineConditionalRules,rules:g}}))},s=(d,f)=>{const h=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];h[d].conditions=h[d].conditions.filter((g,v)=>f!==v),n(g=>({...g,inlineConditionalRules:{...g.inlineConditionalRules,rules:h}}))},l=d=>{const f=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];f[d].conditions=[...f[d].conditions,{value:"",children:[]}],n(h=>({...h,inlineConditionalRules:{...h.inlineConditionalRules,rules:f}}))},c=()=>{n(d=>({...d,inlineConditionalRules:{...d.inlineConditionalRules,rules:[...d.inlineConditionalRules.rules,{conditions:[]}]}}))};return o.jsxs("div",{children:[o.jsx("h4",{children:"Inline Conditions"}),(u=e==null?void 0:e.inlineConditionalRules)==null?void 0:u.rules.map((d,f)=>o.jsx(Zr,{className:"mb-3",header:`Rule ${f+1}`,headerTemplate:h=>i(h,f),children:o.jsxs("div",{children:[d==null?void 0:d.conditions.map((h,g)=>o.jsx("div",{className:"p-field p-pt-2",children:o.jsxs("div",{className:"grid",children:[o.jsx("label",{className:"block",children:"Show when selected option is:"}),o.jsx("div",{className:" p-fluid col-11",children:o.jsx(Pa,{value:h.value,options:e==null?void 0:e.options,onChange:v=>a(v,f,g),optionLabel:"optionText.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-1",children:o.jsx(Ot,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>s(f,g),tooltipOptions:{position:"top"}})})]})},"inline-rules-"+g)),o.jsx(Ot,{text:!0,onClick:()=>l(f),className:"p-mt-4",icon:"pi pi-plus",label:"Add Condition",size:"small"})]})},f)),o.jsx(Ot,{text:!0,onClick:()=>c(),className:"p-mt-4",icon:"pi pi-plus",label:"Add Rule",size:"small"})]})},rse=t=>{const{fieldState:e,pageIndex:n,section:r,setFieldState:i,page:a}=t,{pageSettingUpdate:s,formBuilderFormLayout:l,sectionSettingUpdate:c}=sn();return o.jsx(o.Fragment,{children:o.jsxs("div",{className:" scroll-height-250",children:[o.jsx(nse,{fieldState:e,setFieldState:i}),o.jsx("hr",{}),o.jsx(ese,{fieldState:e,setFieldState:i,pageIndex:n,formBuilderFormLayout:l,pageSettingUpdate:s}),o.jsx("hr",{}),o.jsx(tse,{fieldState:e,setFieldState:i,section:r,formBuilderFormLayout:l,sectionSettingUpdate:c,page:a}),o.jsx("hr",{})]})})},ise=t=>{const{fieldState:e,setFieldState:n}=t,[r,i]=k.useState(""),[a,s]=k.useState([""]),[l,c]=k.useState(!1),[u,d]=k.useState(0),[f,h]=k.useState(!1),{updateGlobalToast:g}=Ht(),v=()=>{h(!0)},m=()=>{var $;const H=(($=e==null?void 0:e.reviewerChecklist)==null?void 0:$.length)>=0?[...e.reviewerChecklist]:[];H.push({uuid:nt(),checklist:r,action:a,agree:null,selectAction:[],other:{isOther:!1,description:""},reviewerComments:""});const N={...e,reviewerChecklist:H};n(U=>({...U,...N})),h(!1),i(""),s([""])},A=()=>{h(!1),i(""),s([""])},w=H=>{const N=[...e.reviewerChecklist];N.splice(H,1);const $={...e,reviewerChecklist:N};n(U=>({...U,...$}))},C=(H,N)=>{c(!0);const{checklist:$,action:U}=H;h(!0),d(N),setTimeout(()=>{i($),s(U)},1e3)},S=(H,N)=>o.jsxs(o.Fragment,{children:[o.jsx(Ot,{text:!0,type:"button",className:"p-button-info",icon:"pi pi-pencil",onClick:()=>C(H,N==null?void 0:N.rowIndex)}),o.jsx(Ot,{text:!0,type:"button",className:"p-button-danger",icon:"pi pi-trash",onClick:()=>w(N==null?void 0:N.rowIndex)})]}),T=H=>{var N;return o.jsx(o.Fragment,{children:(N=H==null?void 0:H.action)==null?void 0:N.length})},x=H=>{const N=[...a];N.splice(H,1),s(N)},E=()=>{const H=[...e.reviewerChecklist];H[u]={checklist:r,action:a};const N={...e,reviewerChecklist:H};n($=>({...$,...N})),h(!1),c(!1)},_=()=>o.jsx("div",{children:l?o.jsx(Ot,{text:!0,className:"mb-5 p-button-success",label:"Edit Checklist",onClick:()=>{E()}}):o.jsx(Ot,{text:!0,className:"mb-5 p-button-success",label:"Add Checklist",onClick:()=>{m()}})}),M=H=>{n(N=>({...N,reviewerChecklist:H==null?void 0:H.value}))},O=H=>{navigator.clipboard.writeText(JSON.stringify(H))};function F(H){try{JSON.parse(H)}catch{return!1}return!0}const P=async()=>{var $;const H=await navigator.clipboard.readText();let N="";if(F(H)){const U=JSON.parse(H);if(($=U[0])!=null&&$.checklist){const le={..._t.cloneDeep(e),reviewerChecklist:U};n(G=>({...G,...le}));return}else N="Empty or Invalid Schema"}else N="Invalid Schema";g({showToast:!0,toastMessage:N,toastDetail:"",toastType:"error"})};return o.jsxs("div",{children:[o.jsx(Os,{maximizable:!0,header:"Add Checklist options for admin to reveiw",visible:f,style:{width:"30vw"},onHide:()=>A(),footer:_(),children:o.jsxs("div",{className:"scroll-height-500",children:[o.jsx("h5",{children:"Checklist"}),o.jsx(so,{rows:2,cols:50,value:r,onChange:H=>{var N;i((N=H==null?void 0:H.target)==null?void 0:N.value)}}),o.jsx("h5",{children:"Actions when admin selects NO as invalid"}),a.map((H,N)=>o.jsxs("div",{children:[N+1,"."," ",o.jsx(so,{value:H,onChange:$=>{var le;const U=[...a];U[N]=(le=$==null?void 0:$.target)==null?void 0:le.value,s(U)},rows:2,cols:50})," ",o.jsx(Ot,{text:!0,type:"button",icon:"pi pi-trash",className:"p-button-danger",onClick:()=>x(N)}),o.jsx("br",{}),o.jsx("br",{})]},`actionIndex-${N}`)),o.jsx(Ot,{outlined:!0,className:" p-button-primary mr-2",onClick:()=>{s([...a,""])},children:"Add Action"})]})})," ",o.jsx("h5",{children:"Reviewer Checklist"}),o.jsx(Ot,{className:"mb-5 mr-2 p-button-success",label:"Add Review Checklist",onClick:()=>{v()}}),o.jsx(Ot,{outlined:!0,label:"Copy Schema ",onClick:()=>{O([...(e==null?void 0:e.reviewerChecklist)||[]])},className:"mb-5 mr-2"}),o.jsx(Ot,{outlined:!0,label:"Paste Checklist ",onClick:()=>{P()},className:"mb-5 p-button-info"}),o.jsx("div",{className:"card",children:o.jsxs(ro,{value:e==null?void 0:e.reviewerChecklist,reorderableRows:!0,onRowReorder:M,scrollable:!0,children:[o.jsx(Sr,{rowReorder:!0,style:{width:"3em"}}),o.jsx(Sr,{field:"checklist",header:"Checklist"}),o.jsx(Sr,{field:"actions",header:"Actions",body:H=>T(H)}),o.jsx(Sr,{header:"",body:(H,N)=>S(H,N)})]})})]})},ase=t=>{const{onHandleChangeLayoutSettings:e,fieldState:n}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"isFieldAnFilterOption",checked:(n==null?void 0:n.isFieldAnFilterOption)||!1,onChange:r=>e("isFieldAnFilterOption",r.checked)}),o.jsx("label",{htmlFor:"isFieldAnFilterOption",children:"Is field an filter option to filter data"}),"     ",o.jsx(cn,{target:".isFieldAnFilterOption",content:"Make the field a filter for sorting data"}),o.jsx("i",{className:"isFieldAnFilterOption pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"isSortable",checked:(n==null?void 0:n.isSortable)||!1,onChange:r=>e("isSortable",r.checked)}),o.jsx("label",{htmlFor:"isSortable",children:"Enable sortable"}),"     ",o.jsx(cn,{target:".isSortable",content:"Make the field as column sortable"}),o.jsx("i",{className:"isSortable pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"isFilterable",checked:(n==null?void 0:n.isFilterable)||!1,onChange:r=>e("isFilterable",r.checked)}),o.jsx("label",{htmlFor:"isFilterable",children:"Enable filter"}),"     ",o.jsx(cn,{target:".isFilterable",content:"Filter the column data"}),o.jsx("i",{className:"isFilterable pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"resizableColumns",checked:n==null?void 0:n.resizableColumns,onChange:r=>e("resizableColumns",r.checked)}),o.jsx("label",{htmlFor:"resizableColumns",children:"Enable resizable columns"}),"     ",o.jsx(cn,{target:".resizableColumns",content:"Column width can be increase or decreased by dragging"}),o.jsx("i",{className:"resizableColumns pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"reorderableColumns",checked:n==null?void 0:n.reorderableColumns,onChange:r=>e("reorderableColumns",r.checked)}),o.jsx("label",{htmlFor:"reorderableColumns",children:"Enable reorderable columns"}),"     ",o.jsx(cn,{target:".reorderableColumns",content:"Column can ordered to show as first or last"}),o.jsx("i",{className:"reorderableColumns pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"colToggle",checked:(n==null?void 0:n.colToggle)||!1,onChange:r=>e("colToggle",r.checked)}),o.jsx("label",{htmlFor:"colToggle",children:"Enable column toggle"}),"     ",o.jsx(cn,{target:".colToggle",content:"Column can be shown and hide by settings by user"}),o.jsx("i",{className:"colToggle pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{inputId:"freezeColumn",checked:(n==null?void 0:n.freezeColumn)||!1,onChange:r=>e("freezeColumn",r.checked)}),o.jsx("label",{htmlFor:"freezeColumn",children:"Enable freeze columns"}),"     ",o.jsx(cn,{target:".freezeColumn",content:"Column can sticky so the important can be in view all the time"}),o.jsx("i",{className:"freezeColumn pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]})]})},sse=t=>{var c,u,d;const{fieldState:e,setFieldState:n}=t,{formBuilderSchemaLanguages:r}=sn(),i=()=>{n(f=>Object.assign({},f,{options:[...f.options,{uuid:nt(),optionText:{english:""},value:"",score:0,hyperlinkText:{english:""},abbreviationText:{english:""},custom_values:{}}]}))},a=f=>{n(h=>({...h,fieldType:{...h==null?void 0:h.fieldType,type:f}}))},s=(f,h)=>{n(g=>({...g,[f]:h}))},l=[{label:"Employee",api:"/employees/list",availableId:["user_id","employee_id"],optionValue:"employee_id",optionLabel:"first_name"},{label:"Departments",api:"/department/",availableId:["department_id"],optionValue:"department_id",optionLabel:"department_name"}];return o.jsxs("div",{className:"p-fluid",children:[o.jsx("h4",{children:"Render Type"}),o.jsxs("div",{className:"flex flex-wrap gap-3 my-2",children:[o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"renderType1",name:"renderType",value:"radio",onChange:f=>{a(f==null?void 0:f.value)},checked:((c=e==null?void 0:e.fieldType)==null?void 0:c.type)==="radio"}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:"Radio"})]}),o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"renderType2",name:"renderType",value:"dropdown",onChange:f=>{a(f==null?void 0:f.value)},checked:((u=e==null?void 0:e.fieldType)==null?void 0:u.type)==="dropdown"}),o.jsx("label",{htmlFor:"ingredient2",className:"ml-2",children:"Dropdown"})]})]}),o.jsx("label",{htmlFor:"",className:"pb-2",children:"Data Source"}),o.jsxs("div",{className:"flex flex-wrap gap-3 mt-2",children:[o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"dataSourceType1",name:"dataSourceType",value:"custom",onChange:f=>{s("dataSourceType",f==null?void 0:f.value)},checked:(e==null?void 0:e.dataSourceType)==="custom"}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:"Custom"})]}),o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(ia,{inputId:"dataSourceType2",name:"dataSourceType",value:"database",onChange:f=>{s("dataSourceType",f==null?void 0:f.value)},checked:(e==null?void 0:e.dataSourceType)==="database"}),o.jsx("label",{htmlFor:"ingredient2",className:"ml-2",children:"Database"})]})]}),(e==null?void 0:e.dataSourceType)==="database"&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Select Data Source"}),o.jsx("div",{children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:"col-6",children:[o.jsx("div",{className:"py-2",children:o.jsx("label",{children:"Datasources"})}),o.jsx(Pa,{value:e==null?void 0:e.dataSource,onChange:f=>{var h;s("optionLabel",(h=f.value)==null?void 0:h.optionLabel),s("dataSource",f.value)},options:l,placeholder:"Select a Data Source",className:"w-full "})]}),o.jsxs("div",{className:"col-6",children:[o.jsx("div",{className:"py-2",children:o.jsx("label",{htmlFor:"",className:"py-2",children:"Select Datasource Id"})}),o.jsx(Pa,{value:e==null?void 0:e.optionValue,onChange:f=>s("optionValue",f.value),options:(d=e==null?void 0:e.dataSource)==null?void 0:d.availableId,placeholder:"Source Id",className:"w-full "})]})]})})]}),(e==null?void 0:e.dataSourceType)==="custom"&&o.jsx(o.Fragment,{children:(e==null?void 0:e.options)!==void 0&&e.componentType!=="grid-component"&&e.componentType!=="matrix-dropdown"&&e.componentType!=="table"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"scroll-height-300 pt-5",children:o.jsx(ao,{activeIndex:0,children:r!=null&&r.length?r.map((f,h)=>o.jsx(io,{tabIndex:h,header:f==null?void 0:f.language,children:o.jsx(fN,{enableCopyPaste:!0,isCustomValue:!0,fieldState:e,setFieldState:n,language:f})},h)):""})}),o.jsx(Ot,{text:!0,className:"mr-3",label:"Add",icon:"pi pi-plus",onClick:()=>i(),"aria-label":"Add"})]})})]})},ose=t=>{var u,d;const{option:e,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a}=t,{userSelectedLanguage:s}=sn(),l=[{type:"radio",label:"Radio"},{type:"text",label:"Input Text"},{type:"text-area",label:"Text Area"},{type:"date",label:"Date Field"}],c=(f,h)=>{var g;return o.jsxs("div",{onClick:f.onClick,className:f.className,children:[o.jsx("span",{children:f.titleElement}),e.children&&((g=e.children)==null?void 0:g.length)>1&&o.jsx(Ot,{text:!0,icon:"pi pi-trash",size:"small",onClick:()=>{console.log("field",h==null?void 0:h.uuid),a(h==null?void 0:h.uuid)},"aria-label":"Filter"})]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"field-checkbox mt-3",children:[o.jsx(Yr,{inputId:"showConditionalFields",onChange:f=>{n(e==null?void 0:e.uuid,f.checked,{enableConditionalField:f.checked})},checked:e==null?void 0:e.enableConditionalField}),o.jsx("label",{htmlFor:"showConditionalFields",children:"Enable Conditional Field"})]}),(e==null?void 0:e.enableConditionalField)===!0&&o.jsxs(o.Fragment,{children:[o.jsx(Ot,{text:!0,label:"Add Field",onClick:()=>{i(e==null?void 0:e.uuid)}}),o.jsx(ss,{children:((u=e.children)==null?void 0:u.length)&&((d=e.children)==null?void 0:d.map((f,h)=>{var g,v;return o.jsx(Cr,{header:(g=f.label)==null?void 0:g[s==null?void 0:s.type],headerTemplate:m=>c(m,f),children:o.jsxs("div",{className:"card",children:[o.jsx("p",{children:"Choose Field Type"}),o.jsx("div",{className:"flex mb-3",children:(l==null?void 0:l.length)&&(l==null?void 0:l.map(m=>o.jsxs("div",{className:"mr-3",children:[o.jsx(ia,{inputId:"ingredient1",name:"fieldType",value:m==null?void 0:m.type,onChange:()=>r(f==null?void 0:f.uuid,{type:m==null?void 0:m.type}),checked:(f==null?void 0:f.type)===(m==null?void 0:m.type)}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:m==null?void 0:m.label})]},`field_type_${f==null?void 0:f.uuid}`)))}),o.jsxs("div",{className:"field-checkbox mt-3",children:[o.jsx(Yr,{inputId:"isRequired",onChange:m=>{r(f==null?void 0:f.uuid,{attributes:{required:m.checked}})},checked:(v=f==null?void 0:f.attributes)==null?void 0:v.required}),o.jsxs("label",{htmlFor:"showConditionalFields",children:["Is Required"," "]})]}),o.jsxs(ss,{children:[o.jsx(Cr,{header:"Text",children:o.jsx(Zr,{header:"Text Settings",toggleable:!0,collapsed:!0,children:o.jsx("div",{className:"",children:o.jsx(nD,{language:s,fieldState:f,onHandleChange:(m,A,w)=>{r(f==null?void 0:f.uuid,{[m]:{[A==null?void 0:A.type]:w}})}})})})}),(f==null?void 0:f.type)==="radio"&&o.jsx(Cr,{header:"Radio",children:o.jsx("div",{style:{width:"100%"},children:o.jsx(b7,{option:e,fieldState:f,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a})})})]})]})},`field-tab-${h}-${f==null?void 0:f.uuid}-${e==null?void 0:e.uuid}`)}))})]})]})},b7=t=>{var s,l;const{fieldState:e,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a}=t;return o.jsx(o.Fragment,{children:o.jsx(ss,{children:((s=e==null?void 0:e.options)==null?void 0:s.length)&&((l=e==null?void 0:e.options)==null?void 0:l.map((c,u)=>o.jsx(Cr,{header:`Option - ${c==null?void 0:c.label}`,children:o.jsx(ose,{option:c,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a})},`hirarchey-option-${u}`)))})})};var gN={},lse=Fi&&Fi.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),D3=Fi&&Fi.__assign||function(){return D3=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},D3.apply(this,arguments)},cse=Fi&&Fi.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),use=Fi&&Fi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mN=Fi&&Fi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&cse(e,t,n);return use(e,t),e},dse=Fi&&Fi.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},fse=Fi&&Fi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gN,"__esModule",{value:!0});var y7=mN(k),hse=fse(RI),Zu=mN(la);function vN(t){return t&&t.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>")}function pse(t){var e=document.createTextNode("");t.appendChild(e);var n=document.activeElement===t;if(e!==null&&e.nodeValue!==null&&n){var r=window.getSelection();if(r!==null){var i=document.createRange();i.setStart(e,e.nodeValue.length),i.collapse(!0),r.removeAllRanges(),r.addRange(i)}t instanceof HTMLElement&&t.focus()}}var gse=function(t){lse(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.lastHtml=n.props.html,n.el=typeof n.props.innerRef=="function"?{current:null}:y7.createRef(),n.getEl=function(){return(n.props.innerRef&&typeof n.props.innerRef!="function"?n.props.innerRef:n.el).current},n.emitChange=function(r){var i=n.getEl();if(i){var a=i.innerHTML;if(n.props.onChange&&a!==n.lastHtml){var s=Object.assign({},r,{target:{value:a}});n.props.onChange(s)}n.lastHtml=a}},n}return e.prototype.render=function(){var n=this,r=this.props,i=r.tagName,a=r.html,s=r.innerRef,l=dse(r,["tagName","html","innerRef"]);return y7.createElement(i||"div",D3(D3({},l),{ref:typeof s=="function"?function(c){s(c),n.el.current=c}:s||this.el,onInput:this.emitChange,onBlur:this.props.onBlur||this.emitChange,onKeyUp:this.props.onKeyUp||this.emitChange,onKeyDown:this.props.onKeyDown||this.emitChange,contentEditable:!this.props.disabled,dangerouslySetInnerHTML:{__html:a}}),this.props.children)},e.prototype.shouldComponentUpdate=function(n){var r=this.props,i=this.getEl();return!i||vN(n.html)!==vN(i.innerHTML)?!0:r.disabled!==n.disabled||r.tagName!==n.tagName||r.className!==n.className||r.innerRef!==n.innerRef||r.placeholder!==n.placeholder||!(0,hse.default)(r.style,n.style)},e.prototype.componentDidUpdate=function(){var n=this.getEl();n&&(this.props.html!==n.innerHTML&&(n.innerHTML=this.props.html),this.lastHtml=this.props.html,pse(n))},e.propTypes={html:Zu.string.isRequired,onChange:Zu.func,disabled:Zu.bool,tagName:Zu.string,className:Zu.string,style:Zu.object,innerRef:Zu.oneOfType([Zu.object,Zu.func])},e}(y7.Component),N3=gN.default=gse;const mse=t=>{var w;const e=k.useRef(null),{field:n,fieldIndex:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:l,path:c}=t,[u,d]=k.useState(n),{userSelectedLanguage:f,fieldSettingUpdate:h,fieldSettingUpdateInlineConditional:g,gridComponentFieldSettingUpdate:v}=sn(),m=(C,S,T)=>{d(x=>({...x,[C]:{...x[C],[S==null?void 0:S.type]:T}}))};k.useEffect(()=>(A(),()=>{}),[u]);const A=()=>{const C=c.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?g(C[fa],C[ha],C[Ca],C[xa],C[Ta],C[Fa],C[Go],C[wo],u):(C==null?void 0:C.length)>Fa&&(C==null?void 0:C.length)===Vl+1&&(n!=null&&n.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?v(C[fa],C[ha],C[Ca],C[xa],C[Ta],C[5],C[6],C[7],u):h(i,a,s,l,r,{...n,label:u==null?void 0:u.label})};return o.jsx(o.Fragment,{children:o.jsx(N3,{style:{display:"inline-block"},className:"builder-input-label-edit",innerRef:e,html:(w=n==null?void 0:n.label)==null?void 0:w[f==null?void 0:f.type],disabled:!1,onChange:C=>{var S;m("label",f,(S=C==null?void 0:C.target)==null?void 0:S.value)},tagName:"article"})})},ca=t=>{const{sectionIndex:e,fieldIndex:n}=t,{formBuilderFormSchema:r}=sn();return(r==null?void 0:r.enableFieldEnumeration)===!0?o.jsx("span",{className:"mr-2",children:o.jsx(F8,{classes:"font-medium p-1 bg-primary",level:"purple",value:`${e+1}.${n+1}`})}):o.jsx(o.Fragment,{})},A7=t=>{var f,h,g,v,m,A,w,C,S,T,x,E,_,M;const{field:e,update:n,value:r,isFirst:i,isDisabled:a}=t,{isBuilderMode:s,isAdmin:l}=Ht(),{selectedLanguage:c}=sn(),[u,d]=k.useState(0);return k.useEffect(()=>{const O=Rt.addListener("onSubmitUserForm",()=>{var P;(P=e==null?void 0:e.attributes)!=null&&P.required?r!=null&&r[e.uuid]?e.isValid=t3:e.isValid=D8:e.isValid=1}),F=Rt.addListener("OnInvalidFieldCatch",P=>{(e==null?void 0:e.uuid)===(P==null?void 0:P.fieldId)?d(N8):d(O8)});return()=>{O.remove(),F.remove()}}),o.jsxs("div",{className:"",children:[(e==null?void 0:e.type)===yZ&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex align-items-center mb-3",children:[" ",i===!0&&o.jsx(ca,{...t}),((f=e==null?void 0:e.attributes)==null?void 0:f.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",s?o.jsx(mse,{...t}):o.jsx("div",{className:"text-gray-900 font-bold text-xl",children:(h=e==null?void 0:e.label)==null?void 0:h[c]})]}),((g=e==null?void 0:e.options)==null?void 0:g.length)&&((v=e==null?void 0:e.options)==null?void 0:v.map(O=>{var F,P;return o.jsxs("div",{children:[o.jsxs("div",{className:"flex align-items-center mb-2",children:[o.jsx(ia,{inputId:O.uuid,name:e==null?void 0:e.uuid,value:O.uuid,onChange:H=>{(!l||!a)&&n(e==null?void 0:e.uuid,H==null?void 0:H.value)},checked:(r==null?void 0:r[e.uuid])===O.uuid,disabled:l||a}),o.jsx("label",{htmlFor:O.uuid,className:"ml-2",children:O.label})]}),(O==null?void 0:O.enableConditionalField)===!0&&(r==null?void 0:r[e==null?void 0:e.uuid])===(O==null?void 0:O.uuid)&&(O==null?void 0:O.children)&&((F=O==null?void 0:O.children)==null?void 0:F.length)>0&&((P=O==null?void 0:O.children)==null?void 0:P.map(()=>o.jsx(A7,{...t},`radio_child_${r==null?void 0:r[e==null?void 0:e.uuid]}`)))]},`${O.uuid}-radio-wrapper-${e==null?void 0:e.uuid}`)}))]}),(e==null?void 0:e.type)===AZ&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((m=e==null?void 0:e.attributes)==null?void 0:m.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[c]]}),o.jsx(wn,{className:"mt-2",onChange:O=>{var F;return n(e==null?void 0:e.uuid,(F=O==null?void 0:O.target)==null?void 0:F.value)},value:r==null?void 0:r.uuid,placeholder:(A=e==null?void 0:e.placeholder)==null?void 0:A[c],disabled:l||a})]})}),(e==null?void 0:e.type)===wZ&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((w=e==null?void 0:e.attributes)==null?void 0:w.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[c]]}),o.jsx(ef,{className:"mt-2",onChange:O=>{var F;return n(e==null?void 0:e.uuid,(F=O==null?void 0:O.target)==null?void 0:F.value)},value:r==null?void 0:r.uuid,placeholder:(C=e==null?void 0:e.placeholder)==null?void 0:C[c],disabled:l||a})]})}),(e==null?void 0:e.type)===SZ&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[c]]}),o.jsx(so,{className:"mt-2",onChange:O=>{var F;return n(e==null?void 0:e.uuid,(F=O==null?void 0:O.target)==null?void 0:F.value)},value:r==null?void 0:r.uuid,placeholder:(T=e==null?void 0:e.placeholder)==null?void 0:T[c],disabled:l||a})]})}),o.jsx("div",{children:((x=e==null?void 0:e.helperText)==null?void 0:x[c])!==""&&o.jsx("small",{children:(E=e==null?void 0:e.helperText)==null?void 0:E[c]})}),o.jsx("div",{children:((_=e==null?void 0:e.attributes)==null?void 0:_.required)&&o.jsx("small",{className:"error",children:u===1&&!(r!=null&&r[e.uuid])?(M=e==null?void 0:e.validationMesssage)==null?void 0:M.language:""})})]},`${e==null?void 0:e.uuid}-radio`)},vse=t=>{const{hirarechicalRadioSchemaState:e}=t,[n,r]=k.useState({});return o.jsx("div",{children:o.jsx(A7,{schema:e,field:e,update:(i,a)=>{const s={...n};s[i]=a,r(s)},value:n,sectionIndex:0,fieldIndex:0,pageIndex:0,rowIndex:0,columnIndex:0,path:""})})},w7={showHeaderText:!1,showHelperText:!1,showToolTip:!1,showLabel:!0,label:{english:"Field label"},abbreviationLabel:{english:""},helperText:{english:"Helper Text"},guidelines:{english:""},headerText:{english:"Header text"},textTable:{english:""},toolTip:{english:""},validationMesssage:{english:"This field is required"},placeholder:{english:""},enableConditionalField:!0},bse={uuid:nt(),...w7,type:"radio",value:null,options:[{uuid:nt(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:nt(),label:"No",value:null,enableConditionalField:!0,children:[]}]};({uuid:nt(),...w7,options:(nt(),{uuid:nt(),...w7,options:(nt(),nt())},nt())});const yse=t=>{const{fieldState:e,setFieldState:n}=t,r=(f,h,g)=>g==null?void 0:g.map(v=>{var m;return v.uuid===f?{...v,...h}:{...v,children:v!=null&&v.children&&((m=v==null?void 0:v.children)==null?void 0:m.length)>0?[...v.children.map(A=>A.type==="radio"?{...A,options:r(f,h,(A==null?void 0:A.options)||[])}:{...A})]:[]}}),i=(f,h,g)=>{const v=r(f,g,e.options);n(m=>({...m,options:v}))},a=(f,h,g)=>g==null?void 0:g.map(v=>{var m;return{...v,children:v!=null&&v.children&&((m=v==null?void 0:v.children)==null?void 0:m.length)>0?[...v.children.map(A=>A.uuid===f?{...A,...h}:{...A,options:a(f,h,A==null?void 0:A.options)})]:[]}}),s=(f,h)=>{const g=a(f,h,e.options);n(v=>({...v,options:g}))},l=(f,h)=>h==null?void 0:h.map(g=>{var v;return{...g,children:g!=null&&g.children&&((v=g==null?void 0:g.children)==null?void 0:v.length)>0?[...g.children.filter(m=>{if(m.uuid!==f)return{...m,options:l(f,m==null?void 0:m.options)}})]:[]}}),c=(f,h,g)=>g==null?void 0:g.map(v=>{var m;return v.children&&v.uuid===f?{...v,children:[...v.children,h]}:{...v,children:v!=null&&v.children&&((m=v==null?void 0:v.children)==null?void 0:m.length)>0?[...v.children.map(A=>({...A,options:c(f,h,A==null?void 0:A.options)}))]:[]}}),u=f=>{const h=c(f,{...bse,isValid:0,uuid:nt(),options:[{uuid:nt(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:nt(),label:"No",value:null,enableConditionalField:!0,children:[]}],isPostField:!1,showAlphabetList:!1,showButtonLayout:!1,answerOptions:[],isExternalSource:!1,underLined:!1,noOfMultpleAnswer:void 0,isAllowMultipleAnswer:!1,isIcon:!1,isTodayBtn:!1,resizableColumns:!1,isFilterable:!1,freezeColumn:!1,colToggle:!1,isFieldAnFilterOption:!1,isSortable:!1,reorderableColumns:!1,timeLimit:0,score:0,subject_id:0,course_category_id:0,TextEditorProps:!1,fieldData:void 0},e.options);n(g=>({...g,options:h}))},d=f=>{const h=l(f,e.options);n(g=>({...g,options:h}))};return o.jsx("div",{children:o.jsx("div",{className:" px-4",children:o.jsxs("div",{className:"grid",children:[o.jsx("div",{className:"col-6 scroll-height-200",children:(e==null?void 0:e.isHierarchalCondionalTabEnabled)===!0&&o.jsx(b7,{fieldState:e,updateCondtionOption:i,updateChildrenField:s,addChildrenField:u,removeChildrenField:d})}),o.jsxs("div",{className:"col-6 p-3 scroll-height-200",children:[o.jsx("h4",{className:"flex justify-content-center align-items-center",children:"Preview"}),o.jsx(vse,{hirarechicalRadioSchemaState:e})]})]})})})},Qi=t=>{var Z;const{formBuilderFormSchema:e,fieldSettingUpdate:n,fieldSettingUpdateInlineConditional:r,formBuilderSchemaLanguages:i,pageSettingUpdate:a,formBuilderFormLayout:s,formBuilderPublishedStatus:l,gridComponentFieldSettingUpdate:c}=sn(),{renderType:u}=Ht(),{visibilty:d,field:f,closeSettingFieldSidebar:h,pageIndex:g,sectionIndex:v,rowIndex:m,columnIndex:A,fieldIndex:w,path:C,row:S,typeName:T}=t,{updateGlobalToast:x}=Ht(),[E,_]=k.useState(f),M=C.split("-"),O=()=>{const K=C.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?r(K[fa],K[ha],K[Ca],K[xa],K[Ta],K[Fa],K[Go],K[wo],E):(K==null?void 0:K.length)>Fa&&(K==null?void 0:K.length)===Vl+1&&(E!=null&&E.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?c(K[fa],K[ha],K[Ca],K[xa],K[Ta],K[5],K[6],K[7],E):(n(g,v,m,A,w,{...E}),setTimeout(()=>{Rt.emit("OnSignatureSettingChange",{})},1e3),setTimeout(()=>{Rt.emit("onUpdateField",{})},1e3)),x({showToast:!0,toastMessage:"Updated",toastDetail:`${T} updated`,toastType:"success"})},F=(K,W,ge)=>{_(ve=>({...ve,[K]:{...ve[K],[W==null?void 0:W.type]:ge}}))},P=(K,W)=>{_(ge=>({...ge,attributes:{...ge.attributes,[K]:W}}))},H=(K,W)=>{_(ge=>({...ge,[K]:W}))},N=(K,W)=>{_(ge=>({...ge,inlineConditional:{...ge.inlineConditional,[K]:W}}))},$=()=>{},U=()=>{_(K=>({...K,data:[...K.data,{uuid:nt(),dataKey:"",value:""}]}))},le=()=>{_(K=>Object.assign({},K,{options:[...K.options,{uuid:nt(),optionText:{english:""},value:"",score:0,hyperlinkText:{english:""},abbreviationText:{english:""},custom_values:{}}]}))},G=()=>{},X=()=>{},ce=()=>{},Y=()=>{},ae=K=>{var Ie;const W=[...(E==null?void 0:E.conditionalTabRules.rules)||[]],ge=W.filter((be,de)=>K!==de);_(be=>({...be,conditionalTabRules:{...be.conditionalTabRules,rules:ge}}));const ve=W[K];(Ie=ve==null?void 0:ve.conditions)==null||Ie.map(be=>{const de=_t.findIndex(s,q=>{var ee;return(q==null?void 0:q.uuid)===((ee=be==null?void 0:be.tab)==null?void 0:ee.uuid)}),ne=s[de];ne&&(ne.isHidden=!1,a(de,ne))})},re=(K,W)=>{const ge=[...(E==null?void 0:E.conditionalTabRules.rules)||[]];ge[K].conditions=ge[K].conditions.filter((ve,Ie)=>W!==Ie),_(ve=>({...ve,conditionalTabRules:{...ve.conditionalTabRules,rules:ge}}))};return o.jsx(o.Fragment,{children:o.jsxs(To,{style:{width:"80vw",zIndex:7e3},visible:d,position:"left",className:"p-sidebar-lg",onHide:()=>h(),header:()=>{var K;return o.jsx("div",{className:"flex align-items-center gap-2 justify-content-between",children:o.jsxs("div",{className:"text-gray-900 font-bold text-2xl",children:[(K=f==null?void 0:f.label)==null?void 0:K.english," "]})})},"aria-label":"Field Setting Sidebar",children:[o.jsx("div",{className:"",children:o.jsxs(ss,{children:[o.jsx(Cr,{header:"Text",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(ao,{activeIndex:0,children:i!=null&&i.length?i.map((K,W)=>o.jsx(io,{tabIndex:W,header:K==null?void 0:K.language,children:o.jsx(nD,{language:K,fieldState:E,onHandleChange:F,...t})},W)):""})})}),(E==null?void 0:E.isValidationTabEnabled)===!0&&o.jsx(Cr,{header:"Validation",children:o.jsx(xte,{fieldState:E,onHandleChangeLayoutSettings:H,onHandleChangeAttributesSetttings:P,...t})}),o.jsx(Cr,{header:"Attributes",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(Tte,{fieldState:E,onHandleChangeLayoutSettings:H,onHandleChangeAttributesSetttings:P})})}),(E==null?void 0:E.isLayoutTabEnabled)===!0&&o.jsx(Cr,{header:"Layout",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(Bte,{fieldState:E,onHandleChangeLayoutSettings:H})})}),(E==null?void 0:E.isDynamicListingTabEnabled)===!0&&o.jsx(Cr,{header:"Dynamic Options",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(sse,{fieldState:E,setFieldState:_})})}),(E==null?void 0:E.options)!==void 0&&(E==null?void 0:E.data)&&o.jsx(Cr,{header:"Data",children:o.jsxs("div",{className:"scroll-height-200",children:[o.jsx(Vte,{onHandleChangeLayoutSettings:H,fieldState:E,setFieldState:_}),o.jsx(Ot,{className:"mr-3",label:"Data Option",icon:"pi pi-plus",onClick:()=>U(),"aria-label":"Add"})]})}),o.jsx(Cr,{header:"Table view options",children:o.jsx(ase,{fieldState:E,onHandleChangeLayoutSettings:H})}),(E==null?void 0:E.componentType)!=="radio-hierarchal"&&(E==null?void 0:E.options)!==void 0&&f.componentType!=="grid-component"&&f.componentType!=="matrix-dropdown"&&f.componentType!=="table"&&o.jsxs(Cr,{header:"Options",children:[(E==null?void 0:E.componentType)!=="radio-hierarchal"&&o.jsx("div",{className:"flex justify-content-end",children:o.jsx(Ot,{className:"mr-3 mb-2",label:"Option",icon:"pi pi-plus",onClick:()=>le(),"aria-label":"Option"})}),o.jsxs("div",{className:"scroll-height-200 px-4",children:[o.jsx(ao,{activeIndex:0,children:i!=null&&i.length?i.map((K,W)=>o.jsx(io,{tabIndex:W,header:K==null?void 0:K.language,children:o.jsx(fN,{enableAbbreviationColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableHyperTextColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableAddNewColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableCopyPaste:(E==null?void 0:E.componentType)!=="radio-hierarchal",isCustomValue:!1,fieldState:E,setFieldState:_,language:K})},W)):""}),(E==null?void 0:E.isHierarchalCondionalTabEnabled)===!0&&o.jsx(b7,{fieldState:E,onHandleChangeLayoutSettings:H,removeChildrenField:Y,addChildrenField:ce,updateChildrenField:X,updateCondtionOption:G})]})]}),(E==null?void 0:E.componentType)==="radio-hierarchal"&&(E==null?void 0:E.options)!==void 0&&f.componentType!=="grid-component"&&f.componentType!=="matrix-dropdown"&&f.componentType!=="table"&&o.jsx(Cr,{header:"Hierarchal Options",children:o.jsx(yse,{fieldState:E,setFieldState:_})}),u===e3&&(E==null?void 0:E.inlineConditionalRules)!==void 0&&!(S!=null&&S.rowIsRepeatable)&&(M==null?void 0:M.length)<wo+1&&o.jsx(Cr,{header:"Conditional",children:o.jsx(rse,{handleRemoveConditionalTabRule:ae,handleRemoveConditionalTabRuleCondition:re,onHandleSelectInlineConditionalOption:$,onHandleChangeLayoutSettings:H,onHandleChangeInlineConditionaltSetttings:N,fieldState:E,setFieldState:_,pageIndex:g,sectionIndex:v,...t})}),!((Z=t==null?void 0:t.row)!=null&&Z.rowIsRepeatable)&&(e==null?void 0:e.enableReviewTask)===!0&&o.jsx(Cr,{header:"Admin reviewer checklist",children:o.jsx(ise,{fieldState:E,setFieldState:_})})]})}),o.jsx("div",{className:"w-full px-4 py-3 surface-100 sidebar-footer",children:o.jsxs("div",{className:"flex flex-row gap-2 align-items-center justify-content-end",children:[o.jsx(Ot,{text:!0,label:"Close",type:"button",icon:"pi pi-times",onClick:()=>h(),"aria-label":"Close",size:"small",className:"p-button-danger"}),!l&&o.jsx(Ot,{size:"small",label:"Update",type:"button",outlined:!0,onClick:()=>O(),"aria-label":"Update"})]})})]})})},ki=t=>{const[e,n]=k.useState(null),{field:r}=t,{userTaskSubmitFormData:i,updateUserFormDataSubmit:a}=mr();k.useEffect(()=>{var h,g;if(i!==null&&e===null){let v=0;r!=null&&r.rowIsRepeatable?v=i.findIndex(m=>(m==null?void 0:m.rowId)===(r==null?void 0:r.uuid)):v=i.findIndex(m=>(m==null?void 0:m.fieldId)===(r==null?void 0:r.uuid)),n((h=i[v])!=null&&h.reviewerChecklist?(g=i[v])==null?void 0:g.reviewerChecklist:[])}return()=>{}},[r==null?void 0:r.rowIsRepeatable,r==null?void 0:r.uuid,e,i]);const s=h=>{const g=i.findIndex(m=>(m==null?void 0:m.fieldId)===(r==null?void 0:r.uuid)),v=[...i];v[g]={...v[g],reviewerChecklist:h},a(v)},l=(h,g)=>{const v=e;v[g]={...v[g],agree:h==null?void 0:h.value},n([...v]),s(v)},c=(h,g)=>{const v=e;if(g!=null&&g.checked)v[h].selectAction.push(g==null?void 0:g.value);else{const m=v[h].selectAction.findIndex(A=>A===(g==null?void 0:g.value));v[h].selectAction.splice(m,1)}n([...v]),s(v)},u=(h,g)=>{const v=e;h!=null&&h.checked?v[g]={...v[g],other:{...v[g].other,isOther:!0}}:v[g]={...v[g],other:{...v[g].other,isOther:!1}},n([...v]),s(v)},d=(h,g)=>{var m;const v=e;v[g]={...v[g],other:{...v[g].other,description:(m=h==null?void 0:h.target)==null?void 0:m.value}},n([...v]),s(v)},f=(h,g,v)=>{var A;const m=e;m[v]={...m[v],[g]:(A=h==null?void 0:h.target)==null?void 0:A.value},n([...m]),s(m)};return o.jsx(o.Fragment,{children:e!==null&&(e==null?void 0:e.length)>0?o.jsx(o.Fragment,{children:o.jsx(Zr,{header:"Reviewer Checklist",toggleable:!0,collapsed:!0,children:o.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:e==null?void 0:e.map((h,g)=>{var v,m,A,w,C;return o.jsxs("div",{className:"card p-fluid",style:{width:250},children:[o.jsx("h6",{className:"mb-2",children:h==null?void 0:h.checklist}),o.jsx("br",{}),o.jsxs("div",{className:"flex flex-row gap-3 mb-2",children:[o.jsxs("div",{className:"field-radiobutton",children:[o.jsx(ia,{inputId:`yes-${g}`,name:"action",value:!0,onChange:S=>{l(S,g)},checked:(h==null?void 0:h.agree)===!0}),o.jsx("label",{htmlFor:`yes-${g}`,children:"Yes"})]}),o.jsxs("div",{className:"field-radiobutton",children:[o.jsx(ia,{inputId:`no-${g}`,name:"action",value:!1,onChange:S=>{l(S,g)},checked:(h==null?void 0:h.agree)===!1}),o.jsx("label",{htmlFor:`no-${g}`,children:"No"})]})]}),(h==null?void 0:h.agree)===!1&&o.jsxs("div",{className:"px-5 mb-3",children:[(h==null?void 0:h.action)&&Array.isArray(h.action)&&((v=h==null?void 0:h.action)==null?void 0:v.length)>0&&((m=h==null?void 0:h.action)==null?void 0:m.map((S,T)=>{var x;return o.jsxs("div",{children:[o.jsx(Yr,{value:S,checked:((x=h==null?void 0:h.selectAction)==null?void 0:x.length)>0?h==null?void 0:h.selectAction.some(E=>E===S):!1,onChange:E=>{c(g,E)}})," ",S," ",o.jsx("br",{}),o.jsx("br",{})]},`action-${g}-${T}`)})),o.jsx(Yr,{checked:(A=h==null?void 0:h.other)==null?void 0:A.isOther,onChange:S=>{u(S,g)}})," Other ",o.jsx("br",{}),o.jsx("br",{}),((w=h==null?void 0:h.other)==null?void 0:w.isOther)===!0&&o.jsxs("div",{className:"",children:[o.jsx("label",{children:"If other please specify the action point"}),o.jsx("br",{}),o.jsx(so,{className:"mt-3",value:(C=h==null?void 0:h.other)==null?void 0:C.description,onChange:S=>d(S,g)})]})]}),(h==null?void 0:h.agree)===!1&&o.jsxs("div",{className:"",children:[o.jsx("label",{children:"Reviewer Feedback "}),o.jsx("br",{}),o.jsx(so,{className:"mt-3",value:h==null?void 0:h.reviewerFeedback,onChange:S=>f(S,"reviewerFeedback",g)})]}),o.jsxs("div",{className:"",children:[o.jsx("label",{children:"Reviewer Comments / Notes (internal use only)"}),o.jsx("br",{}),o.jsx(so,{className:"mt-3",value:h==null?void 0:h.reviewerComments,onChange:S=>f(S,"reviewerComments",g)})]})]},`checklistIndex-${g}`)})})})}):o.jsx(o.Fragment,{children:o.jsx("div",{className:"text-gray-900 flex justify-content-center align-items-center",children:"No Admin review is required"})})})},xi=t=>{const{isPreview:e,field:n,isAdmin:r,fieldWrap:i}=t,{userSelectedLanguage:a}=sn(),{globalAlignment:s}=Ht(),l=g=>{const v=g.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",m=`${g.className} justify-content-start`,A=`${g.titleClassName} pl-1`;return o.jsxs("div",{className:m,children:[o.jsxs("button",{className:g.togglerClassName,onClick:g.onTogglerClick,children:[o.jsx("span",{className:v}),o.jsx(Qt,{})]}),o.jsx("span",{className:A,children:d})]})},{TASK_PUBLISHED:c,task_status:u}=mr(),[d,f]=k.useState("");k.useEffect(()=>{var g;f((g=n==null?void 0:n.label)==null?void 0:g[a==null?void 0:a.type])},[n,a==null?void 0:a.type]);const h=()=>{let g="";return e||(g=g+" field-form-builder"),u===c&&r===!0&&(g=g+" card"),g};return o.jsx(o.Fragment,{children:o.jsx("div",{dir:s,className:h(),children:u===c&&r===!0?o.jsx(Zr,{headerTemplate:l,toggleable:!0,children:i}):i})})};/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:bN,setPrototypeOf:yN,isFrozen:Ase,getPrototypeOf:wse,getOwnPropertyDescriptor:Sse}=Object;let{freeze:Eo,seal:zl,create:AN}=Object,{apply:S7,construct:C7}=typeof Reflect<"u"&&Reflect;Eo||(Eo=function(e){return e}),zl||(zl=function(e){return e}),S7||(S7=function(e,n,r){return e.apply(n,r)}),C7||(C7=function(e,n){return new e(...n)});const O3=vl(Array.prototype.forEach),wN=vl(Array.prototype.pop),Jp=vl(Array.prototype.push),F3=vl(String.prototype.toLowerCase),x7=vl(String.prototype.toString),SN=vl(String.prototype.match),Zp=vl(String.prototype.replace),Cse=vl(String.prototype.indexOf),xse=vl(String.prototype.trim),Tc=vl(Object.prototype.hasOwnProperty),Io=vl(RegExp.prototype.test),e2=Tse(TypeError);function vl(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S7(t,e,r)}}function Tse(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return C7(t,n)}}function hi(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:F3;yN&&yN(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const a=n(i);a!==i&&(Ase(e)||(e[r]=a),i=a)}t[i]=!0}return t}function Ese(t){for(let e=0;e<t.length;e++)Tc(t,e)||(t[e]=null);return t}function J0(t){const e=AN(null);for(const[n,r]of bN(t))Tc(t,n)&&(Array.isArray(r)?e[n]=Ese(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=J0(r):e[n]=r);return e}function t2(t,e){for(;t!==null;){const r=Sse(t,e);if(r){if(r.get)return vl(r.get);if(typeof r.value=="function")return vl(r.value)}t=wse(t)}function n(){return null}return n}const CN=Eo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T7=Eo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),E7=Eo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ise=Eo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),I7=Eo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_se=Eo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xN=Eo(["#text"]),TN=Eo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),_7=Eo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),EN=Eo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),k3=Eo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Dse=zl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Nse=zl(/<%[\w\W]*|[\w\W]*%>/gm),Ose=zl(/\${[\w\W]*}/gm),Fse=zl(/^data-[\-\w.\u00B7-\uFFFF]/),kse=zl(/^aria-[\-\w]+$/),IN=zl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pse=zl(/^(?:\w+script|data):/i),Mse=zl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_N=zl(/^html$/i),Lse=zl(/^[a-z][.\w]*(-[.\w]+)+$/i);var DN=Object.freeze({__proto__:null,MUSTACHE_EXPR:Dse,ERB_EXPR:Nse,TMPLIT_EXPR:Ose,DATA_ATTR:Fse,ARIA_ATTR:kse,IS_ALLOWED_URI:IN,IS_SCRIPT_OR_DATA:Pse,ATTR_WHITESPACE:Mse,DOCTYPE_NAME:_N,CUSTOM_ELEMENT:Lse});const n2={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Bse=function(){return typeof window>"u"?null:window},Vse=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function NN(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bse();const e=It=>NN(It);if(e.version="3.1.7",e.removed=[],!t||!t.document||t.document.nodeType!==n2.document)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:g}=t,v=c.prototype,m=t2(v,"cloneNode"),A=t2(v,"remove"),w=t2(v,"nextSibling"),C=t2(v,"childNodes"),S=t2(v,"parentNode");if(typeof s=="function"){const It=n.createElement("template");It.content&&It.content.ownerDocument&&(n=It.content.ownerDocument)}let T,x="";const{implementation:E,createNodeIterator:_,createDocumentFragment:M,getElementsByTagName:O}=n,{importNode:F}=r;let P={};e.isSupported=typeof bN=="function"&&typeof S=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:N,TMPLIT_EXPR:$,DATA_ATTR:U,ARIA_ATTR:le,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:X,CUSTOM_ELEMENT:ce}=DN;let{IS_ALLOWED_URI:Y}=DN,ae=null;const re=hi({},[...CN,...T7,...E7,...I7,...xN]);let Z=null;const K=hi({},[...TN,..._7,...EN,...k3]);let W=Object.seal(AN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ge=null,ve=null,Ie=!0,be=!0,de=!1,ne=!0,q=!1,ee=!0,oe=!1,pe=!1,Ce=!1,De=!1,me=!1,Te=!1,Pe=!0,Ee=!1;const j="user-content-";let he=!0,ye=!1,se={},fe=null;const Ae=hi({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ne=null;const Le=hi({},["audio","video","img","source","image","track"]);let ze=null;const tt=hi({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),it="http://www.w3.org/1998/Math/MathML",ht="http://www.w3.org/2000/svg",Ut="http://www.w3.org/1999/xhtml";let fn=Ut,$t=!1,mn=null;const En=hi({},[it,ht,Ut],x7);let Tt=null;const je=["application/xhtml+xml","text/html"],He="text/html";let ot=null,rn=null;const nn=n.createElement("form"),Jt=function(Fe){return Fe instanceof RegExp||Fe instanceof Function},_n=function(){let Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rn&&rn===Fe)){if((!Fe||typeof Fe!="object")&&(Fe={}),Fe=J0(Fe),Tt=je.indexOf(Fe.PARSER_MEDIA_TYPE)===-1?He:Fe.PARSER_MEDIA_TYPE,ot=Tt==="application/xhtml+xml"?x7:F3,ae=Tc(Fe,"ALLOWED_TAGS")?hi({},Fe.ALLOWED_TAGS,ot):re,Z=Tc(Fe,"ALLOWED_ATTR")?hi({},Fe.ALLOWED_ATTR,ot):K,mn=Tc(Fe,"ALLOWED_NAMESPACES")?hi({},Fe.ALLOWED_NAMESPACES,x7):En,ze=Tc(Fe,"ADD_URI_SAFE_ATTR")?hi(J0(tt),Fe.ADD_URI_SAFE_ATTR,ot):tt,Ne=Tc(Fe,"ADD_DATA_URI_TAGS")?hi(J0(Le),Fe.ADD_DATA_URI_TAGS,ot):Le,fe=Tc(Fe,"FORBID_CONTENTS")?hi({},Fe.FORBID_CONTENTS,ot):Ae,ge=Tc(Fe,"FORBID_TAGS")?hi({},Fe.FORBID_TAGS,ot):{},ve=Tc(Fe,"FORBID_ATTR")?hi({},Fe.FORBID_ATTR,ot):{},se=Tc(Fe,"USE_PROFILES")?Fe.USE_PROFILES:!1,Ie=Fe.ALLOW_ARIA_ATTR!==!1,be=Fe.ALLOW_DATA_ATTR!==!1,de=Fe.ALLOW_UNKNOWN_PROTOCOLS||!1,ne=Fe.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=Fe.SAFE_FOR_TEMPLATES||!1,ee=Fe.SAFE_FOR_XML!==!1,oe=Fe.WHOLE_DOCUMENT||!1,De=Fe.RETURN_DOM||!1,me=Fe.RETURN_DOM_FRAGMENT||!1,Te=Fe.RETURN_TRUSTED_TYPE||!1,Ce=Fe.FORCE_BODY||!1,Pe=Fe.SANITIZE_DOM!==!1,Ee=Fe.SANITIZE_NAMED_PROPS||!1,he=Fe.KEEP_CONTENT!==!1,ye=Fe.IN_PLACE||!1,Y=Fe.ALLOWED_URI_REGEXP||IN,fn=Fe.NAMESPACE||Ut,W=Fe.CUSTOM_ELEMENT_HANDLING||{},Fe.CUSTOM_ELEMENT_HANDLING&&Jt(Fe.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=Fe.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Fe.CUSTOM_ELEMENT_HANDLING&&Jt(Fe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=Fe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Fe.CUSTOM_ELEMENT_HANDLING&&typeof Fe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=Fe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(be=!1),me&&(De=!0),se&&(ae=hi({},xN),Z=[],se.html===!0&&(hi(ae,CN),hi(Z,TN)),se.svg===!0&&(hi(ae,T7),hi(Z,_7),hi(Z,k3)),se.svgFilters===!0&&(hi(ae,E7),hi(Z,_7),hi(Z,k3)),se.mathMl===!0&&(hi(ae,I7),hi(Z,EN),hi(Z,k3))),Fe.ADD_TAGS&&(ae===re&&(ae=J0(ae)),hi(ae,Fe.ADD_TAGS,ot)),Fe.ADD_ATTR&&(Z===K&&(Z=J0(Z)),hi(Z,Fe.ADD_ATTR,ot)),Fe.ADD_URI_SAFE_ATTR&&hi(ze,Fe.ADD_URI_SAFE_ATTR,ot),Fe.FORBID_CONTENTS&&(fe===Ae&&(fe=J0(fe)),hi(fe,Fe.FORBID_CONTENTS,ot)),he&&(ae["#text"]=!0),oe&&hi(ae,["html","head","body"]),ae.table&&(hi(ae,["tbody"]),delete ge.tbody),Fe.TRUSTED_TYPES_POLICY){if(typeof Fe.TRUSTED_TYPES_POLICY.createHTML!="function")throw e2('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Fe.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw e2('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=Fe.TRUSTED_TYPES_POLICY,x=T.createHTML("")}else T===void 0&&(T=Vse(g,i)),T!==null&&typeof x=="string"&&(x=T.createHTML(""));Eo&&Eo(Fe),rn=Fe}},wt=hi({},["mi","mo","mn","ms","mtext"]),Ke=hi({},["annotation-xml"]),st=hi({},["title","style","font","a","script"]),vt=hi({},[...T7,...E7,...Ise]),Vt=hi({},[...I7,..._se]),On=function(Fe){let Qe=S(Fe);(!Qe||!Qe.tagName)&&(Qe={namespaceURI:fn,tagName:"template"});const At=F3(Fe.tagName),jt=F3(Qe.tagName);return mn[Fe.namespaceURI]?Fe.namespaceURI===ht?Qe.namespaceURI===Ut?At==="svg":Qe.namespaceURI===it?At==="svg"&&(jt==="annotation-xml"||wt[jt]):!!vt[At]:Fe.namespaceURI===it?Qe.namespaceURI===Ut?At==="math":Qe.namespaceURI===ht?At==="math"&&Ke[jt]:!!Vt[At]:Fe.namespaceURI===Ut?Qe.namespaceURI===ht&&!Ke[jt]||Qe.namespaceURI===it&&!wt[jt]?!1:!Vt[At]&&(st[At]||!vt[At]):!!(Tt==="application/xhtml+xml"&&mn[Fe.namespaceURI]):!1},$n=function(Fe){Jp(e.removed,{element:Fe});try{S(Fe).removeChild(Fe)}catch{A(Fe)}},lr=function(Fe,Qe){try{Jp(e.removed,{attribute:Qe.getAttributeNode(Fe),from:Qe})}catch{Jp(e.removed,{attribute:null,from:Qe})}if(Qe.removeAttribute(Fe),Fe==="is"&&!Z[Fe])if(De||me)try{$n(Qe)}catch{}else try{Qe.setAttribute(Fe,"")}catch{}},Wn=function(Fe){let Qe=null,At=null;if(Ce)Fe="<remove></remove>"+Fe;else{const Zt=SN(Fe,/^[\r\n\t ]+/);At=Zt&&Zt[0]}Tt==="application/xhtml+xml"&&fn===Ut&&(Fe='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Fe+"</body></html>");const jt=T?T.createHTML(Fe):Fe;if(fn===Ut)try{Qe=new h().parseFromString(jt,Tt)}catch{}if(!Qe||!Qe.documentElement){Qe=E.createDocument(fn,"template",null);try{Qe.documentElement.innerHTML=$t?x:jt}catch{}}const Xt=Qe.body||Qe.documentElement;return Fe&&At&&Xt.insertBefore(n.createTextNode(At),Xt.childNodes[0]||null),fn===Ut?O.call(Qe,oe?"html":"body")[0]:oe?Qe.documentElement:Xt},br=function(Fe){return _.call(Fe.ownerDocument||Fe,Fe,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Nr=function(Fe){return Fe instanceof f&&(typeof Fe.nodeName!="string"||typeof Fe.textContent!="string"||typeof Fe.removeChild!="function"||!(Fe.attributes instanceof d)||typeof Fe.removeAttribute!="function"||typeof Fe.setAttribute!="function"||typeof Fe.namespaceURI!="string"||typeof Fe.insertBefore!="function"||typeof Fe.hasChildNodes!="function")},yn=function(Fe){return typeof l=="function"&&Fe instanceof l},lt=function(Fe,Qe,At){P[Fe]&&O3(P[Fe],jt=>{jt.call(e,Qe,At,rn)})},ut=function(Fe){let Qe=null;if(lt("beforeSanitizeElements",Fe,null),Nr(Fe))return $n(Fe),!0;const At=ot(Fe.nodeName);if(lt("uponSanitizeElement",Fe,{tagName:At,allowedTags:ae}),Fe.hasChildNodes()&&!yn(Fe.firstElementChild)&&Io(/<[/\w]/g,Fe.innerHTML)&&Io(/<[/\w]/g,Fe.textContent)||Fe.nodeType===n2.progressingInstruction||ee&&Fe.nodeType===n2.comment&&Io(/<[/\w]/g,Fe.data))return $n(Fe),!0;if(!ae[At]||ge[At]){if(!ge[At]&&Nt(At)&&(W.tagNameCheck instanceof RegExp&&Io(W.tagNameCheck,At)||W.tagNameCheck instanceof Function&&W.tagNameCheck(At)))return!1;if(he&&!fe[At]){const jt=S(Fe)||Fe.parentNode,Xt=C(Fe)||Fe.childNodes;if(Xt&&jt){const Zt=Xt.length;for(let Sn=Zt-1;Sn>=0;--Sn){const Ln=m(Xt[Sn],!0);Ln.__removalCount=(Fe.__removalCount||0)+1,jt.insertBefore(Ln,w(Fe))}}}return $n(Fe),!0}return Fe instanceof c&&!On(Fe)||(At==="noscript"||At==="noembed"||At==="noframes")&&Io(/<\/no(script|embed|frames)/i,Fe.innerHTML)?($n(Fe),!0):(q&&Fe.nodeType===n2.text&&(Qe=Fe.textContent,O3([H,N,$],jt=>{Qe=Zp(Qe,jt," ")}),Fe.textContent!==Qe&&(Jp(e.removed,{element:Fe.cloneNode()}),Fe.textContent=Qe)),lt("afterSanitizeElements",Fe,null),!1)},yt=function(Fe,Qe,At){if(Pe&&(Qe==="id"||Qe==="name")&&(At in n||At in nn))return!1;if(!(be&&!ve[Qe]&&Io(U,Qe))){if(!(Ie&&Io(le,Qe))){if(!Z[Qe]||ve[Qe]){if(!(Nt(Fe)&&(W.tagNameCheck instanceof RegExp&&Io(W.tagNameCheck,Fe)||W.tagNameCheck instanceof Function&&W.tagNameCheck(Fe))&&(W.attributeNameCheck instanceof RegExp&&Io(W.attributeNameCheck,Qe)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(Qe))||Qe==="is"&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&Io(W.tagNameCheck,At)||W.tagNameCheck instanceof Function&&W.tagNameCheck(At))))return!1}else if(!ze[Qe]){if(!Io(Y,Zp(At,X,""))){if(!((Qe==="src"||Qe==="xlink:href"||Qe==="href")&&Fe!=="script"&&Cse(At,"data:")===0&&Ne[Fe])){if(!(de&&!Io(G,Zp(At,X,"")))){if(At)return!1}}}}}}return!0},Nt=function(Fe){return Fe!=="annotation-xml"&&SN(Fe,ce)},An=function(Fe){lt("beforeSanitizeAttributes",Fe,null);const{attributes:Qe}=Fe;if(!Qe)return;const At={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z};let jt=Qe.length;for(;jt--;){const Xt=Qe[jt],{name:Zt,namespaceURI:Sn,value:Ln}=Xt,zn=ot(Zt);let at=Zt==="value"?Ln:xse(Ln);if(At.attrName=zn,At.attrValue=at,At.keepAttr=!0,At.forceKeepAttr=void 0,lt("uponSanitizeAttribute",Fe,At),at=At.attrValue,At.forceKeepAttr||(lr(Zt,Fe),!At.keepAttr))continue;if(!ne&&Io(/\/>/i,at)){lr(Zt,Fe);continue}q&&O3([H,N,$],Me=>{at=Zp(at,Me," ")});const ie=ot(Fe.nodeName);if(yt(ie,zn,at)){if(Ee&&(zn==="id"||zn==="name")&&(lr(Zt,Fe),at=j+at),ee&&Io(/((--!?|])>)|<\/(style|title)/i,at)){lr(Zt,Fe);continue}if(T&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Sn)switch(g.getAttributeType(ie,zn)){case"TrustedHTML":{at=T.createHTML(at);break}case"TrustedScriptURL":{at=T.createScriptURL(at);break}}try{Sn?Fe.setAttributeNS(Sn,Zt,at):Fe.setAttribute(Zt,at),Nr(Fe)?$n(Fe):wN(e.removed)}catch{}}}lt("afterSanitizeAttributes",Fe,null)},Nn=function It(Fe){let Qe=null;const At=br(Fe);for(lt("beforeSanitizeShadowDOM",Fe,null);Qe=At.nextNode();)lt("uponSanitizeShadowNode",Qe,null),!ut(Qe)&&(Qe.content instanceof a&&It(Qe.content),An(Qe));lt("afterSanitizeShadowDOM",Fe,null)};return e.sanitize=function(It){let Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Qe=null,At=null,jt=null,Xt=null;if($t=!It,$t&&(It="<!-->"),typeof It!="string"&&!yn(It))if(typeof It.toString=="function"){if(It=It.toString(),typeof It!="string")throw e2("dirty is not a string, aborting")}else throw e2("toString is not a function");if(!e.isSupported)return It;if(pe||_n(Fe),e.removed=[],typeof It=="string"&&(ye=!1),ye){if(It.nodeName){const Ln=ot(It.nodeName);if(!ae[Ln]||ge[Ln])throw e2("root node is forbidden and cannot be sanitized in-place")}}else if(It instanceof l)Qe=Wn("<!---->"),At=Qe.ownerDocument.importNode(It,!0),At.nodeType===n2.element&&At.nodeName==="BODY"||At.nodeName==="HTML"?Qe=At:Qe.appendChild(At);else{if(!De&&!q&&!oe&&It.indexOf("<")===-1)return T&&Te?T.createHTML(It):It;if(Qe=Wn(It),!Qe)return De?null:Te?x:""}Qe&&Ce&&$n(Qe.firstChild);const Zt=br(ye?It:Qe);for(;jt=Zt.nextNode();)ut(jt)||(jt.content instanceof a&&Nn(jt.content),An(jt));if(ye)return It;if(De){if(me)for(Xt=M.call(Qe.ownerDocument);Qe.firstChild;)Xt.appendChild(Qe.firstChild);else Xt=Qe;return(Z.shadowroot||Z.shadowrootmode)&&(Xt=F.call(r,Xt,!0)),Xt}let Sn=oe?Qe.outerHTML:Qe.innerHTML;return oe&&ae["!doctype"]&&Qe.ownerDocument&&Qe.ownerDocument.doctype&&Qe.ownerDocument.doctype.name&&Io(_N,Qe.ownerDocument.doctype.name)&&(Sn="<!DOCTYPE "+Qe.ownerDocument.doctype.name+`>
2290
2290
  `+Sn),q&&O3([H,N,$],Ln=>{Sn=Zp(Sn,Ln," ")}),T&&Te?T.createHTML(Sn):Sn},e.setConfig=function(){let It=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_n(It),pe=!0},e.clearConfig=function(){rn=null,pe=!1},e.isValidAttribute=function(It,Fe,Qe){rn||_n({});const At=ot(It),jt=ot(Fe);return yt(At,jt,Qe)},e.addHook=function(It,Fe){typeof Fe=="function"&&(P[It]=P[It]||[],Jp(P[It],Fe))},e.removeHook=function(It){if(P[It])return wN(P[It])},e.removeHooks=function(It){P[It]&&(P[It]=[])},e.removeAllHooks=function(){P={}},e}var P3=NN();const aa=t=>{var C;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,path:l}=t,[c,u]=k.useState(e);k.useEffect(()=>{var S;return A((S=e==null?void 0:e.label)==null?void 0:S[d==null?void 0:d.type]),()=>{}},[e]);const{userSelectedLanguage:d,fieldSettingUpdate:f,fieldSettingUpdateInlineConditional:h,gridComponentFieldSettingUpdate:g}=sn(),v=(S,T,x)=>{u(E=>({...E,[S]:{...E[S],[T==null?void 0:T.type]:x}}))},[m,A]=k.useState((C=e==null?void 0:e.label)==null?void 0:C[d==null?void 0:d.type]);k.useEffect(()=>(w(),()=>{}),[c]);const w=()=>{const S=l.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?h(S[fa],S[ha],S[Ca],S[xa],S[Ta],S[Fa],S[Go],S[wo],c):(S==null?void 0:S.length)>Fa&&(S==null?void 0:S.length)===Vl+1&&(e!=null&&e.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?g(S[fa],S[ha],S[Ca],S[xa],S[Ta],S[5],S[6],S[7],c):f(r,i,a,s,n,{...e,label:c==null?void 0:c.label})};return o.jsx(o.Fragment,{children:o.jsx(N3,{style:{display:"inline-block"},className:"builder-input-label-edit",html:m,disabled:!1,onChange:S=>{var T;A(P3.sanitize((T=S==null?void 0:S.target)==null?void 0:T.value))},onBlur:S=>{var x;const T=P3.sanitize((x=S==null?void 0:S.target)==null?void 0:x.innerText);A(T),v("label",d,T)},tagName:"article"})})},Z0=t=>{const{onLabel:e,offLabel:n,onIcon:r,offIcon:i,onHandleChangeSetttings:a,settingsKey:s,settingsKeyValue:l}=t;return o.jsx(o.Fragment,{children:o.jsx(qp,{checked:l,onLabel:e,onChange:c=>{a(s,c.value)},offLabel:n,onIcon:r,offIcon:i,className:"mr-1 px-1",style:{fontSize:"0.8rem"}})})},Wr=t=>{var le,G,X,ce;const{field:e,fieldIndex:n,columnIndex:r,sectionIndex:i,rowIndex:a,pageIndex:s,type:l,path:c,handleFieldSettingsSidebar:u,showFieldIcons:d=!0,showSettingsIcon:f=!0}=t,{emitSocketData:h,renderType:g}=Ht(),v=(Y,ae)=>{P(re=>({...re,[Y]:ae}))},{fieldSettingUpdate:m,fieldSettingUpdateInlineConditional:A,cloneField:w,gridComponentFieldSettingUpdate:C,fieldSettingDeleteInlineConditional:S,gridComponentFieldDelete:T,removeField:x}=sn(),{updateGlobalToast:E}=Ht(),_=Y=>{const ae=c.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?A(ae[fa],ae[ha],ae[Ca],ae[xa],ae[Ta],ae[Fa],ae[Go],ae[wo],Y):(ae==null?void 0:ae.length)>Fa&&(ae==null?void 0:ae.length)===Vl+1&&(Y!=null&&Y.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?C(ae[fa],ae[ha],ae[Ca],ae[xa],ae[Ta],ae[5],ae[6],ae[7],Y):m(s,i,a,r,n,Y),E({showToast:!0,toastMessage:"Updated",toastDetail:"Field updated",toastType:"success"})},[M,O]=k.useState(!1),[F,P]=k.useState({custom_component_title:"",custom_component_description:""}),H=()=>{P(Y=>({...Y,custom_component_schema:e})),O(!0)},N=()=>{const Y=c.split("-").map(Number);l==="inline-conditional"?S(Y[fa],Y[ha],Y[Ca],Y[xa],Y[Ta],Y[Fa],Y[Go],Y[wo]):(Y==null?void 0:Y.length)>Fa&&(Y==null?void 0:Y.length)===Vl+1&&(e!=null&&e.componentType)&&l==="grid"?T(Y[fa],Y[ha],Y[Ca],Y[xa],Y[Ta],Y[5],Y[6],Y[7]):x(s,i,a,r,n)},$=(Y,ae)=>{const re={...e,attributes:{...e.attributes,[Y]:ae}};_(re)},U=(Y,ae)=>{const re={...e,[Y]:ae};_(re)};return o.jsx(o.Fragment,{children:o.jsxs("div",{className:`${(e==null?void 0:e.componentType)!=="hidden-field"&&(e==null?void 0:e.componentType)!=="image"&&(e==null?void 0:e.componentType)!=="quiz"&&(e==null?void 0:e.componentType)!=="document"&&(e==null?void 0:e.componentType)!=="href"&&(e==null?void 0:e.componentType)!=="paragraph"&&(e==null?void 0:e.componentType)!=="heading"&&(e==null?void 0:e.componentType)!=="list"&&(e==null?void 0:e.componentType)!=="hr"&&(e==null?void 0:e.componentType)!=="image-gallery"&&(e==null?void 0:e.componentType)!=="video"&&(e==null?void 0:e.componentType)!=="question","builder-element-quick-options mb-2 w-3 justify-content-center"} flex quick-setting`,children:[o.jsx(o.Fragment,{children:(e==null?void 0:e.componentType)!=="hidden-field"&&(e==null?void 0:e.componentType)!=="document"&&(e==null?void 0:e.componentType)!=="quiz"&&(e==null?void 0:e.componentType)!=="image"&&(e==null?void 0:e.componentType)!=="href"&&(e==null?void 0:e.componentType)!=="paragraph"&&(e==null?void 0:e.componentType)!=="heading"&&(e==null?void 0:e.componentType)!=="list"&&(e==null?void 0:e.componentType)!=="hr"&&(e==null?void 0:e.componentType)!=="image-gallery"&&(e==null?void 0:e.componentType)!=="video"&&(e==null?void 0:e.componentType)!=="question"&&d===!1&&o.jsxs("div",{className:" ",children:[o.jsx(Z0,{field:e,onHandleChangeSetttings:$,settingsKey:"required",settingsKeyValue:(le=e==null?void 0:e.attributes)==null?void 0:le.required,onLabel:"Required",offLabel:"Not Required",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:(G=e==null?void 0:e.attributes)==null?void 0:G.required}),o.jsx(Z0,{field:e,onHandleChangeSetttings:U,settingsKey:"showToolTip",settingsKeyValue:e==null?void 0:e.showToolTip,onLabel:"Tooltip",offLabel:"Tooltip",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showToolTip}),o.jsx(Z0,{field:e,onHandleChangeSetttings:U,settingsKey:"showHelperText",settingsKeyValue:e==null?void 0:e.showHelperText,onLabel:"Helper text",offLabel:"Helper text",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showHelperText}),o.jsx(Z0,{field:e,onHandleChangeSetttings:U,settingsKey:"showHeaderText",settingsKeyValue:e==null?void 0:e.showHeaderText,onLabel:"Header text",offLabel:"Header text",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showHeaderText}),o.jsx(Z0,{field:e,onHandleChangeSetttings:U,settingsKey:"isFluid",settingsKeyValue:e==null?void 0:e.isFluid,onLabel:"Fluid",offLabel:"Fluid",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.isFluid}),(e==null?void 0:e.componentType)=="radio"&&o.jsxs(o.Fragment,{children:[o.jsx(Z0,{field:e,onHandleChangeSetttings:U,settingsKey:"showAlphabetList",settingsKeyValue:e==null?void 0:e.showAlphabetList,onLabel:"Alpha",offLabel:"Alpha",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showAlphabetList}),o.jsx(Z0,{field:e,onHandleChangeSetttings:$,settingsKey:"style",settingsKeyValue:(X=e==null?void 0:e.attributes)==null?void 0:X.style,onLabel:"Style",offLabel:"Style",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:(ce=e==null?void 0:e.attributes)==null?void 0:ce.style})]})]})}),o.jsxs("div",{className:"quick-setting",children:[f===!0&&o.jsxs("span",{className:"p-buttonset",children:[(e==null?void 0:e.componentType)!=="hr"&&o.jsx(Ot,{text:!0,size:"small",tooltip:"Advanced settings",icon:"pi pi-cog",onClick:()=>{u(!0)},className:"mr-3"}),o.jsx(Ot,{size:"small",text:!0,icon:"pi pi-clone",outlined:!0,onClick:()=>{w(e,s,i,a,r,n),h()},tooltip:"Clone"}),o.jsx(Ot,{text:!0,className:"p-button-danger",size:"small",outlined:!0,icon:"pi pi-trash",onClick:()=>{N()},tooltip:"Delete"}),(g===e3||g===k0)&&o.jsx(Ot,{text:!0,size:"small",outlined:!0,icon:"pi pi-file",tooltip:"Save as custom component",onClick:()=>{H()}})]}),o.jsxs(Os,{header:"Custom component save",visible:M,style:{width:"20vw"},footer:()=>o.jsx(o.Fragment,{children:o.jsxs("div",{children:[o.jsx(Ot,{size:"small",text:!0,label:"Close",icon:"pi pi-times",onClick:()=>O(!1),className:"p-button-text"}),(e==null?void 0:e.componentType)!=="hidden-field"&&o.jsx(Ot,{text:!0,label:"Save",icon:"pi pi-check",onClick:()=>{O(!1)},autoFocus:!0})]})}),onHide:()=>O(!1),children:[o.jsxs("span",{className:"p-float-label",children:[o.jsx(wn,{id:"custom_component_title",name:"custom_component_title",className:"w-full",value:(F==null?void 0:F.custom_component_title)||"",onChange:Y=>{var ae;return v("custom_component_title",(ae=Y==null?void 0:Y.target)==null?void 0:ae.value)}}),o.jsx("label",{htmlFor:"username",children:"Custom component title"})]}),o.jsxs("span",{className:"p-float-label mt-5",children:[o.jsx(so,{id:"custom_component_description",name:"custom_component_description",className:"w-full",value:(F==null?void 0:F.custom_component_description)||"",onChange:Y=>{var ae;return v("custom_component_description",(ae=Y==null?void 0:Y.target)==null?void 0:ae.value)}}),o.jsx("label",{htmlFor:"username",children:"Custom component description"})]})]})]})]})})},qse=t=>{var re,Z,K,W,ge,ve,Ie,be;const{pageIndex:e,sectionIndex:n,field:r,fieldIndex:i,row:a,rowIndex:s,columnIndex:l,isDisabled:c}=t,{isAdmin:u,isBuilderMode:d}=Ht(),{userSelectedLanguage:f,fieldSettingUpdate:h}=sn(),{taskRegisterData:g,updateTaskRegisterData:v,updateTaskProgressValue:m,updateUserFormDataSubmit:A,userTaskSubmitFormData:w}=mr(),[C,S]=k.useState(!1),[T,x]=k.useState(!1),[E,_]=k.useState(null),[M,O]=k.useState(0),[F,P]=k.useState(!1),H=()=>{P(!0)},N=()=>{P(!1)},$=de=>{S(de)},U=()=>{S(!1)},le=()=>{var de,ne,q;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const ee=[...a.repeatableFields],oe=_t.findIndex(ee,function(pe){return pe.uuid===(r==null?void 0:r.uuid)});oe>=0&&ee[oe].fieldData?_(ee[oe].fieldData):(r.isValid=0,_(null))}}else{const ee=w,oe=_t.cloneDeep(g);if(ee!=null&&ee.length){for(const pe of ee)if(pe.fieldId===t.field.uuid&&((de=pe==null?void 0:pe.postData)!=null&&de.length)){_((ne=pe==null?void 0:pe.postData[0])==null?void 0:ne.postValue),oe[r==null?void 0:r.uuid]=(q=pe==null?void 0:pe.postData[0])==null?void 0:q.postValue;const Ce=Object.keys(oe).length;m(Ce);break}}}x(!0)},G=de=>{var oe;_(de.target.value);const ne=w,q=_t.cloneDeep(g);if((oe=de==null?void 0:de.target)!=null&&oe.value&&(ne==null?void 0:ne.length)>0)for(const pe of ne)pe.fieldId===t.field.uuid&&(q[r==null?void 0:r.uuid]=de==null?void 0:de.value,pe.postData[0]={postValue:de.value});else delete q[r==null?void 0:r.uuid];v(q);const ee=Object.keys(q).length;m(ee)};k.useEffect(()=>{T||le();const de=Rt.addListener("clearRepeatableFields",ee=>{ee===(a==null?void 0:a.uuid)&&(_(null),O(0),r.isValid=0,h(e,n,s,l,i,r))}),ne=Rt.addListener("onSubmitUserForm",()=>{var ee;(ee=r==null?void 0:r.attributes)!=null&&ee.required?E!==null||E!==void 0?r.isValid=1:(console.log("Countr field in valid ",E),r.isValid=0):r.isValid=1}),q=Rt.addListener("OnInvalidFieldCatch",ee=>{console.log("OnInvalidFieldCatch listener"),console.log("field.uuid === value?.fieldId",r.uuid===(ee==null?void 0:ee.fieldId)),r.uuid===(ee==null?void 0:ee.fieldId)?O(1):O(0)});return()=>{ne.remove(),q.remove(),de.remove()}});const X=(de,ne)=>{var q;if(w){const ee=[...w],oe=_t.findIndex(ee,function(Ce){return Ce.rowId===(a==null?void 0:a.uuid)});let pe=(q=w[oe])==null?void 0:q.repeatableFields;pe={...pe,[de==null?void 0:de.uuid]:ne==null?void 0:ne.name},ee[oe]={...ee[oe],repeatableFields:pe},A(ee)}_(ne),console.log("value !== null country",ne!==null),ne!==null?de.isValid=1:de.isValid=0},ce=(de,ne)=>de?o.jsxs("div",{className:"country-item flex",children:[o.jsx("img",{alt:de.name,src:de==null?void 0:de.image,onError:q=>q.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",style:{width:"20px",marginRight:10}}),o.jsx("div",{children:de.name})]}):o.jsx("span",{children:ne.placeholder}),Y=de=>o.jsxs("div",{className:"country-item flex",children:[o.jsx("img",{alt:de.name,src:de==null?void 0:de.image,onError:ne=>ne.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",style:{width:"20px",marginRight:10}}),o.jsx("div",{children:de.name})]}),ae=o.jsxs("div",{onMouseOver:H,onMouseOut:N,children:[d&&F&&o.jsx(Wr,{handleFieldSettingsSidebar:$,...t}),o.jsxs("div",{className:`field ${d?" py-3 px-4 builder-element-wrapper ":""}${(r==null?void 0:r.isFluid)===!0&&" p-fluid"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"field-form-builder col-12 ":"col-12 ",children:[(r==null?void 0:r.showHeaderText)&&o.jsx("h6",{children:(re=r==null?void 0:r.headerText)==null?void 0:re[f==null?void 0:f.type]}),(r==null?void 0:r.showLabel)&&o.jsxs("label",{htmlFor:i,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{...t}),((Z=r==null?void 0:r.attributes)==null?void 0:Z.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(K=r==null?void 0:r.label)==null?void 0:K[f==null?void 0:f.type]}),o.jsx("span",{className:"ml-3",children:(r==null?void 0:r.showToolTip)&&o.jsx(zi,{message:(W=r==null?void 0:r.toolTip)==null?void 0:W[f==null?void 0:f.type],position:"right"})})]}),o.jsx(Pa,{className:"country-select-builder-component",onFocus:()=>O(1),onChange:de=>{a!=null&&a.rowIsRepeatable?X(r,de.target.value):G(de)},options:r==null?void 0:r.countries,optionLabel:"name",value:E,placeholder:(ge=r==null?void 0:r.placeholder)==null?void 0:ge[f==null?void 0:f.type],disabled:c,valueTemplate:ce,itemTemplate:Y,filter:!0,filterBy:"name",showClear:!0}),((ve=r==null?void 0:r.attributes)==null?void 0:ve.required)&&o.jsx("small",{className:"error",children:M===1&&E===null?((Ie=r==null?void 0:r.validationMesssage)==null?void 0:Ie[f==null?void 0:f.type])||"field is required":""}),o.jsx("div",{children:(r==null?void 0:r.showHelperText)&&o.jsx("small",{children:(be=r==null?void 0:r.helperText)==null?void 0:be[f==null?void 0:f.type]})})]})}),u&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(ki,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[C===!0&&o.jsx(Qi,{visibilty:C,closeSettingFieldSidebar:U,...t},r==null?void 0:r.uuid),o.jsx(xi,{...t,fieldWrap:ae})]})},Use=t=>{var re,Z,K,W,ge,ve,Ie,be,de,ne,q,ee,oe,pe,Ce;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a}=mr(),{userSelectedLanguage:s,fieldSettingUpdate:l}=sn(),{field:c,fieldIndex:u,sectionIndex:d,pageIndex:f,row:h,rowIndex:g,columnIndex:v,isDisabled:m}=t,{isAdmin:A,isBuilderMode:w}=Ht(),[C,S]=k.useState(!1),[T,x]=k.useState(""),[E,_]=k.useState(null),[M,O]=k.useState(0),[F,P]=k.useState(!1),[H,N]=k.useState(!1),$=()=>{N(!0)},U=()=>{N(!1)},le=()=>{var De,me,Te;if(h!=null&&h.rowIsRepeatable){if(h!=null&&h.repeatableFields){const Pe=[...h.repeatableFields],Ee=_t.findIndex(Pe,function(j){return j.uuid===(c==null?void 0:c.uuid)});Ee>=0&&Pe[Ee].fieldData?x(Pe[Ee].fieldData):x("")}}else{const Pe=a;if(Pe!=null&&Pe.length){for(const Ee of Pe)if(Ee.fieldId===t.field.uuid&&((De=Ee==null?void 0:Ee.postData[0])==null?void 0:De.postValue)!==""&&((me=Ee==null?void 0:Ee.postData[0])!=null&&me.postValue)){x((Te=Ee==null?void 0:Ee.postData[0])==null?void 0:Te.postValue);break}}}P(!0)};k.useEffect(()=>{F||le();const De=Rt.addListener("clearRepeatableFields",j=>{j===(h==null?void 0:h.uuid)&&(x(""),O(0),c.isValid=0,l(f,d,g,v,u,c))}),me=Rt.addListener("onSubmitUserForm",()=>{var j,he;(j=c==null?void 0:c.attributes)!=null&&j.required?T&&T.length&&(T==null?void 0:T.length)<((he=c==null?void 0:c.attributes)==null?void 0:he.minLength)?c.isValid=1:c.isValid=0:c.isValid=1}),Te=Rt.addListener("OnInvalidFieldCatch",j=>{console.log("Text field catch before"),c.uuid===(j==null?void 0:j.fieldId)?(console.log("Text field catch"),O(1)):O(0)}),Pe=Rt.addListener("OnGetFieldValue",j=>{var ye;const he=(ye=j==null?void 0:j.repeatableColumn)==null?void 0:ye.filter(se=>(se==null?void 0:se.fieldUuid)===(c==null?void 0:c.uuid));he!=null&&he.length}),Ee=Rt.addListener("formFieldAdded",j=>{E===null&&_(j==null?void 0:j.uuid)});return()=>{me.remove(),Te.remove(),Pe.remove(),De.remove(),Ee.remove()}}),k.useEffect(()=>(E!==null&&setTimeout(()=>{_(null)},1e3),()=>{}),[E]);const G=De=>{S(De)},X=()=>{S(!1)},ce=De=>{var Pe,Ee;x(De.target.value);const me=a,Te=_t.cloneDeep(e);if(me!==null){if((Pe=De==null?void 0:De.target)!=null&&Pe.value){if(Te[c==null?void 0:c.uuid]=(Ee=De==null?void 0:De.target)==null?void 0:Ee.value,(me==null?void 0:me.length)>0)for(const j of me)j.fieldId===t.field.uuid&&(j.postData[0]={postValue:De.target.value})}else if(delete Te[c==null?void 0:c.uuid],(me==null?void 0:me.length)>0)for(const j of me)j.fieldId===t.field.uuid&&(j.postData[0]={postValue:""})}if(!(h!=null&&h.rowIsRepeatable)){n(Te);const j=Object.keys(Te).length;r(j)}},Y=(De,me)=>{var Te;if(a){const Pe=[...a],Ee=_t.findIndex(Pe,function(he){return he.rowId===(h==null?void 0:h.uuid)});let j=(Te=a[Ee])==null?void 0:Te.repeatableFields;j={...j,[De==null?void 0:De.uuid]:me},Pe[Ee]={...Pe[Ee],repeatableFields:j},i(Pe)}x(me),me!==""?De.isValid=1:De.isValid=0},ae=o.jsxs("div",{onMouseOver:$,onMouseOut:U,children:[w&&H&&o.jsx(Wr,{handleFieldSettingsSidebar:G,...t}),o.jsxs("div",{className:`field ${w?" py-3 px-4 builder-element-wrapper ":""} ${(c==null?void 0:c.isFluid)===!0&&" p-fluid"}`,children:[o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:A?"col-6 ":"col-12 p-fluid",children:[(c==null?void 0:c.showHeaderText)&&o.jsx("h6",{children:(re=c==null?void 0:c.headerText)==null?void 0:re[s==null?void 0:s.type]}),(c==null?void 0:c.showLabel)&&o.jsxs("label",{htmlFor:c==null?void 0:c.uuid,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{...t}),((Z=c==null?void 0:c.attributes)==null?void 0:Z.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",w===!1?o.jsx(o.Fragment,{children:(K=c==null?void 0:c.label)==null?void 0:K[s==null?void 0:s.type]}):o.jsx(aa,{...t}),(c==null?void 0:c.showToolTip)&&o.jsx("span",{className:"ml-3",children:o.jsx(zi,{message:(W=c==null?void 0:c.toolTip)==null?void 0:W[s==null?void 0:s.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(c==null?void 0:c.iconAlignment),children:[(c==null?void 0:c.showIcon)&&o.jsx("i",{className:"pi pi-"+((ve=(ge=c==null?void 0:c.icon)==null?void 0:ge.properties)==null?void 0:ve.name)}),o.jsx(wn,{"data-component":"text-input",id:c==null?void 0:c.uuid,placeholder:(Ie=c==null?void 0:c.placeholder)==null?void 0:Ie[s==null?void 0:s.type],minLength:(be=c==null?void 0:c.attributes)==null?void 0:be.minLength,maxLength:(de=c==null?void 0:c.attributes)==null?void 0:de.maxLength,value:T,onFocus:()=>O(1),onChange:De=>{h!=null&&h.rowIsRepeatable?Y(c,De.target.value):ce(De)},className:M===N8&&((ne=c==null?void 0:c.attributes)!=null&&ne.required)?T?"valid":"invalid":"valid'",readOnly:m,disabled:A})]}),o.jsx("div",{children:((q=c==null?void 0:c.attributes)==null?void 0:q.required)&&o.jsxs(o.Fragment,{children:[o.jsx("small",{className:"error",children:M===1&&!T?(ee=c==null?void 0:c.validationMesssage)==null?void 0:ee.english:""}),o.jsx("small",{className:"error",children:M===1&&T.length&&(T==null?void 0:T.length)<((oe=c==null?void 0:c.attributes)==null?void 0:oe.minLength)?`Mini length ${(pe=c==null?void 0:c.attributes)==null?void 0:pe.minLength}`:""})]})}),o.jsx("div",{children:(c==null?void 0:c.showHelperText)&&o.jsx("small",{children:(Ce=c==null?void 0:c.helperText)==null?void 0:Ce[s==null?void 0:s.type]})})]})]}),A&&o.jsx(o.Fragment,{children:o.jsx("div",{className:"col-6",children:o.jsx(ki,{...t})})})]}),A&&o.jsx("hr",{})]})]});return o.jsxs(o.Fragment,{children:[C===!0&&o.jsx(Qi,{visibilty:C,closeSettingFieldSidebar:X,...t}),o.jsx(xi,{...t,fieldWrap:ae})]})},$se=t=>{var i,a;const{language:e,onHandleChange:n,fieldState:r}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Hyperlink text"}),o.jsx(wn,{value:(i=r==null?void 0:r.text)==null?void 0:i[e==null?void 0:e.type],onChange:s=>n("text",e,s.target.value)})]}),o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Hyperlink"}),o.jsx(wn,{value:(a=r==null?void 0:r.hrefLink)==null?void 0:a[e==null?void 0:e.type],onChange:s=>n("hrefLink",e,s.target.value)})]})]})},jse=t=>{var r;const{onHandleChangeStyling:e,fieldState:n}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field",children:[o.jsx("label",{className:"mr-2",children:"Hyperlink color"}),o.jsx(v3,{value:n==null?void 0:n.color,onChange:i=>{e("color",i.value)}})]}),o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Font Size"}),o.jsx(wn,{type:"number",maxLength:2,placeholder:"eg 20px",value:(r=Number(n==null?void 0:n.fontSize))==null?void 0:r.toFixed(0),onChange:i=>{e("fontSize",i.target.value)}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Yr,{checked:n==null?void 0:n.underLined,onChange:i=>{e("underLined",i.checked)}}),o.jsx("label",{children:"Underline link"})]})]})},zse=t=>{const{visibilty:e,field:n,closeSettingFieldSidebar:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:l,fieldIndex:c,typeName:u}=t,[d,f]=k.useState(n),{fieldSettingUpdate:h,formBuilderSchemaLanguages:g,formBuilderPublishedStatus:v}=sn(),{updateGlobalToast:m}=Ht(),A=(S,T,x)=>{f(E=>({...E,[S]:{...E[S],[T==null?void 0:T.type]:x}}))},w=(S,T)=>{f(x=>({...x,[S]:T}))},C=()=>{h(i,a,s,l,c,d),m({showToast:!0,toastMessage:"Updated",toastDetail:`${u} updated`,toastType:"success"})};return o.jsx(o.Fragment,{children:o.jsxs(To,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>r(),header:()=>{var S,T;return o.jsx("div",{className:"flex align-items-center gap-2 justify-content-between",children:o.jsxs("div",{className:"text-gray-900 font-bold text-2xl",children:[t==null?void 0:t.typeName," settings"," ",(S=n==null?void 0:n.label)!=null&&S.english?`- ${(T=n==null?void 0:n.label)==null?void 0:T.english}`:""," "]})})},children:[o.jsxs(ss,{children:[o.jsx(Cr,{header:"Text",children:o.jsx(ao,{activeIndex:0,children:g!=null&&g.length?g.map((S,T)=>o.jsx(io,{tabIndex:T,header:S==null?void 0:S.language,children:o.jsx($se,{language:S,fieldState:d,onHandleChange:A,...t})},T)):""})}),o.jsx(Cr,{header:"Styling",children:o.jsx(jse,{fieldState:d,onHandleChangeStyling:w,...t})})]}),o.jsx("div",{className:"w-full px-4 py-3 surface-100 sidebar-footer",children:o.jsxs("div",{className:"flex flex-row gap-2 align-items-center justify-content-end",children:[!v&&o.jsx(Ot,{size:"small",label:"Update",type:"button",outlined:!0,onClick:()=>C(),"aria-label":"Update"}),o.jsx(Ot,{label:"Close",type:"button",onClick:()=>r(),"aria-label":"Close",size:"small",className:"p-button-danger"})]})})]})})},Hse=t=>{var g,v,m,A,w,C,S,T,x;const{field:e}=t,{userSelectedLanguage:n}=sn(),{isBuilderMode:r}=Ht(),[i,a]=k.useState(!1),[s,l]=k.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)},d=E=>{a(E)},f=()=>{a(!1)};k.useEffect(()=>{},[e]);const h=o.jsxs("div",{className:r?"builder-element-wrapper":"",onMouseOver:c,onMouseOut:u,children:[r&&s&&o.jsx(Wr,{handleFieldSettingsSidebar:d,...t}),o.jsxs("div",{className:r?"field-form-builder px-4":" px-4",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(g=e==null?void 0:e.headerText)==null?void 0:g[n==null?void 0:n.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:e.uuid,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[((v=e==null?void 0:e.attributes)==null?void 0:v.required)&&o.jsx("span",{className:"must-required",children:"*"})," ",r?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(m=e==null?void 0:e.label)==null?void 0:m[n==null?void 0:n.type]}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(zi,{message:(A=e==null?void 0:e.toolTip)==null?void 0:A[n==null?void 0:n.type],position:"right"})})]}),o.jsx("a",{style:{fontSize:parseInt(e==null?void 0:e.fontSize),color:`#${e==null?void 0:e.color}`,textDecoration:e!=null&&e.underLined?"underline":"none"},className:"atag-style",href:(w=e==null?void 0:e.hrefLink)==null?void 0:w[n==null?void 0:n.type],children:(C=e==null?void 0:e.text)==null?void 0:C[n==null?void 0:n.type]}),((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&o.jsx("small",{className:"error",children:(T=e==null?void 0:e.validationMesssage)==null?void 0:T[n==null?void 0:n.type]}),(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(x=e==null?void 0:e.helperText)==null?void 0:x[n==null?void 0:n.type]})]})]});return o.jsxs(o.Fragment,{children:[i&&o.jsx(zse,{visibilty:i,closeSettingFieldSidebar:f,...t}),o.jsx(xi,{...t,fieldWrap:h})]})},Yse=t=>{var K,W,ge,ve,Ie,be,de,ne,q,ee,oe,pe,Ce,De,me,Te,Pe,Ee,j,he,ye;const{field:e,fieldIndex:n,sectionIndex:r,pageIndex:i,row:a,rowIndex:s,columnIndex:l,isDisabled:c}=t,{isAdmin:u,isBuilderMode:d}=Ht(),{taskRegisterData:f,updateTaskRegisterData:h,updateTaskProgressValue:g,updateUserFormDataSubmit:v,userTaskSubmitFormData:m,TASK_PUBLISHED:A,task_status:w}=mr(),{userSelectedLanguage:C,fieldSettingUpdate:S}=sn(),[T,x]=k.useState(null),[E,_]=k.useState(!1),[M,O]=k.useState(null),[F,P]=k.useState(0),[H,N]=k.useState(!1),[$,U]=k.useState(!1),le=()=>{U(!0)},G=()=>{U(!1)},X=()=>{var se,fe;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const Ae=[...a.repeatableFields],Ne=_t.findIndex(Ae,function(Le){return Le.uuid===(e==null?void 0:e.uuid)});Ne>=0&&Ae[Ne].fieldData?O(Number(Ae[Ne].fieldData)||null):O(null)}}else{const Ae=m;if(Ae!=null&&Ae.length){for(const Ne of Ae)if(Ne.fieldId===t.field.uuid&&((se=Ne==null?void 0:Ne.postData)!=null&&se.length)){O(Number((fe=Ne==null?void 0:Ne.postData[0])==null?void 0:fe.postValue)||null);break}}}N(!0)};k.useEffect(()=>{H||X();const se=Rt.addListener("clearRepeatableFields",ze=>{ze===(a==null?void 0:a.uuid)&&(O(null),P(0),e.isValid=0,S(i,r,s,l,n,e))}),fe=Rt.addListener("onSubmitUserForm",()=>{var ze;(ze=e==null?void 0:e.attributes)!=null&&ze.required?M?e.isValid=1:e.isValid=0:e.isValid=1}),Ae=Rt.addListener("OnInvalidFieldCatch",ze=>{e.uuid===(ze==null?void 0:ze.fieldId)?P(1):P(0)}),Ne=Rt.addListener("OnGetFieldValue",ze=>{var it;const tt=(it=ze==null?void 0:ze.repeatableColumn)==null?void 0:it.filter(ht=>(ht==null?void 0:ht.fieldUuid)===(e==null?void 0:e.uuid));tt!=null&&tt.length}),Le=Rt.addListener("formFieldAdded",ze=>{T===null&&x(ze.uuid)});return()=>{fe.remove(),Ae.remove(),Ne.remove(),se.remove(),Le.remove()}}),k.useEffect(()=>(T!==null&&setTimeout(()=>{x(null)},1e3),()=>{}),[T]);const ce=se=>{_(se)},Y=()=>{_(!1)},ae=se=>{const fe=m,Ae=_t.cloneDeep(f);if(fe!==null){if(se){if(Ae[e==null?void 0:e.uuid]=se,(fe==null?void 0:fe.length)>0)for(const Ne of fe)Ne.fieldId===t.field.uuid&&(Ne.postData[0]={postValue:se})}else if(delete Ae[e==null?void 0:e.uuid],(fe==null?void 0:fe.length)>0)for(const Ne of fe)Ne.fieldId===t.field.uuid&&(Ne.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){h(Ae);const Ne=Object.keys(Ae).length;g(Ne)}},re=(se,fe)=>{var Ae;if(m!=null&&m.length){const Ne=[...m],Le=_t.findIndex(Ne,function(tt){return tt.rowId===(a==null?void 0:a.uuid)});let ze=(Ae=m[Le])==null?void 0:Ae.repeatableFields;ze={...ze,[se==null?void 0:se.uuid]:fe},Ne[Le]={...Ne[Le],repeatableFields:ze},v(Ne)}O(fe),fe!==""?se.isValid=1:se.isValid=0},Z=o.jsxs("div",{onMouseOver:le,onMouseOut:G,children:[d===!0&&$===!0&&o.jsx(Wr,{handleFieldSettingsSidebar:ce,...t}),o.jsxs("div",{className:`field ${d===!0&&" py-3 px-4 builder-element-wrapper "} ${(e==null?void 0:e.isFluid)===!0&&" p-fluid"}`,children:[o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:u?"col-6 ":"col-12 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(K=e==null?void 0:e.headerText)==null?void 0:K[C==null?void 0:C.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:e.uuid,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{...t}),((W=e==null?void 0:e.attributes)==null?void 0:W.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(ge=e==null?void 0:e.label)==null?void 0:ge[C==null?void 0:C.type]}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(zi,{message:(ve=e==null?void 0:e.toolTip)==null?void 0:ve[C==null?void 0:C.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(e==null?void 0:e.iconAlignment),children:[(e==null?void 0:e.showIcon)&&o.jsx("i",{className:"pi pi-"+((be=(Ie=e==null?void 0:e.icon)==null?void 0:Ie.properties)==null?void 0:be.name)}),o.jsx(eo,{readOnly:c,id:e==null?void 0:e.uuid,disabled:u||c,placeholder:(de=e==null?void 0:e.placeholder)==null?void 0:de[C==null?void 0:C.type],value:M,min:(ne=e==null?void 0:e.attributes)==null?void 0:ne.min,max:e==null?void 0:e.attributes.max,suffix:e==null?void 0:e.attributes.suffix,prefix:(q=e==null?void 0:e.attributes)==null?void 0:q.prefix,showButtons:(ee=e==null?void 0:e.attributes)==null?void 0:ee.showButtons,pt:{incrementButton:{className:"bg-teal-500 border-teal-500"},decrementButton:{className:"bg-orange-500 border-orange-500"}},minFractionDigits:(oe=e==null?void 0:e.attributes)==null?void 0:oe.minFractionDigits,maxFractionDigits:(pe=e==null?void 0:e.attributes)==null?void 0:pe.maxFractionDigits,locale:(Ce=e==null?void 0:e.attributes)==null?void 0:Ce.locale,mode:(De=e==null?void 0:e.attributes)==null?void 0:De.mode,currency:(me=e==null?void 0:e.attributes)==null?void 0:me.currency,currencyDisplay:(Te=e==null?void 0:e.attributes)==null?void 0:Te.currencyDisplay,useGrouping:(Pe=e==null?void 0:e.attributes)==null?void 0:Pe.useGrouping,onFocus:()=>P(1),onChange:se=>{a!=null&&a.rowIsRepeatable?re(e,se.value):ae(se.value)},className:F===1&&((Ee=e==null?void 0:e.attributes)!=null&&Ee.required)?M?"valid":"invalid":"valid'"})]}),o.jsx("div",{children:((j=e==null?void 0:e.attributes)==null?void 0:j.required)&&o.jsx("small",{className:"error",children:F===1&&!M?(he=e==null?void 0:e.validationMesssage)==null?void 0:he.english:""})}),o.jsx("div",{children:(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(ye=e==null?void 0:e.helperText)==null?void 0:ye[C==null?void 0:C.type]})})]})]}),u&&o.jsx(o.Fragment,{children:o.jsx("div",{className:"col-6",children:o.jsx(ki,{...t})})})]}),u&&o.jsx("hr",{})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&d===!0&&o.jsx(Qi,{visibilty:E,closeSettingFieldSidebar:Y,...t}),o.jsx(xi,{...t,fieldWrap:Z})]})};//! moment.js
2291
2291
  //! version : 2.30.1
2292
2292
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -3764,7 +3764,7 @@ ${dh(e)}`),n.map&&!n.map.bytes&&(this.logger_("going to request init segment."),
3764
3764
  `.split("").map(t=>t.charCodeAt(0)));class yge extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Age extends fA{constructor(e,n={}){super(e,n),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Ks();const e=this.subtitlesTrack_.cues,n=e[0].startTime,r=e[e.length-1].startTime;return Ks([[n,r]])}initSegmentForMap(e,n=!1){if(!e)return null;const r=pv(e);let i=this.initSegments_[r];if(n&&!i&&e.bytes){const a=FL.byteLength+e.bytes.byteLength,s=new Uint8Array(a);s.set(e.bytes),s.set(FL,e.bytes.byteLength),this.initSegments_[r]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:s}}return i||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,n){tg(e,n,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const n=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",n),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,n,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===xu.TIMEOUT&&this.handleTimeout_(),e.code===xu.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const i=this.pendingSegment_;this.saveBandwidthRelatedStats_(i.duration,n.stats),n.key&&this.segmentKey(n.key,!0),this.state="APPENDING",this.trigger("appending");const a=i.segment;if(a.map&&(a.map.bytes=n.map.bytes),i.bytes=n.bytes,typeof Re.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,n,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(i)}catch(s){this.stopForError({message:s.message,metadata:{errorType:Dt.Error.StreamingVttParserError,error:s}});return}if(this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_),i.cues.length?i.timingInfo={start:i.cues[0].startTime,end:i.cues[i.cues.length-1].endTime}:i.timingInfo={start:i.startOfSegment,end:i.startOfSegment+i.duration},i.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,i.cues.forEach(s=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new Re.VTTCue(s.startTime,s.endTime,s.text):s)}),tge(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let n,r=!1;if(typeof Re.WebVTT!="function")throw new yge;typeof Re.TextDecoder=="function"?n=new Re.TextDecoder("utf8"):(n=Re.WebVTT.StringDecoder(),r=!0);const i=new Re.WebVTT.Parser(Re,Re.vttjs,n);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},i.oncue=e.cues.push.bind(e.cues),i.ontimestampmap=s=>{e.timestampmap=s},i.onparsingerror=s=>{Dt.log.warn("Error encountered when parsing cues: "+s.message)},e.segment.map){let s=e.segment.map.bytes;r&&(s=OL(s)),i.parse(s)}let a=e.bytes;r&&(a=OL(a)),i.parse(a),i.flush()}updateTimeMapping_(e,n,r){const i=e.segment;if(!n)return;if(!e.cues.length){i.empty=!0;return}const{MPEGTS:a,LOCAL:s}=e.timestampmap,c=a/l1.ONE_SECOND_IN_TS-s+n.mapping;if(e.cues.forEach(u=>{const d=u.endTime-u.startTime,f=a===0?u.startTime+c:this.handleRollover_(u.startTime+c,n.time);u.startTime=Math.max(f,0),u.endTime=Math.max(f+d,0)}),!r.syncInfo){const u=e.cues[0].startTime,d=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(u,d-i.duration)}}}handleRollover_(e,n){if(n===null)return e;let r=e*l1.ONE_SECOND_IN_TS;const i=n*l1.ONE_SECOND_IN_TS;let a;for(i<r?a=-8589934592:a=8589934592;Math.abs(r-i)>4294967296;)r+=a;return r/l1.ONE_SECOND_IN_TS}}const wge=function(t,e){const n=t.cues;for(let r=0;r<n.length;r++){const i=n[r];if(e>=i.adStartTime&&e<=i.adEndTime)return i}return null},Sge=function(t,e,n=0){if(!t.segments)return;let r=n,i;for(let a=0;a<t.segments.length;a++){const s=t.segments[a];if(i||(i=wge(e,r+s.duration/2)),i){if("cueIn"in s){i.endTime=r,i.adEndTime=r,r+=s.duration,i=null;continue}if(r<i.endTime){r+=s.duration;continue}i.endTime+=s.duration}else if("cueOut"in s&&(i=new Re.VTTCue(r,r+s.duration,s.cueOut),i.adStartTime=r,i.adEndTime=r+parseFloat(s.cueOut),e.addCue(i)),"cueOutCont"in s){const[l,c]=s.cueOutCont.split("/").map(parseFloat);i=new Re.VTTCue(r,r+s.duration,""),i.adStartTime=r-l,i.adEndTime=i.adStartTime+c,e.addCue(i)}r+=s.duration}};class kL{constructor({start:e,end:n,segmentIndex:r,partIndex:i=null,appended:a=!1}){this.start_=e,this.end_=n,this.segmentIndex_=r,this.partIndex_=i,this.appended_=a}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class Cge{constructor(e,n=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=n}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class PL{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,n){const{mediaSequence:r,segments:i}=e;if(this.isReliable_=this.isReliablePlaylist_(r,i),!!this.isReliable_)return this.updateStorage_(i,r,this.calculateBaseTime_(r,n))}getSyncInfoForTime(e){for(const{segmentSyncInfo:n,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const i of r)if(i.isInRange(e))return i}else if(n.isInRange(e))return n;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,n,r){const i=new Map;let a=`
3765
3765
  `,s=r,l=n;this.start_=s,e.forEach((c,u)=>{const d=this.storage_.get(l),f=s,h=f+c.duration,g=!!(d&&d.segmentSyncInfo&&d.segmentSyncInfo.isAppended),v=new kL({start:f,end:h,appended:g,segmentIndex:u});c.syncInfo=v;let m=s;const A=(c.parts||[]).map((w,C)=>{const S=m,T=m+w.duration,x=!!(d&&d.partsSyncInfo&&d.partsSyncInfo[C]&&d.partsSyncInfo[C].isAppended),E=new kL({start:S,end:T,appended:x,segmentIndex:u,partIndex:C});return m=T,a+=`Media Sequence: ${l}.${C} | Range: ${S} --> ${T} | Appended: ${x}
3766
3766
  `,w.syncInfo=E,E});i.set(l,new Cge(v,A)),a+=`${SL(c.resolvedUri)} | Media Sequence: ${l} | Range: ${f} --> ${h} | Appended: ${g}
3767
- `,l++,s=h}),this.end_=s,this.storage_=i,this.diagnostics_=a}calculateBaseTime_(e,n){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:n:0}isReliablePlaylist_(e,n){return e!=null&&Array.isArray(n)&&n.length}}class ML extends PL{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,n){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,n)}}const xge=86400,pA=[{name:"VOD",run:(t,e,n,r,i)=>n!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(t,e,n,r,i,a)=>{const s=t.getMediaSequenceSync(a);if(!s||!s.isReliable)return null;const l=s.getSyncInfoForTime(i);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,e,n,r,i)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let a=null,s=null;const l=Qy(e);i=i||0;for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=t.timelineToDatetimeMappings[f.timeline];if(!h||!f.dateTimeObject)continue;let v=f.dateTimeObject.getTime()/1e3+h;if(f.parts&&typeof d.partIndex=="number")for(let A=0;A<d.partIndex;A++)v+=f.parts[A].duration;const m=Math.abs(i-v);if(s!==null&&(m===0||s<m))break;s=m,a={time:v,segmentIndex:d.segmentIndex,partIndex:d.partIndex}}return a}},{name:"Segment",run:(t,e,n,r,i)=>{let a=null,s=null;i=i||0;const l=Qy(e);for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=d.part&&d.part.start||f&&f.start;if(f.timeline===r&&typeof h<"u"){const g=Math.abs(i-h);if(s!==null&&s<g)break;(!a||s===null||s>=g)&&(s=g,a={time:h,segmentIndex:d.segmentIndex,partIndex:d.partIndex})}}return a}},{name:"Discontinuity",run:(t,e,n,r,i)=>{let a=null;if(i=i||0,e.discontinuityStarts&&e.discontinuityStarts.length){let s=null;for(let l=0;l<e.discontinuityStarts.length;l++){const c=e.discontinuityStarts[l],u=e.discontinuitySequence+l+1,d=t.discontinuities[u];if(d){const f=Math.abs(i-d.time);if(s!==null&&s<f)break;(!a||s===null||s>=f)&&(s=f,a={time:d.time,segmentIndex:c,partIndex:null})}}}return a}},{name:"Playlist",run:(t,e,n,r,i)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Tge extends Dt.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const n=new PL,r=new ML(n),i=new ML(n);this.mediaSequenceStorage_={main:n,audio:r,vtt:i},this.logger_=Ql("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,n,r,i,a){if(n!==1/0)return pA.find(({name:c})=>c==="VOD").run(this,e,n);const s=this.runStrategies_(e,n,r,i,a);if(!s.length)return null;for(const l of s){const{syncPoint:c,strategy:u}=l,{segmentIndex:d,time:f}=c;if(d<0)continue;const h=e.segments[d],g=f,v=g+h.duration;if(this.logger_(`Strategy: ${u}. Current time: ${i}. selected segment: ${d}. Time: [${g} -> ${v}]}`),i>=g&&i<v)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(s,{key:"time",value:i})}getExpiredTime(e,n){if(!e||!e.segments)return null;const r=this.runStrategies_(e,n,e.discontinuitySequence,0);if(!r.length)return null;const i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+Q2({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(e,n,r,i,a){const s=[];for(let l=0;l<pA.length;l++){const c=pA[l],u=c.run(this,e,n,r,i,a);u&&(u.strategy=c.name,s.push({strategy:c.name,syncPoint:u}))}return s}selectSyncPoint_(e,n){let r=e[0].syncPoint,i=Math.abs(e[0].syncPoint[n.key]-n.value),a=e[0].strategy;for(let s=1;s<e.length;s++){const l=Math.abs(e[s].syncPoint[n.key]-n.value);l<i&&(i=l,r=e[s].syncPoint,a=e[s].strategy)}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${a}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,n){const r=n.mediaSequence-e.mediaSequence;if(r>xge){Dt.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let i=r-1;i>=0;i--){const a=e.segments[i];if(a&&typeof a.start<"u"){n.syncInfo={mediaSequence:e.mediaSequence+i,time:a.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const n=e.segments[0],r=n.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[n.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:n}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,n),i=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:i.start}));const a=i.dateTimeObject;i.discontinuity&&n&&a&&(this.timelineToDatetimeMappings[i.timeline]=-(a.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,n,r){const i=e.segment,a=e.part;let s=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset=="number")s={time:e.startOfSegment,mapping:e.startOfSegment-n.start},r&&(this.timelines[e.timeline]=s,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${s.time}] [mapping: ${s.mapping}]`)),l=e.startOfSegment,c=n.end+s.mapping;else if(s)l=n.start+s.mapping,c=n.end+s.mapping;else return!1;return a&&(a.start=l,a.end=c),(!i.start||l<i.start)&&(i.start=l),i.end=c,!0}saveDiscontinuitySyncInfo_(e){const n=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let i=0;i<n.discontinuityStarts.length;i++){const a=n.discontinuityStarts[i],s=n.discontinuitySequence+i+1,l=a-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>c){let u;l<0?u=r.start-Q2({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex,endIndex:a}):u=r.end+Q2({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex+1,endIndex:a}),this.discontinuities[s]={time:u,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class Ege extends Dt.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:n,to:r}){if(typeof n=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:n,to:r},delete this.pendingTimelineChanges_[e];const i={timelineChangeInfo:{from:n,to:r}};this.trigger({type:"timelinechange",metadata:i})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Ige=sL(oL(function(){var t=function(){function m(){this.listeners={}}var A=m.prototype;return A.on=function(C,S){this.listeners[C]||(this.listeners[C]=[]),this.listeners[C].push(S)},A.off=function(C,S){if(!this.listeners[C])return!1;var T=this.listeners[C].indexOf(S);return this.listeners[C]=this.listeners[C].slice(0),this.listeners[C].splice(T,1),T>-1},A.trigger=function(C){var S=this.listeners[C];if(S)if(arguments.length===2)for(var T=S.length,x=0;x<T;++x)S[x].call(this,arguments[1]);else for(var E=Array.prototype.slice.call(arguments,1),_=S.length,M=0;M<_;++M)S[M].apply(this,E)},A.dispose=function(){this.listeners={}},A.pipe=function(C){this.on("data",function(S){C.push(S)})},m}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(m){return m.subarray(0,m.byteLength-m[m.byteLength-1])}/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */const n=function(){const m=[[[],[],[],[],[]],[[],[],[],[],[]]],A=m[0],w=m[1],C=A[4],S=w[4];let T,x,E;const _=[],M=[];let O,F,P,H,N,$;for(T=0;T<256;T++)M[(_[T]=T<<1^(T>>7)*283)^T]=T;for(x=E=0;!C[x];x^=O||1,E=M[E]||1)for(H=E^E<<1^E<<2^E<<3^E<<4,H=H>>8^H&255^99,C[x]=H,S[H]=x,P=_[F=_[O=_[x]]],$=P*16843009^F*65537^O*257^x*16843008,N=_[H]*257^H*16843008,T=0;T<4;T++)A[T][x]=N=N<<24^N>>>8,w[T][H]=$=$<<24^$>>>8;for(T=0;T<5;T++)A[T]=A[T].slice(0),w[T]=w[T].slice(0);return m};let r=null;class i{constructor(A){r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let w,C,S;const T=this._tables[0][4],x=this._tables[1],E=A.length;let _=1;if(E!==4&&E!==6&&E!==8)throw new Error("Invalid aes key size");const M=A.slice(0),O=[];for(this._key=[M,O],w=E;w<4*E+28;w++)S=M[w-1],(w%E===0||E===8&&w%E===4)&&(S=T[S>>>24]<<24^T[S>>16&255]<<16^T[S>>8&255]<<8^T[S&255],w%E===0&&(S=S<<8^S>>>24^_<<24,_=_<<1^(_>>7)*283)),M[w]=M[w-E]^S;for(C=0;w;C++,w--)S=M[C&3?w:w-4],w<=4||C<4?O[C]=S:O[C]=x[0][T[S>>>24]]^x[1][T[S>>16&255]]^x[2][T[S>>8&255]]^x[3][T[S&255]]}decrypt(A,w,C,S,T,x){const E=this._key[1];let _=A^E[0],M=S^E[1],O=C^E[2],F=w^E[3],P,H,N;const $=E.length/4-2;let U,le=4;const G=this._tables[1],X=G[0],ce=G[1],Y=G[2],ae=G[3],re=G[4];for(U=0;U<$;U++)P=X[_>>>24]^ce[M>>16&255]^Y[O>>8&255]^ae[F&255]^E[le],H=X[M>>>24]^ce[O>>16&255]^Y[F>>8&255]^ae[_&255]^E[le+1],N=X[O>>>24]^ce[F>>16&255]^Y[_>>8&255]^ae[M&255]^E[le+2],F=X[F>>>24]^ce[_>>16&255]^Y[M>>8&255]^ae[O&255]^E[le+3],le+=4,_=P,M=H,O=N;for(U=0;U<4;U++)T[(3&-U)+x]=re[_>>>24]<<24^re[M>>16&255]<<16^re[O>>8&255]<<8^re[F&255]^E[le++],P=_,_=M,M=O,O=F,F=P}}class a extends t{constructor(){super(t),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(A){this.jobs.push(A),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const s=function(m){return m<<24|(m&65280)<<8|(m&16711680)>>8|m>>>24},l=function(m,A,w){const C=new Int32Array(m.buffer,m.byteOffset,m.byteLength>>2),S=new i(Array.prototype.slice.call(A)),T=new Uint8Array(m.byteLength),x=new Int32Array(T.buffer);let E,_,M,O,F,P,H,N,$;for(E=w[0],_=w[1],M=w[2],O=w[3],$=0;$<C.length;$+=4)F=s(C[$]),P=s(C[$+1]),H=s(C[$+2]),N=s(C[$+3]),S.decrypt(F,P,H,N,x,$),x[$]=s(x[$]^E),x[$+1]=s(x[$+1]^_),x[$+2]=s(x[$+2]^M),x[$+3]=s(x[$+3]^O),E=F,_=P,M=H,O=N;return T};class c{constructor(A,w,C,S){const T=c.STEP,x=new Int32Array(A.buffer),E=new Uint8Array(A.byteLength);let _=0;for(this.asyncStream_=new a,this.asyncStream_.push(this.decryptChunk_(x.subarray(_,_+T),w,C,E)),_=T;_<x.length;_+=T)C=new Uint32Array([s(x[_-4]),s(x[_-3]),s(x[_-2]),s(x[_-1])]),this.asyncStream_.push(this.decryptChunk_(x.subarray(_,_+T),w,C,E));this.asyncStream_.push(function(){S(null,e(E))})}static get STEP(){return 32e3}decryptChunk_(A,w,C,S){return function(){const T=l(A,w,C);S.set(T,A.byteOffset)}}}var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d;typeof window<"u"?d=window:typeof u<"u"?d=u:typeof self<"u"?d=self:d={};var f=d,h=function(A){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer},g=f.BigInt||Number;g("0x1"),g("0x100"),g("0x10000"),g("0x1000000"),g("0x100000000"),g("0x10000000000"),g("0x1000000000000"),g("0x100000000000000"),g("0x10000000000000000"),function(){var m=new Uint16Array([65484]),A=new Uint8Array(m.buffer,m.byteOffset,m.byteLength);return A[0]===255?"big":A[0]===204?"little":"unknown"}();const v=function(m){const A={};return Object.keys(m).forEach(w=>{const C=m[w];h(C)?A[w]={bytes:C.buffer,byteOffset:C.byteOffset,byteLength:C.byteLength}:A[w]=C}),A};self.onmessage=function(m){const A=m.data,w=new Uint8Array(A.encrypted.bytes,A.encrypted.byteOffset,A.encrypted.byteLength),C=new Uint32Array(A.key.bytes,A.key.byteOffset,A.key.byteLength/4),S=new Uint32Array(A.iv.bytes,A.iv.byteOffset,A.iv.byteLength/4);new c(w,C,S,function(T,x){self.postMessage(v({source:A.source,decrypted:x}),[x.buffer])})}}));var _ge=aL(Ige);const Dge=t=>{let e=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},LL=(t,e)=>{t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},gA=(t,e)=>{e.activePlaylistLoader=t,t.load()},Nge=(t,e)=>()=>{const{segmentLoaders:{[t]:n,main:r},mediaTypes:{[t]:i}}=e,a=i.activeTrack(),s=i.getActiveGroup(),l=i.activePlaylistLoader,c=i.lastGroup_;if(!(s&&c&&s.id===c.id)&&(i.lastGroup_=s,i.lastTrack_=a,LL(n,i),!(!s||s.isMainPlaylist))){if(!s.playlistLoader){l&&r.resetEverything();return}n.resyncLoader(),gA(s.playlistLoader,i)}},Oge=(t,e)=>()=>{const{segmentLoaders:{[t]:n},mediaTypes:{[t]:r}}=e;r.lastGroup_=null,n.abort(),n.pause()},Fge=(t,e)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[t]:r,main:i},mediaTypes:{[t]:a}}=e,s=a.activeTrack(),l=a.getActiveGroup(),c=a.activePlaylistLoader,u=a.lastTrack_;if(!(u&&s&&u.id===s.id)&&(a.lastGroup_=l,a.lastTrack_=s,LL(r,a),!!l)){if(l.isMainPlaylist){if(!s||!u||s.id===u.id)return;const d=e.vhs.playlistController_,f=d.selectPlaylist();if(d.media()===f)return;a.logger_(`track change. Switching main audio from ${u.id} to ${s.id}`),n.pause(),i.resetEverything(),d.fastQualityChange_(f);return}if(t==="AUDIO"){if(!l.playlistLoader){i.setAudio(!0),i.resetEverything();return}r.setAudio(!0),i.setAudio(!1)}if(c===l.playlistLoader){gA(l.playlistLoader,a);return}r.track&&r.track(s),r.resetEverything(),gA(l.playlistLoader,a)}},yv={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:n},excludePlaylist:r}=e,i=n.activeTrack(),a=n.activeGroup(),s=(a.filter(c=>c.default)[0]||a[0]).id,l=n.tracks[s];if(i===l){r({error:{message:"Problem encountered loading the default audio track."}});return}Dt.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in n.tracks)n.tracks[c].enabled=n.tracks[c]===l;n.onTrackChanged()},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:n}}=e;Dt.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}},BL={AUDIO:(t,e,n)=>{if(!e)return;const{tech:r,requestOptions:i,segmentLoaders:{[t]:a}}=n;e.on("loadedmetadata",()=>{const s=e.media();a.playlist(s,i),(!r.paused()||s.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",yv[t](t,n))},SUBTITLES:(t,e,n)=>{const{tech:r,requestOptions:i,segmentLoaders:{[t]:a},mediaTypes:{[t]:s}}=n;e.on("loadedmetadata",()=>{const l=e.media();a.playlist(l,i),a.track(s.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",yv[t](t,n))}},kge={AUDIO:(t,e)=>{const{vhs:n,sourceType:r,segmentLoaders:{[t]:i},requestOptions:a,main:{mediaGroups:s},mediaTypes:{[t]:{groups:l,tracks:c,logger_:u}},mainPlaylistLoader:d}=e,f=J2(d.main);(!s[t]||Object.keys(s[t]).length===0)&&(s[t]={main:{default:{default:!0}}},f&&(s[t].main.default.playlists=d.main.playlists));for(const h in s[t]){l[h]||(l[h]=[]);for(const g in s[t][h]){let v=s[t][h][g],m;if(f?(u(`AUDIO group '${h}' label '${g}' is a main playlist`),v.isMainPlaylist=!0,m=null):r==="vhs-json"&&v.playlists?m=new ch(v.playlists[0],n,a):v.resolvedUri?m=new ch(v.resolvedUri,n,a):v.playlists&&r==="dash"?m=new sA(v.playlists[0],n,a,d):m=null,v=Ji({id:g,playlistLoader:m},v),BL[t](t,v.playlistLoader,e),l[h].push(v),typeof c[g]>"u"){const A=new Dt.AudioTrack({id:g,kind:Dge(v),enabled:!1,language:v.language,default:v.default,label:g});c[g]=A}}}i.on("error",yv[t](t,e))},SUBTITLES:(t,e)=>{const{tech:n,vhs:r,sourceType:i,segmentLoaders:{[t]:a},requestOptions:s,main:{mediaGroups:l},mediaTypes:{[t]:{groups:c,tracks:u}},mainPlaylistLoader:d}=e;for(const f in l[t]){c[f]||(c[f]=[]);for(const h in l[t][f]){if(!r.options_.useForcedSubtitles&&l[t][f][h].forced)continue;let g=l[t][f][h],v;if(i==="hls")v=new ch(g.resolvedUri,r,s);else if(i==="dash"){if(!g.playlists.filter(A=>A.excludeUntil!==1/0).length)return;v=new sA(g.playlists[0],r,s,d)}else i==="vhs-json"&&(v=new ch(g.playlists?g.playlists[0]:g.resolvedUri,r,s));if(g=Ji({id:h,playlistLoader:v},g),BL[t](t,g.playlistLoader,e),c[f].push(g),typeof u[h]>"u"){const m=n.addRemoteTextTrack({id:h,kind:"subtitles",default:g.default&&g.autoselect,language:g.language,label:h},!1).track;u[h]=m}}}a.on("error",yv[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[t]:{groups:i,tracks:a}}}=e;for(const s in r[t]){i[s]||(i[s]=[]);for(const l in r[t][s]){const c=r[t][s][l];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const u=n.options_.vhs&&n.options_.vhs.captionServices||{};let d={label:l,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(u[d.instreamId]&&(d=Ji(d,u[d.instreamId])),d.default===void 0&&delete d.default,i[s].push(Ji({id:l},c)),typeof a[l]>"u"){const f=n.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;a[l]=f}}}}},VL=(t,e)=>{for(let n=0;n<t.length;n++)if(eA(e,t[n])||t[n].playlists&&VL(t[n].playlists,e))return!0;return!1},Pge=(t,e)=>n=>{const{mainPlaylistLoader:r,mediaTypes:{[t]:{groups:i}}}=e,a=r.media();if(!a)return null;let s=null;a.attributes[t]&&(s=i[a.attributes[t]]);const l=Object.keys(i);if(!s)if(t==="AUDIO"&&l.length>1&&J2(e.main))for(let c=0;c<l.length;c++){const u=i[l[c]];if(VL(u,a)){s=u;break}}else i.main?s=i.main:l.length===1&&(s=i[l[0]]);return typeof n>"u"?s:n===null||!s?null:s.filter(c=>c.id===n.id)[0]||null},Mge={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].enabled)return n[r];return null},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].mode==="showing"||n[r].mode==="hidden")return n[r];return null}},Lge=(t,{mediaTypes:e})=>()=>{const n=e[t].activeTrack();return n?e[t].activeGroup(n):null},Bge=t=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{kge[u](u,t)});const{mediaTypes:e,mainPlaylistLoader:n,tech:r,vhs:i,segmentLoaders:{["AUDIO"]:a,main:s}}=t;["AUDIO","SUBTITLES"].forEach(u=>{e[u].activeGroup=Pge(u,t),e[u].activeTrack=Mge[u](u,t),e[u].onGroupChanged=Nge(u,t),e[u].onGroupChanging=Oge(u,t),e[u].onTrackChanged=Fge(u,t),e[u].getActiveGroup=Lge(u,t)});const l=e.AUDIO.activeGroup();if(l){const u=(l.filter(f=>f.default)[0]||l[0]).id;e.AUDIO.tracks[u].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(s.setAudio(!1),a.setAudio(!0)):s.setAudio(!0)}n.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanged())}),n.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",c),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),i.on("dispose",()=>{r.audioTracks().removeEventListener("change",c),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const u in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[u])},Vge=()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:bd,activeTrack:bd,getActiveGroup:bd,onGroupChanged:bd,onTrackChanged:bd,lastTrack_:null,logger_:Ql(`MediaGroups[${e}]`)}}),t};class qL{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=rl(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(n=>[n.ID,n])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class qge extends Dt.EventTarget{constructor(e,n){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new qL,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Ql("Content Steering"),this.xhr_=e,this.getBandwidth_=n}assignTagProperties(e,n){this.manifestType_=n.serverUri?"HLS":"DASH";const r=n.serverUri||n.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=rl(e,r),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const n=this.steeringManifest.reloadUri;if(!n)return;const r=e?n:this.getRequestURI(n);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const i={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:i}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(a,s)=>{if(a){if(s.status===410){this.logger_(`manifest request 410 ${a}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(s.status===429){const u=s.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${a}.`),this.logger_(`content steering will retry in ${u} seconds.`),this.startTTLTimeout_(parseInt(u,10));return}this.logger_(`manifest failed to load ${a}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:i});let l;try{l=JSON.parse(this.request_.responseText)}catch(u){const d={errorType:Dt.Error.StreamingContentSteeringParserError,error:u};this.trigger({type:"error",metadata:d})}this.assignSteeringProperties_(l);const c={contentSteeringInfo:i.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const n=new Re.URL(e),r=new Re.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const n=JSON.parse(Re.atob(e));this.assignSteeringProperties_(n)}setSteeringParams_(e){const n=new Re.URL(e),r=this.getPathway(),i=this.getBandwidth_();if(r){const a=`_${this.manifestType_}_pathway`;n.searchParams.set(a,r)}if(i){const a=`_${this.manifestType_}_throughput`;n.searchParams.set(a,i)}return n.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(i=>{for(const a of i)if(this.availablePathways_.has(a))return a;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const n=i=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!n(i))return i}const r=this.setSteeringParams_(e);return n(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const n=e*1e3;this.ttlTimeout_=Re.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){Re.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new qL}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,n){return!n&&this.steeringManifest.reloadUri||n&&(rl(e,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const Uge=10;let yd;const $ge=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],jge=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},zge=function({currentPlaylist:t,buffered:e,currentTime:n,nextPlaylist:r,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:s,bufferBasedABR:l,log:c}){if(!r)return Dt.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${t&&t.id||"null"} -> ${r.id}`;if(!t)return c(`${u} as current playlist is not set`),!0;if(r.id===t.id)return!1;const d=!!sh(e,n).length;if(!t.endList)return!d&&typeof t.partTargetDuration=="number"?(c(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${u} as current playlist is live`),!0);const f=Ry(e,n),h=l?Ls.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ls.MAX_BUFFER_LOW_WATER_LINE;if(s<h)return c(`${u} as duration < max low water line (${s} < ${h})`),!0;const g=r.attributes.BANDWIDTH,v=t.attributes.BANDWIDTH;if(g<v&&(!l||f<a)){let m=`${u} as next bandwidth < current bandwidth (${g} < ${v})`;return l&&(m+=` and forwardBuffer < bufferHighWaterLine (${f} < ${a})`),c(m),!0}if((!l||g>v)&&f>=i){let m=`${u} as forwardBuffer >= bufferLowWaterLine (${f} >= ${i})`;return l&&(m+=` and next bandwidth > current bandwidth (${g} > ${v})`),c(m),!0}return c(`not ${u} as no switching criteria met`),!1};class Hge extends Dt.EventTarget{constructor(e){super();const{src:n,withCredentials:r,tech:i,bandwidth:a,externVhs:s,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:f,bufferBasedABR:h,leastPixelDiffSelector:g,captionServices:v}=e;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:m}=e;(m===null||typeof m>"u")&&(m=1/0),yd=s,this.bufferBasedABR=!!h,this.leastPixelDiffSelector=!!g,this.withCredentials=r,this.tech_=i,this.vhs_=i.vhs,this.player_=e.player_,this.sourceType_=d,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Vge(),this.mediaSource=new Re.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Ks(),this.hasPlayed_=!1,this.syncController_=new Tge(e),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new _ge,this.sourceUpdater_=new NL(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Ege,this.keyStatusMap_=new Map;const A={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:v,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:a,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new sA(n,this.vhs_,Ji(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ch(n,this.vhs_,Ji(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new fA(Ji(A,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new fA(Ji(A,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Age(Ji(A,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((S,T)=>{function x(){i.off("vttjserror",E),S()}function E(){i.off("vttjsloaded",x),T()}i.one("vttjsloaded",x),i.one("vttjserror",E),i.addWebVttScript_()})}),e);const w=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new qge(this.vhs_.xhr,w),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),$ge.forEach(S=>{this[S+"_"]=jge.bind(this,S)}),this.logger_=Ql("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const C=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(C,()=>{const S=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-S,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();return e===-1||n===-1?-1:e+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,e)}switchMedia_(e,n,r){const i=this.media(),a=i&&(i.id||i.uri),s=e&&(e.id||e.uri);if(a&&a!==s){this.logger_(`switch media ${a} -> ${s} from ${n}`);const l={renditionInfo:{id:s,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:n};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const n=this.mediaTypes_[e],r=n?n.activeGroup():null,i=this.contentSteeringController_.getPathway();if(r&&i){const s=(r.length?r[0].playlists:r.playlists).filter(l=>l.attributes.serviceLocation===i);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=Re.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(Re.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),n=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return n;const r=e.mediaGroups.AUDIO,i=Object.keys(r);let a;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)a=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||i.length&&r[i[0]];for(const c in l)if(l[c].default){a={label:c};break}}if(!a)return n;const s=[];for(const l in r)if(r[l][a.label]){const c=r[l][a.label];if(c.playlists&&c.playlists.length)s.push.apply(s,c.playlists);else if(c.uri)s.push(c);else if(e.playlists.length)for(let u=0;u<e.playlists.length;u++){const d=e.playlists[u];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===l&&s.push(d)}}return s.length?s:n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;Zy(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,n.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.mainSegmentLoader_.load()),Bge({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),n),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let n=this.mainPlaylistLoader_.media();if(!n){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;n=this.initialMedia_}this.handleUpdatedMediaPlaylist(n)}),this.mainPlaylistLoader_.on("error",()=>{const n=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;Zy(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const n=this.mainPlaylistLoader_.media();if(n.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(n)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(n=>{this.mainPlaylistLoader_.on(n,r=>{this.player_.trigger(ka({},r))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,n){const r=e.mediaGroups||{};let i=!0;const a=Object.keys(r.AUDIO);for(const s in r.AUDIO)for(const l in r.AUDIO[s])r.AUDIO[s][l].uri||(i=!1);i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),yd.Playlist.isAes(n)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),a.length&&Object.keys(r.AUDIO[a[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),i=this.bufferLowWaterLine(),a=this.bufferHighWaterLine(),s=this.tech_.buffered();return zge({buffered:s,currentTime:r,currentPlaylist:n,nextPlaylist:e,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.sourceType_==="dash"&&this.timelineChangeController_.on("audioTimelineBehind",()=>{const r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const i=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(i)}),this.mainSegmentLoader_.on("earlyabort",r=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:Uge}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(r=>{this.mainSegmentLoader_.on(r,i=>{this.player_.trigger(ka({},i))}),this.audioSegmentLoader_.on(r,i=>{this.player_.trigger(ka({},i))}),this.subtitleSegmentLoader_.on(r,i=>{this.player_.trigger(ka({},i))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.mainSegmentLoader_.load()})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const n=this.seekable();if(!n.length)return!1;const r=n.end(0);let i=r;if(e.start){const a=e.start.timeOffset;a<0?i=Math.max(r+a,n.start(0)):i=Math.min(r,a)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,n=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const n=this.duration();e[e.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const n=this.mainSegmentLoader_.getCurrentMediaInfo_();!n||n.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const i=yd.Playlist.playlistEnd(e,r),a=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-a<=Cu;const l=s.end(s.length-1);return l-a<=Cu&&i-l<=Cu}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||n.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=n,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const i=this.mainPlaylistLoader_.main.playlists,a=i.filter(hv),s=a.length===1&&a[0]===e;if(i.length===1&&r!==1/0)return Dt.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(s);if(s){if(this.main().contentSteering){const v=this.pathwayAttribute_(e),m=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(v),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(v)},m);return}let g=!1;i.forEach(v=>{if(v===e)return;const m=v.excludeUntil;typeof m<"u"&&m!==1/0&&(g=!0,delete v.excludeUntil)}),g&&(Dt.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,n.reason&&(e.lastExcludeReason_=n.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=n.internal?this.logger_:Dt.log.warn,d=n.message?" "+n.message:"";u(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${d} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const f=c.targetDuration/2*1e3||5*1e3,h=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=f;return this.switchMedia_(c,"exclude",s||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,n){const r=[],i=e==="all";(i||e==="main")&&r.push(this.mainPlaylistLoader_);const a=[];(i||e==="audio")&&a.push("AUDIO"),(i||e==="subtitle")&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(s=>{const l=this.mediaTypes_[s]&&this.mediaTypes_[s].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(s=>{const l=this[`${s}SegmentLoader_`];l&&(e===s||e==="all")&&r.push(l)}),r.forEach(s=>n.forEach(l=>{typeof s[l]=="function"&&s[l]()}))}setCurrentTime(e){const n=sh(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:yd.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let n=this.mainPlaylistLoader_.media();if(!n)return;let r=this.syncController_.getExpiredTime(n,this.duration());if(r===null)return;const i=this.mainPlaylistLoader_.main,a=yd.Playlist.seekable(n,r,yd.Playlist.liveEdgeDelay(i,n));if(a.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),r=this.syncController_.getExpiredTime(n,this.duration()),r===null||(e=yd.Playlist.seekable(n,r,yd.Playlist.liveEdgeDelay(i,n)),e.length===0)))return;let s,l;if(this.seekable_&&this.seekable_.length&&(s=this.seekable_.end(0),l=this.seekable_.start(0)),e?e.start(0)>a.end(0)||a.start(0)>e.end(0)?this.seekable_=a:this.seekable_=Ks([[e.start(0)>a.start(0)?e.start(0):a.start(0),e.end(0)<a.end(0)?e.end(0):a.end(0)]]):this.seekable_=a,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===s&&this.seekable_.start(0)===l)return;this.logger_(`seekable updated [${NM(this.seekable_)}]`);const c={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:c}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const i=this.seekable();if(!i.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))&&this.sourceUpdater_.setDuration(i.end(i.length-1));return}const n=this.tech_.buffered();let r=yd.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const n=this.mediaTypes_[e].groups;for(const r in n)n[r].forEach(i=>{i.playlistLoader&&i.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!n||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=eg(this.main(),n),i={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(i.video=r.video||e.main.videoCodec||f1e),e.main.isMuxed&&(i.video+=`,${r.audio||e.main.audioCodec||wF}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||a)&&(i.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||wF,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const s=(u,d)=>u?g4(d):Eb(d),l={};let c;if(["video","audio"].forEach(function(u){if(i.hasOwnProperty(u)&&!s(e[u].isFmp4,i[u])){const d=e[u].isFmp4?"browser":"muxer";l[d]=l[d]||[],l[d].push(i[u]),u==="audio"&&(c=d)}}),a&&c&&n.attributes.AUDIO){const u=n.attributes.AUDIO;this.main().playlists.forEach(d=>{(d.attributes&&d.attributes.AUDIO)===u&&d!==n&&(d.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${c} does not support codec(s): "${i.audio}"`)}if(Object.keys(l).length){const u=Object.keys(l).reduce((d,f)=>(d&&(d+=", "),d+=`${f} does not support codec(s): "${l[f].join(",")}"`,d),"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(d=>{const f=(hu(this.sourceUpdater_.codecs[d]||"")[0]||{}).type,h=(hu(i[d]||"")[0]||{}).type;f&&h&&f.toLowerCase()!==h.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[d]}" -> "${i[d]}"`)}),u.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const n=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){const e=this.main().playlists,n=[];Object.keys(e).forEach(r=>{const i=e[r];if(n.indexOf(i.id)!==-1)return;n.push(i.id);const a=eg(this.main,i),s=[];a.audio&&!Eb(a.audio)&&!g4(a.audio)&&s.push(`audio codec ${a.audio}`),a.video&&!Eb(a.video)&&!g4(a.video)&&s.push(`video codec ${a.video}`),a.text&&a.text==="stpp.ttml.im1t"&&s.push(`text codec ${a.text}`),s.length&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${s.join(", ")}`))})}excludeIncompatibleVariants_(e){const n=[],r=this.main().playlists,i=gv(hu(e)),a=bL(i),s=i.video&&hu(i.video)[0]||null,l=i.audio&&hu(i.audio)[0]||null;Object.keys(r).forEach(c=>{const u=r[c];if(n.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;n.push(u.id);const d=[],f=eg(this.mainPlaylistLoader_.main,u),h=bL(f);if(!(!f.audio&&!f.video)){if(h!==a&&d.push(`codec count "${h}" !== "${a}"`),!this.sourceUpdater_.canChangeType()){const g=f.video&&hu(f.video)[0]||null,v=f.audio&&hu(f.audio)[0]||null;g&&s&&g.type.toLowerCase()!==s.type.toLowerCase()&&d.push(`video codec "${g.type}" !== "${s.type}"`),v&&l&&v.type.toLowerCase()!==l.type.toLowerCase()&&d.push(`audio codec "${v.type}" !== "${l.type}"`)}d.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${d.join(" && ")}`))}})}updateAdCues_(e){let n=0;const r=this.seekable();r.length&&(n=r.start(0)),Sge(e,this.cueTagsTrack_,n)}goalBufferLength(){const e=this.tech_.currentTime(),n=Ls.GOAL_BUFFER_LENGTH,r=Ls.GOAL_BUFFER_LENGTH_RATE,i=Math.max(n,Ls.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+e*r,i)}bufferLowWaterLine(){const e=this.tech_.currentTime(),n=Ls.BUFFER_LOW_WATER_LINE,r=Ls.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(n,Ls.MAX_BUFFER_LOW_WATER_LINE),a=Math.max(n,Ls.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+e*r,this.bufferBasedABR?a:i)}bufferHighWaterLine(){return Ls.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){CL(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ege({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,n,r){const i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();CL(this.inbandTextTracks_,e,this.tech_),Q2e({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:i,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const n of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(n=>{this.contentSteeringController_.on(n,r=>{this.trigger(ka({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const n=this.main();(this.contentSteeringController_.didDASHTagChange(n.uri,n.contentSteering)||(()=>{const a=this.contentSteeringController_.getAvailablePathways(),s=[];for(const l of n.playlists){const c=l.attributes.serviceLocation;if(c&&(s.push(c),!a.has(c)))return!0}return!!(!s.length&&a.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,i=new Set;let a=!1;Object.keys(r).forEach(s=>{const l=r[s],c=this.pathwayAttribute_(l),u=c&&e!==c;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!u&&(delete l.excludeUntil,delete l.lastExcludeReason_,a=!0);const f=!l.excludeUntil&&l.excludeUntil!==1/0;!i.has(l.id)&&u&&f&&(i.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const l=this.mediaTypes_[s];if(l.activePlaylistLoader){const c=l.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(a=!0)}}),a&&this.changeSegmentPathway_()}handlePathwayClones_(){const n=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||i&&i.size){for(const[s,l]of r.entries())i.get(s)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(s));for(const[s,l]of i.entries()){const c=r.get(s);if(!c){n.filter(d=>d.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(d=>{this.mainPlaylistLoader_.addClonePathway(l,d)}),this.contentSteeringController_.addAvailablePathway(s);continue}this.equalPathwayClones_(c,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(s))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,n){if(e["BASE-ID"]!==n["BASE-ID"]||e.ID!==n.ID||e["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,i=n["URI-REPLACEMENT"].PARAMS;for(const a in r)if(r[a]!==i[a])return!1;for(const a in i)if(r[a]!==i[a])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=this.mainPlaylistLoader_.getKeyIdSet(r);!i||!i.size||i.forEach(a=>{const s="usable",l=this.keyStatusMap_.has(a)&&this.keyStatusMap_.get(a)===s,c=r.lastExcludeReason_===n&&r.excludeUntil===1/0;l?l&&c&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${a} is ${s}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==n&&(r.excludeUntil=1/0,r.lastExcludeReason_=n,this.logger_(`excluding playlist ${r.id} because the key ID ${a} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,a=r.excludeUntil===1/0&&r.lastExcludeReason_===n;i&&a&&(delete r.excludeUntil,Dt.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${n} key IDs`))})}addKeyStatus_(e,n){const a=(typeof e=="string"?e:bge(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${a} added to the keyStatusMap`),this.keyStatusMap_.set(a,n)}updatePlaylistByKeyStatus(e,n){this.addKeyStatus_(e,n),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const Yge=(t,e,n)=>r=>{const i=t.main.playlists[e],a=Jy(i),s=hv(i);if(typeof r>"u")return s;r?delete i.disabled:i.disabled=!0;const l={renditionInfo:{id:e,bandwidth:i.attributes.BANDWIDTH,resolution:i.attributes.RESOLUTION,codecs:i.attributes.CODECS},cause:"fast-quality"};return r!==s&&!a&&(n(i),r?t.trigger({type:"renditionenabled",metadata:l}):t.trigger({type:"renditiondisabled",metadata:l})),r};class Kge{constructor(e,n,r){const{playlistController_:i}=e,a=i.fastQualityChange_.bind(i);if(n.attributes){const s=n.attributes.RESOLUTION;this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=eg(i.main(),n),this.playlist=n,this.id=r,this.enabled=Yge(e.playlists,n.id,a)}}const Xge=function(t){t.representations=()=>{const e=t.playlistController_.main(),n=J2(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;return n?n.filter(r=>!Jy(r)).map((r,i)=>new Kge(t,r,r.id)):[]}},UL=["seeking","seeked","pause","playing","error"];class Gge extends Dt.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Ql("PlaybackWatcher"),this.logger_("initialize");const n=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),a=()=>this.resetTimeUpdate_(),s=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach(d=>{c[d]={reset:()=>this.resetSegmentDownloads_(d),updateend:()=>this.checkSegmentDownloads_(d)},s[`${d}SegmentLoader_`].on("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].on("playlistupdate",c[d].reset),this.tech_.on(["seeked","seeking"],c[d].reset)});const u=d=>{["main","audio"].forEach(f=>{s[`${f}SegmentLoader_`][d]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(UL,a),this.tech_.on("canplay",r),this.tech_.one("play",n),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(UL,a),this.tech_.off("canplay",r),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(d=>{s[`${d}SegmentLoader_`].off("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].off("playlistupdate",c[d].reset),this.tech_.off(["seeked","seeking"],c[d].reset)}),this.checkCurrentTimeTimeout_&&Re.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&Re.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=Re.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const n=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=n.buffered_()}checkSegmentDownloads_(e){const n=this.playlistController_,r=n[`${e}SegmentLoader_`],i=r.buffered_(),a=Bpe(this[`${e}Buffered_`],i);if(this[`${e}Buffered_`]=i,a){const s={bufferedRanges:i};n.trigger({type:"bufferedrangeschanged",metadata:s}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:g1(i)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&n.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===e&&(!n.length||e+Cu>=n.end(n.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Ks([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const n=this.seekable(),r=this.tech_.currentTime(),i=this.afterSeekableWindow_(n,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let a;if(i&&(a=n.end(n.length-1)),this.beforeSeekableWindow_(n,r)){const v=n.start(0);a=v+(v===n.end(0)?0:Cu)}if(typeof a<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${NM(n)}. Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0;const s=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,d=this.media(),f=d.partTargetDuration?d.partTargetDuration:(d.targetDuration-Su)*2,h=[c,u];for(let v=0;v<h.length;v++){if(!h[v])continue;if(Ry(h[v],r)<f)return!1}const g=fv(l,r);return g.length===0?!1:(a=g.start(0)+Cu,this.logger_(`Buffered region starts (${g.start(0)}) just beyond seek point (${r}). Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),n=this.tech_.buffered(),r=sh(n,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,n)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=fv(i,n);return s.length>0?(this.logger_(`Stopped at ${n} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0):!1}afterSeekableWindow_(e,n,r,i=!1){if(!e.length)return!1;let a=e.end(e.length-1)+Cu;const s=!r.endList,l=typeof r.partTargetDuration=="number";return s&&(l||i)&&(a=e.end(e.length-1)+r.targetDuration*3),n>a}beforeSeekableWindow_(e,n){return!!(e.length&&e.start(0)>0&&n<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:n,currentTime:r}){if(!e)return;let i;if(e.length&&n.length){const a=sh(e,r-3),s=sh(e,r),l=sh(n,r);l.length&&!s.length&&a.length&&(i={start:a.end(0),end:l.end(0)})}else fv(e,r).length||(i=this.gapFromVideoUnderflow_(e,r));return i?(this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const n=this.tech_.buffered(),r=this.tech_.currentTime(),i=fv(n,r);if(this.resetTimeUpdate_(),i.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+Su);const a={gapInfo:{from:r,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:a}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,n){const r=Ppe(e);for(let i=0;i<r.length;i++){const a=r.start(i),s=r.end(i);if(n-a<4&&n-a>2)return{start:a,end:s}}return null}}const Rge={errorInterval:30,getSource(t){const n=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(n)}},$L=function(t,e){let n=0,r=0;const i=Ji(Rge,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const a=function(){r&&t.currentTime(r)},s=function(d){d!=null&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(d),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())},l=function(){if(Date.now()-n<i.errorInterval*1e3){t.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!i.getSource||typeof i.getSource!="function"){Dt.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return n=Date.now(),i.getSource.call(t,s)},c=function(){t.off("loadedmetadata",a),t.off("error",l),t.off("dispose",c)},u=function(d){c(),$L(t,d)};t.on("error",l),t.on("dispose",c),t.reloadSourceOnError=u},Wge=function(t){$L(this,t)};var jL="3.13.3",Qge="7.0.3",Jge="1.3.0",Zge="7.1.0",eme="4.0.1";const Wa={PlaylistLoader:ch,Playlist:il,utils:a2e,STANDARD_PLAYLIST_SELECTOR:wL,INITIAL_PLAYLIST_SELECTOR:K2e,lastBandwidthSelector:wL,movingAverageBandwidthSelector:H2e,comparePlaylistBandwidth:uA,comparePlaylistResolution:z2e,xhr:WM()};Object.keys(Ls).forEach(t=>{Object.defineProperty(Wa,t,{get(){return Dt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),Ls[t]},set(e){if(Dt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Dt.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}Ls[t]=e}})});const zL="videojs-vhs",HL=function(t,e){const n=e.media();let r=-1;for(let i=0;i<t.length;i++)if(t[i].id===n.id){r=i;break}t.selectedIndex_=r,t.trigger({selectedIndex:r,type:"change"})},tme=function(t,e){e.representations().forEach(n=>{t.addQualityLevel(n)}),HL(t,e.playlists)};Wa.canPlaySource=function(){return Dt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const nme=(t,e,n)=>{if(!t)return t;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=gv(hu(e.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const i=x2(r.video),a=x2(r.audio),s={};for(const l in t)s[l]={},a&&(s[l].audioContentType=a),i&&(s[l].videoContentType=i),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(s[l].pssh=e.contentProtection[l].pssh),typeof t[l]=="string"&&(s[l].url=t[l]);return Ji(t,s)},rme=(t,e)=>t.reduce((n,r)=>{if(!r.contentProtection)return n;const i=e.reduce((a,s)=>{const l=r.contentProtection[s];return l&&l.pssh&&(a[s]={pssh:l.pssh}),a},{});return Object.keys(i).length&&n.push(i),n},[]),ime=({player:t,sourceKeySystems:e,audioMedia:n,mainPlaylists:r})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();const i=n?r.concat([n]):r,a=rme(i,Object.keys(e)),s=[],l=[];return a.forEach(c=>{l.push(new Promise((u,d)=>{t.tech_.one("keysessioncreated",u)})),s.push(new Promise((u,d)=>{t.eme.initializeMediaKeys({keySystems:c},f=>{if(f){d(f);return}u()})}))}),Promise.race([Promise.all(s),Promise.race(l)])},ame=({player:t,sourceKeySystems:e,media:n,audioMedia:r})=>{const i=nme(e,n,r);return i?(t.currentSource().keySystems=i,i&&!t.eme?(Dt.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},YL=()=>{if(!Re.localStorage)return null;const t=Re.localStorage.getItem(zL);if(!t)return null;try{return JSON.parse(t)}catch{return null}},sme=t=>{if(!Re.localStorage)return!1;let e=YL();e=e?Ji(e,t):t;try{Re.localStorage.setItem(zL,JSON.stringify(e))}catch{return!1}return e},ome=t=>t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(t.substring(t.indexOf(",")+1)):t,KL=(t,e)=>{t._requestCallbackSet||(t._requestCallbackSet=new Set),t._requestCallbackSet.add(e)},XL=(t,e)=>{t._responseCallbackSet||(t._responseCallbackSet=new Set),t._responseCallbackSet.add(e)},GL=(t,e)=>{t._requestCallbackSet&&(t._requestCallbackSet.delete(e),t._requestCallbackSet.size||delete t._requestCallbackSet)},RL=(t,e)=>{t._responseCallbackSet&&(t._responseCallbackSet.delete(e),t._responseCallbackSet.size||delete t._responseCallbackSet)};Wa.supportsNativeHls=function(){if(!xn||!xn.createElement)return!1;const t=xn.createElement("video");return Dt.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(t.canPlayType(n))}):!1}(),Wa.supportsNativeDash=function(){return!xn||!xn.createElement||!Dt.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(xn.createElement("video").canPlayType("application/dash+xml"))}(),Wa.supportsTypeNatively=t=>t==="hls"?Wa.supportsNativeHls:t==="dash"?Wa.supportsNativeDash:!1,Wa.isSupported=function(){return Dt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Wa.xhr.onRequest=function(t){KL(Wa.xhr,t)},Wa.xhr.onResponse=function(t){XL(Wa.xhr,t)},Wa.xhr.offRequest=function(t){GL(Wa.xhr,t)},Wa.xhr.offResponse=function(t){RL(Wa.xhr,t)};const lme=Dt.getComponent("Component");class WL extends lme{constructor(e,n,r){if(super(n,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Ql("VhsHandler"),n.options_&&n.options_.playerId){const i=Dt.getPlayer(n.options_.playerId);this.player_=i}if(this.tech_=n,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(xn,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],i=>{const a=xn.fullscreenElement||xn.webkitFullscreenElement||xn.mozFullScreenElement||xn.msFullscreenElement;a&&a.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Ji(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=YL();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ls.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ls.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const n=this.options_.customPixelRatio;typeof n=="number"&&n>=0&&(this.customPixelRatio=n)}setOptions(e={}){this.setOptions_(e)}src(e,n){if(!e)return;this.setOptions_(),this.options_.src=ome(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Wa,this.options_.sourceType=SF(n),this.options_.seekTo=a=>{this.tech_.setCurrentTime(a)},this.options_.player_=this.player_,this.playlistController_=new Hge(this.options_);const r=Ji({liveRangeSafeTimeDelta:Cu},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Gge(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const a=Dt.players[this.tech_.options_.playerId];let s=this.playlistController_.error;typeof s=="object"&&!s.code?s.code=3:typeof s=="string"&&(s={message:s,code:3}),a.error(s)});const i=this.options_.bufferBasedABR?Wa.movingAverageBandwidthSelector(.55):Wa.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=Wa.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(a){this.playlistController_.selectPlaylist=a.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(a){this.playlistController_.mainSegmentLoader_.throughput.rate=a,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let a=this.playlistController_.mainSegmentLoader_.bandwidth;const s=Re.navigator.connection||Re.navigator.mozConnection||Re.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&s){const c=s.downlink*1e3*1e3;c>=l&&a>=l?a=Math.max(a,c):a=c}return a},set(a){this.playlistController_.mainSegmentLoader_.bandwidth=a,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const a=1/(this.bandwidth||1);let s;return this.throughput>0?s=1/this.throughput:s=0,Math.floor(1/(a+s))},set(){Dt.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>g1(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>g1(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&sme({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Xge(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=Re.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),ime({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(n=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=ame({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Dt.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{tme(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{HL(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":jL,"mux.js":Qge,"mpd-parser":Jge,"m3u8-parser":Zge,"aes-decrypter":eme}}version(){return this.constructor.version()}canChangeType(){return NL.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&Re.URL.revokeObjectURL&&(Re.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,n){return f2e({playlist:this.playlistController_.media(),time:e,callback:n})}seekToProgramTime(e,n,r=!0,i=2){return tL({programTime:e,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=e=>{KL(this.xhr,e)},this.xhr.onResponse=e=>{XL(this.xhr,e)},this.xhr.offRequest=e=>{GL(this.xhr,e)},this.xhr.offResponse=e=>{RL(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],n=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,i=>{this.player_.trigger(ka({},i))})}),n.forEach(r=>{this.playbackWatcher_.on(r,i=>{this.player_.trigger(ka({},i))})})}}const Av={name:"videojs-http-streaming",VERSION:jL,canHandleSource(t,e={}){const n=Ji(Dt.options,e);return Av.canPlayType(t.type,n)},handleSource(t,e,n={}){const r=Ji(Dt.options,n);return e.vhs=new WL(t,e,r),e.vhs.xhr=WM(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){const n=SF(t);if(!n)return"";const r=Av.getOverrideNative(e);return!Wa.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative(t={}){const{vhs:e={}}=t,n=!(Dt.browser.IS_ANY_SAFARI||Dt.browser.IS_IOS),{overrideNative:r=n}=e;return r}};g4("avc1.4d400d,mp4a.40.2")&&Dt.getTech("Html5").registerSourceHandler(Av,0),Dt.VhsHandler=WL,Dt.VhsSourceHandler=Av,Dt.Vhs=Wa,Dt.use||Dt.registerComponent("Vhs",Wa),Dt.options.vhs=Dt.options.vhs||{},(!Dt.getPlugin||!Dt.getPlugin("reloadSourceOnError"))&&Dt.registerPlugin("reloadSourceOnError",Wge);const QL=t=>{const{userTrainingSaveData:e,updateUserTraining:n}=mr(),r=k.useRef(null),i=k.useRef(null),{options:a,onReady:s,currentItem:l}=t,[c,u]=k.useState(!1),d=g=>{if(e!==null){const v=e==null?void 0:e.findIndex(m=>(m==null?void 0:m.fieldId)===(l==null?void 0:l.uuid));if(v>=0){const m=g.target;e[v].seenTime=m.currentTime}}},f=g=>{const v=[...e],m=v==null?void 0:v.findIndex(A=>(A==null?void 0:A.fieldId)===(g==null?void 0:g.uuid));m>=0&&(v[m]={...e[m],isSeen:!0},n(v),h("Ended"))};k.useEffect(()=>{if(i.current){const g=i.current;g.autoplay(a.autoplay),g.src(a.sources)}else{const g=r.current;if(!g)return;const v=i.current=Dt(g,a,()=>{Dt.log("player is ready"),s&&s(v)})}},[a,r]);const h=g=>{const v=i.current,m=e!==null?e.findIndex(A=>(A==null?void 0:A.fieldId)===(l==null?void 0:l.uuid)):-1;m>=0&&e[m].logs.push({action:g,videoTime:e[m].seenTime,totalTime:v.duration(),timeState:new Date}),n(e)};return k.useEffect(()=>{if(!c&&e!==null){const g=e.findIndex(v=>(v==null?void 0:v.fieldId)===(l==null?void 0:l.uuid));g>=0&&(u(!0),i.current.currentTime(e[g].seenTime))}},[e]),k.useEffect(()=>{const g=i.current;return()=>{g&&(g.dispose(),i.current=null)}},[i]),o.jsx("div",{"data-vjs-player":!0,children:o.jsx("video",{onPause:()=>{h("Pause")},onPlay:()=>{h("Play")},onEnded:()=>{f(l)},onTimeUpdate:d,ref:r,className:"video-js vjs-big-play-centered"})})},cme=t=>{var S,T,x,E,_;const{field:e}=t,n=k.useRef(null),{userSelectedLanguage:r}=sn(),{isBuilderMode:i,media:a}=Ht(),s=(S=a==null?void 0:a.video)!=null&&S.MediaVideo?(T=a==null?void 0:a.video)==null?void 0:T.MediaVideo:()=>o.jsx(o.Fragment,{}),l=M=>{n.current=M,M.on("waiting",()=>{Dt.log("player is waiting")}),M.on("dispose",()=>{Dt.log("player will dispose")})},[c,u]=k.useState(!1),[d,f]=k.useState(!1),h=()=>{f(!0)},g=()=>{f(!1)},v=M=>{u(M)},m=()=>{u(!1)},A=k.useCallback(M=>o.jsx(QL,{options:{autoplay:!1,controls:!0,responsive:!0,fluid:!0,sources:[{src:M}]},currentItem:e,onReady:l,onUpdate:()=>{}}),[e==null?void 0:e.media_file_id]),w=k.useCallback(M=>o.jsx(s,{mediaId:M,alt:""}),[e==null?void 0:e.media_file_id]),C=o.jsxs("div",{onMouseOver:h,onMouseOut:g,children:[i&&d&&o.jsx(Wr,{handleFieldSettingsSidebar:v,...t}),o.jsx("div",{className:i?"field-form-builder py-4 px-2":"py-4 px-2",children:o.jsx("div",{className:"field",children:o.jsx("div",{className:"grid",children:o.jsx("div",{className:"col-12",children:o.jsxs("div",{className:"mt-3",children:[o.jsxs("label",{className:"flex font-bold mb-3 text-gray-900 text-xl",children:[" ",(x=e==null?void 0:e.title)==null?void 0:x[r==null?void 0:r.type]," -"," ",e==null?void 0:e.videoDuration]}),(e==null?void 0:e.isExternalSource)===!0&&o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&A((E=e==null?void 0:e.media_url)==null?void 0:E[r==null?void 0:r.type])}),(e==null?void 0:e.isExternalSource)===!1?(e==null?void 0:e.media_file_id)!==void 0&&(e==null?void 0:e.media_file_id)!==null?o.jsx(o.Fragment,{children:w(e==null?void 0:e.media_file_id)}):o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&A((_=e==null?void 0:e.media_url)==null?void 0:_[r==null?void 0:r.type])}):o.jsx(o.Fragment,{})]})})})})})]});return o.jsxs(o.Fragment,{children:[o.jsx(n0e,{visibilty:c,closeSettingFieldSidebar:m,...t}),o.jsx(xi,{...t,fieldWrap:C})]})},ume=t=>{const{isBuilderMode:e}=Ht(),[n,r]=k.useState(!1),i=()=>{r(!0)},a=()=>{r(!1)},s=o.jsxs("div",{onMouseOver:i,onMouseOut:a,children:[e&&n&&o.jsx(Wr,{handleFieldSettingsSidebar:()=>{},...t}),o.jsx("div",{className:e?"field-form-builder":"",children:o.jsx("div",{className:"grid",children:o.jsxs("div",{className:"col-12",children:[o.jsx(ga,{}),o.jsx("div",{className:"hr-divider"})]})})})]});return o.jsx(o.Fragment,{children:o.jsx(xi,{...t,fieldWrap:s})})},dme=t=>{var ce,Y,ae,re,Z,K,W,ge,ve,Ie,be;const{isAdmin:e,isBuilderMode:n}=Ht(),{field:r,fieldIndex:i,row:a}=t,{task_status:s,taskRegisterData:l,updateTaskRegisterData:c,updateTaskProgressValue:u,userTaskSubmitFormData:d,updateUserFormDataSubmit:f,TASK_PUBLISHED:h}=mr(),{userSelectedLanguage:g}=sn(),[v,m]=k.useState(!1),[A,w]=k.useState(""),[C,S]=k.useState(0),[T,x]=k.useState(!1),[E,_]=k.useState(!1),M=()=>{_(!0)},O=()=>{_(!1)},F=de=>new Date(de),P=()=>{var de,ne,q;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const ee=[...a.repeatableFields],oe=_t.findIndex(ee,function(pe){return pe.uuid===(r==null?void 0:r.uuid)});oe>=0&&ee[oe].fieldData?w(ee[oe].fieldData):w("")}}else{const ee=d;if(ee!=null&&ee.length){for(const oe of ee)if(oe.fieldId===t.field.uuid&&((de=oe==null?void 0:oe.postData[0])==null?void 0:de.postValue)!==""&&((ne=oe==null?void 0:oe.postData[0])!=null&&ne.postValue)){w(F((q=oe==null?void 0:oe.postData[0])==null?void 0:q.postValue));break}}}x(!0)};k.useEffect(()=>{T||P();const de=Rt.addListener("clearRepeatableFields",oe=>{oe===(a==null?void 0:a.uuid)&&(w(""),S(0),r.isValid=0)}),ne=Rt.addListener("onSubmitUserForm",()=>{var oe;(oe=r==null?void 0:r.attributes)!=null&&oe.required?A?r.isValid=1:r.isValid=0:r.isValid=1}),q=Rt.addListener("OnInvalidFieldCatch",oe=>{r.uuid===(oe==null?void 0:oe.fieldId)?S(1):S(0)}),ee=Rt.addListener("OnGetFieldValue",oe=>{var Ce;const pe=(Ce=oe==null?void 0:oe.repeatableColumn)==null?void 0:Ce.filter(De=>(De==null?void 0:De.fieldUuid)===(r==null?void 0:r.uuid));pe!=null&&pe.length});return()=>{ne.remove(),q.remove(),de.remove(),ee.remove()}});const H=de=>{m(de)},N=()=>{m(!1)},$=de=>{var ee,oe;w(de.target.value);const ne=d,q=_t.cloneDeep(l);if(ne!==null){if((ee=de==null?void 0:de.target)!=null&&ee.value){if(q[r==null?void 0:r.uuid]=(oe=de==null?void 0:de.target)==null?void 0:oe.value,(ne==null?void 0:ne.length)>0)for(const pe of ne)pe.fieldId===t.field.uuid&&(pe.postData[0]={postValue:de.target.value})}else if(delete q[r==null?void 0:r.uuid],(ne==null?void 0:ne.length)>0)for(const pe of ne)pe.fieldId===t.field.uuid&&(pe.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){c(q);const pe=Object.keys(q).length;u(pe)}},U=(de,ne)=>{var q;if(w(ne),(d==null?void 0:d.length)>0){const ee=[...d],oe=_t.findIndex(ee,function(Ce){return Ce.rowId===(a==null?void 0:a.uuid)});let pe=(q=d[oe])==null?void 0:q.repeatableFields;pe={...pe,[de.uuid]:ne},ee[oe]={...ee[oe],repeatableFields:pe},f(ee),ne!==""?de.isValid=1:de.isValid=0}},le=new Date(r==null?void 0:r.minDate),G=new Date(r==null?void 0:r.maxDate),X=o.jsxs("div",{onMouseOver:M,onMouseOut:O,children:[n&&E&&o.jsx(Wr,{type:"",handleFieldSettingsSidebar:H,...t}),o.jsxs("div",{className:`field ${n?" py-3 px-4 builder-element-wrapper ":""}${(r==null?void 0:r.isFluid)===!0&&" p-fluid"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:"col-12 ",children:[(r==null?void 0:r.showHeaderText)&&o.jsx("h6",{children:(ce=r==null?void 0:r.headerText)==null?void 0:ce[g==null?void 0:g.type]}),(r==null?void 0:r.showLabel)&&o.jsxs("label",{htmlFor:i,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{update:function(){throw new Error("Function not implemented.")},value:{fieldId:void 0,uuid:void 0},...t}),((Y=r==null?void 0:r.attributes)==null?void 0:Y.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",n?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(ae=r==null?void 0:r.label)==null?void 0:ae[g==null?void 0:g.type]}),(r==null?void 0:r.showToolTip)&&o.jsx("span",{className:"ml-3",children:(r==null?void 0:r.showToolTip)&&o.jsx(zi,{message:(re=r==null?void 0:r.toolTip)==null?void 0:re[g==null?void 0:g.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(r==null?void 0:r.iconAlignment),children:[(r==null?void 0:r.showIcon)&&o.jsx("i",{className:"pi pi-"+((K=(Z=r==null?void 0:r.icon)==null?void 0:Z.properties)==null?void 0:K.name)}),o.jsx(ef,{readOnlyInput:!0,numberOfMonths:r==null?void 0:r.noOfMonths,selectionMode:(r==null?void 0:r.dateRange)||"single",view:(r==null?void 0:r.calenderView)||!1,showButtonBar:(r==null?void 0:r.isTodayBtn)||!1,showIcon:(r==null?void 0:r.isIcon)||!1,id:r==null?void 0:r.uuid,dateFormat:r==null?void 0:r.dateFormat,placeholder:(W=r==null?void 0:r.placeholder)==null?void 0:W[g==null?void 0:g.type],value:A,onFocus:()=>S(1),onChange:de=>{a!=null&&a.rowIsRepeatable?U(r,de.target.value):$(de)},minDate:le,maxDate:G,className:C===1&&((ge=r==null?void 0:r.attributes)!=null&&ge.required)?A?"valid":"invalid":"valid'",disabled:e||s===h})]}),o.jsx("div",{children:((ve=r==null?void 0:r.attributes)==null?void 0:ve.required)&&o.jsx("small",{className:"error",children:C===1&&!A?(Ie=r==null?void 0:r.validationMesssage)==null?void 0:Ie.english:""})}),o.jsx("div",{children:(r==null?void 0:r.showHelperText)&&o.jsx("small",{children:(be=r==null?void 0:r.helperText)==null?void 0:be[g==null?void 0:g.type]})})]})]})}),e&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(ki,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[v===!0&&o.jsx(Qi,{visibilty:v,closeSettingFieldSidebar:N,...t},r==null?void 0:r.uuid),o.jsx(xi,{...t,fieldWrap:X})]})},fme=t=>{var W,ge,ve,Ie,be,de,ne,q;const e=k.useRef(null),{task_status:n,taskRegisterData:r,updateTaskRegisterData:i,updateTaskProgressValue:a,updateUserFormDataSubmit:s,userTaskSubmitFormData:l,onSetValuetoPostDataHook:c,TASK_PUBLISHED:u}=mr(),{userSelectedLanguage:d,fieldSettingUpdate:f}=sn(),{field:h,fieldIndex:g,columnIndex:v,sectionIndex:m,rowIndex:A,pageIndex:w,row:C}=t,{isAdmin:S,isBuilderMode:T}=Ht(),[x,E]=k.useState(!1),[_,M]=k.useState(0),[O,F]=k.useState(!1),[P,H]=k.useState(null),[N,$]=k.useState(!1),U=()=>{$(!0)},le=()=>{$(!1)},G=()=>{var oe,pe,Ce;(oe=e==null?void 0:e.current)==null||oe.clear(),h.isValid=0,f(w,m,A,v,g,h),H(null);const ee=l;if(l!=null&&l.length){const De=_t.cloneDeep(r);if(De[h==null?void 0:h.uuid]=(pe=e.current)==null?void 0:pe.toDataURL(),(ee==null?void 0:ee.length)>0){for(const me of ee)if(me.fieldId===t.field.uuid){me.postData[0]={postValue:null},H(null);break}}if(!(C!=null&&C.rowIsRepeatable)){i(De);const me=(Ce=Object.keys(De))==null?void 0:Ce.length;a(me)}}},X=()=>{var oe,pe,Ce;const ee=l;if((ee==null?void 0:ee.length)>0)for(const De of ee)De.fieldId===t.field.uuid&&((oe=De==null?void 0:De.postData[0])!=null&&oe.postValue&&((pe=De==null?void 0:De.postData[0])==null?void 0:pe.postValue)!==""&&(H((Ce=De==null?void 0:De.postData[0])==null?void 0:Ce.postValue),F(!0)),h.isValid=1);F(!0)},ce=()=>{var ee,oe,pe,Ce;if(l!=null&&l.length){const De=[...l],me=_t.findIndex(De,function(Pe){return Pe.rowId===(C==null?void 0:C.uuid)});let Te=(ee=l[me])==null?void 0:ee.repeatableFields;Te={...Te,[h==null?void 0:h.uuid]:`<img src="${(oe=e.current)==null?void 0:oe.toDataURL()}" >`},De[me]={...De[me],repeatableFields:Te},s(De)}H(((pe=e.current)==null?void 0:pe.toDataURL())||""),((Ce=e.current)==null?void 0:Ce.toDataURL())!==""?h.isValid=1:h.isValid=0};k.useEffect(()=>{O||X();const ee=Rt.addListener("clearRepeatableFields",De=>{De===(C==null?void 0:C.uuid)&&(H(null),G(),M(0),h.isValid=0,f(w,m,A,v,g,h))}),oe=Rt.addListener("onSubmitUserForm",()=>{var De;(De=h==null?void 0:h.attributes)!=null&&De.required?(P!==null?h.isValid=1:h.isValid=0,f(w,m,A,v,g,h)):h.isValid=1}),pe=Rt.addListener("OnInvalidFieldCatch",De=>{h.uuid===(De==null?void 0:De.fieldId)?M(1):M(0)}),Ce=Rt.addListener("OnSignatureSettingChange",()=>{G()});return()=>{oe.remove(),pe.remove(),Ce.remove(),ee.remove()}});const Y=ee=>{E(ee)},ae=()=>{E(!1)},re=()=>{var oe,pe,Ce,De;const ee=l;if(l!=null&&l.length){const me=_t.cloneDeep(r);if(me[h==null?void 0:h.uuid]=(oe=e.current)==null?void 0:oe.toDataURL(),(ee==null?void 0:ee.length)>0){for(const Te of ee)if(Te.fieldId===t.field.uuid){Te.postData[0]={postValue:(pe=e.current)==null?void 0:pe.toDataURL()},H(((Ce=e.current)==null?void 0:Ce.toDataURL())||null);break}}if(!(C!=null&&C.rowIsRepeatable)){i(me);const Te=(De=Object.keys(me))==null?void 0:De.length;a(Te)}}},Z=()=>{var ee,oe,pe;return`rgba(${(ee=h==null?void 0:h.backgroundColor)==null?void 0:ee.r}, ${(oe=h==null?void 0:h.backgroundColor)==null?void 0:oe.g}, ${(pe=h==null?void 0:h.backgroundColor)==null?void 0:pe.b}, 0.8)`},K=o.jsxs("div",{onMouseOver:U,onMouseOut:le,children:[T&&N&&o.jsx(Wr,{handleFieldSettingsSidebar:Y,...t}),o.jsxs("div",{className:`field ${T?" py-3 px-4 builder-element-wrapper ":""}${(h==null?void 0:h.isFluid)===!0&&" p-fluid"}`,children:[o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:S?"col-6 p-fluid":"col-12 p-fluid",children:[(h==null?void 0:h.showHeaderText)&&o.jsx("h6",{children:(W=h==null?void 0:h.headerText)==null?void 0:W[d==null?void 0:d.type]}),(h==null?void 0:h.showLabel)&&o.jsxs("label",{htmlFor:h.uuid,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{...t}),((ge=h==null?void 0:h.attributes)==null?void 0:ge.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",T?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(ve=h==null?void 0:h.label)==null?void 0:ve[d==null?void 0:d.type]}),o.jsx("span",{className:"ml-3",children:(h==null?void 0:h.showToolTip)&&o.jsx(zi,{message:(Ie=h==null?void 0:h.toolTip)==null?void 0:Ie[d==null?void 0:d.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[n!==u&&!S&&o.jsx(DT,{backgroundColor:Z(),penColor:`#${h==null?void 0:h.penColor}`,canvasProps:{width:`${h==null?void 0:h.canvasWidth}`,height:h==null?void 0:h.canvasHeight,className:"sigCanvas"},ref:e,onEnd:()=>{C!=null&&C.rowIsRepeatable?ce():re()}},h==null?void 0:h.uuid),n===u&&P==null&&o.jsx("p",{children:"Not signed"}),(S||n===u)&&o.jsx("img",{alt:"",src:P,style:{width:350,height:200}}),o.jsx("div",{children:((be=h==null?void 0:h.attributes)==null?void 0:be.required)&&o.jsx("small",{className:"error",children:_===1&&!P?(de=h==null?void 0:h.validationMesssage)==null?void 0:de.english:""})}),o.jsx("div",{className:"mt-3",children:(h==null?void 0:h.showHelperText)&&o.jsx("small",{children:(ne=h==null?void 0:h.helperText)==null?void 0:ne[d==null?void 0:d.type]})}),n===Qm&&o.jsx(o.Fragment,{children:S===!1&&o.jsx(Ot,{text:!0,label:(q=h==null?void 0:h.clearSignatureButtonLabel)==null?void 0:q[d==null?void 0:d.type],onClick:()=>G(),className:"p-button-raised p-button-text mt-3"})})]})]}),S&&o.jsx(o.Fragment,{children:o.jsx("div",{className:"col-6",children:o.jsx(ki,{...t})})})]}),S&&o.jsx("hr",{})]})]});return o.jsxs(o.Fragment,{children:[x===!0&&o.jsx(Qi,{visibilty:x,closeSettingFieldSidebar:ae,...t}),o.jsx(xi,{...t,fieldWrap:K})]})};function b1(){return b1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},b1.apply(null,arguments)}function rg(t){"@babel/helpers - typeof";return rg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rg(t)}function hme(t,e){if(rg(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(rg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pme(t){var e=hme(t,"string");return rg(e)=="symbol"?e:e+""}function mA(t,e,n){return(e=pme(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gme(t){if(Array.isArray(t))return t}function mme(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return l}}function vA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function JL(t,e){if(t){if(typeof t=="string")return vA(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vA(t,e):void 0}}function vme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3767
+ `,l++,s=h}),this.end_=s,this.storage_=i,this.diagnostics_=a}calculateBaseTime_(e,n){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:n:0}isReliablePlaylist_(e,n){return e!=null&&Array.isArray(n)&&n.length}}class ML extends PL{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,n){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,n)}}const xge=86400,pA=[{name:"VOD",run:(t,e,n,r,i)=>n!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(t,e,n,r,i,a)=>{const s=t.getMediaSequenceSync(a);if(!s||!s.isReliable)return null;const l=s.getSyncInfoForTime(i);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,e,n,r,i)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let a=null,s=null;const l=Qy(e);i=i||0;for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=t.timelineToDatetimeMappings[f.timeline];if(!h||!f.dateTimeObject)continue;let v=f.dateTimeObject.getTime()/1e3+h;if(f.parts&&typeof d.partIndex=="number")for(let A=0;A<d.partIndex;A++)v+=f.parts[A].duration;const m=Math.abs(i-v);if(s!==null&&(m===0||s<m))break;s=m,a={time:v,segmentIndex:d.segmentIndex,partIndex:d.partIndex}}return a}},{name:"Segment",run:(t,e,n,r,i)=>{let a=null,s=null;i=i||0;const l=Qy(e);for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=d.part&&d.part.start||f&&f.start;if(f.timeline===r&&typeof h<"u"){const g=Math.abs(i-h);if(s!==null&&s<g)break;(!a||s===null||s>=g)&&(s=g,a={time:h,segmentIndex:d.segmentIndex,partIndex:d.partIndex})}}return a}},{name:"Discontinuity",run:(t,e,n,r,i)=>{let a=null;if(i=i||0,e.discontinuityStarts&&e.discontinuityStarts.length){let s=null;for(let l=0;l<e.discontinuityStarts.length;l++){const c=e.discontinuityStarts[l],u=e.discontinuitySequence+l+1,d=t.discontinuities[u];if(d){const f=Math.abs(i-d.time);if(s!==null&&s<f)break;(!a||s===null||s>=f)&&(s=f,a={time:d.time,segmentIndex:c,partIndex:null})}}}return a}},{name:"Playlist",run:(t,e,n,r,i)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Tge extends Dt.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const n=new PL,r=new ML(n),i=new ML(n);this.mediaSequenceStorage_={main:n,audio:r,vtt:i},this.logger_=Ql("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,n,r,i,a){if(n!==1/0)return pA.find(({name:c})=>c==="VOD").run(this,e,n);const s=this.runStrategies_(e,n,r,i,a);if(!s.length)return null;for(const l of s){const{syncPoint:c,strategy:u}=l,{segmentIndex:d,time:f}=c;if(d<0)continue;const h=e.segments[d],g=f,v=g+h.duration;if(this.logger_(`Strategy: ${u}. Current time: ${i}. selected segment: ${d}. Time: [${g} -> ${v}]}`),i>=g&&i<v)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(s,{key:"time",value:i})}getExpiredTime(e,n){if(!e||!e.segments)return null;const r=this.runStrategies_(e,n,e.discontinuitySequence,0);if(!r.length)return null;const i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+Q2({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(e,n,r,i,a){const s=[];for(let l=0;l<pA.length;l++){const c=pA[l],u=c.run(this,e,n,r,i,a);u&&(u.strategy=c.name,s.push({strategy:c.name,syncPoint:u}))}return s}selectSyncPoint_(e,n){let r=e[0].syncPoint,i=Math.abs(e[0].syncPoint[n.key]-n.value),a=e[0].strategy;for(let s=1;s<e.length;s++){const l=Math.abs(e[s].syncPoint[n.key]-n.value);l<i&&(i=l,r=e[s].syncPoint,a=e[s].strategy)}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${a}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,n){const r=n.mediaSequence-e.mediaSequence;if(r>xge){Dt.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let i=r-1;i>=0;i--){const a=e.segments[i];if(a&&typeof a.start<"u"){n.syncInfo={mediaSequence:e.mediaSequence+i,time:a.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const n=e.segments[0],r=n.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[n.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:n}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,n),i=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:i.start}));const a=i.dateTimeObject;i.discontinuity&&n&&a&&(this.timelineToDatetimeMappings[i.timeline]=-(a.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,n,r){const i=e.segment,a=e.part;let s=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset=="number")s={time:e.startOfSegment,mapping:e.startOfSegment-n.start},r&&(this.timelines[e.timeline]=s,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${s.time}] [mapping: ${s.mapping}]`)),l=e.startOfSegment,c=n.end+s.mapping;else if(s)l=n.start+s.mapping,c=n.end+s.mapping;else return!1;return a&&(a.start=l,a.end=c),(!i.start||l<i.start)&&(i.start=l),i.end=c,!0}saveDiscontinuitySyncInfo_(e){const n=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let i=0;i<n.discontinuityStarts.length;i++){const a=n.discontinuityStarts[i],s=n.discontinuitySequence+i+1,l=a-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>c){let u;l<0?u=r.start-Q2({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex,endIndex:a}):u=r.end+Q2({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex+1,endIndex:a}),this.discontinuities[s]={time:u,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class Ege extends Dt.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:n,to:r}){if(typeof n=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:n,to:r},delete this.pendingTimelineChanges_[e];const i={timelineChangeInfo:{from:n,to:r}};this.trigger({type:"timelinechange",metadata:i})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Ige=sL(oL(function(){var t=function(){function m(){this.listeners={}}var A=m.prototype;return A.on=function(C,S){this.listeners[C]||(this.listeners[C]=[]),this.listeners[C].push(S)},A.off=function(C,S){if(!this.listeners[C])return!1;var T=this.listeners[C].indexOf(S);return this.listeners[C]=this.listeners[C].slice(0),this.listeners[C].splice(T,1),T>-1},A.trigger=function(C){var S=this.listeners[C];if(S)if(arguments.length===2)for(var T=S.length,x=0;x<T;++x)S[x].call(this,arguments[1]);else for(var E=Array.prototype.slice.call(arguments,1),_=S.length,M=0;M<_;++M)S[M].apply(this,E)},A.dispose=function(){this.listeners={}},A.pipe=function(C){this.on("data",function(S){C.push(S)})},m}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(m){return m.subarray(0,m.byteLength-m[m.byteLength-1])}/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */const n=function(){const m=[[[],[],[],[],[]],[[],[],[],[],[]]],A=m[0],w=m[1],C=A[4],S=w[4];let T,x,E;const _=[],M=[];let O,F,P,H,N,$;for(T=0;T<256;T++)M[(_[T]=T<<1^(T>>7)*283)^T]=T;for(x=E=0;!C[x];x^=O||1,E=M[E]||1)for(H=E^E<<1^E<<2^E<<3^E<<4,H=H>>8^H&255^99,C[x]=H,S[H]=x,P=_[F=_[O=_[x]]],$=P*16843009^F*65537^O*257^x*16843008,N=_[H]*257^H*16843008,T=0;T<4;T++)A[T][x]=N=N<<24^N>>>8,w[T][H]=$=$<<24^$>>>8;for(T=0;T<5;T++)A[T]=A[T].slice(0),w[T]=w[T].slice(0);return m};let r=null;class i{constructor(A){r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let w,C,S;const T=this._tables[0][4],x=this._tables[1],E=A.length;let _=1;if(E!==4&&E!==6&&E!==8)throw new Error("Invalid aes key size");const M=A.slice(0),O=[];for(this._key=[M,O],w=E;w<4*E+28;w++)S=M[w-1],(w%E===0||E===8&&w%E===4)&&(S=T[S>>>24]<<24^T[S>>16&255]<<16^T[S>>8&255]<<8^T[S&255],w%E===0&&(S=S<<8^S>>>24^_<<24,_=_<<1^(_>>7)*283)),M[w]=M[w-E]^S;for(C=0;w;C++,w--)S=M[C&3?w:w-4],w<=4||C<4?O[C]=S:O[C]=x[0][T[S>>>24]]^x[1][T[S>>16&255]]^x[2][T[S>>8&255]]^x[3][T[S&255]]}decrypt(A,w,C,S,T,x){const E=this._key[1];let _=A^E[0],M=S^E[1],O=C^E[2],F=w^E[3],P,H,N;const $=E.length/4-2;let U,le=4;const G=this._tables[1],X=G[0],ce=G[1],Y=G[2],ae=G[3],re=G[4];for(U=0;U<$;U++)P=X[_>>>24]^ce[M>>16&255]^Y[O>>8&255]^ae[F&255]^E[le],H=X[M>>>24]^ce[O>>16&255]^Y[F>>8&255]^ae[_&255]^E[le+1],N=X[O>>>24]^ce[F>>16&255]^Y[_>>8&255]^ae[M&255]^E[le+2],F=X[F>>>24]^ce[_>>16&255]^Y[M>>8&255]^ae[O&255]^E[le+3],le+=4,_=P,M=H,O=N;for(U=0;U<4;U++)T[(3&-U)+x]=re[_>>>24]<<24^re[M>>16&255]<<16^re[O>>8&255]<<8^re[F&255]^E[le++],P=_,_=M,M=O,O=F,F=P}}class a extends t{constructor(){super(t),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(A){this.jobs.push(A),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const s=function(m){return m<<24|(m&65280)<<8|(m&16711680)>>8|m>>>24},l=function(m,A,w){const C=new Int32Array(m.buffer,m.byteOffset,m.byteLength>>2),S=new i(Array.prototype.slice.call(A)),T=new Uint8Array(m.byteLength),x=new Int32Array(T.buffer);let E,_,M,O,F,P,H,N,$;for(E=w[0],_=w[1],M=w[2],O=w[3],$=0;$<C.length;$+=4)F=s(C[$]),P=s(C[$+1]),H=s(C[$+2]),N=s(C[$+3]),S.decrypt(F,P,H,N,x,$),x[$]=s(x[$]^E),x[$+1]=s(x[$+1]^_),x[$+2]=s(x[$+2]^M),x[$+3]=s(x[$+3]^O),E=F,_=P,M=H,O=N;return T};class c{constructor(A,w,C,S){const T=c.STEP,x=new Int32Array(A.buffer),E=new Uint8Array(A.byteLength);let _=0;for(this.asyncStream_=new a,this.asyncStream_.push(this.decryptChunk_(x.subarray(_,_+T),w,C,E)),_=T;_<x.length;_+=T)C=new Uint32Array([s(x[_-4]),s(x[_-3]),s(x[_-2]),s(x[_-1])]),this.asyncStream_.push(this.decryptChunk_(x.subarray(_,_+T),w,C,E));this.asyncStream_.push(function(){S(null,e(E))})}static get STEP(){return 32e3}decryptChunk_(A,w,C,S){return function(){const T=l(A,w,C);S.set(T,A.byteOffset)}}}var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d;typeof window<"u"?d=window:typeof u<"u"?d=u:typeof self<"u"?d=self:d={};var f=d,h=function(A){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer},g=f.BigInt||Number;g("0x1"),g("0x100"),g("0x10000"),g("0x1000000"),g("0x100000000"),g("0x10000000000"),g("0x1000000000000"),g("0x100000000000000"),g("0x10000000000000000"),function(){var m=new Uint16Array([65484]),A=new Uint8Array(m.buffer,m.byteOffset,m.byteLength);return A[0]===255?"big":A[0]===204?"little":"unknown"}();const v=function(m){const A={};return Object.keys(m).forEach(w=>{const C=m[w];h(C)?A[w]={bytes:C.buffer,byteOffset:C.byteOffset,byteLength:C.byteLength}:A[w]=C}),A};self.onmessage=function(m){const A=m.data,w=new Uint8Array(A.encrypted.bytes,A.encrypted.byteOffset,A.encrypted.byteLength),C=new Uint32Array(A.key.bytes,A.key.byteOffset,A.key.byteLength/4),S=new Uint32Array(A.iv.bytes,A.iv.byteOffset,A.iv.byteLength/4);new c(w,C,S,function(T,x){self.postMessage(v({source:A.source,decrypted:x}),[x.buffer])})}}));var _ge=aL(Ige);const Dge=t=>{let e=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},LL=(t,e)=>{t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},gA=(t,e)=>{e.activePlaylistLoader=t,t.load()},Nge=(t,e)=>()=>{const{segmentLoaders:{[t]:n,main:r},mediaTypes:{[t]:i}}=e,a=i.activeTrack(),s=i.getActiveGroup(),l=i.activePlaylistLoader,c=i.lastGroup_;if(!(s&&c&&s.id===c.id)&&(i.lastGroup_=s,i.lastTrack_=a,LL(n,i),!(!s||s.isMainPlaylist))){if(!s.playlistLoader){l&&r.resetEverything();return}n.resyncLoader(),gA(s.playlistLoader,i)}},Oge=(t,e)=>()=>{const{segmentLoaders:{[t]:n},mediaTypes:{[t]:r}}=e;r.lastGroup_=null,n.abort(),n.pause()},Fge=(t,e)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[t]:r,main:i},mediaTypes:{[t]:a}}=e,s=a.activeTrack(),l=a.getActiveGroup(),c=a.activePlaylistLoader,u=a.lastTrack_;if(!(u&&s&&u.id===s.id)&&(a.lastGroup_=l,a.lastTrack_=s,LL(r,a),!!l)){if(l.isMainPlaylist){if(!s||!u||s.id===u.id)return;const d=e.vhs.playlistController_,f=d.selectPlaylist();if(d.media()===f)return;a.logger_(`track change. Switching main audio from ${u.id} to ${s.id}`),n.pause(),i.resetEverything(),d.fastQualityChange_(f);return}if(t==="AUDIO"){if(!l.playlistLoader){i.setAudio(!0),i.resetEverything();return}r.setAudio(!0),i.setAudio(!1)}if(c===l.playlistLoader){gA(l.playlistLoader,a);return}r.track&&r.track(s),r.resetEverything(),gA(l.playlistLoader,a)}},yv={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:n},excludePlaylist:r}=e,i=n.activeTrack(),a=n.activeGroup(),s=(a.filter(c=>c.default)[0]||a[0]).id,l=n.tracks[s];if(i===l){r({error:{message:"Problem encountered loading the default audio track."}});return}Dt.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in n.tracks)n.tracks[c].enabled=n.tracks[c]===l;n.onTrackChanged()},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:n}}=e;Dt.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}},BL={AUDIO:(t,e,n)=>{if(!e)return;const{tech:r,requestOptions:i,segmentLoaders:{[t]:a}}=n;e.on("loadedmetadata",()=>{const s=e.media();a.playlist(s,i),(!r.paused()||s.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",yv[t](t,n))},SUBTITLES:(t,e,n)=>{const{tech:r,requestOptions:i,segmentLoaders:{[t]:a},mediaTypes:{[t]:s}}=n;e.on("loadedmetadata",()=>{const l=e.media();a.playlist(l,i),a.track(s.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",yv[t](t,n))}},kge={AUDIO:(t,e)=>{const{vhs:n,sourceType:r,segmentLoaders:{[t]:i},requestOptions:a,main:{mediaGroups:s},mediaTypes:{[t]:{groups:l,tracks:c,logger_:u}},mainPlaylistLoader:d}=e,f=J2(d.main);(!s[t]||Object.keys(s[t]).length===0)&&(s[t]={main:{default:{default:!0}}},f&&(s[t].main.default.playlists=d.main.playlists));for(const h in s[t]){l[h]||(l[h]=[]);for(const g in s[t][h]){let v=s[t][h][g],m;if(f?(u(`AUDIO group '${h}' label '${g}' is a main playlist`),v.isMainPlaylist=!0,m=null):r==="vhs-json"&&v.playlists?m=new ch(v.playlists[0],n,a):v.resolvedUri?m=new ch(v.resolvedUri,n,a):v.playlists&&r==="dash"?m=new sA(v.playlists[0],n,a,d):m=null,v=Ji({id:g,playlistLoader:m},v),BL[t](t,v.playlistLoader,e),l[h].push(v),typeof c[g]>"u"){const A=new Dt.AudioTrack({id:g,kind:Dge(v),enabled:!1,language:v.language,default:v.default,label:g});c[g]=A}}}i.on("error",yv[t](t,e))},SUBTITLES:(t,e)=>{const{tech:n,vhs:r,sourceType:i,segmentLoaders:{[t]:a},requestOptions:s,main:{mediaGroups:l},mediaTypes:{[t]:{groups:c,tracks:u}},mainPlaylistLoader:d}=e;for(const f in l[t]){c[f]||(c[f]=[]);for(const h in l[t][f]){if(!r.options_.useForcedSubtitles&&l[t][f][h].forced)continue;let g=l[t][f][h],v;if(i==="hls")v=new ch(g.resolvedUri,r,s);else if(i==="dash"){if(!g.playlists.filter(A=>A.excludeUntil!==1/0).length)return;v=new sA(g.playlists[0],r,s,d)}else i==="vhs-json"&&(v=new ch(g.playlists?g.playlists[0]:g.resolvedUri,r,s));if(g=Ji({id:h,playlistLoader:v},g),BL[t](t,g.playlistLoader,e),c[f].push(g),typeof u[h]>"u"){const m=n.addRemoteTextTrack({id:h,kind:"subtitles",default:g.default&&g.autoselect,language:g.language,label:h},!1).track;u[h]=m}}}a.on("error",yv[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[t]:{groups:i,tracks:a}}}=e;for(const s in r[t]){i[s]||(i[s]=[]);for(const l in r[t][s]){const c=r[t][s][l];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const u=n.options_.vhs&&n.options_.vhs.captionServices||{};let d={label:l,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(u[d.instreamId]&&(d=Ji(d,u[d.instreamId])),d.default===void 0&&delete d.default,i[s].push(Ji({id:l},c)),typeof a[l]>"u"){const f=n.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;a[l]=f}}}}},VL=(t,e)=>{for(let n=0;n<t.length;n++)if(eA(e,t[n])||t[n].playlists&&VL(t[n].playlists,e))return!0;return!1},Pge=(t,e)=>n=>{const{mainPlaylistLoader:r,mediaTypes:{[t]:{groups:i}}}=e,a=r.media();if(!a)return null;let s=null;a.attributes[t]&&(s=i[a.attributes[t]]);const l=Object.keys(i);if(!s)if(t==="AUDIO"&&l.length>1&&J2(e.main))for(let c=0;c<l.length;c++){const u=i[l[c]];if(VL(u,a)){s=u;break}}else i.main?s=i.main:l.length===1&&(s=i[l[0]]);return typeof n>"u"?s:n===null||!s?null:s.filter(c=>c.id===n.id)[0]||null},Mge={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].enabled)return n[r];return null},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].mode==="showing"||n[r].mode==="hidden")return n[r];return null}},Lge=(t,{mediaTypes:e})=>()=>{const n=e[t].activeTrack();return n?e[t].activeGroup(n):null},Bge=t=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{kge[u](u,t)});const{mediaTypes:e,mainPlaylistLoader:n,tech:r,vhs:i,segmentLoaders:{["AUDIO"]:a,main:s}}=t;["AUDIO","SUBTITLES"].forEach(u=>{e[u].activeGroup=Pge(u,t),e[u].activeTrack=Mge[u](u,t),e[u].onGroupChanged=Nge(u,t),e[u].onGroupChanging=Oge(u,t),e[u].onTrackChanged=Fge(u,t),e[u].getActiveGroup=Lge(u,t)});const l=e.AUDIO.activeGroup();if(l){const u=(l.filter(f=>f.default)[0]||l[0]).id;e.AUDIO.tracks[u].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(s.setAudio(!1),a.setAudio(!0)):s.setAudio(!0)}n.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanged())}),n.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",c),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),i.on("dispose",()=>{r.audioTracks().removeEventListener("change",c),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const u in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[u])},Vge=()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:bd,activeTrack:bd,getActiveGroup:bd,onGroupChanged:bd,onTrackChanged:bd,lastTrack_:null,logger_:Ql(`MediaGroups[${e}]`)}}),t};class qL{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=rl(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(n=>[n.ID,n])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class qge extends Dt.EventTarget{constructor(e,n){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new qL,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Ql("Content Steering"),this.xhr_=e,this.getBandwidth_=n}assignTagProperties(e,n){this.manifestType_=n.serverUri?"HLS":"DASH";const r=n.serverUri||n.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=rl(e,r),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const n=this.steeringManifest.reloadUri;if(!n)return;const r=e?n:this.getRequestURI(n);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const i={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:i}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(a,s)=>{if(a){if(s.status===410){this.logger_(`manifest request 410 ${a}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(s.status===429){const u=s.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${a}.`),this.logger_(`content steering will retry in ${u} seconds.`),this.startTTLTimeout_(parseInt(u,10));return}this.logger_(`manifest failed to load ${a}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:i});let l;try{l=JSON.parse(this.request_.responseText)}catch(u){const d={errorType:Dt.Error.StreamingContentSteeringParserError,error:u};this.trigger({type:"error",metadata:d})}this.assignSteeringProperties_(l);const c={contentSteeringInfo:i.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const n=new Re.URL(e),r=new Re.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const n=JSON.parse(Re.atob(e));this.assignSteeringProperties_(n)}setSteeringParams_(e){const n=new Re.URL(e),r=this.getPathway(),i=this.getBandwidth_();if(r){const a=`_${this.manifestType_}_pathway`;n.searchParams.set(a,r)}if(i){const a=`_${this.manifestType_}_throughput`;n.searchParams.set(a,i)}return n.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(i=>{for(const a of i)if(this.availablePathways_.has(a))return a;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const n=i=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!n(i))return i}const r=this.setSteeringParams_(e);return n(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const n=e*1e3;this.ttlTimeout_=Re.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){Re.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new qL}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,n){return!n&&this.steeringManifest.reloadUri||n&&(rl(e,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const Uge=10;let yd;const $ge=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],jge=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},zge=function({currentPlaylist:t,buffered:e,currentTime:n,nextPlaylist:r,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:s,bufferBasedABR:l,log:c}){if(!r)return Dt.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${t&&t.id||"null"} -> ${r.id}`;if(!t)return c(`${u} as current playlist is not set`),!0;if(r.id===t.id)return!1;const d=!!sh(e,n).length;if(!t.endList)return!d&&typeof t.partTargetDuration=="number"?(c(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${u} as current playlist is live`),!0);const f=Ry(e,n),h=l?Ls.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ls.MAX_BUFFER_LOW_WATER_LINE;if(s<h)return c(`${u} as duration < max low water line (${s} < ${h})`),!0;const g=r.attributes.BANDWIDTH,v=t.attributes.BANDWIDTH;if(g<v&&(!l||f<a)){let m=`${u} as next bandwidth < current bandwidth (${g} < ${v})`;return l&&(m+=` and forwardBuffer < bufferHighWaterLine (${f} < ${a})`),c(m),!0}if((!l||g>v)&&f>=i){let m=`${u} as forwardBuffer >= bufferLowWaterLine (${f} >= ${i})`;return l&&(m+=` and next bandwidth > current bandwidth (${g} > ${v})`),c(m),!0}return c(`not ${u} as no switching criteria met`),!1};class Hge extends Dt.EventTarget{constructor(e){super();const{src:n,withCredentials:r,tech:i,bandwidth:a,externVhs:s,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:f,bufferBasedABR:h,leastPixelDiffSelector:g,captionServices:v}=e;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:m}=e;(m===null||typeof m>"u")&&(m=1/0),yd=s,this.bufferBasedABR=!!h,this.leastPixelDiffSelector=!!g,this.withCredentials=r,this.tech_=i,this.vhs_=i.vhs,this.player_=e.player_,this.sourceType_=d,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Vge(),this.mediaSource=new Re.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Ks(),this.hasPlayed_=!1,this.syncController_=new Tge(e),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new _ge,this.sourceUpdater_=new NL(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Ege,this.keyStatusMap_=new Map;const A={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:v,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:a,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new sA(n,this.vhs_,Ji(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ch(n,this.vhs_,Ji(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new fA(Ji(A,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new fA(Ji(A,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Age(Ji(A,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((S,T)=>{function x(){i.off("vttjserror",E),S()}function E(){i.off("vttjsloaded",x),T()}i.one("vttjsloaded",x),i.one("vttjserror",E),i.addWebVttScript_()})}),e);const w=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new qge(this.vhs_.xhr,w),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),$ge.forEach(S=>{this[S+"_"]=jge.bind(this,S)}),this.logger_=Ql("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const C=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(C,()=>{const S=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-S,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();return e===-1||n===-1?-1:e+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,e)}switchMedia_(e,n,r){const i=this.media(),a=i&&(i.id||i.uri),s=e&&(e.id||e.uri);if(a&&a!==s){this.logger_(`switch media ${a} -> ${s} from ${n}`);const l={renditionInfo:{id:s,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:n};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const n=this.mediaTypes_[e],r=n?n.activeGroup():null,i=this.contentSteeringController_.getPathway();if(r&&i){const s=(r.length?r[0].playlists:r.playlists).filter(l=>l.attributes.serviceLocation===i);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=Re.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(Re.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),n=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return n;const r=e.mediaGroups.AUDIO,i=Object.keys(r);let a;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)a=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||i.length&&r[i[0]];for(const c in l)if(l[c].default){a={label:c};break}}if(!a)return n;const s=[];for(const l in r)if(r[l][a.label]){const c=r[l][a.label];if(c.playlists&&c.playlists.length)s.push.apply(s,c.playlists);else if(c.uri)s.push(c);else if(e.playlists.length)for(let u=0;u<e.playlists.length;u++){const d=e.playlists[u];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===l&&s.push(d)}}return s.length?s:n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;Zy(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,n.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.mainSegmentLoader_.load()),Bge({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),n),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let n=this.mainPlaylistLoader_.media();if(!n){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;n=this.initialMedia_}this.handleUpdatedMediaPlaylist(n)}),this.mainPlaylistLoader_.on("error",()=>{const n=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;Zy(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const n=this.mainPlaylistLoader_.media();if(n.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(n)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(n=>{this.mainPlaylistLoader_.on(n,r=>{this.player_.trigger(ka({},r))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,n){const r=e.mediaGroups||{};let i=!0;const a=Object.keys(r.AUDIO);for(const s in r.AUDIO)for(const l in r.AUDIO[s])r.AUDIO[s][l].uri||(i=!1);i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),yd.Playlist.isAes(n)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),a.length&&Object.keys(r.AUDIO[a[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),i=this.bufferLowWaterLine(),a=this.bufferHighWaterLine(),s=this.tech_.buffered();return zge({buffered:s,currentTime:r,currentPlaylist:n,nextPlaylist:e,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.sourceType_==="dash"&&this.timelineChangeController_.on("audioTimelineBehind",()=>{const r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const i=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(i)}),this.mainSegmentLoader_.on("earlyabort",r=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:Uge}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(r=>{this.mainSegmentLoader_.on(r,i=>{this.player_.trigger(ka({},i))}),this.audioSegmentLoader_.on(r,i=>{this.player_.trigger(ka({},i))}),this.subtitleSegmentLoader_.on(r,i=>{this.player_.trigger(ka({},i))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.mainSegmentLoader_.load()})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const n=this.seekable();if(!n.length)return!1;const r=n.end(0);let i=r;if(e.start){const a=e.start.timeOffset;a<0?i=Math.max(r+a,n.start(0)):i=Math.min(r,a)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,n=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const n=this.duration();e[e.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const n=this.mainSegmentLoader_.getCurrentMediaInfo_();!n||n.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const i=yd.Playlist.playlistEnd(e,r),a=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-a<=Cu;const l=s.end(s.length-1);return l-a<=Cu&&i-l<=Cu}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||n.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=n,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const i=this.mainPlaylistLoader_.main.playlists,a=i.filter(hv),s=a.length===1&&a[0]===e;if(i.length===1&&r!==1/0)return Dt.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(s);if(s){if(this.main().contentSteering){const v=this.pathwayAttribute_(e),m=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(v),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(v)},m);return}let g=!1;i.forEach(v=>{if(v===e)return;const m=v.excludeUntil;typeof m<"u"&&m!==1/0&&(g=!0,delete v.excludeUntil)}),g&&(Dt.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,n.reason&&(e.lastExcludeReason_=n.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=n.internal?this.logger_:Dt.log.warn,d=n.message?" "+n.message:"";u(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${d} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const f=c.targetDuration/2*1e3||5*1e3,h=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=f;return this.switchMedia_(c,"exclude",s||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,n){const r=[],i=e==="all";(i||e==="main")&&r.push(this.mainPlaylistLoader_);const a=[];(i||e==="audio")&&a.push("AUDIO"),(i||e==="subtitle")&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(s=>{const l=this.mediaTypes_[s]&&this.mediaTypes_[s].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(s=>{const l=this[`${s}SegmentLoader_`];l&&(e===s||e==="all")&&r.push(l)}),r.forEach(s=>n.forEach(l=>{typeof s[l]=="function"&&s[l]()}))}setCurrentTime(e){const n=sh(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:yd.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let n=this.mainPlaylistLoader_.media();if(!n)return;let r=this.syncController_.getExpiredTime(n,this.duration());if(r===null)return;const i=this.mainPlaylistLoader_.main,a=yd.Playlist.seekable(n,r,yd.Playlist.liveEdgeDelay(i,n));if(a.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),r=this.syncController_.getExpiredTime(n,this.duration()),r===null||(e=yd.Playlist.seekable(n,r,yd.Playlist.liveEdgeDelay(i,n)),e.length===0)))return;let s,l;if(this.seekable_&&this.seekable_.length&&(s=this.seekable_.end(0),l=this.seekable_.start(0)),e?e.start(0)>a.end(0)||a.start(0)>e.end(0)?this.seekable_=a:this.seekable_=Ks([[e.start(0)>a.start(0)?e.start(0):a.start(0),e.end(0)<a.end(0)?e.end(0):a.end(0)]]):this.seekable_=a,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===s&&this.seekable_.start(0)===l)return;this.logger_(`seekable updated [${NM(this.seekable_)}]`);const c={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:c}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const i=this.seekable();if(!i.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))&&this.sourceUpdater_.setDuration(i.end(i.length-1));return}const n=this.tech_.buffered();let r=yd.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const n=this.mediaTypes_[e].groups;for(const r in n)n[r].forEach(i=>{i.playlistLoader&&i.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!n||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=eg(this.main(),n),i={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(i.video=r.video||e.main.videoCodec||f1e),e.main.isMuxed&&(i.video+=`,${r.audio||e.main.audioCodec||wF}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||a)&&(i.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||wF,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const s=(u,d)=>u?g4(d):Eb(d),l={};let c;if(["video","audio"].forEach(function(u){if(i.hasOwnProperty(u)&&!s(e[u].isFmp4,i[u])){const d=e[u].isFmp4?"browser":"muxer";l[d]=l[d]||[],l[d].push(i[u]),u==="audio"&&(c=d)}}),a&&c&&n.attributes.AUDIO){const u=n.attributes.AUDIO;this.main().playlists.forEach(d=>{(d.attributes&&d.attributes.AUDIO)===u&&d!==n&&(d.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${c} does not support codec(s): "${i.audio}"`)}if(Object.keys(l).length){const u=Object.keys(l).reduce((d,f)=>(d&&(d+=", "),d+=`${f} does not support codec(s): "${l[f].join(",")}"`,d),"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(d=>{const f=(hu(this.sourceUpdater_.codecs[d]||"")[0]||{}).type,h=(hu(i[d]||"")[0]||{}).type;f&&h&&f.toLowerCase()!==h.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[d]}" -> "${i[d]}"`)}),u.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const n=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){const e=this.main().playlists,n=[];Object.keys(e).forEach(r=>{const i=e[r];if(n.indexOf(i.id)!==-1)return;n.push(i.id);const a=eg(this.main,i),s=[];a.audio&&!Eb(a.audio)&&!g4(a.audio)&&s.push(`audio codec ${a.audio}`),a.video&&!Eb(a.video)&&!g4(a.video)&&s.push(`video codec ${a.video}`),a.text&&a.text==="stpp.ttml.im1t"&&s.push(`text codec ${a.text}`),s.length&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${s.join(", ")}`))})}excludeIncompatibleVariants_(e){const n=[],r=this.main().playlists,i=gv(hu(e)),a=bL(i),s=i.video&&hu(i.video)[0]||null,l=i.audio&&hu(i.audio)[0]||null;Object.keys(r).forEach(c=>{const u=r[c];if(n.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;n.push(u.id);const d=[],f=eg(this.mainPlaylistLoader_.main,u),h=bL(f);if(!(!f.audio&&!f.video)){if(h!==a&&d.push(`codec count "${h}" !== "${a}"`),!this.sourceUpdater_.canChangeType()){const g=f.video&&hu(f.video)[0]||null,v=f.audio&&hu(f.audio)[0]||null;g&&s&&g.type.toLowerCase()!==s.type.toLowerCase()&&d.push(`video codec "${g.type}" !== "${s.type}"`),v&&l&&v.type.toLowerCase()!==l.type.toLowerCase()&&d.push(`audio codec "${v.type}" !== "${l.type}"`)}d.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${d.join(" && ")}`))}})}updateAdCues_(e){let n=0;const r=this.seekable();r.length&&(n=r.start(0)),Sge(e,this.cueTagsTrack_,n)}goalBufferLength(){const e=this.tech_.currentTime(),n=Ls.GOAL_BUFFER_LENGTH,r=Ls.GOAL_BUFFER_LENGTH_RATE,i=Math.max(n,Ls.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+e*r,i)}bufferLowWaterLine(){const e=this.tech_.currentTime(),n=Ls.BUFFER_LOW_WATER_LINE,r=Ls.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(n,Ls.MAX_BUFFER_LOW_WATER_LINE),a=Math.max(n,Ls.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+e*r,this.bufferBasedABR?a:i)}bufferHighWaterLine(){return Ls.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){CL(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ege({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,n,r){const i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();CL(this.inbandTextTracks_,e,this.tech_),Q2e({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:i,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const n of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(n=>{this.contentSteeringController_.on(n,r=>{this.trigger(ka({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const n=this.main();(this.contentSteeringController_.didDASHTagChange(n.uri,n.contentSteering)||(()=>{const a=this.contentSteeringController_.getAvailablePathways(),s=[];for(const l of n.playlists){const c=l.attributes.serviceLocation;if(c&&(s.push(c),!a.has(c)))return!0}return!!(!s.length&&a.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,i=new Set;let a=!1;Object.keys(r).forEach(s=>{const l=r[s],c=this.pathwayAttribute_(l),u=c&&e!==c;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!u&&(delete l.excludeUntil,delete l.lastExcludeReason_,a=!0);const f=!l.excludeUntil&&l.excludeUntil!==1/0;!i.has(l.id)&&u&&f&&(i.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const l=this.mediaTypes_[s];if(l.activePlaylistLoader){const c=l.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(a=!0)}}),a&&this.changeSegmentPathway_()}handlePathwayClones_(){const n=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||i&&i.size){for(const[s,l]of r.entries())i.get(s)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(s));for(const[s,l]of i.entries()){const c=r.get(s);if(!c){n.filter(d=>d.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(d=>{this.mainPlaylistLoader_.addClonePathway(l,d)}),this.contentSteeringController_.addAvailablePathway(s);continue}this.equalPathwayClones_(c,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(s))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,n){if(e["BASE-ID"]!==n["BASE-ID"]||e.ID!==n.ID||e["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,i=n["URI-REPLACEMENT"].PARAMS;for(const a in r)if(r[a]!==i[a])return!1;for(const a in i)if(r[a]!==i[a])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=this.mainPlaylistLoader_.getKeyIdSet(r);!i||!i.size||i.forEach(a=>{const s="usable",l=this.keyStatusMap_.has(a)&&this.keyStatusMap_.get(a)===s,c=r.lastExcludeReason_===n&&r.excludeUntil===1/0;l?l&&c&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${a} is ${s}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==n&&(r.excludeUntil=1/0,r.lastExcludeReason_=n,this.logger_(`excluding playlist ${r.id} because the key ID ${a} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,a=r.excludeUntil===1/0&&r.lastExcludeReason_===n;i&&a&&(delete r.excludeUntil,Dt.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${n} key IDs`))})}addKeyStatus_(e,n){const a=(typeof e=="string"?e:bge(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${a} added to the keyStatusMap`),this.keyStatusMap_.set(a,n)}updatePlaylistByKeyStatus(e,n){this.addKeyStatus_(e,n),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const Yge=(t,e,n)=>r=>{const i=t.main.playlists[e],a=Jy(i),s=hv(i);if(typeof r>"u")return s;r?delete i.disabled:i.disabled=!0;const l={renditionInfo:{id:e,bandwidth:i.attributes.BANDWIDTH,resolution:i.attributes.RESOLUTION,codecs:i.attributes.CODECS},cause:"fast-quality"};return r!==s&&!a&&(n(i),r?t.trigger({type:"renditionenabled",metadata:l}):t.trigger({type:"renditiondisabled",metadata:l})),r};class Kge{constructor(e,n,r){const{playlistController_:i}=e,a=i.fastQualityChange_.bind(i);if(n.attributes){const s=n.attributes.RESOLUTION;this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=eg(i.main(),n),this.playlist=n,this.id=r,this.enabled=Yge(e.playlists,n.id,a)}}const Xge=function(t){t.representations=()=>{const e=t.playlistController_.main(),n=J2(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;return n?n.filter(r=>!Jy(r)).map((r,i)=>new Kge(t,r,r.id)):[]}},UL=["seeking","seeked","pause","playing","error"];class Gge extends Dt.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Ql("PlaybackWatcher"),this.logger_("initialize");const n=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),a=()=>this.resetTimeUpdate_(),s=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach(d=>{c[d]={reset:()=>this.resetSegmentDownloads_(d),updateend:()=>this.checkSegmentDownloads_(d)},s[`${d}SegmentLoader_`].on("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].on("playlistupdate",c[d].reset),this.tech_.on(["seeked","seeking"],c[d].reset)});const u=d=>{["main","audio"].forEach(f=>{s[`${f}SegmentLoader_`][d]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(UL,a),this.tech_.on("canplay",r),this.tech_.one("play",n),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(UL,a),this.tech_.off("canplay",r),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(d=>{s[`${d}SegmentLoader_`].off("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].off("playlistupdate",c[d].reset),this.tech_.off(["seeked","seeking"],c[d].reset)}),this.checkCurrentTimeTimeout_&&Re.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&Re.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=Re.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const n=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=n.buffered_()}checkSegmentDownloads_(e){const n=this.playlistController_,r=n[`${e}SegmentLoader_`],i=r.buffered_(),a=Bpe(this[`${e}Buffered_`],i);if(this[`${e}Buffered_`]=i,a){const s={bufferedRanges:i};n.trigger({type:"bufferedrangeschanged",metadata:s}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:g1(i)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&n.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===e&&(!n.length||e+Cu>=n.end(n.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Ks([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const n=this.seekable(),r=this.tech_.currentTime(),i=this.afterSeekableWindow_(n,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let a;if(i&&(a=n.end(n.length-1)),this.beforeSeekableWindow_(n,r)){const v=n.start(0);a=v+(v===n.end(0)?0:Cu)}if(typeof a<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${NM(n)}. Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0;const s=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,d=this.media(),f=d.partTargetDuration?d.partTargetDuration:(d.targetDuration-Su)*2,h=[c,u];for(let v=0;v<h.length;v++){if(!h[v])continue;if(Ry(h[v],r)<f)return!1}const g=fv(l,r);return g.length===0?!1:(a=g.start(0)+Cu,this.logger_(`Buffered region starts (${g.start(0)}) just beyond seek point (${r}). Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),n=this.tech_.buffered(),r=sh(n,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,n)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=fv(i,n);return s.length>0?(this.logger_(`Stopped at ${n} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0):!1}afterSeekableWindow_(e,n,r,i=!1){if(!e.length)return!1;let a=e.end(e.length-1)+Cu;const s=!r.endList,l=typeof r.partTargetDuration=="number";return s&&(l||i)&&(a=e.end(e.length-1)+r.targetDuration*3),n>a}beforeSeekableWindow_(e,n){return!!(e.length&&e.start(0)>0&&n<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:n,currentTime:r}){if(!e)return;let i;if(e.length&&n.length){const a=sh(e,r-3),s=sh(e,r),l=sh(n,r);l.length&&!s.length&&a.length&&(i={start:a.end(0),end:l.end(0)})}else fv(e,r).length||(i=this.gapFromVideoUnderflow_(e,r));return i?(this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const n=this.tech_.buffered(),r=this.tech_.currentTime(),i=fv(n,r);if(this.resetTimeUpdate_(),i.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+Su);const a={gapInfo:{from:r,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:a}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,n){const r=Ppe(e);for(let i=0;i<r.length;i++){const a=r.start(i),s=r.end(i);if(n-a<4&&n-a>2)return{start:a,end:s}}return null}}const Rge={errorInterval:30,getSource(t){const n=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(n)}},$L=function(t,e){let n=0,r=0;const i=Ji(Rge,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const a=function(){r&&t.currentTime(r)},s=function(d){d!=null&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(d),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())},l=function(){if(Date.now()-n<i.errorInterval*1e3){t.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!i.getSource||typeof i.getSource!="function"){Dt.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return n=Date.now(),i.getSource.call(t,s)},c=function(){t.off("loadedmetadata",a),t.off("error",l),t.off("dispose",c)},u=function(d){c(),$L(t,d)};t.on("error",l),t.on("dispose",c),t.reloadSourceOnError=u},Wge=function(t){$L(this,t)};var jL="3.13.3",Qge="7.0.3",Jge="1.3.0",Zge="7.1.0",eme="4.0.1";const Wa={PlaylistLoader:ch,Playlist:il,utils:a2e,STANDARD_PLAYLIST_SELECTOR:wL,INITIAL_PLAYLIST_SELECTOR:K2e,lastBandwidthSelector:wL,movingAverageBandwidthSelector:H2e,comparePlaylistBandwidth:uA,comparePlaylistResolution:z2e,xhr:WM()};Object.keys(Ls).forEach(t=>{Object.defineProperty(Wa,t,{get(){return Dt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),Ls[t]},set(e){if(Dt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Dt.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}Ls[t]=e}})});const zL="videojs-vhs",HL=function(t,e){const n=e.media();let r=-1;for(let i=0;i<t.length;i++)if(t[i].id===n.id){r=i;break}t.selectedIndex_=r,t.trigger({selectedIndex:r,type:"change"})},tme=function(t,e){e.representations().forEach(n=>{t.addQualityLevel(n)}),HL(t,e.playlists)};Wa.canPlaySource=function(){return Dt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const nme=(t,e,n)=>{if(!t)return t;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=gv(hu(e.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const i=x2(r.video),a=x2(r.audio),s={};for(const l in t)s[l]={},a&&(s[l].audioContentType=a),i&&(s[l].videoContentType=i),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(s[l].pssh=e.contentProtection[l].pssh),typeof t[l]=="string"&&(s[l].url=t[l]);return Ji(t,s)},rme=(t,e)=>t.reduce((n,r)=>{if(!r.contentProtection)return n;const i=e.reduce((a,s)=>{const l=r.contentProtection[s];return l&&l.pssh&&(a[s]={pssh:l.pssh}),a},{});return Object.keys(i).length&&n.push(i),n},[]),ime=({player:t,sourceKeySystems:e,audioMedia:n,mainPlaylists:r})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();const i=n?r.concat([n]):r,a=rme(i,Object.keys(e)),s=[],l=[];return a.forEach(c=>{l.push(new Promise((u,d)=>{t.tech_.one("keysessioncreated",u)})),s.push(new Promise((u,d)=>{t.eme.initializeMediaKeys({keySystems:c},f=>{if(f){d(f);return}u()})}))}),Promise.race([Promise.all(s),Promise.race(l)])},ame=({player:t,sourceKeySystems:e,media:n,audioMedia:r})=>{const i=nme(e,n,r);return i?(t.currentSource().keySystems=i,i&&!t.eme?(Dt.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},YL=()=>{if(!Re.localStorage)return null;const t=Re.localStorage.getItem(zL);if(!t)return null;try{return JSON.parse(t)}catch{return null}},sme=t=>{if(!Re.localStorage)return!1;let e=YL();e=e?Ji(e,t):t;try{Re.localStorage.setItem(zL,JSON.stringify(e))}catch{return!1}return e},ome=t=>t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(t.substring(t.indexOf(",")+1)):t,KL=(t,e)=>{t._requestCallbackSet||(t._requestCallbackSet=new Set),t._requestCallbackSet.add(e)},XL=(t,e)=>{t._responseCallbackSet||(t._responseCallbackSet=new Set),t._responseCallbackSet.add(e)},GL=(t,e)=>{t._requestCallbackSet&&(t._requestCallbackSet.delete(e),t._requestCallbackSet.size||delete t._requestCallbackSet)},RL=(t,e)=>{t._responseCallbackSet&&(t._responseCallbackSet.delete(e),t._responseCallbackSet.size||delete t._responseCallbackSet)};Wa.supportsNativeHls=function(){if(!xn||!xn.createElement)return!1;const t=xn.createElement("video");return Dt.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(t.canPlayType(n))}):!1}(),Wa.supportsNativeDash=function(){return!xn||!xn.createElement||!Dt.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(xn.createElement("video").canPlayType("application/dash+xml"))}(),Wa.supportsTypeNatively=t=>t==="hls"?Wa.supportsNativeHls:t==="dash"?Wa.supportsNativeDash:!1,Wa.isSupported=function(){return Dt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Wa.xhr.onRequest=function(t){KL(Wa.xhr,t)},Wa.xhr.onResponse=function(t){XL(Wa.xhr,t)},Wa.xhr.offRequest=function(t){GL(Wa.xhr,t)},Wa.xhr.offResponse=function(t){RL(Wa.xhr,t)};const lme=Dt.getComponent("Component");class WL extends lme{constructor(e,n,r){if(super(n,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Ql("VhsHandler"),n.options_&&n.options_.playerId){const i=Dt.getPlayer(n.options_.playerId);this.player_=i}if(this.tech_=n,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(xn,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],i=>{const a=xn.fullscreenElement||xn.webkitFullscreenElement||xn.mozFullScreenElement||xn.msFullscreenElement;a&&a.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Ji(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=YL();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ls.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ls.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const n=this.options_.customPixelRatio;typeof n=="number"&&n>=0&&(this.customPixelRatio=n)}setOptions(e={}){this.setOptions_(e)}src(e,n){if(!e)return;this.setOptions_(),this.options_.src=ome(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Wa,this.options_.sourceType=SF(n),this.options_.seekTo=a=>{this.tech_.setCurrentTime(a)},this.options_.player_=this.player_,this.playlistController_=new Hge(this.options_);const r=Ji({liveRangeSafeTimeDelta:Cu},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Gge(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const a=Dt.players[this.tech_.options_.playerId];let s=this.playlistController_.error;typeof s=="object"&&!s.code?s.code=3:typeof s=="string"&&(s={message:s,code:3}),a.error(s)});const i=this.options_.bufferBasedABR?Wa.movingAverageBandwidthSelector(.55):Wa.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=Wa.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(a){this.playlistController_.selectPlaylist=a.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(a){this.playlistController_.mainSegmentLoader_.throughput.rate=a,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let a=this.playlistController_.mainSegmentLoader_.bandwidth;const s=Re.navigator.connection||Re.navigator.mozConnection||Re.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&s){const c=s.downlink*1e3*1e3;c>=l&&a>=l?a=Math.max(a,c):a=c}return a},set(a){this.playlistController_.mainSegmentLoader_.bandwidth=a,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const a=1/(this.bandwidth||1);let s;return this.throughput>0?s=1/this.throughput:s=0,Math.floor(1/(a+s))},set(){Dt.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>g1(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>g1(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&sme({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Xge(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=Re.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),ime({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(n=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=ame({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Dt.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{tme(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{HL(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":jL,"mux.js":Qge,"mpd-parser":Jge,"m3u8-parser":Zge,"aes-decrypter":eme}}version(){return this.constructor.version()}canChangeType(){return NL.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&Re.URL.revokeObjectURL&&(Re.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,n){return f2e({playlist:this.playlistController_.media(),time:e,callback:n})}seekToProgramTime(e,n,r=!0,i=2){return tL({programTime:e,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=e=>{KL(this.xhr,e)},this.xhr.onResponse=e=>{XL(this.xhr,e)},this.xhr.offRequest=e=>{GL(this.xhr,e)},this.xhr.offResponse=e=>{RL(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],n=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,i=>{this.player_.trigger(ka({},i))})}),n.forEach(r=>{this.playbackWatcher_.on(r,i=>{this.player_.trigger(ka({},i))})})}}const Av={name:"videojs-http-streaming",VERSION:jL,canHandleSource(t,e={}){const n=Ji(Dt.options,e);return Av.canPlayType(t.type,n)},handleSource(t,e,n={}){const r=Ji(Dt.options,n);return e.vhs=new WL(t,e,r),e.vhs.xhr=WM(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){const n=SF(t);if(!n)return"";const r=Av.getOverrideNative(e);return!Wa.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative(t={}){const{vhs:e={}}=t,n=!(Dt.browser.IS_ANY_SAFARI||Dt.browser.IS_IOS),{overrideNative:r=n}=e;return r}};g4("avc1.4d400d,mp4a.40.2")&&Dt.getTech("Html5").registerSourceHandler(Av,0),Dt.VhsHandler=WL,Dt.VhsSourceHandler=Av,Dt.Vhs=Wa,Dt.use||Dt.registerComponent("Vhs",Wa),Dt.options.vhs=Dt.options.vhs||{},(!Dt.getPlugin||!Dt.getPlugin("reloadSourceOnError"))&&Dt.registerPlugin("reloadSourceOnError",Wge);const QL=t=>{const{userTrainingSaveData:e,updateUserTraining:n}=mr(),r=k.useRef(null),i=k.useRef(null),{options:a,onReady:s,currentItem:l}=t,[c,u]=k.useState(!1),d=g=>{if(e!==null){const v=e==null?void 0:e.findIndex(m=>(m==null?void 0:m.fieldId)===(l==null?void 0:l.uuid));if(v>=0){const m=g.target;e[v].seenTime=m.currentTime}}},f=g=>{const v=[...e],m=v==null?void 0:v.findIndex(A=>(A==null?void 0:A.fieldId)===(g==null?void 0:g.uuid));m>=0&&(v[m]={...e[m],isSeen:!0},n(v),h("Ended"))};k.useEffect(()=>{if(i.current){const g=i.current;g.autoplay(a.autoplay),g.src(a.sources)}else{const g=r.current;if(!g)return;const v=i.current=Dt(g,a,()=>{Dt.log("player is ready"),s&&s(v)})}},[a,r]);const h=g=>{const v=i.current,m=e!==null?e.findIndex(A=>(A==null?void 0:A.fieldId)===(l==null?void 0:l.uuid)):-1;m>=0&&e[m].logs.push({action:g,videoTime:e[m].seenTime,totalTime:v.duration(),timeState:new Date}),n(e)};return k.useEffect(()=>{if(!c&&e!==null){const g=e.findIndex(v=>(v==null?void 0:v.fieldId)===(l==null?void 0:l.uuid));g>=0&&(u(!0),i.current.currentTime(e[g].seenTime))}},[e]),k.useEffect(()=>{const g=i.current;return()=>{g&&(g.dispose(),i.current=null)}},[i]),o.jsx("div",{"data-vjs-player":!0,children:o.jsx("video",{onPause:()=>{h("Pause")},onPlay:()=>{h("Play")},onEnded:()=>{f(l)},onTimeUpdate:d,ref:r,className:"video-js vjs-big-play-centered"})})},cme=t=>{var S,T,x,E,_;const{field:e}=t,n=k.useRef(null),{userSelectedLanguage:r}=sn(),{isBuilderMode:i,media:a}=Ht(),s=(S=a==null?void 0:a.video)!=null&&S.MediaVideo?(T=a==null?void 0:a.video)==null?void 0:T.MediaVideo:()=>o.jsx(o.Fragment,{}),l=M=>{n.current=M,M.on("waiting",()=>{Dt.log("player is waiting")}),M.on("dispose",()=>{Dt.log("player will dispose")})},[c,u]=k.useState(!1),[d,f]=k.useState(!1),h=()=>{f(!0)},g=()=>{f(!1)},v=M=>{u(M)},m=()=>{u(!1)},A=k.useCallback(M=>o.jsx(QL,{options:{autoplay:!1,controls:!0,responsive:!0,fluid:!0,sources:[{src:M}]},currentItem:e,onReady:l,onUpdate:()=>{}}),[e==null?void 0:e.media_file_id]),w=k.useCallback(M=>o.jsx(s,{mediaId:M,alt:""}),[e==null?void 0:e.media_file_id]),C=o.jsxs("div",{onMouseOver:h,onMouseOut:g,children:[i&&d&&o.jsx(Wr,{handleFieldSettingsSidebar:v,...t}),o.jsx("div",{className:i?"field-form-builder py-4 px-2":"py-4 px-2",children:o.jsx("div",{className:"field",children:o.jsx("div",{className:"grid",children:o.jsx("div",{className:"col-12",children:o.jsxs("div",{className:"mt-3",children:[o.jsxs("label",{className:"flex font-bold mb-3 text-gray-900 text-xl",children:[" ",(x=e==null?void 0:e.title)==null?void 0:x[r==null?void 0:r.type]," -"," ",e==null?void 0:e.videoDuration]}),(e==null?void 0:e.isExternalSource)===!0&&o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&A((E=e==null?void 0:e.media_url)==null?void 0:E[r==null?void 0:r.type])}),(e==null?void 0:e.isExternalSource)===!1?(e==null?void 0:e.media_file_id)!==void 0&&(e==null?void 0:e.media_file_id)!==null?o.jsx(o.Fragment,{children:w(e==null?void 0:e.media_file_id)}):o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&A((_=e==null?void 0:e.media_url)==null?void 0:_[r==null?void 0:r.type])}):o.jsx(o.Fragment,{})]})})})})})]});return o.jsxs(o.Fragment,{children:[o.jsx(n0e,{visibilty:c,closeSettingFieldSidebar:m,...t}),o.jsx(xi,{...t,fieldWrap:C})]})},ume=t=>{const{isBuilderMode:e}=Ht(),[n,r]=k.useState(!1),i=()=>{r(!0)},a=()=>{r(!1)},s=o.jsxs("div",{onMouseOver:i,onMouseOut:a,children:[e&&n&&o.jsx(Wr,{handleFieldSettingsSidebar:()=>{},...t}),o.jsx("div",{className:e?"field-form-builder":"",children:o.jsx("div",{className:"grid",children:o.jsxs("div",{className:"col-12",children:[o.jsx(ga,{}),o.jsx("div",{className:"hr-divider"})]})})})]});return o.jsx(o.Fragment,{children:o.jsx(xi,{...t,fieldWrap:s})})},dme=t=>{var ce,Y,ae,re,Z,K,W,ge,ve,Ie,be;const{isAdmin:e,isBuilderMode:n}=Ht(),{field:r,fieldIndex:i,row:a}=t,{task_status:s,taskRegisterData:l,updateTaskRegisterData:c,updateTaskProgressValue:u,userTaskSubmitFormData:d,updateUserFormDataSubmit:f,TASK_PUBLISHED:h}=mr(),{userSelectedLanguage:g}=sn(),[v,m]=k.useState(!1),[A,w]=k.useState(""),[C,S]=k.useState(0),[T,x]=k.useState(!1),[E,_]=k.useState(!1),M=()=>{_(!0)},O=()=>{_(!1)},F=de=>new Date(de),P=()=>{var de,ne,q;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const ee=[...a.repeatableFields],oe=_t.findIndex(ee,function(pe){return pe.uuid===(r==null?void 0:r.uuid)});oe>=0&&ee[oe].fieldData?w(ee[oe].fieldData):w("")}}else{const ee=d;if(ee!=null&&ee.length){for(const oe of ee)if(oe.fieldId===t.field.uuid&&((de=oe==null?void 0:oe.postData[0])==null?void 0:de.postValue)!==""&&((ne=oe==null?void 0:oe.postData[0])!=null&&ne.postValue)){w(F((q=oe==null?void 0:oe.postData[0])==null?void 0:q.postValue));break}}}x(!0)};k.useEffect(()=>{T||P();const de=Rt.addListener("clearRepeatableFields",oe=>{oe===(a==null?void 0:a.uuid)&&(w(""),S(0),r.isValid=0)}),ne=Rt.addListener("onSubmitUserForm",()=>{var oe;(oe=r==null?void 0:r.attributes)!=null&&oe.required?A?r.isValid=1:r.isValid=0:r.isValid=1}),q=Rt.addListener("OnInvalidFieldCatch",oe=>{r.uuid===(oe==null?void 0:oe.fieldId)?S(1):S(0)}),ee=Rt.addListener("OnGetFieldValue",oe=>{var Ce;const pe=(Ce=oe==null?void 0:oe.repeatableColumn)==null?void 0:Ce.filter(De=>(De==null?void 0:De.fieldUuid)===(r==null?void 0:r.uuid));pe!=null&&pe.length});return()=>{ne.remove(),q.remove(),de.remove(),ee.remove()}});const H=de=>{m(de)},N=()=>{m(!1)},$=de=>{var ee,oe;w(de.target.value);const ne=d,q=_t.cloneDeep(l);if(ne!==null){if((ee=de==null?void 0:de.target)!=null&&ee.value){if(q[r==null?void 0:r.uuid]=(oe=de==null?void 0:de.target)==null?void 0:oe.value,(ne==null?void 0:ne.length)>0)for(const pe of ne)pe.fieldId===t.field.uuid&&(pe.postData[0]={postValue:de.target.value})}else if(delete q[r==null?void 0:r.uuid],(ne==null?void 0:ne.length)>0)for(const pe of ne)pe.fieldId===t.field.uuid&&(pe.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){c(q);const pe=Object.keys(q).length;u(pe)}},U=(de,ne)=>{var q;if(w(ne),(d==null?void 0:d.length)>0){const ee=[...d],oe=_t.findIndex(ee,function(Ce){return Ce.rowId===(a==null?void 0:a.uuid)});let pe=(q=d[oe])==null?void 0:q.repeatableFields;pe={...pe,[de.uuid]:ne},ee[oe]={...ee[oe],repeatableFields:pe},f(ee),ne!==""?de.isValid=1:de.isValid=0}},le=new Date(r==null?void 0:r.minDate),G=new Date(r==null?void 0:r.maxDate),X=o.jsxs("div",{onMouseOver:M,onMouseOut:O,children:[n&&E&&o.jsx(Wr,{type:"",handleFieldSettingsSidebar:H,...t}),o.jsxs("div",{className:`field ${n?" py-3 px-4 builder-element-wrapper ":""}${(r==null?void 0:r.isFluid)===!0&&" p-fluid"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:"col-12 ",children:[(r==null?void 0:r.showHeaderText)&&o.jsx("h6",{children:(ce=r==null?void 0:r.headerText)==null?void 0:ce[g==null?void 0:g.type]}),(r==null?void 0:r.showLabel)&&o.jsxs("label",{htmlFor:i,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{update:function(){throw new Error("Function not implemented.")},value:{fieldId:void 0,uuid:void 0},...t}),((Y=r==null?void 0:r.attributes)==null?void 0:Y.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",n?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(ae=r==null?void 0:r.label)==null?void 0:ae[g==null?void 0:g.type]}),(r==null?void 0:r.showToolTip)&&o.jsx("span",{className:"ml-3",children:(r==null?void 0:r.showToolTip)&&o.jsx(zi,{message:(re=r==null?void 0:r.toolTip)==null?void 0:re[g==null?void 0:g.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(r==null?void 0:r.iconAlignment),children:[(r==null?void 0:r.showIcon)&&o.jsx("i",{className:"pi pi-"+((K=(Z=r==null?void 0:r.icon)==null?void 0:Z.properties)==null?void 0:K.name)}),o.jsx(ef,{readOnlyInput:!0,numberOfMonths:r==null?void 0:r.noOfMonths,selectionMode:(r==null?void 0:r.dateRange)||"single",view:(r==null?void 0:r.calenderView)||!1,showButtonBar:(r==null?void 0:r.isTodayBtn)||!1,showIcon:(r==null?void 0:r.isIcon)||!1,id:r==null?void 0:r.uuid,dateFormat:r==null?void 0:r.dateFormat,placeholder:(W=r==null?void 0:r.placeholder)==null?void 0:W[g==null?void 0:g.type],value:A,onFocus:()=>S(1),onChange:de=>{a!=null&&a.rowIsRepeatable?U(r,de.target.value):$(de)},minDate:le,maxDate:G,className:C===1&&((ge=r==null?void 0:r.attributes)!=null&&ge.required)?A?"valid":"invalid":"valid'",disabled:e||s===h})]}),o.jsx("div",{children:((ve=r==null?void 0:r.attributes)==null?void 0:ve.required)&&o.jsx("small",{className:"error",children:C===1&&!A?(Ie=r==null?void 0:r.validationMesssage)==null?void 0:Ie.english:""})}),o.jsx("div",{children:(r==null?void 0:r.showHelperText)&&o.jsx("small",{children:(be=r==null?void 0:r.helperText)==null?void 0:be[g==null?void 0:g.type]})})]})]})}),e&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(ki,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[v===!0&&o.jsx(Qi,{visibilty:v,closeSettingFieldSidebar:N,...t},r==null?void 0:r.uuid),o.jsx(xi,{...t,fieldWrap:X})]})},fme=t=>{var W,ge,ve,Ie,be,de,ne,q;const e=k.useRef(null),{task_status:n,taskRegisterData:r,updateTaskRegisterData:i,updateTaskProgressValue:a,updateUserFormDataSubmit:s,userTaskSubmitFormData:l,onSetValuetoPostDataHook:c,TASK_PUBLISHED:u}=mr(),{userSelectedLanguage:d,fieldSettingUpdate:f}=sn(),{field:h,fieldIndex:g,columnIndex:v,sectionIndex:m,rowIndex:A,pageIndex:w,row:C}=t,{isAdmin:S,isBuilderMode:T}=Ht(),[x,E]=k.useState(!1),[_,M]=k.useState(0),[O,F]=k.useState(!1),[P,H]=k.useState(null),[N,$]=k.useState(!1),U=()=>{$(!0)},le=()=>{$(!1)},G=()=>{var oe,pe,Ce;(oe=e==null?void 0:e.current)==null||oe.clear(),h.isValid=0,f(w,m,A,v,g,h),H(null);const ee=l;if(l!=null&&l.length){const De=_t.cloneDeep(r);if(De[h==null?void 0:h.uuid]=(pe=e.current)==null?void 0:pe.toDataURL(),(ee==null?void 0:ee.length)>0){for(const me of ee)if(me.fieldId===t.field.uuid){me.postData[0]={postValue:null},H(null);break}}if(!(C!=null&&C.rowIsRepeatable)){i(De);const me=(Ce=Object.keys(De))==null?void 0:Ce.length;a(me)}}},X=()=>{var oe,pe,Ce;const ee=l;if((ee==null?void 0:ee.length)>0)for(const De of ee)De.fieldId===t.field.uuid&&((oe=De==null?void 0:De.postData[0])!=null&&oe.postValue&&((pe=De==null?void 0:De.postData[0])==null?void 0:pe.postValue)!==""&&(H((Ce=De==null?void 0:De.postData[0])==null?void 0:Ce.postValue),F(!0)),h.isValid=1);F(!0)},ce=()=>{var ee,oe,pe,Ce;if(l!=null&&l.length){const De=[...l],me=_t.findIndex(De,function(Pe){return Pe.rowId===(C==null?void 0:C.uuid)});let Te=(ee=l[me])==null?void 0:ee.repeatableFields;Te={...Te,[h==null?void 0:h.uuid]:`<img src="${(oe=e.current)==null?void 0:oe.toDataURL()}" >`},De[me]={...De[me],repeatableFields:Te},s(De)}H(((pe=e.current)==null?void 0:pe.toDataURL())||""),((Ce=e.current)==null?void 0:Ce.toDataURL())!==""?h.isValid=1:h.isValid=0};k.useEffect(()=>{O||X();const ee=Rt.addListener("clearRepeatableFields",De=>{De===(C==null?void 0:C.uuid)&&(H(null),G(),M(0),h.isValid=0,f(w,m,A,v,g,h))}),oe=Rt.addListener("onSubmitUserForm",()=>{var De;(De=h==null?void 0:h.attributes)!=null&&De.required?(P!==null?h.isValid=1:h.isValid=0,f(w,m,A,v,g,h)):h.isValid=1}),pe=Rt.addListener("OnInvalidFieldCatch",De=>{h.uuid===(De==null?void 0:De.fieldId)?M(1):M(0)}),Ce=Rt.addListener("OnSignatureSettingChange",()=>{G()});return()=>{oe.remove(),pe.remove(),Ce.remove(),ee.remove()}});const Y=ee=>{E(ee)},ae=()=>{E(!1)},re=()=>{var oe,pe,Ce,De;const ee=l;if(l!=null&&l.length){const me=_t.cloneDeep(r);if(me[h==null?void 0:h.uuid]=(oe=e.current)==null?void 0:oe.toDataURL(),(ee==null?void 0:ee.length)>0){for(const Te of ee)if(Te.fieldId===t.field.uuid){Te.postData[0]={postValue:(pe=e.current)==null?void 0:pe.toDataURL()},H(((Ce=e.current)==null?void 0:Ce.toDataURL())||null);break}}if(!(C!=null&&C.rowIsRepeatable)){i(me);const Te=(De=Object.keys(me))==null?void 0:De.length;a(Te)}}},Z=()=>{var ee,oe,pe;return`rgba(${(ee=h==null?void 0:h.backgroundColor)==null?void 0:ee.r}, ${(oe=h==null?void 0:h.backgroundColor)==null?void 0:oe.g}, ${(pe=h==null?void 0:h.backgroundColor)==null?void 0:pe.b}, 0.8)`},K=o.jsxs("div",{onMouseOver:U,onMouseOut:le,children:[T&&N&&o.jsx(Wr,{handleFieldSettingsSidebar:Y,...t}),o.jsxs("div",{className:`field ${T?" py-3 px-4 builder-element-wrapper ":""}${(h==null?void 0:h.isFluid)===!0&&" p-fluid"}`,children:[o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:S?"col-6 p-fluid":"col-12 p-fluid",children:[(h==null?void 0:h.showHeaderText)&&o.jsx("h6",{children:(W=h==null?void 0:h.headerText)==null?void 0:W[d==null?void 0:d.type]}),(h==null?void 0:h.showLabel)&&o.jsxs("label",{htmlFor:h.uuid,className:"flex font-bold mb-3 text-gray-900 text-xl",children:[o.jsx(ca,{...t}),((ge=h==null?void 0:h.attributes)==null?void 0:ge.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",T?o.jsx(aa,{...t}):o.jsx(o.Fragment,{children:(ve=h==null?void 0:h.label)==null?void 0:ve[d==null?void 0:d.type]}),o.jsx("span",{className:"ml-3",children:(h==null?void 0:h.showToolTip)&&o.jsx(zi,{message:(Ie=h==null?void 0:h.toolTip)==null?void 0:Ie[d==null?void 0:d.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[n!==u&&!S&&o.jsx(DT,{backgroundColor:Z(),penColor:`#${h==null?void 0:h.penColor}`,canvasProps:{width:`${h==null?void 0:h.canvasWidth}`,height:h==null?void 0:h.canvasHeight,className:"sigCanvas"},ref:e,onEnd:()=>{C!=null&&C.rowIsRepeatable?ce():re()}},h==null?void 0:h.uuid),n===u&&P==null&&o.jsx("p",{children:"Not signed"}),(S||n===u)&&o.jsx("img",{alt:"",src:P,style:{width:"100%",height:"100%"}}),o.jsx("div",{children:((be=h==null?void 0:h.attributes)==null?void 0:be.required)&&o.jsx("small",{className:"error",children:_===1&&!P?(de=h==null?void 0:h.validationMesssage)==null?void 0:de.english:""})}),o.jsx("div",{className:"mt-3",children:(h==null?void 0:h.showHelperText)&&o.jsx("small",{children:(ne=h==null?void 0:h.helperText)==null?void 0:ne[d==null?void 0:d.type]})}),n===Qm&&o.jsx(o.Fragment,{children:S===!1&&o.jsx(Ot,{text:!0,label:(q=h==null?void 0:h.clearSignatureButtonLabel)==null?void 0:q[d==null?void 0:d.type],onClick:()=>G(),className:"p-button-raised p-button-text mt-3"})})]})]}),S&&o.jsx(o.Fragment,{children:o.jsx("div",{className:"col-6",children:o.jsx(ki,{...t})})})]}),S&&o.jsx("hr",{})]})]});return o.jsxs(o.Fragment,{children:[x===!0&&o.jsx(Qi,{visibilty:x,closeSettingFieldSidebar:ae,...t}),o.jsx(xi,{...t,fieldWrap:K})]})};function b1(){return b1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},b1.apply(null,arguments)}function rg(t){"@babel/helpers - typeof";return rg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rg(t)}function hme(t,e){if(rg(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(rg(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pme(t){var e=hme(t,"string");return rg(e)=="symbol"?e:e+""}function mA(t,e,n){return(e=pme(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gme(t){if(Array.isArray(t))return t}function mme(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return l}}function vA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function JL(t,e){if(t){if(typeof t=="string")return vA(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vA(t,e):void 0}}function vme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3768
3768
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y1(t,e){return gme(t)||mme(t,e)||JL(t,e)||vme()}var bme={header:"p-galleria-header",footer:"p-galleria-footer",closeIcon:"p-galleria-close-icon",closeButton:"p-galleria-close p-link",root:function(e){var n=e.props,r=e.context,i=e.thumbnailsPosClassName,a=e.indicatorPosClassName;return ft("p-galleria p-component",{"p-galleria-fullscreen":n.fullScreen,"p-galleria-indicator-onitem":n.showIndicatorsOnItem,"p-galleria-item-nav-onhover":n.showItemNavigatorsOnHover&&!n.fullScreen,"p-input-filled":r&&r.inputStyle==="filled"||Yn.inputStyle==="filled","p-ripple-disabled":r&&r.ripple===!1||Yn.ripple===!1},i,a)},content:"p-galleria-content",mask:function(e){var n=e.visibleState;return ft("p-galleria-mask",{"p-galleria-visible":n})},thumbnailItem:function(e){var n=e.subProps;return ft("p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":n.current,"p-galleria-thumbnail-item-active":n.active,"p-galleria-thumbnail-item-start":n.start,"p-galleria-thumbnail-item-end":n.end})},thumbnailItemContent:"p-galleria-thumbnail-item-content",previousThumbnailIcon:"p-galleria-thumbnail-prev-icon",previousThumbnailButton:function(e){var n=e.isDisabled;return ft("p-galleria-thumbnail-prev p-link",{"p-disabled":n})},nextThumbnailIcon:"p-galleria-thumbnail-next-icon",nextThumbnailButton:function(e){var n=e.isDisabled;return ft("p-galleria-thumbnail-next p-link",{"p-disabled":n})},thumbnailContainer:"p-galleria-thumbnail-container",thumbnailItemsContainer:"p-galleria-thumbnail-items-container",thumbnailItems:"p-galleria-thumbnail-items",thumbnailWrapper:"p-galleria-thumbnail-wrapper",previousItemIcon:"p-galleria-item-prev-icon",previousItemButton:function(e){var n=e.isDisabled;return ft("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":n})},nextItemIcon:"p-galleria-item-next-icon",nextItemButton:function(e){var n=e.isDisabled;return ft("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":n})},caption:"p-galleria-caption",indicator:function(e){var n=e.isActive;return ft("p-galleria-indicator",{"p-highlight":n})},indicators:"p-galleria-indicators p-reset",itemWrapper:"p-galleria-item-wrapper",itemContainer:"p-galleria-item-container",item:"p-galleria-item",transition:"p-galleria"},yme=`
3769
3769
  @layer primereact {
3770
3770
  .p-galleria-content {
@@ -53214,7 +53214,7 @@ const xle = (t) => {
53214
53214
  )
53215
53215
  ] })
53216
53216
  ] }, `checklistIndex-${m}`);
53217
- }) }) }) }) : /* @__PURE__ */ c(we, {}) });
53217
+ }) }) }) }) : /* @__PURE__ */ c(we, { children: /* @__PURE__ */ c("div", { className: "text-gray-900 flex justify-content-center align-items-center", children: "No Admin review is required" }) }) });
53218
53218
  }, li = (t) => {
53219
53219
  const { isPreview: e, field: n, isAdmin: r, fieldWrap: i } = t, { userSelectedLanguage: a } = nn(), { globalAlignment: s } = jt(), o = (m) => {
53220
53220
  const v = m.collapsed ? "pi pi-chevron-down" : "pi pi-chevron-up", g = `${m.className} justify-content-start`, A = `${m.titleClassName} pl-1`;
@@ -60055,7 +60055,7 @@ var m0e = function() {
60055
60055
  theme: i.theme,
60056
60056
  formats: i.formats
60057
60057
  };
60058
- m0e ? w(new Quill(d.current, P)) : import("./quill-DDgt-wDy.js").then(function(z) {
60058
+ m0e ? w(new Quill(d.current, P)) : import("./quill-F9YpzFuc.js").then(function(z) {
60059
60059
  if (z && Ce.isExist(d.current)) {
60060
60060
  var F;
60061
60061
  z.default ? F = new z.default(d.current, P) : F = new z(d.current, P), w(F);
@@ -101327,7 +101327,7 @@ const XL = (t) => {
101327
101327
  {
101328
101328
  alt: "",
101329
101329
  src: P,
101330
- style: { width: 350, height: 200 }
101330
+ style: { width: "100%", height: "100%" }
101331
101331
  }
101332
101332
  ),
101333
101333
  /* @__PURE__ */ c("div", { children: ((ve = p == null ? void 0 : p.attributes) == null ? void 0 : ve.required) && /* @__PURE__ */ c("small", { className: "error", children: D === 1 && !P ? (ue = p == null ? void 0 : p.validationMesssage) == null ? void 0 : ue.english : "" }) }),
@@ -1,7 +1,7 @@
1
1
  var Bl = Object.defineProperty;
2
2
  var Ml = (n, t, e) => t in n ? Bl(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var T = (n, t, e) => Ml(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { d as ti, i as Rr, a as Hi, b as Dl, e as Br, M as Ul, S as ei, U as si, g as ni, c as ri, f as fr, h as zs, j as $i, k as Vs, l as dr, m as Pl, n as jl, o as Fi, p as Hl, q as $l, r as Fl, s as zl, t as ii, u as Kl, v as Gl, w as Ft, x as zi, y as xe } from "./main-7qwhE7Xm.js";
4
+ import { d as ti, i as Rr, a as Hi, b as Dl, e as Br, M as Ul, S as ei, U as si, g as ni, c as ri, f as fr, h as zs, j as $i, k as Vs, l as dr, m as Pl, n as jl, o as Fi, p as Hl, q as $l, r as Fl, s as zl, t as ii, u as Kl, v as Gl, w as Ft, x as zi, y as xe } from "./main-b--hPc8_.js";
5
5
  function Ki(n) {
6
6
  return n;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cft-builder",
3
- "version": "0.2.326",
3
+ "version": "0.2.327",
4
4
  "type": "module",
5
5
  "types": "dist/types/index",
6
6
  "files": [