@veltdev/sdk 6.0.14 → 6.0.15

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.
Files changed (58) hide show
  1. package/app/models/data/comment-events.data.model.d.ts +21 -0
  2. package/{chunk-MWDTJYYY.js → chunk-3PBF7YO3.js} +1 -1
  3. package/{chunk-YD46V2HJ.js → chunk-4GG23KLI.js} +1 -1
  4. package/{chunk-WIBWKKPR.js → chunk-6BD6RXNY.js} +1 -1
  5. package/{chunk-F2UI7E6N.js → chunk-6H34ZIG2.js} +1 -1
  6. package/{chunk-ZXRARNBR.js → chunk-6T5UVEZD.js} +1 -1
  7. package/{chunk-L4AXPJQZ.js → chunk-75Y5C52Y.js} +1 -1
  8. package/{chunk-UI4FQ45E.js → chunk-C344AKG7.js} +1 -1
  9. package/{chunk-ME557375.js → chunk-C63ZTYWF.js} +1 -1
  10. package/{chunk-NPLOF2QS.js → chunk-CCR2M5I7.js} +1 -1
  11. package/{chunk-TKYUWYIS.js → chunk-CFO4WLW4.js} +1 -1
  12. package/{chunk-2V7TTJKH.js → chunk-EB7KKL2E.js} +1 -1
  13. package/{chunk-NMRSVQSF.js → chunk-G6Z7ZUAW.js} +1 -1
  14. package/{chunk-RM6DYFJ2.js → chunk-GQF25NGN.js} +1 -1
  15. package/{chunk-QWZ5M6S5.js → chunk-HACQMR4F.js} +1 -1
  16. package/{chunk-QIQIQCJU.js → chunk-IX3PT26K.js} +1 -1
  17. package/{chunk-TVVTJPQP.js → chunk-J3HUREFU.js} +1 -1
  18. package/{chunk-FJAHUNNB.js → chunk-JWW5WUFN.js} +1 -1
  19. package/{chunk-72VT3VO3.js → chunk-KHH55JTT.js} +1 -1
  20. package/{chunk-SSYLZSDJ.js → chunk-M4VXYJVT.js} +1 -1
  21. package/{chunk-LQG2TUSP.js → chunk-MNXXG4BH.js} +1 -1
  22. package/{chunk-65XLFMDJ.js → chunk-O7NJNJTL.js} +1 -1
  23. package/{chunk-F5KOG4DN.js → chunk-OPEO5BAC.js} +1 -1
  24. package/{chunk-4FVMXAF7.js → chunk-PAXX26WX.js} +1 -1
  25. package/{chunk-2FEIHKKV.js → chunk-QRHFCGHR.js} +1 -1
  26. package/{chunk-RNJD4QCR.js → chunk-R2BHD5BA.js} +1 -1
  27. package/{chunk-ZXZRV24Q.js → chunk-RD7RCB2H.js} +1 -1
  28. package/{chunk-XUZBUCP7.js → chunk-RQWK7TC4.js} +1 -1
  29. package/{chunk-H2T34LM4.js → chunk-SQOVGQOO.js} +1 -1
  30. package/{chunk-WIWLWJ4R.js → chunk-SRFILMAK.js} +1 -1
  31. package/{chunk-YMQYY2F3.js → chunk-TJ5Z4KBP.js} +1 -1
  32. package/{chunk-UKXVAUY2.js → chunk-TJCNGA5O.js} +1 -1
  33. package/chunk-TUKJVGIT.js +174 -0
  34. package/{chunk-IEQR2CEL.js → chunk-UQ5O7HIC.js} +1 -1
  35. package/{chunk-AR4T44MM.js → chunk-XU45S6MG.js} +1 -1
  36. package/package.json +1 -1
  37. package/velt-activity-log.js +1 -1
  38. package/velt-area.js +1 -1
  39. package/velt-arrow.js +1 -1
  40. package/velt-comment.js +7 -7
  41. package/velt-crdt.js +1 -1
  42. package/velt-cursor.js +1 -1
  43. package/velt-huddle.js +1 -1
  44. package/velt-live-state-sync.js +1 -1
  45. package/velt-notification.js +1 -1
  46. package/velt-portable.js +1 -1
  47. package/velt-presence.js +1 -1
  48. package/velt-reaction.js +1 -1
  49. package/velt-recorder.js +1 -1
  50. package/velt-rewriter.js +1 -1
  51. package/velt-selection.js +1 -1
  52. package/velt-tag.js +1 -1
  53. package/velt-user-invite.js +1 -1
  54. package/velt-user-request.js +1 -1
  55. package/velt-video-player.js +1 -1
  56. package/velt-views.js +1 -1
  57. package/velt.js +2 -2
  58. package/chunk-64GL6WKY.js +0 -174
@@ -1 +1 @@
1
- import{$ as w,_ as V,aa as j,ba as T,ca as Z}from"./chunk-XUZBUCP7.js";import{D as E,Ja as R,La as S,Ma as F,Oa as l,V as b,db as C,i as g,m as y,na as I,ta as v}from"./chunk-64GL6WKY.js";var _={schedule(n,t){let e=setTimeout(n,t);return()=>clearTimeout(e)}};function O(n){return n.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function k(n){return!!n&&n.nodeType===Node.ELEMENT_NODE}var h;function N(n,t){if(!h){let e=Element.prototype;h=e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}return n.nodeType===Node.ELEMENT_NODE?h.call(n,t):!1}function z(n){let t={};return n.forEach(({propName:e,templateName:s,transform:u})=>{t[O(s)]=[e,u]}),t}function A(n,t){return t.get(l).resolveComponentFactory(n).inputs}function P(n,t){let e=n.childNodes,s=t.map(()=>[]),u=-1;t.some((r,o)=>r==="*"?(u=o,!0):!1);for(let r=0,o=e.length;r<o;++r){let i=e[r],c=L(i,t,u);c!==-1&&s[c].push(i)}return s}function L(n,t,e){let s=e;return k(n)&&t.some((u,r)=>u!=="*"&&N(n,u)?(s=r,!0):!1),s}var Y=10,p=class{componentFactory;inputMap=new Map;constructor(t,e){this.componentFactory=e.get(l).resolveComponentFactory(t);for(let s of this.componentFactory.inputs)this.inputMap.set(s.propName,s.templateName)}create(t){return new m(this.componentFactory,t,this.inputMap)}},m=class{componentFactory;injector;inputMap;eventEmitters=new y(1);events=this.eventEmitters.pipe(b(t=>E(...t)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(t,e,s){this.componentFactory=t,this.injector=e,this.inputMap=s,this.ngZone=this.injector.get(R),this.appRef=this.injector.get(C),this.cdScheduler=e.get(v),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(t){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(t)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=_.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},Y))})}getInputValue(t){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(t):this.componentRef.instance[t])}setInputValue(t,e){if(this.componentRef===null){this.initialInputValues.set(t,e);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(t)??t,e),S(this.componentRef.hostView)&&(F(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(t){let e=I.create({providers:[],parent:this.injector}),s=P(t,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(e,s,t),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[t,e]of this.initialInputValues)this.setInputValue(t,e);this.initialInputValues.clear()}initializeOutputs(t){let e=this.componentFactory.outputs.map(({propName:s,templateName:u})=>{let r=t.instance[s];return new g(o=>{let i=r.subscribe(c=>o.next({name:u,value:c}));return()=>i.unsubscribe()})});this.eventEmitters.next(e)}runInZone(t){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(t):t()}},f=class extends HTMLElement{ngElementEventsSubscription=null};function D(n,t){let e=A(n,t.injector),s=t.strategyFactory||new p(n,t.injector),u=z(e);class r extends f{injector;static observedAttributes=Object.keys(u);get ngElementStrategy(){if(!this._ngElementStrategy){let i=this._ngElementStrategy=s.create(this.injector||t.injector);e.forEach(({propName:c,transform:a})=>{if(!this.hasOwnProperty(c))return;let d=this[c];delete this[c],i.setInputValue(c,d,a)})}return this._ngElementStrategy}_ngElementStrategy;constructor(i){super(),this.injector=i}attributeChangedCallback(i,c,a,d){let[M,x]=u[i];this.ngElementStrategy.setInputValue(M,a,x)}connectedCallback(){let i=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),i=!0),this.ngElementStrategy.connect(this),i||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(i=>{let c=new CustomEvent(i.name,{detail:i.value});this.dispatchEvent(c)})}}return e.forEach(({propName:o,transform:i})=>{Object.defineProperty(r.prototype,o,{get(){return this.ngElementStrategy.getInputValue(o)},set(c){this.ngElementStrategy.setInputValue(o,c,i)},configurable:!0,enumerable:!0})}),r}function K(n,t){let e=D(n,{injector:t});class s extends e{connectedCallback(){let r;try{let o=this;Z(o),r=V(o)}catch{}super.connectedCallback?.();try{if(w(r),r){let o=this;setTimeout(()=>{j(o),T(o)},0)}}catch{}}}return s}export{K as a};
1
+ import{$ as w,_ as V,aa as j,ba as T,ca as Z}from"./chunk-RQWK7TC4.js";import{D as E,Ja as R,La as S,Ma as F,Oa as l,V as b,db as C,i as g,m as y,na as I,ta as v}from"./chunk-TUKJVGIT.js";var _={schedule(n,t){let e=setTimeout(n,t);return()=>clearTimeout(e)}};function O(n){return n.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function k(n){return!!n&&n.nodeType===Node.ELEMENT_NODE}var h;function N(n,t){if(!h){let e=Element.prototype;h=e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}return n.nodeType===Node.ELEMENT_NODE?h.call(n,t):!1}function z(n){let t={};return n.forEach(({propName:e,templateName:s,transform:u})=>{t[O(s)]=[e,u]}),t}function A(n,t){return t.get(l).resolveComponentFactory(n).inputs}function P(n,t){let e=n.childNodes,s=t.map(()=>[]),u=-1;t.some((r,o)=>r==="*"?(u=o,!0):!1);for(let r=0,o=e.length;r<o;++r){let i=e[r],c=L(i,t,u);c!==-1&&s[c].push(i)}return s}function L(n,t,e){let s=e;return k(n)&&t.some((u,r)=>u!=="*"&&N(n,u)?(s=r,!0):!1),s}var Y=10,p=class{componentFactory;inputMap=new Map;constructor(t,e){this.componentFactory=e.get(l).resolveComponentFactory(t);for(let s of this.componentFactory.inputs)this.inputMap.set(s.propName,s.templateName)}create(t){return new m(this.componentFactory,t,this.inputMap)}},m=class{componentFactory;injector;inputMap;eventEmitters=new y(1);events=this.eventEmitters.pipe(b(t=>E(...t)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(t,e,s){this.componentFactory=t,this.injector=e,this.inputMap=s,this.ngZone=this.injector.get(R),this.appRef=this.injector.get(C),this.cdScheduler=e.get(v),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(t){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(t)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=_.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},Y))})}getInputValue(t){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(t):this.componentRef.instance[t])}setInputValue(t,e){if(this.componentRef===null){this.initialInputValues.set(t,e);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(t)??t,e),S(this.componentRef.hostView)&&(F(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(t){let e=I.create({providers:[],parent:this.injector}),s=P(t,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(e,s,t),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[t,e]of this.initialInputValues)this.setInputValue(t,e);this.initialInputValues.clear()}initializeOutputs(t){let e=this.componentFactory.outputs.map(({propName:s,templateName:u})=>{let r=t.instance[s];return new g(o=>{let i=r.subscribe(c=>o.next({name:u,value:c}));return()=>i.unsubscribe()})});this.eventEmitters.next(e)}runInZone(t){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(t):t()}},f=class extends HTMLElement{ngElementEventsSubscription=null};function D(n,t){let e=A(n,t.injector),s=t.strategyFactory||new p(n,t.injector),u=z(e);class r extends f{injector;static observedAttributes=Object.keys(u);get ngElementStrategy(){if(!this._ngElementStrategy){let i=this._ngElementStrategy=s.create(this.injector||t.injector);e.forEach(({propName:c,transform:a})=>{if(!this.hasOwnProperty(c))return;let d=this[c];delete this[c],i.setInputValue(c,d,a)})}return this._ngElementStrategy}_ngElementStrategy;constructor(i){super(),this.injector=i}attributeChangedCallback(i,c,a,d){let[M,x]=u[i];this.ngElementStrategy.setInputValue(M,a,x)}connectedCallback(){let i=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),i=!0),this.ngElementStrategy.connect(this),i||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(i=>{let c=new CustomEvent(i.name,{detail:i.value});this.dispatchEvent(c)})}}return e.forEach(({propName:o,transform:i})=>{Object.defineProperty(r.prototype,o,{get(){return this.ngElementStrategy.getInputValue(o)},set(c){this.ngElementStrategy.setInputValue(o,c,i)},configurable:!0,enumerable:!0})}),r}function K(n,t){let e=D(n,{injector:t});class s extends e{connectedCallback(){let r;try{let o=this;Z(o),r=V(o)}catch{}super.connectedCallback?.();try{if(w(r),r){let o=this;setTimeout(()=>{j(o),T(o)},0)}}catch{}}}return s}export{K as a};
@@ -1,4 +1,4 @@
1
- import{Cd as qe,Hd as $e,Ja as ke,ad as ye,bd as ne,cd as Ee,da as Re,dd as Ue,ed as Ae,fd as Oe,g as K,ga as Te,gd as C,hd as Se,id as Ie,jd as Pe,kd as Ne,ld as Ce,md as xe,na as we,nd as H,sd as ve,td as De,ud as Le,va as $,vd as Be,wd as x,xd as Me,yd as Fe}from"./chunk-64GL6WKY.js";var Ke="firebasestorage.googleapis.com",Ze="storageBucket",Tt=120*1e3,wt=600*1e3,kt=1e3;var d=class t extends Oe{constructor(e,n,s=0){super(se(e),`Firebase Storage: ${n} (${se(e)})`),this.status_=s,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,t.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return se(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
1
+ import{Cd as qe,Hd as $e,Ja as ke,ad as ye,bd as ne,cd as Ee,da as Re,dd as Ue,ed as Ae,fd as Oe,g as K,ga as Te,gd as C,hd as Se,id as Ie,jd as Pe,kd as Ne,ld as Ce,md as xe,na as we,nd as H,sd as ve,td as De,ud as Le,va as $,vd as Be,wd as x,xd as Me,yd as Fe}from"./chunk-TUKJVGIT.js";var Ke="firebasestorage.googleapis.com",Ze="storageBucket",Tt=120*1e3,wt=600*1e3,kt=1e3;var d=class t extends Oe{constructor(e,n,s=0){super(se(e),`Firebase Storage: ${n} (${se(e)})`),this.status_=s,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,t.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return se(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
2
2
  ${this.customData.serverResponse}`:this.message=this._baseMessage}},h=(function(t){return t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment",t})(h||{});function se(t){return"storage/"+t}function de(){let t="An unknown error occurred, please check the error payload for server response.";return new d(h.UNKNOWN,t)}function yt(t){return new d(h.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function Et(t){return new d(h.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function Ut(){let t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new d(h.UNAUTHENTICATED,t)}function At(){return new d(h.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function Ot(t){return new d(h.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function Ye(){return new d(h.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Je(){return new d(h.CANCELED,"User canceled the upload/download.")}function St(t){return new d(h.INVALID_URL,"Invalid URL '"+t+"'.")}function It(t){return new d(h.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function Pt(){return new d(h.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Ze+"' property when initializing the app?")}function Qe(){return new d(h.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Nt(){return new d(h.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function Ct(){return new d(h.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function xt(t){return new d(h.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function oe(t){return new d(h.INVALID_ARGUMENT,t)}function et(){return new d(h.APP_DELETED,"The Firebase app was deleted.")}function vt(t){return new d(h.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function z(t,e){return new d(h.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function j(t){throw new d(h.INTERNAL_ERROR,"Internal error: "+t)}var y=class t{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let s;try{s=t.makeFromUrl(e,n)}catch{return new t(e,"")}if(s.path==="")return s;throw It(e)}static makeFromUrl(e,n){let s=null,r="([A-Za-z0-9.\\-_]+)";function o(b){b.path.charAt(b.path.length-1)==="/"&&(b.path_=b.path_.slice(0,-1))}let i="(/(.*))?$",u=new RegExp("^gs://"+r+i,"i"),a={bucket:1,path:3};function c(b){b.path_=decodeURIComponent(b.path)}let l="v[A-Za-z0-9_]+",f=n.replace(/[.]/g,"\\."),p="(/([^?#]*).*)?$",m=new RegExp(`^https?://${f}/${l}/b/${r}/o${p}`,"i"),g={bucket:1,path:3},w=n===Ke?"(?:storage.googleapis.com|storage.cloud.google.com)":n,_="([^?#]*)",U=new RegExp(`^https?://${w}/${r}/${_}`,"i"),T=[{regex:u,indices:a,postModify:o},{regex:m,indices:g,postModify:c},{regex:U,indices:{bucket:1,path:2},postModify:c}];for(let b=0;b<T.length;b++){let P=T[b],N=P.regex.exec(e);if(N){let ee=N[P.indices.bucket],q=N[P.indices.path];q||(q=""),s=new t(ee,q),P.postModify(s);break}}if(s==null)throw St(e);return s}},ie=class{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}};function Dt(t,e,n){let s=1,r=null,o=null,i=!1,u=0;function a(){return u===2}let c=!1;function l(..._){c||(c=!0,e.apply(null,_))}function f(_){r=setTimeout(()=>{r=null,t(m,a())},_)}function p(){o&&clearTimeout(o)}function m(_,...U){if(c){p();return}if(_){p(),l.call(null,_,...U);return}if(a()||i){p(),l.call(null,_,...U);return}s<64&&(s*=2);let T;u===1?(u=2,T=0):T=(s+Math.random())*1e3,f(T)}let g=!1;function w(_){g||(g=!0,p(),!c&&(r!==null?(_||(u=2),clearTimeout(r),f(0)):_||(u=1)))}return f(0),o=setTimeout(()=>{i=!0,w(!0)},n),w}function Lt(t){t(!1)}function Bt(t){return t!==void 0}function Mt(t){return typeof t=="function"}function Ft(t){return typeof t=="object"&&!Array.isArray(t)}function Q(t){return typeof t=="string"||t instanceof String}function He(t){return fe()&&t instanceof Blob}function fe(){return typeof Blob<"u"}function je(t,e,n,s){if(s<e)throw oe(`Invalid value for '${t}'. Expected ${e} or greater.`);if(s>n)throw oe(`Invalid value for '${t}'. Expected ${n} or less.`)}function F(t,e,n){let s=e;return n==null&&(s=`https://${e}`),`${n}://${s}/v0${t}`}function tt(t){let e=encodeURIComponent,n="?";for(let s in t)if(t.hasOwnProperty(s)){let r=e(s)+"="+e(t[s]);n=n+r+"&"}return n=n.slice(0,-1),n}var L=(function(t){return t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT",t})(L||{});function nt(t,e){let n=t>=500&&t<600,r=[408,429].indexOf(t)!==-1,o=e.indexOf(t)!==-1;return n||r||o}var ae=class{constructor(e,n,s,r,o,i,u,a,c,l,f,p=!0,m=!1){this.url_=e,this.method_=n,this.headers_=s,this.body_=r,this.successCodes_=o,this.additionalRetryCodes_=i,this.callback_=u,this.errorCallback_=a,this.timeout_=c,this.progressCallback_=l,this.connectionFactory_=f,this.retry=p,this.isUsingEmulator=m,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((g,w)=>{this.resolve_=g,this.reject_=w,this.start_()})}start_(){let e=(s,r)=>{if(r){s(!1,new D(!1,null,!0));return}let o=this.connectionFactory_();this.pendingConnection_=o;let i=u=>{let a=u.loaded,c=u.lengthComputable?u.total:-1;this.progressCallback_!==null&&this.progressCallback_(a,c)};this.progressCallback_!==null&&o.addUploadProgressListener(i),o.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&o.removeUploadProgressListener(i),this.pendingConnection_=null;let u=o.getErrorCode()===L.NO_ERROR,a=o.getStatus();if(!u||nt(a,this.additionalRetryCodes_)&&this.retry){let l=o.getErrorCode()===L.ABORT;s(!1,new D(!1,null,l));return}let c=this.successCodes_.indexOf(a)!==-1;s(!0,new D(c,o))})},n=(s,r)=>{let o=this.resolve_,i=this.reject_,u=r.connection;if(r.wasSuccessCode)try{let a=this.callback_(u,u.getResponse());Bt(a)?o(a):o()}catch(a){i(a)}else if(u!==null){let a=de();a.serverResponse=u.getErrorText(),this.errorCallback_?i(this.errorCallback_(u,a)):i(a)}else if(r.canceled){let a=this.appDelete_?et():Je();i(a)}else{let a=Ye();i(a)}};this.canceled_?n(!1,new D(!1,null,!0)):this.backoffId_=Dt(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&Lt(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},D=class{constructor(e,n,s){this.wasSuccessCode=e,this.connection=n,this.canceled=!!s}};function qt(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function $t(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function Ht(t,e){e&&(t["X-Firebase-GMPID"]=e)}function jt(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function zt(t,e,n,s,r,o,i=!0,u=!1){let a=tt(t.urlParams),c=t.url+a,l=Object.assign({},t.headers);return Ht(l,e),qt(l,n),$t(l,o),jt(l,s),new ae(c,t.method,l,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r,i,u)}function Gt(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Wt(...t){let e=Gt();if(e!==void 0){let n=new e;for(let s=0;s<t.length;s++)n.append(t[s]);return n.getBlob()}else{if(fe())return new Blob(t);throw new d(h.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function Vt(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}function Xt(t){if(typeof atob>"u")throw xt("base-64");return atob(t)}var E={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},G=class{constructor(e,n){this.data=e,this.contentType=n||null}};function Kt(t,e){switch(t){case E.RAW:return new G(st(e));case E.BASE64:case E.BASE64URL:return new G(rt(t,e));case E.DATA_URL:return new G(Yt(e),Jt(e))}throw de()}function st(t){let e=[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);if(s<=127)e.push(s);else if(s<=2047)e.push(192|s>>6,128|s&63);else if((s&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{let o=s,i=t.charCodeAt(++n);s=65536|(o&1023)<<10|i&1023,e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|s&63)}else(s&64512)===56320?e.push(239,191,189):e.push(224|s>>12,128|s>>6&63,128|s&63)}return new Uint8Array(e)}function Zt(t){let e;try{e=decodeURIComponent(t)}catch{throw z(E.DATA_URL,"Malformed data URL.")}return st(e)}function rt(t,e){switch(t){case E.BASE64:{let r=e.indexOf("-")!==-1,o=e.indexOf("_")!==-1;if(r||o)throw z(t,"Invalid character '"+(r?"-":"_")+"' found: is it base64url encoded?");break}case E.BASE64URL:{let r=e.indexOf("+")!==-1,o=e.indexOf("/")!==-1;if(r||o)throw z(t,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Xt(e)}catch(r){throw r.message.includes("polyfill")?r:z(t,"Invalid character found")}let s=new Uint8Array(n.length);for(let r=0;r<n.length;r++)s[r]=n.charCodeAt(r);return s}var Y=class{constructor(e){this.base64=!1,this.contentType=null;let n=e.match(/^data:([^,]+)?,/);if(n===null)throw z(E.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");let s=n[1]||null;s!=null&&(this.base64=Qt(s,";base64"),this.contentType=this.base64?s.substring(0,s.length-7):s),this.rest=e.substring(e.indexOf(",")+1)}};function Yt(t){let e=new Y(t);return e.base64?rt(E.BASE64,e.rest):Zt(e.rest)}function Jt(t){return new Y(t).contentType}function Qt(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}var J=class t{constructor(e,n){let s=0,r="";He(e)?(this.data_=e,s=e.size,r=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),s=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),s=e.length),this.size_=s,this.type_=r}size(){return this.size_}type(){return this.type_}slice(e,n){if(He(this.data_)){let s=this.data_,r=Vt(s,e,n);return r===null?null:new t(r)}else{let s=new Uint8Array(this.data_.buffer,e,n-e);return new t(s,!0)}}static getBlob(...e){if(fe()){let n=e.map(s=>s instanceof t?s.data_:s);return new t(Wt.apply(null,n))}else{let n=e.map(i=>Q(i)?Kt(E.RAW,i).data:i.data_),s=0;n.forEach(i=>{s+=i.byteLength});let r=new Uint8Array(s),o=0;return n.forEach(i=>{for(let u=0;u<i.length;u++)r[o++]=i[u]}),new t(r,!0)}}uploadData(){return this.data_}};function ot(t){let e;try{e=JSON.parse(t)}catch{return null}return Ft(e)?e:null}function en(t){if(t.length===0)return null;let e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function tn(t,e){let n=e.split("/").filter(s=>s.length>0).join("/");return t.length===0?n:t+"/"+n}function it(t){let e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}function nn(t,e){return e}var R=class{constructor(e,n,s,r){this.server=e,this.local=n||e,this.writable=!!s,this.xform=r||nn}},Z=null;function sn(t){return!Q(t)||t.length<2?t:it(t)}function at(){if(Z)return Z;let t=[];t.push(new R("bucket")),t.push(new R("generation")),t.push(new R("metageneration")),t.push(new R("name","fullPath",!0));function e(o,i){return sn(i)}let n=new R("name");n.xform=e,t.push(n);function s(o,i){return i!==void 0?Number(i):i}let r=new R("size");return r.xform=s,t.push(r),t.push(new R("timeCreated")),t.push(new R("updated")),t.push(new R("md5Hash",null,!0)),t.push(new R("cacheControl",null,!0)),t.push(new R("contentDisposition",null,!0)),t.push(new R("contentEncoding",null,!0)),t.push(new R("contentLanguage",null,!0)),t.push(new R("contentType",null,!0)),t.push(new R("metadata","customMetadata",!0)),Z=t,Z}function rn(t,e){function n(){let s=t.bucket,r=t.fullPath,o=new y(s,r);return e._makeStorageReference(o)}Object.defineProperty(t,"ref",{get:n})}function on(t,e,n){let s={};s.type="file";let r=n.length;for(let o=0;o<r;o++){let i=n[o];s[i.local]=i.xform(s,e[i.server])}return rn(s,t),s}function ut(t,e,n){let s=ot(e);return s===null?null:on(t,s,n)}function an(t,e,n,s){let r=ot(e);if(r===null||!Q(r.downloadTokens))return null;let o=r.downloadTokens;if(o.length===0)return null;let i=encodeURIComponent;return o.split(",").map(c=>{let l=t.bucket,f=t.fullPath,p="/b/"+i(l)+"/o/"+i(f),m=F(p,n,s),g=tt({alt:"media",token:c});return m+g})[0]}function ct(t,e){let n={},s=e.length;for(let r=0;r<s;r++){let o=e[r];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}var S=class{constructor(e,n,s,r){this.url=e,this.method=n,this.handler=s,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}};function O(t){if(!t)throw de()}function _e(t,e){function n(s,r){let o=ut(t,r,e);return O(o!==null),o}return n}function un(t,e){function n(s,r){let o=ut(t,r,e);return O(o!==null),an(o,r,t.host,t._protocol)}return n}function V(t){function e(n,s){let r;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?r=At():r=Ut():n.getStatus()===402?r=Et(t.bucket):n.getStatus()===403?r=Ot(t.path):r=s,r.status=n.getStatus(),r.serverResponse=s.serverResponse,r}return e}function pe(t){let e=V(t);function n(s,r){let o=e(s,r);return s.getStatus()===404&&(o=yt(t.path)),o.serverResponse=r.serverResponse,o}return n}function cn(t,e,n){let s=e.fullServerUrl(),r=F(s,t.host,t._protocol),o="GET",i=t.maxOperationRetryTime,u=new S(r,o,_e(t,n),i);return u.errorHandler=pe(e),u}function ln(t,e,n){let s=e.fullServerUrl(),r=F(s,t.host,t._protocol),o="GET",i=t.maxOperationRetryTime,u=new S(r,o,un(t,n),i);return u.errorHandler=pe(e),u}function hn(t,e){let n=e.fullServerUrl(),s=F(n,t.host,t._protocol),r="DELETE",o=t.maxOperationRetryTime;function i(a,c){}let u=new S(s,r,i,o);return u.successCodes=[200,204],u.errorHandler=pe(e),u}function dn(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function lt(t,e,n){let s=Object.assign({},n);return s.fullPath=t.path,s.size=e.size(),s.contentType||(s.contentType=dn(null,e)),s}function fn(t,e,n,s,r){let o=e.bucketOnlyServerUrl(),i={"X-Goog-Upload-Protocol":"multipart"};function u(){let T="";for(let b=0;b<2;b++)T=T+Math.random().toString().slice(2);return T}let a=u();i["Content-Type"]="multipart/related; boundary="+a;let c=lt(e,s,r),l=ct(c,n),f="--"+a+`\r
3
3
  Content-Type: application/json; charset=utf-8\r
4
4
  \r
@@ -1 +1 @@
1
- import{Fa as ce}from"./chunk-XUZBUCP7.js";import{e as re,j as se,k as te,l as ie,m as oe,t as ne}from"./chunk-4FVMXAF7.js";import{$f as N,$h as X,He as D,M as b,Pf as E,Qd as W,Qf as u,Ti as H,Uh as z,Ui as Y,Xh as j,Yf as L,Yh as J,Yi as Z,Zf as T,a as f,ag as _,b as y,ba as K,bi as G,di as V,ea as R,ee as v,fa as M,g,hg as B,ji as S,ki as $,l as A,rg as F,rj as Q,sf as U,tf as P,uf as p,uj as q,v as x,xj as ee}from"./chunk-64GL6WKY.js";var C="public",w=100,Ne=(()=>{let I=class I{constructor(e,r,s,t,o,i,c,a,n,d){this.authService=e,this.docService=r,this.loggingService=s,this.commonDbService=t,this.usersService=o,this.commentUtilsService=i,this.coreActionsService=c,this.functions=a,this.configService=n,this.contactService=d,this.endpointsService=M(Z),this.adapterSelectorService=M(Q),this.currentUserPermissions$=new A(null),this.permissionsCache$=new A(null),this.permissionProvider$=new A(null),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.requestKeyedPermissionsCache=new Map,this.inFlightPermissionsRequests=new Map,this.permissionsCacheGeneration=0,this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",this.reportedUnknownFolderErrorCodes=new Set;try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(h){this.loggingService.catch("Error in UserPermissionService constructor:",h)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,r,s,t,o,i){try{return e.find(a=>a.resourceId===s&&a.type===t&&a.organizationId===o&&a.userId===i)?(r.push({userId:i,resourceId:s,organizationId:o,type:t,hasAccess:!1}),e.filter(a=>!(a.resourceId===s&&a.type===t&&a.organizationId===o&&a.userId===i))):e}catch(c){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",c),e}}hasUserContextAccess({userId:e,accessFields:r}){try{if(!this.getIsContextEnabled()||r.includes(D.DEFAULT_VELT_CONTEXT))return!0;let s=r.filter(o=>!B(o));if(!s.length){if(r.some(c=>c.startsWith(D.VISIBILITY_ORG_PREFIX)))return!0;let i=`${D.VISIBILITY_SELF_PREFIX}${L(e).toString()}`;return r.includes(i)}let t=this.contactService.getUserAccessFieldsByUserId(e);return t?.length?s.every(o=>t.includes(o)):!0}catch(s){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",s),!1}}isMetadataProbeUnanswerable(e){try{return this.adapterSelectorService?.isPortableBackendActive()?!se(e)&&!te(e):!1}catch(r){return this.loggingService.catch("Error in UserPermissionService isMetadataProbeUnanswerable: ",r),!1}}organizationDetails(e){return g(this,null,function*(){try{if(this.isMetadataProbeUnanswerable("organizationMetadata"))return{error:!1};let r=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e,suppressError:!0}});return r&&r?.errorCode?{errorCode:u.PERMISSION_DENIED,error:!0}:r&&!r?.metadata?{errorCode:u.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(r){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",r),{errorCode:u.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(s){return g(this,arguments,function*({documentId:e,organizationId:r}){try{if(this.isMetadataProbeUnanswerable("documentMetadata"))return{error:!1};let t=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:r,suppressError:!0}});if(t&&t?.errorCode)return{errorCode:u.PERMISSION_DENIED,error:!0};if(t&&!t?.metadata)return{errorCode:u.DOES_NOT_EXIST,error:!0};let o=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,f(f({},o),t?.metadata??{}));let i,c=t?.metadata?.veltFolderId;if(c)try{i=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:c,organizationId:r}}))?.folderIamConfig?.accessType}catch(a){this.loggingService.catch("Error fetching folder accessType for document:",a)}return i||(i=t?.docIamConfig?.accessType),{error:!1,accessType:i}}catch(t){return this.loggingService.catch("Error in UserPermissionService documentDetails:",t),{errorCode:u.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(s){return g(this,arguments,function*({folderId:e,organizationId:r}){try{if(this.isMetadataProbeUnanswerable("folderMetadata"))return{error:!1};let t=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:r,suppressError:!0}});return t&&t?.errorCode?{errorCode:u.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:u.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:t?.folderIamConfig?.accessType}}catch(t){return this.loggingService.catch("Error in UserPermissionService folderDetails:",t),{errorCode:u.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return g(this,null,function*(){let r=this.permissionsCacheGeneration;try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let s=this.authService.getUser()?.userId,t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let o=yield this.validateResources(t),[i,c]=yield this.fetchUserPermissionsFromDB(t),a=this.authService.getUser()?.userId;if(s!==a)return{};let n=this.buildPermissionsResponse(t,o,i,c);if(Object.keys(n).length>0){if(!e)this.setCurrentUserPermissions(n);else if(this.permissionsCacheGeneration===r){let d=this.buildPermissionsCacheKey(e);d!==null&&this.requestKeyedPermissionsCache.set(d,JSON.parse(JSON.stringify(n)))}}return n}catch(s){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",s),{}}})}getUserPermissionsFromCacheOrFetch(e){return g(this,null,function*(){try{if(!e)return yield this.getUserPermissions(e);let r=this.buildPermissionsCacheKey(e);if(r===null)return yield this.getUserPermissions(e);let s=this.permissionsCacheGeneration,t=this.requestKeyedPermissionsCache.get(r);if(t)return JSON.parse(JSON.stringify(t));let o=this.inFlightPermissionsRequests.get(r);if(o){let a=yield o;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(a))}let i=this.getUserPermissions(e);this.inFlightPermissionsRequests.set(r,i),i.finally(()=>{this.inFlightPermissionsRequests.get(r)===i&&this.inFlightPermissionsRequests.delete(r)}).catch(()=>{});let c=yield i;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(c))}catch(r){return this.loggingService.catch("Error in UserPermissionService getUserPermissionsFromCacheOrFetch:",r),{}}})}clearRequestKeyedPermissionsCache(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService clearRequestKeyedPermissionsCache:",e)}}invalidateAllPermissionsState(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService invalidateAllPermissionsState:",e)}}buildPermissionsCacheKey(e){try{let r={};return Object.keys(e).sort().forEach(s=>{let t=e[s];t!==void 0&&(r[s]=Array.isArray(t)?[...t].sort():t)}),r.__userId=this.authService.getUser()?.userId??null,JSON.stringify(r)}catch(r){return this.loggingService.catch("Error in UserPermissionService buildPermissionsCacheKey:",r),null}}extractResourceIds(e){let r=this.docService.getDocumentPaths(),s=this.docService.getDocumentIds();if(e){let i=e.organizationId??r?.clientOrganizationId;return{folderIds:e.folderIds??[],documentIds:e.documentIds??[],clientOrganizationId:i,organizationId:i?N(i):void 0}}let t=r?.clientOrganizationId;return{folderIds:r?.folderId?[r.folderId]:[],documentIds:s.map(i=>i.clientDocumentId),clientOrganizationId:t,organizationId:t?N(t):void 0}}validateResources(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:t,clientOrganizationId:o}=e,i=[],c=[],a=r.length>0||s.length>0;t&&!a&&(i.push(this.organizationDetails(t)),c.push({id:o??"",type:"organization"})),r.forEach(l=>{i.push(this.folderDetails({folderId:_(l),organizationId:t??""})),c.push({id:l,type:"folder"})}),s.forEach(l=>{i.push(this.documentDetails({documentId:T(l),organizationId:t??""})),c.push({id:l,type:"document"})});let[n,d]=yield Promise.all([Promise.allSettled(i),this.getDefaultDocumentAccessType()]),h=this.processValidationResults(n,c);return y(f({},this.suppressResolverGrantedFailures(h,o)),{defaultDocumentAccessType:d})})}suppressResolverGrantedFailures(e,r){try{let s=this.authService.getUser()?.userId;if(!s)return e;let t=this.getPermissionsCache()??[];if(t.length===0)return e;let o=(n,d,h)=>t.some(l=>l?.userId===s&&l?.resourceId===n&&l?.type===d&&(!h||l?.organizationId===h)&&l?.hasAccess===!0),i=e.failedDocumentIds.filter(n=>!(n.errorCode===u.PERMISSION_DENIED&&o(n.id,p.DOCUMENT,r))),c=e.failedFolderIds.filter(n=>!(n.errorCode===u.PERMISSION_DENIED&&o(n.id,p.FOLDER,r))),a=e.failedOrganizationId;return a&&a.errorCode===u.PERMISSION_DENIED&&r&&o(r,p.ORGANIZATION,r)&&(a=void 0),{failedFolderIds:c,failedDocumentIds:i,failedOrganizationId:a,folderAccessTypes:e.folderAccessTypes,documentAccessTypes:e.documentAccessTypes}}catch(s){return this.loggingService.catch("Error in UserPermissionService suppressResolverGrantedFailures:",s),e}}getDefaultDocumentAccessType(){return g(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,r){let s=[],t=[],o,i={},c={};for(let a=0;a<e.length;a++){let n=e[a],d=r[a];if(n.status==="rejected"||n.status==="fulfilled"&&n.value.error){let l=n.status==="fulfilled"?n.value.errorCode??u.SOMETHING_WENT_WRONG:u.SOMETHING_WENT_WRONG,m={id:d.id,errorCode:l};switch(d.type){case"organization":if(o=m,l===u.DOES_NOT_EXIST)throw new Error(`Organization with id '${d.id}' does not exist`);break;case"folder":s.push(m);break;case"document":t.push(m);break}}else if(n.status==="fulfilled")switch(d.type){case"folder":n.value.accessType&&(i[d.id]=n.value.accessType);break;case"document":n.value.accessType&&(c[d.id]=n.value.accessType);break}}return{failedFolderIds:s,failedDocumentIds:t,failedOrganizationId:o,folderAccessTypes:i,documentAccessTypes:c}}fetchUserPermissionsFromDB(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:t}=e,o=[this.authService.getUser()?.userId??""],i=[...r.map(n=>_(n)),...s.map(n=>T(n)),t??""],[c,a]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:o,organizationId:t}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:o,organizationId:t,resourceIds:i})]);return[c.status==="fulfilled"?c.value:[],a.status==="fulfilled"?a.value:[]]})}buildPermissionsResponse(e,r,s,t){let{folderIds:o,documentIds:i,clientOrganizationId:c,organizationId:a}=e,{failedFolderIds:n,failedDocumentIds:d,failedOrganizationId:h}=r,l={};return this.processRegularUserPermissions(l,s,o,i,c??"",a??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.ensureCurrentUserFailuresRecorded(l,c??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.processTemporaryUserPermissions(l,t),this.processContextPermissions(l),l}processContextPermissions(e){try{let r=this.authService.getUser()?.userId;if(r){let s=this.contactService.getUserAccessFieldsByUserId(r);s?.length&&(e[r]||(e[r]={}),e[r].context={accessFields:s})}}catch(r){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",r);return}}processRegularUserPermissions(e,r,s,t,o,i,c,a,n,d,h,l){for(let m of r)for(let O of m)O?.user?.userId&&(e[O.user.userId]=y(f({},s.length&&{folders:this.buildFolderPermissions(s,O,c,d,l)}),{documents:this.buildDocumentPermissions(t,O,a,h,l),organization:{[o]:this.buildOrganizationPermission(i,O,n)}}))}ensureCurrentUserFailuresRecorded(e,r,s,t,o,i,c,a){try{let n=this.authService.getUser()?.userId;if(!n)return;let d=!!o&&!!r,h=(s?.length??0)>0,l=(t?.length??0)>0;if(!d&&!h&&!l)return;if(e[n]||(e[n]={}),d&&(e[n].organization||(e[n].organization={}),e[n].organization[r]||(e[n].organization[r]={error:this.getErrorMessage(o.errorCode,"organization"),errorCode:o.errorCode})),h){e[n].folders||(e[n].folders={});for(let m of s)e[n].folders[m.id]||(e[n].folders[m.id]=f({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===u.PERMISSION_DENIED&&{accessType:i[m.id]??a??C}))}if(l){e[n].documents||(e[n].documents={});for(let m of t)e[n].documents[m.id]||(e[n].documents[m.id]=f({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===u.PERMISSION_DENIED&&{accessType:c[m.id]??a??C}))}}catch(n){this.loggingService.catch("Error in UserPermissionService ensureCurrentUserFailuresRecorded:",n)}}getErrorMessage(e,r){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${r}`),e){case u.DOES_NOT_EXIST:return`${r} does not exist`;case u.PERMISSION_DENIED:return`User does not have access to ${r}`;case u.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(s){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",s),"Something went wrong"}}buildFolderPermissions(e,r,s,t,o){return e.reduce((i,c)=>{let a=s.find(n=>n.id===c);return a?i[c]=f({error:this.getErrorMessage(a.errorCode,"folder"),errorCode:a.errorCode},a.errorCode===u.PERMISSION_DENIED&&{accessType:t[c]??o??C}):i[c]={accessRole:r.viewerFolderIds?.includes(_(c))?E.VIEWER:E.EDITOR,accessType:t[c]??o??C},i},{})}buildDocumentPermissions(e,r,s,t,o){return e.reduce((i,c)=>{let a=s.find(n=>n.id===c);return a?i[c]=f({error:this.getErrorMessage(a.errorCode,"document"),errorCode:a.errorCode},a.errorCode===u.PERMISSION_DENIED&&{accessType:t[c]??o??C}):i[c]={accessRole:r.viewerDocumentIds?.includes(T(c))?E.VIEWER:E.EDITOR,accessType:t[c]??o??C},i},{})}buildOrganizationPermission(e,r,s){return s?{error:this.getErrorMessage(s.errorCode,"organization"),errorCode:s.errorCode}:{accessRole:r.viewerOrganizationIds?.includes(e)?E.VIEWER:E.EDITOR}}processTemporaryUserPermissions(e,r){for(let s of r)if(s?.userId)switch(this.ensureUserPermissionStructure(e,s.userId),s.type){case"folder":this.addTemporaryFolderPermission(e,s);break;case"document":this.addTemporaryDocumentPermission(e,s);break;case"organization":this.addTemporaryOrganizationPermission(e,s);break}}ensureUserPermissionStructure(e,r){e[r]||(e[r]={})}addTemporaryFolderPermission(e,r){let{userId:s,resourceId:t,role:o,expiresAt:i}=r;e[s].folders||(e[s].folders={}),e[s].folders[t]={accessRole:o??E.EDITOR,expiresAt:i}}addTemporaryDocumentPermission(e,r){let{userId:s,resourceId:t,role:o,expiresAt:i}=r;e[s].documents||(e[s].documents={}),e[s].documents[t]={accessRole:o??E.EDITOR,expiresAt:i}}addTemporaryOrganizationPermission(e,r){let{userId:s,resourceId:t,role:o,expiresAt:i}=r;e[s].organization||(e[s].organization={}),e[s].organization[t]={accessRole:o??E.EDITOR,expiresAt:i}}hasEditAccess({organizationId:e,folderId:r,documentId:s}){try{let t=!0,o=this.getCurrentUserPermissionsWithServerIds(),i=this.authService.getUser()?.userId??"";return o&&(e&&typeof e=="string"&&o?.[i]?.organization?.[e]&&(o?.[i]?.organization?.[e]?.accessRole===E.VIEWER||o?.[i]?.organization?.[e]?.errorCode===u.PERMISSION_DENIED)&&(t=!1),r&&typeof r=="string"&&o?.[i]?.folders?.[r]&&(o?.[i]?.folders?.[r]?.accessRole===E.VIEWER||o?.[i]?.folders?.[r]?.errorCode===u.PERMISSION_DENIED)&&(t=!1),s&&typeof s=="string"&&o?.[i]?.documents?.[s]&&(o?.[i]?.documents?.[s]?.accessRole===E.VIEWER||o?.[i]?.documents?.[s]?.errorCode===u.PERMISSION_DENIED)&&(t=!1)),t}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(b(z))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let r=JSON.parse(JSON.stringify(e??{})),s=this.authService.getUser()?.userId??"";if(r?.[s]){let t=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(r?.[s]?.organization?.[t]){let o=N(t);r[s].organization&&(r[s].organization[o]=r[s].organization[t],delete r[s].organization[t])}r?.[s]?.folders&&(r[s].folders=Object.fromEntries(Object.entries(r?.[s]?.folders??{}).map(([o,i])=>[_(o),i]))),r?.[s]?.documents&&(r[s].documents=Object.fromEntries(Object.entries(r?.[s]?.documents??{}).map(([o,i])=>[T(o),i])))}return r}catch(r){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",r),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(x(e=>this.refactorPermissionsWithServerIds(e)),b(z))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let r=null;e&&(r=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(r)}catch(r){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",r)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.permissionProvider$.next(e)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",r)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return g(this,null,function*(){let e=F();try{if(this.isRevokeAccessOnUserLogoutEnabled){let r=[],s=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(o=>{o.userId===s&&o.hasAccess&&(o.type===p.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&r.push(y(f({},o),{hasAccess:!1})):r.push(y(f({},o),{hasAccess:!1})))}),r.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}}),this.setPermissionsCache([]),this.clearRequestKeyedPermissionsCache(),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}});let o=yield this.revokeAccess({requests:r,userId:this.authService.getUser()?.userId??""});o.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:o,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:o,success:!1,statusCode:500}}})}}}catch(r){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:r}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",r)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(r){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",r),""}}cancelPendingRevokes(e){try{e.forEach(r=>{let s=this.getRevokeKey({userId:r.userId,resourceId:r.resource.id,type:r.resource.type,organizationId:r.resource.organizationId});this.pendingRevokeRequests.has(s)&&this.pendingRevokeRequests.delete(s)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(r){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",r)}}flushPendingRevokes(){return g(this,null,function*(){let e=this.pendingRevokeUniqueId,r=this.pendingRevokeUserId;try{let s=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",s.length===0)return;let t=this.getPermissionsCache()??[];s.forEach(c=>{t=t.filter(a=>!(a.resourceId===c.resourceId&&a.type===c.type&&a.organizationId===c.organizationId&&a.userId===c.userId))}),this.setPermissionsCache(t);let o=this.docService.getDocContext(),i=yield this.revokeAccess({requests:s,userId:r,currentContext:o});i.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:i,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:i,success:!1,statusCode:500}}})}catch(s){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:s}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",s)}})}revokeAccessOnDocumentUnset(t){return g(this,arguments,function*({documentIds:e,folderId:r,context:s}){let o=F();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let i=[],c=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.authService.getUser()?.userId??"",n=this.getPermissionsCache()??[];e.forEach(d=>{n=this.collectRevokeRequest(n,i,d.clientDocumentId,p.DOCUMENT,c,a)}),r&&(n=this.collectRevokeRequest(n,i,r,p.FOLDER,c,a)),c&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(n=this.collectRevokeRequest(n,i,c,p.ORGANIZATION,c,a)),s&&this.getIsContextEnabled()&&X({input:s}).forEach(h=>{let l=JSON.stringify(h.access);n=this.collectRevokeRequest(n,i,l,p.CONTEXT,c,a)}),this.setPermissionsCache(n),i.length>0&&(this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:i}}),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:o,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:i}}),i.forEach(d=>{this.pendingRevokeRequests.set(this.getRevokeKey(d),d)}),this.pendingRevokeUniqueId=o,this.pendingRevokeUserId=a,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(i){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:o,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:i}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",i)}})}getAccess(s){return g(this,arguments,function*({requests:e,userId:r}){let t={retryConfig:this.getPermissionProviderRetryConfig()};return this.isClientDevResolverActive()?t.clientResolvedResults=yield this.resolveClientSide(e):this.getPermissionProvider()?.dev&&this.warnNoResolverOnce(),this.sendGetAccessToProxy({requests:e,userId:r,metadata:t})})}sendGetAccessToProxy(t){return g(this,arguments,function*({requests:e,userId:r,metadata:s}){if(this.adapterSelectorService?.isPortableBackendActive())return this.sendGetAccessToPortableGateway({requests:e});let o=$(this.functions,V({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield G({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:s},getSdkProxy:o,userId:r})})}sendGetAccessToPortableGateway(r){return g(this,arguments,function*({requests:e}){try{let s=this.adapterSelectorService.resolveDbAdapter(),t=[];for(let o=0;o<e.length;o+=w){let i=e.slice(o,o+w),c=yield s.getAccess({scope:"org",data:i.map(n=>({userId:n.userId,resource:{id:n.resource?.id,type:n.resource?.type,organizationId:n.resource?.organizationId}}))});if(!c?.ok){let n=c?.code;return this.loggingService.catch("Tier B getAccess denied/failed at the gateway: ",c),{data:[],success:!1,statusCode:this.denialCodeToStatusCode(n)}}let a=c.data?.data??[];t.push(...this.dropUnrequestedEntries(a,i))}return{data:this.skipNotProvidedFolderEntries(t),success:!0,statusCode:200}}catch(s){return this.loggingService.catch("Error in UserPermissionService sendGetAccessToPortableGateway: ",s),{data:[],success:!1,statusCode:500}}})}skipNotProvidedFolderEntries(e){try{this.reportUnrecognizedFolderErrorCodes(e);let r=e.filter(s=>!(s?.type===p.FOLDER&&s?.errorCode==="not_provided"));return r.length!==e.length&&this.loggingService.log(`[WB] Tier B getAccess: ${e.length-r.length} folder answer(s) skipped (errorCode 'not_provided' \u2014 folder subsystem not provisioned on this gateway)`),r}catch(r){return this.loggingService.catch("Error in UserPermissionService skipNotProvidedFolderEntries: ",r),e}}dropUnrequestedEntries(e,r){try{if(!e?.length)return e??[];let s=i=>`${i?.userId}|${i?.resourceId}|${i?.organizationId}|${i?.type}`,t=new Set((r??[]).map(i=>`${i?.userId}|${i?.resource?.id}|${i?.resource?.organizationId}|${i?.resource?.type}`)),o=e.filter(i=>t.has(s(i)));return o.length!==e.length&&this.loggingService.catch("Tier B getAccess returned entries that were not requested \u2014 dropped before the permissions cache: ",e.filter(i=>!t.has(s(i))),void 0,!0),o}catch(s){return this.loggingService.catch("Error in UserPermissionService dropUnrequestedEntries: ",s),e}}reportUnrecognizedFolderErrorCodes(e){try{for(let r of e??[]){let s=r?.errorCode;!s||r?.type!==p.FOLDER||s==="not_provided"||this.reportedUnknownFolderErrorCodes.has(s)||(this.reportedUnknownFolderErrorCodes.add(s),console.warn(`Velt [portable backend]: a folder permission entry carried an unrecognised errorCode '${s}'. It is being consumed verbatim (hasAccess is honoured as sent). If your gateway means the folder subsystem is not provisioned, the expected literal is the exact lowercase 'not_provided' \u2014 anything else reads as a REAL denial and will withhold folder-scoped access.`))}}catch(r){this.loggingService.catch("Error in UserPermissionService reportUnrecognizedFolderErrorCodes: ",r)}}denialCodeToStatusCode(e){switch(e){case"unauthenticated":return 401;case"permission-denied":return 403;case"not-found":return 404;case"invalid-argument":return 400;case"failed-precondition":return 412;case"resource-exhausted":return 429;case"unimplemented":return 501;default:return 500}}isClientDevResolverActive(){return!!this.getPermissionProvider()?.dev&&this.isClientDevResolverConfigured()}resolveClientSidePermissions(e){return g(this,null,function*(){if(!this.isClientDevResolverActive())throw new Error("Client-side dev permission resolver is not active");return this.resolveClientSide(e)})}isClientDevResolverConfigured(){let e=this.getPermissionProvider();return e?!!e.endpointConfig?.url?.trim()||typeof e.resolvePermissions=="function":!1}resolveClientSide(e){return g(this,null,function*(){this.warnClientResolverEnabledOnce();let r=this.getPermissionProvider(),s=this.getPermissionProviderRetryConfig(),t=r?.resolveTimeout??6e4,o=yield j(()=>this.withResolverTimeout(()=>this.invokeResolver(e,r),t),"clientPermissionResolver",{retryCount:s?.retryCount??0,retryDelay:s?.retryDelay??0});if(!o||!o.success||o.statusCode!==200)throw new Error(o?.message??"Client permission resolver failed");let i=o.data;if(!Array.isArray(i))throw new Error("Client permission resolver returned a malformed payload");return i})}invokeResolver(e,r){return g(this,null,function*(){let s={data:{requests:e}},t=r.endpointConfig?.url?.trim();if(t)return J(t,r.endpointConfig?.headers,s,!0,r.endpointConfig?.credentials);let o=yield r.resolvePermissions(s);if(Array.isArray(o))return{data:o,success:!0,statusCode:200};let i=o,c=i?.statusCode??(i?.success===!1?500:200),a=i?.success!==!1&&c===200;return{data:Array.isArray(i?.data)?i.data:void 0,success:a,statusCode:a?200:c===200?500:c,message:i?.message}})}withResolverTimeout(e,r){return g(this,null,function*(){if(!r||r<=0)return e();let s,t=new Promise((o,i)=>{s=setTimeout(()=>i(new Error("Client permission resolver timed out")),r)});try{return yield Promise.race([e(),t])}finally{s&&clearTimeout(s)}})}warnClientResolverEnabledOnce(){this.clientResolverProdWarned||(this.clientResolverProdWarned=!0,console.warn("[Velt] Client-side dev permission resolver is enabled (dev: true). Permissions are resolved in the browser for local development only \u2014 DO NOT use this in production. Production API keys ignore browser-resolved results and fall back to the server-side permission provider."))}warnNoResolverOnce(){this.clientResolverNoResolverWarned||(this.clientResolverNoResolverWarned=!0,console.warn("[Velt] setPermissionProvider was called with dev: true but no endpointConfig.url or resolvePermissions callback was provided. Falling back to the server-side permission provider."))}revokeAccess(t){return g(this,arguments,function*({requests:e,userId:r,currentContext:s}){if(this.adapterSelectorService?.isPortableBackendActive())return this.sendRevokeAccessToPortableGateway({requests:e});let o=$(this.functions,V({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield G({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:f({retryConfig:this.getPermissionProviderRetryConfig()},s?.access&&{currentContext:s})},getSdkProxy:o,userId:r})})}sendRevokeAccessToPortableGateway(r){return g(this,arguments,function*({requests:e}){try{let s=this.adapterSelectorService.resolveDbAdapter();for(let t=0;t<e.length;t+=w){let o=e.slice(t,t+w),i=yield s.revokeAccess({scope:"org",data:o.map(c=>({userId:c.userId,resourceId:c.resourceId,type:c.type,organizationId:c.organizationId}))});if(!i?.ok)return this.loggingService.catch("Tier B revokeAccess denied/failed at the gateway: ",i),{success:!1}}return{success:!0}}catch(s){return this.loggingService.catch("Error in UserPermissionService sendRevokeAccessToPortableGateway: ",s),{success:!1}}})}onResourceAccessRequired(i){return g(this,arguments,function*({requests:e,uniqueId:r,methodName:s,userId:t,fromCache:o=!0}){try{if(!e?.length)return;let c=[],a=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&o&&(e.forEach(n=>{let d=a?.find(h=>h.resourceId===n.resource.id&&h.type===n.resource.type&&h.userId===n.userId&&h.organizationId===n.resource.organizationId);d&&c.push(d)}),c.length>0&&(e=e.filter(n=>!c.find(d=>d.resourceId===n.resource.id&&d.type===n.resource.type&&d.userId===n.userId&&d.organizationId===n.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{requests:e,fromCache:o,clientResolved:this.isClientDevResolverActive()}});let n=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??t??""});return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{result:n,clientResolved:this.isClientDevResolverActive()}}),n?.success&&n?.data?.length&&(this.setPermissionsCache([...a,...n.data]),n.data=[...c,...n.data]),n}else if(c.length>0)return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{results:{data:c,success:!0,statusCode:200}}}),{data:c,success:!0,statusCode:200};return}catch(c){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",c),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{error:c,requests:e,fromCache:o}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let r=new Map;e.forEach(t=>{let o=`${t.userId}_${t.resourceId}_${t.organizationId}_${t.type}`;r.set(o,t)});let s=JSON.parse(JSON.stringify(Array.from(r.values())));this.permissionsCache$.next(s)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",r)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};I.\u0275fac=function(r){return new(r||I)(R(ee),R(re),R(H),R(ne),R(ie),R(oe),R(q),R(W),R(Y),R(ce))},I.\u0275prov=K({token:I,factory:I.\u0275fac,providedIn:"root"});let k=I;return k})();export{Ne as a};
1
+ import{Fa as ce}from"./chunk-RQWK7TC4.js";import{e as re,j as se,k as te,l as ie,m as oe,t as ne}from"./chunk-PAXX26WX.js";import{$f as N,$h as X,He as D,M as b,Pf as E,Qd as W,Qf as u,Ti as H,Uh as z,Ui as Y,Xh as j,Yf as L,Yh as J,Yi as Z,Zf as T,a as f,ag as _,b as y,ba as K,bi as G,di as V,ea as R,ee as v,fa as M,g,hg as B,ji as S,ki as $,l as A,rg as F,rj as Q,sf as U,tf as P,uf as p,uj as q,v as x,xj as ee}from"./chunk-TUKJVGIT.js";var C="public",w=100,Ne=(()=>{let I=class I{constructor(e,r,s,t,o,i,c,a,n,d){this.authService=e,this.docService=r,this.loggingService=s,this.commonDbService=t,this.usersService=o,this.commentUtilsService=i,this.coreActionsService=c,this.functions=a,this.configService=n,this.contactService=d,this.endpointsService=M(Z),this.adapterSelectorService=M(Q),this.currentUserPermissions$=new A(null),this.permissionsCache$=new A(null),this.permissionProvider$=new A(null),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.requestKeyedPermissionsCache=new Map,this.inFlightPermissionsRequests=new Map,this.permissionsCacheGeneration=0,this.REVOKE_DELAY_MS=3e3,this.pendingRevokeRequests=new Map,this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",this.reportedUnknownFolderErrorCodes=new Set;try{this.docService.setUserPermissionService(this),this.authService.setUserPermissionService(this),this.commentUtilsService.setUserPermissionService(this),this.contactService.setUserPermissionService(this)}catch(h){this.loggingService.catch("Error in UserPermissionService constructor:",h)}}ngOnDestroy(){try{this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(e){this.loggingService.catch("Error in UserPermissionService ngOnDestroy:",e)}}collectRevokeRequest(e,r,s,t,o,i){try{return e.find(a=>a.resourceId===s&&a.type===t&&a.organizationId===o&&a.userId===i)?(r.push({userId:i,resourceId:s,organizationId:o,type:t,hasAccess:!1}),e.filter(a=>!(a.resourceId===s&&a.type===t&&a.organizationId===o&&a.userId===i))):e}catch(c){return this.loggingService.catch("Error in UsersPermissionService collectRevokeRequest:",c),e}}hasUserContextAccess({userId:e,accessFields:r}){try{if(!this.getIsContextEnabled()||r.includes(D.DEFAULT_VELT_CONTEXT))return!0;let s=r.filter(o=>!B(o));if(!s.length){if(r.some(c=>c.startsWith(D.VISIBILITY_ORG_PREFIX)))return!0;let i=`${D.VISIBILITY_SELF_PREFIX}${L(e).toString()}`;return r.includes(i)}let t=this.contactService.getUserAccessFieldsByUserId(e);return t?.length?s.every(o=>t.includes(o)):!0}catch(s){return this.loggingService.catch("Error in UserPermissionService hasUserContextAccess:",s),!1}}isMetadataProbeUnanswerable(e){try{return this.adapterSelectorService?.isPortableBackendActive()?!se(e)&&!te(e):!1}catch(r){return this.loggingService.catch("Error in UserPermissionService isMetadataProbeUnanswerable: ",r),!1}}organizationDetails(e){return g(this,null,function*(){try{if(this.isMetadataProbeUnanswerable("organizationMetadata"))return{error:!1};let r=yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{organizationId:e,suppressError:!0}});return r&&r?.errorCode?{errorCode:u.PERMISSION_DENIED,error:!0}:r&&!r?.metadata?{errorCode:u.DOES_NOT_EXIST,error:!0}:{error:!1}}catch(r){return this.loggingService.catch("Error in UserPermissionService organizationDetails:",r),{errorCode:u.SOMETHING_WENT_WRONG,error:!0}}})}documentDetails(s){return g(this,arguments,function*({documentId:e,organizationId:r}){try{if(this.isMetadataProbeUnanswerable("documentMetadata"))return{error:!1};let t=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:e,organizationId:r,suppressError:!0}});if(t&&t?.errorCode)return{errorCode:u.PERMISSION_DENIED,error:!0};if(t&&!t?.metadata)return{errorCode:u.DOES_NOT_EXIST,error:!0};let o=this.docService.getDocumentMetadata(e)??{};this.docService.setDocumentMetadata(e,f(f({},o),t?.metadata??{}));let i,c=t?.metadata?.veltFolderId;if(c)try{i=(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:c,organizationId:r}}))?.folderIamConfig?.accessType}catch(a){this.loggingService.catch("Error fetching folder accessType for document:",a)}return i||(i=t?.docIamConfig?.accessType),{error:!1,accessType:i}}catch(t){return this.loggingService.catch("Error in UserPermissionService documentDetails:",t),{errorCode:u.SOMETHING_WENT_WRONG,error:!0}}})}folderDetails(s){return g(this,arguments,function*({folderId:e,organizationId:r}){try{if(this.isMetadataProbeUnanswerable("folderMetadata"))return{error:!1};let t=yield this.commonDbService?.getData({feature:"folderMetadata",properties:{folderId:e,organizationId:r,suppressError:!0}});return t&&t?.errorCode?{errorCode:u.PERMISSION_DENIED,error:!0}:t&&!t?.metadata?{errorCode:u.DOES_NOT_EXIST,error:!0}:{error:!1,accessType:t?.folderIamConfig?.accessType}}catch(t){return this.loggingService.catch("Error in UserPermissionService folderDetails:",t),{errorCode:u.SOMETHING_WENT_WRONG,error:!0}}})}getUserPermissions(e){return g(this,null,function*(){let r=this.permissionsCacheGeneration;try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getUserPermissions]",void 0,void 0,!0),{};let s=this.authService.getUser()?.userId,t=this.extractResourceIds(e);if(!t.clientOrganizationId||!t.organizationId)return this.loggingService.catch("Client organization id or organization id not set during getUserPermissions",void 0,void 0,!0),{};let o=yield this.validateResources(t),[i,c]=yield this.fetchUserPermissionsFromDB(t),a=this.authService.getUser()?.userId;if(s!==a)return{};let n=this.buildPermissionsResponse(t,o,i,c);if(Object.keys(n).length>0){if(!e)this.setCurrentUserPermissions(n);else if(this.permissionsCacheGeneration===r){let d=this.buildPermissionsCacheKey(e);d!==null&&this.requestKeyedPermissionsCache.set(d,JSON.parse(JSON.stringify(n)))}}return n}catch(s){return this.loggingService.catch("Error in UserPermissionService getUserPermissions:",s),{}}})}getUserPermissionsFromCacheOrFetch(e){return g(this,null,function*(){try{if(!e)return yield this.getUserPermissions(e);let r=this.buildPermissionsCacheKey(e);if(r===null)return yield this.getUserPermissions(e);let s=this.permissionsCacheGeneration,t=this.requestKeyedPermissionsCache.get(r);if(t)return JSON.parse(JSON.stringify(t));let o=this.inFlightPermissionsRequests.get(r);if(o){let a=yield o;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(a))}let i=this.getUserPermissions(e);this.inFlightPermissionsRequests.set(r,i),i.finally(()=>{this.inFlightPermissionsRequests.get(r)===i&&this.inFlightPermissionsRequests.delete(r)}).catch(()=>{});let c=yield i;return this.permissionsCacheGeneration!==s?yield this.getUserPermissions(e):JSON.parse(JSON.stringify(c))}catch(r){return this.loggingService.catch("Error in UserPermissionService getUserPermissionsFromCacheOrFetch:",r),{}}})}clearRequestKeyedPermissionsCache(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService clearRequestKeyedPermissionsCache:",e)}}invalidateAllPermissionsState(){try{this.requestKeyedPermissionsCache.clear(),this.inFlightPermissionsRequests.clear(),this.permissionsCacheGeneration++}catch(e){this.loggingService.catch("Error in UserPermissionService invalidateAllPermissionsState:",e)}}buildPermissionsCacheKey(e){try{let r={};return Object.keys(e).sort().forEach(s=>{let t=e[s];t!==void 0&&(r[s]=Array.isArray(t)?[...t].sort():t)}),r.__userId=this.authService.getUser()?.userId??null,JSON.stringify(r)}catch(r){return this.loggingService.catch("Error in UserPermissionService buildPermissionsCacheKey:",r),null}}extractResourceIds(e){let r=this.docService.getDocumentPaths(),s=this.docService.getDocumentIds();if(e){let i=e.organizationId??r?.clientOrganizationId;return{folderIds:e.folderIds??[],documentIds:e.documentIds??[],clientOrganizationId:i,organizationId:i?N(i):void 0}}let t=r?.clientOrganizationId;return{folderIds:r?.folderId?[r.folderId]:[],documentIds:s.map(i=>i.clientDocumentId),clientOrganizationId:t,organizationId:t?N(t):void 0}}validateResources(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:t,clientOrganizationId:o}=e,i=[],c=[],a=r.length>0||s.length>0;t&&!a&&(i.push(this.organizationDetails(t)),c.push({id:o??"",type:"organization"})),r.forEach(l=>{i.push(this.folderDetails({folderId:_(l),organizationId:t??""})),c.push({id:l,type:"folder"})}),s.forEach(l=>{i.push(this.documentDetails({documentId:T(l),organizationId:t??""})),c.push({id:l,type:"document"})});let[n,d]=yield Promise.all([Promise.allSettled(i),this.getDefaultDocumentAccessType()]),h=this.processValidationResults(n,c);return y(f({},this.suppressResolverGrantedFailures(h,o)),{defaultDocumentAccessType:d})})}suppressResolverGrantedFailures(e,r){try{let s=this.authService.getUser()?.userId;if(!s)return e;let t=this.getPermissionsCache()??[];if(t.length===0)return e;let o=(n,d,h)=>t.some(l=>l?.userId===s&&l?.resourceId===n&&l?.type===d&&(!h||l?.organizationId===h)&&l?.hasAccess===!0),i=e.failedDocumentIds.filter(n=>!(n.errorCode===u.PERMISSION_DENIED&&o(n.id,p.DOCUMENT,r))),c=e.failedFolderIds.filter(n=>!(n.errorCode===u.PERMISSION_DENIED&&o(n.id,p.FOLDER,r))),a=e.failedOrganizationId;return a&&a.errorCode===u.PERMISSION_DENIED&&r&&o(r,p.ORGANIZATION,r)&&(a=void 0),{failedFolderIds:c,failedDocumentIds:i,failedOrganizationId:a,folderAccessTypes:e.folderAccessTypes,documentAccessTypes:e.documentAccessTypes}}catch(s){return this.loggingService.catch("Error in UserPermissionService suppressResolverGrantedFailures:",s),e}}getDefaultDocumentAccessType(){return g(this,null,function*(){try{return(yield this.commonDbService?.getData({feature:"apiKeyMetadata",properties:{}}))?.defaultDocumentAccessType}catch(e){this.loggingService.catch("Error fetching defaultDocumentAccessType:",e);return}})}processValidationResults(e,r){let s=[],t=[],o,i={},c={};for(let a=0;a<e.length;a++){let n=e[a],d=r[a];if(n.status==="rejected"||n.status==="fulfilled"&&n.value.error){let l=n.status==="fulfilled"?n.value.errorCode??u.SOMETHING_WENT_WRONG:u.SOMETHING_WENT_WRONG,m={id:d.id,errorCode:l};switch(d.type){case"organization":if(o=m,l===u.DOES_NOT_EXIST)throw new Error(`Organization with id '${d.id}' does not exist`);break;case"folder":s.push(m);break;case"document":t.push(m);break}}else if(n.status==="fulfilled")switch(d.type){case"folder":n.value.accessType&&(i[d.id]=n.value.accessType);break;case"document":n.value.accessType&&(c[d.id]=n.value.accessType);break}}return{failedFolderIds:s,failedDocumentIds:t,failedOrganizationId:o,folderAccessTypes:i,documentAccessTypes:c}}fetchUserPermissionsFromDB(e){return g(this,null,function*(){let{folderIds:r,documentIds:s,organizationId:t}=e,o=[this.authService.getUser()?.userId??""],i=[...r.map(n=>_(n)),...s.map(n=>T(n)),t??""],[c,a]=yield Promise.allSettled([this.usersService.getUsersFromDBWithBatching({userIds:o,organizationId:t}),this.usersService.getTemporaryUsersFromDBWithBatching({userIds:o,organizationId:t,resourceIds:i})]);return[c.status==="fulfilled"?c.value:[],a.status==="fulfilled"?a.value:[]]})}buildPermissionsResponse(e,r,s,t){let{folderIds:o,documentIds:i,clientOrganizationId:c,organizationId:a}=e,{failedFolderIds:n,failedDocumentIds:d,failedOrganizationId:h}=r,l={};return this.processRegularUserPermissions(l,s,o,i,c??"",a??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.ensureCurrentUserFailuresRecorded(l,c??"",n,d,h,r.folderAccessTypes,r.documentAccessTypes,r.defaultDocumentAccessType),this.processTemporaryUserPermissions(l,t),this.processContextPermissions(l),l}processContextPermissions(e){try{let r=this.authService.getUser()?.userId;if(r){let s=this.contactService.getUserAccessFieldsByUserId(r);s?.length&&(e[r]||(e[r]={}),e[r].context={accessFields:s})}}catch(r){this.loggingService.catch("Error in UserPermissionService processContextPermissions:",r);return}}processRegularUserPermissions(e,r,s,t,o,i,c,a,n,d,h,l){for(let m of r)for(let O of m)O?.user?.userId&&(e[O.user.userId]=y(f({},s.length&&{folders:this.buildFolderPermissions(s,O,c,d,l)}),{documents:this.buildDocumentPermissions(t,O,a,h,l),organization:{[o]:this.buildOrganizationPermission(i,O,n)}}))}ensureCurrentUserFailuresRecorded(e,r,s,t,o,i,c,a){try{let n=this.authService.getUser()?.userId;if(!n)return;let d=!!o&&!!r,h=(s?.length??0)>0,l=(t?.length??0)>0;if(!d&&!h&&!l)return;if(e[n]||(e[n]={}),d&&(e[n].organization||(e[n].organization={}),e[n].organization[r]||(e[n].organization[r]={error:this.getErrorMessage(o.errorCode,"organization"),errorCode:o.errorCode})),h){e[n].folders||(e[n].folders={});for(let m of s)e[n].folders[m.id]||(e[n].folders[m.id]=f({error:this.getErrorMessage(m.errorCode,"folder"),errorCode:m.errorCode},m.errorCode===u.PERMISSION_DENIED&&{accessType:i[m.id]??a??C}))}if(l){e[n].documents||(e[n].documents={});for(let m of t)e[n].documents[m.id]||(e[n].documents[m.id]=f({error:this.getErrorMessage(m.errorCode,"document"),errorCode:m.errorCode},m.errorCode===u.PERMISSION_DENIED&&{accessType:c[m.id]??a??C}))}}catch(n){this.loggingService.catch("Error in UserPermissionService ensureCurrentUserFailuresRecorded:",n)}}getErrorMessage(e,r){try{switch(this.loggingService.log(`Error in UserPermissionService getErrorMessage: ${e} ${r}`),e){case u.DOES_NOT_EXIST:return`${r} does not exist`;case u.PERMISSION_DENIED:return`User does not have access to ${r}`;case u.SOMETHING_WENT_WRONG:return"Something went wrong";default:return"Something went wrong"}}catch(s){return this.loggingService.catch("Error in UserPermissionService getErrorMessage:",s),"Something went wrong"}}buildFolderPermissions(e,r,s,t,o){return e.reduce((i,c)=>{let a=s.find(n=>n.id===c);return a?i[c]=f({error:this.getErrorMessage(a.errorCode,"folder"),errorCode:a.errorCode},a.errorCode===u.PERMISSION_DENIED&&{accessType:t[c]??o??C}):i[c]={accessRole:r.viewerFolderIds?.includes(_(c))?E.VIEWER:E.EDITOR,accessType:t[c]??o??C},i},{})}buildDocumentPermissions(e,r,s,t,o){return e.reduce((i,c)=>{let a=s.find(n=>n.id===c);return a?i[c]=f({error:this.getErrorMessage(a.errorCode,"document"),errorCode:a.errorCode},a.errorCode===u.PERMISSION_DENIED&&{accessType:t[c]??o??C}):i[c]={accessRole:r.viewerDocumentIds?.includes(T(c))?E.VIEWER:E.EDITOR,accessType:t[c]??o??C},i},{})}buildOrganizationPermission(e,r,s){return s?{error:this.getErrorMessage(s.errorCode,"organization"),errorCode:s.errorCode}:{accessRole:r.viewerOrganizationIds?.includes(e)?E.VIEWER:E.EDITOR}}processTemporaryUserPermissions(e,r){for(let s of r)if(s?.userId)switch(this.ensureUserPermissionStructure(e,s.userId),s.type){case"folder":this.addTemporaryFolderPermission(e,s);break;case"document":this.addTemporaryDocumentPermission(e,s);break;case"organization":this.addTemporaryOrganizationPermission(e,s);break}}ensureUserPermissionStructure(e,r){e[r]||(e[r]={})}addTemporaryFolderPermission(e,r){let{userId:s,resourceId:t,role:o,expiresAt:i}=r;e[s].folders||(e[s].folders={}),e[s].folders[t]={accessRole:o??E.EDITOR,expiresAt:i}}addTemporaryDocumentPermission(e,r){let{userId:s,resourceId:t,role:o,expiresAt:i}=r;e[s].documents||(e[s].documents={}),e[s].documents[t]={accessRole:o??E.EDITOR,expiresAt:i}}addTemporaryOrganizationPermission(e,r){let{userId:s,resourceId:t,role:o,expiresAt:i}=r;e[s].organization||(e[s].organization={}),e[s].organization[t]={accessRole:o??E.EDITOR,expiresAt:i}}hasEditAccess({organizationId:e,folderId:r,documentId:s}){try{let t=!0,o=this.getCurrentUserPermissionsWithServerIds(),i=this.authService.getUser()?.userId??"";return o&&(e&&typeof e=="string"&&o?.[i]?.organization?.[e]&&(o?.[i]?.organization?.[e]?.accessRole===E.VIEWER||o?.[i]?.organization?.[e]?.errorCode===u.PERMISSION_DENIED)&&(t=!1),r&&typeof r=="string"&&o?.[i]?.folders?.[r]&&(o?.[i]?.folders?.[r]?.accessRole===E.VIEWER||o?.[i]?.folders?.[r]?.errorCode===u.PERMISSION_DENIED)&&(t=!1),s&&typeof s=="string"&&o?.[i]?.documents?.[s]&&(o?.[i]?.documents?.[s]?.accessRole===E.VIEWER||o?.[i]?.documents?.[s]?.errorCode===u.PERMISSION_DENIED)&&(t=!1)),t}catch{return!0}}getCurrentUserPermissions$(){return this.currentUserPermissions$.asObservable().pipe(b(z))}getCurrentUserPermissions(){return this.currentUserPermissions$.value}refactorPermissionsWithServerIds(e){try{let r=JSON.parse(JSON.stringify(e??{})),s=this.authService.getUser()?.userId??"";if(r?.[s]){let t=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(r?.[s]?.organization?.[t]){let o=N(t);r[s].organization&&(r[s].organization[o]=r[s].organization[t],delete r[s].organization[t])}r?.[s]?.folders&&(r[s].folders=Object.fromEntries(Object.entries(r?.[s]?.folders??{}).map(([o,i])=>[_(o),i]))),r?.[s]?.documents&&(r[s].documents=Object.fromEntries(Object.entries(r?.[s]?.documents??{}).map(([o,i])=>[T(o),i])))}return r}catch(r){return this.loggingService.catch("Error in UsersPermissionService refactorPermissionsWithServerIds:",r),e}}getCurrentUserPermissionsWithServerIds$(){return this.currentUserPermissions$.asObservable().pipe(x(e=>this.refactorPermissionsWithServerIds(e)),b(z))}getCurrentUserPermissionsWithServerIds(){return this.refactorPermissionsWithServerIds(this.currentUserPermissions$.value)}setCurrentUserPermissions(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCurrentUserPermissions","color: green;");let r=null;e&&(r=JSON.parse(JSON.stringify(e))),this.currentUserPermissions$.next(r)}catch(r){this.loggingService.catch("Error in UsersPermissionService setCurrentUserPermissions:",r)}}getIsContextEnabled(){return this.loggingService.log("%c[WB] Calling FUNCTION: getIsContextEnabled","color: green;"),this.permissionProvider$.value?.isContextEnabled??!1}setPermissionProvider(e){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setPermissionProvider","color: green;"),this.clientResolverProdWarned=!1,this.clientResolverNoResolverWarned=!1,this.permissionProvider$.next(e)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionProvider:",r)}}get isRevokeAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET)??!1}get isRevokeAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT)??!1}get isRevokeOrganizationAccessOnUserLogoutEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.USER_LOGOUT&&e.revokeOrganizationAccess)??!1}get isRevokeOrganizationAccessOnDocumentUnsetEnabled(){return this.permissionProvider$.value?.revokeAccessOn?.some(e=>e.type===U.DOCUMENT_UNSET&&e.revokeOrganizationAccess)??!1}getPermissionProviderRetryConfig(){return this.permissionProvider$.value?.retryConfig??{retryCount:0,retryDelay:0}}revokeAccessOnUserLogout(){return g(this,null,function*(){let e=F();try{if(this.isRevokeAccessOnUserLogoutEnabled){let r=[],s=this.authService.getUser()?.userId??"";if((this.getPermissionsCache()??[]).forEach(o=>{o.userId===s&&o.hasAccess&&(o.type===p.ORGANIZATION?this.isRevokeOrganizationAccessOnUserLogoutEnabled&&r.push(y(f({},o),{hasAccess:!1})):r.push(y(f({},o),{hasAccess:!1})))}),r.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_FORMED,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}}),this.setPermissionsCache([]),this.clearRequestKeyedPermissionsCache(),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_TRIGGERED,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{requests:r}});let o=yield this.revokeAccess({requests:r,userId:this.authService.getUser()?.userId??""});o.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:o,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{result:{data:o,success:!1,statusCode:500}}})}}}catch(r){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_USER_LOGOUT_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_USER_LOGOUT,source:"internal",payload:{error:r}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnUserLogout:",r)}})}getRevokeKey(e){try{return`${e.userId}_${e.resourceId}_${e.type}_${e.organizationId}`}catch(r){return this.loggingService.catch("Error in UsersPermissionService getRevokeKey:",r),""}}cancelPendingRevokes(e){try{e.forEach(r=>{let s=this.getRevokeKey({userId:r.userId,resourceId:r.resource.id,type:r.resource.type,organizationId:r.resource.organizationId});this.pendingRevokeRequests.has(s)&&this.pendingRevokeRequests.delete(s)}),this.pendingRevokeRequests.size===0&&this.pendingRevokeTimeoutId&&(clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=null)}catch(r){this.loggingService.catch("Error in UsersPermissionService cancelPendingRevokes:",r)}}flushPendingRevokes(){return g(this,null,function*(){let e=this.pendingRevokeUniqueId,r=this.pendingRevokeUserId;try{let s=Array.from(this.pendingRevokeRequests.values());if(this.pendingRevokeRequests.clear(),this.pendingRevokeTimeoutId=null,this.pendingRevokeUniqueId="",this.pendingRevokeUserId="",s.length===0)return;let t=this.getPermissionsCache()??[];s.forEach(c=>{t=t.filter(a=>!(a.resourceId===c.resourceId&&a.type===c.type&&a.organizationId===c.organizationId&&a.userId===c.userId))}),this.setPermissionsCache(t);let o=this.docService.getDocContext(),i=yield this.revokeAccess({requests:s,userId:r,currentContext:o});i.success?this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_RESULT,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:i,success:!0,statusCode:200}}}):this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{result:{data:i,success:!1,statusCode:500}}})}catch(s){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:e,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:s}}),this.loggingService.catch("Error in UsersPermissionService flushPendingRevokes:",s)}})}revokeAccessOnDocumentUnset(t){return g(this,arguments,function*({documentIds:e,folderId:r,context:s}){let o=F();try{if(this.isRevokeAccessOnDocumentUnsetEnabled){let i=[],c=this.docService.getOrganizationConfig()?.clientOrganizationId??"",a=this.authService.getUser()?.userId??"",n=this.getPermissionsCache()??[];e.forEach(d=>{n=this.collectRevokeRequest(n,i,d.clientDocumentId,p.DOCUMENT,c,a)}),r&&(n=this.collectRevokeRequest(n,i,r,p.FOLDER,c,a)),c&&this.isRevokeOrganizationAccessOnDocumentUnsetEnabled&&(n=this.collectRevokeRequest(n,i,c,p.ORGANIZATION,c,a)),s&&this.getIsContextEnabled()&&X({input:s}).forEach(h=>{let l=JSON.stringify(h.access);n=this.collectRevokeRequest(n,i,l,p.CONTEXT,c,a)}),this.setPermissionsCache(n),i.length>0&&(this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:i}}),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_TRIGGERED,timestamp:new Date().getTime(),uniqueId:o,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{requests:i}}),i.forEach(d=>{this.pendingRevokeRequests.set(this.getRevokeKey(d),d)}),this.pendingRevokeUniqueId=o,this.pendingRevokeUserId=a,this.pendingRevokeTimeoutId&&clearTimeout(this.pendingRevokeTimeoutId),this.pendingRevokeTimeoutId=setTimeout(()=>this.flushPendingRevokes(),this.REVOKE_DELAY_MS))}}catch(i){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.REVOKE_ACCESS_ON_DOCUMENT_UNSET_ERROR,timestamp:new Date().getTime(),uniqueId:o,methodName:P.REVOKE_ACCESS_ON_DOCUMENT_UNSET,source:"internal",payload:{error:i}}),this.loggingService.catch("Error in UsersPermissionService revokeAccessOnDocumentUnset:",i)}})}getAccess(s){return g(this,arguments,function*({requests:e,userId:r}){let t={retryConfig:this.getPermissionProviderRetryConfig()};return this.isClientDevResolverActive()?t.clientResolvedResults=yield this.resolveClientSide(e):this.getPermissionProvider()?.dev&&this.warnNoResolverOnce(),this.sendGetAccessToProxy({requests:e,userId:r,metadata:t})})}sendGetAccessToProxy(t){return g(this,arguments,function*({requests:e,userId:r,metadata:s}){if(this.adapterSelectorService?.isPortableBackendActive())return this.sendGetAccessToPortableGateway({requests:e});let o=$(this.functions,V({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield G({methodName:"getAccess",data:{type:"getAccess",data:e,metadata:s},getSdkProxy:o,userId:r})})}sendGetAccessToPortableGateway(r){return g(this,arguments,function*({requests:e}){try{let s=this.adapterSelectorService.resolveDbAdapter(),t=[];for(let o=0;o<e.length;o+=w){let i=e.slice(o,o+w),c=yield s.getAccess({scope:"org",data:i.map(n=>({userId:n.userId,resource:{id:n.resource?.id,type:n.resource?.type,organizationId:n.resource?.organizationId}}))});if(!c?.ok){let n=c?.code;return this.loggingService.catch("Tier B getAccess denied/failed at the gateway: ",c),{data:[],success:!1,statusCode:this.denialCodeToStatusCode(n)}}let a=c.data?.data??[];t.push(...this.dropUnrequestedEntries(a,i))}return{data:this.skipNotProvidedFolderEntries(t),success:!0,statusCode:200}}catch(s){return this.loggingService.catch("Error in UserPermissionService sendGetAccessToPortableGateway: ",s),{data:[],success:!1,statusCode:500}}})}skipNotProvidedFolderEntries(e){try{this.reportUnrecognizedFolderErrorCodes(e);let r=e.filter(s=>!(s?.type===p.FOLDER&&s?.errorCode==="not_provided"));return r.length!==e.length&&this.loggingService.log(`[WB] Tier B getAccess: ${e.length-r.length} folder answer(s) skipped (errorCode 'not_provided' \u2014 folder subsystem not provisioned on this gateway)`),r}catch(r){return this.loggingService.catch("Error in UserPermissionService skipNotProvidedFolderEntries: ",r),e}}dropUnrequestedEntries(e,r){try{if(!e?.length)return e??[];let s=i=>`${i?.userId}|${i?.resourceId}|${i?.organizationId}|${i?.type}`,t=new Set((r??[]).map(i=>`${i?.userId}|${i?.resource?.id}|${i?.resource?.organizationId}|${i?.resource?.type}`)),o=e.filter(i=>t.has(s(i)));return o.length!==e.length&&this.loggingService.catch("Tier B getAccess returned entries that were not requested \u2014 dropped before the permissions cache: ",e.filter(i=>!t.has(s(i))),void 0,!0),o}catch(s){return this.loggingService.catch("Error in UserPermissionService dropUnrequestedEntries: ",s),e}}reportUnrecognizedFolderErrorCodes(e){try{for(let r of e??[]){let s=r?.errorCode;!s||r?.type!==p.FOLDER||s==="not_provided"||this.reportedUnknownFolderErrorCodes.has(s)||(this.reportedUnknownFolderErrorCodes.add(s),console.warn(`Velt [portable backend]: a folder permission entry carried an unrecognised errorCode '${s}'. It is being consumed verbatim (hasAccess is honoured as sent). If your gateway means the folder subsystem is not provisioned, the expected literal is the exact lowercase 'not_provided' \u2014 anything else reads as a REAL denial and will withhold folder-scoped access.`))}}catch(r){this.loggingService.catch("Error in UserPermissionService reportUnrecognizedFolderErrorCodes: ",r)}}denialCodeToStatusCode(e){switch(e){case"unauthenticated":return 401;case"permission-denied":return 403;case"not-found":return 404;case"invalid-argument":return 400;case"failed-precondition":return 412;case"resource-exhausted":return 429;case"unimplemented":return 501;default:return 500}}isClientDevResolverActive(){return!!this.getPermissionProvider()?.dev&&this.isClientDevResolverConfigured()}resolveClientSidePermissions(e){return g(this,null,function*(){if(!this.isClientDevResolverActive())throw new Error("Client-side dev permission resolver is not active");return this.resolveClientSide(e)})}isClientDevResolverConfigured(){let e=this.getPermissionProvider();return e?!!e.endpointConfig?.url?.trim()||typeof e.resolvePermissions=="function":!1}resolveClientSide(e){return g(this,null,function*(){this.warnClientResolverEnabledOnce();let r=this.getPermissionProvider(),s=this.getPermissionProviderRetryConfig(),t=r?.resolveTimeout??6e4,o=yield j(()=>this.withResolverTimeout(()=>this.invokeResolver(e,r),t),"clientPermissionResolver",{retryCount:s?.retryCount??0,retryDelay:s?.retryDelay??0});if(!o||!o.success||o.statusCode!==200)throw new Error(o?.message??"Client permission resolver failed");let i=o.data;if(!Array.isArray(i))throw new Error("Client permission resolver returned a malformed payload");return i})}invokeResolver(e,r){return g(this,null,function*(){let s={data:{requests:e}},t=r.endpointConfig?.url?.trim();if(t)return J(t,r.endpointConfig?.headers,s,!0,r.endpointConfig?.credentials);let o=yield r.resolvePermissions(s);if(Array.isArray(o))return{data:o,success:!0,statusCode:200};let i=o,c=i?.statusCode??(i?.success===!1?500:200),a=i?.success!==!1&&c===200;return{data:Array.isArray(i?.data)?i.data:void 0,success:a,statusCode:a?200:c===200?500:c,message:i?.message}})}withResolverTimeout(e,r){return g(this,null,function*(){if(!r||r<=0)return e();let s,t=new Promise((o,i)=>{s=setTimeout(()=>i(new Error("Client permission resolver timed out")),r)});try{return yield Promise.race([e(),t])}finally{s&&clearTimeout(s)}})}warnClientResolverEnabledOnce(){this.clientResolverProdWarned||(this.clientResolverProdWarned=!0,console.warn("[Velt] Client-side dev permission resolver is enabled (dev: true). Permissions are resolved in the browser for local development only \u2014 DO NOT use this in production. Production API keys ignore browser-resolved results and fall back to the server-side permission provider."))}warnNoResolverOnce(){this.clientResolverNoResolverWarned||(this.clientResolverNoResolverWarned=!0,console.warn("[Velt] setPermissionProvider was called with dev: true but no endpointConfig.url or resolvePermissions callback was provided. Falling back to the server-side permission provider."))}revokeAccess(t){return g(this,arguments,function*({requests:e,userId:r,currentContext:s}){if(this.adapterSelectorService?.isPortableBackendActive())return this.sendRevokeAccessToPortableGateway({requests:e});let o=$(this.functions,V({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));return yield G({methodName:"revokeAccess",data:{type:"revokeAccess",data:e,metadata:f({retryConfig:this.getPermissionProviderRetryConfig()},s?.access&&{currentContext:s})},getSdkProxy:o,userId:r})})}sendRevokeAccessToPortableGateway(r){return g(this,arguments,function*({requests:e}){try{let s=this.adapterSelectorService.resolveDbAdapter();for(let t=0;t<e.length;t+=w){let o=e.slice(t,t+w),i=yield s.revokeAccess({scope:"org",data:o.map(c=>({userId:c.userId,resourceId:c.resourceId,type:c.type,organizationId:c.organizationId}))});if(!i?.ok)return this.loggingService.catch("Tier B revokeAccess denied/failed at the gateway: ",i),{success:!1}}return{success:!0}}catch(s){return this.loggingService.catch("Error in UserPermissionService sendRevokeAccessToPortableGateway: ",s),{success:!1}}})}onResourceAccessRequired(i){return g(this,arguments,function*({requests:e,uniqueId:r,methodName:s,userId:t,fromCache:o=!0}){try{if(!e?.length)return;let c=[],a=this.getPermissionsCache()??[];if(!this.forceRefreshPermissions()&&o&&(e.forEach(n=>{let d=a?.find(h=>h.resourceId===n.resource.id&&h.type===n.resource.type&&h.userId===n.userId&&h.organizationId===n.resource.organizationId);d&&c.push(d)}),c.length>0&&(e=e.filter(n=>!c.find(d=>d.resourceId===n.resource.id&&d.type===n.resource.type&&d.userId===n.userId&&d.organizationId===n.resource.organizationId)))),e.length>0){this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{requests:e,fromCache:o,clientResolved:this.isClientDevResolverActive()}});let n=yield this.getAccess({requests:e,userId:this.authService.getUser()?.userId??t??""});return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_RESULT,timestamp:new Date().getTime(),uniqueId:r,methodName:s,source:"internal",payload:{result:n,clientResolved:this.isClientDevResolverActive()}}),n?.success&&n?.data?.length&&(this.setPermissionsCache([...a,...n.data]),n.data=[...c,...n.data]),n}else if(c.length>0)return this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_RESULT_FROM_CACHE,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{results:{data:c,success:!0,statusCode:200}}}),{data:c,success:!0,statusCode:200};return}catch(c){this.loggingService.catch("Error in UsersPermissionService onResourceAccessRequired:",c),this.coreActionsService.triggerAction(v.PERMISSION_PROVIDER,{event:S.Events.PermissionProvider.RESOURCE_ACCESS_ERROR,timestamp:new Date().getTime(),methodName:s,source:"internal",uniqueId:r,payload:{error:c,requests:e,fromCache:o}});return}})}getPermissionsCache(){return this.forceRefreshPermissions()?[]:this.permissionsCache$.getValue()}forceRefreshPermissions(){return this.getPermissionProvider()?.forceRefresh??!1}setPermissionsCache(e){try{let r=new Map;e.forEach(t=>{let o=`${t.userId}_${t.resourceId}_${t.organizationId}_${t.type}`;r.set(o,t)});let s=JSON.parse(JSON.stringify(Array.from(r.values())));this.permissionsCache$.next(s)}catch(r){this.loggingService.catch("Error in UsersPermissionService setPermissionsCache:",r)}}isPermissionProviderAvailable(){try{return!!this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService isPermissionProviderAvailable:",e),!1}}getPermissionProvider(){try{return this.permissionProvider$.getValue()}catch(e){return this.loggingService.catch("Error in UsersPermissionService getPermissionProvider:",e),null}}getPermissionProvider$(){return this.permissionProvider$.asObservable()}};I.\u0275fac=function(r){return new(r||I)(R(ee),R(re),R(H),R(ne),R(ie),R(oe),R(q),R(W),R(Y),R(ce))},I.\u0275prov=K({token:I,factory:I.\u0275fac,providedIn:"root"});let k=I;return k})();export{Ne as a};
@@ -1,2 +1,2 @@
1
- import{b as L}from"./chunk-ZXZRV24Q.js";import{Ha as z,Ja as B}from"./chunk-XUZBUCP7.js";import{Bb as c,Ha as r,Ia as S,Ic as N,Mb as T,Pb as f,Qb as D,Ra as s,Sb as h,Ti as j,Wa as I,_a as O,a as y,ab as m,b as u,ja as w,ka as _,mc as v,nb as p,nc as g,ob as a,pb as d,sa as C,ub as E,vb as k,wj as V,xb as F,ya as b,zb as x}from"./chunk-64GL6WKY.js";function A(t,i){if(t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2){let o=c(2).ngIf;r(),h("",g(2,2,"You are following")," ",o.leaderName)}}function P(t,i){t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2&&(r(),D(g(2,1,"You are leading.")))}function R(t,i){if(t&1){let o=F();a(0,"div",2),x("click",function(){w(o);let e=c().ngIf,l=c();return _(e.type==="following"?l.closeOverlay():void 0)}),a(1,"div",3),m(2,A,3,4,"span",4)(3,P,3,3,"span",4),a(4,"button",5),x("click",function(){w(o);let e=c(2);return _(e.closeOverlay())}),f(5),v(6,"translate"),v(7,"translate"),d()()()}if(t&2){let o=c().ngIf;T("no-pointer",o.type==="leading"),r(2),p("ngIf",o.type==="following"),r(),p("ngIf",o.type==="leading"),r(2),h("",g(6,6,"Stop")," ",g(7,8,o.type))}}function Y(t,i){if(t&1&&(E(0),m(1,R,8,10,"div",1),k()),t&2){let o=i.ngIf;r(),p("ngIf",o.leaderName!==""||o.type==="leading")}}var te=(()=>{let i=class i extends B{closeOverlay(){this.closeOverlayEvent.emit()}constructor(n,e,l,M){super(e,l),this.loggingService=n,this.elementRef=e,this.themeService=l,this.domService=M,this.closeOverlayEvent=new S,this.componentConfigSignal=C({leaderName:"",type:"following"})}ngOnInit(){}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngAfterViewInit: ",n)}}setLeaderName(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{leaderName:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",e)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{type:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setType: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.customCssSubscription?.unsubscribe()}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngOnDestroy: ",n)}}};i.\u0275fac=function(e){return new(e||i)(s(j),s(b),s(z),s(V))},i.\u0275cmp=I({type:i,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[O],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(e,l){e&1&&m(0,Y,2,1,"ng-container",0),e&2&&p("ngIf",l.componentConfigSignal())},dependencies:[N,L],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
1
+ import{b as L}from"./chunk-RD7RCB2H.js";import{Ha as z,Ja as B}from"./chunk-RQWK7TC4.js";import{Bb as c,Ha as r,Ia as S,Ic as N,Mb as T,Pb as f,Qb as D,Ra as s,Sb as h,Ti as j,Wa as I,_a as O,a as y,ab as m,b as u,ja as w,ka as _,mc as v,nb as p,nc as g,ob as a,pb as d,sa as C,ub as E,vb as k,wj as V,xb as F,ya as b,zb as x}from"./chunk-TUKJVGIT.js";function A(t,i){if(t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2){let o=c(2).ngIf;r(),h("",g(2,2,"You are following")," ",o.leaderName)}}function P(t,i){t&1&&(a(0,"span",6),f(1),v(2,"translate"),d()),t&2&&(r(),D(g(2,1,"You are leading.")))}function R(t,i){if(t&1){let o=F();a(0,"div",2),x("click",function(){w(o);let e=c().ngIf,l=c();return _(e.type==="following"?l.closeOverlay():void 0)}),a(1,"div",3),m(2,A,3,4,"span",4)(3,P,3,3,"span",4),a(4,"button",5),x("click",function(){w(o);let e=c(2);return _(e.closeOverlay())}),f(5),v(6,"translate"),v(7,"translate"),d()()()}if(t&2){let o=c().ngIf;T("no-pointer",o.type==="leading"),r(2),p("ngIf",o.type==="following"),r(),p("ngIf",o.type==="leading"),r(2),h("",g(6,6,"Stop")," ",g(7,8,o.type))}}function Y(t,i){if(t&1&&(E(0),m(1,R,8,10,"div",1),k()),t&2){let o=i.ngIf;r(),p("ngIf",o.leaderName!==""||o.type==="leading")}}var te=(()=>{let i=class i extends B{closeOverlay(){this.closeOverlayEvent.emit()}constructor(n,e,l,M){super(e,l),this.loggingService=n,this.elementRef=e,this.themeService=l,this.domService=M,this.closeOverlayEvent=new S,this.componentConfigSignal=C({leaderName:"",type:"following"})}ngOnInit(){}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngAfterViewInit: ",n)}}setLeaderName(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{leaderName:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setLeaderName: ",e)}}getLeaderName(){return this.componentConfigSignal().leaderName}setType(n){try{this.componentConfigSignal.update(e=>(e=u(y({},e),{type:n}),e))}catch(e){this.loggingService.catch("Error in FollowOverlayComponent setType: ",e)}}ngOnDestroy(){try{super.ngOnDestroy(),this.customCssSubscription?.unsubscribe()}catch(n){this.loggingService.catch("Error in FollowOverlayComponent ngOnDestroy: ",n)}}};i.\u0275fac=function(e){return new(e||i)(s(j),s(b),s(z),s(V))},i.\u0275cmp=I({type:i,selectors:[["snippyly-follow-overlay"]],outputs:{closeOverlayEvent:"closeOverlayEvent"},standalone:!1,features:[O],decls:1,vars:1,consts:[[4,"ngIf"],["data-velt-ignore","","class","follow-overlay-container",3,"no-pointer","click",4,"ngIf"],["data-velt-ignore","",1,"follow-overlay-container",3,"click"],["data-velt-ignore","",1,"follow-dialog"],["data-velt-ignore","","class","follow-text",4,"ngIf"],["data-velt-ignore","",1,"follow-btn",3,"click"],["data-velt-ignore","",1,"follow-text"]],template:function(e,l){e&1&&m(0,Y,2,1,"ng-container",0),e&2&&p("ngIf",l.componentConfigSignal())},dependencies:[N,L],styles:[`html{--velt-base-rem-unit: 1}*[data-snippyly-element=true],*[data-velt-element=true]{font-family:var(--velt-default-font-family)}velt-wireframe{display:none!important}body.velt-pin-dragging iframe{pointer-events:none!important}.follow-overlay-container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:var(--velt-follow-mode-overlay-z-index);display:flex;justify-content:center;align-items:flex-end}.follow-overlay-container .follow-dialog{background-color:var(--legacy-velt-follow-overlay-bg-color);color:var(--legacy-velt-follow-overlay-text-color);font-size:12px;display:flex;justify-content:center;align-items:center;gap:calc((1.2rem + 0px) * var(--velt-base-rem-unit));padding:calc((.9rem + 0px) * var(--velt-base-rem-unit)) calc((1.1rem + 0px) * var(--velt-base-rem-unit));border-radius:90px;margin-bottom:calc((2rem + 0px) * var(--velt-base-rem-unit));box-shadow:0 8px 16px -8px #0f0f0f1a;border:1px solid var(--legacy-velt-follow-overlay-border-color)}.follow-overlay-container .follow-dialog .follow-btn{background-color:var(--legacy-velt-follow-overlay-btn-color);padding:8px 12px;border-radius:90px;display:inline-flex;justify-content:center;align-items:center;border:none;font-weight:600;font-size:14px;cursor:pointer;pointer-events:all}.follow-overlay-container .follow-dialog .follow-btn:hover{transition:background-color .5s;background-color:var(--legacy-velt-follow-overlay-btn-hover-color)}.follow-overlay-container.no-pointer{pointer-events:none}
2
2
  `],encapsulation:3,changeDetection:0});let t=i;return t})();export{te as a};
@@ -1,2 +1,2 @@
1
- import{Cb as a,Db as h,Ra as o,Ti as g,Wa as c,fb as m,wj as l,ya as s}from"./chunk-64GL6WKY.js";var d=["*"],C=(()=>{let i=class i{constructor(t,e,n){this.elementRef=t,this.domService=e,this.loggingService=n,this.veltElement=!0}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngAfterViewInit: ",t)}}ngOnDestroy(){try{this.customCssSubscription?.unsubscribe()}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngOnDestroy: ",t)}}};i.\u0275fac=function(e){return new(e||i)(o(s),o(l),o(g))},i.\u0275cmp=c({type:i,selectors:[["velt-shadow-dom-internal"]],hostVars:1,hostBindings:function(e,n){e&2&&m("data-velt-element",n.veltElement)},ngContentSelectors:d,decls:1,vars:0,template:function(e,n){e&1&&(a(),h(0))},styles:[`:host{width:100%}
1
+ import{Cb as a,Db as h,Ra as o,Ti as g,Wa as c,fb as m,wj as l,ya as s}from"./chunk-TUKJVGIT.js";var d=["*"],C=(()=>{let i=class i{constructor(t,e,n){this.elementRef=t,this.domService=e,this.loggingService=n,this.veltElement=!0}ngAfterViewInit(){try{this.customCssSubscription=this.domService.subscribeInjectCustomCss(this.elementRef)}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngAfterViewInit: ",t)}}ngOnDestroy(){try{this.customCssSubscription?.unsubscribe()}catch(t){this.loggingService.catch("Error in ShadowDomComponent ngOnDestroy: ",t)}}};i.\u0275fac=function(e){return new(e||i)(o(s),o(l),o(g))},i.\u0275cmp=c({type:i,selectors:[["velt-shadow-dom-internal"]],hostVars:1,hostBindings:function(e,n){e&2&&m("data-velt-element",n.veltElement)},ngContentSelectors:d,decls:1,vars:0,template:function(e,n){e&1&&(a(),h(0))},styles:[`:host{width:100%}
2
2
  `],encapsulation:3,changeDetection:0});let r=i;return r})();export{C as a};
@@ -1 +1 @@
1
- import{a as o}from"./chunk-H2T34LM4.js";import{Ra as g,Ti as v,W as c,Ya as l,k as s}from"./chunk-64GL6WKY.js";var p=(()=>{let i=class i{constructor(e,r){this.loggingService=e,this.dragDrop=r,this.currentX=0,this.currentY=0,this.destroy$=new s,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: DraggableOverlayDirective","color: blue;")}ngOnInit(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnInit","color: green;"),this.setupDraggableOverlay()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnInit: ",e)}}setupDraggableOverlay(){try{if(this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: setupDraggableOverlay","color: green;"),this.connectedOverlay&&this.connectedOverlay.overlayRef){let e=this.connectedOverlay.overlayRef.overlayElement;this.dragRef=this.dragDrop.createDrag(e),this.subscriptions.push(this.dragRef.moved.pipe(c(this.destroy$)).subscribe(r=>{let a=this.connectedOverlay?.overlayRef.getConfig().positionStrategy;this.updatePosition(a,r.distance.x,r.distance.y)},r=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.moved subscription: ",r)})),this.dragRef.ended.pipe(c(this.destroy$)).subscribe(r=>{this.currentX+=r.distance.x,this.currentY+=r.distance.y},r=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.ended subscription: ",r)})}}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective setupDraggableOverlay: ",e)}}updatePosition(e,r,a){try{if(e){let n=this.currentX+r,h=this.currentY+a;e.withDefaultOffsetX(n).withDefaultOffsetY(h),this.connectedOverlay?.overlayRef?.updatePosition()}}catch{}}cleanupDraggableOverlay(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: cleanupDraggableOverlay","color: green;"),this.dragRef&&this.dragRef.dispose()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective cleanupDraggableOverlay: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnDestroy","color: green;"),this.cleanupDraggableOverlay(),this.destroy$.next(),this.destroy$.complete(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnDestroy: ",e)}}};i.\u0275fac=function(r){return new(r||i)(g(v),g(o))},i.\u0275dir=l({type:i,selectors:[["","veltDraggableOverlay",""]],inputs:{connectedOverlay:[0,"veltDraggableOverlay","connectedOverlay"]}});let t=i;return t})();export{p as a};
1
+ import{a as o}from"./chunk-SQOVGQOO.js";import{Ra as g,Ti as v,W as c,Ya as l,k as s}from"./chunk-TUKJVGIT.js";var p=(()=>{let i=class i{constructor(e,r){this.loggingService=e,this.dragDrop=r,this.currentX=0,this.currentY=0,this.destroy$=new s,this.subscriptions=[],this.loggingService.log("%c[WB] Creating CLASS: DraggableOverlayDirective","color: blue;")}ngOnInit(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnInit","color: green;"),this.setupDraggableOverlay()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnInit: ",e)}}setupDraggableOverlay(){try{if(this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: setupDraggableOverlay","color: green;"),this.connectedOverlay&&this.connectedOverlay.overlayRef){let e=this.connectedOverlay.overlayRef.overlayElement;this.dragRef=this.dragDrop.createDrag(e),this.subscriptions.push(this.dragRef.moved.pipe(c(this.destroy$)).subscribe(r=>{let a=this.connectedOverlay?.overlayRef.getConfig().positionStrategy;this.updatePosition(a,r.distance.x,r.distance.y)},r=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.moved subscription: ",r)})),this.dragRef.ended.pipe(c(this.destroy$)).subscribe(r=>{this.currentX+=r.distance.x,this.currentY+=r.distance.y},r=>{this.loggingService.catch("Error in DraggableOverlayDirective dragRef.ended subscription: ",r)})}}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective setupDraggableOverlay: ",e)}}updatePosition(e,r,a){try{if(e){let n=this.currentX+r,h=this.currentY+a;e.withDefaultOffsetX(n).withDefaultOffsetY(h),this.connectedOverlay?.overlayRef?.updatePosition()}}catch{}}cleanupDraggableOverlay(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: cleanupDraggableOverlay","color: green;"),this.dragRef&&this.dragRef.dispose()}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective cleanupDraggableOverlay: ",e)}}ngOnDestroy(){try{this.loggingService.log("%c[WB] Calling DraggableOverlayDirective FUNCTION: ngOnDestroy","color: green;"),this.cleanupDraggableOverlay(),this.destroy$.next(),this.destroy$.complete(),this.subscriptions.forEach(e=>{e.unsubscribe()})}catch(e){this.loggingService.catch("Error in DraggableOverlayDirective ngOnDestroy: ",e)}}};i.\u0275fac=function(r){return new(r||i)(g(v),g(o))},i.\u0275dir=l({type:i,selectors:[["","veltDraggableOverlay",""]],inputs:{connectedOverlay:[0,"veltDraggableOverlay","connectedOverlay"]}});let t=i;return t})();export{p as a};
@@ -1 +1 @@
1
- import{x as Z}from"./chunk-IEQR2CEL.js";import{b as N}from"./chunk-ZXZRV24Q.js";import{xa as T,ya as B}from"./chunk-XUZBUCP7.js";import{Bb as f,Eh as z,Ha as a,Hc as A,He as j,Ic as E,Kb as k,Mb as P,Pb as d,Qb as b,Ra as y,Rb as u,Re as R,Ti as F,Wa as I,ab as w,fb as L,g as V,ja as v,ka as g,la as D,ma as S,mc as p,nb as h,nc as m,ob as r,pb as s,qb as _,xb as M,zb as C}from"./chunk-64GL6WKY.js";function G(o,l){if(o&1){let n=M();r(0,"div",18),C("click",function(){let i=v(n).$implicit,e=f(2);return g(e.selectAudioDevice(i))}),d(1),p(2,"translate"),s()}if(o&2){let n=l.$implicit,t=f(2);P("selected",n.deviceId===(t.selectedAudioDevice==null?null:t.selectedAudioDevice.deviceId)),a(),u(" ",m(2,3,n.label)," ")}}function H(o,l){if(o&1&&(r(0,"div",12)(1,"div",13),d(2),p(3,"translate"),s(),d(4),p(5,"translate"),r(6,"div",14)(7,"div",15),w(8,G,3,5,"div",16),s(),d(9),p(10,"translate"),D(),r(11,"svg",4),_(12,"path",17),s()()()),o&2){let n=f();a(2),b(m(3,4,"Audio")),a(2),u(" ",m(5,6,"Microphone")," "),a(4),h("ngForOf",n.audioDevices),a(),u(" ",m(10,8,n.selectedAudioDevice==null?null:n.selectedAudioDevice.label)," ")}}function U(o,l){if(o&1){let n=M();r(0,"div",18),C("click",function(){let i=v(n).$implicit,e=f(2);return g(e.selectVideoDevice(i))}),d(1),p(2,"translate"),s()}if(o&2){let n=l.$implicit,t=f(2);P("selected",n.deviceId===(t.selectedVideoDevice==null?null:t.selectedVideoDevice.deviceId)),a(),u(" ",m(2,3,n.label)," ")}}function $(o,l){if(o&1&&(r(0,"div",12)(1,"div",13),d(2),p(3,"translate"),s(),d(4),p(5,"translate"),r(6,"div",14)(7,"div",15),w(8,U,3,5,"div",16),s(),d(9),p(10,"translate"),D(),r(11,"svg",4),_(12,"path",17),s()()()),o&2){let n=f();a(2),b(m(3,4,"Video")),a(2),u(" ",m(5,6,"Camera")," "),a(4),h("ngForOf",n.videoDevices),a(),u(" ",m(10,8,n.selectedVideoDevice==null?null:n.selectedVideoDevice.label)," ")}}var ne=(()=>{let l=class l{constructor(t,i,e){this.loggingService=t,this.dialogRef=i,this.devices=[],this.audioDevices=[],this.videoDevices=[],this.settingsVisible={audio:!0,video:!0},this.defaultMediaSourceOptions=z(),this.veltElement=!0;try{e&&(this.selectedAudioDevice=e.selectedAudioDevice,this.selectedVideoDevice=e.selectedVideoDevice,e.settingsVisible&&(this.settingsVisible=e.settingsVisible)),this.getDevices()}catch(c){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent constructor: ",c)}}ngOnInit(){try{this.dialogRef.addPanelClass("snippyly-media-source-options-dialog")}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnInit: ",t)}}getDevices(){return V(this,null,function*(){try{let t=new R;if(t.getBrowserName()?.toLowerCase()==="safari"||t.getBrowserName()?.toLowerCase()==="firefox")try{let i=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0});i&&i.getTracks().forEach(e=>e.stop())}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices getUserMedia catch: ",i)}navigator.mediaDevices.enumerateDevices().then(i=>{if(this.devices=i.filter(e=>e.kind==="audioinput"||e.kind==="videoinput"),this.audioDevices=this.devices.filter(e=>e.kind==="audioinput"),this.videoDevices=this.devices.filter(e=>e.kind==="videoinput"),this.audioDevices.length>0&&!this.selectedAudioDevice){if(this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId){let e=this.audioDevices.find(c=>c.deviceId===this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId);e&&(this.selectedAudioDevice=e)}this.selectedAudioDevice||(this.selectedAudioDevice=this.audioDevices[0])}if(this.videoDevices.length>0&&!this.selectedVideoDevice){if(this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId){let e=this.videoDevices.find(c=>c.deviceId===this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId);e&&(this.selectedVideoDevice=e)}this.selectedVideoDevice||(this.selectedVideoDevice=this.videoDevices[0])}}).catch(i=>{this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices enumerateDevices catch: ",i)})}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices: ",t)}})}selectAudioDevice(t){try{this.selectedAudioDevice=t}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",i)}}selectVideoDevice(t){try{this.selectedVideoDevice=t}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectVideoDevice: ",i)}}saveChanges(){try{let t={};this.settingsVisible.audio&&(t.selectedAudioDevice=this.selectedAudioDevice),this.settingsVisible.video&&(t.selectedVideoDevice=this.selectedVideoDevice),localStorage.setItem(j.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(t||{})),this.closeDialog(t)}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent saveChanges: ",t)}}closeDialog(t){try{this.dialogRef.close(t)}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeDialog: ",i)}}};l.\u0275fac=function(i){return new(i||l)(y(F),y(T),y(B,8))},l.\u0275cmp=I({type:l,selectors:[["snippyly-media-source-options-dialog"]],hostVars:1,hostBindings:function(i,e){i&2&&L("data-velt-element",e.veltElement)},standalone:!1,decls:17,vars:10,consts:[["mediaSourceOptionsDialogRef",""],[1,"s-video-settings-modal",3,"pointerdown","pointerup","click","snippylyOverlay","snippylyOverlayZIndex"],[1,"s-video-header"],[1,"s-video-header-name"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M19.5 12C19.5 11.77 19.49 11.55 19.47 11.32L21.33 9.91C21.73 9.61 21.84 9.05 21.59 8.61L19.72 5.38C19.47 4.94 18.93 4.76 18.47 4.96L16.32 5.87C15.95 5.61 15.56 5.38 15.15 5.19L14.86 2.88C14.8 2.38 14.37 2 13.87 2H10.14C9.63 2 9.2 2.38 9.14 2.88L8.85 5.19C8.44 5.38 8.05 5.61 7.68 5.87L5.53 4.96C5.07 4.76 4.53 4.94 4.28 5.38L2.41 8.62C2.16 9.06 2.27 9.61 2.67 9.92L4.53 11.33C4.51 11.55 4.5 11.77 4.5 12C4.5 12.23 4.51 12.45 4.53 12.68L2.67 14.09C2.27 14.39 2.16 14.95 2.41 15.39L4.28 18.62C4.53 19.06 5.07 19.24 5.53 19.04L7.68 18.13C8.05 18.39 8.44 18.62 8.85 18.81L9.14 21.12C9.2 21.62 9.63 22 10.13 22H13.86C14.36 22 14.79 21.62 14.85 21.12L15.14 18.81C15.55 18.62 15.94 18.39 16.31 18.13L18.46 19.04C18.92 19.24 19.46 19.06 19.71 18.62L21.58 15.39C21.83 14.95 21.72 14.4 21.32 14.09L19.46 12.68C19.49 12.45 19.5 12.23 19.5 12ZM12.04 15.5C10.11 15.5 8.54 13.93 8.54 12C8.54 10.07 10.11 8.5 12.04 8.5C13.97 8.5 15.54 10.07 15.54 12C15.54 13.93 13.97 15.5 12.04 15.5Z","fill","white"],[1,"s-icon-button",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41076 4.41058C4.7362 4.08514 5.26384 4.08514 5.58928 4.41058L10 8.82133L14.4108 4.41058C14.7362 4.08514 15.2638 4.08514 15.5893 4.41058C15.9147 4.73602 15.9147 5.26366 15.5893 5.58909L11.1785 9.99984L15.5893 14.4106C15.9147 14.736 15.9147 15.2637 15.5893 15.5891C15.2638 15.9145 14.7362 15.9145 14.4108 15.5891L10 11.1783L5.58928 15.5891C5.26384 15.9145 4.7362 15.9145 4.41076 15.5891C4.08533 15.2637 4.08533 14.736 4.41076 14.4106L8.82151 9.99984L4.41076 5.58909C4.08533 5.26366 4.08533 4.73602 4.41076 4.41058Z","fill","white"],["class","s-video-settings-modal-item",4,"ngIf"],[1,"s-flex-fill"],[1,"s-button","s-primary","s-save-button",3,"click"],[1,"s-video-settings-modal-item"],[1,"s-heading"],[1,"s-input","dropdown"],[1,"dropdown-content"],["class","dropdown-item",3,"selected","click",4,"ngFor","ngForOf"],["fill-rule","evenodd","clip-rule","evenodd","d","M16.2071 9.79289C15.8166 9.40237 15.1834 9.40237 14.7929 9.79289L12 12.5858L9.20711 9.79289C8.81658 9.40237 8.18342 9.40237 7.79289 9.79289C7.40237 10.1834 7.40237 10.8166 7.79289 11.2071L11.2929 14.7071C11.6834 15.0976 12.3166 15.0976 12.7071 14.7071L16.2071 11.2071C16.5976 10.8166 16.5976 10.1834 16.2071 9.79289Z","fill","#80808A"],[1,"dropdown-item",3,"click"]],template:function(i,e){if(i&1){let c=M();r(0,"div",1,0),C("pointerdown",function(x){return v(c),g(x.stopPropagation())})("pointerup",function(x){return v(c),g(x.stopPropagation())})("click",function(x){return v(c),g(x.stopPropagation())}),r(2,"div",2)(3,"div",3),D(),r(4,"svg",4),_(5,"path",5),s(),d(6),p(7,"translate"),s(),S(),r(8,"div",6),C("click",function(){return v(c),g(e.closeDialog())}),D(),r(9,"svg",7),_(10,"path",8),s()()(),w(11,H,13,10,"div",9)(12,$,13,10,"div",9),S(),_(13,"div",10),r(14,"div",11),C("click",function(){return v(c),g(e.saveChanges())}),d(15),p(16,"translate"),s()()}if(i&2){let c=k(1);h("snippylyOverlay",c)("snippylyOverlayZIndex",3e3),a(6),u(" ",m(7,6,"Settings")," "),a(5),h("ngIf",e.settingsVisible==null?null:e.settingsVisible.audio),a(),h("ngIf",e.settingsVisible==null?null:e.settingsVisible.video),a(3),b(m(16,8,"Save changes"))}},dependencies:[A,E,Z,N],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-video-settings-modal[_ngcontent-%COMP%], .s-video-header[_ngcontent-%COMP%], .s-video-header-name[_ngcontent-%COMP%], .s-video-settings-modal-item[_ngcontent-%COMP%], .s-input[_ngcontent-%COMP%]{display:flex!important;color:#fff!important}.s-video-settings-modal-item[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-start!important;justify-content:flex-start!important;width:100%!important;color:#91919c!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-settings-modal[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-end!important;padding:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;background:#141416!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:calc((40rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important}.s-video-header[_ngcontent-%COMP%]{justify-content:space-between!important;width:100%!important;align-items:center!important}.s-video-header-name[_ngcontent-%COMP%]{gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:600!important;font-size:calc((1.2rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((2rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:hover{background:#4f4bbf!important}.s-video-settings-modal-item[_ngcontent-%COMP%] .s-heading[_ngcontent-%COMP%]{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) 0!important}.s-input[_ngcontent-%COMP%]{position:relative!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#91919c!important;width:100%!important;justify-content:space-between!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important;align-items:center!important;cursor:pointer!important;transition:.2s ease!important}.s-input[_ngcontent-%COMP%]:hover{background:#303034!important}.dropdown[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{position:absolute!important;top:0!important;right:0!important;z-index:1!important}.dropdown-content[_ngcontent-%COMP%]{width:100%!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;justify-content:flex-start!important;align-items:flex-start!important;border-radius:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important;color:#91919c!important;background:#141416!important;cursor:pointer!important;visibility:hidden!important;opacity:0!important;transition:all .1s ease!important}.dropdown[_ngcontent-%COMP%]:hover .dropdown-content[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important}.dropdown-item[_ngcontent-%COMP%]{padding:calc((1.2rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:100%!important;display:flex!important;justify-content:flex-start!important;align-items:center!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;transition:all .1s ease!important;color:#91919c!important}.dropdown-item.selected[_ngcontent-%COMP%]{color:#fff!important}.dropdown-item[_ngcontent-%COMP%]:hover{background:#303034!important;color:#fff!important}.s-icon-button[_ngcontent-%COMP%]{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:100px!important;cursor:pointer!important}.s-icon-button[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#777e91!important}.s-icon-button[_ngcontent-%COMP%]:hover{background:#222226!important}.s-icon-button[_ngcontent-%COMP%]:hover svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#fff!important}.s-flex-fill[_ngcontent-%COMP%]{flex-grow:1!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog{max-width:unset} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}@media screen and (max-width:768px){.s-video-settings-modal[_ngcontent-%COMP%]{width:calc(.8 * var(--legacy-velt-viewport-width))!important}}@media screen and (max-width:425px){ .velt-mat-dialog-container.snippyly-media-source-options-dialog{width:calc(1 * var(--legacy-velt-viewport-width))!important;max-width:calc(1 * var(--legacy-velt-viewport-width))!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width))!important;height:calc(1 * var(--legacy-velt-viewport-height))!important;border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .s-video-settings-modal{width:calc(1 * var(--legacy-velt-viewport-width))!important;height:calc(1 * var(--legacy-velt-viewport-height))!important;border-radius:0!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .s-save-button{width:100%!important}}"],changeDetection:0});let o=l;return o})();export{ne as a};
1
+ import{x as Z}from"./chunk-UQ5O7HIC.js";import{b as N}from"./chunk-RD7RCB2H.js";import{xa as T,ya as B}from"./chunk-RQWK7TC4.js";import{Bb as f,Eh as z,Ha as a,Hc as A,He as j,Ic as E,Kb as k,Mb as P,Pb as d,Qb as b,Ra as y,Rb as u,Re as R,Ti as F,Wa as I,ab as w,fb as L,g as V,ja as v,ka as g,la as D,ma as S,mc as p,nb as h,nc as m,ob as r,pb as s,qb as _,xb as M,zb as C}from"./chunk-TUKJVGIT.js";function G(o,l){if(o&1){let n=M();r(0,"div",18),C("click",function(){let i=v(n).$implicit,e=f(2);return g(e.selectAudioDevice(i))}),d(1),p(2,"translate"),s()}if(o&2){let n=l.$implicit,t=f(2);P("selected",n.deviceId===(t.selectedAudioDevice==null?null:t.selectedAudioDevice.deviceId)),a(),u(" ",m(2,3,n.label)," ")}}function H(o,l){if(o&1&&(r(0,"div",12)(1,"div",13),d(2),p(3,"translate"),s(),d(4),p(5,"translate"),r(6,"div",14)(7,"div",15),w(8,G,3,5,"div",16),s(),d(9),p(10,"translate"),D(),r(11,"svg",4),_(12,"path",17),s()()()),o&2){let n=f();a(2),b(m(3,4,"Audio")),a(2),u(" ",m(5,6,"Microphone")," "),a(4),h("ngForOf",n.audioDevices),a(),u(" ",m(10,8,n.selectedAudioDevice==null?null:n.selectedAudioDevice.label)," ")}}function U(o,l){if(o&1){let n=M();r(0,"div",18),C("click",function(){let i=v(n).$implicit,e=f(2);return g(e.selectVideoDevice(i))}),d(1),p(2,"translate"),s()}if(o&2){let n=l.$implicit,t=f(2);P("selected",n.deviceId===(t.selectedVideoDevice==null?null:t.selectedVideoDevice.deviceId)),a(),u(" ",m(2,3,n.label)," ")}}function $(o,l){if(o&1&&(r(0,"div",12)(1,"div",13),d(2),p(3,"translate"),s(),d(4),p(5,"translate"),r(6,"div",14)(7,"div",15),w(8,U,3,5,"div",16),s(),d(9),p(10,"translate"),D(),r(11,"svg",4),_(12,"path",17),s()()()),o&2){let n=f();a(2),b(m(3,4,"Video")),a(2),u(" ",m(5,6,"Camera")," "),a(4),h("ngForOf",n.videoDevices),a(),u(" ",m(10,8,n.selectedVideoDevice==null?null:n.selectedVideoDevice.label)," ")}}var ne=(()=>{let l=class l{constructor(t,i,e){this.loggingService=t,this.dialogRef=i,this.devices=[],this.audioDevices=[],this.videoDevices=[],this.settingsVisible={audio:!0,video:!0},this.defaultMediaSourceOptions=z(),this.veltElement=!0;try{e&&(this.selectedAudioDevice=e.selectedAudioDevice,this.selectedVideoDevice=e.selectedVideoDevice,e.settingsVisible&&(this.settingsVisible=e.settingsVisible)),this.getDevices()}catch(c){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent constructor: ",c)}}ngOnInit(){try{this.dialogRef.addPanelClass("snippyly-media-source-options-dialog")}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent ngOnInit: ",t)}}getDevices(){return V(this,null,function*(){try{let t=new R;if(t.getBrowserName()?.toLowerCase()==="safari"||t.getBrowserName()?.toLowerCase()==="firefox")try{let i=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0});i&&i.getTracks().forEach(e=>e.stop())}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices getUserMedia catch: ",i)}navigator.mediaDevices.enumerateDevices().then(i=>{if(this.devices=i.filter(e=>e.kind==="audioinput"||e.kind==="videoinput"),this.audioDevices=this.devices.filter(e=>e.kind==="audioinput"),this.videoDevices=this.devices.filter(e=>e.kind==="videoinput"),this.audioDevices.length>0&&!this.selectedAudioDevice){if(this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId){let e=this.audioDevices.find(c=>c.deviceId===this.defaultMediaSourceOptions?.selectedAudioDevice?.deviceId);e&&(this.selectedAudioDevice=e)}this.selectedAudioDevice||(this.selectedAudioDevice=this.audioDevices[0])}if(this.videoDevices.length>0&&!this.selectedVideoDevice){if(this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId){let e=this.videoDevices.find(c=>c.deviceId===this.defaultMediaSourceOptions?.selectedVideoDevice?.deviceId);e&&(this.selectedVideoDevice=e)}this.selectedVideoDevice||(this.selectedVideoDevice=this.videoDevices[0])}}).catch(i=>{this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices enumerateDevices catch: ",i)})}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent getDevices: ",t)}})}selectAudioDevice(t){try{this.selectedAudioDevice=t}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectAudioDevice: ",i)}}selectVideoDevice(t){try{this.selectedVideoDevice=t}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent selectVideoDevice: ",i)}}saveChanges(){try{let t={};this.settingsVisible.audio&&(t.selectedAudioDevice=this.selectedAudioDevice),this.settingsVisible.video&&(t.selectedVideoDevice=this.selectedVideoDevice),localStorage.setItem(j.LOCAL_STORAGE.SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS,JSON.stringify(t||{})),this.closeDialog(t)}catch(t){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent saveChanges: ",t)}}closeDialog(t){try{this.dialogRef.close(t)}catch(i){this.loggingService.catch("Error in MediaSourceOptionsDialogComponent closeDialog: ",i)}}};l.\u0275fac=function(i){return new(i||l)(y(F),y(T),y(B,8))},l.\u0275cmp=I({type:l,selectors:[["snippyly-media-source-options-dialog"]],hostVars:1,hostBindings:function(i,e){i&2&&L("data-velt-element",e.veltElement)},standalone:!1,decls:17,vars:10,consts:[["mediaSourceOptionsDialogRef",""],[1,"s-video-settings-modal",3,"pointerdown","pointerup","click","snippylyOverlay","snippylyOverlayZIndex"],[1,"s-video-header"],[1,"s-video-header-name"],["width","24","height","24","viewBox","0 0 24 24","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M19.5 12C19.5 11.77 19.49 11.55 19.47 11.32L21.33 9.91C21.73 9.61 21.84 9.05 21.59 8.61L19.72 5.38C19.47 4.94 18.93 4.76 18.47 4.96L16.32 5.87C15.95 5.61 15.56 5.38 15.15 5.19L14.86 2.88C14.8 2.38 14.37 2 13.87 2H10.14C9.63 2 9.2 2.38 9.14 2.88L8.85 5.19C8.44 5.38 8.05 5.61 7.68 5.87L5.53 4.96C5.07 4.76 4.53 4.94 4.28 5.38L2.41 8.62C2.16 9.06 2.27 9.61 2.67 9.92L4.53 11.33C4.51 11.55 4.5 11.77 4.5 12C4.5 12.23 4.51 12.45 4.53 12.68L2.67 14.09C2.27 14.39 2.16 14.95 2.41 15.39L4.28 18.62C4.53 19.06 5.07 19.24 5.53 19.04L7.68 18.13C8.05 18.39 8.44 18.62 8.85 18.81L9.14 21.12C9.2 21.62 9.63 22 10.13 22H13.86C14.36 22 14.79 21.62 14.85 21.12L15.14 18.81C15.55 18.62 15.94 18.39 16.31 18.13L18.46 19.04C18.92 19.24 19.46 19.06 19.71 18.62L21.58 15.39C21.83 14.95 21.72 14.4 21.32 14.09L19.46 12.68C19.49 12.45 19.5 12.23 19.5 12ZM12.04 15.5C10.11 15.5 8.54 13.93 8.54 12C8.54 10.07 10.11 8.5 12.04 8.5C13.97 8.5 15.54 10.07 15.54 12C15.54 13.93 13.97 15.5 12.04 15.5Z","fill","white"],[1,"s-icon-button",3,"click"],["width","20","height","20","viewBox","0 0 20 20","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M4.41076 4.41058C4.7362 4.08514 5.26384 4.08514 5.58928 4.41058L10 8.82133L14.4108 4.41058C14.7362 4.08514 15.2638 4.08514 15.5893 4.41058C15.9147 4.73602 15.9147 5.26366 15.5893 5.58909L11.1785 9.99984L15.5893 14.4106C15.9147 14.736 15.9147 15.2637 15.5893 15.5891C15.2638 15.9145 14.7362 15.9145 14.4108 15.5891L10 11.1783L5.58928 15.5891C5.26384 15.9145 4.7362 15.9145 4.41076 15.5891C4.08533 15.2637 4.08533 14.736 4.41076 14.4106L8.82151 9.99984L4.41076 5.58909C4.08533 5.26366 4.08533 4.73602 4.41076 4.41058Z","fill","white"],["class","s-video-settings-modal-item",4,"ngIf"],[1,"s-flex-fill"],[1,"s-button","s-primary","s-save-button",3,"click"],[1,"s-video-settings-modal-item"],[1,"s-heading"],[1,"s-input","dropdown"],[1,"dropdown-content"],["class","dropdown-item",3,"selected","click",4,"ngFor","ngForOf"],["fill-rule","evenodd","clip-rule","evenodd","d","M16.2071 9.79289C15.8166 9.40237 15.1834 9.40237 14.7929 9.79289L12 12.5858L9.20711 9.79289C8.81658 9.40237 8.18342 9.40237 7.79289 9.79289C7.40237 10.1834 7.40237 10.8166 7.79289 11.2071L11.2929 14.7071C11.6834 15.0976 12.3166 15.0976 12.7071 14.7071L16.2071 11.2071C16.5976 10.8166 16.5976 10.1834 16.2071 9.79289Z","fill","#80808A"],[1,"dropdown-item",3,"click"]],template:function(i,e){if(i&1){let c=M();r(0,"div",1,0),C("pointerdown",function(x){return v(c),g(x.stopPropagation())})("pointerup",function(x){return v(c),g(x.stopPropagation())})("click",function(x){return v(c),g(x.stopPropagation())}),r(2,"div",2)(3,"div",3),D(),r(4,"svg",4),_(5,"path",5),s(),d(6),p(7,"translate"),s(),S(),r(8,"div",6),C("click",function(){return v(c),g(e.closeDialog())}),D(),r(9,"svg",7),_(10,"path",8),s()()(),w(11,H,13,10,"div",9)(12,$,13,10,"div",9),S(),_(13,"div",10),r(14,"div",11),C("click",function(){return v(c),g(e.saveChanges())}),d(15),p(16,"translate"),s()()}if(i&2){let c=k(1);h("snippylyOverlay",c)("snippylyOverlayZIndex",3e3),a(6),u(" ",m(7,6,"Settings")," "),a(5),h("ngIf",e.settingsVisible==null?null:e.settingsVisible.audio),a(),h("ngIf",e.settingsVisible==null?null:e.settingsVisible.video),a(3),b(m(16,8,"Save changes"))}},dependencies:[A,E,Z,N],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}*[_ngcontent-%COMP%]{box-sizing:border-box;-webkit-tap-highlight-color:rgba(255,255,255,0)!important;outline:none!important;margin:0!important;padding:0!important;line-height:1.5!important;color:#000!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))}*[_ngcontent-%COMP%]:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){height:unset;width:unset}*[_ngcontent-%COMP%]:empty:not(svg,rect,circle,ellipse,line,polyline,polygon,path,text,g,use,image,defs,hr){display:revert!important}.s-video-settings-modal[_ngcontent-%COMP%], .s-video-header[_ngcontent-%COMP%], .s-video-header-name[_ngcontent-%COMP%], .s-video-settings-modal-item[_ngcontent-%COMP%], .s-input[_ngcontent-%COMP%]{display:flex!important;color:#fff!important}.s-video-settings-modal-item[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-start!important;justify-content:flex-start!important;width:100%!important;color:#91919c!important;font-size:calc((.8rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}.s-video-settings-modal[_ngcontent-%COMP%]{flex-direction:column!important;align-items:flex-end!important;padding:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;gap:calc((2rem + 0px) * var(--velt-base-rem-unit))!important;background:#141416!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:calc((40rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important}.s-video-header[_ngcontent-%COMP%]{justify-content:space-between!important;width:100%!important;align-items:center!important}.s-video-header-name[_ngcontent-%COMP%]{gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;font-weight:600!important;font-size:calc((1.2rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important}.s-button[_ngcontent-%COMP%]{display:flex!important;align-items:center!important;justify-content:center!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit)) calc((2rem + 0px) * var(--velt-base-rem-unit))!important;border-radius:calc((4rem + 0px) * var(--velt-base-rem-unit))!important;font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;transition:.1s ease!important;cursor:pointer!important}.s-primary[_ngcontent-%COMP%]{background:#625df5!important;color:#fff!important}.s-primary[_ngcontent-%COMP%]:hover{background:#4f4bbf!important}.s-video-settings-modal-item[_ngcontent-%COMP%] .s-heading[_ngcontent-%COMP%]{font-size:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#fff!important;padding:calc((.5rem + 0px) * var(--velt-base-rem-unit)) 0!important}.s-input[_ngcontent-%COMP%]{position:relative!important;padding:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;color:#91919c!important;width:100%!important;justify-content:space-between!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important;align-items:center!important;cursor:pointer!important;transition:.2s ease!important}.s-input[_ngcontent-%COMP%]:hover{background:#303034!important}.dropdown[_ngcontent-%COMP%] .dropdown-content[_ngcontent-%COMP%]{position:absolute!important;top:0!important;right:0!important;z-index:1!important}.dropdown-content[_ngcontent-%COMP%]{width:100%!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;justify-content:flex-start!important;align-items:flex-start!important;border-radius:calc((.9rem + 0px) * var(--velt-base-rem-unit))!important;border:2px solid #303034!important;color:#91919c!important;background:#141416!important;cursor:pointer!important;visibility:hidden!important;opacity:0!important;transition:all .1s ease!important}.dropdown[_ngcontent-%COMP%]:hover .dropdown-content[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important}.dropdown-item[_ngcontent-%COMP%]{padding:calc((1.2rem + 0px) * var(--velt-base-rem-unit)) calc((1rem + 0px) * var(--velt-base-rem-unit))!important;width:100%!important;display:flex!important;justify-content:flex-start!important;align-items:center!important;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;transition:all .1s ease!important;color:#91919c!important}.dropdown-item.selected[_ngcontent-%COMP%]{color:#fff!important}.dropdown-item[_ngcontent-%COMP%]:hover{background:#303034!important;color:#fff!important}.s-icon-button[_ngcontent-%COMP%]{padding:calc((.5rem + 0px) * var(--velt-base-rem-unit))!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:100px!important;cursor:pointer!important}.s-icon-button[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#777e91!important}.s-icon-button[_ngcontent-%COMP%]:hover{background:#222226!important}.s-icon-button[_ngcontent-%COMP%]:hover svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:#fff!important}.s-flex-fill[_ngcontent-%COMP%]{flex-grow:1!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog{max-width:unset} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{background-color:transparent!important;padding:0!important;margin:0!important;border-radius:calc((1rem + 0px) * var(--velt-base-rem-unit))!important}@media screen and (max-width:768px){.s-video-settings-modal[_ngcontent-%COMP%]{width:calc(.8 * var(--legacy-velt-viewport-width))!important}}@media screen and (max-width:425px){ .velt-mat-dialog-container.snippyly-media-source-options-dialog{width:calc(1 * var(--legacy-velt-viewport-width))!important;max-width:calc(1 * var(--legacy-velt-viewport-width))!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface{width:calc(1 * var(--legacy-velt-viewport-width))!important;height:calc(1 * var(--legacy-velt-viewport-height))!important;border-radius:calc((0rem + 0px) * var(--velt-base-rem-unit))!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .s-video-settings-modal{width:calc(1 * var(--legacy-velt-viewport-width))!important;height:calc(1 * var(--legacy-velt-viewport-height))!important;border-radius:0!important} .velt-mat-dialog-container.snippyly-media-source-options-dialog mat-dialog-container .mat-mdc-dialog-surface.mdc-dialog__surface .s-save-button{width:100%!important}}"],changeDetection:0});let o=l;return o})();export{ne as a};