@arbocollab/arbo-plugin-item-table 0.1.203 → 0.1.204

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.
@@ -156,7 +156,7 @@ Caused by: `,y0=Symbol("causeStack");function See(e,t){const n=he.hasOwnProp(e,y
156
156
  `),l=a===-1?-1:i.indexOf(`
157
157
  `,a+1),c=l===-1?i:i.slice(l+1),u=String(o.stack),d=See(o,u),h=d===-1?u:u.slice(0,d),f=d===-1?"":u.slice(d);h.endsWith(c)||(o.stack=h+`
158
158
  `+i+f)}}catch{}throw o}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Dc(this.defaults,n);const{transitional:o,paramsSerializer:s,headers:r}=n;o!==void 0&&Bv.assertOptions(o,{silentJSONParsing:Ao.transitional(Ao.boolean),forcedJSONParsing:Ao.transitional(Ao.boolean),clarifyTimeoutError:Ao.transitional(Ao.boolean),legacyInterceptorReqResOrdering:Ao.transitional(Ao.boolean),advertiseZstdAcceptEncoding:Ao.transitional(Ao.boolean),validateStatusUndefinedResolves:Ao.transitional(Ao.boolean),encodeBasicAuthUsername:Ao.transitional(Ao.boolean)},!1),s!=null&&(he.isFunction(s)?n.paramsSerializer={serialize:s}:Bv.assertOptions(s,{encode:Ao.function,serialize:Ao.function},!0)),n.allowAbsoluteUrls!==void 0||(he.hasOwnProp(this.defaults,"allowAbsoluteUrls")&&this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Bv.assertOptions(n,{baseUrl:Ao.spelling("baseURL"),withXsrfToken:Ao.spelling("withXSRFToken")},!0),n.method=(he.getSafeProp(n,"method")||he.getSafeProp(this.defaults,"method")||"get").toLowerCase();const i=he.getSafeProp(r,"common"),a=he.getSafeProp(r,n.method),l=r&&he.merge(O0(i)?i:void 0,O0(a)?a:void 0);r&&he.forEach(tM.concat("common"),v=>{O0(he.getSafeProp(r,v))&&delete r[v]}),n.headers=Do.concat(l,r);const c=[];let u=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(n)===!1)return;u=u&&C.synchronous;const S=n.transitional||S0;S&&S.legacyInterceptorReqResOrdering?c.unshift(C.fulfilled,C.rejected):c.push(C.fulfilled,C.rejected)});const d=[];this.interceptors.response.forEach(function(C){d.push(C.fulfilled,C.rejected)});let h,f=0,p;if(!u){const v=[A0.bind(this),void 0];for(v.unshift(...c),v.push(...d),p=v.length,h=Promise.resolve(n);f<p;)h=h.then(v[f++],v[f++]);return h}p=c.length;let g=n;for(;f<p;){const v=c[f++],C=c[f++];try{g=v?v(g):g}catch(S){if(!C){h=Promise.reject(S);break}try{const b=C.call(this,S);he.isThenable(b)&&(h=Promise.resolve(b).then(()=>A0.call(this,g)))}catch(b){h=Promise.reject(b)}break}}if(!h)try{h=A0.call(this,g)}catch(v){h=Promise.reject(v)}for(f=0,p=d.length;f<p;)h=h.then(d[f++],d[f++]);return h}getUri(t){t=Dc(this.defaults,t);const n=uM(t.baseURL,t.url,t.allowAbsoluteUrls,t);return jO(n,t.params,t.paramsSerializer)}};he.forEach(["delete","get","head","options"],function(t){Ic.prototype[t]=async function(n,o){return this.request(Dc(o||{},{method:t,url:n,data:o&&he.hasOwnProp(o,"data")?o.data:void 0}))}}),he.forEach(["post","put","patch","query"],function(t){function n(o){return async function(r,i,a){return this.request(Dc(a||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Ic.prototype[t]=n(),t!=="query"&&(Ic.prototype[t+"Form"]=n(!0))});let bte=class qG{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const o=this;this.promise.then(s=>{if(!o._listeners)return;let r=o._listeners.length;for(;r-- >0;)o._listeners[r](s);o._listeners=null}),this.promise.then=s=>{let r;const i=new Promise(a=>{o.subscribe(a),r=a}).then(s);return i.cancel=function(){o.unsubscribe(r)},i},t(function(r,i,a){o.reason||(o.reason=new Yf(r,i,a),n(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new qG(function(s){t=s}),cancel:t}}};function Ste(e){return function(n){return e.apply(null,n)}}function Ete(e){return he.isObject(e)&&e.isAxiosError===!0}const $v={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries($v).forEach(([e,t])=>{$v[t]===void 0&&($v[t]=e)});function PM(e){const t=new Ic(e),n=IO(Ic.prototype.request,t);return he.extend(n,Ic.prototype,t,{allOwnKeys:!0}),he.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return PM(Dc(e,s))},n}const to=PM(qf);to.Axios=Ic,to.CanceledError=Yf,to.CancelToken=bte,to.isCancel=nM,to.VERSION=P0,to.toFormData=Av,to.AxiosError=at,to.Cancel=to.CanceledError,to.all=function(t){return Promise.all(t)},to.spread=Ste,to.isAxiosError=Ete,to.mergeConfig=Dc,to.AxiosHeaders=Do,to.formToJSON=e=>eM(he.isHTMLForm(e)?new FormData(e):e),to.getAdapter=DM.getAdapter,to.HttpStatusCode=$v,to.default=to;const{Axios:mIe,AxiosError:vIe,CanceledError:yIe,isCancel:wIe,CancelToken:CIe,VERSION:bIe,all:SIe,Cancel:EIe,isAxiosError:_te,spread:_Ie,toFormData:RIe,AxiosHeaders:TIe,HttpStatusCode:DIe,formToJSON:IIe,getAdapter:xIe,mergeConfig:PIe,create:kIe}=to;class Zf extends Error{constructor(t,n,o,s,r){super(t),this.name="ApiError",this.statusCode=n,this.code=o,this.details=s,this.type=r,Object.setPrototypeOf(this,Zf.prototype)}}const Rte=e=>{var t,n;if(_te(e)){const o=(t=e.response)==null?void 0:t.status,s=(n=e.response)==null?void 0:n.data,r=(s==null?void 0:s.message)||e.message||"An unexpected error occurred",i=(s==null?void 0:s.code)||e.code,a=(s==null?void 0:s.details)||s;let l="UNKNOWN";return!o||e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?l=e.code==="ECONNABORTED"?"TIMEOUT":"NETWORK":o>=500?l="SERVER":o===od.UNAUTHORIZED||o===od.FORBIDDEN?l="AUTH":o===od.UNPROCESSABLE_ENTITY||o===od.BAD_REQUEST?l="VALIDATION":o>=od.BAD_REQUEST&&(l="CLIENT"),new Zf(r,o,i,a,l)}return e instanceof Error?new Zf(e.message,void 0,void 0,void 0,"UNKNOWN"):new Zf("An unknown error occurred",void 0,void 0,void 0,"UNKNOWN")};function kM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function FM(e,t,n,o,s,r,i){try{var a=e[r](i),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(o,s)}function M0(e){return function(){var t=this,n=arguments;return new Promise(function(o,s){var r=e.apply(t,n);function i(l){FM(r,o,s,i,a,"next",l)}function a(l){FM(r,o,s,i,a,"throw",l)}i(void 0)})}}function N0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tte(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,OM(o.key),o)}}function L0(e,t,n){return t&&Tte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dte(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=kte(e))||t){n&&(e=n);var o=0,s=function(){};return{s,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
159
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){a=!0,r=l},f:function(){try{i||n.return==null||n.return()}finally{if(a)throw r}}}}function ad(e,t,n){return(t=OM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,o)}return n}function ld(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AM(Object(n),!0).forEach(function(o){ad(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AM(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Ite(e,t){if(e==null)return{};var n,o,s=xte(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function xte(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}function xc(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function r(f,p,g,v){var C=p&&p.prototype instanceof a?p:a,S=Object.create(C.prototype);return Us(S,"_invoke",function(b,y,_){var E,D,T,P=0,L=_||[],I=!1,x={p:0,n:0,v:e,a:O,f:O.bind(e,4),d:function(N,F){return E=N,D=0,T=e,x.n=F,i}};function O(N,F){for(D=N,T=F,t=0;!I&&P&&!z&&t<L.length;t++){var z,j=L[t],Q=x.p,re=j[2];N>3?(z=re===F)&&(T=j[(D=j[4])?5:(D=3,3)],j[4]=j[5]=e):j[0]<=Q&&((z=N<2&&Q<j[1])?(D=0,x.v=F,x.n=j[1]):Q<re&&(z=N<3||j[0]>F||F>re)&&(j[4]=N,j[5]=F,x.n=re,D=0))}if(z||N>1)return i;throw I=!0,F}return function(N,F,z){if(P>1)throw TypeError("Generator is already running");for(I&&F===1&&O(F,z),D=F,T=z;(t=D<2?e:T)||!I;){E||(D?D<3?(D>1&&(x.n=-1),O(D,T)):x.n=T:x.v=T);try{if(P=2,E){if(D||(N="next"),t=E[N]){if(!(t=t.call(E,T)))throw TypeError("iterator result is not an object");if(!t.done)return t;T=t.value,D<2&&(D=0)}else D===1&&(t=E.return)&&t.call(E),D<2&&(T=TypeError("The iterator does not provide a '"+N+"' method"),D=1);E=e}else if((t=(I=x.n<0)?T:b.call(y,x))!==i)break}catch(j){E=e,D=1,T=j}finally{P=1}}return{value:t,done:I}}}(f,g,v),!0),S}var i={};function a(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][o]?t(t([][o]())):(Us(t={},o,function(){return this}),t),d=c.prototype=a.prototype=Object.create(u);function h(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,c):(f.__proto__=c,Us(f,s,"GeneratorFunction")),f.prototype=Object.create(d),f}return l.prototype=c,Us(d,"constructor",c),Us(c,"constructor",l),l.displayName="GeneratorFunction",Us(c,s,"GeneratorFunction"),Us(d),Us(d,s,"Generator"),Us(d,o,function(){return this}),Us(d,"toString",function(){return"[object Generator]"}),(xc=function(){return{w:r,m:h}})()}function Us(e,t,n,o){var s=Object.defineProperty;try{s({},"",{})}catch{s=0}Us=function(r,i,a,l){function c(u,d){Us(r,u,function(h){return this._invoke(u,d,h)})}i?s?s(r,i,{value:a,enumerable:!l,configurable:!l,writable:!l}):r[i]=a:(c("next",0),c("throw",1),c("return",2))},Us(e,t,n,o)}function Pte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function OM(e){var t=Pte(e,"string");return typeof t=="symbol"?t:t+""}function Hv(e){"@babel/helpers - typeof";return Hv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hv(e)}function kte(e,t){if(e){if(typeof e=="string")return kM(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kM(e,t):void 0}}var V0=function(e){return e.TOOLBOX_EXPORT_DATA="TOOLBOX_EXPORT_DATA",e.SW_APP_LOADER="SW_APP_LOADER",e}({});function MM(e){return Hv(e)==="object"&&e!==null&&!Array.isArray(e)}function NM(e,t){var n=Object.keys(e);return n.length===t.length&&t.every(function(o){return n.includes(o)})}function Fte(e){return typeof Blob<"u"&&e instanceof Blob}var Ate=function(t){return MM(t)&&NM(t,["file","fileName"])&&Fte(t.file)&&typeof t.fileName=="string"},Ote=function(t){return MM(t)&&NM(t,["scene_id","people_id","openGS","queryParams"])&&(typeof t.scene_id=="string"||t.scene_id===null)&&(typeof t.people_id=="string"||t.people_id===null)&&(typeof t.openGS=="boolean"||t.openGS===null)&&typeof t.queryParams=="string"},Mte=Object.freeze(ad(ad({},V0.TOOLBOX_EXPORT_DATA,Ate),V0.SW_APP_LOADER,Ote));function Nte(e){return Hv(e)==="object"&&e!==null&&!Array.isArray(e)}function Lte(e,t){var n=Object.keys(e);return n.length===t.length&&t.every(function(o){return n.includes(o)})}function Vte(e){if(!Nte(e))return{valid:!1,reason:"Message must be an object."};if(e.version!==1)return{valid:!1,reason:"Unsupported or missing message version."};if(typeof e.type!="string"||!Object.values(V0).includes(e.type))return{valid:!1,reason:"Unknown or missing message type."};if(e.id!==void 0&&typeof e.id!="string")return{valid:!1,reason:"Message id must be a string when provided."};var t=e.id===void 0?["version","type","payload"]:["version","type","payload","id"];if(!Lte(e,t))return{valid:!1,reason:"Message contains missing or unexpected fields."};var n=e.type;return Mte[n](e.payload)?{valid:!0,message:e}:{valid:!1,reason:"Payload does not match the ".concat(n," schema.")}}function Bte(e){var t=e.target,n=e.allowedOrigins,o=e.onMessage,s=e.onInvalidMessage,r=t??(typeof window>"u"?void 0:window);if(!r)throw new TypeError("A target window is required outside a browser environment.");if(!Array.isArray(n)||n.length===0)throw new TypeError("At least one allowed message origin must be configured.");if(n.some(function(a){return typeof a!="string"||a.length===0||a==="*"}))throw new TypeError("Allowed message origins must be explicit origin strings; wildcards are not allowed.");if(typeof o!="function")throw new TypeError("An onMessage callback is required.");var i=function(l){if(!n.includes(l.origin)){s==null||s(l.data,"Untrusted message origin: ".concat(l.origin),l);return}var c=Vte(l.data);if(c.valid===!1){s==null||s(l.data,c.reason,l);return}o(c.message,l)};return r.addEventListener("message",i),function(){return r.removeEventListener("message",i)}}let $te=class extends Error{},hl=class extends $te{constructor(){super("Zone is an abstract class")}},LM=class{get type(){throw new hl}get name(){throw new hl}get ianaName(){return this.name}get isUniversal(){throw new hl}offsetName(t,n){throw new hl}formatOffset(t,n){throw new hl}offset(t){throw new hl}equals(t){throw new hl}get isValid(){throw new hl}};const B0=new Map;function Hte(e){let t=B0.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),B0.set(e,t)),t}const Gte={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ute(e,t){const n=e.format(t).replace(/\u200E/g,""),o=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,s,r,i,a,l,c,u]=o;return[i,s,r,a,l,c,u]}function Wte(e,t){const n=e.formatToParts(t),o=[];for(let s=0;s<n.length;s++){const{type:r,value:i}=n[s],a=Gte[r];r==="era"?o[a]=i:Gv(a)||(o[a]=parseInt(i,10))}return o}const $0=new Map;let zte=class xT extends LM{static create(t){let n=$0.get(t);return n===void 0&&$0.set(t,n=new xT(t)),n}static resetCache(){$0.clear(),B0.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=xT.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:n,locale:o}){return Yte(t,n,o,this.name)}formatOffset(t,n){return Wv(this.offset(t),n)}offset(t){if(!this.valid)return NaN;const n=new Date(t);if(isNaN(n))return NaN;const o=Hte(this.name);let[s,r,i,a,l,c,u]=o.formatToParts?Wte(o,n):Ute(o,n);a==="BC"&&(s=-Math.abs(s)+1);const h=qte({year:s,month:r,day:i,hour:l===24?0:l,minute:c,second:u,millisecond:0});let f=+n;const p=f%1e3;return f-=p>=0?p:1e3+p,(h-f)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}},H0=null,jte=class yg extends LM{static get utcInstance(){return H0===null&&(H0=new yg(0)),H0}static instance(t){return t===0?yg.utcInstance:new yg(t)}static parseSpecifier(t){if(t){const n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new yg(BM(n[1],n[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Wv(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Wv(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,n){return Wv(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}};function Gv(e){return typeof e>"u"}function Uv(e,t=2){const n=e<0;let o;return n?o="-"+(""+-e).padStart(t,"0"):o=(""+e).padStart(t,"0"),o}function VM(e){if(!(Gv(e)||e===null||e===""))return parseInt(e,10)}function Kte(e){if(!(Gv(e)||e===null||e==="")){const t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function qte(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Yte(e,t,n,o=null){const s=new Date(e),r={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};o&&(r.timeZone=o);const i={timeZoneName:t,...r},a=new Intl.DateTimeFormat(n,i).formatToParts(s).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function BM(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const o=parseInt(t,10)||0,s=n<0||Object.is(n,-0)?-o:o;return n*60+s}function Wv(e,t){const n=Math.trunc(Math.abs(e/60)),o=Math.trunc(Math.abs(e%60)),s=e>=0?"+":"-";switch(t){case"short":return`${s}${Uv(n,2)}:${Uv(o,2)}`;case"narrow":return`${s}${n}${o>0?`:${o}`:""}`;case"techie":return`${s}${Uv(n,2)}${Uv(o,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}const $M=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function cd(...e){const t=e.reduce((n,o)=>n+o.source,"");return RegExp(`^${t}$`)}function ud(...e){return t=>e.reduce(([n,o,s],r)=>{const[i,a,l]=r(t,s);return[{...n,...i},a||o,l]},[{},null,1]).slice(0,2)}function HM(...e){return(t,n)=>{const o={};let s;for(s=0;s<e.length;s++)o[e[s]]=VM(t[n+s]);return[o,null,n+s]}}const GM=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Xte=`(?:${GM.source}?(?:\\[(${$M.source})\\])?)?`,UM=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,WM=RegExp(`${UM.source}${Xte}`),G0=RegExp(`(?:[Tt]${WM.source})?`),Zte=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Jte=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Qte=/(\d{4})-?(\d{3})/,ene=HM("weekYear","weekNumber","weekDay"),tne=HM("year","ordinal"),nne=/(\d{4})-(\d\d)-(\d\d)/,zM=RegExp(`${UM.source} ?(?:${GM.source}|(${$M.source}))?`),one=RegExp(`(?: ${zM.source})?`);function dd(e,t,n){const o=e[t];return Gv(o)?n:VM(o)}function sne(e,t){return[{year:dd(e,t),month:dd(e,t+1,1),day:dd(e,t+2,1)},null,t+3]}function hd(e,t){return[{hours:dd(e,t,0),minutes:dd(e,t+1,0),seconds:dd(e,t+2,0),milliseconds:Kte(e[t+3])},null,t+4]}function Jf(e,t){const n=!e[t]&&!e[t+1],o=BM(e[t+1],e[t+2]),s=n?null:jte.instance(o);return[{},s,t+3]}function Qf(e,t){const n=e[t]?zte.create(e[t]):null;return[{},n,t+1]}cd(Zte,G0),cd(Jte,G0),cd(Qte,G0),cd(WM),ud(sne,hd,Jf,Qf),ud(ene,hd,Jf,Qf),ud(tne,hd,Jf,Qf),ud(hd,Jf,Qf),ud(hd),cd(nne,one),cd(zM),ud(hd,Jf,Qf);var rne=["accessTokenKey","refreshTokenKey","domain","path","secure","sameSite","canSetTokens","cookieParser"];function Dt(){if(typeof sessionStorage<"u"&&sessionStorage.getItem("APP_DEBUG")==="1"){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).log.apply(e,["[DEBUG COMMON_UTILS]"].concat(n))}}function ep(){if(typeof sessionStorage<"u"&&sessionStorage.getItem("APP_DEBUG")==="1"){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).error.apply(e,["[DEBUG COMMON_UTILS]"].concat(n))}}function zv(){if(typeof sessionStorage<"u"&&sessionStorage.getItem("APP_DEBUG")==="1"){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).warn.apply(e,["[DEBUG COMMON_UTILS]"].concat(n))}}function ine(){var e=typeof window<"u"?sessionStorage.getItem("BASE_DOMAIN_COOKIE")||window.location.hostname:void 0;return Dt("getStandardizedCookieConfig - domain:",e,"from BASE_DOMAIN_COOKIE:",sessionStorage.getItem("BASE_DOMAIN_COOKIE")),{accessTokenKey:"account.token",refreshTokenKey:"account.refresh_token",domain:e,path:"/",secure:!0,sameSite:"lax"}}function ane(){return{maxRetries:5,retryDelay:500,backoffFactor:1.5}}var jM=1e3,lne=1e4;function KM(e){if(!(typeof window>"u")){var t=window.self!==window.top;try{if(t&&window.top){Dt("Inside iframe - redirecting top window to:",e),window.top.location.replace(e);return}}catch(n){ep("Top window redirect blocked, redirecting current window instead:",n)}try{Dt("Redirecting current window to:",e),window.location.replace(e)}catch(n){ep("Failed to redirect:",n)}}}function jv(e){return typeof e!="string"||!e?e:e.length<=2?"*".repeat(e.length):"".concat(e[0]).concat("*".repeat(e.length-2)).concat(e[e.length-1])}function cne(e){return ld(ld({},e),{},{access_token:jv(e.access_token),token:jv(e.token),refresh_token:jv(e.refresh_token)})}function Kv(e){if(!e)return!1;var t=e.trim();return!!t&&t!=="undefined"&&t!=="null"}function qM(e){return Kv(e.getAccessToken())||Kv(e.getRefreshToken())}function une(e){if(!(typeof document>"u")){var t=typeof window<"u"?window.location.hostname:"",n=e||(typeof sessionStorage<"u"?sessionStorage.getItem("BASE_DOMAIN_COOKIE"):null)||t,o=Array.from(new Set([n,t].filter(Boolean)));Dt("Clearing all cookies - domains:",o);var s=document.cookie.split(";");s.forEach(function(r){var i=r.split("=")[0].trim();i&&(document.cookie="".concat(i,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"),o.forEach(function(a){document.cookie="".concat(i,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=").concat(a)}))})}}function dne(){typeof sessionStorage<"u"&&sessionStorage.clear()}function hne(e){return function(t){var n,o=(n=t.response)===null||n===void 0?void 0:n.status,s=qM(e);if(Dt("getStandardizedTokenExpiredDetection - status:",o,"userLoggedIn:",s),!s)return Dt("User not logged in - returning false"),!1;if(o===400){var r,i,a,l=(r=t.response)===null||r===void 0?void 0:r.data,c=(l==null?void 0:l.error)==="invalid_token"||(l==null||(i=l.error)===null||i===void 0?void 0:i.key)==="invalid_token";return Dt(" 400 error - isInvalidToken:",c,"error:",l==null?void 0:l.error,"error.key:",l==null||(a=l.error)===null||a===void 0?void 0:a.key),!1}if(o===401){var u,d,h=(u=t.response)===null||u===void 0?void 0:u.data,f=h==null||(d=h.error)===null||d===void 0?void 0:d.key,p=h==null?void 0:h.details;return Dt(" 401 error - errorKey:",f,"details:",p),f==="unauthenticated"&&(!p||Object.keys(p).length===0||p.reason==="refresh_token_expired")?(Dt(" 401 unauthenticated - triggering refresh"),!0):(Dt(" 401 error but not unauthenticated - returning false"),!1)}return o===425?(Dt(" 425 error - triggering refresh"),!0):(Dt("Status",o,"not handled - returning false"),!1)}}var fne=function(){function e(){var t,n,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};N0(this,e),this.accessTokenKey=o.accessTokenKey||"access_token",this.refreshTokenKey=o.refreshTokenKey||"refresh_token",this.domain=o.domain,this.path=o.path||"/",this.secure=(t=o.secure)!==null&&t!==void 0?t:!0,this.sameSite=o.sameSite||"lax",this.canSetTokens=(n=o.canSetTokens)!==null&&n!==void 0?n:!0,this.cookieParser=o.cookieParser}return L0(e,[{key:"getCookieValue",value:function(n){if(typeof document>"u")return null;var o=document.cookie.split(";"),s=Dte(o),r;try{for(s.s();!(r=s.n()).done;){var i=r.value;if(i=i.trim(),i.startsWith(n+"=")){var a=i.substring(n.length+1);return this.cookieParser?this.cookieParser(a,n):decodeURIComponent(a)}}}catch(l){s.e(l)}finally{s.f()}return null}},{key:"getAccessToken",value:function(){return this.getCookieValue(this.accessTokenKey)}},{key:"getRefreshToken",value:function(){return this.getCookieValue(this.refreshTokenKey)}},{key:"getExpiresInRefreshToken",value:function(){return this.getCookieValue("account.expires_in_refresh_token")}},{key:"setTokens",value:function(n){if(!this.canSetTokens||typeof document>"u"){zv(" CookieTokenStorage: Token setting is disabled or running in a non-browser environment");return}Dt(" setTokens called - storing tokens with keys:",this.accessTokenKey,this.refreshTokenKey,"domain:",this.domain);var o=this.domain?"; domain=".concat(this.domain):"",s=this.secure?"; secure":"",r="; samesite=".concat(this.sameSite),i="",a="";if(n.expires_in&&typeof n.expires_in=="number"){var l=new Date;l.setTime(l.getTime()+n.expires_in*1e3),i=";expires=".concat(l.toUTCString())}var c=this.getExpiresInRefreshToken();if(Dt("setTokens - refresh token data:",cne(n)),Dt("setTokens - refresh token expires_in value:",c),c){var u=new Date;u.setTime(u.getTime()+Number(c)*1e3),a=";expires=".concat(u.toUTCString())}if(n.access_token||n.token){var d=n.access_token||n.token,h="".concat(this.accessTokenKey,"=").concat(encodeURIComponent(d),"; path=").concat(this.path).concat(o).concat(s).concat(r).concat(i);document.cookie=h}if(n.refresh_token_expires_in&&typeof n.refresh_token_expires_in=="number"){var f=new Date;f.setTime(f.getTime()+n.refresh_token_expires_in*1e3),i=";expires=".concat(f.toUTCString())}if(n.refresh_token){Dt("setTokens - refresh token set to:",jv(n.refresh_token)),Dt("setTokens - refresh token expires_in set to:",a);var p="".concat(this.refreshTokenKey,"=").concat(encodeURIComponent(n.refresh_token),"; path=").concat(this.path).concat(o).concat(s).concat(r).concat(a);document.cookie=p}}},{key:"hasTokens",value:function(){return!!this.getAccessToken()&&!!this.getRefreshToken()}}])}(),pne=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auth_state_channel",n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"auth_state_event";N0(this,e),ad(this,"channel",null),this.channelName=t,this.storageKey=n,this.initChannel()}return L0(e,[{key:"initChannel",value:function(){if(typeof BroadcastChannel<"u")try{this.channel=new BroadcastChannel(this.channelName)}catch(n){console.error("Failed to create BroadcastChannel, falling back to storage events:",n),this.channel=null}}},{key:"broadcastEvent",value:function(n){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={type:n,data:s,timestamp:Date.now()};this.channel?this.channel.postMessage(r):typeof localStorage<"u"&&(localStorage.setItem(this.storageKey,JSON.stringify(r)),setTimeout(function(){return localStorage.removeItem(o.storageKey)},100))}},{key:"onEvent",value:function(n){var o=this;return this.channel?this.channel.onmessage=function(s){n(s.data)}:typeof window<"u"&&window.addEventListener("storage",function(s){if(s.key===o.storageKey&&s.newValue)try{var r=JSON.parse(s.newValue);n(r)}catch(i){console.error("Failed to parse auth event:",i)}}),function(){o.channel?o.channel.onmessage=null:typeof window<"u"&&window.removeEventListener("storage",function(){})}}},{key:"destroy",value:function(){this.channel&&(this.channel.close(),this.channel=null)}}])}(),gne=function(){function e(t){var n=this;if(N0(this,e),ad(this,"currentAttempt",0),ad(this,"isLoggingOut",!1),this.instanceId=Math.random().toString(36).substring(2,15),this.refreshTokenFn=t.refreshTokenFn,this.tokenStorage=t.storage,this.useStandardizedConfig=t.useStandardizedConfig===!0,Dt("RefreshTokenHandler initialized - useStandardizedConfig:",this.useStandardizedConfig),this.useStandardizedConfig){var o=ane();this.maxRetries=o.maxRetries,this.retryDelay=o.retryDelay,this.backoffFactor=o.backoffFactor,Dt(" Using standardized retry config - maxRetries:",this.maxRetries,"retryDelay:",this.retryDelay,"backoffFactor:",this.backoffFactor)}else this.maxRetries=t.maxRetries||3,this.retryDelay=t.retryDelay||1e3,this.backoffFactor=t.backoffFactor||2,Dt(" Using custom retry config - maxRetries:",this.maxRetries,"retryDelay:",this.retryDelay,"backoffFactor:",this.backoffFactor);this.onCrossTabLogout=t.onCrossTabLogout,this.authStateManager=new pne,this.initCrossTabListener(),this.onRefreshSuccess=t.onRefreshSuccess||function(){Dt("Token refresh successful")},this.onRefreshFailure=t.onRefreshFailure||function(s){console.error("Token refresh failed:",s)},this.onTokenInvalid=t.onTokenInvalid||function(){Dt("Token is invalid or cannot be refreshed");var s=new Error("No refresh token available");n.useStandardizedConfig?n.handleLogout("no_refresh_token",s):(n.onRefreshFailure(s),n.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:n.instanceId,reason:"no_refresh_token",error:"No refresh token available"}))}}return L0(e,[{key:"isLogoutInProgress",get:function(){return this.isLoggingOut}},{key:"handleLogout",value:function(n,o){if(this.isLoggingOut){Dt("handleLogout skipped - logout already in progress");return}Dt("handleLogout called with reason:",n),this.onRefreshFailure&&(Dt("Calling onRefreshFailure callback"),this.onRefreshFailure(o));var s=this.getLogoutTag(n,"this-tab");this.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:this.instanceId,reason:n,tag:s,error:(o==null?void 0:o.message)||"Token refresh failed"}),this.clearStateAndRedirectToLogin(s)}},{key:"getLogoutTag",value:function(n,o){return Kv(this.tokenStorage.getRefreshToken())?(console.error("False logout detected. Refresh token not expired. Reason: ".concat(n)),console.error("Sender channel: ".concat(o)),-1):1}},{key:"clearStateAndRedirectToLogin",value:function(n){if(!this.isLoggingOut){this.isLoggingOut=!0;var o=typeof sessionStorage<"u"&&sessionStorage.getItem("BASE_URL")||"",s=typeof sessionStorage<"u"&&sessionStorage.getItem("BASE_DOMAIN_COOKIE")||void 0;if(typeof localStorage<"u"&&typeof window<"u")try{var r="".concat(window.location.pathname).concat(window.location.search);localStorage.setItem("last_url_access_after_timeout",r),localStorage.removeItem("retryCount"),Dt("localStorage updated - saved last URL:",r)}catch(a){ep("Failed to update localStorage:",a)}Dt("Clearing sessionStorage and cookies"),dne(),une(s);var i="".concat(o,"/login?timeout=").concat(n);Dt("Redirecting to login in ".concat(jM,"ms:"),i),setTimeout(function(){return KM(i)},jM)}}},{key:"initCrossTabListener",value:function(){var n=this;this.authStateManager.onEvent(function(o){if(o.type==="auth:logout")if(Dt("Received logout event:",o.data),o.data&&o.data.sourceInstanceId!==n.instanceId){if(Dt("Logout event from different tab, executing logout handlers"),n.onCrossTabLogout?(Dt("Executing onCrossTabLogout with reason: ".concat(o.data.reason||"cross_tab_logout")),n.onCrossTabLogout(o.data.reason||"cross_tab_logout")):typeof n.onLogout=="function"?(Dt("Executing legacy onLogout with reason: ".concat(o.data.reason)),n.onLogout(o.data.reason)):n.useStandardizedConfig||console.warn("No logout handler defined for cross-tab events"),n.useStandardizedConfig){var s=o.data.tag===-1||o.data.tag===1,r=s?o.data.tag:n.getLogoutTag(o.data.reason||"cross_tab_logout","cross-tab");s&&r===-1&&(console.error("False logout detected. Reason: ".concat(o.data.reason||"cross_tab_logout")),console.error("Sender channel: cross-tab")),Dt("Standardized mode - logging out this tab after cross-tab event, tag:",r),n.clearStateAndRedirectToLogin(r)}}else Dt("Ignoring self-generated logout event")})}},{key:"handleTokenRefresh",value:function(){var t=M0(xc().m(function o(){var s=this,r,i,a,l;return xc().w(function(c){for(;;)switch(c.p=c.n){case 0:if(r=this.tokenStorage.getRefreshToken(),Dt(" handleTokenRefresh started, refreshToken available:",!!r),r){c.n=1;break}return Dt(" ERROR: No refresh token available - cannot refresh"),this.onTokenInvalid(),c.a(2,!1);case 1:return this.currentAttempt=0,c.p=2,c.n=3,this.executeWithRetry(function(){return Dt("Refresh attempt ".concat(s.currentAttempt+1,"/").concat(s.maxRetries)),s.refreshTokenFn(s.tokenStorage.getRefreshToken())});case 3:if(i=c.v,!(!i||!i.access_token&&!i.token)){c.n=4;break}throw console.error("Invalid token response received"),new Error("Invalid token response");case 4:return i.token&&!i.access_token&&(i.access_token=i.token),Dt(" Token refresh successful, saving new tokens"),this.tokenStorage.setTokens(i),Dt(" Calling onRefreshSuccess callback"),this.onRefreshSuccess(i),c.a(2,!0);case 5:return c.p=5,l=c.v,console.error("Token refresh failed after all attempts:",l),l===void 0&&(l=new Error("Undefined error during token refresh")),this.useStandardizedConfig?this.handleLogout("max_retry_reached",l):(this.onRefreshFailure(l),this.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:this.instanceId,reason:"max_retry_reached",error:((a=l)===null||a===void 0?void 0:a.message)||"Token refresh failed after maximum retries"})),c.a(2,!1)}},o,this,[[2,5]])}));function n(){return t.apply(this,arguments)}return n}()},{key:"executeWithRetry",value:function(){var t=M0(xc().m(function o(s){var r,i,a,l;return xc().w(function(c){for(;;)switch(c.p=c.n){case 0:return c.p=0,c.n=1,s();case 1:return c.a(2,c.v);case 2:if(c.p=2,l=c.v,this.currentAttempt++,!(this.currentAttempt>=this.maxRetries)){c.n=3;break}throw Dt("Maximum retry attempts (".concat(this.maxRetries,") reached")),l;case 3:return i=(l==null||(r=l.response)===null||r===void 0?void 0:r.status)===425,a=i?this.getRetryAfterDelay(l):this.retryDelay*Math.pow(this.backoffFactor,this.currentAttempt-1),Dt("Retry in ".concat(a,"ms, attempt ").concat(this.currentAttempt,"/").concat(this.maxRetries)),c.n=4,new Promise(function(u){return setTimeout(u,a)});case 4:return c.a(2,this.executeWithRetry(s))}},o,this,[[0,2]])}));function n(o){return t.apply(this,arguments)}return n}()},{key:"getRetryAfterDelay",value:function(n){var o;if(n!=null&&(o=n.response)!==null&&o!==void 0&&o.headers){var s=n.response.headers["retry-after"];if(s){var r=parseInt(s,10);if(!isNaN(r))return r*1e3;var i=new Date(s);if(!isNaN(i.getTime()))return i.getTime()-Date.now()}}return this.retryDelay*Math.pow(this.backoffFactor,this.currentAttempt-1)}},{key:"broadcastLogout",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"manual_logout";Dt("Broadcasting logout event with reason: ".concat(n)),this.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:this.instanceId,reason:n,timestamp:Date.now()})}}])}();function mne(e,t){var n,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=(n=o.useStandardizedConfig)!==null&&n!==void 0?n:t.useStandardizedConfig;Dt("createRefreshInterceptor called - useStandardizedConfig:",s);var r=s?hne(t.tokenStorage):o.tokenExpiredDetection||function(c){var u;return((u=c.response)===null||u===void 0?void 0:u.status)===401},i=s?[401,425]:o.retryStatusCodes||[401,425],a=o.tokenHeaderFormatter||function(c){return"Bearer ".concat(c)};Dt("Interceptor config - retryStatusCodes:",i,"using standardized detection:",s);var l=null;e.interceptors.response.use(function(c){return c},function(){var c=M0(xc().m(function u(d){var h,f,p,g,v,C,S,b,y,_,E,D,T,P,L,I,x,O,N,F,z;return xc().w(function(j){for(;;)switch(j.p=j.n){case 0:if(g=d.config,v=function(re){var q,V=s&&t.isLogoutInProgress;return zv(V?"HOLD ->":"REJECT ->",((g==null?void 0:g.method)||"").toUpperCase(),g==null?void 0:g.url,"| status:",(q=d.response)===null||q===void 0?void 0:q.status,"| reason:",re,"| logoutInProgress:",t.isLogoutInProgress,"| at:",new Date().toISOString().slice(11,23)),V?new Promise(function(k,G){setTimeout(function(){zv("Logout redirect did not happen in time - releasing held request:",g==null?void 0:g.url),G(d)},lne)}):Promise.reject(d)},g){j.n=1;break}return j.a(2,v("no request config"));case 1:if(!g._retry){j.n=2;break}return j.a(2,v("retried request failed again"));case 2:if(C=(h=d.response)===null||h===void 0?void 0:h.status,Dt(" Response error handler triggered - status:",C,"url:",g.url),S=r(d),Dt(" tokenExpiredDetection returned:",S),b=!1,C===400)if(E=(y=d.response)===null||y===void 0?void 0:y.data,D=(E==null?void 0:E.error)==="invalid_token"||(E==null||(_=E.error)===null||_===void 0?void 0:_.key)==="invalid_token",D)if(b=!1,s){if(Dt(" 400 invalid_token (standardized) - clearing account.token from cookies"),typeof document<"u")try{T=sessionStorage.getItem("BASE_DOMAIN_COOKIE")||window.location.hostname,Dt(" Clearing account.token - domain:",T),document.cookie="account.token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=".concat(T),document.cookie="account.token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/",Dt(" ✅ Removed account.token from cookies (prevents infinite 400 loop)")}catch(Q){ep(" Failed to clear account.token:",Q)}typeof window<"u"&&(P=sessionStorage.getItem("BASE_URL")||"",L="".concat(P,"/sw?redirect=1"),Dt("Redirecting to re-auth page - URL:",L),KM(L))}else Dt(" 400 invalid_token (custom config) - user handles via callbacks");else b=!1,Dt(" 400 non-invalid_token - skip refresh");else s&&C===401&&!qM(t.tokenStorage)?(I=typeof window<"u"&&window.location.pathname.includes("/login"),x=/login|refresh-token|refreshToken/i.test(g.url||""),I||x?Dt("401 with no tokens on login page/auth request - not redirecting"):(Dt("401 with no tokens - logging out and redirecting to /login"),t.handleLogout("no_tokens",new Error("No authentication tokens available"))),b=!1):(b=S&&i.includes(C),Dt(" Status",C,"- shouldRefresh:",S,"in retryStatusCodes:",i.includes(C),"canRetry:",b));if(b){j.n=3;break}return j.a(2,v("not eligible for refresh"));case 3:if(O=((f=g.url)===null||f===void 0?void 0:f.includes("refresh-token"))||((p=g.url)===null||p===void 0?void 0:p.includes("refreshToken")),!O){j.n=4;break}return j.a(2,v("refresh endpoint itself failed"));case 4:return g._retry=!0,j.p=5,l?Dt(" Using existing refresh promise"):(Dt(" Starting new token refresh"),l=t.handleTokenRefresh()),j.n=6,l;case 6:if(N=j.v,l=null,N){j.n=7;break}return j.a(2,v("token refresh failed (waiting request)"));case 7:return F=t.tokenStorage.getAccessToken(),Dt(" Token refreshed successfully, new token available:",!!F),F?(Dt(" Injecting refreshed token into Authorization header for retry"),g.headers.Authorization=a(F)):zv(" WARNING: Token refresh succeeded but no token in storage!"),Dt(" Retrying original request with new token"),j.a(2,e(g));case 8:return j.p=8,z=j.v,ep(" Error during refresh:",z),l=null,j.a(2,v("error thrown during refresh"))}},u,null,[[5,8]])}));return function(u){return c.apply(this,arguments)}}()),e.interceptors.request.use(function(c){var u=c.headers.Authorization;if(u){var d=String(u).replace(/^Bearer\s*/i,"").trim();if(d&&d!=="undefined"&&d!=="null")return c;Dt("Removing invalid Authorization header:",u),delete c.headers.Authorization}var h=t.tokenStorage.getAccessToken(),f=t.tokenStorage.getRefreshToken();return Dt(" Request interceptor: token exists:",!!h,"refreshToken exists:",!!f,"url:",c.url),h&&Kv(h)?(Dt(" Access token available - injecting into Authorization header"),c.headers.Authorization=a(h)):Dt(f?" Access token missing/empty but refresh token available - response interceptor will handle 401":" Both tokens missing/empty - allowing request (no token to inject)"),c},function(c){return Promise.reject(c)})}function vne(e){var t=e.useStandardizedConfig===!0;Dt("createCookieRefreshHandler called - useStandardizedConfig:",t);var n;if(t){var o=ine();n=ld(ld({},o),{},{canSetTokens:e.canSetTokens,cookieParser:e.cookieParser}),Dt(" Applied standardized cookie config:",n)}else{var s=e.accessTokenKey,r=e.refreshTokenKey,i=e.domain,a=e.path,l=e.secure,c=e.sameSite,u=e.canSetTokens,d=e.cookieParser;n={accessTokenKey:s,refreshTokenKey:r,domain:i,path:a,secure:l,sameSite:c,canSetTokens:u,cookieParser:d},Dt(" Applied custom cookie config:",n)}var h=new fne(n);e.accessTokenKey,e.refreshTokenKey,e.domain,e.path,e.secure,e.sameSite,e.canSetTokens,e.cookieParser;var f=Ite(e,rne);return new gne(ld(ld({},f),{},{storage:h,useStandardizedConfig:t}))}var Oo=function(e){return e.review="{reviewDomain}/{ws_code}",e.review_take="{reviewDomain}/{ws_code}?id={take_id}",e.review_scene="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&tab=iteration",e.review_rendition="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}",e.review_frame="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}&tab=comment&refresh_marker=true#type=frame&data={frame}",e.review_rendition_comment="{reviewDomain}/{ws_code}?scene_id={scene_id}&rendition_id={rendition_id}&comment_id={comment_id}&tab=comment",e.review_comment="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&comment_id={comment_id}",e.scene_hub="{baseDomain}/{ws_code}/{scene_id}?o=st",e.hub_rendition="{baseDomain}/{ws_code}/{scene_id}?o=st&renditionId={rendition_id}",e.hub_comment="{baseDomain}/{ws_code}/{scene_id}?o=st&comment_id={comment_id}",e.people_insight="{baseDomain}/{ws_code}/{user_id}?o=pt",e.people_detail="{baseDomain}/{ws_code}/ws/ppl/{display_name}-{user_id}",e.project="{baseDomain}/{ws_code}/pl/dir/{entity_id}",e.project_focusMode="{baseDomain}/{ws_code}/pl/dir/{parent_id}?f={entity_id}",e.woohoo="{baseDomain}/{ws_code}/pl/woo/rpt/{woohoo_id}",e.update="{baseDomain}/{ws_code}/pl/au?id={entity_id}",e.core="{baseDomain}/{ws_code}",e}(Oo||{});Oo.review,Oo.review_take,Oo.review_scene,Oo.review_rendition,Oo.review_frame,Oo.review_rendition_comment,Oo.review_comment,Oo.scene_hub,Oo.hub_rendition,Oo.hub_comment,Oo.people_insight,Oo.people_detail,Oo.project,Oo.woohoo,Oo.update,Oo.core,Oo.project_focusMode;const YM={accessToken:"account.token",refreshToken:"account.refresh_token"},yne={baseUrl:"BASE_URL"},XM="/refresh-token",wne=3e5,Cne="*",ZM={Accept:"application/json","Content-Type":"application/json"},bne="undefined",Sne="No access token found",Pc={badRequest:400,unauthorized:401,tooEarly:425},Ene=[Pc.unauthorized,Pc.tooEarly,Pc.badRequest],_ne="unauthenticated",Rne="invalid_token",Tne="refresh_token_expired",Dne={type:"TOKEN_EXPIRED",message:"Authentication token has expired"},Ine="Session refreshed successfully",xne="Session expired. Please log in again.",Pne=e=>{const{error:t}=e??{};return typeof t=="string"?t:t==null?void 0:t.key},kne=e=>{var t,n;return((t=e==null?void 0:e.response)==null?void 0:t.status)!==Pc.badRequest?!1:Pne((n=e.response)==null?void 0:n.data)===Rne},Fne=()=>{},Ane=e=>sessionStorage.getItem(e)||"",U0=()=>{const e=lv.get(YM.accessToken);return e&&e!==bne?e:null},One=()=>!!lv.get(YM.refreshToken),Mne=()=>{const e=window.location.origin,t=Ane(yne.baseUrl);if(!t)return e;try{return new URL(t,e).origin}catch{return e}};class W0{constructor(t,n=Fne,o){this.client=t,this.showMessage=n,this.onAuthExpired=o}attach(){const t=vne({refreshTokenFn:n=>this.refresh(n),onRefreshSuccess:n=>{this.showMessage(Ine,"success"),this.client.defaults.headers.common.Authorization=`Bearer ${n.access_token}`},onRefreshFailure:()=>{this.showMessage(xne,"error")},useStandardizedConfig:!0});this.handler=t,mne(this.client,t,{retryStatusCodes:[...Ene],tokenExpiredDetection:W0.isTokenExpired})}refreshAccessToken(){return!this.handler||!One()?Promise.resolve(!1):(this.pendingRefresh??(this.pendingRefresh=this.handler.handleTokenRefresh().catch(()=>!1).finally(()=>{this.pendingRefresh=void 0})),this.pendingRefresh)}static isTokenExpired(t){var i,a;const n=(i=t==null?void 0:t.response)==null?void 0:i.status;if(n===Pc.tooEarly)return!0;const{error:o,details:s={}}=((a=t==null?void 0:t.response)==null?void 0:a.data)??{},r=typeof o=="string"?o:o==null?void 0:o.key;return n===Pc.badRequest||n!==Pc.unauthorized||typeof o=="string"||r!==_ne?!1:Object.keys(s).length===0||s.reason===Tne}async refresh(t){const n=await this.client.post(XM,{refresh_token:t}),o="data"in n&&n.data?n.data:n;return console.log("Refreshing tokens:",{tokens:o,res:n}),{access_token:o.access_token,refresh_token:o.refresh_token,expires_in:o.expires_in}}handleAuthExpired(){var t;if(window.self===window.top){(t=this.onAuthExpired)==null||t.call(this);return}window.parent.postMessage(Dne,Mne())}}class Nne{constructor(t={}){this.options={unwrapResponse:!0,withRefreshToken:!0,requireToken:!0,...t},this.client=to.create({baseURL:typeof t.baseURL=="string"?t.baseURL:"",timeout:t.timeout??wne,headers:{...ZM,...t.headers}}),this.setupRequestInterceptor(),this.setupResponseInterceptor(),this.setupErrorHandling()}get(t,n){return this.request({...n,method:"GET",url:t})}post(t,n,o){return this.request({...o,method:"POST",url:t,data:n})}put(t,n,o){return this.request({...o,method:"PUT",url:t,data:n})}patch(t,n,o){return this.request({...o,method:"PATCH",url:t,data:n})}delete(t,n){return this.request({...n,method:"DELETE",url:t})}request(t){return this.client.request(t)}setupRequestInterceptor(){this.client.interceptors.request.use(async t=>{const{baseURL:n,dynamicHeaders:o,requireToken:s}=this.options;typeof n=="function"&&(t.baseURL=n());const r=t.url===XM,i=r?U0():await this.resolveAccessToken();if(!i&&s&&!r)throw new Error(Sne);t.headers.set("Accept-Language",Cne),t.headers.has("Content-Type")||t.headers.set("Content-Type",ZM["Content-Type"]),t.headers.has("Content-Type")&&t.headers.get("Content-Type")==="multipart/form-data"&&t.headers.delete("Content-Type"),i&&t.headers.set("Authorization",`Bearer ${i}`);for(const[a,l]of Object.entries((o==null?void 0:o(t))??{}))t.headers.set(a,l);return t})}async resolveAccessToken(){const t=U0();return t||!this.tokenRefresher?t:(await this.tokenRefresher.refreshAccessToken(),U0())}setupResponseInterceptor(){this.client.interceptors.response.use(t=>this.options.unwrapResponse?t.data:t)}setupErrorHandling(){const{withRefreshToken:t,showMessage:n,onAuthExpired:o,onError:s}=this.options;t&&(this.tokenRefresher=new W0(this.client,n,o),this.tokenRefresher.attach()),this.client.interceptors.response.use(void 0,r=>(kne(r)&&(o==null||o("/sw?redirect=1")),Promise.reject(r))),s&&this.client.interceptors.response.use(void 0,s)}}const Lne=5,Vne=1e3,Bne=3,$ne="default",Hne=e=>new URL(e,"http://localhost").pathname;class Gne{constructor(t={}){this.groups=new Map,this.defaultLimit=t.defaultLimit??Lne,this.rules=t.rules??[],this.releaseDelayMs=t.releaseDelayMs??Vne}async run(t,n){const o=this.resolveGroup(t);await this.acquire(o);try{return await n()}finally{this.release(o)}}resolveGroup(t){const n=Hne(t),o=this.rules.find(i=>i.pattern.test(n)),s=o?o.pattern.source:$ne;let r=this.groups.get(s);return r||(r={limit:(o==null?void 0:o.limit)??this.defaultLimit,ongoing:0,queue:[]},this.groups.set(s,r)),r}acquire(t){return new Promise(n=>{const o=()=>{t.ongoing++,n()};t.ongoing<t.limit?o():t.queue.push(o)})}release(t){t.ongoing--;const n=t.queue.shift();n&&setTimeout(n,this.releaseDelayMs)}}const Une=(e,t)=>{const n=new Gne(t),o=to.getAdapter(e.defaults.adapter);return e.defaults.adapter=s=>n.run(s.url??"",()=>o(s)),n},Wne=(e,{maxRetries:t=Bne}={})=>{e.interceptors.response.use(void 0,async n=>{var a,l;const o=n.config;if(((a=n.response)==null?void 0:a.status)!==429||!o)return Promise.reject(n);const s=(o._retryCount??0)+1;if(s>t)return Promise.reject(n);o._retryCount=s;const r=Number.parseInt(String(((l=n.response.headers)==null?void 0:l["retry-after"])??""),10),i=Number.isNaN(r)?2**s*1e3:r*1e3;return await new Promise(c=>setTimeout(c,i)),e.request(o)})},zne=6e4,jne="/start",Kne=(e=jne)=>{const n=`${sessionStorage.getItem("BASE_URL")||""}${e}`;console.log("Redirecting to auth URL:",n),window.location.replace(n)};function qne(e,t){const n=sessionStorage.getItem(e)||"";return(n==null?void 0:n.length)>0?n:t}class Yne{constructor(t,n={}){const{concurrency:o,rateLimitRetry:s,...r}=n,i=()=>qne("API_BASE_URL","");this.callbackFunc=t,this.api=new Nne({baseURL:i,timeout:zne,requireToken:!0,onAuthExpired:Kne,...r,unwrapResponse:!1,showMessage:t}),this.axios=this.api.client,o!==!1&&Une(this.axios,o),s!==!1&&Wne(this.axios,s)}buildUrl(t=""){const n=t.replace(/^\//,"");return!n.startsWith("http://")&&!n.startsWith("https://")?`/${n}`:n}buildQueryParams(t){const n=new URLSearchParams;Object.entries(t).forEach(([s,r])=>{r!=null&&r!==""&&(Array.isArray(r)?r.forEach(i=>n.append(s,String(i))):typeof r=="object"?n.append(s,JSON.stringify(r)):n.append(s,String(r)))});const o=n.toString();return o?`?${o}`:""}async send(t,n,{params:o,data:s,options:r}={}){try{const i=o?this.buildQueryParams(o):"",a={...r,method:t,url:`${this.buildUrl(n)}${i}`};return s!==void 0&&(a.data=s),(await this.axios.request(a)).data}catch(i){throw Rte(i)}}get(t="",n,o){return this.send("GET",t,{params:n,options:o})}post(t="",n,o,s){return this.send("POST",t,{params:n,data:o,options:s})}put(t="",n,o){return this.send("PUT",t,{data:n,options:o})}patch(t="",n,o){return this.send("PATCH",t,{data:n,options:o})}delete(t="",n,o){return this.send("DELETE",t,{data:n,options:o})}}const Xne=({domainApi:e,wsCode:t,entityId:n})=>({list_cursor:{url:`${e}/v1/workspace/${t}/item/2`,method:"post",code:"list_cursor"},assignedUser:{url:`${e}/v1/workspace/${t}/item/2/assigned-users`,method:"post",code:"assignedUser"},metricValues:{url:`${e}/v1/workspace/${t}/item/2/metrics`,method:"post",code:"metricValues"},multipleAssignableUser:{url:`${e}/v1/workspace/${t}/item/2/assignable-users`,method:"post",code:"multipleAssignableUser"},assignableUser:{url:`${e}/v1/workspace/${t}/item/2/assignable-users`,method:"post",code:"assignableUser"},assignableStatus:{url:`${e}/v1/workspace/${t}/item/2/assignable-statuses`,method:"post",code:"assignableStatus"},delete_rendition:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-rendition`,method:"delete",code:"delete_rendition"},delete_thumbnail:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-thumbnail`,method:"delete",code:"delete_thumbnail"},archive_item:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"archive_item"},unarchive_item:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"unarchive_item"},removeAssignee:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-assignee`,method:"delete",code:"removeAssignee"},basicInfor:{url:`${e}/v1/workspace/${t}/tile/people/ws-user-roles/{userId}/basic-info`,method:"get",code:"basicInfor"},bulkDelete:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete`,method:"delete",code:"bulkDelete"},bulkArchive:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"bulkArchive"},bulkDateUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-date-update`,method:"put",code:"bulkDateUpdate"},bulkAssignUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-assignee-update`,method:"put",code:"bulkAssignUpdate"},bulkStatusUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-status-update`,method:"put",code:"bulkStatusUpdate"},bulkMetricUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-metric-update`,method:"put",code:"bulkMetricUpdate"},getPermission:{url:`${e}/v1/workspace/${t}/item/2/permissions`,method:"post",code:"getPermission"},getUserPermission:{url:`${e}/v1/workspace/${t}/permissions`,method:"get",code:"getUserPermission"},bulkUnarchive:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"bulkUnarchive"},downloadTemplate:{url:`${e}/v1/workspace/${t}/item/2/download-sample`,method:"get",code:"downloadTemplate"},importItems:{url:`${e}/v1/workspace/${t}/item/2/import-from-file`,method:"post",code:"importItems"},exportItems:{url:`${e}/v1/workspace/${t}/item/2/export`,method:"get",code:"exportItems"},updateFromFile:{url:`${e}/v1/workspace/${t}/item/2/update-from-file`,method:"post",code:"updateFromFile"},metricList:{url:`${e}/v1/workspace/${t}/entity/2/metrics`,method:"get",code:"metricList"},getEntityDetail:{url:`${e}/workspace/${t}/entities/${n}?include_permission=1`,method:"get",code:"getEntityDetail"},item:{url:`${e}/v1/workspace/${t}/item/2/update`,method:"put",code:"item"},me:{url:`${e}/v1/me`,method:"get",code:"me"},workspaces:{url:`${e}/v1/workspaces`,method:"get",code:"workspaces"},entityUserRoles:{url:`${e}/v1/workspace/${t}/entity/2/users`,method:"get",code:"entityUserRoles"},templateFlowStatuses:{url:`${e}/workspace/${t}/entities/${n}/template_flow_statuses`,method:"get",code:"templateFlowStatuses"},createNewItem:{url:`${e}/v1/workspace/${t}/item/2/new?entity_id=${n}`,method:"post",code:"createNewItem"},getAssignableStatuses:{url:`${e}/v1/workspace/${t}/entity/2/assignable-statuses`,method:"get",code:"getAssignableStatuses"},getAssignableAssignees:{url:`${e}/v1/workspace/${t}/entity/2/users`,method:"get",code:"getAssignableAssignees"},getFilterStatuses:{url:`${e}/v1/workspace/${t}/entity/2/statuses`,method:"get",code:"getFilterStatuses"},bulkRename:{url:`${e}/v1/workspace/${t}/item/2/bulk-rename`,method:"put",code:"bulkRename"}}),Zne=(e,t)=>{const n=new Blob([e]),o=globalThis.URL.createObjectURL(n),s=document.createElement("a");s.href=o,s.download=t,document.body.appendChild(s),s.click(),s.remove(),globalThis.URL.revokeObjectURL(o)};class JM extends Yne{constructor(t,n,o){const s=n==null?void 0:n.domainApi,r=n==null?void 0:n.wsCode,i=(n==null?void 0:n.entityId)||"";super(o,{concurrency:{rules:[{pattern:/^\/api\/v1\/workspace\/[^/]+\/item\/2$/,limit:1},{pattern:/^\/api\/v1\/workspace\/[^/]+\/item\/2\/metrics$/,limit:5}]}}),this.events=Object.create(null);const a=Xne({domainApi:s,wsCode:r,entityId:i}),l={};Object.entries(a).forEach(([c,u])=>{const d=c;t[d]?l[d]=t[d]:(console.warn(`API config for ${d} is missing, using base config.`),l[d]=u)}),this.apiConfig=l}on(t,n){var o;((o=this.events)[t]??(o[t]=[])).push(n)}off(t,n){const o=this.events[t];o&&(this.events[t]=o.filter(s=>s!==n))}emit(t,...n){const o=this.events[t];o!=null&&o.length&&o.forEach(s=>{try{s(...n)}catch(r){console.error(`Error in event listener for ${t}:`,r)}})}buildHeaders(t){return typeof FormData<"u"&&t instanceof FormData?{"Content-Type":"multipart/form-data"}:{}}async _requestHandler({method:t,path:n,params:o,payload:s,code:r,responseType:i,autoDownload:a=!0}){var u,d;const l=this.buildHeaders(s);let c;try{if(c=await this.axios.request({method:t,url:n,params:o,data:s,headers:l,responseType:i}),(((u=c.headers)==null?void 0:u["content-type"])||"").includes("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")){const f=((d=c.headers)==null?void 0:d["content-disposition"])||"",p=f.includes("filename=")?f.split("filename=")[1]:"exported_items.xlsx";a&&Zne(c.data,p)}if(c.status>=400&&c.status<=500)throw new Error(`Client error (${c.status}): ${c.statusText}`);return this.emit("call-api",{apiCode:r,path:n,params:o,payload:s,res:c,success:!0}),c.data}catch(h){throw console.error("API Request Error:",h),h.code==="ERR_NETWORK"||!navigator.onLine?this.emit("call-api",{path:n,params:o,payload:s,error:new Error("You are currently offline. Please check your network connection."),success:!1,apiCode:"offline"}):this.emit("call-api",{path:n,params:o,payload:s,error:h,success:!1,apiCode:r,res:h==null?void 0:h.response}),h}}generateUrl(t,n){let o=t;return Object.entries(n).forEach(([s,r])=>{o=o.replace(`{${s}}`,String(r))}),o}async request(t,n,o={}){const{url:s,code:r,method:i}=this.apiConfig[t],a=this.generateUrl(s,n);return this._requestHandler({method:i,path:a,params:o.params,payload:o.payload,code:r,responseType:o.responseType,autoDownload:o.autoDownload})}async getAllItem_cursor(t){var r;const n=t.workspaceId,o={entity_ids:((r=t.entityIds)==null?void 0:r.join(","))||"",cursor:t.cursor||void 0,per_page:t.pageSize||t.perPage||20,offset:t.offset||void 0,search:t.search||t.q||void 0,include_signature:1,include:"last_updated_by,property,last_completed_by",include_permission:"{include_permission}",assignee_any_ina:(t==null?void 0:t.assignee_any_ina)||"",assignee_all_ina:(t==null?void 0:t.assignee_all_ina)||void 0,with_not_assigned:t.with_not_assigned||void 0,status_ina:t.status_ina||void 0,status_eq:t.status_eq||void 0,start_date_gte:t.start_date_gte||void 0,start_date_lte:t.start_date_lte||void 0,start_date_btw:t.start_date_btw||void 0,due_date_gte:t.due_date_gte||void 0,due_date_lte:t.due_date_lte||void 0,due_date_btw:t.due_date_btw||void 0,condition_combine_type:t.condition_combine_type||"or",preflight_status:t.preflight_status||void 0},s=t.sortBy;return this.request("list_cursor",{workspaceId:n},{params:o,payload:{sort_by:s}})}async getAssignedUser(t){const n={item_ids:t.item_ids||[],metric_ids:t.metric_ids||[]},o={per_page:t.per_page};return this.request("assignedUser",{workspaceId:t.workspaceId},{params:o,payload:n})}async getMetricList({workspaceId:t,entityId:n,page:o,query:s,per_page:r}){return this.request("metricList",{workspaceId:t,entityId:n},{params:{status_ed:1,include:"metric_type",entity_id:n,include_permission:1,per_page:r||100,page:o||1,name_like:s||void 0,permission:"1,2"}})}async getMetricValues({workspaceId:t,item_ids:n,per_page:o,metric_ids:s}){const r={item_ids:n,metric_ids:s};return this.request("metricValues",{workspaceId:t},{params:{per_page:o,include_permission:1},payload:r})}async multipleAssignableUser(t){const n=t.workspaceId,o=t.itemIds,s={page:t.page||1,per_page:t.perPage,display_name_like:t.q||"",item_ids:o||[]};return o.length||(delete s.item_ids,s.entity_id=t.entityId),this.request("multipleAssignableUser",{workspaceId:n},{payload:s})}async getAssignableStatus(t){var s;const n=t.workspaceId,o={item_ids:t.itemIds||[],page:t.page||1,per_page:t.perPage||10,name_like:t.name_like||""};return((s=t.itemIds)==null?void 0:s.length)==0&&(o.entity_id=t.entityId,delete o.item_ids),this.request("assignableStatus",{workspaceId:n||""},{payload:o})}async updateSceneName({workspaceId:t,entityId:n,itemId:o,name:s}){const r={item_id:o,entity_id:n,name:s,include:"item_user_roles"};return this.request("item",{workspaceId:t,itemId:o},{payload:r})}async deleteScene(t,n,o){const s={item_ids:[o]};return this.request("bulkDelete",{workspaceId:t,entityId:n},{payload:s})}async deleteThumbnail({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("delete_thumbnail",{workspaceId:t},{payload:r,params:s})}async deleteRendition({workspaceId:t,itemIds:n,deleteAll:o=!1,entityId:s,filterParams:r}){const i={item_ids:n,delete_all:o?1:void 0,entity_id:s};return!n||n.length===0?i.item_ids=void 0:i.entity_id=void 0,this.request("delete_rendition",{workspaceId:t},{payload:i,params:r})}async archiveScene(t,n,o){const s={item_ids:o,status:0};return this.request("archive_item",{workspaceId:t,entityId:n},{payload:s})}async changeDate({workspaceId:t,itemIds:n,startDate:o,dueDate:s,entityId:r,filterParams:i}){const a={item_ids:n,start_date:o,due_date:s,entity_id:r};return this.request("bulkDateUpdate",{workspaceId:t},{payload:a,params:i})}async updateAssignee(t){const{workspaceId:n,itemIds:o,userIds:s,entityId:r}=t,i={item_ids:o,ws_user_role_ids:s,entity_id:r};return this.request("bulkAssignUpdate",{workspaceId:n},{payload:i,params:t.filterParams})}createUpdateEntityPayload(t){const{itemIds:n,userIds:o,entityId:s}=t,r={item_ids:n,ws_user_role_ids:o,entity_id:s};return!n||n.length===0?(r.item_ids=void 0,r.entity_id=s):(r.item_ids=n,r.entity_id=void 0),r}async removeAssignee(t){const n=this.createUpdateEntityPayload(t);return this.request("removeAssignee",{workspaceId:t.workspaceId},{payload:n,params:t.filterParams})}async replaceAssignee(t){const{workspaceId:n,itemIds:o,userIds:s,entityId:r}=t,i={item_ids:o,ws_user_role_ids:s,entity_id:r};return this.request("bulkAssignUpdate",{workspaceId:n},{params:{replace:1,...t.filterParams},payload:i})}async addAssignee({workspaceId:t,itemIds:n,userIds:o,entityId:s,filterParams:r}){const i={item_ids:n,ws_user_role_ids:o,entity_id:s};return this.request("bulkAssignUpdate",{workspaceId:t},{payload:i,params:r})}async unAssignAll(t){const{workspaceId:n,entityId:o,itemIds:s,filterParams:r}=t,i={item_ids:s,entity_id:o,ws_user_role_ids:[]};return!s||s.length===0?i.item_ids=void 0:i.entity_id=void 0,this.request("removeAssignee",{workspaceId:n,entityId:String(o)},{payload:i,params:r})}async updateItemStatus(t){const{workspaceId:n,itemIds:o=[],statusId:s,entityId:r}=t,i={item_ids:o,template_flow_status_id:s};return o.length||(i.item_ids=void 0,i.entity_id=r),this.request("bulkStatusUpdate",{workspaceId:n},{payload:i,params:t.filterParams})}async getUserInformation(t,n){return this.request("basicInfor",{workspaceId:t,userId:n})}async bulkDeleteItems({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("bulkDelete",{workspaceId:t},{payload:r,params:s})}async bulkUnarchiveItems({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,status:1,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("bulkUnarchive",{workspaceId:t},{payload:r,params:s})}async bulkArchiveItems({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,status:0,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("bulkArchive",{workspaceId:t},{payload:r,params:s})}async bulkUpdateMetric(t){const{workspaceId:n,itemIds:o,metricId:s,value:r,clear:i}=t,a={item_ids:o,metric_id:s,metric_value:r,clear:i??(r==null?1:0),entity_id:t.entityId};return t.itemIds===void 0?(delete a.item_ids,a.entity_id=String(t.entityId)):(a.item_ids=o,a.entity_id=void 0),this.request("bulkMetricUpdate",{workspaceId:n},{payload:a,params:t.filterParams})}async getPermissionForItems({workspaceId:t,itemIds:n}){const o={item_ids:n};return this.request("getPermission",{workspaceId:t},{payload:o,params:{per_page:50}})}async unarchiveScene(t,n,o){const s={item_ids:o,status:1};return this.request("unarchive_item",{workspaceId:t,entityId:n},{payload:s})}async getUserPermission(t){return this.request("getUserPermission",{workspaceId:t})}async getEntityDetail(t,n){return this.request("getEntityDetail",{workspaceId:t,entityId:n})}async downloadTemplate(t,n,o=!0){return this.request("downloadTemplate",{workspaceId:t,entityId:n},{responseType:"blob",params:{format:"xlsx",entity_id:n},autoDownload:o})}async downloadExportedItemsFile(t,n,o=!0){return this.request("exportItems",{workspaceId:t,exportId:n},{responseType:"blob",params:{format:"xlsx",entity_id:n},autoDownload:o})}async addNewSceneViaImportFile(t,n,o){return this.request("importItems",{workspaceId:t,entityId:n},{payload:o})}async overwriteScenesViaImportFile(t,n,o){return this.request("updateFromFile",{workspaceId:t,entityId:n},{payload:o})}async getMe(){return this.request("me",{})}async getWorkspaces(t){const n={page:1,per_page:1,"ws_user_role>status_eq":1,include:"owner",include_ws:t};return this.request("workspaces",{},{params:n})}async getEntityUserRoles(t){const{workspaceId:n,page:o,per_page:s,display_name_like:r,entity_ids:i}=t;return this.request("entityUserRoles",{workspaceId:n},{params:{page:o,per_page:s,display_name_like:r,entity_ids:i}})}async getTemplateFlowStatuses(t){const{workspaceId:n,entityId:o}=t;return this.request("templateFlowStatuses",{workspaceId:n,entityId:o},{params:{per_page:100,page:t.page??1,all:1,name_like:t.name_like}})}async addNewItem(t,n,o){return this.request("createNewItem",{workspaceId:t,entityId:n},{payload:o})}async getFilterStatuses(t,n,o){return this.request("getFilterStatuses",{workspaceId:t,entityId:n},{params:o})}async getAssignableStatuses(t,n){return this.request("getAssignableStatuses",{workspaceId:t},{params:n})}async getAssignableAssignees(t,n){return this.request("getAssignableAssignees",{workspaceId:t},{params:n})}async bulkRename(t){return this.request("bulkRename",{workspaceId:t.workspaceId,entityId:t.entityId},{payload:t.payload,params:t.filter})}}const Jne=(e,t,n,o,s,r,i)=>{const{apiServices:a}=io(n,o),l=H(!1),c=()=>{l.value=!0},u=()=>{ft(()=>{setTimeout(()=>{l.value=!1},500)})},d=Y(()=>!!(s!=null&&s.value&&(r!=null&&r.value))),h=In("filterParams",null);return{isUpdating:l,handleUpdate:async p=>{var v;const g=p.value;c();try{const C={itemIds:e.value.itemIds,metricId:p.id,workspaceId:String(e.value.workspaceId),filterParams:h!=null&&h.value?h.value:void 0};p.value==null?C.clear=1:C.value=g,d.value?(delete C.itemIds,C.entityId=String(o.entityId)):C.itemIds=e.value.itemIds;const S=await((v=a.value)==null?void 0:v.bulkUpdateMetric(C));(S==null?void 0:S.message)=="Done"&&t(p)}catch(C){console.error("Error during bulk metric update:",C)}u()}}},Qne=bt(tt({__name:"MetricUpdateButton",props:{workspaceId:{},entityId:{},variant:{},rowSelected:{},selectedIds:{},disabled:{type:Boolean},selectedAll:{type:Boolean}},emits:["update","update-start","update-completed","update-failed"],setup(e,{emit:t}){const n=_O(),o=H([]),s=e,r=t,i=H([]),a=H(null),l=j=>{var q,V,k;const Q=o.value.findIndex(G=>G.id===j.id);a.value=Q;const re=(q=i.value[Q])==null?void 0:q.$el;(V=_.value)==null||V.scrollTo(Q*30),re&&re.scrollIntoView({behavior:"smooth",block:"center"}),c(Q),(k=i.value[Q])==null||k.show()},c=j=>{a.value=j,i.value.forEach((Q,re)=>{re!==j&&Q&&Q.hide()})},u=H(""),d=()=>{u.value="",i.value.forEach(j=>{j==null||j.hide()}),a.value=null},h=Y(()=>s.selectedIds||[]),f=Y(()=>({itemIds:h.value,workspaceId:String(s.workspaceId)})),p=In("isSelectAll",H(!1)),g=In("bulkUpdate",H(!1)),v=H(null),{handleUpdate:C,isUpdating:S}=Jne(f,j=>{var Q;r("update",j),d(),(Q=v.value)==null||Q.hide()},!1,s,g,p),b=async j=>{var Q;r("update-start");try{await C(j),r("update-completed")}catch{r("update-failed"),(Q=v.value)==null||Q.open()}},y=j=>{d(),ft(()=>{var Q;(Q=_.value)==null||Q.focus()})},_=H(null),E=(j,Q)=>{var re;j?(re=_.value)==null||re.focus():d(),j&&Q!==j&&z("")},D=H(!0),T=H(!0),{apiServices:P}=io(!1,s),L=async(j,Q,re)=>{var q;try{return re?T.value=!0:D.value=!0,await((q=P.value)==null?void 0:q.getMetricList({workspaceId:s.workspaceId||"",entityId:s.entityId||"",page:j,query:Q,per_page:10}))}catch(V){throw console.error("Failed to fetch metric list:",V),V}finally{D.value=!1,T.value=!1}},I=H(0),x=H(!0),O=j=>({id:String(j.id),label:String(j.name),value:String(j.id),description:j.morpheme_value?`${String(j.morpheme_value)}`:"",type:n.checkEditType(j),metricConfig:j}),N=j=>j.filter(Q=>!Q.formula).filter(Q=>{var re;return((re=Q==null?void 0:Q.auth_permission)==null?void 0:re.permission)==2}).map(O),F=async()=>{I.value+=1;const j=await L(I.value,u.value,!0);if(j&&j.data){const Q=N(j.data);o.value=[...o.value,...Q],x.value=j.meta.last_page!=j.meta.current_page}else x.value=!1},z=async j=>{u.value=j,I.value=1;try{const Q=await L(I.value,u.value);Q&&Q.data?(o.value=N(Q.data),x.value=Q.meta.last_page!=Q.meta.current_page):o.value=[]}catch{o.value=[]}};return(j,Q)=>(K(),ze(Hf,{ref_key:"wrapperRef",ref:v,isUpdating:W(S),disabled:s.disabled||W(S),onOnVisibleChange:E},{trigger:be(({hide:re,disabled:q})=>[ye(pt,{variant:s.variant,loading:W(S),disabled:q,onEscape:re},{default:be(()=>[ye(ct,{src:"SquareRootVariable",class:"icon"}),Q[1]||(Q[1]=nt(" Metric ",-1))]),_:1},8,["variant","loading","disabled","onEscape"])]),popup:be(({isVisible:re,popupRef:q,hide:V})=>[qe(ye(ha,{ref_key:"searchListRef",ref:_,style:{width:"320px"},options:o.value,loading:D.value,"loading-more":T.value,"selected-id":void 0,"has-more":x.value,onSearch:z,onSelect:l,onLoadMore:Q[0]||(Q[0]=()=>F()),onCancel:V},{item:be(({item:k,index:G,selectedIndex:ee})=>[ye(lQ,{ref:ge=>i.value[G]=ge,label:k.label,type:k.type,morpheme:k.description||"",onFocusOnSearch:y,onOpen:ge=>c(G),attachTo:q,config:k.metricConfig,onHandleUpdate:b,class:se(["metric-update-item",{selected:a.value===G||ee===G}])},null,8,["label","type","morpheme","onOpen","attachTo","config","class"])]),"extra-item":be(()=>[...Q[2]||(Q[2]=[Te("div",{style:{width:"250px"}},null,-1)])]),"empty-list":be(()=>[...Q[3]||(Q[3]=[nt("No options available.",-1)])]),_:2},1032,["options","loading","loading-more","has-more","onCancel"]),[[lr,re]])]),default:be(()=>[Q[4]||(Q[4]=nt(" > ",-1))]),_:1},8,["isUpdating","disabled"]))}}),[["__scopeId","data-v-a645d131"]]),qv=Sc("bulkUpdate",()=>{const e=H(At.UNCHECK),t=Go({loaded:0,total:0}),n=u=>{t.total=u},o=u=>{t.loaded=u},s=Go({isBulkUpdating:!1});function r(u){s.isBulkUpdating=u}const i=H({}),a=u=>{i.value=u},l=(u,d)=>{i.value[u]=d},c=u=>{e.value=u};return{bulkUpdateState:s,setIsBulkUpdating:r,selectionIds:i,setSelectionIds:a,setCheckedForId:l,setSelectionStatus:c,selectionStatus:e,rowCount:t,setTotalRowCount:n,setLoadedRowCount:o,handelSelectAll:()=>{c(At.CHECKED)}}}),eoe={class:"status-label"},QM=bt(tt({__name:"StatusItem",props:{status:{},selected:{type:Boolean},focused:{type:Boolean},hovered:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=Kt,o=e,s=t,r=a=>{s("select",a)},i=a=>new On(a).isLight()?"#f3f5f8":"#d7d7d7";return(a,l)=>(K(),ce("div",{class:se(["status-option",{selected:o.selected,focused:o.focused,hovered:o.hovered}]),onClick:l[0]||(l[0]=c=>r(e.status.id))},[Te("div",{class:"status-color",style:hn({backgroundColor:e.status.color,borderColor:i(e.status.color)})},null,4),qe((K(),ce("div",eoe,[xt(a.$slots,"label",{},()=>[nt(it(e.status.name),1)],!0)])),[[W(n),{content:e.status.name,delay:[1e3,0]}]])],2))}}),[["__scopeId","data-v-aeaa75a4"]]),toe=["innerHTML"],eN=bt(tt({__name:"StatusEditor",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},ids:{},callback:{type:Function}},emits:["updated","error","cancel","start-update","finish-update"],setup(e,{expose:t,emit:n}){const o={PER_PAGE:50,INITIAL_PAGE:1},s=e,r=n,i=H([]),a=H(!1),l=H(!1),c=H(null),u=H(o.INITIAL_PAGE),d=H(!0),h=H(0),f=H(""),p=Y(()=>{var O;return(O=s.value)==null?void 0:O.id});Y(()=>!!(s.id||s.ids&&s.ids.length>0));const g=O=>({label:O.name,value:O.id,selected:p.value===O.id,hover:!1,type:"status",disabled:!1,clickable:!0,danger:!1,data:O,id:O.id,color:O.color}),v=Y(()=>{const O=new Set;return s.id&&O.add(String(s.id)),s.ids&&s.ids.forEach(N=>{N&&O.add(String(N))}),Array.from(O)}),C=In("bulkUpdate",!1),{apiServices:S}=io(!C,s),b=qv(),{selectionStatus:y}=us(b),_=In("filterParams",null),E=async(O=o.INITIAL_PAGE,N="",F=!1)=>{var z,j,Q,re;F?l.value=!0:a.value=!0,c.value=null;try{const q={workspaceId:String(s.workspaceId),itemIds:v.value,page:O,perPage:o.PER_PAGE,name_like:N.trim(),..._||{},entityId:String(s.entityId)};if(((z=S.value)==null?void 0:z.getAssignableStatus)===void 0)throw new Error("API service getAssignableStatus is undefined");const V=await((j=S.value)==null?void 0:j.getAssignableStatus(q));if(!(V!=null&&V.data)){F||(i.value=[]),d.value=!1;return}const k=V.data.map(g);i.value=F?[...i.value,...k]:k,h.value=((Q=V.meta)==null?void 0:Q.total)??V.data.length,d.value=!((re=V.meta)!=null&&re.on_last_page),u.value=O}catch(q){console.error("Error fetching statuses:",q),c.value="Failed to load statuses",F||(i.value=[]),d.value=!1,r("error",c.value)}finally{a.value=!1,l.value=!1}},D=mr(async O=>{f.value=O,u.value=o.INITIAL_PAGE,await E(o.INITIAL_PAGE,O,!1)},Ci),T=async()=>{!d.value||l.value||await E(u.value+1,f.value,!0)},P=()=>{var O;r("cancel"),(O=s.params)==null||O.api.stopEditing()},L=async O=>{var N,F,z;try{const j={workspaceId:String(s.workspaceId),itemIds:v.value,statusId:String(O.value),entityId:String(s.entityId),filterParams:_!=null&&_.value?_==null?void 0:_.value:void 0};if(y.value==At.CHECKED&&C&&(j.itemIds=void 0,j.entityId=String(s.entityId)),r("start-update"),!await S.value.updateItemStatus(j))throw new Error("Status update failed: empty response");r("updated",{workspaceId:String(s.workspaceId),itemIds:v.value,isUpdateAll:y.value==At.CHECKED&&C,data:{id:O.id,name:O.label,color:O.color}}),s.params&&((F=s.params)==null||F.node.setData({...(N=s.params)==null?void 0:N.node.data,status:{id:O.id,name:O.label,color:O.color}}),(z=s.params)==null||z.api.stopEditing()),r("finish-update")}catch(j){console.error("Error updating status:",j),c.value="Failed to update status",r("error",c.value)}},I=Y(()=>i.value.map(O=>({...O})));Qe([()=>s.id,()=>s.workspaceId,()=>s.ids],()=>{E()},{deep:!0,immediate:!0});const x=H(null);return en(()=>{ft(()=>{var O;(O=x.value)==null||O.focus()})}),t({refresh:()=>E(o.INITIAL_PAGE,f.value,!1),loadMore:T,focus:()=>{var O;return(O=x.value)==null?void 0:O.focus()}}),(O,N)=>{var F;return K(),ze(ha,jt({ref_key:"popupRef",ref:x},s,{"selected-id":(F=s.value)==null?void 0:F.id,options:I.value,loading:a.value,"loading-more":l.value,"has-more":d.value,error:c.value,onSearch:W(D),onSelect:L,onLoadMore:T,onCancel:P,onClose:P}),{item:be(({item:z,selectedIndex:j,isSelected:Q,handleItemHover:re,getHighlightedLabel:q,query:V,idx:k})=>[(K(),ze(QM,{key:z.value,status:z.data,selected:Q(z),onMouseover:G=>re(k),onSelect:G=>L(z),hovered:k===j},{label:be(()=>[V?(K(),ce("span",{key:0,class:se([O.$style["item-label"],O.$style.match]),style:{flex:"1"},innerHTML:q(z.label)},null,10,toe)):(K(),ce("span",{key:1,class:se(O.$style["item-label"]),style:{flex:"1"}},it(z.label),3))]),_:2},1032,["status","selected","onMouseover","onSelect","hovered"]))]),_:1},16,["selected-id","options","loading","loading-more","has-more","error","onSearch"])}}}),[["__cssModules",{$style:{"item-label":"_item-label_7ir12_1"}}]]),noe=tt({__name:"StatusUpdateButton",props:{ids:{},workspaceId:{},entityId:{},variant:{},disabled:{type:Boolean},selectedAll:{type:Boolean}},emits:["updated","update-start","update-completed","update-failed"],setup(e,{emit:t}){const n=e,o=Y(()=>{const f=ro();return f==null?void 0:f.appContext.config.globalProperties.apiServices}),s=t,r=H(!1),i=H(null),a=f=>{try{r.value=!1,s("updated",f)}catch(p){console.error("Error handling status update:",p)}finally{s("update-completed")}},l=Y(()=>({apiServices:o.value,ids:n.ids,workspaceId:n.workspaceId,entityId:n.entityId,selectedAll:n.selectedAll}));ui("bulkUpdate",!0);const c=f=>{var p,g;console.trace("handleUpdateCompleted called with success:",f),r.value=!1,f?(s("update-completed"),(p=i.value)==null||p.destroy()):(s("update-failed"),(g=i.value)==null||g.open())},u=H(null),d=(f,p)=>{var g;f&&((g=u.value)==null||g.focus())},h=()=>{r.value=!0,s("update-start")};return Qe(()=>n.ids,()=>{}),(f,p)=>(K(),ze(Hf,{ref_key:"wrapperRef",ref:i,isUpdating:r.value,disabled:n.disabled||r.value,onOnVisibleChange:d},{trigger:be(({hide:g,disabled:v})=>[ye(pt,{variant:n.variant,loading:r.value,disabled:v,onEscape:g},{default:be(()=>[ye(ct,{src:"Square",class:"icon"}),p[2]||(p[2]=nt(" Status ",-1))]),_:1},8,["variant","loading","disabled","onEscape"])]),popup:be(({hide:g})=>[ye(eN,jt({disabled:r.value,ref_key:"statusRef",ref:u},l.value,{onUpdated:a,onCancel:g,onStartUpdate:h,onFinishUpdate:p[0]||(p[0]=v=>c(!0)),onError:p[1]||(p[1]=v=>c(!1)),callback:()=>{}}),null,16,["disabled","onCancel"])]),default:be(()=>[p[3]||(p[3]=nt(" > ",-1))]),_:1},8,["isUpdating","disabled"]))}}),jr=" ",z0=e=>e.replace(/[\r\n]+/g," "),Yv=e=>e instanceof HTMLElement&&e.classList.contains("locked-tag"),Ws=e=>(e==null?void 0:e.nodeType)===Node.TEXT_NODE,j0=e=>{var t;return((t=e instanceof Element?e:e.parentElement)==null?void 0:t.closest(".locked-tag"))??null},ga=e=>{let t=0,n=e.length;return Yv(e.previousSibling)&&e.data.startsWith(jr)&&(t=1),Yv(e.nextSibling)&&n>t&&e.data.endsWith(jr)&&(n-=1),{start:t,end:n}},ooe=e=>{if(!Ws(e))return!1;const{start:t,end:n}=ga(e);return n<=t},tN=e=>{const t=j0(e.startContainer),n=j0(e.endContainer);return t&&e.setStartAfter(t),n&&e.setEndAfter(n),e},soe=(e,t)=>e.length===t.length&&e.every((n,o)=>{const s=t[o];return typeof n=="string"||typeof s=="string"?n===s:n.id===s.id&&n.text===s.text&&n.direction===s.direction});class roe{constructor(t){Tn(this,"editor",null);Tn(this,"handleInput",()=>{this.editor&&(this.sanitize(),this.ensureTagPadding(),this.normalizeCaret(),this.options.onChange(this.parse()))});Tn(this,"handlePaste",t=>{var n;t.preventDefault(),this.insertPlainText(((n=t.clipboardData)==null?void 0:n.getData("text/plain"))??"")});Tn(this,"handleDrop",t=>{var o,s;t.preventDefault();const n=((o=t.dataTransfer)==null?void 0:o.getData("text/plain"))??"";n&&this.insertPlainText(n,(s=document.caretRangeFromPoint)==null?void 0:s.call(document,t.clientX,t.clientY))});Tn(this,"handleBeforeInput",t=>{const n=t.inputType;(n.startsWith("format")||n==="insertParagraph"||n==="insertLineBreak"||n==="insertFromDrop"||n==="insertFromYank")&&t.preventDefault()});Tn(this,"handleClick",t=>{const n=this.editor,o=window.getSelection();if(!n||!(o!=null&&o.isCollapsed)||t.target!==n)return;const s=document.createRange();if(s.selectNodeContents(n),t.clientX<=s.getBoundingClientRect().right)return;const[r,i]=this.getBoundaryPoint("end");o.collapse(r,i),n.scrollLeft=n.scrollWidth});Tn(this,"handleKeydown",t=>{var s;const n=this.editor;if(!n)return;if(t.key==="Enter"){t.preventDefault();return}const o=t.ctrlKey||t.metaKey;if(o&&!t.altKey&&t.key.toLowerCase()==="a"){t.preventDefault(),(s=window.getSelection())==null||s.selectAllChildren(n);return}if(t.key==="Home"||t.key==="End"){t.preventDefault(),this.moveToEdge(t.key==="Home"?"start":"end",t.shiftKey);return}if((t.key==="ArrowLeft"||t.key==="ArrowRight")&&!t.shiftKey&&!o&&!t.altKey){this.moveAcrossTag(t.key)&&t.preventDefault();return}if(t.key==="Backspace"||t.key==="Delete"){if(!o&&!t.altKey&&!t.shiftKey&&this.deleteCharacter(t.key)){t.preventDefault();return}const r=this.findAdjacentTag(t.key);r&&(t.preventDefault(),this.removeTag(r,t.key==="Backspace"?"after":"before"))}});Tn(this,"normalizeCaret",()=>{const t=this.editor,n=window.getSelection();if(!t||!(n!=null&&n.rangeCount)||!n.isCollapsed)return;const{startContainer:o,startOffset:s}=n.getRangeAt(0);if(!t.contains(o))return;const r=j0(o);if(!r&&o!==t)return;const i=r??t.childNodes[s-1]??null,a=r?r.nextSibling:t.childNodes[s]??null;if(this.ensureTagPadding(),Ws(i))n.collapse(i,ga(i).end);else if(Ws(a))n.collapse(a,ga(a).start);else if(Ws((i==null?void 0:i.nextSibling)??null)){const l=i.nextSibling;n.collapse(l,ga(l).start)}else if(Ws((a==null?void 0:a.previousSibling)??null)){const l=a.previousSibling;n.collapse(l,ga(l).end)}});this.options=t}mount(t,n=[]){this.editor=t,this.render(n),document.addEventListener("selectionchange",this.normalizeCaret)}destroy(){document.removeEventListener("selectionchange",this.normalizeCaret),this.editor=null}sync(t){this.editor&&(soe(t,this.parse())||this.render(t))}render(t){const n=this.editor;n&&(n.innerHTML="",t.forEach(o=>{typeof o=="string"?n.appendChild(document.createTextNode(z0(o))):this.options.isTagAllowed(o.id)&&n.appendChild(this.createTagNode(o))}),this.ensureTagPadding())}parse(){var o;const t=[];let n="";return(o=this.editor)==null||o.childNodes.forEach(s=>{Ws(s)?n+=s.data.replace(/\u00A0/g," "):this.isAllowedTagNode(s)&&(n&&(t.push(n),n=""),t.push({id:s.dataset.id||"unknown",text:s.innerText||"Tag",direction:s.dataset.direction??void 0}))}),n&&t.push(n),t}insertTag(t){const n=this.editor;if(!n||!this.options.isTagAllowed(t.id))return;const o=n.querySelector(`.locked-tag[data-id="${t.id}"]`);if(o instanceof HTMLElement){this.applyTagData(o,t),this.handleInput();return}const s=this.createTagNode(t),r=document.createTextNode(jr),i=this.getEditorRange();i?(i.deleteContents(),i.insertNode(r),i.insertNode(s)):n.append(s,r),n.normalize(),this.handleInput(),this.placeCaretAfterTag(r)}updateTag(t,n){var s;const o=(s=this.editor)==null?void 0:s.querySelector(`.locked-tag[data-id="${t}"]`);o instanceof HTMLElement&&(o.innerText=n,this.handleInput())}replaceTag(t,n){if(!this.editor||!this.options.isTagAllowed(n.id))return;const o=this.createTagNode({id:n.id,text:n.label,direction:n.direction}),s=this.editor.querySelector(`.locked-tag[data-id="${t.id}"]`);s instanceof HTMLElement&&(s.replaceWith(o),this.handleInput())}deleteTag(t){const n=this.editor;if(!n)return;const o=n.querySelector(`.locked-tag[data-id="${t}"]`);o instanceof HTMLElement&&this.removeTag(o,"after");const s=this.parse(),r=s[0];s.length===1&&typeof r=="string"&&r.trim()===""&&(n.innerHTML="",this.options.onChange(this.parse()))}isAllowedTagNode(t){return Yv(t)&&this.options.isTagAllowed(t.getAttribute("data-id")??"")}applyTagData(t,{text:n,direction:o}){t.innerText=n,o?t.dataset.direction=o:delete t.dataset.direction}createTagNode({id:t,text:n,direction:o}){const s=document.createElement("span");return s.contentEditable="false",s.className="locked-tag",s.dataset.id=t,this.applyTagData(s,{text:n,direction:o}),s}getEditorRange(){const t=window.getSelection();if(!this.editor||!(t!=null&&t.rangeCount))return null;const n=t.getRangeAt(0).cloneRange();return this.editor.contains(n.commonAncestorContainer)?tN(n):null}insertPlainText(t,n){const o=this.editor;if(!o)return;const s=window.getSelection();let r=n?tN(n):this.getEditorRange();(!r||!o.contains(r.commonAncestorContainer))&&(r=document.createRange(),r.selectNodeContents(o),r.collapse(!1)),r.deleteContents();const i=document.createTextNode(z0(t));r.insertNode(i),r.setStartAfter(i),r.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(r),this.handleInput()}sanitize(){const t=this.editor;if(!t)return;t.querySelectorAll(".locked-tag .locked-tag").forEach(o=>o.remove());let n=!1;if(Array.from(t.childNodes).forEach(o=>{if(Ws(o)||this.isAllowedTagNode(o))return;n=!0;const s=Yv(o)?"":z0(o.textContent??"");o.replaceWith(document.createTextNode(s))}),n){const o=window.getSelection(),s=document.createRange();s.selectNodeContents(t),s.collapse(!1),o==null||o.removeAllRanges(),o==null||o.addRange(s)}}ensureTagPadding(){var t;(t=this.editor)==null||t.querySelectorAll(".locked-tag").forEach(n=>{const o=n.previousSibling,s=n.nextSibling;Ws(o)?o.data.endsWith(jr)||o.appendData(jr):n.before(document.createTextNode(jr)),Ws(s)?s.data.startsWith(jr)||s.insertData(0,jr):n.after(document.createTextNode(jr))})}async placeCaretAfterTag(t){var s;(s=this.editor)==null||s.focus(),await Promise.resolve();const n=document.createRange();n.setStart(t,ga(t).start),n.collapse(!0);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(n)}findAdjacentTag(t){const n=this.editor,o=window.getSelection();if(!n||!o||!o.isCollapsed||!o.rangeCount)return null;const{startContainer:s,startOffset:r}=o.getRangeAt(0);if(!n.contains(s))return null;const i=t==="Backspace";let a;if(s===n)a=i?n.childNodes[r-1]??null:n.childNodes[r]??null;else if(Ws(s)&&s.parentNode===n){const{start:l,end:c}=ga(s);if(i?Math.min(r,c)>l:Math.max(r,l)<c)return null;a=i?s.previousSibling:s.nextSibling}else return null;for(;ooe(a);)a=i?a.previousSibling:a.nextSibling;return a&&this.isAllowedTagNode(a)?a:null}getBoundaryPoint(t){const n=this.editor,o=t==="start"?n.firstChild:n.lastChild;return Ws(o)?[o,t==="start"?0:o.length]:[n,t==="start"?0:n.childNodes.length]}moveToEdge(t,n){const o=this.editor,s=window.getSelection();if(!o||!s)return;const[r,i]=this.getBoundaryPoint(t),a=n&&s.anchorNode&&o.contains(s.anchorNode)?{node:s.anchorNode,offset:s.anchorOffset}:{node:r,offset:i};s.setBaseAndExtent(a.node,a.offset,r,i),o.scrollLeft=t==="start"?0:o.scrollWidth}moveAcrossTag(t){const n=t==="ArrowLeft",o=this.findAdjacentTag(n?"Backspace":"Delete"),s=window.getSelection();if(!o||!s)return!1;const r=n?o.previousSibling:o.nextSibling;if(!Ws(r))return!1;const i=ga(r);return s.collapse(r,n?i.end:i.start),!0}deleteCharacter(t){const n=window.getSelection();if(!this.editor||!(n!=null&&n.isCollapsed)||!n.rangeCount)return!1;const{startContainer:o,startOffset:s}=n.getRangeAt(0);if(!Ws(o)||o.parentNode!==this.editor)return!1;const{start:r,end:i}=ga(o);let a,l=1,c=s;if(t==="Backspace"){if(a=Math.min(s,i)-1,a<r)return!1;/[\uDC00-\uDFFF]/.test(o.data[a])&&a>r&&(a--,l=2),c=s-l}else{if(a=Math.max(s,r),a>=i)return!1;/[\uD800-\uDBFF]/.test(o.data[a])&&a+1<i&&(l=2)}return o.deleteData(a,l),n.collapse(o,c),this.handleInput(),!0}removeTag(t,n){var r;const o=t.previousSibling,s=t.nextSibling;t.remove(),o instanceof Text&&s instanceof Text&&o.data.endsWith(jr)&&s.data.startsWith(jr)&&(n==="after"?o.deleteData(o.length-1,1):s.deleteData(0,1)),(r=this.editor)==null||r.normalize(),this.handleInput()}focus(){var o;console.log("Focusing editor"),(o=this.editor)==null||o.focus();const t=document.createRange();t.selectNodeContents(this.editor),t.collapse(!1);const n=window.getSelection();n==null||n.removeAllRanges(),n==null||n.addRange(t)}}const ioe={class:"input-wrapper"},aoe=["data-placeholder"],loe=bt(tt({__name:"DynamicInput",props:{modelValue:{type:Array,default:()=>[]},placeholder:{type:String,default:"Rename to"},allowedTags:{type:Array,default:void 0}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const o=e,s=n,r=H(null),i=new roe({isTagAllowed:a=>!o.allowedTags||o.allowedTags.includes(a),onChange:a=>s("update:modelValue",a)});return en(()=>{r.value&&i.mount(r.value,o.modelValue)}),Jn(()=>i.destroy()),Qe(()=>o.modelValue,a=>i.sync(a),{deep:!0}),t({insertTag:a=>i.insertTag(a),updateTag:(a,l)=>i.updateTag(a,l),replaceTag:(a,l)=>i.replaceTag(a,l),deleteTag:a=>i.deleteTag(a),focus:()=>{console.log("Focusing editor"),i.focus()}}),(a,l)=>(K(),ce("div",ioe,[Te("div",{ref_key:"editorRef",ref:r,class:"custom-input single-line",contenteditable:"true","data-placeholder":e.placeholder,onPaste:l[0]||(l[0]=(...c)=>W(i).handlePaste&&W(i).handlePaste(...c)),onDrop:l[1]||(l[1]=(...c)=>W(i).handleDrop&&W(i).handleDrop(...c)),onBeforeinput:l[2]||(l[2]=(...c)=>W(i).handleBeforeInput&&W(i).handleBeforeInput(...c)),onInput:l[3]||(l[3]=(...c)=>W(i).handleInput&&W(i).handleInput(...c)),onKeydown:l[4]||(l[4]=(...c)=>W(i).handleKeydown&&W(i).handleKeydown(...c)),onClick:l[5]||(l[5]=Nt((...c)=>W(i).handleClick&&W(i).handleClick(...c),["stop","prevent"]))},null,40,aoe)]))}}),[["__scopeId","data-v-e3be4ee2"]]),coe={key:0},uoe={key:1},nN=8,doe=bt(tt({__name:"PreviewName",props:{text:{}},setup(e){const t=Kt,n=e,o=H(null),s=H(null),r=H(n.text),i=H(!1),a=d=>{const h=s.value;return h.textContent=d,h.offsetWidth},l=(d,h)=>{const f=d.slice(-nN),p=d.length-nN-1;if(p<1||a(d)<=h)return d;let g=0,v=p;for(;g<v;){const C=Math.ceil((g+v)/2);a(`${d.slice(0,C)}…${f}`)<=h?g=C:v=C-1}return`${d.slice(0,g)}…${f}`},c=()=>{!o.value||!s.value||(r.value=l(n.text,o.value.clientWidth),i.value=r.value!==n.text)};let u;return en(()=>{c(),u=new ResizeObserver(c),u.observe(o.value)}),Jn(()=>u==null?void 0:u.disconnect()),Qe(()=>n.text,()=>ft(c)),(d,h)=>(K(),ce("div",{ref_key:"rootRef",ref:o,class:"preview-name"},[i.value?qe((K(),ce("span",coe,[nt(it(r.value),1)])),[[W(t),{content:e.text,delay:[1e3,0],bypassOverflowCheck:!0}]]):(K(),ce("span",uoe,it(e.text),1)),Te("span",{ref_key:"measureRef",ref:s,class:"measure","aria-hidden":"true"},null,512)],512))}}),[["__scopeId","data-v-f1310bab"]]),oN=10,sN=5,tp={number:{first:"000",step:"1"},letter:{first:"A",step:"1"}},hoe={up:{first:"Start at",step:"Increase by"},down:{first:"End at",step:"Decrease by"}},foe=/^[0-9]$/,poe=/^[A-Za-z]$/,rN=(e,t)=>t==="first"&&e==="letter"?poe:foe,goe=(e,t,n)=>rN(e,t).test(n),moe=e=>e==="first"?oN:sN,voe=e=>e&&e[0]===e[0].toLowerCase()?e.toLowerCase():e.toUpperCase(),yoe=(e,t,n)=>{const o=rN(e,t),s=Array.from(n).filter(r=>o.test(r)).join("").slice(0,moe(t));return t==="first"&&e==="letter"?voe(s):s},iN=(e,t)=>t!==""&&(e==="first"||Number(t)>0),woe=e=>Array.from(e.toUpperCase()).reduce((t,n)=>t*26+(n.charCodeAt(0)-64),0),Coe=e=>{let t="",n=e;for(;n>0;){const o=(n-1)%26;t=String.fromCharCode(65+o)+t,n=Math.floor((n-1)/26)}return t},aN=({type:e,direction:t,first:n,step:o,count:s})=>{const r=Number(o)||1,i=c=>(t==="up"?c:s-1-c)*r;if(e==="number"){const c=Number(n);return Array.from({length:s},(u,d)=>String(c+i(d)).padStart(n.length,"0"))}const a=woe(n),l=n!==""&&n[0]===n[0].toLowerCase();return Array.from({length:s},(c,u)=>{const d=Coe(a+i(u));return l?d.toLowerCase():d})},boe={class:"bulk-rename-popup",id:"bulk-rename-el"},Soe={class:"left-section"},Eoe={class:"modified-template-options"},_oe=["onClick"],Roe={class:"setting-count"},Toe={class:"field-label"},Doe={class:"field-label"},Ioe={class:"confirmation"},xoe={class:"preview-section"},Poe={class:"preview-list"},koe={key:0,class:"preview-more"},lN=8,cN=7,Foe=bt(tt({__name:"BulkRenamePopup",props:{item:{}},emits:["cancel","rename"],setup(e,{expose:t,emit:n}){const o=Kt,s=H(null),r=["number","letter","name"],i={number_up:"1→9",number_down:"9→1",letter_up:"A→Z",letter_down:"Z→A",name:"Name"},a=e,l=H([]),c=Y(()=>l.value.find(q=>typeof q!="string"&&(q.id==="number"||q.id==="letter"))),u=H("number"),d=H("up"),h=Go({...tp.number}),f=Go({...tp.number}),p=()=>{Object.assign(h,tp[u.value]),Object.assign(f,tp[u.value])};Qe(c,q=>{if(!q)return;const V=q.id;V!==u.value&&(u.value=V,p()),d.value=q.direction==="down"?"down":"up"},{immediate:!0,flush:"sync"});const g=Y(()=>hoe[d.value]),v=(q,V)=>{const k=yoe(u.value,q,V);h[q]=k,iN(q,k)&&(f[q]=k)},C=(q,V)=>{V.key.length===1&&!V.ctrlKey&&!V.metaKey&&!V.altKey&&!goe(u.value,q,V.key)&&V.preventDefault()},S=(q,V)=>{var Fe;V.preventDefault();const k=V.target,G=((Fe=V.clipboardData)==null?void 0:Fe.getData("text/plain"))??"",ee=k.selectionStart??k.value.length,ge=k.selectionEnd??k.value.length;k.value=k.value.slice(0,ee)+G+k.value.slice(ge),v(q,k.value),k.value=h[q]},b=q=>{if(iN(q,h[q]))return;const V=tp[u.value][q];h[q]=V,f[q]=V},y=Y(()=>c.value?aN({type:u.value,direction:d.value,first:f.first,step:f.step,count:a.item.length}):[]),_=Y(()=>l.value.every(q=>typeof q=="string"&&!q)),E=Y(()=>_.value||l.value.length==0&&l.value[0]===" "?a.item.map(q=>q.name):a.item.map((q,V)=>l.value.map(k=>typeof k=="string"?k:k.id==="name"?q.name:y.value[V]??"").join(""))),D=Y(()=>E.value.length>lN?E.value.length-cN:0),T=Y(()=>E.value.length>lN?E.value.slice(0,cN):E.value),P=[{id:"name",name:"Current name",icon:null,description:{active:"Remove from the name",inactive:"Add the current name"}},{id:"number_up",name:"Number",icon:"ArrowLeft",description:{active:"Remove from the name",inactive:"Add a number that counts up",switch:"Switch to a number that counts up"}},{id:"number_down",name:"Number",icon:"ArrowRight",description:{active:"Remove from the name",inactive:"Add a number that counts down",switch:"Switch to a number that counts down"}},{id:"letter_up",name:"Letter",icon:"ArrowLeft",description:{active:"Remove from the name",inactive:"Add a letter that counts up",switch:"Switch to a letter that counts up"}},{id:"letter_down",name:"Letter",icon:"ArrowRight",description:{active:"Remove from the name",inactive:"Add a letter that counts down",switch:"Switch to a letter that counts down"}}],L=q=>{x.value=[q];const V=q.id.split("_")[0],k=q.id.split("_")[1],G=i[q.id],ee=s.value;if(!ee)return;const ge=Ge=>l.value.find(fe=>typeof fe!="string"&&Ge.includes(fe.id));if(V==="name"){ge(["name"])?ee.deleteTag("name"):ee.insertTag({id:V,text:G,direction:void 0});return}const Fe=ge(["number","letter"]);if(Fe){const Ge=Fe.id===V,fe=Fe.direction===k;if(Ge&&fe){ee.deleteTag(Fe.id);return}ee.deleteTag(Fe.id),ee.insertTag({id:V,text:G,direction:k})}else ee.insertTag({id:V,text:G,direction:k})},I=q=>O(q.id)?q.description.active:!!c.value&&q.description.switch?q.description.switch:q.description.inactive,x=H(null),O=q=>{const[V,k]=q.split("_");return l.value.some(G=>typeof G!="string"&&G.id===V&&G.direction===k)},N=n,F=Y(()=>l.value.length===1&&typeof l.value.at(0)!="string"&&l.value[0].id==="name"),z=Y(()=>l.value.length===0||F.value),j=()=>{x.value=null,l.value=[],N("cancel")},Q=()=>{const q=l.value.map(V=>typeof V=="string"?{type:"text",value:V}:V.id==="name"?{type:"current_name"}:{type:"counter",value:h.first,direction:V.direction=="up"?"asc":"desc",format:V.id==="number"?"number":"letter",step:h.step});N("rename",q)};return t({reset:()=>{x.value=null,l.value=[]},focus:()=>{var q;(q=s.value)==null||q.focus()}}),en(()=>{console.log("Focusing template input"),setTimeout(()=>{var q;(q=s.value)==null||q.focus()},500)}),(q,V)=>(K(),ce("div",boe,[Te("div",Soe,[ye(loe,{modelValue:l.value,"onUpdate:modelValue":V[0]||(V[0]=k=>l.value=k),"allowed-tags":r,ref_key:"templateInputRef",ref:s},null,8,["modelValue"]),Te("div",Eoe,[(K(),ce(Ft,null,Pn(P,k=>qe((K(),ce("button",{onClick:G=>L(k),class:se(["template-option",{active:O(k.id)}]),key:k.id},[nt(it(k.name)+" ",1),k.icon?(K(),ze(W(ct),{key:0,src:k.icon,style:{transform:"rotate(90deg)"}},null,8,["src"])):Xe("",!0)],10,_oe)),[[W(o),{content:I(k),bypassOverflowCheck:!0,delay:[300,0],interactive:!1,hideOnClick:!1,appendTo:"parent"}]])),64))]),Te("div",Roe,[Te("span",Toe,it(g.value.first),1),ye(W($f),{"model-value":h.first,disabled:!c.value,"max-length":W(oN),onInput:V[1]||(V[1]=k=>v("first",k)),onKeydown:V[2]||(V[2]=k=>C("first",k)),onPaste:V[3]||(V[3]=k=>S("first",k)),onBlur:V[4]||(V[4]=k=>b("first")),"show-clear":!1},{clear:be(()=>[...V[9]||(V[9]=[Te("div",null,null,-1)])]),_:1},8,["model-value","disabled","max-length"]),Te("span",Doe,it(g.value.step),1),ye(W($f),{"model-value":h.step,disabled:!c.value,"max-length":W(sN),onInput:V[5]||(V[5]=k=>v("step",k)),onKeydown:V[6]||(V[6]=k=>C("step",k)),onPaste:V[7]||(V[7]=k=>S("step",k)),onBlur:V[8]||(V[8]=k=>b("step")),"show-clear":!1},null,8,["model-value","disabled","max-length"])]),Te("div",Ioe,[ye(W(pt),{variant:"secondary",onClick:j},{default:be(()=>[...V[10]||(V[10]=[nt(" Cancel ",-1)])]),_:1}),ye(W(pt),{onClick:Q,disabled:z.value},{default:be(()=>[...V[11]||(V[11]=[nt(" Rename ",-1)])]),_:1},8,["disabled"])])]),Te("div",xoe,[V[12]||(V[12]=Te("span",{class:"preview-title"},"Preview",-1)),Te("ul",Poe,[(K(!0),ce(Ft,null,Pn(T.value,(k,G)=>(K(),ce("li",{key:G},[ye(doe,{text:k},null,8,["text"])]))),128)),D.value>0?(K(),ce("li",koe," … "+it(D.value)+" more items ",1)):Xe("",!0)])])]))}}),[["__scopeId","data-v-270b322e"]]),Aoe=tt({__name:"BulkRenameButton",props:{item:{},totalItem:{}},emits:["cancel","rename"],setup(e,{expose:t,emit:n}){const{popupRef:o,show:s,hide:r,triggerRef:i}=mo({interactive:!0,trigger:"manually",placement:"top-end",showArrow:!1,offset:[-350,25],hideOnClick:!0,toggleOnClick:!0,onHide:()=>{console.log("Popup hidden"),h()},onShow:()=>{ft(()=>{var f;(f=d.value)==null||f.focus()})}}),a=e,l=()=>{r()},c=f=>{u("rename",f),r()},u=n,d=H(null),h=()=>{d.value&&d.value.reset()};return t({popupRef:o,hide:r,show:s,triggerRef:i}),(f,p)=>(K(),ce(Ft,null,[Te("div",{class:"trigger-el",ref_key:"triggerRef",ref:i},null,512),Te("div",{class:"popup-el",ref_key:"popupRef",ref:o},[ye(Foe,{item:a.item,"total-item":a.totalItem,ref_key:"bulkRenameRef",ref:d,onCancel:l,onRename:c},null,8,["item","total-item"])],512)],64))}}),Ooe={...{list_cursor:{error:"Failed to fetch data. Please reload table."},assignedUser:{error:"Failed to fetch assignees. Please reload table."},metricValues:{error:"Failed to fetch metric values. Please reload table."},assignableUser:{error:"Failed to fetch people. Please try again."},assignableStatus:{error:"Failed to fetch statuses. Please try again."},basicInfor:{error:"Failed to fetch basic information."},item:{error:"Update failed. Please try again."},removeAssignee:{error:"Update failed. Please try again."},metricList:{error:"Failed to fetch metrics. Please try again."},multipleAssignableUser:{error:"Failed to fetch data. Please reload table."},getPermission:{error:"Failed to fetch permissions."},delete_rendition:{success:"Deletion successful.",error:"Deletion failed. Please try again."},delete_thumbnail:{success:"Deletion successful.",error:"Deletion failed. Please try again."},archive_item:{success:"Archive successful.",error:"Archive failed. Please try again."},unarchive_item:{success:"Unarchive successful.",error:"Unarchive failed. Please try again."},bulkDelete:{success:"Deletion successful.",error:"Deletion failed. Please try again."},bulkArchive:{error:"Archive failed. Please try again."},bulkDateUpdate:{error:"Failed to update items."},bulkAssignUpdate:{error:"Failed to update assignees."},bulkStatusUpdate:{error:"Failed to update items."},getUserPermission:{error:"Failed to fetch user permissions."},getEntityDetail:{error:"Failed to fetch entity details."},bulkUnarchive:{error:"Unarchive failed. Please try again."},downloadTemplate:{},importItems:{},exportItems:{},updateFromFile:{},me:{},workspaces:{},entityUserRoles:{},templateFlowStatuses:{},bulkMetricUpdate:{error:"Update failed. Please try again."},createNewItem:{},getAssignableAssignees:{},getAssignableStatuses:{},getFilterStatuses:{},bulkRename:{}},offline:{error:"You are currently offline. Please check your network connection."}};function uN(e,t,n){return(t=Noe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Moe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Noe(e){var t=Moe(e,"string");return typeof t=="symbol"?t:t+""}function kc(e){"@babel/helpers - typeof";return kc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kc(e)}var dN=function(e){return e.TOOLBOX_EXPORT_DATA="TOOLBOX_EXPORT_DATA",e.SW_APP_LOADER="SW_APP_LOADER",e}({});function hN(e){return kc(e)==="object"&&e!==null&&!Array.isArray(e)}function fN(e,t){var n=Object.keys(e);return n.length===t.length&&t.every(function(o){return n.includes(o)})}function Loe(e){return typeof Blob<"u"&&e instanceof Blob}var Voe=function(t){return hN(t)&&fN(t,["file","fileName"])&&Loe(t.file)&&typeof t.fileName=="string"},Boe=function(t){return hN(t)&&fN(t,["scene_id","people_id","openGS","queryParams"])&&(typeof t.scene_id=="string"||t.scene_id===null)&&(typeof t.people_id=="string"||t.people_id===null)&&(typeof t.openGS=="boolean"||t.openGS===null)&&typeof t.queryParams=="string"};Object.freeze(uN(uN({},dN.TOOLBOX_EXPORT_DATA,Voe),dN.SW_APP_LOADER,Boe));class $oe extends Error{}class fl extends $oe{constructor(){super("Zone is an abstract class")}}class pN{get type(){throw new fl}get name(){throw new fl}get ianaName(){return this.name}get isUniversal(){throw new fl}offsetName(t,n){throw new fl}formatOffset(t,n){throw new fl}offset(t){throw new fl}equals(t){throw new fl}get isValid(){throw new fl}}const K0=new Map;function Hoe(e){let t=K0.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),K0.set(e,t)),t}const Goe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Uoe(e,t){const n=e.format(t).replace(/\u200E/g,""),o=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,s,r,i,a,l,c,u]=o;return[i,s,r,a,l,c,u]}function Woe(e,t){const n=e.formatToParts(t),o=[];for(let s=0;s<n.length;s++){const{type:r,value:i}=n[s],a=Goe[r];r==="era"?o[a]=i:Zv(a)||(o[a]=parseInt(i,10))}return o}const q0=new Map;class Xv extends pN{static create(t){let n=q0.get(t);return n===void 0&&q0.set(t,n=new Xv(t)),n}static resetCache(){q0.clear(),K0.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=Xv.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:n,locale:o}){return Koe(t,n,o,this.name)}formatOffset(t,n){return Qv(this.offset(t),n)}offset(t){if(!this.valid)return NaN;const n=new Date(t);if(isNaN(n))return NaN;const o=Hoe(this.name);let[s,r,i,a,l,c,u]=o.formatToParts?Woe(o,n):Uoe(o,n);a==="BC"&&(s=-Math.abs(s)+1);const h=joe({year:s,month:r,day:i,hour:l===24?0:l,minute:c,second:u,millisecond:0});let f=+n;const p=f%1e3;return f-=p>=0?p:1e3+p,(h-f)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}}let Y0=null;class fd extends pN{static get utcInstance(){return Y0===null&&(Y0=new fd(0)),Y0}static instance(t){return t===0?fd.utcInstance:new fd(t)}static parseSpecifier(t){if(t){const n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new fd(mN(n[1],n[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Qv(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Qv(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,n){return Qv(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}}function Zv(e){return typeof e>"u"}function Jv(e,t=2){const n=e<0;let o;return n?o="-"+(""+-e).padStart(t,"0"):o=(""+e).padStart(t,"0"),o}function gN(e){if(!(Zv(e)||e===null||e===""))return parseInt(e,10)}function zoe(e){if(!(Zv(e)||e===null||e==="")){const t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function joe(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Koe(e,t,n,o=null){const s=new Date(e),r={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};o&&(r.timeZone=o);const i={timeZoneName:t,...r},a=new Intl.DateTimeFormat(n,i).formatToParts(s).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function mN(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const o=parseInt(t,10)||0,s=n<0||Object.is(n,-0)?-o:o;return n*60+s}function Qv(e,t){const n=Math.trunc(Math.abs(e/60)),o=Math.trunc(Math.abs(e%60)),s=e>=0?"+":"-";switch(t){case"short":return`${s}${Jv(n,2)}:${Jv(o,2)}`;case"narrow":return`${s}${n}${o>0?`:${o}`:""}`;case"techie":return`${s}${Jv(n,2)}${Jv(o,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}const vN=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function pd(...e){const t=e.reduce((n,o)=>n+o.source,"");return RegExp(`^${t}$`)}function gd(...e){return t=>e.reduce(([n,o,s],r)=>{const[i,a,l]=r(t,s);return[{...n,...i},a||o,l]},[{},null,1]).slice(0,2)}function yN(...e){return(t,n)=>{const o={};let s;for(s=0;s<e.length;s++)o[e[s]]=gN(t[n+s]);return[o,null,n+s]}}const wN=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,qoe=`(?:${wN.source}?(?:\\[(${vN.source})\\])?)?`,CN=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,bN=RegExp(`${CN.source}${qoe}`),X0=RegExp(`(?:[Tt]${bN.source})?`),Yoe=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Xoe=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Zoe=/(\d{4})-?(\d{3})/,Joe=yN("weekYear","weekNumber","weekDay"),Qoe=yN("year","ordinal"),ese=/(\d{4})-(\d\d)-(\d\d)/,SN=RegExp(`${CN.source} ?(?:${wN.source}|(${vN.source}))?`),tse=RegExp(`(?: ${SN.source})?`);function md(e,t,n){const o=e[t];return Zv(o)?n:gN(o)}function nse(e,t){return[{year:md(e,t),month:md(e,t+1,1),day:md(e,t+2,1)},null,t+3]}function vd(e,t){return[{hours:md(e,t,0),minutes:md(e,t+1,0),seconds:md(e,t+2,0),milliseconds:zoe(e[t+3])},null,t+4]}function np(e,t){const n=!e[t]&&!e[t+1],o=mN(e[t+1],e[t+2]),s=n?null:fd.instance(o);return[{},s,t+3]}function op(e,t){const n=e[t]?Xv.create(e[t]):null;return[{},n,t+1]}pd(Yoe,X0),pd(Xoe,X0),pd(Zoe,X0),pd(bN),gd(nse,vd,np,op),gd(Joe,vd,np,op),gd(Qoe,vd,np,op),gd(vd,np,op),gd(vd),pd(ese,tse),pd(SN),gd(vd,np,op);var Mo=function(e){return e.review="{reviewDomain}/{ws_code}",e.review_take="{reviewDomain}/{ws_code}?id={take_id}",e.review_scene="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&tab=iteration",e.review_rendition="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}",e.review_frame="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}&tab=comment&refresh_marker=true#type=frame&data={frame}",e.review_rendition_comment="{reviewDomain}/{ws_code}?scene_id={scene_id}&rendition_id={rendition_id}&comment_id={comment_id}&tab=comment",e.review_comment="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&comment_id={comment_id}",e.scene_hub="{baseDomain}/{ws_code}/{scene_id}?o=st",e.hub_rendition="{baseDomain}/{ws_code}/{scene_id}?o=st&renditionId={rendition_id}",e.hub_comment="{baseDomain}/{ws_code}/{scene_id}?o=st&comment_id={comment_id}",e.people_insight="{baseDomain}/{ws_code}/{user_id}?o=pt",e.people_detail="{baseDomain}/{ws_code}/ws/ppl/{display_name}-{user_id}",e.project="{baseDomain}/{ws_code}/pl/dir/{entity_id}",e.project_focusMode="{baseDomain}/{ws_code}/pl/dir/{parent_id}?f={entity_id}",e.woohoo="{baseDomain}/{ws_code}/pl/woo/rpt/{woohoo_id}",e.update="{baseDomain}/{ws_code}/pl/au?id={entity_id}",e.core="{baseDomain}/{ws_code}",e}(Mo||{});Mo.review,Mo.review_take,Mo.review_scene,Mo.review_rendition,Mo.review_frame,Mo.review_rendition_comment,Mo.review_comment,Mo.scene_hub,Mo.hub_rendition,Mo.hub_comment,Mo.people_insight,Mo.people_detail,Mo.project,Mo.woohoo,Mo.update,Mo.core,Mo.project_focusMode;var Z0=null;function ose(e){Z0=e}function ey(){if(!Z0)throw new Error("i18n instance not set. Call setI18nInstance(i18n) before using errorHelper.");return Z0}function EN(){try{var e=sessionStorage.getItem("APP_DEBUG")?"✅":"",t=ey();return"".concat(t.t("errorMessages.fallback.unknownError")," ").concat(e)}catch{return"An error occurred. Please try again or contact support."}}function sse(e,t,n,o){var s=e.replace(/{field}/g,t);if(o&&kc(o)==="object")Object.keys(o).forEach(function(i){var a="{".concat(i,"}"),l=o[i];Array.isArray(l)?l=l.join(", "):i==="value"&&(o.min||o.max)&&(l="".concat(o.min||o.value," and ").concat(o.max||o.value)),s=s.replace(new RegExp(a,"g"),l||"")});else if(Array.isArray(n)&&n.length>0){var r=n[0]||"";n.length>1?r="".concat(n[0]," and ").concat(n[1]):n.length===1&&Array.isArray(n[0])&&(r=n[0].join(", ")),s=s.replace(/{value}/g,r)}return s}function rse(e,t){for(var n=Object.keys(t),o=0,s=n;o<s.length;o++){var r=s[o],i=Array.isArray(t[r])?t[r].join(", "):String(t[r]);e=e.replace(new RegExp("\\{".concat(r,"\\}"),"g"),i)}if(n.length>0&&e.includes("{value}")){var a=t[n[0]],l=Array.isArray(a)?a.join(", "):String(a);e=e.replace(/{value}/g,l)}return e}function _N(e){return!!(e&&e.validation&&e.validation.fields&&Object.keys(e.validation.fields).length>0)}function RN(e,t){if(!e||kc(e)!=="object")return null;try{var n=ey();if(e.validation&&e.validation.fields)for(var o=e.validation.fields,s=Object.keys(o),r=0,i=s;r<i.length;r++){var a=i[r],l=o[a];if(l&&l.rule){var c=l.rule,u=l.data||[],d=l.params||{};try{var h,f,p=((h=n.messages)===null||h===void 0?void 0:h.value)||n.messages,g=((f=n.locale)===null||f===void 0?void 0:f.value)||n.locale,v=null;if(t){var C,S=t.toUpperCase();v=(C=p[g])===null||C===void 0||(C=C.errorMessages)===null||C===void 0||(C=C[S])===null||C===void 0||(C=C.validation_rules)===null||C===void 0?void 0:C[c]}if(!v){var b;v=(b=p[g])===null||b===void 0||(b=b.errorMessages)===null||b===void 0||(b=b.GEN)===null||b===void 0||(b=b.validation_rules)===null||b===void 0?void 0:b[c]}if(v&&typeof v=="string")return sse(v,a,u,d)}catch(y){console.error("Error in validation rules",y)}}}}catch(y){return console.error("Error in getValidationErrorMessage:",y),null}return null}function TN(e){var t=sessionStorage.getItem("APP_DEBUG")?"✅":"";if(!e)return EN();var n=e.code,o=e.error,s=e.details,r=e.message;if(_N(s)&&s){var i=RN(s,o==null?void 0:o.type);if(sessionStorage.getItem("APP_DEBUG")&&console.log("[Error Utils Debug]",i),i)return n!==""?"[".concat(n,"] ").concat(i," ").concat(t):"".concat(i);try{var a=ey();return a.t("errorMessages.GEN.validation_error")}catch{return"Validation error occurred."}}if(o&&kc(o)==="object"&&o.type&&o.key){var l=o.type.toUpperCase();try{var c,u,d,h="errorMessages.".concat(l,".").concat(o.key),f=ey(),p=((c=f.messages)===null||c===void 0?void 0:c.value)||f.messages,g=((u=f.locale)===null||u===void 0?void 0:u.value)||f.locale,v=(d=p[g])===null||d===void 0||(d=d.errorMessages)===null||d===void 0||(d=d[l])===null||d===void 0?void 0:d[o.key];if(v&&typeof v=="string"){var C=v;return s!=null&&s.context&&(C=rse(C,s.context),sessionStorage.getItem("APP_DEBUG")&&console.log("[Error Utils Debug]",C)),n!==""?"[".concat(n,"] ").concat(C," ").concat(t):"".concat(C," ").concat(t)}}catch(b){console.error("[Error Utils Debug]",b)}}if(o&&kc(o)!=="object"&&_N(s)){var S=RN(s);if(S)return n!==""?"[".concat(n,"] ").concat(S," ").concat(t):"".concat(S," ").concat(t)}return r?"".concat(r):EN()}const Es=Sc("toast",()=>{const e=c=>TN(c),t=c=>{var u;if((c==null?void 0:c.apiCode)==="offline")r({id:"offline",type:"error",message:"You are currently offline. Please check your network connection."});else{const d=TN((u=c==null?void 0:c.res)==null?void 0:u.data);r({id:c==null?void 0:c.apiCode,type:"error",message:d})}},n=H([]),o=(c,u)=>{const d=Ooe[c];if(d){const h=d[u];if(h){r({id:c,type:u,message:h});return}}else r({id:c,type:u,message:c})},s=new Map,r=(c,u=5e3)=>{const d={...c,id:c.id??Date.now()+Math.random()};if(n.value.push(d),u>0){const h=Date.now(),f=setTimeout(()=>{i(d.id),s.delete(d.id)},u);s.set(d.id,{timeoutId:f,remainingTime:u,startTime:h})}};function i(c){n.value=n.value.filter(d=>d.id!==c);const u=s.get(c);u&&(clearTimeout(u.timeoutId),s.delete(c))}function a(c){const u=s.get(c);if(u){clearTimeout(u.timeoutId);const d=Date.now()-u.startTime;u.remainingTime=Math.max(0,u.remainingTime-d)}}function l(c){const u=s.get(c);if(u&&u.remainingTime>0){const d=setTimeout(()=>{i(c),s.delete(c)},u.remainingTime);u.timeoutId=d,u.startTime=Date.now()}}return{notifications:n,addNotification:r,removeNotification:i,showMessage:o,showErrorNetMessage:t,pauseAutoDismiss:a,resumeAutoDismiss:l,getErrorMessageFromResponse:e}}),ise={style:{"max-width":"225px","line-height":"14px"}},ase={style:{"max-width":"100px","line-height":"14px"}},DN=500,lse=bt(tt({__name:"BulkUpdate",props:{selectRowData:{},workspaceId:{},entityId:{},gridApi:{},selectedAll:{type:Boolean},takeName:{},totalRows:{},visibleRows:{},loading:{type:Boolean}},emits:["close","assignStatus","assignAssignee","assignDate","assignMetric","moreActions","deleteSelected","unselect","updated","selectAll","refreshSelectedRow"],setup(e,{emit:t}){const n=Kt,o=Uo,s=e,r=t,i=qv(),{handelSelectAll:a}=i,{selectionStatus:l}=us(i),c=Y(()=>l.value===At.CHECKED),u=Y(()=>s.selectRowData.map(oe=>oe.id)),d=Y(()=>s.selectRowData.length>0);ui("bulkUpdate",d),ui("isSelectAll",c);const h=(oe,ae,ue)=>{const xe=oe.getRowNode(ae);xe&&xe.setData({...xe.data,...ue})},f=({itemIds:oe,data:ae})=>{const ue=s.gridApi;if(!ue){console.error("Grid API is undefined");return}oe.forEach(xe=>{const le=ue.getRowNode(xe);le&&!le.data.isLocked&&le.setData({...le.data,status:ae})})},p=({itemIds:oe,data:ae})=>{const ue=s.gridApi;if(!ue){console.error("Grid API is undefined");return}oe.forEach(xe=>{const le=ue.getRowNode(xe);if(le){const M=le.data.dateRange||[null,null];"startDate"in ae&&ae.startDate!==void 0&&(M[0]=ae.startDate?new Date(ae.startDate):null),"dueDate"in ae&&ae.dueDate!==void 0&&(M[1]=ae.dueDate?new Date(ae.dueDate):null);const $={...le.data,dateRange:M};le.setData($)}}),r("updated")},g=oe=>{const ae=s.gridApi,{id:ue,value:xe}=oe;if(!ae){console.error("Grid API is undefined");return}u.value.forEach(le=>h(ae,le,{[`metric_${ue}`]:xe})),r("updated")},v=["primary"],C=[{label:"Rename",icon:"Pen",id:"bulk-rename",type:"icon",value:"bulk-rename"},{label:"Delete Thumbnail",icon:"Image",id:"delete-thumbnail",type:"icon",value:"delete-thumbnail"},{label:"Delete Rendition",icon:"Film",id:"delete-rendition",type:"icon",value:"delete-rendition"},{label:"Unarchive",value:"UnBoxArchive",type:"icon",icon:"BoxArchive",id:"unarchive",clickable:!0},{label:"Archive",value:"BoxArchive",type:"icon",icon:"BoxArchive",id:"archive",clickable:!0},{label:"Delete",value:"delete",type:"icon",icon:"TrashCan",id:"delete",danger:!0,clickable:!0}],S=()=>{r("unselect")},b=r0(),{userPermissions:y}=us(b),_=Y(()=>y.value.includes(i0)),E=Y(()=>{if(!_.value){console.error("User does not have permission to open review.");return}return l.value==At.CHECKED?ls({type:"review_take",config:{reviewDomain:fn.getInstance().getItem("BASE_REVIEW_URL"),ws_code:s.workspaceId,take_id:s.entityId}}).url:ls({type:"review_multiple_scenes",config:{reviewDomain:fn.getInstance().getItem("BASE_REVIEW_URL"),ws_code:s.workspaceId,scene_ids:u.value.join(",")}}).url}),D=oe=>{const{assignees:ae,type:ue}=oe,xe=s.gridApi;if(!xe){console.error("Grid API is not available for bulk update.");return}const le=new Set(ae.map(M=>M.id));u.value.forEach(M=>{const $=xe.getRowNode(M);if(!$)return;const Ce=$.data.assignees||[];let Ee=[];switch(ue){case"add":{const me=new Set(Ce.map($e=>$e.id));Ee=[...Ce,...ae.filter($e=>!me.has($e.id))];break}case"overwrite":Ee=ae;break;case"remove":Ee=Ce.filter(me=>!le.has(me.id));break;case"removeAll":Ee=[];break}$.setData({...$.data,assignees:Ee})})},{apiServices:T}=io(!1,s),P=H(null),L=In("filterParams",void 0),I=Y(()=>({workspaceId:String(s.workspaceId),itemIds:d.value&&c.value?[]:u.value,entityId:s.entityId,filterParams:L!=null&&L.value?L.value:void 0})),x=async()=>{var xe;const oe=u.value,ae=s.gridApi;if(!ae){console.error("Grid API is not available for bulk delete.");return}const ue=await((xe=T.value)==null?void 0:xe.bulkDeleteItems(I.value));(ue==null?void 0:ue.message)=="Done"&&(oe.forEach(le=>h(ae,le,{isDeleted:!0,disabled:!0})),ae.deselectAll())},O=async({request:oe,apiUnavailableMessage:ae,failureMessage:ue,onSuccess:xe})=>{var Ce,Ee;const le=u.value,M=s.gridApi;if(!M){console.error(ae);return}const $=await oe();if(($==null?void 0:$.message)!="Done"){console.error(ue),(Ce=P.value)==null||Ce.open();return}xe(le,M),(Ee=P.value)==null||Ee.hide()},N=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.bulkUnarchiveItems(I.value)},apiUnavailableMessage:"Grid API is not available for bulk unarchive.",failureMessage:"Failed to unarchive items.",onSuccess:oe=>Q(oe,"isArchived",!1)}),F=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.bulkArchiveItems(I.value)},apiUnavailableMessage:"Grid API is not available for bulk archive.",failureMessage:"Failed to archive items.",onSuccess:oe=>Q(oe,"isArchived",!0)}),z=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.deleteThumbnail(I.value)},apiUnavailableMessage:"Grid API is not available for bulk thumbnail deletion.",failureMessage:"Failed to delete thumbnails.",onSuccess:(oe,ae)=>oe.forEach(ue=>h(ae,ue,{thumbnail:null}))}),j=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.deleteRendition(I.value)},apiUnavailableMessage:"Grid API is not available for bulk rendition deletion.",failureMessage:"Failed to delete renditions.",onSuccess:(oe,ae)=>oe.forEach(ue=>h(ae,ue,{rendition:null}))}),Q=(oe,ae,ue)=>{const xe=s.gridApi;if(!xe){console.error("Grid API is not available for bulk update.");return}const le=[];oe.forEach(M=>{const $=xe.getRowNode(M);$&&($.setData({...$.data,[ae]:typeof ue=="function"?ue():ue}),le.push($))}),xe.redrawRows({rowNodes:le})},re=H(!1),q=H(null),V=async oe=>{var ae,ue,xe;try{switch(G.value=!0,re.value=!0,oe.id){case"unarchive":await N();break;case"delete":await x();break;case"archive":await F();break;case"delete-thumbnail":await z();break;case"delete-rendition":await j();break;case"bulk-rename":await Ge(),(ae=P.value)==null||ae.hide();break;default:console.error("Unknown action:",oe.id),re.value=!1;break}}catch(le){console.error("Error performing action:",le),(ue=P.value)==null||ue.open()}finally{(xe=q.value)==null||xe.focus(),ft(()=>{G.value=!1,re.value=!1})}},k=(oe,ae)=>{var ue;!oe&&ae&&((ue=q.value)==null||ue.focus())},G=H(!0),ee=oe=>{ft(()=>{G.value=oe})};Qe(()=>s.selectRowData,()=>{G.value=!1},{deep:!0,immediate:!0});const ge=Y(()=>({workspaceId:s.workspaceId,entityId:s.entityId,variant:v,disabled:G.value,ids:l.value==At.CHECKED?[]:u.value})),Fe=H(null),Ge=async()=>{var oe;(oe=Fe.value)==null||oe.show()},fe=Y(()=>s.selectRowData.map((oe,ae)=>({name:oe.name,index:ae}))),X=(oe,{currentName:ae,counterValue:ue})=>oe.map(xe=>{switch(xe.type){case"text":return xe.value;case"current_name":return ae;case"counter":return ue;default:return""}}).join(""),we=(oe,ae)=>{const ue=oe.find(xe=>xe.type==="counter");return ue?aN({type:ue.format,direction:ue.direction==="asc"?"up":"down",first:ue.value,step:ue.step,count:ae}):[]},de=(oe,ae)=>{const ue=new Map(s.selectRowData.map(le=>[le.id,le.name||""])),xe=we(oe,ae.length);return ae.map((le,M)=>{const $=ue.get(le)??"",Ce=X(oe,{currentName:$,counterValue:xe[M]??""});return{id:le,from:$,to:Ce}})},B=({parameters:oe,segments:ae,renamedItems:ue,status:xe,response:le,error:M})=>{var Se,Me,Ct;const $=M!==void 0,Ce=xe.status??((Se=M==null?void 0:M.response)==null?void 0:Se.status),Ee=s.selectRowData.length,me=oe.itemIdsCount??null,$e=new Set(ue.map(Rt=>Rt.to)).size,Ye=[$?`FAILED: ${(M==null?void 0:M.message)??"unknown error"} (HTTP ${Ce??"n/a"})`:Ce===202?"OK: HTTP 202, rename queued; table names unchanged, rows set to processing (state 1)":`OK: request resolved (HTTP ${Ce??"unknown"})`,me===null?`Select-all: server resolves items from entity (${Ee} loaded locally)`:me===Ee?`All ${Ee} selected items were sent`:`MISMATCH: ${me} ids sent vs ${Ee} selected`,ue.length?$e===ue.length?"All generated names are unique":`WARNING: ${ue.length-$e} duplicate generated name(s)`:`Names not generated locally (more than ${DN} items); server applies the rename`,le==null||le===""?"Response body is empty":"Response body received"];console.group("[BulkRename] report"),console.log("1. Parameters",oe),console.log("2. Input (segments)",ae),console.log("2. Input (rows)",ue.map(({id:Rt,from:Lt})=>({id:Rt,name:Lt}))),console.log("3. Output (new names)"),console.table(ue),console.log("4. API status",{ok:!$,httpStatus:Ce??null,statusText:xe.statusText??((Me=M==null?void 0:M.response)==null?void 0:Me.statusText)??null}),console.log("5. Response body",$?((Ct=M==null?void 0:M.response)==null?void 0:Ct.data)??M:le),console.log("6. Conclusion",Ye.join(`
159
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){a=!0,r=l},f:function(){try{i||n.return==null||n.return()}finally{if(a)throw r}}}}function ad(e,t,n){return(t=OM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,o)}return n}function ld(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AM(Object(n),!0).forEach(function(o){ad(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AM(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Ite(e,t){if(e==null)return{};var n,o,s=xte(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function xte(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}function xc(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function r(f,p,g,v){var C=p&&p.prototype instanceof a?p:a,S=Object.create(C.prototype);return Us(S,"_invoke",function(b,y,_){var E,D,T,P=0,L=_||[],I=!1,x={p:0,n:0,v:e,a:O,f:O.bind(e,4),d:function(N,F){return E=N,D=0,T=e,x.n=F,i}};function O(N,F){for(D=N,T=F,t=0;!I&&P&&!z&&t<L.length;t++){var z,j=L[t],Q=x.p,re=j[2];N>3?(z=re===F)&&(T=j[(D=j[4])?5:(D=3,3)],j[4]=j[5]=e):j[0]<=Q&&((z=N<2&&Q<j[1])?(D=0,x.v=F,x.n=j[1]):Q<re&&(z=N<3||j[0]>F||F>re)&&(j[4]=N,j[5]=F,x.n=re,D=0))}if(z||N>1)return i;throw I=!0,F}return function(N,F,z){if(P>1)throw TypeError("Generator is already running");for(I&&F===1&&O(F,z),D=F,T=z;(t=D<2?e:T)||!I;){E||(D?D<3?(D>1&&(x.n=-1),O(D,T)):x.n=T:x.v=T);try{if(P=2,E){if(D||(N="next"),t=E[N]){if(!(t=t.call(E,T)))throw TypeError("iterator result is not an object");if(!t.done)return t;T=t.value,D<2&&(D=0)}else D===1&&(t=E.return)&&t.call(E),D<2&&(T=TypeError("The iterator does not provide a '"+N+"' method"),D=1);E=e}else if((t=(I=x.n<0)?T:b.call(y,x))!==i)break}catch(j){E=e,D=1,T=j}finally{P=1}}return{value:t,done:I}}}(f,g,v),!0),S}var i={};function a(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][o]?t(t([][o]())):(Us(t={},o,function(){return this}),t),d=c.prototype=a.prototype=Object.create(u);function h(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,c):(f.__proto__=c,Us(f,s,"GeneratorFunction")),f.prototype=Object.create(d),f}return l.prototype=c,Us(d,"constructor",c),Us(c,"constructor",l),l.displayName="GeneratorFunction",Us(c,s,"GeneratorFunction"),Us(d),Us(d,s,"Generator"),Us(d,o,function(){return this}),Us(d,"toString",function(){return"[object Generator]"}),(xc=function(){return{w:r,m:h}})()}function Us(e,t,n,o){var s=Object.defineProperty;try{s({},"",{})}catch{s=0}Us=function(r,i,a,l){function c(u,d){Us(r,u,function(h){return this._invoke(u,d,h)})}i?s?s(r,i,{value:a,enumerable:!l,configurable:!l,writable:!l}):r[i]=a:(c("next",0),c("throw",1),c("return",2))},Us(e,t,n,o)}function Pte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function OM(e){var t=Pte(e,"string");return typeof t=="symbol"?t:t+""}function Hv(e){"@babel/helpers - typeof";return Hv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hv(e)}function kte(e,t){if(e){if(typeof e=="string")return kM(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kM(e,t):void 0}}var V0=function(e){return e.TOOLBOX_EXPORT_DATA="TOOLBOX_EXPORT_DATA",e.SW_APP_LOADER="SW_APP_LOADER",e}({});function MM(e){return Hv(e)==="object"&&e!==null&&!Array.isArray(e)}function NM(e,t){var n=Object.keys(e);return n.length===t.length&&t.every(function(o){return n.includes(o)})}function Fte(e){return typeof Blob<"u"&&e instanceof Blob}var Ate=function(t){return MM(t)&&NM(t,["file","fileName"])&&Fte(t.file)&&typeof t.fileName=="string"},Ote=function(t){return MM(t)&&NM(t,["scene_id","people_id","openGS","queryParams"])&&(typeof t.scene_id=="string"||t.scene_id===null)&&(typeof t.people_id=="string"||t.people_id===null)&&(typeof t.openGS=="boolean"||t.openGS===null)&&typeof t.queryParams=="string"},Mte=Object.freeze(ad(ad({},V0.TOOLBOX_EXPORT_DATA,Ate),V0.SW_APP_LOADER,Ote));function Nte(e){return Hv(e)==="object"&&e!==null&&!Array.isArray(e)}function Lte(e,t){var n=Object.keys(e);return n.length===t.length&&t.every(function(o){return n.includes(o)})}function Vte(e){if(!Nte(e))return{valid:!1,reason:"Message must be an object."};if(e.version!==1)return{valid:!1,reason:"Unsupported or missing message version."};if(typeof e.type!="string"||!Object.values(V0).includes(e.type))return{valid:!1,reason:"Unknown or missing message type."};if(e.id!==void 0&&typeof e.id!="string")return{valid:!1,reason:"Message id must be a string when provided."};var t=e.id===void 0?["version","type","payload"]:["version","type","payload","id"];if(!Lte(e,t))return{valid:!1,reason:"Message contains missing or unexpected fields."};var n=e.type;return Mte[n](e.payload)?{valid:!0,message:e}:{valid:!1,reason:"Payload does not match the ".concat(n," schema.")}}function Bte(e){var t=e.target,n=e.allowedOrigins,o=e.onMessage,s=e.onInvalidMessage,r=t??(typeof window>"u"?void 0:window);if(!r)throw new TypeError("A target window is required outside a browser environment.");if(!Array.isArray(n)||n.length===0)throw new TypeError("At least one allowed message origin must be configured.");if(n.some(function(a){return typeof a!="string"||a.length===0||a==="*"}))throw new TypeError("Allowed message origins must be explicit origin strings; wildcards are not allowed.");if(typeof o!="function")throw new TypeError("An onMessage callback is required.");var i=function(l){if(!n.includes(l.origin)){s==null||s(l.data,"Untrusted message origin: ".concat(l.origin),l);return}var c=Vte(l.data);if(c.valid===!1){s==null||s(l.data,c.reason,l);return}o(c.message,l)};return r.addEventListener("message",i),function(){return r.removeEventListener("message",i)}}let $te=class extends Error{},hl=class extends $te{constructor(){super("Zone is an abstract class")}},LM=class{get type(){throw new hl}get name(){throw new hl}get ianaName(){return this.name}get isUniversal(){throw new hl}offsetName(t,n){throw new hl}formatOffset(t,n){throw new hl}offset(t){throw new hl}equals(t){throw new hl}get isValid(){throw new hl}};const B0=new Map;function Hte(e){let t=B0.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),B0.set(e,t)),t}const Gte={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ute(e,t){const n=e.format(t).replace(/\u200E/g,""),o=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,s,r,i,a,l,c,u]=o;return[i,s,r,a,l,c,u]}function Wte(e,t){const n=e.formatToParts(t),o=[];for(let s=0;s<n.length;s++){const{type:r,value:i}=n[s],a=Gte[r];r==="era"?o[a]=i:Gv(a)||(o[a]=parseInt(i,10))}return o}const $0=new Map;let zte=class xT extends LM{static create(t){let n=$0.get(t);return n===void 0&&$0.set(t,n=new xT(t)),n}static resetCache(){$0.clear(),B0.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=xT.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:n,locale:o}){return Yte(t,n,o,this.name)}formatOffset(t,n){return Wv(this.offset(t),n)}offset(t){if(!this.valid)return NaN;const n=new Date(t);if(isNaN(n))return NaN;const o=Hte(this.name);let[s,r,i,a,l,c,u]=o.formatToParts?Wte(o,n):Ute(o,n);a==="BC"&&(s=-Math.abs(s)+1);const h=qte({year:s,month:r,day:i,hour:l===24?0:l,minute:c,second:u,millisecond:0});let f=+n;const p=f%1e3;return f-=p>=0?p:1e3+p,(h-f)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}},H0=null,jte=class yg extends LM{static get utcInstance(){return H0===null&&(H0=new yg(0)),H0}static instance(t){return t===0?yg.utcInstance:new yg(t)}static parseSpecifier(t){if(t){const n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new yg(BM(n[1],n[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Wv(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Wv(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,n){return Wv(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}};function Gv(e){return typeof e>"u"}function Uv(e,t=2){const n=e<0;let o;return n?o="-"+(""+-e).padStart(t,"0"):o=(""+e).padStart(t,"0"),o}function VM(e){if(!(Gv(e)||e===null||e===""))return parseInt(e,10)}function Kte(e){if(!(Gv(e)||e===null||e==="")){const t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function qte(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Yte(e,t,n,o=null){const s=new Date(e),r={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};o&&(r.timeZone=o);const i={timeZoneName:t,...r},a=new Intl.DateTimeFormat(n,i).formatToParts(s).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function BM(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const o=parseInt(t,10)||0,s=n<0||Object.is(n,-0)?-o:o;return n*60+s}function Wv(e,t){const n=Math.trunc(Math.abs(e/60)),o=Math.trunc(Math.abs(e%60)),s=e>=0?"+":"-";switch(t){case"short":return`${s}${Uv(n,2)}:${Uv(o,2)}`;case"narrow":return`${s}${n}${o>0?`:${o}`:""}`;case"techie":return`${s}${Uv(n,2)}${Uv(o,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}const $M=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function cd(...e){const t=e.reduce((n,o)=>n+o.source,"");return RegExp(`^${t}$`)}function ud(...e){return t=>e.reduce(([n,o,s],r)=>{const[i,a,l]=r(t,s);return[{...n,...i},a||o,l]},[{},null,1]).slice(0,2)}function HM(...e){return(t,n)=>{const o={};let s;for(s=0;s<e.length;s++)o[e[s]]=VM(t[n+s]);return[o,null,n+s]}}const GM=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Xte=`(?:${GM.source}?(?:\\[(${$M.source})\\])?)?`,UM=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,WM=RegExp(`${UM.source}${Xte}`),G0=RegExp(`(?:[Tt]${WM.source})?`),Zte=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Jte=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Qte=/(\d{4})-?(\d{3})/,ene=HM("weekYear","weekNumber","weekDay"),tne=HM("year","ordinal"),nne=/(\d{4})-(\d\d)-(\d\d)/,zM=RegExp(`${UM.source} ?(?:${GM.source}|(${$M.source}))?`),one=RegExp(`(?: ${zM.source})?`);function dd(e,t,n){const o=e[t];return Gv(o)?n:VM(o)}function sne(e,t){return[{year:dd(e,t),month:dd(e,t+1,1),day:dd(e,t+2,1)},null,t+3]}function hd(e,t){return[{hours:dd(e,t,0),minutes:dd(e,t+1,0),seconds:dd(e,t+2,0),milliseconds:Kte(e[t+3])},null,t+4]}function Jf(e,t){const n=!e[t]&&!e[t+1],o=BM(e[t+1],e[t+2]),s=n?null:jte.instance(o);return[{},s,t+3]}function Qf(e,t){const n=e[t]?zte.create(e[t]):null;return[{},n,t+1]}cd(Zte,G0),cd(Jte,G0),cd(Qte,G0),cd(WM),ud(sne,hd,Jf,Qf),ud(ene,hd,Jf,Qf),ud(tne,hd,Jf,Qf),ud(hd,Jf,Qf),ud(hd),cd(nne,one),cd(zM),ud(hd,Jf,Qf);var rne=["accessTokenKey","refreshTokenKey","domain","path","secure","sameSite","canSetTokens","cookieParser"];function Dt(){if(typeof sessionStorage<"u"&&sessionStorage.getItem("APP_DEBUG")==="1"){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).log.apply(e,["[DEBUG COMMON_UTILS]"].concat(n))}}function ep(){if(typeof sessionStorage<"u"&&sessionStorage.getItem("APP_DEBUG")==="1"){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).error.apply(e,["[DEBUG COMMON_UTILS]"].concat(n))}}function zv(){if(typeof sessionStorage<"u"&&sessionStorage.getItem("APP_DEBUG")==="1"){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=console).warn.apply(e,["[DEBUG COMMON_UTILS]"].concat(n))}}function ine(){var e=typeof window<"u"?sessionStorage.getItem("BASE_DOMAIN_COOKIE")||window.location.hostname:void 0;return Dt("getStandardizedCookieConfig - domain:",e,"from BASE_DOMAIN_COOKIE:",sessionStorage.getItem("BASE_DOMAIN_COOKIE")),{accessTokenKey:"account.token",refreshTokenKey:"account.refresh_token",domain:e,path:"/",secure:!0,sameSite:"lax"}}function ane(){return{maxRetries:5,retryDelay:500,backoffFactor:1.5}}var jM=1e3,lne=1e4;function KM(e){if(!(typeof window>"u")){var t=window.self!==window.top;try{if(t&&window.top){Dt("Inside iframe - redirecting top window to:",e),window.top.location.replace(e);return}}catch(n){ep("Top window redirect blocked, redirecting current window instead:",n)}try{Dt("Redirecting current window to:",e),window.location.replace(e)}catch(n){ep("Failed to redirect:",n)}}}function jv(e){return typeof e!="string"||!e?e:e.length<=2?"*".repeat(e.length):"".concat(e[0]).concat("*".repeat(e.length-2)).concat(e[e.length-1])}function cne(e){return ld(ld({},e),{},{access_token:jv(e.access_token),token:jv(e.token),refresh_token:jv(e.refresh_token)})}function Kv(e){if(!e)return!1;var t=e.trim();return!!t&&t!=="undefined"&&t!=="null"}function qM(e){return Kv(e.getAccessToken())||Kv(e.getRefreshToken())}function une(e){if(!(typeof document>"u")){var t=typeof window<"u"?window.location.hostname:"",n=e||(typeof sessionStorage<"u"?sessionStorage.getItem("BASE_DOMAIN_COOKIE"):null)||t,o=Array.from(new Set([n,t].filter(Boolean)));Dt("Clearing all cookies - domains:",o);var s=document.cookie.split(";");s.forEach(function(r){var i=r.split("=")[0].trim();i&&(document.cookie="".concat(i,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"),o.forEach(function(a){document.cookie="".concat(i,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=").concat(a)}))})}}function dne(){typeof sessionStorage<"u"&&sessionStorage.clear()}function hne(e){return function(t){var n,o=(n=t.response)===null||n===void 0?void 0:n.status,s=qM(e);if(Dt("getStandardizedTokenExpiredDetection - status:",o,"userLoggedIn:",s),!s)return Dt("User not logged in - returning false"),!1;if(o===400){var r,i,a,l=(r=t.response)===null||r===void 0?void 0:r.data,c=(l==null?void 0:l.error)==="invalid_token"||(l==null||(i=l.error)===null||i===void 0?void 0:i.key)==="invalid_token";return Dt(" 400 error - isInvalidToken:",c,"error:",l==null?void 0:l.error,"error.key:",l==null||(a=l.error)===null||a===void 0?void 0:a.key),!1}if(o===401){var u,d,h=(u=t.response)===null||u===void 0?void 0:u.data,f=h==null||(d=h.error)===null||d===void 0?void 0:d.key,p=h==null?void 0:h.details;return Dt(" 401 error - errorKey:",f,"details:",p),f==="unauthenticated"&&(!p||Object.keys(p).length===0||p.reason==="refresh_token_expired")?(Dt(" 401 unauthenticated - triggering refresh"),!0):(Dt(" 401 error but not unauthenticated - returning false"),!1)}return o===425?(Dt(" 425 error - triggering refresh"),!0):(Dt("Status",o,"not handled - returning false"),!1)}}var fne=function(){function e(){var t,n,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};N0(this,e),this.accessTokenKey=o.accessTokenKey||"access_token",this.refreshTokenKey=o.refreshTokenKey||"refresh_token",this.domain=o.domain,this.path=o.path||"/",this.secure=(t=o.secure)!==null&&t!==void 0?t:!0,this.sameSite=o.sameSite||"lax",this.canSetTokens=(n=o.canSetTokens)!==null&&n!==void 0?n:!0,this.cookieParser=o.cookieParser}return L0(e,[{key:"getCookieValue",value:function(n){if(typeof document>"u")return null;var o=document.cookie.split(";"),s=Dte(o),r;try{for(s.s();!(r=s.n()).done;){var i=r.value;if(i=i.trim(),i.startsWith(n+"=")){var a=i.substring(n.length+1);return this.cookieParser?this.cookieParser(a,n):decodeURIComponent(a)}}}catch(l){s.e(l)}finally{s.f()}return null}},{key:"getAccessToken",value:function(){return this.getCookieValue(this.accessTokenKey)}},{key:"getRefreshToken",value:function(){return this.getCookieValue(this.refreshTokenKey)}},{key:"getExpiresInRefreshToken",value:function(){return this.getCookieValue("account.expires_in_refresh_token")}},{key:"setTokens",value:function(n){if(!this.canSetTokens||typeof document>"u"){zv(" CookieTokenStorage: Token setting is disabled or running in a non-browser environment");return}Dt(" setTokens called - storing tokens with keys:",this.accessTokenKey,this.refreshTokenKey,"domain:",this.domain);var o=this.domain?"; domain=".concat(this.domain):"",s=this.secure?"; secure":"",r="; samesite=".concat(this.sameSite),i="",a="";if(n.expires_in&&typeof n.expires_in=="number"){var l=new Date;l.setTime(l.getTime()+n.expires_in*1e3),i=";expires=".concat(l.toUTCString())}var c=this.getExpiresInRefreshToken();if(Dt("setTokens - refresh token data:",cne(n)),Dt("setTokens - refresh token expires_in value:",c),c){var u=new Date;u.setTime(u.getTime()+Number(c)*1e3),a=";expires=".concat(u.toUTCString())}if(n.access_token||n.token){var d=n.access_token||n.token,h="".concat(this.accessTokenKey,"=").concat(encodeURIComponent(d),"; path=").concat(this.path).concat(o).concat(s).concat(r).concat(i);document.cookie=h}if(n.refresh_token_expires_in&&typeof n.refresh_token_expires_in=="number"){var f=new Date;f.setTime(f.getTime()+n.refresh_token_expires_in*1e3),i=";expires=".concat(f.toUTCString())}if(n.refresh_token){Dt("setTokens - refresh token set to:",jv(n.refresh_token)),Dt("setTokens - refresh token expires_in set to:",a);var p="".concat(this.refreshTokenKey,"=").concat(encodeURIComponent(n.refresh_token),"; path=").concat(this.path).concat(o).concat(s).concat(r).concat(a);document.cookie=p}}},{key:"hasTokens",value:function(){return!!this.getAccessToken()&&!!this.getRefreshToken()}}])}(),pne=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auth_state_channel",n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"auth_state_event";N0(this,e),ad(this,"channel",null),this.channelName=t,this.storageKey=n,this.initChannel()}return L0(e,[{key:"initChannel",value:function(){if(typeof BroadcastChannel<"u")try{this.channel=new BroadcastChannel(this.channelName)}catch(n){console.error("Failed to create BroadcastChannel, falling back to storage events:",n),this.channel=null}}},{key:"broadcastEvent",value:function(n){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={type:n,data:s,timestamp:Date.now()};this.channel?this.channel.postMessage(r):typeof localStorage<"u"&&(localStorage.setItem(this.storageKey,JSON.stringify(r)),setTimeout(function(){return localStorage.removeItem(o.storageKey)},100))}},{key:"onEvent",value:function(n){var o=this;return this.channel?this.channel.onmessage=function(s){n(s.data)}:typeof window<"u"&&window.addEventListener("storage",function(s){if(s.key===o.storageKey&&s.newValue)try{var r=JSON.parse(s.newValue);n(r)}catch(i){console.error("Failed to parse auth event:",i)}}),function(){o.channel?o.channel.onmessage=null:typeof window<"u"&&window.removeEventListener("storage",function(){})}}},{key:"destroy",value:function(){this.channel&&(this.channel.close(),this.channel=null)}}])}(),gne=function(){function e(t){var n=this;if(N0(this,e),ad(this,"currentAttempt",0),ad(this,"isLoggingOut",!1),this.instanceId=Math.random().toString(36).substring(2,15),this.refreshTokenFn=t.refreshTokenFn,this.tokenStorage=t.storage,this.useStandardizedConfig=t.useStandardizedConfig===!0,Dt("RefreshTokenHandler initialized - useStandardizedConfig:",this.useStandardizedConfig),this.useStandardizedConfig){var o=ane();this.maxRetries=o.maxRetries,this.retryDelay=o.retryDelay,this.backoffFactor=o.backoffFactor,Dt(" Using standardized retry config - maxRetries:",this.maxRetries,"retryDelay:",this.retryDelay,"backoffFactor:",this.backoffFactor)}else this.maxRetries=t.maxRetries||3,this.retryDelay=t.retryDelay||1e3,this.backoffFactor=t.backoffFactor||2,Dt(" Using custom retry config - maxRetries:",this.maxRetries,"retryDelay:",this.retryDelay,"backoffFactor:",this.backoffFactor);this.onCrossTabLogout=t.onCrossTabLogout,this.authStateManager=new pne,this.initCrossTabListener(),this.onRefreshSuccess=t.onRefreshSuccess||function(){Dt("Token refresh successful")},this.onRefreshFailure=t.onRefreshFailure||function(s){console.error("Token refresh failed:",s)},this.onTokenInvalid=t.onTokenInvalid||function(){Dt("Token is invalid or cannot be refreshed");var s=new Error("No refresh token available");n.useStandardizedConfig?n.handleLogout("no_refresh_token",s):(n.onRefreshFailure(s),n.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:n.instanceId,reason:"no_refresh_token",error:"No refresh token available"}))}}return L0(e,[{key:"isLogoutInProgress",get:function(){return this.isLoggingOut}},{key:"handleLogout",value:function(n,o){if(this.isLoggingOut){Dt("handleLogout skipped - logout already in progress");return}Dt("handleLogout called with reason:",n),this.onRefreshFailure&&(Dt("Calling onRefreshFailure callback"),this.onRefreshFailure(o));var s=this.getLogoutTag(n,"this-tab");this.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:this.instanceId,reason:n,tag:s,error:(o==null?void 0:o.message)||"Token refresh failed"}),this.clearStateAndRedirectToLogin(s)}},{key:"getLogoutTag",value:function(n,o){return Kv(this.tokenStorage.getRefreshToken())?(console.error("False logout detected. Refresh token not expired. Reason: ".concat(n)),console.error("Sender channel: ".concat(o)),-1):1}},{key:"clearStateAndRedirectToLogin",value:function(n){if(!this.isLoggingOut){this.isLoggingOut=!0;var o=typeof sessionStorage<"u"&&sessionStorage.getItem("BASE_URL")||"",s=typeof sessionStorage<"u"&&sessionStorage.getItem("BASE_DOMAIN_COOKIE")||void 0;if(typeof localStorage<"u"&&typeof window<"u")try{var r="".concat(window.location.pathname).concat(window.location.search);localStorage.setItem("last_url_access_after_timeout",r),localStorage.removeItem("retryCount"),Dt("localStorage updated - saved last URL:",r)}catch(a){ep("Failed to update localStorage:",a)}Dt("Clearing sessionStorage and cookies"),dne(),une(s);var i="".concat(o,"/login?timeout=").concat(n);Dt("Redirecting to login in ".concat(jM,"ms:"),i),setTimeout(function(){return KM(i)},jM)}}},{key:"initCrossTabListener",value:function(){var n=this;this.authStateManager.onEvent(function(o){if(o.type==="auth:logout")if(Dt("Received logout event:",o.data),o.data&&o.data.sourceInstanceId!==n.instanceId){if(Dt("Logout event from different tab, executing logout handlers"),n.onCrossTabLogout?(Dt("Executing onCrossTabLogout with reason: ".concat(o.data.reason||"cross_tab_logout")),n.onCrossTabLogout(o.data.reason||"cross_tab_logout")):typeof n.onLogout=="function"?(Dt("Executing legacy onLogout with reason: ".concat(o.data.reason)),n.onLogout(o.data.reason)):n.useStandardizedConfig||console.warn("No logout handler defined for cross-tab events"),n.useStandardizedConfig){var s=o.data.tag===-1||o.data.tag===1,r=s?o.data.tag:n.getLogoutTag(o.data.reason||"cross_tab_logout","cross-tab");s&&r===-1&&(console.error("False logout detected. Reason: ".concat(o.data.reason||"cross_tab_logout")),console.error("Sender channel: cross-tab")),Dt("Standardized mode - logging out this tab after cross-tab event, tag:",r),n.clearStateAndRedirectToLogin(r)}}else Dt("Ignoring self-generated logout event")})}},{key:"handleTokenRefresh",value:function(){var t=M0(xc().m(function o(){var s=this,r,i,a,l;return xc().w(function(c){for(;;)switch(c.p=c.n){case 0:if(r=this.tokenStorage.getRefreshToken(),Dt(" handleTokenRefresh started, refreshToken available:",!!r),r){c.n=1;break}return Dt(" ERROR: No refresh token available - cannot refresh"),this.onTokenInvalid(),c.a(2,!1);case 1:return this.currentAttempt=0,c.p=2,c.n=3,this.executeWithRetry(function(){return Dt("Refresh attempt ".concat(s.currentAttempt+1,"/").concat(s.maxRetries)),s.refreshTokenFn(s.tokenStorage.getRefreshToken())});case 3:if(i=c.v,!(!i||!i.access_token&&!i.token)){c.n=4;break}throw console.error("Invalid token response received"),new Error("Invalid token response");case 4:return i.token&&!i.access_token&&(i.access_token=i.token),Dt(" Token refresh successful, saving new tokens"),this.tokenStorage.setTokens(i),Dt(" Calling onRefreshSuccess callback"),this.onRefreshSuccess(i),c.a(2,!0);case 5:return c.p=5,l=c.v,console.error("Token refresh failed after all attempts:",l),l===void 0&&(l=new Error("Undefined error during token refresh")),this.useStandardizedConfig?this.handleLogout("max_retry_reached",l):(this.onRefreshFailure(l),this.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:this.instanceId,reason:"max_retry_reached",error:((a=l)===null||a===void 0?void 0:a.message)||"Token refresh failed after maximum retries"})),c.a(2,!1)}},o,this,[[2,5]])}));function n(){return t.apply(this,arguments)}return n}()},{key:"executeWithRetry",value:function(){var t=M0(xc().m(function o(s){var r,i,a,l;return xc().w(function(c){for(;;)switch(c.p=c.n){case 0:return c.p=0,c.n=1,s();case 1:return c.a(2,c.v);case 2:if(c.p=2,l=c.v,this.currentAttempt++,!(this.currentAttempt>=this.maxRetries)){c.n=3;break}throw Dt("Maximum retry attempts (".concat(this.maxRetries,") reached")),l;case 3:return i=(l==null||(r=l.response)===null||r===void 0?void 0:r.status)===425,a=i?this.getRetryAfterDelay(l):this.retryDelay*Math.pow(this.backoffFactor,this.currentAttempt-1),Dt("Retry in ".concat(a,"ms, attempt ").concat(this.currentAttempt,"/").concat(this.maxRetries)),c.n=4,new Promise(function(u){return setTimeout(u,a)});case 4:return c.a(2,this.executeWithRetry(s))}},o,this,[[0,2]])}));function n(o){return t.apply(this,arguments)}return n}()},{key:"getRetryAfterDelay",value:function(n){var o;if(n!=null&&(o=n.response)!==null&&o!==void 0&&o.headers){var s=n.response.headers["retry-after"];if(s){var r=parseInt(s,10);if(!isNaN(r))return r*1e3;var i=new Date(s);if(!isNaN(i.getTime()))return i.getTime()-Date.now()}}return this.retryDelay*Math.pow(this.backoffFactor,this.currentAttempt-1)}},{key:"broadcastLogout",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"manual_logout";Dt("Broadcasting logout event with reason: ".concat(n)),this.authStateManager.broadcastEvent("auth:logout",{sourceInstanceId:this.instanceId,reason:n,timestamp:Date.now()})}}])}();function mne(e,t){var n,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=(n=o.useStandardizedConfig)!==null&&n!==void 0?n:t.useStandardizedConfig;Dt("createRefreshInterceptor called - useStandardizedConfig:",s);var r=s?hne(t.tokenStorage):o.tokenExpiredDetection||function(c){var u;return((u=c.response)===null||u===void 0?void 0:u.status)===401},i=s?[401,425]:o.retryStatusCodes||[401,425],a=o.tokenHeaderFormatter||function(c){return"Bearer ".concat(c)};Dt("Interceptor config - retryStatusCodes:",i,"using standardized detection:",s);var l=null;e.interceptors.response.use(function(c){return c},function(){var c=M0(xc().m(function u(d){var h,f,p,g,v,C,S,b,y,_,E,D,T,P,L,I,x,O,N,F,z;return xc().w(function(j){for(;;)switch(j.p=j.n){case 0:if(g=d.config,v=function(re){var q,V=s&&t.isLogoutInProgress;return zv(V?"HOLD ->":"REJECT ->",((g==null?void 0:g.method)||"").toUpperCase(),g==null?void 0:g.url,"| status:",(q=d.response)===null||q===void 0?void 0:q.status,"| reason:",re,"| logoutInProgress:",t.isLogoutInProgress,"| at:",new Date().toISOString().slice(11,23)),V?new Promise(function(k,G){setTimeout(function(){zv("Logout redirect did not happen in time - releasing held request:",g==null?void 0:g.url),G(d)},lne)}):Promise.reject(d)},g){j.n=1;break}return j.a(2,v("no request config"));case 1:if(!g._retry){j.n=2;break}return j.a(2,v("retried request failed again"));case 2:if(C=(h=d.response)===null||h===void 0?void 0:h.status,Dt(" Response error handler triggered - status:",C,"url:",g.url),S=r(d),Dt(" tokenExpiredDetection returned:",S),b=!1,C===400)if(E=(y=d.response)===null||y===void 0?void 0:y.data,D=(E==null?void 0:E.error)==="invalid_token"||(E==null||(_=E.error)===null||_===void 0?void 0:_.key)==="invalid_token",D)if(b=!1,s){if(Dt(" 400 invalid_token (standardized) - clearing account.token from cookies"),typeof document<"u")try{T=sessionStorage.getItem("BASE_DOMAIN_COOKIE")||window.location.hostname,Dt(" Clearing account.token - domain:",T),document.cookie="account.token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=".concat(T),document.cookie="account.token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/",Dt(" ✅ Removed account.token from cookies (prevents infinite 400 loop)")}catch(Q){ep(" Failed to clear account.token:",Q)}typeof window<"u"&&(P=sessionStorage.getItem("BASE_URL")||"",L="".concat(P,"/sw?redirect=1"),Dt("Redirecting to re-auth page - URL:",L),KM(L))}else Dt(" 400 invalid_token (custom config) - user handles via callbacks");else b=!1,Dt(" 400 non-invalid_token - skip refresh");else s&&C===401&&!qM(t.tokenStorage)?(I=typeof window<"u"&&window.location.pathname.includes("/login"),x=/login|refresh-token|refreshToken/i.test(g.url||""),I||x?Dt("401 with no tokens on login page/auth request - not redirecting"):(Dt("401 with no tokens - logging out and redirecting to /login"),t.handleLogout("no_tokens",new Error("No authentication tokens available"))),b=!1):(b=S&&i.includes(C),Dt(" Status",C,"- shouldRefresh:",S,"in retryStatusCodes:",i.includes(C),"canRetry:",b));if(b){j.n=3;break}return j.a(2,v("not eligible for refresh"));case 3:if(O=((f=g.url)===null||f===void 0?void 0:f.includes("refresh-token"))||((p=g.url)===null||p===void 0?void 0:p.includes("refreshToken")),!O){j.n=4;break}return j.a(2,v("refresh endpoint itself failed"));case 4:return g._retry=!0,j.p=5,l?Dt(" Using existing refresh promise"):(Dt(" Starting new token refresh"),l=t.handleTokenRefresh()),j.n=6,l;case 6:if(N=j.v,l=null,N){j.n=7;break}return j.a(2,v("token refresh failed (waiting request)"));case 7:return F=t.tokenStorage.getAccessToken(),Dt(" Token refreshed successfully, new token available:",!!F),F?(Dt(" Injecting refreshed token into Authorization header for retry"),g.headers.Authorization=a(F)):zv(" WARNING: Token refresh succeeded but no token in storage!"),Dt(" Retrying original request with new token"),j.a(2,e(g));case 8:return j.p=8,z=j.v,ep(" Error during refresh:",z),l=null,j.a(2,v("error thrown during refresh"))}},u,null,[[5,8]])}));return function(u){return c.apply(this,arguments)}}()),e.interceptors.request.use(function(c){var u=c.headers.Authorization;if(u){var d=String(u).replace(/^Bearer\s*/i,"").trim();if(d&&d!=="undefined"&&d!=="null")return c;Dt("Removing invalid Authorization header:",u),delete c.headers.Authorization}var h=t.tokenStorage.getAccessToken(),f=t.tokenStorage.getRefreshToken();return Dt(" Request interceptor: token exists:",!!h,"refreshToken exists:",!!f,"url:",c.url),h&&Kv(h)?(Dt(" Access token available - injecting into Authorization header"),c.headers.Authorization=a(h)):Dt(f?" Access token missing/empty but refresh token available - response interceptor will handle 401":" Both tokens missing/empty - allowing request (no token to inject)"),c},function(c){return Promise.reject(c)})}function vne(e){var t=e.useStandardizedConfig===!0;Dt("createCookieRefreshHandler called - useStandardizedConfig:",t);var n;if(t){var o=ine();n=ld(ld({},o),{},{canSetTokens:e.canSetTokens,cookieParser:e.cookieParser}),Dt(" Applied standardized cookie config:",n)}else{var s=e.accessTokenKey,r=e.refreshTokenKey,i=e.domain,a=e.path,l=e.secure,c=e.sameSite,u=e.canSetTokens,d=e.cookieParser;n={accessTokenKey:s,refreshTokenKey:r,domain:i,path:a,secure:l,sameSite:c,canSetTokens:u,cookieParser:d},Dt(" Applied custom cookie config:",n)}var h=new fne(n);e.accessTokenKey,e.refreshTokenKey,e.domain,e.path,e.secure,e.sameSite,e.canSetTokens,e.cookieParser;var f=Ite(e,rne);return new gne(ld(ld({},f),{},{storage:h,useStandardizedConfig:t}))}var Oo=function(e){return e.review="{reviewDomain}/{ws_code}",e.review_take="{reviewDomain}/{ws_code}?id={take_id}",e.review_scene="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&tab=iteration",e.review_rendition="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}",e.review_frame="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}&tab=comment&refresh_marker=true#type=frame&data={frame}",e.review_rendition_comment="{reviewDomain}/{ws_code}?scene_id={scene_id}&rendition_id={rendition_id}&comment_id={comment_id}&tab=comment",e.review_comment="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&comment_id={comment_id}",e.scene_hub="{baseDomain}/{ws_code}/{scene_id}?o=st",e.hub_rendition="{baseDomain}/{ws_code}/{scene_id}?o=st&renditionId={rendition_id}",e.hub_comment="{baseDomain}/{ws_code}/{scene_id}?o=st&comment_id={comment_id}",e.people_insight="{baseDomain}/{ws_code}/{user_id}?o=pt",e.people_detail="{baseDomain}/{ws_code}/ws/ppl/{display_name}-{user_id}",e.project="{baseDomain}/{ws_code}/pl/dir/{entity_id}",e.project_focusMode="{baseDomain}/{ws_code}/pl/dir/{parent_id}?f={entity_id}",e.woohoo="{baseDomain}/{ws_code}/pl/woo/rpt/{woohoo_id}",e.update="{baseDomain}/{ws_code}/pl/au?id={entity_id}",e.core="{baseDomain}/{ws_code}",e}(Oo||{});Oo.review,Oo.review_take,Oo.review_scene,Oo.review_rendition,Oo.review_frame,Oo.review_rendition_comment,Oo.review_comment,Oo.scene_hub,Oo.hub_rendition,Oo.hub_comment,Oo.people_insight,Oo.people_detail,Oo.project,Oo.woohoo,Oo.update,Oo.core,Oo.project_focusMode;const YM={accessToken:"account.token",refreshToken:"account.refresh_token"},yne={baseUrl:"BASE_URL"},XM="/refresh-token",wne=3e5,Cne="*",ZM={Accept:"application/json","Content-Type":"application/json"},bne="undefined",Sne="No access token found",Pc={badRequest:400,unauthorized:401,tooEarly:425},Ene=[Pc.unauthorized,Pc.tooEarly,Pc.badRequest],_ne="unauthenticated",Rne="invalid_token",Tne="refresh_token_expired",Dne={type:"TOKEN_EXPIRED",message:"Authentication token has expired"},Ine="Session refreshed successfully",xne="Session expired. Please log in again.",Pne=e=>{const{error:t}=e??{};return typeof t=="string"?t:t==null?void 0:t.key},kne=e=>{var t,n;return((t=e==null?void 0:e.response)==null?void 0:t.status)!==Pc.badRequest?!1:Pne((n=e.response)==null?void 0:n.data)===Rne},Fne=()=>{},Ane=e=>sessionStorage.getItem(e)||"",U0=()=>{const e=lv.get(YM.accessToken);return e&&e!==bne?e:null},One=()=>!!lv.get(YM.refreshToken),Mne=()=>{const e=window.location.origin,t=Ane(yne.baseUrl);if(!t)return e;try{return new URL(t,e).origin}catch{return e}};class W0{constructor(t,n=Fne,o){this.client=t,this.showMessage=n,this.onAuthExpired=o}attach(){const t=vne({refreshTokenFn:n=>this.refresh(n),onRefreshSuccess:n=>{this.showMessage(Ine,"success"),this.client.defaults.headers.common.Authorization=`Bearer ${n.access_token}`},onRefreshFailure:()=>{this.showMessage(xne,"error")},useStandardizedConfig:!0});this.handler=t,mne(this.client,t,{retryStatusCodes:[...Ene],tokenExpiredDetection:W0.isTokenExpired})}refreshAccessToken(){return!this.handler||!One()?Promise.resolve(!1):(this.pendingRefresh??(this.pendingRefresh=this.handler.handleTokenRefresh().catch(()=>!1).finally(()=>{this.pendingRefresh=void 0})),this.pendingRefresh)}static isTokenExpired(t){var i,a;const n=(i=t==null?void 0:t.response)==null?void 0:i.status;if(n===Pc.tooEarly)return!0;const{error:o,details:s={}}=((a=t==null?void 0:t.response)==null?void 0:a.data)??{},r=typeof o=="string"?o:o==null?void 0:o.key;return n===Pc.badRequest||n!==Pc.unauthorized||typeof o=="string"||r!==_ne?!1:Object.keys(s).length===0||s.reason===Tne}async refresh(t){const n=await this.client.post(XM,{refresh_token:t}),o="data"in n&&n.data?n.data:n;return console.log("Refreshing tokens:",{tokens:o,res:n}),{access_token:o.access_token,refresh_token:o.refresh_token,expires_in:o.expires_in}}handleAuthExpired(){var t;if(window.self===window.top){(t=this.onAuthExpired)==null||t.call(this);return}window.parent.postMessage(Dne,Mne())}}class Nne{constructor(t={}){this.options={unwrapResponse:!0,withRefreshToken:!0,requireToken:!0,...t},this.client=to.create({baseURL:typeof t.baseURL=="string"?t.baseURL:"",timeout:t.timeout??wne,headers:{...ZM,...t.headers}}),this.setupRequestInterceptor(),this.setupResponseInterceptor(),this.setupErrorHandling()}get(t,n){return this.request({...n,method:"GET",url:t})}post(t,n,o){return this.request({...o,method:"POST",url:t,data:n})}put(t,n,o){return this.request({...o,method:"PUT",url:t,data:n})}patch(t,n,o){return this.request({...o,method:"PATCH",url:t,data:n})}delete(t,n){return this.request({...n,method:"DELETE",url:t})}request(t){return this.client.request(t)}setupRequestInterceptor(){this.client.interceptors.request.use(async t=>{const{baseURL:n,dynamicHeaders:o,requireToken:s}=this.options;typeof n=="function"&&(t.baseURL=n());const r=t.url===XM,i=r?U0():await this.resolveAccessToken();if(!i&&s&&!r)throw new Error(Sne);t.headers.set("Accept-Language",Cne),t.headers.has("Content-Type")||t.headers.set("Content-Type",ZM["Content-Type"]),t.headers.has("Content-Type")&&t.headers.get("Content-Type")==="multipart/form-data"&&t.headers.delete("Content-Type"),i&&t.headers.set("Authorization",`Bearer ${i}`);for(const[a,l]of Object.entries((o==null?void 0:o(t))??{}))t.headers.set(a,l);return t})}async resolveAccessToken(){const t=U0();return t||!this.tokenRefresher?t:(await this.tokenRefresher.refreshAccessToken(),U0())}setupResponseInterceptor(){this.client.interceptors.response.use(t=>this.options.unwrapResponse?t.data:t)}setupErrorHandling(){const{withRefreshToken:t,showMessage:n,onAuthExpired:o,onError:s}=this.options;t&&(this.tokenRefresher=new W0(this.client,n,o),this.tokenRefresher.attach()),this.client.interceptors.response.use(void 0,r=>(kne(r)&&(o==null||o("/sw?redirect=1")),Promise.reject(r))),s&&this.client.interceptors.response.use(void 0,s)}}const Lne=5,Vne=1e3,Bne=3,$ne="default",Hne=e=>new URL(e,"http://localhost").pathname;class Gne{constructor(t={}){this.groups=new Map,this.defaultLimit=t.defaultLimit??Lne,this.rules=t.rules??[],this.releaseDelayMs=t.releaseDelayMs??Vne}async run(t,n){const o=this.resolveGroup(t);await this.acquire(o);try{return await n()}finally{this.release(o)}}resolveGroup(t){const n=Hne(t),o=this.rules.find(i=>i.pattern.test(n)),s=o?o.pattern.source:$ne;let r=this.groups.get(s);return r||(r={limit:(o==null?void 0:o.limit)??this.defaultLimit,ongoing:0,queue:[]},this.groups.set(s,r)),r}acquire(t){return new Promise(n=>{const o=()=>{t.ongoing++,n()};t.ongoing<t.limit?o():t.queue.push(o)})}release(t){t.ongoing--;const n=t.queue.shift();n&&setTimeout(n,this.releaseDelayMs)}}const Une=(e,t)=>{const n=new Gne(t),o=to.getAdapter(e.defaults.adapter);return e.defaults.adapter=s=>n.run(s.url??"",()=>o(s)),n},Wne=(e,{maxRetries:t=Bne}={})=>{e.interceptors.response.use(void 0,async n=>{var a,l;const o=n.config;if(((a=n.response)==null?void 0:a.status)!==429||!o)return Promise.reject(n);const s=(o._retryCount??0)+1;if(s>t)return Promise.reject(n);o._retryCount=s;const r=Number.parseInt(String(((l=n.response.headers)==null?void 0:l["retry-after"])??""),10),i=Number.isNaN(r)?2**s*1e3:r*1e3;return await new Promise(c=>setTimeout(c,i)),e.request(o)})},zne=6e4,jne="/start",Kne=(e=jne)=>{const n=`${sessionStorage.getItem("BASE_URL")||""}${e}`;console.log("Redirecting to auth URL:",n),window.location.replace(n)};function qne(e,t){const n=sessionStorage.getItem(e)||"";return(n==null?void 0:n.length)>0?n:t}class Yne{constructor(t,n={}){const{concurrency:o,rateLimitRetry:s,...r}=n,i=()=>qne("API_BASE_URL","");this.callbackFunc=t,this.api=new Nne({baseURL:i,timeout:zne,requireToken:!0,onAuthExpired:Kne,...r,unwrapResponse:!1,showMessage:t}),this.axios=this.api.client,o!==!1&&Une(this.axios,o),s!==!1&&Wne(this.axios,s)}buildUrl(t=""){const n=t.replace(/^\//,"");return!n.startsWith("http://")&&!n.startsWith("https://")?`/${n}`:n}buildQueryParams(t){const n=new URLSearchParams;Object.entries(t).forEach(([s,r])=>{r!=null&&r!==""&&(Array.isArray(r)?r.forEach(i=>n.append(s,String(i))):typeof r=="object"?n.append(s,JSON.stringify(r)):n.append(s,String(r)))});const o=n.toString();return o?`?${o}`:""}async send(t,n,{params:o,data:s,options:r}={}){try{const i=o?this.buildQueryParams(o):"",a={...r,method:t,url:`${this.buildUrl(n)}${i}`};return s!==void 0&&(a.data=s),(await this.axios.request(a)).data}catch(i){throw Rte(i)}}get(t="",n,o){return this.send("GET",t,{params:n,options:o})}post(t="",n,o,s){return this.send("POST",t,{params:n,data:o,options:s})}put(t="",n,o){return this.send("PUT",t,{data:n,options:o})}patch(t="",n,o){return this.send("PATCH",t,{data:n,options:o})}delete(t="",n,o){return this.send("DELETE",t,{data:n,options:o})}}const Xne=({domainApi:e,wsCode:t,entityId:n})=>({list_cursor:{url:`${e}/v1/workspace/${t}/item/2`,method:"post",code:"list_cursor"},assignedUser:{url:`${e}/v1/workspace/${t}/item/2/assigned-users`,method:"post",code:"assignedUser"},metricValues:{url:`${e}/v1/workspace/${t}/item/2/metrics`,method:"post",code:"metricValues"},multipleAssignableUser:{url:`${e}/v1/workspace/${t}/item/2/assignable-users`,method:"post",code:"multipleAssignableUser"},assignableUser:{url:`${e}/v1/workspace/${t}/item/2/assignable-users`,method:"post",code:"assignableUser"},assignableStatus:{url:`${e}/v1/workspace/${t}/item/2/assignable-statuses`,method:"post",code:"assignableStatus"},delete_rendition:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-rendition`,method:"delete",code:"delete_rendition"},delete_thumbnail:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-thumbnail`,method:"delete",code:"delete_thumbnail"},archive_item:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"archive_item"},unarchive_item:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"unarchive_item"},removeAssignee:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-assignee`,method:"delete",code:"removeAssignee"},basicInfor:{url:`${e}/v1/workspace/${t}/tile/people/ws-user-roles/{userId}/basic-info`,method:"get",code:"basicInfor"},bulkDelete:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete`,method:"delete",code:"bulkDelete"},bulkArchive:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"bulkArchive"},bulkDateUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-date-update`,method:"put",code:"bulkDateUpdate"},bulkAssignUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-assignee-update`,method:"put",code:"bulkAssignUpdate"},bulkStatusUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-status-update`,method:"put",code:"bulkStatusUpdate"},bulkMetricUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-metric-update`,method:"put",code:"bulkMetricUpdate"},getPermission:{url:`${e}/v1/workspace/${t}/item/2/permissions`,method:"post",code:"getPermission"},getUserPermission:{url:`${e}/v1/workspace/${t}/permissions`,method:"get",code:"getUserPermission"},bulkUnarchive:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"bulkUnarchive"},downloadTemplate:{url:`${e}/v1/workspace/${t}/item/2/download-sample`,method:"get",code:"downloadTemplate"},importItems:{url:`${e}/v1/workspace/${t}/item/2/import-from-file`,method:"post",code:"importItems"},exportItems:{url:`${e}/v1/workspace/${t}/item/2/export`,method:"get",code:"exportItems"},updateFromFile:{url:`${e}/v1/workspace/${t}/item/2/update-from-file`,method:"post",code:"updateFromFile"},metricList:{url:`${e}/v1/workspace/${t}/entity/2/metrics`,method:"get",code:"metricList"},getEntityDetail:{url:`${e}/workspace/${t}/entities/${n}?include_permission=1`,method:"get",code:"getEntityDetail"},item:{url:`${e}/v1/workspace/${t}/item/2/update`,method:"put",code:"item"},me:{url:`${e}/v1/me`,method:"get",code:"me"},workspaces:{url:`${e}/v1/workspaces`,method:"get",code:"workspaces"},entityUserRoles:{url:`${e}/v1/workspace/${t}/entity/2/users`,method:"get",code:"entityUserRoles"},templateFlowStatuses:{url:`${e}/workspace/${t}/entities/${n}/template_flow_statuses`,method:"get",code:"templateFlowStatuses"},createNewItem:{url:`${e}/v1/workspace/${t}/item/2/new?entity_id=${n}`,method:"post",code:"createNewItem"},getAssignableStatuses:{url:`${e}/v1/workspace/${t}/entity/2/assignable-statuses`,method:"get",code:"getAssignableStatuses"},getAssignableAssignees:{url:`${e}/v1/workspace/${t}/entity/2/users`,method:"get",code:"getAssignableAssignees"},getFilterStatuses:{url:`${e}/v1/workspace/${t}/entity/2/statuses`,method:"get",code:"getFilterStatuses"},bulkRename:{url:`${e}/v1/workspace/${t}/item/2/bulk-rename`,method:"put",code:"bulkRename"}}),Zne=(e,t)=>{const n=new Blob([e]),o=globalThis.URL.createObjectURL(n),s=document.createElement("a");s.href=o,s.download=t,document.body.appendChild(s),s.click(),s.remove(),globalThis.URL.revokeObjectURL(o)};class JM extends Yne{constructor(t,n,o){const s=n==null?void 0:n.domainApi,r=n==null?void 0:n.wsCode,i=(n==null?void 0:n.entityId)||"";super(o,{concurrency:{rules:[{pattern:/^\/api\/v1\/workspace\/[^/]+\/item\/2$/,limit:1},{pattern:/^\/api\/v1\/workspace\/[^/]+\/item\/2\/metrics$/,limit:5}]}}),this.events=Object.create(null);const a=Xne({domainApi:s,wsCode:r,entityId:i}),l={};Object.entries(a).forEach(([c,u])=>{const d=c;t[d]?l[d]=t[d]:(console.warn(`API config for ${d} is missing, using base config.`),l[d]=u)}),this.apiConfig=l}on(t,n){var o;((o=this.events)[t]??(o[t]=[])).push(n)}off(t,n){const o=this.events[t];o&&(this.events[t]=o.filter(s=>s!==n))}emit(t,...n){const o=this.events[t];o!=null&&o.length&&o.forEach(s=>{try{s(...n)}catch(r){console.error(`Error in event listener for ${t}:`,r)}})}buildHeaders(t){return typeof FormData<"u"&&t instanceof FormData?{"Content-Type":"multipart/form-data"}:{}}async _requestHandler({method:t,path:n,params:o,payload:s,code:r,responseType:i,autoDownload:a=!0}){var u,d;const l=this.buildHeaders(s);let c;try{if(c=await this.axios.request({method:t,url:n,params:o,data:s,headers:l,responseType:i}),(((u=c.headers)==null?void 0:u["content-type"])||"").includes("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")){const f=((d=c.headers)==null?void 0:d["content-disposition"])||"",p=f.includes("filename=")?f.split("filename=")[1]:"exported_items.xlsx";a&&Zne(c.data,p)}if(c.status>=400&&c.status<=500)throw new Error(`Client error (${c.status}): ${c.statusText}`);return this.emit("call-api",{apiCode:r,path:n,params:o,payload:s,res:c,success:!0}),c.data}catch(h){throw console.error("API Request Error:",h),h.code==="ERR_NETWORK"||!navigator.onLine?this.emit("call-api",{path:n,params:o,payload:s,error:new Error("You are currently offline. Please check your network connection."),success:!1,apiCode:"offline"}):this.emit("call-api",{path:n,params:o,payload:s,error:h,success:!1,apiCode:r,res:h==null?void 0:h.response}),h}}generateUrl(t,n){let o=t;return Object.entries(n).forEach(([s,r])=>{o=o.replace(`{${s}}`,String(r))}),o}async request(t,n,o={}){const{url:s,code:r,method:i}=this.apiConfig[t],a=this.generateUrl(s,n);return this._requestHandler({method:i,path:a,params:o.params,payload:o.payload,code:r,responseType:o.responseType,autoDownload:o.autoDownload})}async getAllItem_cursor(t){var r;const n=t.workspaceId,o={entity_ids:((r=t.entityIds)==null?void 0:r.join(","))||"",cursor:t.cursor||void 0,per_page:t.pageSize||t.perPage||20,offset:t.offset||void 0,search:t.search||t.q||void 0,include_signature:1,include:"last_updated_by,property,last_completed_by",include_permission:"{include_permission}",assignee_any_ina:(t==null?void 0:t.assignee_any_ina)||"",assignee_all_ina:(t==null?void 0:t.assignee_all_ina)||void 0,with_not_assigned:t.with_not_assigned||void 0,status_ina:t.status_ina||void 0,status_eq:t.status_eq||void 0,start_date_gte:t.start_date_gte||void 0,start_date_lte:t.start_date_lte||void 0,start_date_btw:t.start_date_btw||void 0,due_date_gte:t.due_date_gte||void 0,due_date_lte:t.due_date_lte||void 0,due_date_btw:t.due_date_btw||void 0,condition_combine_type:t.condition_combine_type||"or",preflight_status:t.preflight_status||void 0},s=t.sortBy;return this.request("list_cursor",{workspaceId:n},{params:o,payload:{sort_by:s}})}async getAssignedUser(t){const n={item_ids:t.item_ids||[],metric_ids:t.metric_ids||[]},o={per_page:t.per_page};return this.request("assignedUser",{workspaceId:t.workspaceId},{params:o,payload:n})}async getMetricList({workspaceId:t,entityId:n,page:o,query:s,per_page:r}){return this.request("metricList",{workspaceId:t,entityId:n},{params:{status_ed:1,include:"metric_type",entity_id:n,include_permission:1,per_page:r||100,page:o||1,name_like:s||void 0,permission:"1,2"}})}async getMetricValues({workspaceId:t,item_ids:n,per_page:o,metric_ids:s}){const r={item_ids:n,metric_ids:s};return this.request("metricValues",{workspaceId:t},{params:{per_page:o,include_permission:1},payload:r})}async multipleAssignableUser(t){const n=t.workspaceId,o=t.itemIds,s={page:t.page||1,per_page:t.perPage,display_name_like:t.q||"",item_ids:o||[]};return o.length||(delete s.item_ids,s.entity_id=t.entityId),this.request("multipleAssignableUser",{workspaceId:n},{payload:s})}async getAssignableStatus(t){var s;const n=t.workspaceId,o={item_ids:t.itemIds||[],page:t.page||1,per_page:t.perPage||10,name_like:t.name_like||""};return((s=t.itemIds)==null?void 0:s.length)==0&&(o.entity_id=t.entityId,delete o.item_ids),this.request("assignableStatus",{workspaceId:n||""},{payload:o})}async updateSceneName({workspaceId:t,entityId:n,itemId:o,name:s}){const r={item_id:o,entity_id:n,name:s,include:"item_user_roles"};return this.request("item",{workspaceId:t,itemId:o},{payload:r})}async deleteScene(t,n,o){const s={item_ids:[o]};return this.request("bulkDelete",{workspaceId:t,entityId:n},{payload:s})}async deleteThumbnail({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("delete_thumbnail",{workspaceId:t},{payload:r,params:s})}async deleteRendition({workspaceId:t,itemIds:n,deleteAll:o=!1,entityId:s,filterParams:r}){const i={item_ids:n,delete_all:o?1:void 0,entity_id:s};return!n||n.length===0?i.item_ids=void 0:i.entity_id=void 0,this.request("delete_rendition",{workspaceId:t},{payload:i,params:r})}async archiveScene(t,n,o){const s={item_ids:o,status:0};return this.request("archive_item",{workspaceId:t,entityId:n},{payload:s})}async changeDate({workspaceId:t,itemIds:n,startDate:o,dueDate:s,entityId:r,filterParams:i}){const a={item_ids:n,start_date:o,due_date:s,entity_id:r};return this.request("bulkDateUpdate",{workspaceId:t},{payload:a,params:i})}async updateAssignee(t){const{workspaceId:n,itemIds:o,userIds:s,entityId:r}=t,i={item_ids:o,ws_user_role_ids:s,entity_id:r};return this.request("bulkAssignUpdate",{workspaceId:n},{payload:i,params:t.filterParams})}createUpdateEntityPayload(t){const{itemIds:n,userIds:o,entityId:s}=t,r={item_ids:n,ws_user_role_ids:o,entity_id:s};return!n||n.length===0?(r.item_ids=void 0,r.entity_id=s):(r.item_ids=n,r.entity_id=void 0),r}async removeAssignee(t){const n=this.createUpdateEntityPayload(t);return this.request("removeAssignee",{workspaceId:t.workspaceId},{payload:n,params:t.filterParams})}async replaceAssignee(t){const{workspaceId:n,itemIds:o,userIds:s,entityId:r}=t,i={item_ids:o,ws_user_role_ids:s,entity_id:r};return this.request("bulkAssignUpdate",{workspaceId:n},{params:{replace:1,...t.filterParams},payload:i})}async addAssignee({workspaceId:t,itemIds:n,userIds:o,entityId:s,filterParams:r}){const i={item_ids:n,ws_user_role_ids:o,entity_id:s};return this.request("bulkAssignUpdate",{workspaceId:t},{payload:i,params:r})}async unAssignAll(t){const{workspaceId:n,entityId:o,itemIds:s,filterParams:r}=t,i={item_ids:s,entity_id:o,ws_user_role_ids:[]};return!s||s.length===0?i.item_ids=void 0:i.entity_id=void 0,this.request("removeAssignee",{workspaceId:n,entityId:String(o)},{payload:i,params:r})}async updateItemStatus(t){const{workspaceId:n,itemIds:o=[],statusId:s,entityId:r}=t,i={item_ids:o,template_flow_status_id:s};return o.length||(i.item_ids=void 0,i.entity_id=r),this.request("bulkStatusUpdate",{workspaceId:n},{payload:i,params:t.filterParams})}async getUserInformation(t,n){return this.request("basicInfor",{workspaceId:t,userId:n})}async bulkDeleteItems({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("bulkDelete",{workspaceId:t},{payload:r,params:s})}async bulkUnarchiveItems({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,status:1,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("bulkUnarchive",{workspaceId:t},{payload:r,params:s})}async bulkArchiveItems({workspaceId:t,itemIds:n,entityId:o,filterParams:s}){const r={item_ids:n,status:0,entity_id:o};return!n||n.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("bulkArchive",{workspaceId:t},{payload:r,params:s})}async bulkUpdateMetric(t){const{workspaceId:n,itemIds:o,metricId:s,value:r,clear:i}=t,a={item_ids:o,metric_id:s,metric_value:r,clear:i??(r==null?1:0),entity_id:t.entityId};return t.itemIds===void 0?(delete a.item_ids,a.entity_id=String(t.entityId)):(a.item_ids=o,a.entity_id=void 0),this.request("bulkMetricUpdate",{workspaceId:n},{payload:a,params:t.filterParams})}async getPermissionForItems({workspaceId:t,itemIds:n}){const o={item_ids:n};return this.request("getPermission",{workspaceId:t},{payload:o,params:{per_page:50}})}async unarchiveScene(t,n,o){const s={item_ids:o,status:1};return this.request("unarchive_item",{workspaceId:t,entityId:n},{payload:s})}async getUserPermission(t){return this.request("getUserPermission",{workspaceId:t})}async getEntityDetail(t,n){return this.request("getEntityDetail",{workspaceId:t,entityId:n})}async downloadTemplate(t,n,o=!0){return this.request("downloadTemplate",{workspaceId:t,entityId:n},{responseType:"blob",params:{format:"xlsx",entity_id:n},autoDownload:o})}async downloadExportedItemsFile(t,n,o=!0){return this.request("exportItems",{workspaceId:t,exportId:n},{responseType:"blob",params:{format:"xlsx",entity_id:n},autoDownload:o})}async addNewSceneViaImportFile(t,n,o){return this.request("importItems",{workspaceId:t,entityId:n},{payload:o})}async overwriteScenesViaImportFile(t,n,o){return this.request("updateFromFile",{workspaceId:t,entityId:n},{payload:o})}async getMe(){return this.request("me",{})}async getWorkspaces(t){const n={page:1,per_page:1,"ws_user_role>status_eq":1,include:"owner",include_ws:t};return this.request("workspaces",{},{params:n})}async getEntityUserRoles(t){const{workspaceId:n,page:o,per_page:s,display_name_like:r,entity_ids:i}=t;return this.request("entityUserRoles",{workspaceId:n},{params:{page:o,per_page:s,display_name_like:r,entity_ids:i}})}async getTemplateFlowStatuses(t){const{workspaceId:n,entityId:o}=t;return this.request("templateFlowStatuses",{workspaceId:n,entityId:o},{params:{per_page:100,page:t.page??1,all:1,name_like:t.name_like}})}async addNewItem(t,n,o){return this.request("createNewItem",{workspaceId:t,entityId:n},{payload:o})}async getFilterStatuses(t,n,o){return this.request("getFilterStatuses",{workspaceId:t,entityId:n},{params:o})}async getAssignableStatuses(t,n){return this.request("getAssignableStatuses",{workspaceId:t},{params:n})}async getAssignableAssignees(t,n){return this.request("getAssignableAssignees",{workspaceId:t},{params:n})}async bulkRename(t){return this.request("bulkRename",{workspaceId:t.workspaceId,entityId:t.entityId},{payload:t.payload,params:t.filter})}}const Jne=(e,t,n,o,s,r,i)=>{const{apiServices:a}=io(n,o),l=H(!1),c=()=>{l.value=!0},u=()=>{ft(()=>{setTimeout(()=>{l.value=!1},500)})},d=Y(()=>!!(s!=null&&s.value&&(r!=null&&r.value))),h=In("filterParams",null);return{isUpdating:l,handleUpdate:async p=>{var v;const g=p.value;c();try{const C={itemIds:e.value.itemIds,metricId:p.id,workspaceId:String(e.value.workspaceId),filterParams:h!=null&&h.value?h.value:void 0};p.value==null?C.clear=1:C.value=g,d.value?(delete C.itemIds,C.entityId=String(o.entityId)):C.itemIds=e.value.itemIds;const S=await((v=a.value)==null?void 0:v.bulkUpdateMetric(C));(S==null?void 0:S.message)=="Done"&&t(p)}catch(C){console.error("Error during bulk metric update:",C)}u()}}},Qne=bt(tt({__name:"MetricUpdateButton",props:{workspaceId:{},entityId:{},variant:{},rowSelected:{},selectedIds:{},disabled:{type:Boolean},selectedAll:{type:Boolean}},emits:["update","update-start","update-completed","update-failed"],setup(e,{emit:t}){const n=_O(),o=H([]),s=e,r=t,i=H([]),a=H(null),l=j=>{var q,V,k;const Q=o.value.findIndex(G=>G.id===j.id);a.value=Q;const re=(q=i.value[Q])==null?void 0:q.$el;(V=_.value)==null||V.scrollTo(Q*30),re&&re.scrollIntoView({behavior:"smooth",block:"center"}),c(Q),(k=i.value[Q])==null||k.show()},c=j=>{a.value=j,i.value.forEach((Q,re)=>{re!==j&&Q&&Q.hide()})},u=H(""),d=()=>{u.value="",i.value.forEach(j=>{j==null||j.hide()}),a.value=null},h=Y(()=>s.selectedIds||[]),f=Y(()=>({itemIds:h.value,workspaceId:String(s.workspaceId)})),p=In("isSelectAll",H(!1)),g=In("bulkUpdate",H(!1)),v=H(null),{handleUpdate:C,isUpdating:S}=Jne(f,j=>{var Q;r("update",j),d(),(Q=v.value)==null||Q.hide()},!1,s,g,p),b=async j=>{var Q;r("update-start");try{await C(j),r("update-completed")}catch{r("update-failed"),(Q=v.value)==null||Q.open()}},y=j=>{d(),ft(()=>{var Q;(Q=_.value)==null||Q.focus()})},_=H(null),E=(j,Q)=>{var re;j?(re=_.value)==null||re.focus():d(),j&&Q!==j&&z("")},D=H(!0),T=H(!0),{apiServices:P}=io(!1,s),L=async(j,Q,re)=>{var q;try{return re?T.value=!0:D.value=!0,await((q=P.value)==null?void 0:q.getMetricList({workspaceId:s.workspaceId||"",entityId:s.entityId||"",page:j,query:Q,per_page:10}))}catch(V){throw console.error("Failed to fetch metric list:",V),V}finally{D.value=!1,T.value=!1}},I=H(0),x=H(!0),O=j=>({id:String(j.id),label:String(j.name),value:String(j.id),description:j.morpheme_value?`${String(j.morpheme_value)}`:"",type:n.checkEditType(j),metricConfig:j}),N=j=>j.filter(Q=>!Q.formula).filter(Q=>{var re;return((re=Q==null?void 0:Q.auth_permission)==null?void 0:re.permission)==2}).map(O),F=async()=>{I.value+=1;const j=await L(I.value,u.value,!0);if(j&&j.data){const Q=N(j.data);o.value=[...o.value,...Q],x.value=j.meta.last_page!=j.meta.current_page}else x.value=!1},z=async j=>{u.value=j,I.value=1;try{const Q=await L(I.value,u.value);Q&&Q.data?(o.value=N(Q.data),x.value=Q.meta.last_page!=Q.meta.current_page):o.value=[]}catch{o.value=[]}};return(j,Q)=>(K(),ze(Hf,{ref_key:"wrapperRef",ref:v,isUpdating:W(S),disabled:s.disabled||W(S),onOnVisibleChange:E},{trigger:be(({hide:re,disabled:q})=>[ye(pt,{variant:s.variant,loading:W(S),disabled:q,onEscape:re},{default:be(()=>[ye(ct,{src:"SquareRootVariable",class:"icon"}),Q[1]||(Q[1]=nt(" Metric ",-1))]),_:1},8,["variant","loading","disabled","onEscape"])]),popup:be(({isVisible:re,popupRef:q,hide:V})=>[qe(ye(ha,{ref_key:"searchListRef",ref:_,style:{width:"320px"},options:o.value,loading:D.value,"loading-more":T.value,"selected-id":void 0,"has-more":x.value,onSearch:z,onSelect:l,onLoadMore:Q[0]||(Q[0]=()=>F()),onCancel:V},{item:be(({item:k,index:G,selectedIndex:ee})=>[ye(lQ,{ref:ge=>i.value[G]=ge,label:k.label,type:k.type,morpheme:k.description||"",onFocusOnSearch:y,onOpen:ge=>c(G),attachTo:q,config:k.metricConfig,onHandleUpdate:b,class:se(["metric-update-item",{selected:a.value===G||ee===G}])},null,8,["label","type","morpheme","onOpen","attachTo","config","class"])]),"extra-item":be(()=>[...Q[2]||(Q[2]=[Te("div",{style:{width:"250px"}},null,-1)])]),"empty-list":be(()=>[...Q[3]||(Q[3]=[nt("No options available.",-1)])]),_:2},1032,["options","loading","loading-more","has-more","onCancel"]),[[lr,re]])]),default:be(()=>[Q[4]||(Q[4]=nt(" > ",-1))]),_:1},8,["isUpdating","disabled"]))}}),[["__scopeId","data-v-a645d131"]]),qv=Sc("bulkUpdate",()=>{const e=H(At.UNCHECK),t=Go({loaded:0,total:0}),n=u=>{t.total=u},o=u=>{t.loaded=u},s=Go({isBulkUpdating:!1});function r(u){s.isBulkUpdating=u}const i=H({}),a=u=>{i.value=u},l=(u,d)=>{i.value[u]=d},c=u=>{e.value=u};return{bulkUpdateState:s,setIsBulkUpdating:r,selectionIds:i,setSelectionIds:a,setCheckedForId:l,setSelectionStatus:c,selectionStatus:e,rowCount:t,setTotalRowCount:n,setLoadedRowCount:o,handelSelectAll:()=>{c(At.CHECKED)}}}),eoe={class:"status-label"},QM=bt(tt({__name:"StatusItem",props:{status:{},selected:{type:Boolean},focused:{type:Boolean},hovered:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=Kt,o=e,s=t,r=a=>{s("select",a)},i=a=>new On(a).isLight()?"#f3f5f8":"#d7d7d7";return(a,l)=>(K(),ce("div",{class:se(["status-option",{selected:o.selected,focused:o.focused,hovered:o.hovered}]),onClick:l[0]||(l[0]=c=>r(e.status.id))},[Te("div",{class:"status-color",style:hn({backgroundColor:e.status.color,borderColor:i(e.status.color)})},null,4),qe((K(),ce("div",eoe,[xt(a.$slots,"label",{},()=>[nt(it(e.status.name),1)],!0)])),[[W(n),{content:e.status.name,delay:[1e3,0]}]])],2))}}),[["__scopeId","data-v-aeaa75a4"]]),toe=["innerHTML"],eN=bt(tt({__name:"StatusEditor",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},ids:{},callback:{type:Function}},emits:["updated","error","cancel","start-update","finish-update"],setup(e,{expose:t,emit:n}){const o={PER_PAGE:50,INITIAL_PAGE:1},s=e,r=n,i=H([]),a=H(!1),l=H(!1),c=H(null),u=H(o.INITIAL_PAGE),d=H(!0),h=H(0),f=H(""),p=Y(()=>{var O;return(O=s.value)==null?void 0:O.id});Y(()=>!!(s.id||s.ids&&s.ids.length>0));const g=O=>({label:O.name,value:O.id,selected:p.value===O.id,hover:!1,type:"status",disabled:!1,clickable:!0,danger:!1,data:O,id:O.id,color:O.color}),v=Y(()=>{const O=new Set;return s.id&&O.add(String(s.id)),s.ids&&s.ids.forEach(N=>{N&&O.add(String(N))}),Array.from(O)}),C=In("bulkUpdate",!1),{apiServices:S}=io(!C,s),b=qv(),{selectionStatus:y}=us(b),_=In("filterParams",null),E=async(O=o.INITIAL_PAGE,N="",F=!1)=>{var z,j,Q,re;F?l.value=!0:a.value=!0,c.value=null;try{const q={workspaceId:String(s.workspaceId),itemIds:v.value,page:O,perPage:o.PER_PAGE,name_like:N.trim(),..._||{},entityId:String(s.entityId)};if(((z=S.value)==null?void 0:z.getAssignableStatus)===void 0)throw new Error("API service getAssignableStatus is undefined");const V=await((j=S.value)==null?void 0:j.getAssignableStatus(q));if(!(V!=null&&V.data)){F||(i.value=[]),d.value=!1;return}const k=V.data.map(g);i.value=F?[...i.value,...k]:k,h.value=((Q=V.meta)==null?void 0:Q.total)??V.data.length,d.value=!((re=V.meta)!=null&&re.on_last_page),u.value=O}catch(q){console.error("Error fetching statuses:",q),c.value="Failed to load statuses",F||(i.value=[]),d.value=!1,r("error",c.value)}finally{a.value=!1,l.value=!1}},D=mr(async O=>{f.value=O,u.value=o.INITIAL_PAGE,await E(o.INITIAL_PAGE,O,!1)},Ci),T=async()=>{!d.value||l.value||await E(u.value+1,f.value,!0)},P=()=>{var O;r("cancel"),(O=s.params)==null||O.api.stopEditing()},L=async O=>{var N,F,z;try{const j={workspaceId:String(s.workspaceId),itemIds:v.value,statusId:String(O.value),entityId:String(s.entityId),filterParams:_!=null&&_.value?_==null?void 0:_.value:void 0};if(y.value==At.CHECKED&&C&&(j.itemIds=void 0,j.entityId=String(s.entityId)),r("start-update"),!await S.value.updateItemStatus(j))throw new Error("Status update failed: empty response");r("updated",{workspaceId:String(s.workspaceId),itemIds:v.value,isUpdateAll:y.value==At.CHECKED&&C,data:{id:O.id,name:O.label,color:O.color}}),s.params&&((F=s.params)==null||F.node.setData({...(N=s.params)==null?void 0:N.node.data,status:{id:O.id,name:O.label,color:O.color}}),(z=s.params)==null||z.api.stopEditing()),r("finish-update")}catch(j){console.error("Error updating status:",j),c.value="Failed to update status",r("error",c.value)}},I=Y(()=>i.value.map(O=>({...O})));Qe([()=>s.id,()=>s.workspaceId,()=>s.ids],()=>{E()},{deep:!0,immediate:!0});const x=H(null);return en(()=>{ft(()=>{var O;(O=x.value)==null||O.focus()})}),t({refresh:()=>E(o.INITIAL_PAGE,f.value,!1),loadMore:T,focus:()=>{var O;return(O=x.value)==null?void 0:O.focus()}}),(O,N)=>{var F;return K(),ze(ha,jt({ref_key:"popupRef",ref:x},s,{"selected-id":(F=s.value)==null?void 0:F.id,options:I.value,loading:a.value,"loading-more":l.value,"has-more":d.value,error:c.value,onSearch:W(D),onSelect:L,onLoadMore:T,onCancel:P,onClose:P}),{item:be(({item:z,selectedIndex:j,isSelected:Q,handleItemHover:re,getHighlightedLabel:q,query:V,idx:k})=>[(K(),ze(QM,{key:z.value,status:z.data,selected:Q(z),onMouseover:G=>re(k),onSelect:G=>L(z),hovered:k===j},{label:be(()=>[V?(K(),ce("span",{key:0,class:se([O.$style["item-label"],O.$style.match]),style:{flex:"1"},innerHTML:q(z.label)},null,10,toe)):(K(),ce("span",{key:1,class:se(O.$style["item-label"]),style:{flex:"1"}},it(z.label),3))]),_:2},1032,["status","selected","onMouseover","onSelect","hovered"]))]),_:1},16,["selected-id","options","loading","loading-more","has-more","error","onSearch"])}}}),[["__cssModules",{$style:{"item-label":"_item-label_7ir12_1"}}]]),noe=tt({__name:"StatusUpdateButton",props:{ids:{},workspaceId:{},entityId:{},variant:{},disabled:{type:Boolean},selectedAll:{type:Boolean}},emits:["updated","update-start","update-completed","update-failed"],setup(e,{emit:t}){const n=e,o=Y(()=>{const f=ro();return f==null?void 0:f.appContext.config.globalProperties.apiServices}),s=t,r=H(!1),i=H(null),a=f=>{try{r.value=!1,s("updated",f)}catch(p){console.error("Error handling status update:",p)}finally{s("update-completed")}},l=Y(()=>({apiServices:o.value,ids:n.ids,workspaceId:n.workspaceId,entityId:n.entityId,selectedAll:n.selectedAll}));ui("bulkUpdate",!0);const c=f=>{var p,g;console.trace("handleUpdateCompleted called with success:",f),r.value=!1,f?(s("update-completed"),(p=i.value)==null||p.destroy()):(s("update-failed"),(g=i.value)==null||g.open())},u=H(null),d=(f,p)=>{var g;f&&((g=u.value)==null||g.focus())},h=()=>{r.value=!0,s("update-start")};return Qe(()=>n.ids,()=>{}),(f,p)=>(K(),ze(Hf,{ref_key:"wrapperRef",ref:i,isUpdating:r.value,disabled:n.disabled||r.value,onOnVisibleChange:d},{trigger:be(({hide:g,disabled:v})=>[ye(pt,{variant:n.variant,loading:r.value,disabled:v,onEscape:g},{default:be(()=>[ye(ct,{src:"Square",class:"icon"}),p[2]||(p[2]=nt(" Status ",-1))]),_:1},8,["variant","loading","disabled","onEscape"])]),popup:be(({hide:g})=>[ye(eN,jt({disabled:r.value,ref_key:"statusRef",ref:u},l.value,{onUpdated:a,onCancel:g,onStartUpdate:h,onFinishUpdate:p[0]||(p[0]=v=>c(!0)),onError:p[1]||(p[1]=v=>c(!1)),callback:()=>{}}),null,16,["disabled","onCancel"])]),default:be(()=>[p[3]||(p[3]=nt(" > ",-1))]),_:1},8,["isUpdating","disabled"]))}}),jr=" ",z0=e=>e.replace(/[\r\n]+/g," "),Yv=e=>e instanceof HTMLElement&&e.classList.contains("locked-tag"),Ws=e=>(e==null?void 0:e.nodeType)===Node.TEXT_NODE,j0=e=>{var t;return((t=e instanceof Element?e:e.parentElement)==null?void 0:t.closest(".locked-tag"))??null},ga=e=>{let t=0,n=e.length;return Yv(e.previousSibling)&&e.data.startsWith(jr)&&(t=1),Yv(e.nextSibling)&&n>t&&e.data.endsWith(jr)&&(n-=1),{start:t,end:n}},ooe=e=>{if(!Ws(e))return!1;const{start:t,end:n}=ga(e);return n<=t},tN=e=>{const t=j0(e.startContainer),n=j0(e.endContainer);return t&&e.setStartAfter(t),n&&e.setEndAfter(n),e},soe=(e,t)=>e.length===t.length&&e.every((n,o)=>{const s=t[o];return typeof n=="string"||typeof s=="string"?n===s:n.id===s.id&&n.text===s.text&&n.direction===s.direction});class roe{constructor(t){Tn(this,"editor",null);Tn(this,"handleInput",()=>{this.editor&&(this.sanitize(),this.ensureTagPadding(),this.normalizeCaret(),this.options.onChange(this.parse()))});Tn(this,"handlePaste",t=>{var n;t.preventDefault(),this.insertPlainText(((n=t.clipboardData)==null?void 0:n.getData("text/plain"))??"")});Tn(this,"handleDrop",t=>{var o,s;t.preventDefault();const n=((o=t.dataTransfer)==null?void 0:o.getData("text/plain"))??"";n&&this.insertPlainText(n,(s=document.caretRangeFromPoint)==null?void 0:s.call(document,t.clientX,t.clientY))});Tn(this,"handleBeforeInput",t=>{const n=t.inputType;(n.startsWith("format")||n==="insertParagraph"||n==="insertLineBreak"||n==="insertFromDrop"||n==="insertFromYank")&&t.preventDefault()});Tn(this,"handleClick",t=>{const n=this.editor,o=window.getSelection();if(!n||!(o!=null&&o.isCollapsed)||t.target!==n)return;const s=document.createRange();if(s.selectNodeContents(n),t.clientX<=s.getBoundingClientRect().right)return;const[r,i]=this.getBoundaryPoint("end");o.collapse(r,i),n.scrollLeft=n.scrollWidth});Tn(this,"handleKeydown",t=>{var s;const n=this.editor;if(!n)return;if(t.key==="Enter"){t.preventDefault();return}const o=t.ctrlKey||t.metaKey;if(o&&!t.altKey&&t.key.toLowerCase()==="a"){t.preventDefault(),(s=window.getSelection())==null||s.selectAllChildren(n);return}if(t.key==="Home"||t.key==="End"){t.preventDefault(),this.moveToEdge(t.key==="Home"?"start":"end",t.shiftKey);return}if((t.key==="ArrowLeft"||t.key==="ArrowRight")&&!t.shiftKey&&!o&&!t.altKey){this.moveAcrossTag(t.key)&&t.preventDefault();return}if(t.key==="Backspace"||t.key==="Delete"){if(!o&&!t.altKey&&!t.shiftKey&&this.deleteCharacter(t.key)){t.preventDefault();return}const r=this.findAdjacentTag(t.key);r&&(t.preventDefault(),this.removeTag(r,t.key==="Backspace"?"after":"before"))}});Tn(this,"normalizeCaret",()=>{const t=this.editor,n=window.getSelection();if(!t||!(n!=null&&n.rangeCount)||!n.isCollapsed)return;const{startContainer:o,startOffset:s}=n.getRangeAt(0);if(!t.contains(o))return;const r=j0(o);if(!r&&o!==t)return;const i=r??t.childNodes[s-1]??null,a=r?r.nextSibling:t.childNodes[s]??null;if(this.ensureTagPadding(),Ws(i))n.collapse(i,ga(i).end);else if(Ws(a))n.collapse(a,ga(a).start);else if(Ws((i==null?void 0:i.nextSibling)??null)){const l=i.nextSibling;n.collapse(l,ga(l).start)}else if(Ws((a==null?void 0:a.previousSibling)??null)){const l=a.previousSibling;n.collapse(l,ga(l).end)}});this.options=t}mount(t,n=[]){this.editor=t,this.render(n),document.addEventListener("selectionchange",this.normalizeCaret)}destroy(){document.removeEventListener("selectionchange",this.normalizeCaret),this.editor=null}sync(t){this.editor&&(soe(t,this.parse())||this.render(t))}render(t){const n=this.editor;n&&(n.innerHTML="",t.forEach(o=>{typeof o=="string"?n.appendChild(document.createTextNode(z0(o))):this.options.isTagAllowed(o.id)&&n.appendChild(this.createTagNode(o))}),this.ensureTagPadding())}parse(){var o;const t=[];let n="";return(o=this.editor)==null||o.childNodes.forEach(s=>{Ws(s)?n+=s.data.replace(/\u00A0/g," "):this.isAllowedTagNode(s)&&(n&&(t.push(n),n=""),t.push({id:s.dataset.id||"unknown",text:s.innerText||"Tag",direction:s.dataset.direction??void 0}))}),n&&t.push(n),t}insertTag(t){const n=this.editor;if(!n||!this.options.isTagAllowed(t.id))return;const o=n.querySelector(`.locked-tag[data-id="${t.id}"]`);if(o instanceof HTMLElement){this.applyTagData(o,t),this.handleInput();return}const s=this.createTagNode(t),r=document.createTextNode(jr),i=this.getEditorRange();i?(i.deleteContents(),i.insertNode(r),i.insertNode(s)):n.append(s,r),n.normalize(),this.handleInput(),this.placeCaretAfterTag(r)}updateTag(t,n){var s;const o=(s=this.editor)==null?void 0:s.querySelector(`.locked-tag[data-id="${t}"]`);o instanceof HTMLElement&&(o.innerText=n,this.handleInput())}replaceTag(t,n){if(!this.editor||!this.options.isTagAllowed(n.id))return;const o=this.createTagNode({id:n.id,text:n.label,direction:n.direction}),s=this.editor.querySelector(`.locked-tag[data-id="${t.id}"]`);s instanceof HTMLElement&&(s.replaceWith(o),this.handleInput())}deleteTag(t){const n=this.editor;if(!n)return;const o=n.querySelector(`.locked-tag[data-id="${t}"]`);o instanceof HTMLElement&&this.removeTag(o,"after");const s=this.parse(),r=s[0];s.length===1&&typeof r=="string"&&r.trim()===""&&(n.innerHTML="",this.options.onChange(this.parse()))}isAllowedTagNode(t){return Yv(t)&&this.options.isTagAllowed(t.getAttribute("data-id")??"")}applyTagData(t,{text:n,direction:o}){t.innerText=n,o?t.dataset.direction=o:delete t.dataset.direction}createTagNode({id:t,text:n,direction:o}){const s=document.createElement("span");return s.contentEditable="false",s.className="locked-tag",s.dataset.id=t,this.applyTagData(s,{text:n,direction:o}),s}getEditorRange(){const t=window.getSelection();if(!this.editor||!(t!=null&&t.rangeCount))return null;const n=t.getRangeAt(0).cloneRange();return this.editor.contains(n.commonAncestorContainer)?tN(n):null}insertPlainText(t,n){const o=this.editor;if(!o)return;const s=window.getSelection();let r=n?tN(n):this.getEditorRange();(!r||!o.contains(r.commonAncestorContainer))&&(r=document.createRange(),r.selectNodeContents(o),r.collapse(!1)),r.deleteContents();const i=document.createTextNode(z0(t));r.insertNode(i),r.setStartAfter(i),r.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(r),this.handleInput()}sanitize(){const t=this.editor;if(!t)return;t.querySelectorAll(".locked-tag .locked-tag").forEach(o=>o.remove());let n=!1;if(Array.from(t.childNodes).forEach(o=>{if(Ws(o)||this.isAllowedTagNode(o))return;n=!0;const s=Yv(o)?"":z0(o.textContent??"");o.replaceWith(document.createTextNode(s))}),n){const o=window.getSelection(),s=document.createRange();s.selectNodeContents(t),s.collapse(!1),o==null||o.removeAllRanges(),o==null||o.addRange(s)}}ensureTagPadding(){var t;(t=this.editor)==null||t.querySelectorAll(".locked-tag").forEach(n=>{const o=n.previousSibling,s=n.nextSibling;Ws(o)?o.data.endsWith(jr)||o.appendData(jr):n.before(document.createTextNode(jr)),Ws(s)?s.data.startsWith(jr)||s.insertData(0,jr):n.after(document.createTextNode(jr))})}async placeCaretAfterTag(t){var s;(s=this.editor)==null||s.focus(),await Promise.resolve();const n=document.createRange();n.setStart(t,ga(t).start),n.collapse(!0);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(n)}findAdjacentTag(t){const n=this.editor,o=window.getSelection();if(!n||!o||!o.isCollapsed||!o.rangeCount)return null;const{startContainer:s,startOffset:r}=o.getRangeAt(0);if(!n.contains(s))return null;const i=t==="Backspace";let a;if(s===n)a=i?n.childNodes[r-1]??null:n.childNodes[r]??null;else if(Ws(s)&&s.parentNode===n){const{start:l,end:c}=ga(s);if(i?Math.min(r,c)>l:Math.max(r,l)<c)return null;a=i?s.previousSibling:s.nextSibling}else return null;for(;ooe(a);)a=i?a.previousSibling:a.nextSibling;return a&&this.isAllowedTagNode(a)?a:null}getBoundaryPoint(t){const n=this.editor,o=t==="start"?n.firstChild:n.lastChild;return Ws(o)?[o,t==="start"?0:o.length]:[n,t==="start"?0:n.childNodes.length]}moveToEdge(t,n){const o=this.editor,s=window.getSelection();if(!o||!s)return;const[r,i]=this.getBoundaryPoint(t),a=n&&s.anchorNode&&o.contains(s.anchorNode)?{node:s.anchorNode,offset:s.anchorOffset}:{node:r,offset:i};s.setBaseAndExtent(a.node,a.offset,r,i),o.scrollLeft=t==="start"?0:o.scrollWidth}moveAcrossTag(t){const n=t==="ArrowLeft",o=this.findAdjacentTag(n?"Backspace":"Delete"),s=window.getSelection();if(!o||!s)return!1;const r=n?o.previousSibling:o.nextSibling;if(!Ws(r))return!1;const i=ga(r);return s.collapse(r,n?i.end:i.start),!0}deleteCharacter(t){const n=window.getSelection();if(!this.editor||!(n!=null&&n.isCollapsed)||!n.rangeCount)return!1;const{startContainer:o,startOffset:s}=n.getRangeAt(0);if(!Ws(o)||o.parentNode!==this.editor)return!1;const{start:r,end:i}=ga(o);let a,l=1,c=s;if(t==="Backspace"){if(a=Math.min(s,i)-1,a<r)return!1;/[\uDC00-\uDFFF]/.test(o.data[a])&&a>r&&(a--,l=2),c=s-l}else{if(a=Math.max(s,r),a>=i)return!1;/[\uD800-\uDBFF]/.test(o.data[a])&&a+1<i&&(l=2)}return o.deleteData(a,l),n.collapse(o,c),this.handleInput(),!0}removeTag(t,n){var r;const o=t.previousSibling,s=t.nextSibling;t.remove(),o instanceof Text&&s instanceof Text&&o.data.endsWith(jr)&&s.data.startsWith(jr)&&(n==="after"?o.deleteData(o.length-1,1):s.deleteData(0,1)),(r=this.editor)==null||r.normalize(),this.handleInput()}focus(){var o;console.log("Focusing editor"),(o=this.editor)==null||o.focus();const t=document.createRange();t.selectNodeContents(this.editor),t.collapse(!1);const n=window.getSelection();n==null||n.removeAllRanges(),n==null||n.addRange(t)}}const ioe={class:"input-wrapper"},aoe=["data-placeholder"],loe=bt(tt({__name:"DynamicInput",props:{modelValue:{type:Array,default:()=>[]},placeholder:{type:String,default:"Rename to"},allowedTags:{type:Array,default:void 0}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const o=e,s=n,r=H(null),i=new roe({isTagAllowed:a=>!o.allowedTags||o.allowedTags.includes(a),onChange:a=>s("update:modelValue",a)});return en(()=>{r.value&&i.mount(r.value,o.modelValue)}),Jn(()=>i.destroy()),Qe(()=>o.modelValue,a=>i.sync(a),{deep:!0}),t({insertTag:a=>i.insertTag(a),updateTag:(a,l)=>i.updateTag(a,l),replaceTag:(a,l)=>i.replaceTag(a,l),deleteTag:a=>i.deleteTag(a),focus:()=>{console.log("Focusing editor"),i.focus()}}),(a,l)=>(K(),ce("div",ioe,[Te("div",{ref_key:"editorRef",ref:r,class:"custom-input single-line",contenteditable:"true","data-placeholder":e.placeholder,onPaste:l[0]||(l[0]=(...c)=>W(i).handlePaste&&W(i).handlePaste(...c)),onDrop:l[1]||(l[1]=(...c)=>W(i).handleDrop&&W(i).handleDrop(...c)),onBeforeinput:l[2]||(l[2]=(...c)=>W(i).handleBeforeInput&&W(i).handleBeforeInput(...c)),onInput:l[3]||(l[3]=(...c)=>W(i).handleInput&&W(i).handleInput(...c)),onKeydown:l[4]||(l[4]=(...c)=>W(i).handleKeydown&&W(i).handleKeydown(...c)),onClick:l[5]||(l[5]=Nt((...c)=>W(i).handleClick&&W(i).handleClick(...c),["stop","prevent"]))},null,40,aoe)]))}}),[["__scopeId","data-v-e3be4ee2"]]),coe={key:0},uoe={key:1},nN=8,doe=bt(tt({__name:"PreviewName",props:{text:{}},setup(e){const t=Kt,n=e,o=H(null),s=H(null),r=H(n.text),i=H(!1),a=d=>{const h=s.value;return h.textContent=d,h.offsetWidth},l=(d,h)=>{const f=d.slice(-nN),p=d.length-nN-1;if(p<1||a(d)<=h)return d;let g=0,v=p;for(;g<v;){const C=Math.ceil((g+v)/2);a(`${d.slice(0,C)}…${f}`)<=h?g=C:v=C-1}return`${d.slice(0,g)}…${f}`},c=()=>{!o.value||!s.value||(r.value=l(n.text,o.value.clientWidth),i.value=r.value!==n.text)};let u;return en(()=>{c(),u=new ResizeObserver(c),u.observe(o.value)}),Jn(()=>u==null?void 0:u.disconnect()),Qe(()=>n.text,()=>ft(c)),(d,h)=>(K(),ce("div",{ref_key:"rootRef",ref:o,class:"preview-name"},[i.value?qe((K(),ce("span",coe,[nt(it(r.value),1)])),[[W(t),{content:e.text,delay:[1e3,0],bypassOverflowCheck:!0}]]):(K(),ce("span",uoe,it(e.text),1)),Te("span",{ref_key:"measureRef",ref:s,class:"measure","aria-hidden":"true"},null,512)],512))}}),[["__scopeId","data-v-f1310bab"]]),oN=10,sN=5,tp={number:{first:"000",step:"1"},letter:{first:"A",step:"1"}},hoe={up:{first:"Start at",step:"Increase by"},down:{first:"End at",step:"Decrease by"}},foe=/^[0-9]$/,poe=/^[A-Za-z]$/,rN=(e,t)=>t==="first"&&e==="letter"?poe:foe,goe=(e,t,n)=>rN(e,t).test(n),moe=e=>e==="first"?oN:sN,voe=e=>e&&e[0]===e[0].toLowerCase()?e.toLowerCase():e.toUpperCase(),yoe=(e,t,n)=>{const o=rN(e,t),s=Array.from(n).filter(r=>o.test(r)).join("").slice(0,moe(t));return t==="first"&&e==="letter"?voe(s):s},iN=(e,t)=>t!==""&&(e==="first"||Number(t)>0),woe=e=>Array.from(e.toUpperCase()).reduce((t,n)=>t*26+(n.charCodeAt(0)-64),0),Coe=e=>{let t="",n=e;for(;n>0;){const o=(n-1)%26;t=String.fromCharCode(65+o)+t,n=Math.floor((n-1)/26)}return t},aN=({type:e,direction:t,first:n,step:o,count:s})=>{const r=Number(o)||1,i=c=>(t==="up"?c:s-1-c)*r;if(e==="number"){const c=Number(n);return Array.from({length:s},(u,d)=>String(c+i(d)).padStart(n.length,"0"))}const a=woe(n),l=n!==""&&n[0]===n[0].toLowerCase();return Array.from({length:s},(c,u)=>{const d=Coe(a+i(u));return l?d.toLowerCase():d})},boe={class:"bulk-rename-popup",id:"bulk-rename-el"},Soe={class:"left-section"},Eoe={class:"modified-template-options"},_oe=["onClick"],Roe={class:"setting-count"},Toe={class:"field-label"},Doe={class:"field-label"},Ioe={class:"confirmation"},xoe={class:"preview-section"},Poe={class:"preview-list"},koe={key:0,class:"preview-more"},lN=8,cN=7,Foe=bt(tt({__name:"BulkRenamePopup",props:{item:{}},emits:["cancel","rename"],setup(e,{expose:t,emit:n}){const o=Kt,s=H(null),r=["number","letter","name"],i={number_up:"1→9",number_down:"9→1",letter_up:"A→Z",letter_down:"Z→A",name:"Name"},a=e,l=H([]),c=Y(()=>l.value.find(q=>typeof q!="string"&&(q.id==="number"||q.id==="letter"))),u=H("number"),d=H("up"),h=Go({...tp.number}),f=Go({...tp.number}),p=()=>{Object.assign(h,tp[u.value]),Object.assign(f,tp[u.value])};Qe(c,q=>{if(!q)return;const V=q.id;V!==u.value&&(u.value=V,p()),d.value=q.direction==="down"?"down":"up"},{immediate:!0,flush:"sync"});const g=Y(()=>hoe[d.value]),v=(q,V)=>{const k=yoe(u.value,q,V);h[q]=k,iN(q,k)&&(f[q]=k)},C=(q,V)=>{V.key.length===1&&!V.ctrlKey&&!V.metaKey&&!V.altKey&&!goe(u.value,q,V.key)&&V.preventDefault()},S=(q,V)=>{var Fe;V.preventDefault();const k=V.target,G=((Fe=V.clipboardData)==null?void 0:Fe.getData("text/plain"))??"",ee=k.selectionStart??k.value.length,ge=k.selectionEnd??k.value.length;k.value=k.value.slice(0,ee)+G+k.value.slice(ge),v(q,k.value),k.value=h[q]},b=q=>{if(iN(q,h[q]))return;const V=tp[u.value][q];h[q]=V,f[q]=V},y=Y(()=>c.value?aN({type:u.value,direction:d.value,first:f.first,step:f.step,count:a.item.length}):[]),_=Y(()=>l.value.every(q=>typeof q=="string"&&!q)),E=Y(()=>_.value||l.value.length==0&&l.value[0]===" "?a.item.map(q=>q.name):a.item.map((q,V)=>l.value.map(k=>typeof k=="string"?k:k.id==="name"?q.name:y.value[V]??"").join(""))),D=Y(()=>E.value.length>lN?E.value.length-cN:0),T=Y(()=>E.value.length>lN?E.value.slice(0,cN):E.value),P=[{id:"name",name:"Current name",icon:null,description:{active:"Remove from the name",inactive:"Add the current name"}},{id:"number_up",name:"Number",icon:"ArrowLeft",description:{active:"Remove from the name",inactive:"Add a number that counts up",switch:"Switch to a number that counts up"}},{id:"number_down",name:"Number",icon:"ArrowRight",description:{active:"Remove from the name",inactive:"Add a number that counts down",switch:"Switch to a number that counts down"}},{id:"letter_up",name:"Letter",icon:"ArrowLeft",description:{active:"Remove from the name",inactive:"Add a letter that counts up",switch:"Switch to a letter that counts up"}},{id:"letter_down",name:"Letter",icon:"ArrowRight",description:{active:"Remove from the name",inactive:"Add a letter that counts down",switch:"Switch to a letter that counts down"}}],L=q=>{x.value=[q];const V=q.id.split("_")[0],k=q.id.split("_")[1],G=i[q.id],ee=s.value;if(!ee)return;const ge=Ge=>l.value.find(fe=>typeof fe!="string"&&Ge.includes(fe.id));if(V==="name"){ge(["name"])?ee.deleteTag("name"):ee.insertTag({id:V,text:G,direction:void 0});return}const Fe=ge(["number","letter"]);if(Fe){const Ge=Fe.id===V,fe=Fe.direction===k;if(Ge&&fe){ee.deleteTag(Fe.id);return}ee.deleteTag(Fe.id),ee.insertTag({id:V,text:G,direction:k})}else ee.insertTag({id:V,text:G,direction:k})},I=q=>O(q.id)?q.description.active:!!c.value&&q.description.switch?q.description.switch:q.description.inactive,x=H(null),O=q=>{const[V,k]=q.split("_");return l.value.some(G=>typeof G!="string"&&G.id===V&&G.direction===k)},N=n,F=Y(()=>l.value.length===1&&typeof l.value.at(0)!="string"&&l.value[0].id==="name"),z=Y(()=>l.value.length===0||F.value),j=()=>{x.value=null,l.value=[],N("cancel")},Q=()=>{const q=l.value.map(V=>typeof V=="string"?{type:"text",value:V}:V.id==="name"?{type:"current_name"}:{type:"counter",value:h.first,direction:V.direction=="up"?"asc":"desc",format:V.id==="number"?"number":"letter",step:h.step});N("rename",q)};return t({reset:()=>{x.value=null,l.value=[]},focus:()=>{var q;(q=s.value)==null||q.focus()}}),en(()=>{console.log("Focusing template input"),setTimeout(()=>{var q;(q=s.value)==null||q.focus()},500)}),(q,V)=>(K(),ce("div",boe,[Te("div",Soe,[ye(loe,{modelValue:l.value,"onUpdate:modelValue":V[0]||(V[0]=k=>l.value=k),"allowed-tags":r,ref_key:"templateInputRef",ref:s},null,8,["modelValue"]),Te("div",Eoe,[(K(),ce(Ft,null,Pn(P,k=>qe((K(),ce("button",{onClick:G=>L(k),class:se(["template-option",{active:O(k.id)}]),key:k.id},[nt(it(k.name)+" ",1),k.icon?(K(),ze(W(ct),{key:0,src:k.icon,style:{transform:"rotate(90deg)"}},null,8,["src"])):Xe("",!0)],10,_oe)),[[W(o),{content:I(k),bypassOverflowCheck:!0,delay:[300,0],interactive:!1,hideOnClick:!1,appendTo:"parent"}]])),64))]),Te("div",Roe,[Te("span",Toe,it(g.value.first),1),ye(W($f),{"model-value":h.first,disabled:!c.value,"max-length":W(oN),onInput:V[1]||(V[1]=k=>v("first",k)),onKeydown:V[2]||(V[2]=k=>C("first",k)),onPaste:V[3]||(V[3]=k=>S("first",k)),onBlur:V[4]||(V[4]=k=>b("first")),"show-clear":!1},{clear:be(()=>[...V[9]||(V[9]=[Te("div",null,null,-1)])]),_:1},8,["model-value","disabled","max-length"]),Te("span",Doe,it(g.value.step),1),ye(W($f),{"model-value":h.step,disabled:!c.value,"max-length":W(sN),onInput:V[5]||(V[5]=k=>v("step",k)),onKeydown:V[6]||(V[6]=k=>C("step",k)),onPaste:V[7]||(V[7]=k=>S("step",k)),onBlur:V[8]||(V[8]=k=>b("step")),"show-clear":!1},null,8,["model-value","disabled","max-length"])]),Te("div",Ioe,[ye(W(pt),{variant:"secondary",onClick:j},{default:be(()=>[...V[10]||(V[10]=[nt(" Cancel ",-1)])]),_:1}),ye(W(pt),{onClick:Q,disabled:z.value},{default:be(()=>[...V[11]||(V[11]=[nt(" Rename ",-1)])]),_:1},8,["disabled"])])]),Te("div",xoe,[V[12]||(V[12]=Te("span",{class:"preview-title"},"Preview",-1)),Te("ul",Poe,[(K(!0),ce(Ft,null,Pn(T.value,(k,G)=>(K(),ce("li",{key:G},[ye(doe,{text:k},null,8,["text"])]))),128)),D.value>0?(K(),ce("li",koe," … "+it(D.value)+" more items ",1)):Xe("",!0)])])]))}}),[["__scopeId","data-v-4cce023f"]]),Aoe=tt({__name:"BulkRenameButton",props:{item:{},totalItem:{}},emits:["cancel","rename"],setup(e,{expose:t,emit:n}){const{popupRef:o,show:s,hide:r,triggerRef:i}=mo({interactive:!0,trigger:"manually",placement:"top-end",showArrow:!1,offset:[-350,25],hideOnClick:!0,toggleOnClick:!0,onHide:()=>{console.log("Popup hidden"),h()},onShow:()=>{ft(()=>{var f;(f=d.value)==null||f.focus()})}}),a=e,l=()=>{r()},c=f=>{u("rename",f),r()},u=n,d=H(null),h=()=>{d.value&&d.value.reset()};return t({popupRef:o,hide:r,show:s,triggerRef:i}),(f,p)=>(K(),ce(Ft,null,[Te("div",{class:"trigger-el",ref_key:"triggerRef",ref:i},null,512),Te("div",{class:"popup-el",ref_key:"popupRef",ref:o},[ye(Foe,{item:a.item,"total-item":a.totalItem,ref_key:"bulkRenameRef",ref:d,onCancel:l,onRename:c},null,8,["item","total-item"])],512)],64))}}),Ooe={...{list_cursor:{error:"Failed to fetch data. Please reload table."},assignedUser:{error:"Failed to fetch assignees. Please reload table."},metricValues:{error:"Failed to fetch metric values. Please reload table."},assignableUser:{error:"Failed to fetch people. Please try again."},assignableStatus:{error:"Failed to fetch statuses. Please try again."},basicInfor:{error:"Failed to fetch basic information."},item:{error:"Update failed. Please try again."},removeAssignee:{error:"Update failed. Please try again."},metricList:{error:"Failed to fetch metrics. Please try again."},multipleAssignableUser:{error:"Failed to fetch data. Please reload table."},getPermission:{error:"Failed to fetch permissions."},delete_rendition:{success:"Deletion successful.",error:"Deletion failed. Please try again."},delete_thumbnail:{success:"Deletion successful.",error:"Deletion failed. Please try again."},archive_item:{success:"Archive successful.",error:"Archive failed. Please try again."},unarchive_item:{success:"Unarchive successful.",error:"Unarchive failed. Please try again."},bulkDelete:{success:"Deletion successful.",error:"Deletion failed. Please try again."},bulkArchive:{error:"Archive failed. Please try again."},bulkDateUpdate:{error:"Failed to update items."},bulkAssignUpdate:{error:"Failed to update assignees."},bulkStatusUpdate:{error:"Failed to update items."},getUserPermission:{error:"Failed to fetch user permissions."},getEntityDetail:{error:"Failed to fetch entity details."},bulkUnarchive:{error:"Unarchive failed. Please try again."},downloadTemplate:{},importItems:{},exportItems:{},updateFromFile:{},me:{},workspaces:{},entityUserRoles:{},templateFlowStatuses:{},bulkMetricUpdate:{error:"Update failed. Please try again."},createNewItem:{},getAssignableAssignees:{},getAssignableStatuses:{},getFilterStatuses:{},bulkRename:{}},offline:{error:"You are currently offline. Please check your network connection."}};function uN(e,t,n){return(t=Noe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Moe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Noe(e){var t=Moe(e,"string");return typeof t=="symbol"?t:t+""}function kc(e){"@babel/helpers - typeof";return kc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kc(e)}var dN=function(e){return e.TOOLBOX_EXPORT_DATA="TOOLBOX_EXPORT_DATA",e.SW_APP_LOADER="SW_APP_LOADER",e}({});function hN(e){return kc(e)==="object"&&e!==null&&!Array.isArray(e)}function fN(e,t){var n=Object.keys(e);return n.length===t.length&&t.every(function(o){return n.includes(o)})}function Loe(e){return typeof Blob<"u"&&e instanceof Blob}var Voe=function(t){return hN(t)&&fN(t,["file","fileName"])&&Loe(t.file)&&typeof t.fileName=="string"},Boe=function(t){return hN(t)&&fN(t,["scene_id","people_id","openGS","queryParams"])&&(typeof t.scene_id=="string"||t.scene_id===null)&&(typeof t.people_id=="string"||t.people_id===null)&&(typeof t.openGS=="boolean"||t.openGS===null)&&typeof t.queryParams=="string"};Object.freeze(uN(uN({},dN.TOOLBOX_EXPORT_DATA,Voe),dN.SW_APP_LOADER,Boe));class $oe extends Error{}class fl extends $oe{constructor(){super("Zone is an abstract class")}}class pN{get type(){throw new fl}get name(){throw new fl}get ianaName(){return this.name}get isUniversal(){throw new fl}offsetName(t,n){throw new fl}formatOffset(t,n){throw new fl}offset(t){throw new fl}equals(t){throw new fl}get isValid(){throw new fl}}const K0=new Map;function Hoe(e){let t=K0.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),K0.set(e,t)),t}const Goe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Uoe(e,t){const n=e.format(t).replace(/\u200E/g,""),o=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,s,r,i,a,l,c,u]=o;return[i,s,r,a,l,c,u]}function Woe(e,t){const n=e.formatToParts(t),o=[];for(let s=0;s<n.length;s++){const{type:r,value:i}=n[s],a=Goe[r];r==="era"?o[a]=i:Zv(a)||(o[a]=parseInt(i,10))}return o}const q0=new Map;class Xv extends pN{static create(t){let n=q0.get(t);return n===void 0&&q0.set(t,n=new Xv(t)),n}static resetCache(){q0.clear(),K0.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=Xv.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:n,locale:o}){return Koe(t,n,o,this.name)}formatOffset(t,n){return Qv(this.offset(t),n)}offset(t){if(!this.valid)return NaN;const n=new Date(t);if(isNaN(n))return NaN;const o=Hoe(this.name);let[s,r,i,a,l,c,u]=o.formatToParts?Woe(o,n):Uoe(o,n);a==="BC"&&(s=-Math.abs(s)+1);const h=joe({year:s,month:r,day:i,hour:l===24?0:l,minute:c,second:u,millisecond:0});let f=+n;const p=f%1e3;return f-=p>=0?p:1e3+p,(h-f)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}}let Y0=null;class fd extends pN{static get utcInstance(){return Y0===null&&(Y0=new fd(0)),Y0}static instance(t){return t===0?fd.utcInstance:new fd(t)}static parseSpecifier(t){if(t){const n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new fd(mN(n[1],n[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Qv(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Qv(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,n){return Qv(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}}function Zv(e){return typeof e>"u"}function Jv(e,t=2){const n=e<0;let o;return n?o="-"+(""+-e).padStart(t,"0"):o=(""+e).padStart(t,"0"),o}function gN(e){if(!(Zv(e)||e===null||e===""))return parseInt(e,10)}function zoe(e){if(!(Zv(e)||e===null||e==="")){const t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function joe(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Koe(e,t,n,o=null){const s=new Date(e),r={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};o&&(r.timeZone=o);const i={timeZoneName:t,...r},a=new Intl.DateTimeFormat(n,i).formatToParts(s).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function mN(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const o=parseInt(t,10)||0,s=n<0||Object.is(n,-0)?-o:o;return n*60+s}function Qv(e,t){const n=Math.trunc(Math.abs(e/60)),o=Math.trunc(Math.abs(e%60)),s=e>=0?"+":"-";switch(t){case"short":return`${s}${Jv(n,2)}:${Jv(o,2)}`;case"narrow":return`${s}${n}${o>0?`:${o}`:""}`;case"techie":return`${s}${Jv(n,2)}${Jv(o,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}const vN=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function pd(...e){const t=e.reduce((n,o)=>n+o.source,"");return RegExp(`^${t}$`)}function gd(...e){return t=>e.reduce(([n,o,s],r)=>{const[i,a,l]=r(t,s);return[{...n,...i},a||o,l]},[{},null,1]).slice(0,2)}function yN(...e){return(t,n)=>{const o={};let s;for(s=0;s<e.length;s++)o[e[s]]=gN(t[n+s]);return[o,null,n+s]}}const wN=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,qoe=`(?:${wN.source}?(?:\\[(${vN.source})\\])?)?`,CN=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,bN=RegExp(`${CN.source}${qoe}`),X0=RegExp(`(?:[Tt]${bN.source})?`),Yoe=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Xoe=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Zoe=/(\d{4})-?(\d{3})/,Joe=yN("weekYear","weekNumber","weekDay"),Qoe=yN("year","ordinal"),ese=/(\d{4})-(\d\d)-(\d\d)/,SN=RegExp(`${CN.source} ?(?:${wN.source}|(${vN.source}))?`),tse=RegExp(`(?: ${SN.source})?`);function md(e,t,n){const o=e[t];return Zv(o)?n:gN(o)}function nse(e,t){return[{year:md(e,t),month:md(e,t+1,1),day:md(e,t+2,1)},null,t+3]}function vd(e,t){return[{hours:md(e,t,0),minutes:md(e,t+1,0),seconds:md(e,t+2,0),milliseconds:zoe(e[t+3])},null,t+4]}function np(e,t){const n=!e[t]&&!e[t+1],o=mN(e[t+1],e[t+2]),s=n?null:fd.instance(o);return[{},s,t+3]}function op(e,t){const n=e[t]?Xv.create(e[t]):null;return[{},n,t+1]}pd(Yoe,X0),pd(Xoe,X0),pd(Zoe,X0),pd(bN),gd(nse,vd,np,op),gd(Joe,vd,np,op),gd(Qoe,vd,np,op),gd(vd,np,op),gd(vd),pd(ese,tse),pd(SN),gd(vd,np,op);var Mo=function(e){return e.review="{reviewDomain}/{ws_code}",e.review_take="{reviewDomain}/{ws_code}?id={take_id}",e.review_scene="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&tab=iteration",e.review_rendition="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}",e.review_frame="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&rendition_id={rendition_id}&tab=comment&refresh_marker=true#type=frame&data={frame}",e.review_rendition_comment="{reviewDomain}/{ws_code}?scene_id={scene_id}&rendition_id={rendition_id}&comment_id={comment_id}&tab=comment",e.review_comment="{reviewDomain}/{ws_code}?id={take_id}&scene_id={scene_id}&comment_id={comment_id}",e.scene_hub="{baseDomain}/{ws_code}/{scene_id}?o=st",e.hub_rendition="{baseDomain}/{ws_code}/{scene_id}?o=st&renditionId={rendition_id}",e.hub_comment="{baseDomain}/{ws_code}/{scene_id}?o=st&comment_id={comment_id}",e.people_insight="{baseDomain}/{ws_code}/{user_id}?o=pt",e.people_detail="{baseDomain}/{ws_code}/ws/ppl/{display_name}-{user_id}",e.project="{baseDomain}/{ws_code}/pl/dir/{entity_id}",e.project_focusMode="{baseDomain}/{ws_code}/pl/dir/{parent_id}?f={entity_id}",e.woohoo="{baseDomain}/{ws_code}/pl/woo/rpt/{woohoo_id}",e.update="{baseDomain}/{ws_code}/pl/au?id={entity_id}",e.core="{baseDomain}/{ws_code}",e}(Mo||{});Mo.review,Mo.review_take,Mo.review_scene,Mo.review_rendition,Mo.review_frame,Mo.review_rendition_comment,Mo.review_comment,Mo.scene_hub,Mo.hub_rendition,Mo.hub_comment,Mo.people_insight,Mo.people_detail,Mo.project,Mo.woohoo,Mo.update,Mo.core,Mo.project_focusMode;var Z0=null;function ose(e){Z0=e}function ey(){if(!Z0)throw new Error("i18n instance not set. Call setI18nInstance(i18n) before using errorHelper.");return Z0}function EN(){try{var e=sessionStorage.getItem("APP_DEBUG")?"✅":"",t=ey();return"".concat(t.t("errorMessages.fallback.unknownError")," ").concat(e)}catch{return"An error occurred. Please try again or contact support."}}function sse(e,t,n,o){var s=e.replace(/{field}/g,t);if(o&&kc(o)==="object")Object.keys(o).forEach(function(i){var a="{".concat(i,"}"),l=o[i];Array.isArray(l)?l=l.join(", "):i==="value"&&(o.min||o.max)&&(l="".concat(o.min||o.value," and ").concat(o.max||o.value)),s=s.replace(new RegExp(a,"g"),l||"")});else if(Array.isArray(n)&&n.length>0){var r=n[0]||"";n.length>1?r="".concat(n[0]," and ").concat(n[1]):n.length===1&&Array.isArray(n[0])&&(r=n[0].join(", ")),s=s.replace(/{value}/g,r)}return s}function rse(e,t){for(var n=Object.keys(t),o=0,s=n;o<s.length;o++){var r=s[o],i=Array.isArray(t[r])?t[r].join(", "):String(t[r]);e=e.replace(new RegExp("\\{".concat(r,"\\}"),"g"),i)}if(n.length>0&&e.includes("{value}")){var a=t[n[0]],l=Array.isArray(a)?a.join(", "):String(a);e=e.replace(/{value}/g,l)}return e}function _N(e){return!!(e&&e.validation&&e.validation.fields&&Object.keys(e.validation.fields).length>0)}function RN(e,t){if(!e||kc(e)!=="object")return null;try{var n=ey();if(e.validation&&e.validation.fields)for(var o=e.validation.fields,s=Object.keys(o),r=0,i=s;r<i.length;r++){var a=i[r],l=o[a];if(l&&l.rule){var c=l.rule,u=l.data||[],d=l.params||{};try{var h,f,p=((h=n.messages)===null||h===void 0?void 0:h.value)||n.messages,g=((f=n.locale)===null||f===void 0?void 0:f.value)||n.locale,v=null;if(t){var C,S=t.toUpperCase();v=(C=p[g])===null||C===void 0||(C=C.errorMessages)===null||C===void 0||(C=C[S])===null||C===void 0||(C=C.validation_rules)===null||C===void 0?void 0:C[c]}if(!v){var b;v=(b=p[g])===null||b===void 0||(b=b.errorMessages)===null||b===void 0||(b=b.GEN)===null||b===void 0||(b=b.validation_rules)===null||b===void 0?void 0:b[c]}if(v&&typeof v=="string")return sse(v,a,u,d)}catch(y){console.error("Error in validation rules",y)}}}}catch(y){return console.error("Error in getValidationErrorMessage:",y),null}return null}function TN(e){var t=sessionStorage.getItem("APP_DEBUG")?"✅":"";if(!e)return EN();var n=e.code,o=e.error,s=e.details,r=e.message;if(_N(s)&&s){var i=RN(s,o==null?void 0:o.type);if(sessionStorage.getItem("APP_DEBUG")&&console.log("[Error Utils Debug]",i),i)return n!==""?"[".concat(n,"] ").concat(i," ").concat(t):"".concat(i);try{var a=ey();return a.t("errorMessages.GEN.validation_error")}catch{return"Validation error occurred."}}if(o&&kc(o)==="object"&&o.type&&o.key){var l=o.type.toUpperCase();try{var c,u,d,h="errorMessages.".concat(l,".").concat(o.key),f=ey(),p=((c=f.messages)===null||c===void 0?void 0:c.value)||f.messages,g=((u=f.locale)===null||u===void 0?void 0:u.value)||f.locale,v=(d=p[g])===null||d===void 0||(d=d.errorMessages)===null||d===void 0||(d=d[l])===null||d===void 0?void 0:d[o.key];if(v&&typeof v=="string"){var C=v;return s!=null&&s.context&&(C=rse(C,s.context),sessionStorage.getItem("APP_DEBUG")&&console.log("[Error Utils Debug]",C)),n!==""?"[".concat(n,"] ").concat(C," ").concat(t):"".concat(C," ").concat(t)}}catch(b){console.error("[Error Utils Debug]",b)}}if(o&&kc(o)!=="object"&&_N(s)){var S=RN(s);if(S)return n!==""?"[".concat(n,"] ").concat(S," ").concat(t):"".concat(S," ").concat(t)}return r?"".concat(r):EN()}const Es=Sc("toast",()=>{const e=c=>TN(c),t=c=>{var u;if((c==null?void 0:c.apiCode)==="offline")r({id:"offline",type:"error",message:"You are currently offline. Please check your network connection."});else{const d=TN((u=c==null?void 0:c.res)==null?void 0:u.data);r({id:c==null?void 0:c.apiCode,type:"error",message:d})}},n=H([]),o=(c,u)=>{const d=Ooe[c];if(d){const h=d[u];if(h){r({id:c,type:u,message:h});return}}else r({id:c,type:u,message:c})},s=new Map,r=(c,u=5e3)=>{const d={...c,id:c.id??Date.now()+Math.random()};if(n.value.push(d),u>0){const h=Date.now(),f=setTimeout(()=>{i(d.id),s.delete(d.id)},u);s.set(d.id,{timeoutId:f,remainingTime:u,startTime:h})}};function i(c){n.value=n.value.filter(d=>d.id!==c);const u=s.get(c);u&&(clearTimeout(u.timeoutId),s.delete(c))}function a(c){const u=s.get(c);if(u){clearTimeout(u.timeoutId);const d=Date.now()-u.startTime;u.remainingTime=Math.max(0,u.remainingTime-d)}}function l(c){const u=s.get(c);if(u&&u.remainingTime>0){const d=setTimeout(()=>{i(c),s.delete(c)},u.remainingTime);u.timeoutId=d,u.startTime=Date.now()}}return{notifications:n,addNotification:r,removeNotification:i,showMessage:o,showErrorNetMessage:t,pauseAutoDismiss:a,resumeAutoDismiss:l,getErrorMessageFromResponse:e}}),ise={style:{"max-width":"225px","line-height":"14px"}},ase={style:{"max-width":"100px","line-height":"14px"}},DN=500,lse=bt(tt({__name:"BulkUpdate",props:{selectRowData:{},workspaceId:{},entityId:{},gridApi:{},selectedAll:{type:Boolean},takeName:{},totalRows:{},visibleRows:{},loading:{type:Boolean}},emits:["close","assignStatus","assignAssignee","assignDate","assignMetric","moreActions","deleteSelected","unselect","updated","selectAll","refreshSelectedRow"],setup(e,{emit:t}){const n=Kt,o=Uo,s=e,r=t,i=qv(),{handelSelectAll:a}=i,{selectionStatus:l}=us(i),c=Y(()=>l.value===At.CHECKED),u=Y(()=>s.selectRowData.map(oe=>oe.id)),d=Y(()=>s.selectRowData.length>0);ui("bulkUpdate",d),ui("isSelectAll",c);const h=(oe,ae,ue)=>{const xe=oe.getRowNode(ae);xe&&xe.setData({...xe.data,...ue})},f=({itemIds:oe,data:ae})=>{const ue=s.gridApi;if(!ue){console.error("Grid API is undefined");return}oe.forEach(xe=>{const le=ue.getRowNode(xe);le&&!le.data.isLocked&&le.setData({...le.data,status:ae})})},p=({itemIds:oe,data:ae})=>{const ue=s.gridApi;if(!ue){console.error("Grid API is undefined");return}oe.forEach(xe=>{const le=ue.getRowNode(xe);if(le){const M=le.data.dateRange||[null,null];"startDate"in ae&&ae.startDate!==void 0&&(M[0]=ae.startDate?new Date(ae.startDate):null),"dueDate"in ae&&ae.dueDate!==void 0&&(M[1]=ae.dueDate?new Date(ae.dueDate):null);const $={...le.data,dateRange:M};le.setData($)}}),r("updated")},g=oe=>{const ae=s.gridApi,{id:ue,value:xe}=oe;if(!ae){console.error("Grid API is undefined");return}u.value.forEach(le=>h(ae,le,{[`metric_${ue}`]:xe})),r("updated")},v=["primary"],C=[{label:"Rename",icon:"Pen",id:"bulk-rename",type:"icon",value:"bulk-rename"},{label:"Delete Thumbnail",icon:"Image",id:"delete-thumbnail",type:"icon",value:"delete-thumbnail"},{label:"Delete Rendition",icon:"Film",id:"delete-rendition",type:"icon",value:"delete-rendition"},{label:"Unarchive",value:"UnBoxArchive",type:"icon",icon:"BoxArchive",id:"unarchive",clickable:!0},{label:"Archive",value:"BoxArchive",type:"icon",icon:"BoxArchive",id:"archive",clickable:!0},{label:"Delete",value:"delete",type:"icon",icon:"TrashCan",id:"delete",danger:!0,clickable:!0}],S=()=>{r("unselect")},b=r0(),{userPermissions:y}=us(b),_=Y(()=>y.value.includes(i0)),E=Y(()=>{if(!_.value){console.error("User does not have permission to open review.");return}return l.value==At.CHECKED?ls({type:"review_take",config:{reviewDomain:fn.getInstance().getItem("BASE_REVIEW_URL"),ws_code:s.workspaceId,take_id:s.entityId}}).url:ls({type:"review_multiple_scenes",config:{reviewDomain:fn.getInstance().getItem("BASE_REVIEW_URL"),ws_code:s.workspaceId,scene_ids:u.value.join(",")}}).url}),D=oe=>{const{assignees:ae,type:ue}=oe,xe=s.gridApi;if(!xe){console.error("Grid API is not available for bulk update.");return}const le=new Set(ae.map(M=>M.id));u.value.forEach(M=>{const $=xe.getRowNode(M);if(!$)return;const Ce=$.data.assignees||[];let Ee=[];switch(ue){case"add":{const me=new Set(Ce.map($e=>$e.id));Ee=[...Ce,...ae.filter($e=>!me.has($e.id))];break}case"overwrite":Ee=ae;break;case"remove":Ee=Ce.filter(me=>!le.has(me.id));break;case"removeAll":Ee=[];break}$.setData({...$.data,assignees:Ee})})},{apiServices:T}=io(!1,s),P=H(null),L=In("filterParams",void 0),I=Y(()=>({workspaceId:String(s.workspaceId),itemIds:d.value&&c.value?[]:u.value,entityId:s.entityId,filterParams:L!=null&&L.value?L.value:void 0})),x=async()=>{var xe;const oe=u.value,ae=s.gridApi;if(!ae){console.error("Grid API is not available for bulk delete.");return}const ue=await((xe=T.value)==null?void 0:xe.bulkDeleteItems(I.value));(ue==null?void 0:ue.message)=="Done"&&(oe.forEach(le=>h(ae,le,{isDeleted:!0,disabled:!0})),ae.deselectAll())},O=async({request:oe,apiUnavailableMessage:ae,failureMessage:ue,onSuccess:xe})=>{var Ce,Ee;const le=u.value,M=s.gridApi;if(!M){console.error(ae);return}const $=await oe();if(($==null?void 0:$.message)!="Done"){console.error(ue),(Ce=P.value)==null||Ce.open();return}xe(le,M),(Ee=P.value)==null||Ee.hide()},N=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.bulkUnarchiveItems(I.value)},apiUnavailableMessage:"Grid API is not available for bulk unarchive.",failureMessage:"Failed to unarchive items.",onSuccess:oe=>Q(oe,"isArchived",!1)}),F=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.bulkArchiveItems(I.value)},apiUnavailableMessage:"Grid API is not available for bulk archive.",failureMessage:"Failed to archive items.",onSuccess:oe=>Q(oe,"isArchived",!0)}),z=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.deleteThumbnail(I.value)},apiUnavailableMessage:"Grid API is not available for bulk thumbnail deletion.",failureMessage:"Failed to delete thumbnails.",onSuccess:(oe,ae)=>oe.forEach(ue=>h(ae,ue,{thumbnail:null}))}),j=()=>O({request:()=>{var oe;return(oe=T.value)==null?void 0:oe.deleteRendition(I.value)},apiUnavailableMessage:"Grid API is not available for bulk rendition deletion.",failureMessage:"Failed to delete renditions.",onSuccess:(oe,ae)=>oe.forEach(ue=>h(ae,ue,{rendition:null}))}),Q=(oe,ae,ue)=>{const xe=s.gridApi;if(!xe){console.error("Grid API is not available for bulk update.");return}const le=[];oe.forEach(M=>{const $=xe.getRowNode(M);$&&($.setData({...$.data,[ae]:typeof ue=="function"?ue():ue}),le.push($))}),xe.redrawRows({rowNodes:le})},re=H(!1),q=H(null),V=async oe=>{var ae,ue,xe;try{switch(G.value=!0,re.value=!0,oe.id){case"unarchive":await N();break;case"delete":await x();break;case"archive":await F();break;case"delete-thumbnail":await z();break;case"delete-rendition":await j();break;case"bulk-rename":await Ge(),(ae=P.value)==null||ae.hide();break;default:console.error("Unknown action:",oe.id),re.value=!1;break}}catch(le){console.error("Error performing action:",le),(ue=P.value)==null||ue.open()}finally{(xe=q.value)==null||xe.focus(),ft(()=>{G.value=!1,re.value=!1})}},k=(oe,ae)=>{var ue;!oe&&ae&&((ue=q.value)==null||ue.focus())},G=H(!0),ee=oe=>{ft(()=>{G.value=oe})};Qe(()=>s.selectRowData,()=>{G.value=!1},{deep:!0,immediate:!0});const ge=Y(()=>({workspaceId:s.workspaceId,entityId:s.entityId,variant:v,disabled:G.value,ids:l.value==At.CHECKED?[]:u.value})),Fe=H(null),Ge=async()=>{var oe;(oe=Fe.value)==null||oe.show()},fe=Y(()=>s.selectRowData.map((oe,ae)=>({name:oe.name,index:ae}))),X=(oe,{currentName:ae,counterValue:ue})=>oe.map(xe=>{switch(xe.type){case"text":return xe.value;case"current_name":return ae;case"counter":return ue;default:return""}}).join(""),we=(oe,ae)=>{const ue=oe.find(xe=>xe.type==="counter");return ue?aN({type:ue.format,direction:ue.direction==="asc"?"up":"down",first:ue.value,step:ue.step,count:ae}):[]},de=(oe,ae)=>{const ue=new Map(s.selectRowData.map(le=>[le.id,le.name||""])),xe=we(oe,ae.length);return ae.map((le,M)=>{const $=ue.get(le)??"",Ce=X(oe,{currentName:$,counterValue:xe[M]??""});return{id:le,from:$,to:Ce}})},B=({parameters:oe,segments:ae,renamedItems:ue,status:xe,response:le,error:M})=>{var Se,Me,Ct;const $=M!==void 0,Ce=xe.status??((Se=M==null?void 0:M.response)==null?void 0:Se.status),Ee=s.selectRowData.length,me=oe.itemIdsCount??null,$e=new Set(ue.map(Rt=>Rt.to)).size,Ye=[$?`FAILED: ${(M==null?void 0:M.message)??"unknown error"} (HTTP ${Ce??"n/a"})`:Ce===202?"OK: HTTP 202, rename queued; table names unchanged, rows set to processing (state 1)":`OK: request resolved (HTTP ${Ce??"unknown"})`,me===null?`Select-all: server resolves items from entity (${Ee} loaded locally)`:me===Ee?`All ${Ee} selected items were sent`:`MISMATCH: ${me} ids sent vs ${Ee} selected`,ue.length?$e===ue.length?"All generated names are unique":`WARNING: ${ue.length-$e} duplicate generated name(s)`:`Names not generated locally (more than ${DN} items); server applies the rename`,le==null||le===""?"Response body is empty":"Response body received"];console.group("[BulkRename] report"),console.log("1. Parameters",oe),console.log("2. Input (segments)",ae),console.log("2. Input (rows)",ue.map(({id:Rt,from:Lt})=>({id:Rt,name:Lt}))),console.log("3. Output (new names)"),console.table(ue),console.log("4. API status",{ok:!$,httpStatus:Ce??null,statusText:xe.statusText??((Me=M==null?void 0:M.response)==null?void 0:Me.statusText)??null}),console.log("5. Response body",$?((Ct=M==null?void 0:M.response)==null?void 0:Ct.data)??M:le),console.log("6. Conclusion",Ye.join(`
160
160
  - `)),console.groupEnd()},te=async oe=>{var Se,Me,Ct,Rt;if(!s.workspaceId||!s.entityId)return;const ae=ne(),ue={item_ids:ae,segments:oe};c.value&&(delete ue.item_ids,ue.entity_id=s.entityId);const xe={workspaceId:s.workspaceId,entityId:s.entityId,payload:ue,filter:L!=null&&L.value?L.value:void 0},le=s.selectRowData.length>DN,M=le?[]:de(oe,ae);let $={};const Ce=Lt=>{var qt;console.log("onCallApi event",Lt),((qt=Lt.res)==null?void 0:qt.status)==202&&(Es().addNotification({message:"Rename queued. This may take a moment. Names will update when complete",type:"interactive",id:"bulk-rename-queued"}),Q(ae,"isProcessing",{state:1}))};(Se=T.value)==null||Se.on("call-api",Ce);let Ee,me;try{Ee=await((Me=T.value)==null?void 0:Me.bulkRename(xe))}catch(Lt){throw me=Lt,Lt}finally{(Ct=T.value)==null||Ct.off("call-api",Ce),B({parameters:{workspaceId:xe.workspaceId,entityId:xe.entityId,isSelectAll:c.value,itemIdsCount:((Rt=ue.item_ids)==null?void 0:Rt.length)??null,itemIds:ue.item_ids,filter:xe.filter},segments:oe,renamedItems:M,status:$,response:Ee,error:me})}if($.status===202||le){Q(ae,"isProcessing",{state:1});return}const Ye=s.gridApi;Ye&&(M.forEach(({id:Lt,to:qt})=>{const tn=Ye.getRowNode(Lt);tn&&tn.setDataValue("name",qt)}),r("refreshSelectedRow"))},ne=()=>{const oe=s.gridApi;return oe==null?[]:s.selectRowData.map(ae=>{var ue;return[ae.id,(ue=oe.getRowNode(ae.id))==null?void 0:ue.rowIndex]}).sort((ae,ue)=>ae[1]-ue[1]).map(([ae])=>ae)};return(oe,ae)=>qe((K(),ce("div",{class:se(oe.$style["bulk-update-action"])},[Te("div",{class:se(oe.$style["left-actions"])},[Te("div",{class:se(oe.$style["selection-track"])},[ye(pt,{class:se(oe.$style["btn-close"]),variant:["tertiary","icon"],onClick:S,style:{background:"transparent"}},{prefix:be(()=>[ye(ct,{src:"XMarkSolid",source:"remote"})]),_:1},8,["class"]),W(l)==W(At).INDETERMINATE?(K(),ce("span",{key:0,class:se(oe.$style["selected-count"])},it(e.selectRowData.length)+" selected ",3)):Xe("",!0),W(l)==W(At).CHECKED?(K(),ce("span",{key:1,class:se(oe.$style["selected-count"]),style:{"line-height":"14px"}},[ae[12]||(ae[12]=nt(' All in  " ',-1)),qe((K(),ce("span",ise,[nt(it(e.takeName),1)])),[[W(n),{content:e.takeName}]]),ae[13]||(ae[13]=nt(' " ',-1))],2)):Xe("",!0),!e.loading&&W(l)==W(At).INDETERMINATE&&e.totalRows>e.selectRowData.length&&e.selectRowData.length==e.visibleRows?(K(),ze(pt,{key:2,variant:"secondary",onHandleClick:W(a)},{default:be(()=>[Te("span",{class:se(oe.$style["selected-count"]),style:{"line-height":"14px"}},[ae[14]||(ae[14]=nt(' Select all in  " ',-1)),qe((K(),ce("span",ase,[nt(it(e.takeName),1)])),[[W(n),{content:e.takeName}]]),ae[15]||(ae[15]=nt(' " ',-1))],2)]),_:1},8,["onHandleClick"])):Xe("",!0),Te("span",{class:se(oe.$style.divider)},null,2)],2),ye(noe,jt(ge.value,{onUpdated:f,onUpdateStart:ae[0]||(ae[0]=ue=>G.value=!0),onUpdateCompleted:ae[1]||(ae[1]=ue=>ee(!1)),onUpdateFailed:ae[2]||(ae[2]=ue=>ee(!1)),"selected-all":W(l)==W(At).CHECKED}),null,16,["selected-all"]),ye(MJ,jt({onUpdate:D,onUpdateStart:ae[3]||(ae[3]=ue=>G.value=!0),onUpdateCompleted:ae[4]||(ae[4]=ue=>ee(!1)),onUpdateFailed:ae[5]||(ae[5]=ue=>ee(!1)),"selected-all":W(l)==W(At).CHECKED},ge.value),null,16,["selected-all"]),ye(qJ,jt({"row-selected":e.selectRowData,"selected-all":W(l)==W(At).CHECKED},ge.value,{onUpdated:p,onUpdateStart:ae[6]||(ae[6]=ue=>G.value=!0),onUpdateCompleted:ae[7]||(ae[7]=ue=>ee(!1)),onUpdateFailed:ae[8]||(ae[8]=ue=>ee(!1))}),null,16,["row-selected","selected-all"]),ye(Qne,{disabled:G.value,onUpdate:g,onUpdateStart:ae[9]||(ae[9]=ue=>G.value=!0),onUpdateCompleted:ae[10]||(ae[10]=ue=>ee(!1)),onUpdateFailed:ae[11]||(ae[11]=ue=>ee(!1)),selectedIds:u.value,"workspace-id":e.workspaceId,variant:v,"entity-id":e.entityId,"selected-all":W(l)==W(At).CHECKED},null,8,["disabled","selectedIds","workspace-id","entity-id","selected-all"]),Te("span",{class:se(oe.$style.divider)},null,2),qe((K(),ce("div",null,[_.value?(K(),ze(pt,{key:0,class:se(oe.$style["action-button"]),variant:[...v,"icon"],href:E.value,disabled:s.selectRowData.length>40&&W(l)!=W(At).CHECKED},{default:be(()=>[ye(ct,{src:"PenRuler",class:se(oe.$style["icon-btn"])},null,8,["class"])]),_:1},8,["class","variant","href","disabled"])):Xe("",!0)])),[[W(n),s.selectRowData.length<=40||W(l)==W(At).CHECKED?"Open in Review":"Select fewer than 40 items to open in Review"]]),Te("span",{class:se(oe.$style.divider)},null,2),ye(Hf,{ref_key:"wrapperRef",ref:P,isUpdating:G.value,disabled:G.value,onOnVisibleChange:k},{trigger:be(({hide:ue,toggle:xe,isVisible:le,disabled:M})=>[qe((K(),ze(pt,{onEscape:ue,actived:le,ref_key:"moreActionRef",ref:q,class:se(oe.$style["action-button"]),variant:["secondary","icon"],loading:re.value,disabled:M||G.value,onClick:Nt(xe,["stop"])},{default:be(()=>[ye(ct,{src:"EllipsisVertical",class:se(oe.$style.icon),source:"remote"},null,8,["class"])]),_:1},8,["onEscape","actived","class","loading","disabled","onClick"])),[[W(o),"99999"],[W(n),{content:"More actions"}]])]),popup:be(({isVisible:ue,hide:xe})=>[(K(),ce(Ft,null,Pn(C,(le,M)=>ye(Ec,jt({clickable:!0,key:le.id},{ref_for:!0},le,{show:ue,style:{borderLeft:0},"focus-index":"99999."+M,onClick:()=>{V(le)},onEscape:xe}),null,16,["show","focus-index","onClick","onEscape"])),64))]),_:1},8,["isUpdating","disabled"])],2),ye(Aoe,{item:fe.value,totalItem:fe.value.length,onRename:te,ref_key:"bulkRenameButtonRef",ref:Fe},null,8,["item","totalItem"])],2)),[[lr,e.selectRowData.length>0]])}}),[["__cssModules",{$style:{"bulk-update-action":"_bulk-update-action_1odua_1","left-actions":"_left-actions_1odua_20","right-actions":"_right-actions_1odua_21","selection-track":"_selection-track_1odua_26","btn-close":"_btn-close_1odua_32","close-icon":"_close-icon_1odua_38","selected-count":"_selected-count_1odua_42",divider:"_divider_1odua_48","more-button":"_more-button_1odua_53",dropdown:"_dropdown_1odua_57","dropdown-content":"_dropdown-content_1odua_60",delete:"_delete_1odua_83","icon-btn":"_icon-btn_1odua_90","selected-list":"_selected-list_1odua_94"}}]]),pl=bt(tt({name:"LabelRenderer",__name:"LabelRenderer",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean}},setup(e){const t=Ns,n=Kt,o=e,s=Y(()=>({disabled:o.disabled,error:!1,readOnly:o.readOnly,isEmpty:o.value===void 0||o.value===null||o.value==="",clickable:!0})),{argsMain:r}=To(s),i=Y(()=>{var c,u,d;return!!((c=o.params)!=null&&c.api||(u=o.params)!=null&&u.node||(d=o.params)!=null&&d.context)}),a=Y(()=>{if(o.tooltip){if(typeof o.tooltip=="string")return{content:o.tooltip};if(typeof o.tooltip=="object"&&"display_name"in o.tooltip){const c=o.tooltip,u=document.createElement("div");u.classList.add("tooltip-user-info"),u.style.display="flex",u.style.alignItems="center",u.style.gap="4px";const d=document.createElement("div"),h=ye(df,{id:c.id,name:c.display_name,profile_image:c.profile_image,size:20,initial:c.initial,color:c.color});eb(h,d);const f=document.createElement("span");f.innerText=c.display_name,f.classList.add("tooltip-user-name");const p=document.createElement("span");p.style.whiteSpace="nowrap",p.innerText="By",u.appendChild(p),u.appendChild(d),u.appendChild(f);const g=document.getElementById("item-table-layout-id");return{content:u,allowHtml:!0,appendTo:g||document.body,bypassOverflowCheck:!0}}}return{content:void 0}}),l=Y(()=>o.value===void 0);return(c,u)=>qe((K(),ze(Fo,jt(W(r),{ref:"displayWrapperRef"}),{default:be(()=>[Te("span",{class:se(c.$style["item-table-label-renderer"])},it(o.value||"-"),3)]),_:1},16)),[[W(t),{isLoading:l.value||!i.value}],[W(n),a.value]])}}),[["__cssModules",{$style:{"item-table-label-renderer":"_item-table-label-renderer_s1gdy_1"}}]]),cse=["placeholder","maxlength"],use={key:0,class:"wrapper-suffix"},dse=bt(tt({name:"LabelEditor",__name:"LabelEditor",props:{value:{},placeholder:{default:"Enter name"},disabled:{type:Boolean},readOnly:{type:Boolean},maxLength:{},saveOnBlur:{type:Boolean,default:!0},bordered:{type:Boolean},keyboardFocusing:{type:Boolean}},emits:["update:value","enter","blur"],setup(e,{expose:t,emit:n}){const o=Ns,s=Kt,r=e,i=n,a=H(r.value),l=H(null),c=H(null),u=H(r.value||""),d=H(!1),h=H(!1),f=Y(()=>{var I;return{disabled:r.disabled,error:!1,readOnly:r.readOnly,isEmpty:((I=r.value)==null?void 0:I.length)===0,inputRef:l,wrapperRef:c,clickable:!0,focused:d.value||r.keyboardFocusing}}),{argsMain:p,isHover:g}=To(f),v=()=>u.value!==a.value,C=()=>{h.value=!0,d.value=!1,u.value=a.value,i("update:value",a.value),setTimeout(()=>{h.value=!1},100)},S=()=>{if(!d.value||!l.value)return;const I=l.value.value;if(!v()){d.value=!1;return}a.value=I,i("update:value",I),i("enter",I),d.value=!1},b=()=>{h.value||(r.saveOnBlur?S():C(),i("blur",u.value))},y=I=>{var x;if(I.key==="ArrowLeft"||I.key==="ArrowRight"){I.stopPropagation();return}I.ctrlKey&&(I.key=="a"||I.key=="A")?(I.stopPropagation(),(x=l.value)==null||x.select()):I.key==="Enter"?(I.preventDefault(),I.stopPropagation(),S()):I.key==="Escape"&&(I.preventDefault(),I.stopPropagation(),C())},_=()=>{a.value=r.value,u.value=r.value,d.value=!0,ft(()=>{var I,x;(I=l.value)==null||I.click(),(x=l.value)==null||x.focus()})},E=()=>{var I;d.value?C():(I=l.value)==null||I.blur(),i("blur",u.value)},D={focus:()=>{_()}};en(()=>{var x;const I=(x=c.value)==null?void 0:x.$el;I&&(I.__sceneNameEditor=D)}),Jn(()=>{const I=c.value;I&&delete I.__sceneNameEditor});const T=H(null),P=H(null);t({focus:_,blur:()=>{var I;return(I=l.value)==null?void 0:I.blur()},save:S,cancel:C,focusEditButton:()=>{ft(()=>{var I;(I=T.value)==null||I.focus()})},focusCancelButton:()=>{ft(()=>{var I;(I=P.value)==null||I.focus()})},startEdit:_});const L=Y(()=>r.value===void 0);return c0(c,()=>{d.value&&b()}),(I,x)=>qe((K(),ze(W(Fo),jt(W(p),{ref_key:"wrapperRef",ref:c,bordered:r.bordered,style:{paddingTop:"0px",paddingBottom:"0px"}}),Lh({default:be(()=>[d.value?Xe("",!0):xt(I.$slots,"default",{isEditting:d.value,isHover:W(g)},()=>[qe((K(),ce("span",{class:se(I.$style["label-renderer"])},[nt(it(u.value),1)],2)),[[W(s),{content:u.value||void 0}]])],void 0,0),qe(Te("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":x[0]||(x[0]=O=>u.value=O),class:se(I.$style["label-editor"]),placeholder:e.placeholder,maxlength:e.maxLength,onKeydown:y,onBlur:b},null,42,cse),[[lr,d.value],[Q1,u.value]])]),_:2},[!e.disabled&&!e.readOnly?{name:"suffix",fn:be(({hovered:O,focused:N})=>[O?(K(),ce("div",use,[O&&!N?qe((K(),ze(pt,{key:0,variant:["icon","secondary"],size:24,onClick:Nt(_,["prevent","stop"]),tabindex:"0",ref_key:"editButtonRef",ref:T,onKeydown:[Yn(Nt(_,["prevent","stop"]),["enter"]),Yn(Nt(E,["prevent","stop"]),["escape"])]},{default:be(()=>[ye(W(ct),{src:"Pen",source:"remote"})]),_:1},8,["onKeydown"])),[[W(s),"Edit"]]):Xe("",!0)])):Xe("",!0)]),key:"0"}:void 0]),1040,["bordered"])),[[W(o),{isLoading:L.value}]])}}),[["__cssModules",{$style:{"label-renderer":"_label-renderer_cyzth_1","label-editor":"_label-editor_cyzth_10"}}]]),hse=["tabindex"],IN=bt(tt({name:"SceneNameEditor",__name:"SceneNameEditor",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},placeholder:{default:"Enter name"}},emits:["update:value","enter","blur"],setup(e,{expose:t,emit:n}){const o=Kt,s=Ns,r=e,i=n,a=H(r.value),l=H(r.value),c=H(null),u=H(null),d=In("bulkUpdate",!1),{apiServices:h}=io(!d,r),f=Y(()=>{var q;return{componentType:void 0,disabled:r.disabled,error:!1,readOnly:r.readOnly,isEmpty:((q=a==null?void 0:a.value)==null?void 0:q.length)===0,inputRef:c,wrapperRef:u,clickable:!0}}),{isFocus:p}=To(f),g=Y(()=>{const q=fn.getInstance().getItem("ws.code"),V=fn.getInstance().getItem("BASE_URL"),k=q||r.workspaceId;return ls({type:"scene_hub",config:{baseDomain:V,ws_code:k,scene_id:String(r.id)}}).url}),v=Y(()=>{var q,V,k;return((V=(q=r.data)==null?void 0:q.isProcessing)==null?void 0:V.state)==0||((k=r.data)==null?void 0:k.isDeleted)==!0}),C=Y(()=>r.readOnly||E.value),S=Y(()=>{var q,V,k,G,ee;return((q=r.data)==null?void 0:q.isDeleted)==!0||((k=(V=r.data)==null?void 0:V.isProcessing)==null?void 0:k.state)==0||((ee=(G=r.data)==null?void 0:G.isProcessing)==null?void 0:ee.state)==1}),b=Y(()=>{var q,V;return(V=(q=r.data)==null?void 0:q.isProcessing)==null?void 0:V.message}),y=Y(()=>{var q;return((q=r.data)==null?void 0:q.isArchived)==1}),_=Y(()=>{var q;return((q=r.data)==null?void 0:q.isLocked)==1}),E=Y(()=>r.value===void 0),D=Y(()=>{var q,V;return((V=(q=r.data)==null?void 0:q.permissions)==null?void 0:V.has_edit_permission)==1}),T=async q=>{var V,k,G,ee,ge,Fe,Ge,fe,X,we;a.value=q,p.value=!1;try{const de=await((k=(V=h.value)==null?void 0:V.updateSceneName)==null?void 0:k.call(V,{workspaceId:r.workspaceId,entityId:r.entityId,itemId:r.id,name:a.value})),B=lv.get(rF)||"UTC";if(de){const te=cF(de,B),ne={...r.data,...te};(G=r.params)==null||G.api.clearFocusedCell();const oe=((ge=(ee=r.params)==null?void 0:ee.column)==null?void 0:ge.getColId())||"",ae=((Ge=(Fe=r.params)==null?void 0:Fe.node)==null?void 0:Ge.rowIndex)||0;(fe=r.params)==null||fe.api.setFocusedCell(ae,oe),(we=(X=r.params)==null?void 0:X.node)==null||we.setData(ne),l.value=a.value,i("enter")}else a.value=l.value}catch(de){console.error("Failed to update scene name:",de),a.value=l.value}},P={focus:()=>{p.value=!0,ft(()=>{var q;return(q=u.value)==null?void 0:q.focus()})},startEdit:()=>{var q;(q=u.value)==null||q.startEdit()}},L=()=>u.value?"$el"in u.value?u.value.$el:u.value:null;Qe(()=>r.value,q=>{a.value=q,l.value=q}),en(()=>{const q=L();q&&(q.__sceneNameEditor=P)}),Jn(()=>{const q=u.value,V=q&&"$el"in q?q.$el:q;V&&delete V.__sceneNameEditor});const I=Vf(),{openSceneHub:x}=I,O=q=>{try{if(q.ctrlKey||q.metaKey){window.open(g.value,"_blank");return}x(String(r.id))}catch{window.open(g.value,"_blank")}finally{Q()}},N=()=>{setTimeout(()=>{re.value=!0,F.value=0,ft(()=>{var q;(q=z.value)==null||q.focus()})},300)},F=H(-1),z=H(null);t({focus:N,trigerFocus:N,startEdit:()=>{var q;(q=u.value)==null||q.startEdit()}});const j=q=>{if(q.key==="Enter"){q.preventDefault(),O(q);return}if(q.key==="Escape"){q.preventDefault(),Q();return}q.key==="Tab"&&(q.preventDefault(),q.stopPropagation(),q.stopImmediatePropagation(),ft(()=>{var V;(V=u.value)==null||V.focusEditButton()}))},Q=()=>{var k,G,ee,ge,Fe,Ge;re.value=!1,F.value=-1,(k=r.params)==null||k.api.clearFocusedCell();const q=((ee=(G=r.params)==null?void 0:G.column)==null?void 0:ee.getColId())||"",V=((Fe=(ge=r.params)==null?void 0:ge.node)==null?void 0:Fe.rowIndex)||0;(Ge=r.params)==null||Ge.api.setFocusedCell(V,q)},re=H(!1);return(q,V)=>qe((K(),ze(dse,{"save-on-blur":!0,ref_key:"wrapperRef",ref:u,disabled:r.disabled,"read-only":C.value,placeholder:r.placeholder,value:a.value,"onUpdate:value":V[0]||(V[0]=k=>a.value=k),id:`scene-name-${r.id}`,onEnter:T,"max-length":255,bordered:!0,keyboardFocusing:re.value,onBlur:Q},{default:be(({isHover:k,isEditting:G})=>[qe(Te("div",{class:se(q.$style["scene-name-display"])},[qe((K(),ce("a",{tabindex:F.value,ref_key:"nameRef",ref:z,onClick:Nt(O,["prevent"]),onKeydown:j,target:"_blank",class:se(q.$style["scene-name-text"]),style:{lineHeight:"28px"}},[nt(it(a.value),1)],42,hse)),[[W(o),{content:a.value,delay:[1e3,0]}]]),C.value||!k&&!G&&!C.value?(K(),ce(Ft,{key:0},[_.value?qe((K(),ce("div",{key:0,class:se([q.$style["icon-processing"],q.$style.isLocked])},[ye(ct,{src:"Lock",color:D.value?"#a6a6a6":"#232323"},null,8,["color"])],2)),[[W(o),{content:D.value?"Locked — You can still edit, or unlock by changing the status from completed":"Locked",delay:[1e3,0]}]]):Xe("",!0),y.value?qe((K(),ce("div",{key:1,class:se([q.$style["icon-processing"],q.$style.archived])},[ye(ct,{src:"BoxArchive"})],2)),[[W(o),{content:"Archived",delay:[1e3,0]}]]):Xe("",!0),S.value?qe((K(),ce("div",{key:2,class:se([q.$style["icon-processing"],q.$style.processing,v.value&&q.$style["icon-red"]])},[ye(ct,{src:"AnimatedHourglass",color:"inherit"})],2)),[[W(o),b.value]]):Xe("",!0)],64)):Xe("",!0)],2),[[lr,!W(p)]])]),_:1},8,["disabled","read-only","placeholder","value","id","keyboardFocusing"])),[[W(s),{isLoading:E.value}]])}}),[["__cssModules",{$style:{"scene-name-editor":"_scene-name-editor_nare0_1","scene-name-display":"_scene-name-display_nare0_11","icon-processing":"_icon-processing_nare0_18",archived:"_archived_nare0_28",locked:"_locked_nare0_31",processing:"_processing_nare0_34","icon-red":"_icon-red_nare0_38","scene-name-text":"_scene-name-text_nare0_43"}}]]),J0=bt(tt({__name:"ButtonDropdown",props:{label:{},value:{},variant:{},options:{default:()=>[]},size:{},placement:{default:"bottom"},disabled:{type:Boolean},readOnly:{type:Boolean},tabIndex:{}},emits:["select","handleClick","open"],setup(e,{expose:t,emit:n}){const o=Uo,s=H([]),r=e,i=H(null),a=Y(()=>typeof r.size=="number"?`${r.size}px`:{small:"24px",medium:"32px",large:"48px"}[r.size]??"32px"),l=Y(()=>{let C=[];return typeof r.variant=="string"?C.push(r.variant):Array.isArray(r.variant)&&(C=[...r.variant]),[...C,"icon"]}),c=n,{hide:u,isVisible:d,show:h,triggerRef:f,popupRef:p,instance:g}=mo({toggleOnClick:!0,offset:[0,0],onShow:()=>c("open")});function v(C){c("select",C),u()}return Mh(()=>{g.value&&g.value.setProps({placement:r.placement})}),t({show:h,hide:u,hideDropdown:()=>{u()},popupRef:p}),Qe(d,C=>{var S;C&&((S=p.value)==null||S.focus())}),(C,S)=>(K(),ce("div",{class:se(C.$style["button-dropdown-wrapper"]),style:hn({"--button-size":a.value})},[Te("div",{class:se(C.$style["button-group"])},[xt(C.$slots,"prefix"),Te("div",{ref_key:"triggerRef",ref:f,class:se(W(d)?C.$style.open:"")},[xt(C.$slots,"triggerDropdown",{open:W(d)},()=>[r.readOnly?Xe("",!0):qe((K(),ze(pt,{key:0,onEscape:W(u),ref_key:"mainButton",ref:i,actived:W(d),class:se(C.$style["button-dropdown-trigger"]),variant:l.value,size:e.size,disabled:r.disabled},{default:be(()=>[xt(C.$slots,"iconDropdown",{},()=>[ye(ct,{class:se(C.$style["icon-dropdown"]),src:"ChevronDown",source:"remote"},null,8,["class"])])]),_:3},8,["onEscape","actived","class","variant","size","disabled"])),[[W(o),e.tabIndex]])])],2)],2),Te("div",{ref_key:"popupRef",ref:p,tabindex:"0",class:se(C.$style["button-dropdown-list"]),style:{borderRadius:"var(--radius-lg)",overflow:"hidden"}},[(K(!0),ce(Ft,null,Pn(e.options,(b,y)=>qe((K(),ze(Ec,jt({ref_for:!0,ref:_=>s.value[y]=_,key:b.value},{ref_for:!0},{...b},{"icon-name":b.icon,onClick:Nt(_=>v(b.value||""),["stop","prevent"]),style:{borderLeft:0}}),{label:be(()=>[nt(it(b.label),1)]),_:2},1040,["icon-name","onClick"])),[[W(o),`${e.tabIndex}.${y}`]])),128))],2)],6))}}),[["__cssModules",{$style:{"button-dropdown-wrapper":"_button-dropdown-wrapper_1g99p_1","button-group":"_button-group_1g99p_7","overflow-elipsis":"_overflow-elipsis_1g99p_26","button-dropdown-list":"_button-dropdown-list_1g99p_33",show:"_show_1g99p_38","button-dropdown-item":"_button-dropdown-item_1g99p_41","icon-dropdown":"_icon-dropdown_1g99p_48",open:"_open_1g99p_51"}}]]),sp=bt(tt({__name:"CloseBadgeWrapper",props:{disableRemove:{type:Boolean,default:!0},tooltip:{default:"Unassign"}},emits:["clear"],setup(e,{emit:t}){const n=Kt,o=e,s=t,r=a=>{a.preventDefault(),a.stopImmediatePropagation(),a.stopPropagation(),s("clear")},i=Y(()=>({content:o.tooltip,contentClass:"extra-padding",appendTo:()=>globalThis.document.body}));return(a,l)=>(K(),ce("div",{class:se(a.$style["close-wrapper"])},[e.disableRemove?Xe("",!0):(K(),ce("div",{key:0,class:se(a.$style["close-button"])},[qe((K(),ze(pt,{variant:["icon","tertiary"],style:{background:"white"},"aria-label":"remove",onClick:r,size:16,rounded:!0},{default:be(()=>[ye(ct,{src:"CircleXMark",size:"16",color:"var(--primary-color)"})]),_:1})),[[W(n),i.value]])],2)),xt(a.$slots,"default")],2))}}),[["__cssModules",{$style:{"close-wrapper":"_close-wrapper_15u1e_1","close-button":"_close-button_15u1e_5"}}]]),fse=bt(tt({name:"AssigneeGroupRenderer",__name:"AssigneeGroupRenderer",props:{disabled:{type:Boolean},readOnly:{type:Boolean,default:!0},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},error:{type:Boolean},maxVisible:{default:4}},setup(e){const t=Kt,n=Ns,o=e,{isEditing:s}=td(o),r=H(o.value),i=H(null),a=H(null),{apiServices:l}=io(!0,o),c=H(!0),u=()=>{c.value=o.value===void 0};Oh(()=>{u()}),en(()=>{u()}),Qe(()=>o.value,T=>{u()});const d=Y(()=>({disabled:o.disabled,readOnly:o.readOnly,error:o.error,inputRef:i,wrapperRef:a,clickable:!(o.readOnly||c.value),active:s})),{argsMain:h,isHover:f}=To(d),p=Y(()=>{var T;return((T=r.value)==null?void 0:T.slice(0,o.maxVisible))||[]}),g=Y(()=>{var T;return Math.max(0,(((T=r.value)==null?void 0:T.length)||0)-o.maxVisible)}),v=Y(()=>{var T;return g.value<=0?"":((T=r.value)==null?void 0:T.slice(o.maxVisible).map(P=>P.name).join(", "))||""}),C=Y(()=>p.value.map(T=>({id:T.id,name:T.name,initial:T.initial,avatarId:T.id,profile_image:T.profile_image,color:T.color,size:24,user:T}))),S=Y(()=>({color:f.value?"var(--primary-color)":"var(--grey-300)",display:"flex",alignItems:"center",marginLeft:"4px"}));Qe(()=>o.value,T=>{r.value=T},{immediate:!0,deep:!0});const b=async T=>{var L,I,x;await D(T)&&(r.value=(L=r.value)==null?void 0:L.filter(O=>O.id!==T),(x=o.params)==null||x.node.setData({...(I=o.params)==null?void 0:I.node.data,assignees:r.value}))},y=T=>{var L;const P=fn.getInstance().getItem("ws.code");return((L=l.value)==null?void 0:L.getUserInformation(P,T))||Promise.resolve(null)},{id:_}=Ag(o),E=T=>{var L,I;const P=(I=(L=o.params)==null?void 0:L.api)==null?void 0:I.getRowNode(String(_.value));P==null||P.setDataValue("assignees",Hm(T.assignees))},{removeAssignee:D}=hv({...o,entityId:o.entityId,updateRowData:E,value:o.value,errorCallback:()=>{}});return(T,P)=>qe((K(),ze(Fo,jt(W(h),{ref_key:"wrapperRef",ref:a,bordered:!0}),{default:be(()=>{var L;return[Te("div",{class:se(T.$style.assigneeGroupRenderer)},[((L=r.value)==null?void 0:L.length)===0?(K(),ze(ct,{key:0,src:"UserPlus",source:"remote",color:"#6B6B6B",style:hn(S.value)},null,8,["style"])):Xe("",!0),(K(!0),ce(Ft,null,Pn(C.value,I=>(K(),ze(sp,{key:I.id,"disable-remove":o.readOnly||o.disabled,onClear:x=>b(I.id),style:{marginLeft:"0"}},{default:be(()=>[ye(nd,{user:I.user,"show-profile":!0,apiUpdateFunction:y,class:se(T.$style["ib-assignee-avatar"])},null,8,["user","class"])]),_:2},1032,["disable-remove","onClear"]))),128)),g.value>0?qe((K(),ce("div",{key:1,class:se(T.$style["extra-avatars"])},[nt(" +"+it(g.value),1)],2)),[[W(t),v.value]]):Xe("",!0)],2)]}),_:1},16)),[[W(n),{isLoading:c.value}]])}}),[["__cssModules",{$style:{assigneeGroupRenderer:"_assigneeGroupRenderer_14fiu_1","ib-assignee-group-renderer":"_ib-assignee-group-renderer_14fiu_7","ib-assignee-avatar":"_ib-assignee-avatar_14fiu_16","assignee-wrapper":"_assignee-wrapper_14fiu_20","extra-avatars":"_extra-avatars_14fiu_27"}}]]),pse=bt(tt({name:"DateRangeRenderer",__name:"DateRangeRenderer",props:{disabled:{type:Boolean},readOnly:{type:Boolean,default:!1},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},isStarted:{type:Boolean},isCompleted:{type:Boolean},timezone:{}},setup(e){var E,D;const t=Kt,n=Ns,o=xS(),s=e,r=H(null),i=H(null),{isEditing:a}=td(s),l=T=>{if(T){if(typeof T=="string")return T;if(T instanceof Date)return T.toISOString()}},c=Y(()=>s.value===void 0),u=Y(()=>{var T;return(T=s.data)==null?void 0:T.isStarted}),d=Y(()=>{var T;return(T=s.data)==null?void 0:T.isCompleted}),h=Y(()=>!!(s.value&&(s.value[0]||s.value[1]))),f=Y(()=>h.value?s.disabled&&!s.readOnly?"var(--disabled-color)":"var(--primary-color)":"var(--grey-300)"),p=Y(()=>({disabled:s.disabled,error:!1,readOnly:s.readOnly,inputRef:r,wrapperRef:i,clickable:!0,active:a})),{argsMain:g}=To(p),{startDate:v,endDate:C,startClasses:S,endClasses:b,fullStartDate:y,fullEndDate:_}=FY({start:l((E=s.value)==null?void 0:E[0]),end:l((D=s.value)==null?void 0:D[1]),isStarted:u.value,isEnded:d.value,timezone:s.timezone||o});return(T,P)=>qe((K(),ze(Fo,jt(W(g),{ref_key:"wrapperRef",ref:i,bordered:!0}),{default:be(()=>[c.value?Xe("",!0):(K(),ce("div",{key:0,class:se(T.$style.dateRangeRenderer)},[h.value?Xe("",!0):(K(),ze(ct,{key:0,src:"Calendar",class:se(T.$style.calendarIcon),color:f.value},null,8,["class","color"])),h.value?(K(),ce(Ft,{key:1},[qe((K(),ce("span",{class:se([T.$style.dateLabelDisplay,...W(S).map(L=>T.$style[L])])},[nt(it(W(v)),1)],2)),[[W(t),W(y)]]),P[0]||(P[0]=Te("span",null,"→",-1)),qe((K(),ce("span",{class:se([T.$style.dateLabelDisplay,...W(b).map(L=>T.$style[L])])},[nt(it(W(C)),1)],2)),[[W(t),W(_)]])],64)):Xe("",!0)],2))]),_:1},16)),[[W(n),{isLoading:c.value}]])}}),[["__cssModules",{$style:{dateRangeRenderer:"_dateRangeRenderer_rsfrm_1",calendarIcon:"_calendarIcon_rsfrm_8",dateSection:"_dateSection_rsfrm_12",dateLabelDisplay:"_dateLabelDisplay_rsfrm_19",empty:"_empty_rsfrm_29","end-today":"_end-today_rsfrm_35",actual:"_actual_rsfrm_38","end-tomorrow":"_end-tomorrow_rsfrm_41","end-yesterday":"_end-yesterday_rsfrm_47","end-past":"_end-past_rsfrm_53","end-future":"_end-future_rsfrm_59","start-today":"_start-today_rsfrm_62","start-tomorrow":"_start-tomorrow_rsfrm_68","start-yesterday":"_start-yesterday_rsfrm_74","start-past":"_start-past_rsfrm_80","start-future":"_start-future_rsfrm_86"}}]]),gse=tt({__name:"DateRangeEditor",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{default:void 0},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},isStarted:{type:Boolean},isCompleted:{type:Boolean},timezone:{default:xS()}},emits:["closed"],setup(e,{expose:t,emit:n}){const o=H(null);en(()=>{ft(()=>{o.value&&o.value.focus()})});const s=e,r=n,i=()=>{var C;(C=s.params)==null||C.api.stopEditing(),r("closed")},a=C=>`${St.fromJSDate(C,{zone:"utc"}).toFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")}999Z`,l=async C=>{await v({startDate:C[0]?a(C[0]):null,dueDate:C[1]?a(C[1]):null})},c=async()=>{await v({startDate:null})},u=async()=>{await v({dueDate:null})},d=async C=>{await v({startDate:C?a(C):null})},h=async C=>{await v({dueDate:C?a(C):null})},f=async()=>{await v({startDate:null,dueDate:null})},p=In("bulkUpdate",!1),{apiServices:g}=io(!p,s),v=async C=>{var S,b,y,_,E;try{const D=(S=o.value)==null?void 0:S.getValues(),T=await((y=(b=g.value)==null?void 0:b.changeDate)==null?void 0:y.call(b,{workspaceId:s.workspaceId,itemIds:[s.id],startDate:C.startDate,dueDate:C.dueDate}));T!=null&&T.message&&((E=s.params)==null||E.node.setData({...(_=s.params)==null?void 0:_.node.data,dateRange:D==null?void 0:D.dateRange}))}catch(D){console.error("Failed to update scene name:",D)}};return t({focus:()=>{ft(()=>{var C;(C=o.value)==null||C.focus()})}}),(C,S)=>(K(),ze(Dv,jt(s,{onUpdate:l,"onUpdate:end":h,"onUpdate:start":d,onClearAll:f,onClearDue:u,onClearStart:c,onClosed:i,ref_key:"calendarRef",ref:o}),null,16))}}),mse=bt(tt({__name:"item-table-layout",props:{isSidebarOpen:{type:Boolean,default:!1}},emits:["close-sidebar","sidebar-clear","sidebar-apply"],setup(e,{emit:t}){const n=H(null),o=H(0);let s=null;en(()=>{n.value&&(s=new ResizeObserver(i=>{for(const a of i)o.value=a.contentRect.height}),s.observe(n.value))}),Zl(()=>{s&&n.value&&s.unobserve(n.value)});const r=Y(()=>{const i=o.value;return i>120?i-42-36:0});return(i,a)=>(K(),ce("div",{class:se(i.$style["item-table-wrapper"]),ref_key:"itemTableWrapperRef",ref:n},[Te("div",{class:se(i.$style["item-header"])},[Te("div",{class:se(i.$style["item-header__left"])},[xt(i.$slots,"header-left",{},()=>[Te("h1",{class:se(i.$style["item-header__title"])},[xt(i.$slots,"title",{},()=>[a[0]||(a[0]=nt("Items",-1))])],2)])],2),Te("div",{class:se(i.$style["item-header__spacer"])},null,2),Te("div",{class:se(i.$style["item-header__actions"])},[xt(i.$slots,"header-actions")],2)],2),xt(i.$slots,"grid",{availableHeight:r.value}),Te("div",{class:se(i.$style.footer)},[xt(i.$slots,"footer")],2),xt(i.$slots,"new-row"),xt(i.$slots,"bulk-update-actions"),xt(i.$slots,"snackbar"),xt(i.$slots,"popup")],2))}}),[["__cssModules",{$style:{"item-table-wrapper":"_item-table-wrapper_1uqb9_1","item-header":"_item-header_1uqb9_14","item-header__left":"_item-header__left_1uqb9_22","item-header__title":"_item-header__title_1uqb9_27","item-header__spacer":"_item-header__spacer_1uqb9_32","item-header__actions":"_item-header__actions_1uqb9_35","main-content":"_main-content_1uqb9_41",sidebar:"_sidebar_1uqb9_48","is-open":"_is-open_1uqb9_64","sidebar-header":"_sidebar-header_1uqb9_68","sidebar-footer":"_sidebar-footer_1uqb9_69","sidebar-content":"_sidebar-content_1uqb9_89",footer:"_footer_1uqb9_94"}}]]),xN=bt(tt({name:"MoreOptionEditor",__name:"MoreOptionEditor",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},optionBlock:{},isSubmenu:{type:Boolean,default:!1},layer:{default:0},focusableIndex:{}},emits:["actionExecuted"],setup(e,{expose:t,emit:n}){const o=Uo,s=e,r=Y(()=>(s==null?void 0:s.workspaceId)||""),i=Y(()=>(s==null?void 0:s.entityId)||""),a=()=>{var N,F,z;return(z=(N=s.params)==null?void 0:N.api)==null?void 0:z.getCellRendererInstances({columns:["options"],rowNodes:(F=s.params)!=null&&F.node?[s.params.node]:[]})[0]},l=()=>{var F,z,j,Q;const N=a();(z=(F=N==null?void 0:N.componsenExposed)==null?void 0:F.blur)==null||z.call(F),(Q=(j=N==null?void 0:N.container)==null?void 0:j.parentElement)==null||Q.classList.remove("ag-cell-focus")},c=()=>{var z,j,Q;(j=(z=s.params)==null?void 0:z.api)==null||j.stopEditing(),l();const N=`scene-name-${s.id}`,F=document.getElementById(N);(Q=F==null?void 0:F.__sceneNameEditor)==null||Q.startEdit()},{apiServices:u}=io(!0,s),d=Y(()=>{var N;return{ws_code:r.value,entity_id:i.value,scene_id:s.id,axiosService:u,optionBlock:s.optionBlock,permissions:(N=s.data)==null?void 0:N.permissions}}),h=N=>{var z,j,Q,re,q,V;let F=(j=(z=s.params)==null?void 0:z.api)==null?void 0:j.getRowNode(String(s.id));if(F){const k={...F.data,isDeleted:N==="deleted",isArchived:N==="archived"?!0:F.data.isArchived,isLocked:N==="locked"?!0:F.data.isLocked,disabled:!1};N=="deleted"&&(k.isLocked=!1,k.disabled=!0),N=="unarchived"&&(k.isArchived=!1),(re=(Q=s.params)==null?void 0:Q.api)==null||re.redrawRows({rowNodes:[F]}),F.setData(k),(V=(q=s.params)==null?void 0:q.api)==null||V.redrawRows({rowNodes:[F]})}},f=Vf(),{openSceneHub:p}=f,g=()=>{ft(()=>{var z,j,Q,re,q,V;const N=((j=(z=s.params)==null?void 0:z.node)==null?void 0:j.rowIndex)||0,F=((re=(Q=s.params)==null?void 0:Q.column)==null?void 0:re.getColId())||"";(V=(q=s.params)==null?void 0:q.api)==null||V.setFocusedCell(N,F)})};Y(()=>{var F,z;const N=(z=(F=s.params)==null?void 0:F.api)==null?void 0:z.getRowNode(String(s.id));return N==null?void 0:N.data});const{options:v}=hJ(d,h,c,p,g),C=n,S=()=>{var N,F,z,j,Q,re;console.trace("Focusing current cell for row:",s.id),(re=(N=s.params)==null?void 0:N.api)==null||re.setFocusedCell(((z=(F=s.params)==null?void 0:F.node)==null?void 0:z.rowIndex)||0,((Q=(j=s.params)==null?void 0:j.column)==null?void 0:Q.getColId())||"")},b=Y(()=>{var N;return(N=s.params)==null?void 0:N.api}),y=(N,F)=>{var z,j,Q,re,q,V,k,G;if(C("actionExecuted",N),N.id=="copy-link"){(q=b.value)==null||q.startEditingCell({rowIndex:(j=(z=s.params)==null?void 0:z.node)==null?void 0:j.rowIndex,colKey:(re=(Q=s.params)==null?void 0:Q.column)==null?void 0:re.getColId()});return}else{if(N.id!=="copy-link"&&((V=b.value)==null||V.stopEditing()),N.id==="rename")(k=b.value)==null||k.stopEditing(),(G=b.value)==null||G.clearFocusedCell(),l();else if(N.id==="copy-link"){const ee=document.getElementById(F);setTimeout(()=>{var ge,Fe,Ge;(Ge=(Fe=(ge=ee==null?void 0:ee.__vueParentComponent)==null?void 0:ge.exposed)==null?void 0:Fe.focus)==null||Ge.call(Fe)},300)}else if(["delete-rendition","delete-thumbnail"].includes(N.id)){setTimeout(()=>{S()},300);return}setTimeout(()=>{var ee,ge;(ge=(ee=s.params)==null?void 0:ee.api)==null||ge.clearFocusedCell()},300)}},_=()=>{var N,F;(F=(N=s.params)==null?void 0:N.api)==null||F.stopEditing()},E=N=>{var F,z,j,Q;return N==="archive"?!((z=(F=s.params)==null?void 0:F.data)!=null&&z.isArchived):N==="unarchive"?(Q=(j=s.params)==null?void 0:j.data)==null?void 0:Q.isArchived:!0},D=Y(()=>v.value.map(N=>({...N,options:N.options.filter(F=>!F.hide&&E(F.id))})).filter(N=>N.options.length>0)),T=H({}),P=H(null),L=Y(()=>{var F,z;if(s.focusableIndex)return s.focusableIndex;const N=(z=(F=s.params)==null?void 0:F.api)==null?void 0:z.getRowNode(String(s.id));return`${((N==null?void 0:N.rowIndex)??0)+10}`}),I=(N,F)=>`${L.value}.${N*10+F}`,x=(N,F)=>{if(F&&"focus"in F){T.value[N]=F;return}delete T.value[N]},O=N=>{N.preventDefault(),N.stopPropagation(),N.stopImmediatePropagation()};return en(()=>{var N;(N=P.value)==null||N.focus()}),t({focus(){var z;const N=`${L.value}.0`,F=T.value[N];F&&F.focus?F.focus():(z=P.value)==null||z.focus()}}),(N,F)=>qe((K(),ce("div",{onKeydown:O,class:se([N.$style["more-option-section"],{[N.$style.submenu]:e.isSubmenu}]),ref_key:"wrapperRef",ref:P,tabindex:"0",role:"menu"},[(K(!0),ce(Ft,null,Pn(D.value,(z,j)=>(K(),ce("div",{key:z.id,style:hn({"--g-number":Math.min(z.options.length,4),"--g-size":z.type==="column"?"36px":"auto"}),class:se([N.$style["option-block"],N.$style[z.type]])},[(K(!0),ce(Ft,null,Pn(z.options,(Q,re)=>(K(),ce("div",{key:Q.id,class:se(N.$style["option-item"])},[ye(yse,{layer:s.layer,"scene-id":String(s.id),option:Q,type:z.type,onActionExecuted:q=>y(q,`more-action-${q.id}-${s.id}`),focusableIndex:I(j,re),ref_for:!0,ref:q=>x(I(j,re),q),onHandleHide:_,id:`more-action-${Q.id}-${s.id}`,label:Q.label},null,8,["layer","scene-id","option","type","onActionExecuted","focusableIndex","id","label"])],2))),128))],6))),128))],34)),[[W(o),L.value]])}}),[["__cssModules",{$style:{"more-option-section":"_more-option-section_1jg4p_1","option-block":"_option-block_1jg4p_8","option-item":"_option-item_1jg4p_15",row:"_row_1jg4p_19",column:"_column_1jg4p_25",block:"_block_1jg4p_29"}}]]),vse={key:0,style:{height:"20px",width:"20px",display:"flex","align-items":"center","justify-content":"center"}},yse=bt(tt({__name:"MoreOptionItem",props:{option:{},sceneId:{},type:{},layer:{},focusableIndex:{}},emits:["actionExecuted","handleHide"],setup(e,{expose:t,emit:n}){const o=Uo,s=Kt,r=e,i=H(!1),a=H(!1),l=(T,P)=>{if(!P){p();return}const L=P.target;L.closest(".tippy-content")||L.closest(".tippy-box")||L.closest("[data-tippy-root]")||L.closest(".option-item")||p()},c=H(null),{triggerRef:u,popupRef:d,show:h,isVisible:f,hide:p}=mo({toggleOnClick:!0,interactive:!0,trigger:"click",placement:"left",showArrow:!1,offset:[0,4],hideOnClick:!1,allowHTML:!0,onClickOutside:l,appendTo:c.value||void 0}),g=n,v=async T=>{var P,L;if(!a.value){a.value=!0;try{await((L=(P=r.option).action)==null?void 0:L.call(P,T)),g("actionExecuted",r.option)}catch(I){console.error("Action execution failed:",I)}finally{a.value=!1,i.value=!1}}},C=async T=>{var P,L;if(T.preventDefault(),T.stopPropagation(),!a.value){if(r.option.isDanger){i.value=!i.value;return}if(r.option.subMenu)h();else{a.value=!0;try{await((L=(P=r.option).action)==null?void 0:L.call(P,T)),g("actionExecuted",r.option)}catch(I){console.error("Action execution failed:",I)}finally{a.value=!1}return}}},S=T=>{g("actionExecuted",T),p()},b=T=>{T.key==="Escape"&&p()},y=T=>({row:"small",column:"medium",block:"small"})[T]||"medium",_=T=>{const P=r.option.isDanger?["danger","tertiary"]:[];return{row:["secondary","icon",...P],column:["menu-item",...P],block:["secondary",...P]}[T]||[]},E=()=>{i.value?i.value=!1:f.value?p():g("handleHide")};t({focus:()=>{ft(()=>{u.value instanceof HTMLElement?u.value.focus():u.value&&"$el"in u.value?u.value.$el.focus():console.warn("Trigger ref is not an HTMLElement:",u.value)})},escape:()=>{p()},select:()=>{C(new MouseEvent("click"))}});const D=T=>{var P;T.stopPropagation(),T.preventDefault(),i.value=!1,(P=u.value)==null||P.focus()};return(T,P)=>{var L;return qe((K(),ce("div",{ref_key:"wrapperRef",ref:c,class:se(T.$style["option-item-wrapper"]),style:{width:"100%",overflow:"visible"},onClick:Nt(C,["stop","prevent"])},[qe((K(),ze(pt,{ref_key:"triggerRef",ref:u,class:se(T.$style["option-item"]),disabled:e.option.disabled||a.value,actived:W(f)||i.value,size:y(e.type),variant:_(e.type),onClick:Nt(C,["stop","prevent"]),onKeydown:b,onEscape:E,label:e.option.label},{prefix:be(()=>[e.option.icon?(K(),ce("div",vse,[ye(ct,{size:"14",src:e.option.icon,color:e.option.isDanger?void 0:"#a6a6a6",source:"remote"},null,8,["src","color"])])):Xe("",!0)]),suffix:be(()=>[e.option.subMenu?(K(),ze(ct,{key:0,src:"Play",source:"remote"})):Xe("",!0),e.option.isDanger&&i.value?(K(),ce("div",{key:1,class:se(T.$style["confirm-action"])},[qe((K(),ze(pt,{variant:["tertiary","icon","danger"],size:"small",onHandleClick:D},{default:be(()=>[ye(ct,{src:"XMarkSolid",source:"remote"})]),_:1})),[[W(o),`${r.focusableIndex}.0`],[W(s),{content:"Cancel ",delay:[300,0],contentClass:["extra-padding"]}]]),qe((K(),ze(pt,{variant:["danger","primary","icon"],size:"small",onClick:Nt(v,["stop","prevent"]),onEscape:P[0]||(P[0]=I=>i.value=!1)},{default:be(()=>[ye(ct,{src:"Check",source:"remote"})]),_:1})),[[W(o),`${r.focusableIndex}.1`],[W(s),{delay:[300,0],contentClass:["extra-padding"],content:"Confirm ",theme:"warning"}]])],2)):Xe("",!0)]),_:1},8,["class","disabled","actived","size","variant","label"])),[[W(o),r.focusableIndex]]),e.option.subMenu?(K(),ce("div",{key:0,ref_key:"popupRef",ref:d,class:se(T.$style["submenu-container"])},[ye(xN,{focusableIndex:r.focusableIndex,layer:r.layer+1,ref:"submenuRef","option-block":[((L=e.option)==null?void 0:L.subMenu)||[]],"is-submenu":!1,onActionExecuted:S},null,8,["focusableIndex","layer","option-block"])],2)):Xe("",!0)],2)),[[W(s),{content:e.option.description,contentClass:["extra-padding"],theme:e.option.isDanger?"warning":"arbo",hideOnClick:!1,delay:[300,0]}]])}}}),[["__cssModules",{$style:{"option-item":"_option-item_8a5qn_1","icon-wrapper":"_icon-wrapper_8a5qn_11","confirm-action":"_confirm-action_8a5qn_19"}}]]),PN=(e,t)=>{const n=H(Number(e.value.value)),o=Y(()=>e.value.metricConfig),s=Y(()=>{var g,v;const l=o.value,c=t.value,u=e.value.value=="N/A"||e.value.value===null||e.value.value===void 0||String(e.value.value).length===0,d=!!e.value.error,h=(l==null?void 0:l.format_type)==="icon",{disabled:f}=e.value;return{pendingCalculation:e.value.value=="N/A"||u&&((g=l==null?void 0:l.metric_type)==null?void 0:g.code)==="formula",isEmpty:u,isError:d,hasPrefix:!u&&!d&&(l==null?void 0:l.morpheme_type)==="prefix",hasSuffix:!u&&!d&&(l==null?void 0:l.morpheme_type)==="suffix",isDropdown:(l==null?void 0:l.format_type)==="dropdown",isFormula:((v=l==null?void 0:l.metric_type)==null?void 0:v.code)==="formula",isLoading:e.value.value===void 0,isRating:h,showActions:c&&!u&&!f}}),r=17,i=Y(()=>{var l;return{maxRating:((l=o.value)==null?void 0:l.range)||5,readOnly:e.value.readOnly,disabled:e.value.disabled,size:r}});return{componentState:s,metricConfig:o,ICON_SIZE:r,ratingParams:i,standardNameforIcon:()=>{var c;return(((c=o.value)==null?void 0:c.format_symbol)||"BoltSolid").split(/[\s-_]+/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("").replace(/Outline|Solid/g,"")},internalValue:n}},wse=["aria-label"],kN=bt(tt({name:"MetricRenderer",__name:"MetricRenderer",props:{disabled:{type:Boolean},readOnly:{type:Boolean,default:!0},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean},error:{type:Boolean},config:{}},emits:["update:value","clear","copy"],setup(e,{emit:t}){const n=Ns,o=Kt,s=e,r=_h(!1),i=H(null),a=H(null),{isEditing:l}=td(s),c=Y(()=>{var F,z;return{value:s.value,metricConfig:((z=(F=s.params)==null?void 0:F.colDef)==null?void 0:z.context)||s.config,error:s.error,hovered:r.value,readOnly:s.readOnly,disabled:s.disabled,active:l}}),{componentState:u,metricConfig:d,internalValue:h}=PN(c,r),f=Y(()=>{var z,j;let F=!1;if(["number","formula"].includes(d.value.metric_type.code)){const Q=Number(s.value),re=Number((z=d.value)==null?void 0:z.format_value);Number.isFinite(re)&&re>=0&&(F=(((j=Q.toString().split(".")[1])==null?void 0:j.length)||0)>re)}return F}),p=Y(()=>{var F;return!!((F=d.value)!=null&&F.morpheme_value)||u.value.isEmpty||f.value}),g=Y(()=>{var j,Q,re;if(u.value.isError)return"Something went wrong. Review formula, inputs and retry.";if(u.value.pendingCalculation)return"Can’t calculate yet. Complete required fields.";if(u.value.isEmpty)return;const F=P.value,z=(j=d.value)==null?void 0:j.morpheme_type;return z==="prefix"?`${((Q=d.value)==null?void 0:Q.morpheme_value)||""} ${F}`.trim():z==="suffix"?`${F} ${((re=d.value)==null?void 0:re.morpheme_value)||""}`.trim():F}),v=Y(()=>{const{format_type:F,format_value:z}=d.value;if(F==="dropdown"&&typeof z=="string"&&z.startsWith("["))try{return JSON.parse(z)}catch{return[]}return[]}),C=Y(()=>({disabled:s.disabled,error:u.value.isError,inputRef:i,wrapperRef:a,clickable:!T.value,readOnly:s.readOnly||T.value,isEmpty:u.value.isEmpty})),{argsMain:S,isHover:b}=To(C),y=(F,z,j="en-US")=>new Intl.NumberFormat(j,{minimumFractionDigits:z,maximumFractionDigits:z}).format(F),_=Y(()=>{if(u.value.isEmpty)return"";if(u.value.pendingCalculation)return"pending";const F=s.value,{format_type:z,format_value:j,mapping:Q}=d.value;if(Q&&typeof Q=="object"&&!Array.isArray(Q)){const re=Q[`!${F}`];if(re)return re}if(z==="dropdown"){const re=v.value.find(q=>String(q.name)===String(F));if(re)return re.name}if(typeof F=="string"){const re=Number(F);return Number.isNaN(re)?F:F.replace(/[.-]/g,"").length>16?E(F,j):E(re,j)}return typeof F=="number"?E(F,j):String(F)}),E=(F,z)=>{const j=Number.parseInt(String(z)||"2",10),Q=Number.isFinite(j)&&j>=0?j:2;try{if(typeof F=="string"){const re=F.split("."),q=re[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),V=re[1]?re[1].substring(0,Q).padEnd(Q,"0"):"0".repeat(Q);return Q>0?`${q}.${V}`:q}return y(F,Q)}catch(re){return console.error("Error formatting metric value:",re,{num:F,decimals:Q}),String(F)}},D=(F,z)=>{const j=Number.parseInt(String(z)||"2",10),Q=Number.isFinite(j)&&j>=0?j:2;try{if(typeof F=="string"){const re=F.split("."),q=re[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),V=re[1]?re[1].length:0,k=Math.max(Q,V),G=re[1]?re[1].padEnd(k,"0"):"0".repeat(k);return k>0?`${q}.${G}`:q}return new Intl.NumberFormat("en-US",{minimumFractionDigits:Q,maximumFractionDigits:20}).format(F)}catch(re){return console.error("Error formatting exact metric value:",re,{num:F,decimals:Q}),String(F)}},T=Y(()=>{var F;return((F=d.value)==null?void 0:F.metric_type.code)==="formula"}),P=Y(()=>{if(u.value.isEmpty)return"";if(u.value.pendingCalculation)return"pending";const F=s.value,{format_type:z,format_value:j,mapping:Q}=d.value;if(Q&&typeof Q=="object"&&!Array.isArray(Q)){const re=Q[`!${F}`];if(re)return re}if(z==="dropdown"){const re=v.value.find(q=>String(q.name)===String(F));if(re)return re.name}if(typeof F=="string"){const re=Number(F);return Number.isNaN(re)?F:F.replace(/[.-]/g,"").length>16?D(F,j):D(re,j)}return typeof F=="number"?D(F,j):String(F)}),{tooltip:L}=pF(""),I=async F=>{F.stopPropagation(),F.preventDefault(),F.stopImmediatePropagation();try{await navigator.clipboard.writeText(P.value),L.value="Copied",setTimeout(()=>{L.value="Copy"},3e3)}catch(z){console.error("Failed to copy text:",z),L.value="Copy failed",setTimeout(()=>{L.value="Copy"},3e3)}};Qe(()=>s.value,(F,z)=>{const j=Number(F);Number.isFinite(j)&&j!==h.value?h.value=j:F==null&&h.value!==0&&(h.value=0)},{immediate:!0,deep:!0});const O=()=>{r.value=!0},N=()=>{r.value=!1};return(F,z)=>qe((K(),ze(Fo,jt(W(S),{onMouseenter:O,style:{"--icon-size":"24px"},onMouseleave:N,ref_key:"wrapperRef",ref:a,actived:W(l),bordered:!0}),{suffix:be(()=>[s.disabled?Xe("",!0):(K(),ce("div",{key:0,class:se([F.$style.suffix,"wrapper-suffix"])},[r.value&&!W(u).isEmpty&&!W(u).isError?qe((K(),ze(pt,{key:0,variant:["icon","secondary"],size:24,onClick:Nt(I,["prevent","stop"])},{default:be(()=>[ye(ct,{src:"Copy",source:"remote",size:12})]),_:1})),[[W(o),{content:W(L),hideOnClick:!1,contentClass:"extra-padding"}]]):Xe("",!0)],2))]),default:be(()=>[Te("div",{class:se(F.$style["metric-wrapper"]),"aria-label":W(d).format_value||void 0},[Te("div",{class:se([F.$style["metric-content"],s.disabled?F.$style.disabled:""])},[!W(u).isError&&W(u).isEmpty?(K(),ce(Ft,{key:0},[W(u).pendingCalculation?qe((K(),ce("span",{key:0,class:se(F.$style["metric-empty"])},[...z[0]||(z[0]=[nt(" - ",-1)])],2)),[[W(o),"Can’t calculate yet. Complete required fields."]]):W(u).isEmpty?(K(),ce("span",{key:1,class:se(F.$style["metric-empty"])}," - ",2)):Xe("",!0)],64)):Xe("",!0),W(u).isError?qe((K(),ce("div",{key:1,class:se(F.$style["metric-error"])},[...z[1]||(z[1]=[nt(" Error ",-1)])],2)),[[W(o),"Something went wrong. Review formula, inputs and retry."]]):Xe("",!0),!W(u).isEmpty&&!W(u).isError?qe((K(),ce("span",{key:2,class:se([F.$style["metric-value"],W(b)?F.$style.hovered:"",{[F.$style.disabled]:s.disabled}])},[nt(it(_.value),1)],2)),[[W(o),{content:g.value,bypassOverflowCheck:p.value}]]):Xe("",!0)],2)],10,wse)]),_:1},16,["actived"])),[[W(n),{isLoading:W(u).isLoading}]])}}),[["__cssModules",{$style:{"metric-wrapper":"_metric-wrapper_lu0ag_1","metric-content":"_metric-content_lu0ag_5",disabled:"_disabled_lu0ag_15","metric-value":"_metric-value_lu0ag_19",hovered:"_hovered_lu0ag_19","metric-error":"_metric-error_lu0ag_23","with-morpheme":"_with-morpheme_lu0ag_38","with-formula-icon":"_with-formula-icon_lu0ag_41","metric-value--number":"_metric-value--number_lu0ag_47","metric-value--currency":"_metric-value--currency_lu0ag_47","metric-value--percentage":"_metric-value--percentage_lu0ag_47","metric-morpheme":"_metric-morpheme_lu0ag_51","metric-empty":"_metric-empty_lu0ag_64","metric-icon":"_metric-icon_lu0ag_71"}}]]),Cse={key:0,style:{color:"#6b6b6b"}},bse=bt(tt({__name:"HeaderSorting",props:{params:{},headerType:{},disabled:{type:Boolean},readOnly:{type:Boolean},modelValue:{}},emits:["sort-changed","update:modelValue","open"],setup(e,{expose:t,emit:n}){const o=Kt,s={START_ASC:{value:"start_asc",label:"Soonest to furthest start",id:"start_asc"},START_DESC:{value:"start_desc",label:"Furthest to soonest start",id:"start_desc"},DUE_ASC:{value:"due_asc",label:"Soonest to furthest due",id:"due_asc"},DUE_DESC:{value:"due_desc",label:"Furthest to soonest due",id:"due_desc"}},r={desc:{value:"desc",label:"Newest to oldest",id:"desc"},asc:{value:"asc",label:"Oldest to newest",id:"asc"}},i={asc:{value:"asc",label:"Smallest to largest",id:"asc"},desc:{value:"desc",label:"Largest to smallest",id:"desc"}},a={asc:{value:"asc",label:"Ascending",id:"asc"},desc:{value:"desc",label:"Descending",id:"desc"}},l=e,c={assignees:"default",completedOn:"date",dateRange:"dateRange",id:"number",isArchived:"default",isCompleted:"default",isDeleted:"default",isProcessing:"default",isStarted:"default",lastUpdated:"date",name:"default",status:"default",permissions:"default",options:"default",disabled:"number"},u=Y(()=>{var N,F;if(l.headerType)return l.headerType;if(((F=(N=l.params)==null?void 0:N.column)==null?void 0:F.getColId()).includes("metric"))return"default";const O=l.headerType??l.params.column.getColId();return c[O]||"default"}),d=H(),h=()=>{var O,N,F;const x=(N=(O=l.params)==null?void 0:O.column)==null?void 0:N.getColDef();if((F=x.colId)!=null&&F.includes("metric")){if(x.context.is_primary==1)return"primary";if(x.context.is_point_metric==1)return"secondary"}};Mh(()=>{d.value=h()}),en(()=>{d.value=h()});const f=Y(()=>{var x,O;return((O=(x=l.params)==null?void 0:x.column.getColDef().context)==null?void 0:O.morpheme_value)||void 0}),p=Y(()=>{var x;return(x=l.params)==null?void 0:x.displayName}),g=Y(()=>{let x=[];switch(u.value){case"dateRange":x=Object.values(s).map(O=>({...O,selected:C.value===O.value,type:"text",hover:T.value===O.value}));break;case"date":x=Object.values(r).map(O=>({...O,selected:C.value===O.value,type:"text",hover:T.value===O.value}));break;case"number":x=Object.values(i).map(O=>({...O,selected:C.value===O.value,type:"text",hover:T.value===O.value}));break;default:x=Object.values(a).map(O=>({...O,selected:C.value===O.value,type:"text",hover:T.value===O.value}));break}return C.value!=="none"&&x.push({id:"clear",label:"Clear",value:"none",selected:!1,type:"text",icon:"XMark",hover:T.value=="none"}),x}),v=Y(()=>String(C.value).endsWith("asc")?"SortUp":String(C.value).endsWith("desc")?"SortDown":"Sort"),C=H(l.modelValue??"none"),S=x=>{if(I.value){I.value=!1;return}E("update:modelValue",x),E("sort-changed",x)},b=x=>{C.value=x},y=mr(()=>{if(u.value==="date"||u.value==="default"||u.value==="number"){let x;C.value==="none"?x="asc":C.value==="asc"?x="desc":x="none",C.value=x}else{const x=[s.START_ASC.value,s.START_DESC.value,s.DUE_ASC.value,s.DUE_DESC.value,"none"],N=(x.indexOf(C.value)+1)%x.length;C.value=x[N]}},Ci),_=Y(()=>{if(C.value==="none")return"No sorting applied";const x=g.value.find(O=>O.value===C.value);return(x==null?void 0:x.label)||""}),E=n,D=Y(()=>{if(l.disabled&&!l.readOnly)return"var(--disabled-color)";if(C.value!=="none")return"var(--primary-color-hover)"});Qe(()=>l.modelValue,x=>{x!=C.value&&(C.value=x)}),Qe(C,x=>{x!==l.modelValue&&S(x)});const T=H(C.value);Qe(()=>C.value,x=>{T.value=x});const P=x=>{var z,j;if(l.readOnly||l.disabled)return;let O=0;x.key==="ArrowDown"?O=1:x.key==="ArrowUp"&&(O=-1);const N=g.value.findIndex(Q=>Q.value===T.value),F=g.value.length;if(x.key==="Enter"||x.key===" ")x.preventDefault(),C.value=T.value,(z=L.value)==null||z.hide();else if(O!==0){x.preventDefault();let Q=(N+O+F)%F;T.value=g.value[Q].value}else x.key==="Escape"&&((j=L.value)==null||j.hide())},L=H(null);en(()=>{var x,O;(O=(x=L.value)==null?void 0:x.$el)==null||O.addEventListener("keydown",P)}),Zl(()=>{var x,O;(O=(x=L.value)==null?void 0:x.$el)==null||O.removeEventListener("keydown",P)});const I=H(!1);return t({setDefaultSort:x=>{C.value=x?x.direction:"none",I.value=!0},clear:()=>{C.value="none"}}),(x,O)=>(K(),ze(J0,{ref_key:"dropdownRef",ref:L,options:g.value,label:p.value,readOnly:l.readOnly,onOpen:O[0]||(O[0]=N=>x.$emit("open")),disabled:l.disabled,variant:["icon","tertiary"],size:"small",onHandleClick:W(y),onSelect:O[1]||(O[1]=N=>b(N))},{prefix:be(()=>[ye(pt,{variant:["text"],onClick:W(y),size:"small"},{default:be(()=>[qe((K(),ce("b",null,[nt(it(p.value),1)])),[[W(o),{content:p.value}]]),f.value?(K(),ce("small",Cse," ("+it(f.value)+") ",1)):Xe("",!0),d.value=="primary"?qe((K(),ce("div",{key:1,class:se(x.$style["icon-metric"])},[ye(ct,{src:"ChartPie",color:"#A6A6A6",size:"14"})],2)),[[W(o),"Woohoo metric"]]):Xe("",!0),d.value=="secondary"?qe((K(),ce("div",{key:2,class:se(x.$style["icon-metric"])},[ye(ct,{src:"Bullseye",color:"#A6A6A6",size:"14"})],2)),[[W(o),"Point Metric"]]):Xe("",!0)]),_:1},8,["onClick"])]),iconDropdown:be(()=>[qe(ye(ct,{src:v.value,source:"remote",color:D.value},null,8,["src","color"]),[[W(o),_.value]])]),_:1},8,["options","label","readOnly","disabled","onHandleClick"]))}}),[["__cssModules",{$style:{"icon-metric":"_icon-metric_nh30n_1",iconSorting:"_iconSorting_nh30n_9","button-group":"_button-group_nh30n_15","ab-table-button":"_ab-table-button_nh30n_26","button-main":"_button-main_nh30n_32","button-dropdown-trigger":"_button-dropdown-trigger_nh30n_37",headerSorting:"_headerSorting_nh30n_47"}}]]),Sse=["disabled","readonly","checked","indeterminate"],FN=bt(tt({__name:"Checkbox",props:{modelValue:{},disabled:{type:Boolean},readOnly:{type:Boolean},focusIndex:{},tooltipText:{},allowIndeterminate:{type:Boolean},size:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=Kt,o=Uo,s=e,r=t,i=Y(()=>{if(typeof s.size=="string"){if(["small","medium","large"].includes(s.size))switch(s.size){case"small":return"14px";case"large":return"24px";case"medium":default:return"20px"}if(s.size.endsWith("px"))return s.size}return typeof s.size=="number"?`${s.size}px`:"20px"}),a=Y(()=>s.allowIndeterminate?[At.UNCHECK,At.INDETERMINATE,At.CHECKED]:[At.UNCHECK,At.CHECKED]),l=Y(()=>{if(typeof s.tooltipText=="string"||!s.tooltipText)return s.tooltipText||"";switch(u.value){case At.UNCHECK:return s.tooltipText.unchecked;case At.INDETERMINATE:return s.tooltipText.indeterminate;case At.CHECKED:return s.tooltipText.checked;default:return""}}),c=()=>{if(h.value)return;const p=(a.value.indexOf(u.value)+1)%a.value.length;u.value=a.value[p]},u=H(typeof s.modelValue=="boolean"?s.modelValue?At.CHECKED:At.UNCHECK:s.modelValue),d=Y(()=>({checked:u.value===At.CHECKED,indeterminate:u.value===At.INDETERMINATE,none:u.value===At.UNCHECK})),h=Y(()=>s.disabled||s.readOnly);return Qe(()=>u.value,f=>{r("update:modelValue",f===At.CHECKED)}),(f,p)=>qe((K(),ce("input",{disabled:s.disabled,key:u.value,readonly:s.readOnly,type:"checkbox",class:se([f.$style["input-checkbox"]]),checked:d.value.checked,indeterminate:d.value.indeterminate,onChange:c,"aria-label":"Select All Items",style:hn({"--input-size":i.value})},null,46,Sse)),[[W(n),{content:l.value,hideOnClick:!1,contentClass:"extra-padding"}],[W(o),s.focusIndex]])}}),[["__cssModules",{$style:{small:"_small_1kz1e_84",large:"_large_1kz1e_87",medium:"_medium_1kz1e_90"}}]]),Ese=bt(tt({name:"HeaderCheckbox",__name:"HeaderCheckbox",props:{disabled:{type:Boolean},readOnly:{type:Boolean},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean}},setup(e){const t=e,n=Kt,o=qv(),{setSelectionStatus:s}=o,{rowCount:r,selectionStatus:i}=us(o),a=H(new Set);Qe(i,y=>{s(y)},{immediate:!0});const l=Y(()=>i.value!==At.UNCHECK),c=Y(()=>({checked:i.value===At.CHECKED,indeterminate:i.value===At.INDETERMINATE,UNCHECK:i.value===At.UNCHECK})),u=Y(()=>({[At.UNCHECK]:"Click to select all",[At.INDETERMINATE]:"Click to clear selection",[At.CHECKED]:"Click to clear selection"})[i.value]||"Select items"),d=Y(()=>{const y=[{label:"Select all",value:"INDETERMINATE",type:"text",clickable:!0,id:"indeterminate"}];return l.value&&y.push({label:"None",value:"UNCHECK",type:"text",clickable:!0,id:"uncheck"}),y}),h=y=>({selected:y.getSelectedRows().length,total:r.value.total,loaded:r.value.loaded}),f=({api:y,state:_})=>{if(y)if(_===At.UNCHECK)y.deselectAll(),a.value.clear(),i.value=_;else if(_===At.CHECKED){const E=new Set;y.forEachNode(D=>{D.isSelected()&&E.add(D.id||"")}),a.value=E,y.forEachNode(D=>D.setSelected(!0)),i.value=_}else y.forEachNode(E=>E.setSelected(!0)),i.value=_},p=()=>{var E;const y=(E=t.params)==null?void 0:E.api;if(!y){console.error("[HeaderCheckbox] There is no API available");return}const _={[At.UNCHECK]:At.INDETERMINATE,[At.INDETERMINATE]:At.UNCHECK,[At.CHECKED]:At.UNCHECK};f({api:y,state:_[i.value]})},g=y=>{var D;const _=(D=t.params)==null?void 0:D.api;if(!_){console.error("no api");return}const E={INDETERMINATE:At.INDETERMINATE,GLOBAL:At.CHECKED,UNCHECK:At.UNCHECK};f({api:_,state:E[y]})},v=mr(y=>{const{selected:_,total:E}=h(y);if(E==0){i.value=At.UNCHECK;return}_===E?i.value=At.CHECKED:_===0?i.value=At.UNCHECK:i.value=At.INDETERMINATE},300);let C=[];const S=y=>{v(y)};en(()=>{var T;const y=(T=t.params)==null?void 0:T.api;if(!y)return;const _=P=>v(P.api),E=()=>S(y),D=()=>S(y);y.addEventListener("selectionChanged",_),y.addEventListener("rowDataUpdated",E),y.addEventListener("modelUpdated",E),C=[()=>y.removeEventListener("selectionChanged",_),()=>y.removeEventListener("rowDataUpdated",E),()=>y.removeEventListener("modelUpdated",D)]}),Jn(()=>{C.forEach(y=>y())});const b=`header-checkbox-${Math.random().toString(36).substr(2,9)}`;return(y,_)=>(K(),ze(J0,{tabIndex:"9",options:d.value,size:24,disabled:t.disabled,readOnly:t.readOnly,variant:["icon","tertiary"],placement:"bottom-start",onSelect:g},{prefix:be(()=>[qe((K(),ze(FN,{"tab-index":"8",id:b,disabled:t.disabled,key:W(i),readonly:t.readOnly,type:"checkbox",checked:c.value.checked,indeterminate:c.value.indeterminate,modelValue:W(i),"onUpdate:modelValue":_[0]||(_[0]=E=>yn(i)?i.value=E:null),onChange:p,"aria-label":W(i)===W(At).CHECKED?"All items selected":"Select visible items",class:se(y.$style["ag-checkbox-input"])},null,8,["disabled","readonly","checked","indeterminate","modelValue","aria-label","class"])),[[W(n),{content:u.value,hideOnClick:!1,contentClass:"extra-padding"}]])]),_:1},8,["options","disabled","readOnly"]))}}),[["__cssModules",{$style:{"ag-checkbox-input":"_ag-checkbox-input_4qktt_1","button-group":"_button-group_4qktt_62","button-main":"_button-main_4qktt_62",headerCheckbox:"_headerCheckbox_4qktt_66"}}]]),AN=bt(tt({name:"StatusRenderer",__name:"StatusRenderer",props:{disabled:{type:Boolean},readOnly:{type:Boolean,default:!0},value:{},data:{},id:{},params:{},workspaceId:{},entityId:{},tooltip:{},__checkboxSelection:{type:Boolean}},setup(e){const t=Ns,n=Kt,o=e,{isEditing:s}=td(o),r=H(null),i=H(null),a=Y(()=>o.value),l=Y(()=>a.value===void 0),c=Y(()=>{var g,v;return((g=a.value)==null?void 0:g.name)||((v=a.value)==null?void 0:v.label)||"No status"}),u=Y(()=>{var g;return{disabled:o.disabled,error:!1,readOnly:o.readOnly,isEmpty:w7((g=a.value)==null?void 0:g.label),inputRef:r,wrapperRef:i,clickable:!o.disabled&&!o.readOnly,active:s}}),{argsMain:d,isHover:h}=To(u),f=Y(()=>{var g;return((g=a.value)==null?void 0:g.color)||"#fff"}),p=Y(()=>new On(f.value).isLight()?"#000":"#fff");return(g,v)=>qe((K(),ze(W(Fo),jt(W(d),{ref_key:"wrapperRef",ref:i,bordered:!0,style:{background:`${f.value} !important`,color:p.value,"--border-color":!W(s)&&!W(h)||!a.value?"#f3f5f8":void 0}}),{default:be(()=>[l.value?Xe("",!0):(K(),ce("div",{key:0,class:se({[g.$style["status-renderer"]]:!0,[g.$style["has-status"]]:a.value,[g.$style["has-suffix"]]:!!g.$slots.suffix})},[a.value?(K(),ce(Ft,{key:0},[qe((K(),ce("div",{class:se(g.$style["status-renderer__status-name"])},[nt(it(c.value),1)],2)),[[W(n),{content:c.value,delay:[1e3,0]}]]),xt(g.$slots,"suffix")],64)):(K(),ce(Ft,{key:1},[Te("div",{class:se(g.$style["status-renderer__color-code"])},null,2),v[0]||(v[0]=Te("span",{style:{color:"#a6a6a6"}},"No status",-1)),xt(g.$slots,"suffix")],64))],2))]),_:3},16,["style"])),[[W(t),{isLoading:l.value}]])}}),[["__cssModules",{$style:{"status-renderer":"_status-renderer_k5c36_1","has-status":"_has-status_k5c36_9","has-suffix":"_has-suffix_k5c36_12","status-renderer__color-code":"_status-renderer__color-code_k5c36_22","status-renderer__status-name":"_status-renderer__status-name_k5c36_33"}}]]),ON=bt(tt({__name:"PopupLayout",props:{popupName:{},showOverlay:{type:Boolean,default:!0},overlayOpacity:{default:.5},closeOnOverlayClick:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},minWidth:{default:"300px"},popupIndex:{default:109},showCloseBtn:{type:Boolean,default:!0}},emits:["shown","hidden"],setup(e,{expose:t,emit:n}){const o=e,s=Y(()=>Number(o.popupIndex)),{popupRef:r,show:i,hide:a,isVisible:l}=VY({useTrigger:!1,arrow:!1,centered:!0,showOverlay:o.showOverlay,overlayOpacity:o.overlayOpacity,closeOnOverlayClick:o.closeOnOverlayClick,appendTo(d){return document.body},zIndex:s.value}),c=d=>{o.closeOnEscape&&d.key==="Escape"&&l.value&&a()};en(()=>{document.addEventListener("keydown",c)}),Jn(()=>{document.removeEventListener("keydown",c)}),t({show:i,hide:a,isVisible:l});const u=n;return Qe(()=>l.value,d=>{u(d?"shown":"hidden")}),(d,h)=>{const f=Nh("tooltip");return K(),ce("div",{ref_key:"popupRef",ref:r,class:se(d.$style.popupContainer)},[Te("div",{class:se(d.$style.popupWrapper)},[Te("div",{class:se(d.$style.header)},[xt(d.$slots,"header",{},()=>[Te("span",{class:se(d.$style["header-title"])},it(e.popupName),3)]),o.showCloseBtn?qe((K(),ze(pt,{key:0,variant:["icon","text"],onClick:W(a),"aria-label":"Close popup",size:"small"},{default:be(()=>[ye(ct,{src:"Xmark",size:8})]),_:1},8,["onClick"])),[[f,"Close"]]):Xe("",!0)],2),Te("div",{class:se(d.$style.body)},[xt(d.$slots,"default")],2),d.$slots.footer?(K(),ce("div",{key:0,class:se(d.$style.footer)},[xt(d.$slots,"footer")],2)):Xe("",!0)],2)],2)}}}),[["__cssModules",{$style:{popupContainer:"_popupContainer_1986t_1",popupWrapper:"_popupWrapper_1986t_9",popupFadeIn:"_popupFadeIn_1986t_1",header:"_header_1986t_24","header-title":"_header-title_1986t_34",body:"_body_1986t_43",footer:"_footer_1986t_48"}}]]),_se=["onMouseenter","onMouseleave"],Rse=["innerHTML"],Tse=["innerHTML"],Dse=["data-tooltip"],Ise={key:2,style:{"min-width":"24px","min-height":"24px",position:"absolute",top:"0",right:"0",display:"flex","align-items":"center","justify-content":"center"}},xse=bt(tt({__name:"Snackbar",setup(e){const t=Kt,n=v3,o=Es(),{removeNotification:s}=o,{notifications:r}=us(o),i=f=>f.trim().startsWith("<svg"),a=H("Copy"),l=()=>{setTimeout(()=>{a.value="Copy"},3e3)},c=f=>{navigator.clipboard.writeText(f).then(()=>{a.value="Copied",l()},()=>{a.value="Copy failed",l()})},u=H(new Set),d=f=>{var p;u.value.add(f),(p=o.pauseAutoDismiss)==null||p.call(o,f)},h=f=>{var p;u.value.delete(f),(p=o.resumeAutoDismiss)==null||p.call(o,f)};return(f,p)=>(K(),ze(Zz,{name:"list",tag:"div",class:se(["notification-center",f.$style["notification-wrapper"]])},{default:be(()=>[(K(!0),ce(Ft,null,Pn(W(r),g=>{var v;return qe((K(),ce("div",{key:g.id,class:se([f.$style["notification-item"],f.$style[`notification--${g.type||"info"}`],!(g!=null&&g.actions)||((v=g==null?void 0:g.actions)==null?void 0:v.length)==0?f.$style["snackbar-type"]:""]),onMouseenter:C=>d(g.id),onMouseleave:C=>h(g.id)},[Te("p",{class:se(f.$style.snackbar__message)},[g.type!="white"?(K(),ce("span",{key:0,class:se(f.$style.snackbar__icon)},[!g.icon&&g.type=="success"?(K(),ze(ct,{key:0,src:"CircleCheck",source:"remote"})):Xe("",!0),!g.icon&&g.type=="interactive"?(K(),ze(ct,{key:1,src:"CircleCheck",source:"remote"})):!g.icon&&g.type=="error"?(K(),ze(ct,{key:2,src:"CircleXMark",source:"remote"})):g.icon&&i(g.icon)?(K(),ce("i",{key:3,class:se(f.$style["icon-draw"]),innerHTML:g.icon},null,10,Rse)):g.icon&&!i(g.icon)?(K(),ze(ct,{key:4,src:g.icon,source:"remote",color:"var(--primary-color)"},null,8,["src"])):Xe("",!0)],2)):Xe("",!0),Te("span",{class:se(f.$style["error-message"])},[Te("span",{class:se(f.$style.message),innerHTML:g.message},null,10,Tse)],2)],2),g.actions?(K(),ce("div",{key:0,class:se(f.$style["actions-notification"]),"data-notification":"true"},[(K(!0),ce(Ft,null,Pn(g.actions,C=>(K(),ze(pt,jt({key:C.label},{ref_for:!0},C,{onClick:Nt(C.action,["prevent","stop"]),variant:"secondary",size:"small"}),{prefix:be(()=>[C.btnIcon?(K(),ze(ct,{key:0,src:C.btnIcon,source:"remote",color:"var(--primary-color)"},null,8,["src"])):Xe("",!0)]),_:2},1040,["onClick"]))),128))],2)):Xe("",!0),g.type!=="interactive"&&g.type!=="white"?qe((K(),ce("div",{key:1,"data-tooltip":a.value,style:{"min-width":"24px"}},[ye(pt,{variant:"secondary",onClick:C=>c(g.message),class:se(f.$style["copy-btn"])},{prefix:be(()=>[ye(ct,{src:"Copy",source:"remote",color:"var(--primary-color)",size:"11"})]),_:1},8,["onClick","class"])],8,Dse)),[[W(t),a.value]]):Xe("",!0),g.type=="interactive"?qe((K(),ce("div",Ise,[ye(pt,{variant:"tertiary",onClick:C=>W(s)(g.id),class:se(f.$style["close-btn"]),size:18},{default:be(()=>[ye(ct,{src:"XMarkSolid",size:"9"})]),_:1},8,["onClick","class"])])),[[W(t),"Close"]]):Xe("",!0)],42,_se)),[[W(n)]])}),128))]),_:1},8,["class"]))}}),[["__cssModules",{$style:{"notification-wrapper":"_notification-wrapper_1gm88_1","notification-item":"_notification-item_1gm88_15","notification--success":"_notification--success_1gm88_30","notification--error":"_notification--error_1gm88_36","close-btn":"_close-btn_1gm88_42","notification--info":"_notification--info_1gm88_45","notification--warning":"_notification--warning_1gm88_52","notification--interactive":"_notification--interactive_1gm88_59","notification--white":"_notification--white_1gm88_67","snackbar-type":"_snackbar-type_1gm88_75",snackbar__message:"_snackbar__message_1gm88_84",message:"_message_1gm88_97","error-message":"_error-message_1gm88_105",snackbar__icon:"_snackbar__icon_1gm88_111","actions-notification":"_actions-notification_1gm88_120","icon-draw":"_icon-draw_1gm88_128","copy-btn":"_copy-btn_1gm88_136"}}]]);/*!
161
161
  * vue-draggable-next v2.3.0
162
162
  * (c) 2025 Anish George
@@ -254,4 +254,4 @@ If you are trying to annotate ${o} with application data, use the '${o}.context'
254
254
  `,OEe=class extends cbe{constructor(e){super(e),this.config=e,this.isFirstLine=!0,this.result="";const{suppressQuotes:t,columnSeparator:n}=e;this.suppressQuotes=t,this.columnSeparator=n}addCustomContent(e){e&&(typeof e=="string"?(/^\s*\n/.test(e)||this.beginNewLine(),e=e.replace(/\r?\n/g,aG),this.result+=e):e.forEach(t=>{this.beginNewLine(),t.forEach((n,o)=>{o!==0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(n.data.value||""),n.mergeAcross&&this.appendEmptyCells(n.mergeAcross)})}))}onNewHeaderGroupingRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderGroupingRowColumn.bind(this)}}onNewHeaderGroupingRowColumn(e,t,n,o){n!=0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(t),this.appendEmptyCells(o)}appendEmptyCells(e){for(let t=1;t<=e;t++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn(e,t){t!=0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(this.extractHeaderValue(e))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn(e,t,n){t!=0&&(this.result+=this.columnSeparator);const o=this.extractRowCellValue(e,t,t,"csv",n);this.result+=this.putInQuotes(o.valueFormatted??o.value)}putInQuotes(e){if(this.suppressQuotes)return e;if(e==null)return'""';let t;return typeof e=="string"?t=e:typeof e.toString=="function"?t=e.toString():(Je(53),t=""),'"'+t.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){this.isFirstLine||(this.result+=aG),this.isFirstLine=!1}},MEe=class extends lbe{constructor(){super(...arguments),this.beanName="csvCreator"}wireBeans(e){this.colModel=e.colModel,this.colNames=e.colNames,this.rowGroupColsSvc=e.rowGroupColsSvc,this.valueSvc=e.valueSvc}getMergedParams(e){const t=this.gos.get("defaultCsvExportParams");return Object.assign({},t,e)}export(e){if(this.isExportSuppressed()){Je(51);return}const t=this.getMergedParams(e),n=this.getData(t),o=new Blob(["\uFEFF",n],{type:"text/plain"}),s=typeof t.fileName=="function"?t.fileName(Ot(this.gos,{})):t.fileName;ube(this.getFileName(s),o)}exportDataAsCsv(e){this.export(e)}getDataAsCsv(e,t=!1){const n=t?Object.assign({},e):this.getMergedParams(e);return this.getData(n)}getDefaultFileExtension(){return"csv"}createSerializingSession(e){const{colModel:t,colNames:n,rowGroupColsSvc:o,valueSvc:s,gos:r}=this,{processCellCallback:i,processHeaderCallback:a,processGroupHeaderCallback:l,processRowGroupCallback:c,suppressQuotes:u,columnSeparator:d}=e;return new OEe({colModel:t,colNames:n,valueSvc:s,gos:r,processCellCallback:i||void 0,processHeaderCallback:a||void 0,processGroupHeaderCallback:l||void 0,processRowGroupCallback:c||void 0,suppressQuotes:u||!1,columnSeparator:d||",",rowGroupColsSvc:o})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}};function NEe(e,t){var n;return(n=e.csvCreator)==null?void 0:n.getDataAsCsv(t)}function LEe(e,t){var n;(n=e.csvCreator)==null||n.exportDataAsCsv(t)}var VEe={moduleName:"CsvExport",version:ut,beans:[MEe],apiFunctions:{getDataAsCsv:NEe,exportDataAsCsv:LEe},dependsOn:[AEe]},BEe=class extends je{constructor(e,t,n){super(),this.id=e,this.parentCache=t,this.params=n,this.state="needsLoading",this.version=0,this.startRow=e*n.blockSize,this.endRow=this.startRow+n.blockSize}load(){this.state="loading",this.loadFromDatasource()}setStateWaitingToLoad(){this.version++,this.state="needsLoading"}pageLoadFailed(e){this.isRequestMostRecentAndLive(e)&&(this.state="failed"),this.dispatchLocalEvent({type:"loadComplete"})}pageLoaded(e,t,n){this.successCommon(e,{rowData:t,rowCount:n})}isRequestMostRecentAndLive(e){const t=e===this.version,n=this.isAlive();return t&&n}successCommon(e,t){this.dispatchLocalEvent({type:"loadComplete"}),this.isRequestMostRecentAndLive(e)&&(this.state="loaded",this.processServerResult(t))}postConstruct(){this.rowNodes=[];const{params:{blockSize:e,rowHeight:t},startRow:n,beans:o,rowNodes:s}=this;for(let r=0;r<e;r++){const i=n+r,a=new kl(o);a.setRowHeight(t),a.uiLevel=0,a.setRowIndex(i),a.setRowTop(t*i),s.push(a)}}getBlockStateJson(){const{id:e,startRow:t,endRow:n,state:o}=this;return{id:""+e,state:{blockNumber:e,startRow:t,endRow:n,pageStatus:o}}}setDataAndId(e,t,n){ht(t)?e.setDataAndId(t,n.toString()):e.setDataAndId(void 0,void 0)}loadFromDatasource(){const e=this.createLoadParams();if(Gn(this.params.datasource.getRows)){Je(90);return}window.setTimeout(()=>{this.params.datasource.getRows(e)},0)}createLoadParams(){const{startRow:e,endRow:t,version:n,params:{sortModel:o,filterModel:s},gos:r}=this;return{startRow:e,endRow:t,successCallback:this.pageLoaded.bind(this,n),failCallback:this.pageLoadFailed.bind(this,n),sortModel:o,filterModel:s,context:Ot(r,{}).context}}forEachNode(e,t,n){this.rowNodes.forEach((o,s)=>{this.startRow+s<n&&e(o,t.value++)})}getRow(e,t=!1){t||(this.lastAccessed=this.params.lastAccessedSequence.value++);const n=e-this.startRow;return this.rowNodes[n]}processServerResult(e){const{rowNodes:t,beans:n}=this;t.forEach((s,r)=>{const i=e.rowData?e.rowData[r]:void 0;!s.id&&s.alreadyRendered&&i&&(t[r]=new kl(n),t[r].setRowIndex(s.rowIndex),t[r].setRowTop(s.rowTop),t[r].setRowHeight(s.rowHeight),s.clearRowTopAndRowIndex()),this.setDataAndId(t[r],i,this.startRow+r)});const o=e.rowCount!=null&&e.rowCount>=0?e.rowCount:void 0;this.parentCache.pageLoaded(this,o)}destroy(){for(const e of this.rowNodes)e.clearRowTopAndRowIndex();super.destroy()}},$Ee=2,HEe=class extends je{constructor(e){super(),this.params=e,this.lastRowIndexKnown=!1,this.blocks={},this.blockCount=0,this.rowCount=e.initialRowCount}getRow(e,t=!1){const n=Math.floor(e/this.params.blockSize);let o=this.blocks[n];if(!o){if(t)return;o=this.createBlock(n)}return o.getRow(e)}createBlock(e){const t=this.params,n=this.createBean(new BEe(e,this,t));return this.blocks[n.id]=n,this.blockCount++,this.purgeBlocksIfNeeded(n),t.rowNodeBlockLoader.addBlock(n),n}refreshCache(){if(this.blockCount==0){this.purgeCache();return}for(const t of this.getBlocksInOrder())t.setStateWaitingToLoad();this.params.rowNodeBlockLoader.checkBlockToLoad()}destroy(){for(const e of this.getBlocksInOrder())this.destroyBlock(e);super.destroy()}getRowCount(){return this.rowCount}isLastRowIndexKnown(){return this.lastRowIndexKnown}pageLoaded(e,t){this.isAlive()&&(Rl(this.gos,`InfiniteCache - onPageLoaded: page = ${e.id}, lastRow = ${t}`),this.checkRowCount(e,t),this.onCacheUpdated())}purgeBlocksIfNeeded(e){const t=this.getBlocksInOrder().filter(i=>i!=e),n=(i,a)=>a.lastAccessed-i.lastAccessed;t.sort(n);const o=this.params.maxBlocksInCache>0,s=o?this.params.maxBlocksInCache-1:null,r=$Ee-1;t.forEach((i,a)=>{const l=i.state==="needsLoading"&&a>=r,c=o?a>=s:!1;if(l||c){if(this.isBlockCurrentlyDisplayed(i)||this.isBlockFocused(i))return;this.removeBlockFromCache(i)}})}isBlockFocused(e){const t=this.beans.focusSvc.getFocusCellToUseAfterRefresh();if(!t||t.rowPinned!=null)return!1;const{startRow:n,endRow:o}=e;return t.rowIndex>=n&&t.rowIndex<o}isBlockCurrentlyDisplayed(e){const{startRow:t,endRow:n}=e;return this.beans.rowRenderer.isRangeInRenderedViewport(t,n-1)}removeBlockFromCache(e){e&&this.destroyBlock(e)}checkRowCount(e,t){if(typeof t=="number"&&t>=0)this.rowCount=t,this.lastRowIndexKnown=!0;else if(!this.lastRowIndexKnown){const{blockSize:n,overflowSize:o}=this.params,r=(e.id+1)*n+o;this.rowCount<r&&(this.rowCount=r)}}setRowCount(e,t){this.rowCount=e,ht(t)&&(this.lastRowIndexKnown=t),this.lastRowIndexKnown||this.rowCount%this.params.blockSize===0&&this.rowCount++,this.onCacheUpdated()}forEachNodeDeep(e){const t={value:0};for(const n of this.getBlocksInOrder())n.forEachNode(e,t,this.rowCount)}getBlocksInOrder(){const e=(n,o)=>n.id-o.id;return Object.values(this.blocks).sort(e)}destroyBlock(e){delete this.blocks[e.id],this.destroyBean(e),this.blockCount--,this.params.rowNodeBlockLoader.removeBlock(e)}onCacheUpdated(){this.isAlive()&&(this.destroyAllBlocksPastVirtualRowCount(),this.eventSvc.dispatchEvent({type:"storeUpdated"}))}destroyAllBlocksPastVirtualRowCount(){const e=[];for(const t of this.getBlocksInOrder())t.id*this.params.blockSize>=this.rowCount&&e.push(t);if(e.length>0)for(const t of e)this.destroyBlock(t)}purgeCache(){for(const e of this.getBlocksInOrder())this.removeBlockFromCache(e);this.lastRowIndexKnown=!1,this.rowCount===0&&(this.rowCount=this.params.initialRowCount),this.onCacheUpdated()}getRowNodesInRange(e,t){const n=[];let o=-1,s=!1;const r={value:0};let i=!1;for(const l of this.getBlocksInOrder())if(!i){if(s&&o+1!==l.id){i=!0;continue}o=l.id,l.forEachNode(c=>{const u=c===e||c===t;(s||u)&&n.push(c),u&&(s=!s)},r,this.rowCount)}return i||s?[]:n}},GEe=class extends je{constructor(){super(...arguments),this.beanName="rowModel",this.rootNode=null}getRowBounds(e){return{rowHeight:this.rowHeight,rowTop:this.rowHeight*e}}ensureRowHeightsValid(){return!1}postConstruct(){if(this.gos.get("rowModelType")!=="infinite")return;const e=this.beans,t=new kl(e);this.rootNode=t,t.level=-1,this.rowHeight=zc(e),this.addEventListeners(),this.addDestroyFunc(()=>this.destroyCache())}start(){this.setDatasource(this.gos.get("datasource"))}destroy(){this.destroyDatasource(),super.destroy(),this.rootNode=null}destroyDatasource(){this.datasource&&(this.destroyBean(this.datasource),this.beans.rowRenderer.datasourceChanged(),this.datasource=null)}addEventListeners(){this.addManagedEventListeners({filterChanged:this.reset.bind(this),sortChanged:this.reset.bind(this),newColumnsLoaded:this.onColumnEverything.bind(this),storeUpdated:this.dispatchModelUpdatedEvent.bind(this)}),this.addManagedPropertyListener("datasource",()=>this.setDatasource(this.gos.get("datasource"))),this.addManagedPropertyListener("cacheBlockSize",()=>this.resetCache()),this.addManagedPropertyListener("rowHeight",()=>{this.rowHeight=zc(this.beans),this.cacheParams.rowHeight=this.rowHeight,this.updateRowHeights()})}onColumnEverything(){var t;let e;this.cacheParams?e=!Ep(this.cacheParams.sortModel,((t=this.beans.sortSvc)==null?void 0:t.getSortModel())??[]):e=!0,e&&this.reset()}getType(){return"infinite"}setDatasource(e){this.destroyDatasource(),this.datasource=e,e&&this.reset()}isEmpty(){return!this.infiniteCache}isRowsToRender(){return!!this.infiniteCache}getNodesInRangeForSelection(e,t){var n;return((n=this.infiniteCache)==null?void 0:n.getRowNodesInRange(e,t))??[]}reset(){var n;if(!this.datasource)return;Bd(this.gos)!=null||(n=this.beans.selectionSvc)==null||n.reset("rowDataChanged"),this.resetCache()}dispatchModelUpdatedEvent(){this.eventSvc.dispatchEvent({type:"modelUpdated",newPage:!1,newPageSize:!1,newData:!1,keepRenderedRows:!0,animate:!1})}resetCache(){this.destroyCache();const e=this.beans,{filterManager:t,sortSvc:n,rowNodeBlockLoader:o,eventSvc:s,gos:r}=e;this.cacheParams={datasource:this.datasource,filterModel:(t==null?void 0:t.getFilterModel())??{},sortModel:(n==null?void 0:n.getSortModel())??[],rowNodeBlockLoader:o,initialRowCount:r.get("infiniteInitialRowCount"),maxBlocksInCache:r.get("maxBlocksInCache"),rowHeight:zc(e),overflowSize:r.get("cacheOverflowSize"),blockSize:r.get("cacheBlockSize"),lastAccessedSequence:{value:0}},this.infiniteCache=this.createBean(new HEe(this.cacheParams)),s.dispatchEventOnce({type:"rowCountReady"}),this.dispatchModelUpdatedEvent()}updateRowHeights(){this.forEachNode(e=>{e.setRowHeight(this.rowHeight),e.setRowTop(this.rowHeight*e.rowIndex)}),this.dispatchModelUpdatedEvent()}destroyCache(){this.infiniteCache=this.destroyBean(this.infiniteCache)}getRow(e){const t=this.infiniteCache;if(t&&!(e>=t.getRowCount()))return t.getRow(e)}getRowNode(e){let t;return this.forEachNode(n=>{n.id===e&&(t=n)}),t}forEachNode(e){var t;(t=this.infiniteCache)==null||t.forEachNodeDeep(e)}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}getRowIndexAtPixel(e){if(this.rowHeight!==0){const t=Math.floor(e/this.rowHeight),n=this.getRowCount()-1;return t>n?n:t}return 0}getRowCount(){return this.infiniteCache?this.infiniteCache.getRowCount():0}isRowPresent(e){return!!this.getRowNode(e.id)}refreshCache(){var e;(e=this.infiniteCache)==null||e.refreshCache()}purgeCache(){var e;(e=this.infiniteCache)==null||e.purgeCache()}isLastRowIndexKnown(){var e;return((e=this.infiniteCache)==null?void 0:e.isLastRowIndexKnown())??!1}setRowCount(e,t){var n;(n=this.infiniteCache)==null||n.setRowCount(e,t)}resetRowHeights(){}onRowHeightChanged(){}};function UEe(e){var t;(t=Iw(e))==null||t.refreshCache()}function WEe(e){var t;(t=Iw(e))==null||t.purgeCache()}function zEe(e){var t;return(t=Iw(e))==null?void 0:t.getRowCount()}var jEe=class extends je{constructor(){super(...arguments),this.beanName="rowNodeBlockLoader",this.activeBlockLoadsCount=0,this.blocks=[],this.active=!0}postConstruct(){this.maxConcurrentRequests=Mue(this.gos);const e=this.gos.get("blockLoadDebounceMillis");e&&e>0&&(this.checkBlockToLoadDebounce=qo(this,this.performCheckBlocksToLoad.bind(this),e))}addBlock(e){this.blocks.push(e),e.addEventListener("loadComplete",this.loadComplete.bind(this)),this.checkBlockToLoad()}removeBlock(e){Qr(this.blocks,e)}destroy(){super.destroy(),this.active=!1}loadComplete(){this.activeBlockLoadsCount--,this.checkBlockToLoad()}checkBlockToLoad(){this.checkBlockToLoadDebounce?this.checkBlockToLoadDebounce():this.performCheckBlocksToLoad()}performCheckBlocksToLoad(){if(!this.active)return;if(this.printCacheStatus(),this.maxConcurrentRequests!=null&&this.activeBlockLoadsCount>=this.maxConcurrentRequests){Rl(this.gos,"RowNodeBlockLoader - checkBlockToLoad: max loads exceeded");return}const e=this.maxConcurrentRequests!=null?this.maxConcurrentRequests-this.activeBlockLoadsCount:1,t=this.blocks.filter(n=>n.state==="needsLoading").slice(0,e);this.activeBlockLoadsCount+=t.length;for(const n of t)n.load();this.printCacheStatus()}getBlockState(){const e={};return this.blocks.forEach(t=>{const{id:n,state:o}=t.getBlockStateJson();e[n]=o}),e}printCacheStatus(){Rl(this.gos,`RowNodeBlockLoader - printCacheStatus: activePageLoadsCount = ${this.activeBlockLoadsCount}, blocks = ${JSON.stringify(this.getBlockState())}`)}},KEe={moduleName:"InfiniteRowModelCore",version:ut,rowModels:["infinite"],beans:[GEe,jEe]},qEe={moduleName:"InfiniteRowModel",version:ut,apiFunctions:{refreshInfiniteCache:UEe,purgeInfiniteCache:WEe,getInfiniteRowCount:zEe},dependsOn:[KEe,aEe]},YEe="↑",XEe="↓",ZEe={tag:"span",children:[{tag:"span",ref:"eDelta",cls:"ag-value-change-delta"},{tag:"span",ref:"eValue",cls:"ag-value-change-value"}]},JEe=class extends Sn{constructor(){super(ZEe),this.eValue=dt,this.eDelta=dt,this.refreshCount=0}init(e){this.refresh(e,!0)}showDelta(e,t){const n=Math.abs(t),o=e.formatValue(n),s=ht(o)?o:n,r=t>=0,i=this.eDelta;r?i.textContent=YEe+s:i.textContent=XEe+s,i.classList.toggle("ag-value-change-delta-up",r),i.classList.toggle("ag-value-change-delta-down",!r)}setTimerToRemoveDelta(){this.refreshCount++;const e=this.refreshCount;this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{e===this.refreshCount&&this.hideDeltaValue()},2e3)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),Ko(this.eDelta)}refresh(e,t=!1){var c;const{value:n,valueFormatted:o}=e,{eValue:s,lastValue:r,beans:i}=this;if(n===r||(ht(o)?s.textContent=o:ht(n)?s.textContent=n:Ko(s),(c=i.filterManager)!=null&&c.isSuppressFlashingCellsBecauseFiltering()))return!1;const a=n&&typeof n=="object"&&"toNumber"in n?n.toNumber():n,l=r&&typeof r=="object"&&"toNumber"in r?r.toNumber():r;if(a===l)return!1;if(typeof a=="number"&&typeof l=="number"){const u=a-l;this.showDelta(e,u)}return r&&s.classList.add("ag-value-change-value-highlight"),t||this.setTimerToRemoveDelta(),this.lastValue=n,!0}},QEe=".ag-value-slide-out{opacity:1}:where(.ag-ltr) .ag-value-slide-out{margin-right:5px;transition:opacity 3s,margin-right 3s}:where(.ag-rtl) .ag-value-slide-out{margin-left:5px;transition:opacity 3s,margin-left 3s}:where(.ag-ltr,.ag-rtl) .ag-value-slide-out{transition-timing-function:linear}.ag-value-slide-out-end{opacity:0}:where(.ag-ltr) .ag-value-slide-out-end{margin-right:10px}:where(.ag-rtl) .ag-value-slide-out-end{margin-left:10px}",e_e={tag:"span",children:[{tag:"span",ref:"eCurrent",cls:"ag-value-slide-current"}]},t_e=class extends Sn{constructor(){super(e_e),this.eCurrent=dt,this.refreshCount=0,this.registerCSS(QEe)}init(e){this.refresh(e,!0)}addSlideAnimation(){var s;this.refreshCount++;const e=this.refreshCount;(s=this.ePrevious)==null||s.remove();const{beans:t,eCurrent:n}=this,o=uo({tag:"span",cls:"ag-value-slide-previous ag-value-slide-out"});this.ePrevious=o,o.textContent=n.textContent,this.getGui().insertBefore(o,n),t.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{e===this.refreshCount&&this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{var r;e===this.refreshCount&&((r=this.ePrevious)==null||r.remove(),this.ePrevious=null)},3e3)})}refresh(e,t=!1){var s;let n=e.value;if(Gn(n)&&(n=""),n===this.lastValue||(s=this.beans.filterManager)!=null&&s.isSuppressFlashingCellsBecauseFiltering())return!1;t||this.addSlideAnimation(),this.lastValue=n;const o=this.eCurrent;return ht(e.valueFormatted)?o.textContent=e.valueFormatted:ht(e.value)?o.textContent=n:Ko(o),!0}},n_e=class extends je{constructor(){super(...arguments),this.beanName="cellFlashSvc",this.nextAnimationTime=null,this.nextAnimationCycle=null,this.animations={highlight:new Map,"data-changed":new Map}}animateCell(e,t,n=this.beans.gos.get("cellFlashDuration"),o=this.beans.gos.get("cellFadeDuration")){const s=this.animations[t];s.delete(e);const r=Date.now(),i=r+n,a=r+n+o,l={phase:"flash",flashEndTime:i,fadeEndTime:a};s.set(e,l);const c=`ag-cell-${t}`,u=`${c}-animation`,{comp:d,eGui:{style:h}}=e;d.toggleCss(c,!0),d.toggleCss(u,!1),h.removeProperty("transition"),h.removeProperty("transition-delay"),this.nextAnimationTime&&i+15<this.nextAnimationTime&&(clearTimeout(this.nextAnimationCycle),this.nextAnimationCycle=null,this.nextAnimationTime=null),this.nextAnimationCycle||(this.beans.frameworkOverrides.wrapIncoming(()=>{this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),n)}),this.nextAnimationTime=i)}advanceAnimations(){const e=Date.now();let t=null;for(const n of Object.keys(this.animations)){const o=this.animations[n],s=`ag-cell-${n}`,r=`${s}-animation`;for(const[i,a]of o){if(!i.isAlive()||!i.comp){o.delete(i);continue}const{phase:l,flashEndTime:c,fadeEndTime:u}=a,d=l==="flash"?c:u;if(!(e+15>=d)){t=Math.min(d,t??1/0);continue}const{comp:f,eGui:{style:p}}=i;switch(l){case"flash":f.toggleCss(s,!1),f.toggleCss(r,!0),p.transition=`background-color ${u-c}ms`,p.transitionDelay=`${c-e}ms`,t=Math.min(u,t??1/0),a.phase="fade";break;case"fade":f.toggleCss(s,!1),f.toggleCss(r,!1),p.removeProperty("transition"),p.removeProperty("transition-delay"),o.delete(i);break}}}t==null?(this.nextAnimationTime=null,this.nextAnimationCycle=null):t&&(this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),t-e),this.nextAnimationTime=t)}onFlashCells(e,t){if(!e.comp)return;const n=tme(e.cellPosition);t.cells[n]&&this.animateCell(e,"highlight")}flashCell(e,t){this.animateCell(e,"data-changed",t==null?void 0:t.flashDuration,t==null?void 0:t.fadeDuration)}destroy(){for(const e of Object.keys(this.animations))this.animations[e].clear()}};function o_e(e,t={}){const{cellFlashSvc:n}=e;n&&e.frameworkOverrides.wrapIncoming(()=>{for(const o of e.rowRenderer.getCellCtrls(t.rowNodes,t.columns))n.flashCell(o,t)})}var s_e={moduleName:"HighlightChanges",version:ut,beans:[n_e],userComponents:{agAnimateShowChangeCellRenderer:JEe,agAnimateSlideCellRenderer:t_e},apiFunctions:{flashCells:o_e}};function r_e(e){var t;return((t=e.stateSvc)==null?void 0:t.getState())??{}}function i_e(e,t,n){var o;return(o=e.stateSvc)==null?void 0:o.setState(t,n)}function lG(e){return e={...e},e.version||(e.version="32.1.0"),e.version==="32.1.0"&&(e=a_e(e)),e.version=ut,e}function a_e(e){return e.cellSelection=l_e(e,"rangeSelection"),e}function l_e(e,t){if(e&&typeof e=="object")return e[t]}var c_e=class extends je{constructor(){super(...arguments),this.beanName="stateSvc",this.updateRowGroupExpansionStateTimer=0,this.suppressEvents=!0,this.queuedUpdateSources=new Set,this.dispatchStateUpdateEventDebounced=qo(this,()=>this.dispatchQueuedStateUpdateEvents(),0),this.onRowGroupOpenedDebounced=qo(this,()=>{this.beans.gos.get("ssrmExpandAllAffectsAllRows")?(this.updateCachedState("ssrmRowGroupExpansion",this.getRowGroupExpansionState()),this.updateCachedState("rowGroupExpansion",void 0)):(this.updateCachedState("rowGroupExpansion",this.getRowGroupExpansionState()),this.updateCachedState("ssrmRowGroupExpansion",void 0))},0),this.onRowSelectedDebounced=qo(this,()=>{this.staleStateKeys.delete("rowSelection"),this.updateCachedState("rowSelection",this.getRowSelectionState())},0),this.staleStateKeys=new Set}postConstruct(){const{gos:e,ctrlsSvc:t,colDelayRenderSvc:n}=this.beans;this.isClientSideRowModel=lo(e);const o=lG(e.get("initialState")??{}),s=o.partialColumnState;delete o.partialColumnState,this.cachedState=o;const r=this.suppressEventsAndDispatchInitEvent.bind(this);t.whenReady(this,()=>r(()=>this.setupStateOnGridReady(o))),(o.columnOrder||o.columnVisibility||o.columnSizing||o.columnPinning||o.columnGroup)&&(n==null||n.hideColumns("columnState"));const[i,a,l]=this.addManagedEventListeners({newColumnsLoaded:({source:c})=>{c==="gridInitializing"&&(i(),r(()=>{this.setupStateOnColumnsInitialised(o,!!s),n==null||n.revealColumns("columnState")}))},rowCountReady:()=>{a==null||a(),r(()=>this.setupStateOnRowCountReady(o))},firstDataRendered:()=>{l==null||l(),r(()=>this.setupStateOnFirstDataRendered(o))}})}destroy(){super.destroy(),clearTimeout(this.updateRowGroupExpansionStateTimer),this.queuedUpdateSources.clear()}getState(){return this.staleStateKeys.size&&this.refreshStaleState(),this.cachedState}setState(e,t){const n=lG(e);delete n.partialColumnState,this.cachedState=n,this.startSuppressEvents();const o="api",s=t?new Set(t):void 0;this.setGridReadyState(n,o,s),this.setColumnsInitialisedState(n,o,!!s,s),this.setRowCountState(n,o,s),setTimeout(()=>{this.isAlive()&&this.setFirstDataRenderedState(n,o,s),this.stopSuppressEvents(o)})}setGridReadyState(e,t,n){var o,s;t==="api"&&!(n!=null&&n.has("sideBar"))&&((s=(o=this.beans.sideBar)==null?void 0:o.comp)==null||s.setState(e.sideBar)),this.updateCachedState("sideBar",this.getSideBarState())}setupStateOnGridReady(e){this.setGridReadyState(e,"gridInitializing");const t=()=>this.updateCachedState("sideBar",this.getSideBarState());this.addManagedEventListeners({toolPanelVisibleChanged:t,sideBarUpdated:t})}updateColumnAndGroupState(){this.updateColumnState(["aggregation","columnOrder","columnPinning","columnSizing","columnVisibility","pivot","rowGroup","sort"]),this.updateCachedState("columnGroup",this.getColumnGroupState())}setColumnsInitialisedState(e,t,n,o){this.setColumnState(e,t,n,o),this.setColumnGroupState(e,t,o),this.updateColumnAndGroupState()}setupStateOnColumnsInitialised(e,t){this.setColumnsInitialisedState(e,"gridInitializing",t);const n=o=>()=>this.updateColumnState([o]);this.addManagedEventListeners({columnValueChanged:n("aggregation"),columnMoved:n("columnOrder"),columnPinned:n("columnPinning"),columnResized:n("columnSizing"),columnVisible:n("columnVisibility"),columnPivotChanged:n("pivot"),columnPivotModeChanged:n("pivot"),columnRowGroupChanged:n("rowGroup"),sortChanged:n("sort"),newColumnsLoaded:this.updateColumnAndGroupState.bind(this),columnGroupOpened:()=>this.updateCachedState("columnGroup",this.getColumnGroupState())})}setRowCountState(e,t,n){const{filter:o,rowGroupExpansion:s,ssrmRowGroupExpansion:r,rowSelection:i,pagination:a}=e,l=(u,d)=>!(n!=null&&n.has(u))&&(d||t==="api");l("filter",o)&&this.setFilterState(o),l("rowGroupExpansion",s)&&this.setRowGroupExpansionState(r,s,t),l("rowSelection",i)&&this.setRowSelectionState(i,t),l("pagination",a)&&this.setPaginationState(a,t);const c=this.updateCachedState.bind(this);c("filter",this.getFilterState()),this.beans.gos.get("ssrmExpandAllAffectsAllRows")?(c("ssrmRowGroupExpansion",this.getRowGroupExpansionState()),c("rowGroupExpansion",void 0)):(c("rowGroupExpansion",this.getRowGroupExpansionState()),c("ssrmRowGroupExpansion",void 0)),c("rowSelection",this.getRowSelectionState()),c("pagination",this.getPaginationState())}setupStateOnRowCountReady(e){this.setRowCountState(e,"gridInitializing");const t=this.updateCachedState.bind(this),n=()=>{this.updateRowGroupExpansionStateTimer=0,this.beans.gos.get("ssrmExpandAllAffectsAllRows")?(t("ssrmRowGroupExpansion",this.getRowGroupExpansionState()),t("rowGroupExpansion",void 0)):(t("rowGroupExpansion",this.getRowGroupExpansionState()),t("ssrmRowGroupExpansion",void 0))},o=()=>t("filter",this.getFilterState()),{gos:s,colFilter:r}=this.beans;this.addManagedEventListeners({filterChanged:o,rowExpansionStateChanged:this.onRowGroupOpenedDebounced,expandOrCollapseAll:n,columnRowGroupChanged:n,rowDataUpdated:()=>{(s.get("groupDefaultExpanded")!==0||s.get("isGroupOpenByDefault"))&&(this.updateRowGroupExpansionStateTimer||(this.updateRowGroupExpansionStateTimer=setTimeout(n)))},selectionChanged:()=>{this.staleStateKeys.add("rowSelection"),this.onRowSelectedDebounced()},paginationChanged:i=>{(i.newPage||i.newPageSize)&&t("pagination",this.getPaginationState())}}),r&&this.addManagedListeners(r,{filterStateChanged:o})}setFirstDataRenderedState(e,t,n){const{scroll:o,cellSelection:s,focusedCell:r,columnOrder:i,rowPinning:a}=e,l=(d,h)=>!(n!=null&&n.has(d))&&(h||t==="api");l("focusedCell",r)&&this.setFocusedCellState(r),l("cellSelection",s)&&this.setCellSelectionState(s),l("scroll",o)&&this.setScrollState(o),l("rowPinning",a)&&this.setRowPinningState(a),this.setColumnPivotState(!!(i!=null&&i.orderedColIds),t);const c=this.updateCachedState.bind(this);c("sideBar",this.getSideBarState()),c("focusedCell",this.getFocusedCellState());const u=this.getRangeSelectionState();c("rangeSelection",u),c("cellSelection",u),c("scroll",this.getScrollState())}setupStateOnFirstDataRendered(e){this.setFirstDataRenderedState(e,"gridInitializing");const t=this.updateCachedState.bind(this),n=()=>t("focusedCell",this.getFocusedCellState());this.addManagedEventListeners({cellFocused:n,cellFocusCleared:n,cellSelectionChanged:o=>{if(o.finished){const s=this.getRangeSelectionState();t("rangeSelection",s),t("cellSelection",s)}},bodyScrollEnd:()=>t("scroll",this.getScrollState()),pinnedRowsChanged:()=>t("rowPinning",this.getRowPinningState())})}getColumnState(){const e=this.beans;return rbe(Zy(e),e.colModel.isPivotMode())}setColumnState(e,t,n,o){const{sort:s,rowGroup:r,aggregation:i,pivot:a,columnPinning:l,columnVisibility:c,columnSizing:u,columnOrder:d}=e;let h=!1;const f=(I,x)=>{const O=!(o!=null&&o.has(I))&&!!(x||t==="api");return h||(h=O),O},p={},g=I=>{let x=p[I];return x||(x={colId:I},p[I]=x,x)},v={},C=f("sort",s);C&&(s==null||s.sortModel.forEach(({colId:I,sort:x},O)=>{const N=g(I);N.sort=x,N.sortIndex=O})),(C||!n)&&(v.sort=null,v.sortIndex=null);const S=f("rowGroup",r);S&&(r==null||r.groupColIds.forEach((I,x)=>{const O=g(I);O.rowGroup=!0,O.rowGroupIndex=x})),(S||!n)&&(v.rowGroup=null,v.rowGroupIndex=null);const b=f("aggregation",i);b&&(i==null||i.aggregationModel.forEach(({colId:I,aggFunc:x})=>{g(I).aggFunc=x})),(b||!n)&&(v.aggFunc=null);const y=f("pivot",a);y&&(a==null||a.pivotColIds.forEach((I,x)=>{const O=g(I);O.pivot=!0,O.pivotIndex=x}),this.gos.updateGridOptions({options:{pivotMode:!!(a!=null&&a.pivotMode)},source:t})),(y||!n)&&(v.pivot=null,v.pivotIndex=null);const _=f("columnPinning",l);if(_){for(const I of(l==null?void 0:l.leftColIds)??[])g(I).pinned="left";for(const I of(l==null?void 0:l.rightColIds)??[])g(I).pinned="right"}(_||!n)&&(v.pinned=null);const E=f("columnVisibility",c);if(E)for(const I of(c==null?void 0:c.hiddenColIds)??[])g(I).hide=!0;(E||!n)&&(v.hide=null);const D=f("columnSizing",u);if(D)for(const{colId:I,flex:x,width:O}of(u==null?void 0:u.columnSizingModel)??[]){const N=g(I);N.flex=x??null,N.width=O}(D||!n)&&(v.flex=null);const T=d==null?void 0:d.orderedColIds,P=!!(T!=null&&T.length)&&!(o!=null&&o.has("columnOrder")),L=P?T.map(I=>g(I)):Object.values(p);(L.length||h)&&(this.columnStates=L,ei(this.beans,{state:L,applyOrder:P,defaultState:v},t))}setColumnPivotState(e,t){const n=this.columnStates;this.columnStates=void 0;const o=this.columnGroupStates;this.columnGroupStates=void 0;const s=this.beans,{pivotResultCols:r,colGroupSvc:i}=s;if(r!=null&&r.isPivotResultColsPresent()){if(n){const a=[];for(const l of n)r.getPivotResultCol(l.colId)&&a.push(l);ei(s,{state:a,applyOrder:e},t)}o&&(i==null||i.setColumnGroupState(o,t))}}getColumnGroupState(){const e=this.beans.colGroupSvc;if(!e)return;const t=e.getColumnGroupState();return ibe(t)}setColumnGroupState(e,t,n){var a;const o=this.beans.colGroupSvc;if(!o||n!=null&&n.has("columnGroup")||t!=="api"&&!Object.prototype.hasOwnProperty.call(e,"columnGroup"))return;const s=new Set((a=e.columnGroup)==null?void 0:a.openColumnGroupIds),i=o.getColumnGroupState().map(({groupId:l})=>{const c=s.has(l);return c&&s.delete(l),{groupId:l,open:c}});for(const l of s)i.push({groupId:l,open:!0});i.length&&(this.columnGroupStates=i),o.setColumnGroupState(i,t)}getFilterState(){const e=this.beans.filterManager;let t=e==null?void 0:e.getFilterModel();t&&Object.keys(t).length===0&&(t=void 0);const n=e==null?void 0:e.getFilterState(),o=(e==null?void 0:e.getAdvFilterModel())??void 0;return t||o||n?{filterModel:t,columnFilterState:n,advancedFilterModel:o}:void 0}setFilterState(e){const t=this.beans.filterManager,{filterModel:n,columnFilterState:o,advancedFilterModel:s}=e??{filterModel:null,columnFilterState:null,advancedFilterModel:null};(n!==void 0||o!==void 0)&&(t==null||t.setFilterState(n??null,o??null,"columnFilter")),s!==void 0&&(t==null||t.setAdvFilterModel(s??null,"advancedFilter"))}getRangeSelectionState(){var t;const e=(t=this.beans.rangeSvc)==null?void 0:t.getCellRanges().map(n=>{const{id:o,type:s,startRow:r,endRow:i,columns:a,startColumn:l}=n;return{id:o,type:s,startRow:r,endRow:i,colIds:a.map(c=>c.getColId()),startColId:l.getColId()}});return e!=null&&e.length?{cellRanges:e}:void 0}setCellSelectionState(e){const{gos:t,rangeSvc:n,colModel:o,visibleCols:s}=this.beans;if(!_a(t)||!n)return;const r=[];for(const i of(e==null?void 0:e.cellRanges)??[]){const a=[];for(const c of i.colIds){const u=o.getCol(c);u&&a.push(u)}if(!a.length)continue;let l=o.getCol(i.startColId);if(!l){const c=s.allCols,u=new Set(a);l=c.find(d=>u.has(d))}r.push({...i,columns:a,startColumn:l})}n.setCellRanges(r)}getScrollState(){if(!this.isClientSideRowModel)return;const e=this.beans.ctrlsSvc.getScrollFeature(),{left:t}=(e==null?void 0:e.getHScrollPosition())??{left:0},{top:n}=(e==null?void 0:e.getVScrollPosition())??{top:0};return n||t?{top:n,left:t}:void 0}setScrollState(e){if(!this.isClientSideRowModel)return;const{top:t,left:n}=e??{top:0,left:0},{frameworkOverrides:o,rowRenderer:s,animationFrameSvc:r,ctrlsSvc:i}=this.beans;o.wrapIncoming(()=>{var a;i.get("center").setCenterViewportScrollLeft(n),(a=i.getScrollFeature())==null||a.setVerticalScrollPosition(t),s.redraw({afterScroll:!0}),r==null||r.flushAllFrames()})}getSideBarState(){var e,t;return(t=(e=this.beans.sideBar)==null?void 0:e.comp)==null?void 0:t.getState()}getFocusedCellState(){if(!this.isClientSideRowModel)return;const e=this.beans.focusSvc.getFocusedCell();if(e){const{column:t,rowIndex:n,rowPinned:o}=e;return{colId:t.getColId(),rowIndex:n,rowPinned:o}}}setFocusedCellState(e){if(!this.isClientSideRowModel)return;const{focusSvc:t,colModel:n}=this.beans;if(!e){t.clearFocusedCell();return}const{colId:o,rowIndex:s,rowPinned:r}=e;t.setFocusedCell({column:n.getCol(o),rowIndex:s,rowPinned:r,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}getPaginationState(){const{pagination:e,gos:t}=this.beans;if(!e)return;const n=e.getCurrentPage(),o=t.get("paginationAutoPageSize")?void 0:e.getPageSize();if(!(!n&&!o))return{page:n,pageSize:o}}setPaginationState(e,t){const{pagination:n,gos:o}=this.beans;if(!n)return;const{pageSize:s,page:r}=e??{page:0,pageSize:o.get("paginationPageSize")},i=t==="gridInitializing";s&&!o.get("paginationAutoPageSize")&&n.setPageSize(s,i?"initialState":"pageSizeSelector"),typeof r=="number"&&(i?n.setPage(r):n.goToPage(r))}getRowSelectionState(){var o;const e=this.beans.selectionSvc;if(!e)return;const t=e.getSelectionState();return!t||!Array.isArray(t)&&(t.selectAll===!1||t.selectAllChildren===!1)&&!((o=t==null?void 0:t.toggledNodes)!=null&&o.length)?void 0:t}setRowSelectionState(e,t){var n;(n=this.beans.selectionSvc)==null||n.setSelectionState(e,t,t==="api")}getRowGroupExpansionState(){const{expansionSvc:e}=this.beans;if(e)return e.getExpansionState()}getRowPinningState(){var e;return(e=this.beans.pinnedRowModel)==null?void 0:e.getPinnedState()}setRowPinningState(e){const t=this.beans.pinnedRowModel;e?t==null||t.setPinnedState(e):t==null||t.reset()}setRowGroupExpansionState(e,t,n){const o=this.beans.expansionSvc;if(!o)return;const s=t??{expandedRowGroupIds:[],collapsedRowGroupIds:[]};o.setExpansionState(s,n)}updateColumnState(e){const t=this.getColumnState();let n=!1;const o=this.cachedState;for(const s of Object.keys(t)){const r=t[s];Ep(r,o[s])||(n=!0)}this.cachedState={...o,...t},n&&this.dispatchStateUpdateEvent(e)}updateCachedState(e,t){const n=this.cachedState[e];this.setCachedStateValue(e,t),Ep(t,n)||this.dispatchStateUpdateEvent([e])}setCachedStateValue(e,t){this.cachedState={...this.cachedState,[e]:t}}refreshStaleState(){const e=this.staleStateKeys;for(const t of e)t==="rowSelection"&&this.setCachedStateValue(t,this.getRowSelectionState());e.clear()}dispatchStateUpdateEvent(e){if(!this.suppressEvents){for(const t of e)this.queuedUpdateSources.add(t);this.dispatchStateUpdateEventDebounced()}}dispatchQueuedStateUpdateEvents(){const e=this.queuedUpdateSources,t=Array.from(e);e.clear(),this.eventSvc.dispatchEvent({type:"stateUpdated",sources:t,state:this.cachedState})}startSuppressEvents(){var e;this.suppressEvents=!0,(e=this.beans.colAnimation)==null||e.setSuppressAnimation(!0)}stopSuppressEvents(e){setTimeout(()=>{var t;this.suppressEvents=!1,this.queuedUpdateSources.clear(),this.isAlive()&&((t=this.beans.colAnimation)==null||t.setSuppressAnimation(!1),this.dispatchStateUpdateEvent([e]))})}suppressEventsAndDispatchInitEvent(e){this.startSuppressEvents(),e(),this.stopSuppressEvents("gridInitializing")}},u_e={moduleName:"GridState",version:ut,beans:[c_e],apiFunctions:{getState:r_e,setState:i_e}};function d_e(e){return e.rowModel.isLastRowIndexKnown()}function h_e(e){var t;return((t=e.pagination)==null?void 0:t.getPageSize())??100}function f_e(e){var t;return((t=e.pagination)==null?void 0:t.getCurrentPage())??0}function p_e(e){var t;return((t=e.pagination)==null?void 0:t.getTotalPages())??1}function g_e(e){return e.pagination?e.pagination.getMasterRowCount():e.rowModel.getRowCount()}function m_e(e){var t;(t=e.pagination)==null||t.goToNextPage()}function v_e(e){var t;(t=e.pagination)==null||t.goToPreviousPage()}function y_e(e){var t;(t=e.pagination)==null||t.goToFirstPage()}function w_e(e){var t;(t=e.pagination)==null||t.goToLastPage()}function C_e(e,t){var n;(n=e.pagination)==null||n.goToPage(t)}var b_e=class extends je{constructor(){super(...arguments),this.beanName="paginationAutoPageSizeSvc"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,e=>{this.centerRowsCtrl=e.center;const t=this.checkPageSize.bind(this);this.addManagedEventListeners({bodyHeightChanged:t,scrollVisibilityChanged:t}),this.addManagedPropertyListener("paginationAutoPageSize",this.onPaginationAutoSizeChanged.bind(this)),this.checkPageSize()})}notActive(){return!this.gos.get("paginationAutoPageSize")||this.centerRowsCtrl==null}onPaginationAutoSizeChanged(){this.notActive()?this.beans.pagination.unsetAutoCalculatedPageSize():this.checkPageSize()}checkPageSize(){if(this.notActive())return;const e=this.centerRowsCtrl.viewportSizeFeature.getBodyHeight();if(e>0){const t=this.beans,n=()=>{const o=Math.max(zc(t),1),s=Math.floor(e/o);t.pagination.setPageSize(s,"autoCalculated")};this.isBodyRendered?qo(this,n,50)():(n(),this.isBodyRendered=!0)}else this.isBodyRendered=!1}},rg="paginationPageSizeSelector",S_e={tag:"span",cls:"ag-paging-page-size"},E_e=class extends Sn{constructor(){super(S_e),this.hasEmptyOption=!1,this.handlePageSizeItemSelected=()=>{if(!this.selectPageSizeComp)return;const e=this.selectPageSizeComp.getValue();if(!e)return;const t=Number(e);isNaN(t)||t<1||t===this.pagination.getPageSize()||(this.pagination.setPageSize(t,"pageSizeSelector"),this.hasEmptyOption&&this.toggleSelectDisplay(!0),this.selectPageSizeComp.getFocusableElement().focus())}}wireBeans(e){this.pagination=e.pagination}postConstruct(){this.addManagedPropertyListener(rg,()=>{this.onPageSizeSelectorValuesChange()}),this.addManagedEventListeners({paginationChanged:e=>this.handlePaginationChanged(e)})}handlePaginationChanged(e){if(!this.selectPageSizeComp||!(e!=null&&e.newPageSize))return;const t=this.pagination.getPageSize();this.getPageSizeSelectorValues().includes(t)?this.selectPageSizeComp.setValue(t.toString()):this.hasEmptyOption?this.selectPageSizeComp.setValue(""):this.toggleSelectDisplay(!0)}toggleSelectDisplay(e){this.selectPageSizeComp&&!e&&this.reset(),e&&(this.reloadPageSizesSelector(),this.selectPageSizeComp)}reset(){Ko(this.getGui()),this.selectPageSizeComp&&(this.selectPageSizeComp=this.destroyBean(this.selectPageSizeComp))}onPageSizeSelectorValuesChange(){this.selectPageSizeComp&&this.shouldShowPageSizeSelector()&&this.reloadPageSizesSelector()}shouldShowPageSizeSelector(){return this.gos.get("pagination")&&!this.gos.get("suppressPaginationPanel")&&!this.gos.get("paginationAutoPageSize")&&this.gos.get(rg)!==!1}reloadPageSizesSelector(){const e=this.getPageSizeSelectorValues(),t=this.pagination.getPageSize(),n=!t||!e.includes(t);if(n){const s=this.gos.exists("paginationPageSize"),r=this.gos.get(rg)!==!0;Je(94,{pageSizeSet:s,pageSizesSet:r,pageSizeOptions:e,paginationPageSizeOption:t}),r||Je(95,{paginationPageSizeOption:t,paginationPageSizeSelector:rg}),e.unshift("")}const o=String(n?"":t);this.selectPageSizeComp?(Il(this.pageSizeOptions,e)||(this.selectPageSizeComp.clearOptions().addOptions(this.createPageSizeSelectOptions(e)),this.pageSizeOptions=e),this.selectPageSizeComp.setValue(o,!0)):this.createPageSizeSelectorComp(e,o),this.hasEmptyOption=n}createPageSizeSelectOptions(e){return e.map(t=>({value:String(t)}))}createPageSizeSelectorComp(e,t){const n=this.getLocaleTextFunc(),o=n("pageSizeSelectorLabel","Page Size:"),s=n("ariaPageSizeSelectorLabel","Page Size");this.selectPageSizeComp=this.createManagedBean(new V_).addOptions(this.createPageSizeSelectOptions(e)).setValue(t).setAriaLabel(s).setLabel(o).onValueChange(()=>this.handlePageSizeItemSelected()),this.appendChild(this.selectPageSizeComp)}getPageSizeSelectorValues(){const e=[20,50,100],t=this.gos.get(rg);return!Array.isArray(t)||!(t!=null&&t.length)?e:[...t].sort((n,o)=>n-o)}destroy(){this.toggleSelectDisplay(!1),super.destroy()}},__e={selector:"AG-PAGE-SIZE-SELECTOR",component:E_e},R_e=".ag-paging-panel{align-items:center;border-top:var(--ag-footer-row-border);display:flex;gap:calc(var(--ag-spacing)*4);height:var(--ag-pagination-panel-height);justify-content:flex-end;padding:0 var(--ag-cell-horizontal-padding)}:where(.ag-paging-page-size) .ag-wrapper{min-width:50px}.ag-paging-page-summary-panel{align-items:center;display:flex;gap:var(--ag-cell-widget-spacing);.ag-disabled &{pointer-events:none}}.ag-paging-button{cursor:pointer;position:relative;&.ag-disabled{cursor:default;opacity:.5}}.ag-paging-number,.ag-paging-row-summary-panel-number{font-weight:500}",T_e=class extends w${constructor(){super(),this.btFirst=dt,this.btPrevious=dt,this.btNext=dt,this.btLast=dt,this.lbRecordCount=dt,this.lbFirstRowOnPage=dt,this.lbLastRowOnPage=dt,this.lbCurrent=dt,this.lbTotal=dt,this.pageSizeComp=dt,this.previousAndFirstButtonsDisabled=!1,this.nextButtonDisabled=!1,this.lastButtonDisabled=!1,this.areListenersSetup=!1,this.allowFocusInnerElement=!1,this.registerCSS(R_e)}wireBeans(e){this.rowModel=e.rowModel,this.pagination=e.pagination,this.ariaAnnounce=e.ariaAnnounce}postConstruct(){const e=this.gos.get("enableRtl");this.setTemplate(this.getTemplate(),[__e]);const{btFirst:t,btPrevious:n,btNext:o,btLast:s}=this;this.activateTabIndex([t,n,o,s]),t.insertAdjacentElement("afterbegin",xr(e?"last":"first",this.beans)),n.insertAdjacentElement("afterbegin",xr(e?"next":"previous",this.beans)),o.insertAdjacentElement("afterbegin",xr(e?"previous":"next",this.beans)),s.insertAdjacentElement("afterbegin",xr(e?"first":"last",this.beans)),this.addManagedPropertyListener("pagination",this.onPaginationChanged.bind(this)),this.addManagedPropertyListener("suppressPaginationPanel",this.onPaginationChanged.bind(this)),this.addManagedPropertyListeners(["paginationPageSizeSelector","paginationAutoPageSize","suppressPaginationPanel"],()=>this.onPageSizeRelatedOptionsChange()),this.pageSizeComp.toggleSelectDisplay(this.pageSizeComp.shouldShowPageSizeSelector()),this.initialiseTabGuard({onTabKeyDown:()=>{},focusInnerElement:r=>this.allowFocusInnerElement?this.tabGuardFeature.getTabGuardCtrl().focusInnerElement(r):bpe(this.beans,r),forceFocusOutWhenTabGuardsAreEmpty:!0}),this.onPaginationChanged()}setAllowFocus(e){this.allowFocusInnerElement=e}onPaginationChanged(){const t=this.gos.get("pagination")&&!this.gos.get("suppressPaginationPanel");this.setDisplayed(t),t&&(this.setupListeners(),this.enableOrDisableButtons(),this.updateLabels(),this.onPageSizeRelatedOptionsChange())}onPageSizeRelatedOptionsChange(){this.pageSizeComp.toggleSelectDisplay(this.pageSizeComp.shouldShowPageSizeSelector())}setupListeners(){if(!this.areListenersSetup){this.addManagedEventListeners({paginationChanged:this.onPaginationChanged.bind(this)});for(const e of[{el:this.btFirst,fn:this.onBtFirst.bind(this)},{el:this.btPrevious,fn:this.onBtPrevious.bind(this)},{el:this.btNext,fn:this.onBtNext.bind(this)},{el:this.btLast,fn:this.onBtLast.bind(this)}]){const{el:t,fn:n}=e;this.addManagedListeners(t,{click:n,keydown:o=>{(o.key===Le.ENTER||o.key===Le.SPACE)&&(o.preventDefault(),n())}})}Cpe(this.beans,this,this.getGui()),this.areListenersSetup=!0}}onBtFirst(){this.previousAndFirstButtonsDisabled||this.pagination.goToFirstPage()}formatNumber(e){const t=this.gos.getCallback("paginationNumberFormatter");return t?t({value:e}):abe(e,this.getLocaleTextFunc.bind(this))}getTemplate(){const e=this.getLocaleTextFunc(),t=`ag-${this.getCompId()}`;return{tag:"div",cls:"ag-paging-panel ag-unselectable",attrs:{id:`${t}`},children:[{tag:"ag-page-size-selector",ref:"pageSizeComp"},{tag:"span",cls:"ag-paging-row-summary-panel",children:[{tag:"span",ref:"lbFirstRowOnPage",cls:"ag-paging-row-summary-panel-number",attrs:{id:`${t}-first-row`}},{tag:"span",attrs:{id:`${t}-to`},children:e("to","to")},{tag:"span",ref:"lbLastRowOnPage",cls:"ag-paging-row-summary-panel-number",attrs:{id:`${t}-last-row`}},{tag:"span",attrs:{id:`${t}-of`},children:e("of","of")},{tag:"span",ref:"lbRecordCount",cls:"ag-paging-row-summary-panel-number",attrs:{id:`${t}-row-count`}}]},{tag:"span",cls:"ag-paging-page-summary-panel",role:"presentation",children:[{tag:"div",ref:"btFirst",cls:"ag-button ag-paging-button",role:"button",attrs:{"aria-label":e("firstPage","First Page")}},{tag:"div",ref:"btPrevious",cls:"ag-button ag-paging-button",role:"button",attrs:{"aria-label":e("previousPage","Previous Page")}},{tag:"span",cls:"ag-paging-description",children:[{tag:"span",attrs:{id:`${t}-start-page`},children:e("page","Page")},{tag:"span",ref:"lbCurrent",cls:"ag-paging-number",attrs:{id:`${t}-start-page-number`}},{tag:"span",attrs:{id:`${t}-of-page`},children:e("of","of")},{tag:"span",ref:"lbTotal",cls:"ag-paging-number",attrs:{id:`${t}-of-page-number`}}]},{tag:"div",ref:"btNext",cls:"ag-button ag-paging-button",role:"button",attrs:{"aria-label":e("nextPage","Next Page")}},{tag:"div",ref:"btLast",cls:"ag-button ag-paging-button",role:"button",attrs:{"aria-label":e("lastPage","Last Page")}}]}]}}onBtNext(){this.nextButtonDisabled||this.pagination.goToNextPage()}onBtPrevious(){this.previousAndFirstButtonsDisabled||this.pagination.goToPreviousPage()}onBtLast(){this.lastButtonDisabled||this.pagination.goToLastPage()}enableOrDisableButtons(){const e=this.pagination.getCurrentPage(),t=this.rowModel.isLastRowIndexKnown(),n=this.pagination.getTotalPages();this.previousAndFirstButtonsDisabled=e===0,this.toggleButtonDisabled(this.btFirst,this.previousAndFirstButtonsDisabled),this.toggleButtonDisabled(this.btPrevious,this.previousAndFirstButtonsDisabled);const o=this.isZeroPagesToDisplay(),s=e===n-1;this.nextButtonDisabled=s||o,this.lastButtonDisabled=!t||o||e===n-1,this.toggleButtonDisabled(this.btNext,this.nextButtonDisabled),this.toggleButtonDisabled(this.btLast,this.lastButtonDisabled)}toggleButtonDisabled(e,t){Nce(e,t),e.classList.toggle("ag-disabled",t)}isZeroPagesToDisplay(){const e=this.rowModel.isLastRowIndexKnown(),t=this.pagination.getTotalPages();return e&&t===0}updateLabels(){const e=this.rowModel.isLastRowIndexKnown(),t=this.pagination.getTotalPages(),n=this.pagination.getMasterRowCount(),o=e?n:null,s=this.pagination.getCurrentPage(),r=this.pagination.getPageSize();let i,a;this.isZeroPagesToDisplay()?i=a=0:(i=r*s+1,a=i+r-1,e&&a>o&&(a=o));const l=i+r-1,c=!e&&n<l,u=this.formatNumber(i);this.lbFirstRowOnPage.textContent=u;let d;const h=this.getLocaleTextFunc();c?d=h("pageLastRowUnknown","?"):d=this.formatNumber(a),this.lbLastRowOnPage.textContent=d;const p=t>0?s+1:0,g=this.formatNumber(p);this.lbCurrent.textContent=g;let v,C;if(e)v=this.formatNumber(t),C=this.formatNumber(o);else{const S=h("more","more");v=S,C=S}this.lbTotal.textContent=v,this.lbRecordCount.textContent=C,this.announceAriaStatus(u,d,C,g,v)}announceAriaStatus(e,t,n,o,s){var d,h;const r=this.getLocaleTextFunc(),i=r("page","Page"),a=r("to","to"),l=r("of","of"),c=`${e} ${a} ${t} ${l} ${n}`,u=`${i} ${o} ${l} ${s}`;c!==this.ariaRowStatus&&(this.ariaRowStatus=c,(d=this.ariaAnnounce)==null||d.announceValue(c,"paginationRow")),u!==this.ariaPageStatus&&(this.ariaPageStatus=u,(h=this.ariaAnnounce)==null||h.announceValue(u,"paginationPage"))}},D_e={selector:"AG-PAGINATION",component:T_e},I_e=class extends je{constructor(){super(...arguments),this.beanName="pagination",this.currentPage=0,this.topDisplayedRowIndex=0,this.bottomDisplayedRowIndex=0,this.masterRowCount=0}postConstruct(){const e=this.gos;this.active=e.get("pagination"),this.pageSizeFromGridOptions=e.get("paginationPageSize"),this.paginateChildRows=this.isPaginateChildRows(),this.addManagedPropertyListener("pagination",this.onPaginationGridOptionChanged.bind(this)),this.addManagedPropertyListener("paginationPageSize",this.onPageSizeGridOptionChanged.bind(this))}getPaginationSelector(){return D_e}isPaginateChildRows(){const e=this.gos;return e.get("groupHideParentOfSingleChild")||e.get("groupRemoveSingleChildren")||e.get("groupRemoveLowestSingleChildren")?!0:e.get("paginateChildRows")}onPaginationGridOptionChanged(){this.active=this.gos.get("pagination"),this.calculatePages(),this.dispatchPaginationChangedEvent({keepRenderedRows:!0})}onPageSizeGridOptionChanged(){this.setPageSize(this.gos.get("paginationPageSize"),"gridOptions")}goToPage(e){const t=this.currentPage;if(!this.active||t===e||typeof t!="number")return;const{editSvc:n}=this.beans;n!=null&&n.isEditing()&&(n.isBatchEditing()?n.cleanupEditors():n.stopEditing(void 0,{source:"api"})),this.currentPage=e,this.calculatePages(),this.dispatchPaginationChangedEvent({newPage:!0})}goToPageWithIndex(e){var n,o;if(!this.active)return;let t=e;this.paginateChildRows||(t=((o=(n=this.beans.rowModel).getTopLevelIndexFromDisplayedIndex)==null?void 0:o.call(n,e))??e),this.goToPage(Math.floor(t/this.pageSize))}isRowInPage(e){return this.active?e>=this.topDisplayedRowIndex&&e<=this.bottomDisplayedRowIndex:!0}getCurrentPage(){return this.currentPage}goToNextPage(){this.goToPage(this.currentPage+1)}goToPreviousPage(){this.goToPage(this.currentPage-1)}goToFirstPage(){this.goToPage(0)}goToLastPage(){const e=this.beans.rowModel.getRowCount(),t=Math.floor(e/this.pageSize);this.goToPage(t)}getPageSize(){return this.pageSize}getTotalPages(){return this.totalPages}setPage(e){this.currentPage=e}get pageSize(){return ht(this.pageSizeAutoCalculated)&&this.gos.get("paginationAutoPageSize")?this.pageSizeAutoCalculated:ht(this.pageSizeFromPageSizeSelector)?this.pageSizeFromPageSizeSelector:ht(this.pageSizeFromInitialState)?this.pageSizeFromInitialState:ht(this.pageSizeFromGridOptions)?this.pageSizeFromGridOptions:this.defaultPageSize}calculatePages(){this.active?this.paginateChildRows?this.calculatePagesAllRows():this.calculatePagesMasterRowsOnly():this.calculatedPagesNotActive(),this.beans.pageBounds.calculateBounds(this.topDisplayedRowIndex,this.bottomDisplayedRowIndex)}unsetAutoCalculatedPageSize(){if(this.pageSizeAutoCalculated===void 0)return;const e=this.pageSizeAutoCalculated;this.pageSizeAutoCalculated=void 0,this.pageSize!==e&&(this.calculatePages(),this.dispatchPaginationChangedEvent({newPageSize:!0}))}setPageSize(e,t){const n=this.pageSize;switch(t){case"autoCalculated":this.pageSizeAutoCalculated=e;break;case"pageSizeSelector":this.pageSizeFromPageSizeSelector=e,this.currentPage!==0&&this.goToFirstPage();break;case"initialState":this.pageSizeFromInitialState=e;break;case"gridOptions":this.pageSizeFromGridOptions=e,this.pageSizeFromInitialState=void 0,this.pageSizeFromPageSizeSelector=void 0,this.currentPage!==0&&this.goToFirstPage();break}n!==this.pageSize&&(this.calculatePages(),this.dispatchPaginationChangedEvent({newPageSize:!0,keepRenderedRows:!0}))}setZeroRows(){this.masterRowCount=0,this.topDisplayedRowIndex=0,this.bottomDisplayedRowIndex=-1,this.currentPage=0,this.totalPages=0}adjustCurrentPageIfInvalid(){const e=this.totalPages;this.currentPage>=e&&(this.currentPage=e-1);const t=this.currentPage;(!isFinite(t)||isNaN(t)||t<0)&&(this.currentPage=0)}calculatePagesMasterRowsOnly(){const e=this.beans.rowModel,t=e.getTopLevelRowCount();if(this.masterRowCount=t,t<=0){this.setZeroRows();return}const n=this.pageSize,o=t-1;this.totalPages=Math.floor(o/n)+1,this.adjustCurrentPageIfInvalid();const s=this.currentPage,r=n*s;let i=n*(s+1)-1;if(i>o&&(i=o),this.topDisplayedRowIndex=e.getTopLevelRowDisplayedIndex(r),i===o)this.bottomDisplayedRowIndex=e.getRowCount()-1;else{const a=e.getTopLevelRowDisplayedIndex(i+1);this.bottomDisplayedRowIndex=a-1}}getMasterRowCount(){return this.masterRowCount}calculatePagesAllRows(){const e=this.beans.rowModel.getRowCount();if(this.masterRowCount=e,e===0){this.setZeroRows();return}const{pageSize:t,currentPage:n}=this,o=e-1;this.totalPages=Math.floor(o/t)+1,this.adjustCurrentPageIfInvalid(),this.topDisplayedRowIndex=t*n,this.bottomDisplayedRowIndex=t*(n+1)-1,this.bottomDisplayedRowIndex>o&&(this.bottomDisplayedRowIndex=o)}calculatedPagesNotActive(){this.setPageSize(void 0,"autoCalculated"),this.totalPages=1,this.currentPage=0,this.topDisplayedRowIndex=0,this.bottomDisplayedRowIndex=this.beans.rowModel.getRowCount()-1}dispatchPaginationChangedEvent(e){const{keepRenderedRows:t=!1,newPage:n=!1,newPageSize:o=!1}=e;this.eventSvc.dispatchEvent({type:"paginationChanged",animate:!1,newData:!1,newPage:n,newPageSize:o,keepRenderedRows:t})}},x_e={moduleName:"Pagination",version:ut,beans:[I_e,b_e],icons:{first:"first",previous:"previous",next:"next",last:"last"},apiFunctions:{paginationIsLastPageFound:d_e,paginationGetPageSize:h_e,paginationGetCurrentPage:f_e,paginationGetTotalPages:p_e,paginationGetRowCount:g_e,paginationGoToNextPage:m_e,paginationGoToPreviousPage:v_e,paginationGoToFirstPage:y_e,paginationGoToLastPage:w_e,paginationGoToPage:C_e},dependsOn:[xw]};function P_e(e,t={}){const n=t?t.rowNodes:void 0;e.frameworkOverrides.wrapIncoming(()=>e.rowRenderer.redrawRows(n))}function cG(e,t,n,o,s){t&&(o&&t.parent&&t.parent.level!==-1&&cG(e,t.parent,n,o,s),t.setExpanded(n,void 0,s))}function k_e(e,t){return e.rowModel.getRowNode(t)}function F_e(e,t,n,o){e.rowRenderer.addRenderedRowListener(t,n,o)}function A_e(e){return e.rowRenderer.getRenderedNodes()}function O_e(e,t,n){e.rowModel.forEachNode(t,n)}function M_e(e){return e.rowRenderer.firstRenderedRow}function N_e(e){return e.rowRenderer.lastRenderedRow}function L_e(e,t){return e.rowModel.getRow(t)}function V_e(e){return e.rowModel.getRowCount()}var B_e={moduleName:"RowApi",version:ut,apiFunctions:{redrawRows:P_e,setRowNodeExpanded:cG,getRowNode:k_e,addRenderedRowListener:F_e,getRenderedNodes:A_e,forEachNode:O_e,getFirstDisplayedRowIndex:M_e,getLastDisplayedRowIndex:N_e,getDisplayedRowAtIndex:L_e,getDisplayedRowCount:V_e}},$_e={moduleName:"ScrollApi",version:ut,apiFunctions:{getVerticalPixelRange:QSe,getHorizontalPixelRange:e0e,ensureColumnVisible:WH,ensureIndexVisible:zH,ensureNodeVisible:t0e}};function H_e(e,t,n){if(!t)return;const o=e.ctrlsSvc.getGridBodyCtrl().eGridBody,s=`aria-${t}`;n===null?o.removeAttribute(s):o.setAttribute(s,n)}function G_e(e,t={}){e.frameworkOverrides.wrapIncoming(()=>e.rowRenderer.refreshCells(t))}function U_e(e){e.frameworkOverrides.wrapIncoming(()=>{for(const t of e.ctrlsSvc.getHeaderRowContainerCtrls())t.refresh()})}function W_e(e){var t;return((t=e.animationFrameSvc)==null?void 0:t.isQueueEmpty())??!0}function z_e(e){var t;(t=e.animationFrameSvc)==null||t.flushAllFrames()}function j_e(e){return{rowHeight:zc(e),headerHeight:jp(e)}}function K_e(e,t={}){var r;const n=[];for(const i of e.rowRenderer.getCellCtrls(t.rowNodes,t.columns)){const a=i.getCellRenderer();a!=null&&n.push(Up(a))}if((r=t.columns)!=null&&r.length)return n;const o=[],s=MR(t.rowNodes);for(const i of e.rowRenderer.getAllRowCtrls()){if(s&&!NR(i.rowNode,s)||!i.isFullWidth())continue;const a=i.getFullWidthCellRenderers();for(let l=0;l<a.length;l++){const c=a[l];c!=null&&o.push(Up(c))}}return[...o,...n]}var q_e={moduleName:"RenderApi",version:ut,apiFunctions:{setGridAriaProperty:H_e,refreshCells:G_e,refreshHeader:U_e,isAnimationFrameQueueEmpty:W_e,flushAllAnimationFrames:z_e,getSizesForCurrentTheme:j_e,getCellRendererInstances:K_e}};function Y_e(e,t){var n,o;typeof t=="number"?(n=e.colAutosize)==null||n.sizeColumnsToFit(t,"api"):(o=e.colAutosize)==null||o.sizeColumnsToFitGridBody(t)}function uG({colAutosize:e,visibleCols:t},n,o){Array.isArray(n)?e==null||e.autoSizeCols({colKeys:n,skipHeader:o,source:"api"}):e==null||e.autoSizeCols({...n,colKeys:n.colIds??t.allCols,source:"api"})}function X_e(e,t){var n;t&&typeof t=="object"?uG(e,t):(n=e.colAutosize)==null||n.autoSizeAllColumns({source:"api",skipHeader:t})}var Z_e=class extends je{constructor(){super(...arguments),this.beanName="colAutosize",this.timesDelayed=0,this.shouldQueueResizeOperations=!1,this.resizeOperationQueue=[]}postConstruct(){var n;const{gos:e}=this,t=e.get("autoSizeStrategy");if(t){let o=!1;const s=t.type;if(s==="fitGridWidth"||s==="fitProvidedWidth")o=!0;else if(s==="fitCellContents"){this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered(t)});const r=e.get("rowData");o=r!=null&&r.length>0&&lo(e)}o&&((n=this.beans.colDelayRenderSvc)==null||n.hideColumns(s))}}autoSizeCols(e){const{eventSvc:t,visibleCols:n}=this.beans;this.innerAutoSizeCols(e).then(o=>{var c;const s=u=>Gd(t,Array.from(u),!0,"autosizeColumns");if(!e.scaleUpToFitGridWidth)return s(o);const r=dG(this.beans),i=u=>n.leftCols.some(d=>$p(d,u)),a=u=>n.rightCols.some(d=>$p(d,u)),l=e.colKeys.filter(u=>!Ta(u)&&!Da(u)&&!i(u)&&!a(u));this.sizeColumnsToFit(r,e.source,!0,{defaultMaxWidth:e.defaultMaxWidth,defaultMinWidth:e.defaultMinWidth,columnLimits:(c=e.columnLimits)==null?void 0:c.map(u=>({...u,key:u.colId})),colKeys:l,onlyScaleUp:!0}),s(o)})}innerAutoSizeCols(e){return new Promise((t,n)=>{if(this.shouldQueueResizeOperations)return this.pushResizeOperation(()=>this.innerAutoSizeCols(e).then(t,n));const{colKeys:o,skipHeader:s,skipHeaderGroups:r,stopAtGroup:i,defaultMaxWidth:a,defaultMinWidth:l,columnLimits:c=[],source:u="api"}=e,{animationFrameSvc:d,renderStatus:h,colModel:f,autoWidthCalc:p,visibleCols:g}=this.beans;if(d==null||d.flushAllFrames(),this.timesDelayed<5&&h&&(!h.areHeaderCellsRendered()||!h.areCellsRendered())){this.timesDelayed++,setTimeout(()=>{this.isAlive()&&this.innerAutoSizeCols(e).then(t,n)});return}this.timesDelayed=0;const v=new Set;let C=-1;const S=Object.fromEntries(c.map(({colId:_,...E})=>[_,E])),b=s??this.gos.get("skipHeaderOnAutoSize"),y=r??b;for(;C!==0;){C=0;const _=[];for(const E of o){if(!E||que(E))continue;const D=f.getCol(E);if(!D||v.has(D))continue;const T=p.getPreferredWidthForColumn(D,b);if(T>0){const P=S[D.colId]??{};P.minWidth??(P.minWidth=l),P.maxWidth??(P.maxWidth=a);const L=J_e(D,T,P);D.setActualWidth(L,u),v.add(D),C++}_.push(D)}_.length&&g.refresh(u)}y||this.autoSizeColumnGroupsByColumns(o,u,i),t(v)})}autoSizeColumn(e,t,n){this.autoSizeCols({colKeys:[e],skipHeader:n,skipHeaderGroups:!0,source:t})}autoSizeColumnGroupsByColumns(e,t,n){const{colModel:o,ctrlsSvc:s}=this.beans,r=new Set,i=o.getColsForKeys(e);for(const l of i){let c=l.getParent();for(;c&&c!=n;)c.isPadding()||r.add(c),c=c.getParent()}let a;for(const l of r){for(const c of s.getHeaderRowContainerCtrls())if(a=c.getHeaderCtrlForColumn(l),a)break;a==null||a.resizeLeafColumnsToFit(t)}}autoSizeAllColumns(e){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.autoSizeAllColumns(e));return}this.autoSizeCols({colKeys:this.beans.visibleCols.allCols,...e})}addColumnAutosizeListeners(e,t){const n=this.gos.get("skipHeaderOnAutoSize"),o=()=>{this.autoSizeColumn(t,"uiColumnResized",n)};e.addEventListener("dblclick",o);const s=new tu(e);return s.addEventListener("doubleTap",o),()=>{e.removeEventListener("dblclick",o),s.destroy()}}addColumnGroupResize(e,t,n){const o=this.gos.get("skipHeaderOnAutoSize"),s=()=>{const r=[],i=t.getDisplayedLeafColumns();for(const a of i)a.getColDef().suppressAutoSize||r.push(a.getColId());r.length>0&&this.autoSizeCols({colKeys:r,skipHeader:o,stopAtGroup:t,source:"uiColumnResized"}),n()};return e.addEventListener("dblclick",s),()=>e.removeEventListener("dblclick",s)}sizeColumnsToFitGridBody(e,t){if(!this.isAlive())return;const n=dG(this.beans);if(n>0){this.sizeColumnsToFit(n,"sizeColumnsToFit",!1,e);return}t===void 0?window.setTimeout(()=>{this.sizeColumnsToFitGridBody(e,100)},0):t===100?window.setTimeout(()=>{this.sizeColumnsToFitGridBody(e,500)},100):t===500?window.setTimeout(()=>{this.sizeColumnsToFitGridBody(e,-1)},500):Je(29)}sizeColumnsToFit(e,t="sizeColumnsToFit",n,o){var p,g;if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.sizeColumnsToFit(e,t,n,o));return}const s={};for(const{key:v,...C}of(o==null?void 0:o.columnLimits)??[])s[typeof v=="string"?v:v.getColId()]=C;const r=this.beans.visibleCols.allCols;if(e<=0||!r.length)return;const i=Ra(r);if(o!=null&&o.onlyScaleUp&&i>e||e===i&&r.every(C=>{if(C.colDef.suppressSizeToFit)return!0;const S=s==null?void 0:s[C.getId()],b=(S==null?void 0:S.minWidth)??(o==null?void 0:o.defaultMinWidth),y=(S==null?void 0:S.maxWidth)??(o==null?void 0:o.defaultMaxWidth),_=C.getActualWidth();return(b==null||_>=b)&&(y==null||_<=y)}))return;const l=[],c=[];for(const v of r){const C=((p=o==null?void 0:o.colKeys)==null?void 0:p.some(S=>$p(v,S)))??!0;v.getColDef().suppressSizeToFit||!C?c.push(v):l.push(v)}const u=l.slice(0);let d=!1;const h=v=>{Qr(l,v),c.push(v)};for(const v of l){v.resetActualWidth(t);const C=s==null?void 0:s[v.getId()],S=(C==null?void 0:C.minWidth)??(o==null?void 0:o.defaultMinWidth),b=(C==null?void 0:C.maxWidth)??(o==null?void 0:o.defaultMaxWidth),y=v.getActualWidth();typeof S=="number"&&y<S?v.setActualWidth(S,t,!0):typeof b=="number"&&y>b&&v.setActualWidth(b,t,!0)}for(;!d;){d=!0;const v=e-Ra(c);if(v<=0)for(const C of l){const S=((g=s==null?void 0:s[C.getId()])==null?void 0:g.minWidth)??(o==null?void 0:o.defaultMinWidth)??C.minWidth;C.setActualWidth(S,t,!0)}else{const C=v/Ra(l);let S=v;for(let b=l.length-1;b>=0;b--){const y=l[b],_=s==null?void 0:s[y.getId()],E=(_==null?void 0:_.minWidth)??(o==null?void 0:o.defaultMinWidth),D=(_==null?void 0:_.maxWidth)??(o==null?void 0:o.defaultMaxWidth),T=y.getMinWidth(),P=y.getMaxWidth(),L=typeof E=="number"&&E>T?E:T,I=typeof D=="number"&&D<P?D:P;let x=Math.round(y.getActualWidth()*C);x<L?(x=L,h(y),d=!1):x>I?(x=I,h(y),d=!1):b===0&&(x=S),y.setActualWidth(x,t,!0),S-=x}}}for(const v of u)v.fireColumnWidthChangedEvent(t);const f=this.beans.visibleCols;f.setLeftValues(t),f.updateBodyWidths(),!n&&Gd(this.eventSvc,u,!0,t)}applyAutosizeStrategy(){const{gos:e,colDelayRenderSvc:t}=this.beans,n=e.get("autoSizeStrategy");(n==null?void 0:n.type)!=="fitGridWidth"&&(n==null?void 0:n.type)!=="fitProvidedWidth"||setTimeout(()=>{if(!this.isAlive())return;const o=n.type;if(o==="fitGridWidth"){const{columnLimits:s,defaultMinWidth:r,defaultMaxWidth:i}=n,a=s==null?void 0:s.map(({colId:l,minWidth:c,maxWidth:u})=>({key:l,minWidth:c,maxWidth:u}));this.sizeColumnsToFitGridBody({defaultMinWidth:r,defaultMaxWidth:i,columnLimits:a})}else o==="fitProvidedWidth"&&this.sizeColumnsToFit(n.width,"sizeColumnsToFit");t==null||t.revealColumns(o)})}onFirstDataRendered({colIds:e,...t}){setTimeout(()=>{var o;if(!this.isAlive())return;const n="autosizeColumns";e?this.autoSizeCols({...t,source:n,colKeys:e}):this.autoSizeAllColumns({...t,source:n}),(o=this.beans.colDelayRenderSvc)==null||o.revealColumns(t.type)})}processResizeOperations(){this.shouldQueueResizeOperations=!1;for(const e of this.resizeOperationQueue)e();this.resizeOperationQueue=[]}pushResizeOperation(e){this.resizeOperationQueue.push(e)}destroy(){this.resizeOperationQueue.length=0,super.destroy()}};function J_e(e,t,n={}){const o=n.minWidth??e.getMinWidth();t<o&&(t=o);const s=n.maxWidth??e.getMaxWidth();return t>s&&(t=s),t}function dG({ctrlsSvc:e,scrollVisibleSvc:t}){const n=e.getGridBodyCtrl(),s=n.isVerticalScrollShowing()?t.getScrollbarWidth():0;return Ip(n.eGridBody)-s}var Q_e={moduleName:"ColumnAutoSize",version:ut,beans:[Z_e],apiFunctions:{sizeColumnsToFit:Y_e,autoSizeColumns:uG,autoSizeAllColumns:X_e},dependsOn:[N$]},eRe=".ag-row-pinned-source{background-color:var(--ag-pinned-source-row-background-color);color:var(--ag-pinned-source-row-text-color);font-weight:var(--ag-pinned-source-row-font-weight)}.ag-row-pinned-manual{background-color:var(--ag-pinned-row-background-color);color:var(--ag-pinned-row-text-color);font-weight:var(--ag-pinned-row-font-weight)}";function tRe(e){var t;return((t=e.pinnedRowModel)==null?void 0:t.getPinnedTopRowCount())??0}function nRe(e){var t;return((t=e.pinnedRowModel)==null?void 0:t.getPinnedBottomRowCount())??0}function oRe(e,t){var n;return(n=e.pinnedRowModel)==null?void 0:n.getPinnedTopRow(t)}function sRe(e,t){var n;return(n=e.pinnedRowModel)==null?void 0:n.getPinnedBottomRow(t)}function rRe(e,t,n){var o;return(o=e.pinnedRowModel)==null?void 0:o.forEachPinnedRow(t,n)}var iRe={moduleName:"PinnedRow",version:ut,beans:[oge],css:[eRe],apiFunctions:{getPinnedTopRowCount:tRe,getPinnedBottomRowCount:nRe,getPinnedTopRow:oRe,getPinnedBottomRow:sRe,forEachPinnedRow:rRe},icons:{rowPin:"pin",rowPinTop:"pinned-top",rowPinBottom:"pinned-bottom",rowUnpin:"un-pin"}},aRe=class{constructor(e,t){this.col=e,this.firstNode=t,this.cellSpan=!0,this.spannedNodes=new Set,this.addSpannedNode(t)}reset(){this.spannedNodes.clear(),this.addSpannedNode(this.firstNode)}addSpannedNode(e){this.spannedNodes.add(e),this.lastNode=e}getLastNode(){return this.lastNode}getCellHeight(){return this.lastNode.rowTop+this.lastNode.rowHeight-this.firstNode.rowTop-1}doesSpanContain(e){return e.column!==this.col||e.rowPinned!=this.firstNode.rowPinned?!1:this.firstNode.rowIndex<=e.rowIndex&&e.rowIndex<=this.lastNode.rowIndex}getLastNodeAutoHeight(){var n;const e=(n=this.firstNode.__autoHeights)==null?void 0:n[this.col.getColId()];if(e==null)return;let t=0;for(const o of this.spannedNodes)o!==this.lastNode&&(t+=o.rowHeight);return e-t}},lRe=class extends je{constructor(e){super(),this.column=e}buildCache(e){var b;const{column:t,beans:{gos:n,pinnedRowModel:o,rowModel:s,valueSvc:r,pagination:i}}=this,{colDef:a}=t,l=this.getNodeMap(e),c=new Map,u=n.getCallback("isFullWidthRow"),d=a.equals,h=a.spanRows,f=typeof h=="function";let p=null,g=null,v;const C=(y,_)=>{p=y,g=null,v=_},S=y=>{const _=!y.isExpandable()&&!y.group&&!y.detail&&(u?!u({rowNode:y}):!0);if(y.rowIndex==null||!_){C(null,null);return}if(p==null||y.level!==p.level||y.footer||g&&y.rowIndex-1!==(g==null?void 0:g.getLastNode().rowIndex)){C(y,r.getValue(t,y));return}const E=r.getValue(t,y);if(f){const D=Ot(n,{valueA:v,nodeA:p,valueB:E,nodeB:y,column:t,colDef:a});if(!h(D)){C(y,E);return}}else if(d?!d(v,E):v!==E){C(y,E);return}if(!g){const D=l==null?void 0:l.get(p);(D==null?void 0:D.firstNode)===p?(D.reset(),g=D):g=new aRe(t,p),c.set(p,g)}g.addSpannedNode(y),c.set(y,g)};switch(e){case"center":(b=s.forEachDisplayedNode)==null||b.call(s,y=>{(!i||i.isRowInPage(y.rowIndex))&&S(y)}),this.centerValueNodeMap=c;break;case"top":o==null||o.forEachPinnedRow("top",S),this.topValueNodeMap=c;break;case"bottom":o==null||o.forEachPinnedRow("bottom",S),this.bottomValueNodeMap=c;break}}isCellSpanning(e){return!!this.getCellSpan(e)}getCellSpan(e){return this.getNodeMap(e.rowPinned).get(e)}getNodeMap(e){switch(e){case"top":return this.topValueNodeMap;case"bottom":return this.bottomValueNodeMap;default:return this.centerValueNodeMap}}},cRe=class extends je{constructor(){super(...arguments),this.beanName="rowSpanSvc",this.spanningColumns=new Map,this.debouncePinnedEvent=qo(this,this.dispatchCellsUpdatedEvent.bind(this,!0),0),this.debounceModelEvent=qo(this,this.dispatchCellsUpdatedEvent.bind(this,!1),0),this.pinnedTimeout=null,this.modelTimeout=null}postConstruct(){const e=this.onRowDataUpdated.bind(this),t=this.buildPinnedCaches.bind(this);this.addManagedEventListeners({paginationChanged:this.buildModelCaches.bind(this),pinnedRowDataChanged:t,pinnedRowsChanged:t,rowNodeDataChanged:e,cellValueChanged:e})}register(e){const{gos:t}=this.beans;if(!t.get("enableCellSpan")||this.spanningColumns.has(e))return;const n=this.createManagedBean(new lRe(e));this.spanningColumns.set(e,n),n.buildCache("top"),n.buildCache("bottom"),n.buildCache("center"),this.debouncePinnedEvent(),this.debounceModelEvent()}dispatchCellsUpdatedEvent(e){this.dispatchLocalEvent({type:"spannedCellsUpdated",pinned:e})}deregister(e){this.spanningColumns.delete(e)}onRowDataUpdated({node:e}){const{spannedRowRenderer:t}=this.beans;if(e.rowPinned){if(this.pinnedTimeout!=null)return;this.pinnedTimeout=window.setTimeout(()=>{this.pinnedTimeout=null,this.buildPinnedCaches(),t==null||t.createCtrls("top"),t==null||t.createCtrls("bottom")},0);return}this.modelTimeout==null&&(this.modelTimeout=window.setTimeout(()=>{this.modelTimeout=null,this.buildModelCaches(),t==null||t.createCtrls("center")},0))}buildModelCaches(){this.modelTimeout!=null&&clearTimeout(this.modelTimeout),this.spanningColumns.forEach(e=>e.buildCache("center")),this.debounceModelEvent()}buildPinnedCaches(){this.pinnedTimeout!=null&&clearTimeout(this.pinnedTimeout),this.spanningColumns.forEach(e=>{e.buildCache("top"),e.buildCache("bottom")}),this.debouncePinnedEvent()}isCellSpanning(e,t){const n=this.spanningColumns.get(e);return n?n.isCellSpanning(t):!1}getCellSpanByPosition(e){const{pinnedRowModel:t,rowModel:n}=this.beans,o=e.column,s=e.rowIndex,r=this.spanningColumns.get(o);if(!r)return;let i;switch(e.rowPinned){case"top":i=t==null?void 0:t.getPinnedTopRow(s);break;case"bottom":i=t==null?void 0:t.getPinnedBottomRow(s);break;default:i=n.getRow(s)}if(i)return r.getCellSpan(i)}getCellStart(e){const t=this.getCellSpanByPosition(e);return t?{...e,rowIndex:t.firstNode.rowIndex}:e}getCellEnd(e){const t=this.getCellSpanByPosition(e);return t?{...e,rowIndex:t.getLastNode().rowIndex}:e}getCellSpan(e,t){const n=this.spanningColumns.get(e);if(n)return n.getCellSpan(t)}forEachSpannedColumn(e,t){for(const[n,o]of this.spanningColumns)if(o.isCellSpanning(e)){const s=o.getCellSpan(e);t(n,s)}}destroy(){super.destroy(),this.spanningColumns.clear()}},uRe=class extends eh{constructor(e,t,n){super(e.col,e.firstNode,n,t),this.cellSpan=e,this.SPANNED_CELL_CSS_CLASS="ag-spanned-cell"}setComp(e,t,n,o,s,r,i){this.eWrapper=n,super.setComp(e,t,n,o,s,r,i),this.setAriaRowSpan(),this.refreshAriaRowIndex()}isCellSpanning(){return!0}getCellSpan(){return this.cellSpan}refreshAriaRowIndex(){const{eGui:e,rowNode:t}=this;!e||t.rowIndex==null||ky(e,t.rowIndex)}setAriaRowSpan(){Hce(this.eGui,this.cellSpan.spannedNodes.size)}setFocusedCellPosition(e){this.focusedCellPosition=e}getFocusedCellPosition(){return this.focusedCellPosition??this.cellPosition}checkCellFocused(){const e=this.beans.focusSvc.getFocusedCell();return!!e&&this.cellSpan.doesSpanContain(e)}applyStaticCssClasses(){super.applyStaticCssClasses(),this.comp.toggleCss(this.SPANNED_CELL_CSS_CLASS,!0)}onCellFocused(e){const{beans:t}=this;if(vw(t)){this.focusedCellPosition=void 0;return}const n=this.isCellFocused();n||(this.focusedCellPosition=void 0),e&&n&&(this.focusedCellPosition={rowIndex:e.rowIndex,rowPinned:e.rowPinned,column:e.column}),super.onCellFocused(e)}getRootElement(){return this.eWrapper}},dRe=class extends Dw{onRowIndexChanged(){super.onRowIndexChanged();for(const e of this.getAllCellCtrls())e.refreshAriaRowIndex()}getInitialRowClasses(e){return["ag-spanned-row"]}getNewCellCtrl(e){var o;const t=(o=this.beans.rowSpanSvc)==null?void 0:o.getCellSpan(e,this.rowNode);if(!(!t||t.firstNode!==this.rowNode))return new uRe(t,this,this.beans)}isCorrectCtrlForSpan(e){var o;const t=(o=this.beans.rowSpanSvc)==null?void 0:o.getCellSpan(e.column,this.rowNode);return!t||t.firstNode!==this.rowNode?!1:e.getCellSpan()===t}onRowHeightChanged(){}refreshFirstAndLastRowStyles(){}addHoverFunctionality(){}resetHoveredStatus(){}},hRe=class extends je{constructor(){super(...arguments),this.beanName="spannedRowRenderer",this.topCtrls=new Map,this.bottomCtrls=new Map,this.centerCtrls=new Map}postConstruct(){this.addManagedEventListeners({displayedRowsChanged:this.createAllCtrls.bind(this)})}createAllCtrls(){this.createCtrls("top"),this.createCtrls("bottom"),this.createCtrls("center")}createCtrls(e){const{rowSpanSvc:t}=this.beans,n=this.getCtrlsMap(e),o=n.size,s=this.getAllRelevantRowControls(e),r=new Map;let i=!1;for(const l of s)l.isAlive()&&(t==null||t.forEachSpannedColumn(l.rowNode,(c,u)=>{if(r.has(u.firstNode))return;const d=n.get(u.firstNode);if(d){r.set(u.firstNode,d),n.delete(u.firstNode);return}i=!0;const h=new dRe(u.firstNode,this.beans,!1,!1,!1);r.set(u.firstNode,h)}));this.setCtrlsMap(e,r);const a=r.size===o;if(!(!i&&a)){for(const l of n.values())l.destroyFirstPass(!0),l.destroySecondPass();this.dispatchLocalEvent({type:"spannedRowsUpdated",ctrlsKey:e})}}getAllRelevantRowControls(e){const{rowRenderer:t}=this.beans;switch(e){case"top":return t.topRowCtrls;case"bottom":return t.bottomRowCtrls;case"center":return t.allRowCtrls}}getCellByPosition(e){const{rowSpanSvc:t}=this.beans,n=t==null?void 0:t.getCellSpanByPosition(e);if(!n)return;const o=this.getCtrlsMap(e.rowPinned).get(n.firstNode);if(o)return o.getAllCellCtrls().find(s=>s.column===e.column)}getCtrls(e){return[...this.getCtrlsMap(e).values()]}destroyRowCtrls(e){for(const t of this.getCtrlsMap(e).values())t.destroyFirstPass(!0),t.destroySecondPass();this.setCtrlsMap(e,new Map)}getCtrlsMap(e){switch(e){case"top":return this.topCtrls;case"bottom":return this.bottomCtrls;default:return this.centerCtrls}}setCtrlsMap(e,t){switch(e){case"top":this.topCtrls=t;break;case"bottom":this.bottomCtrls=t;break;default:this.centerCtrls=t;break}}destroy(){super.destroy(),this.destroyRowCtrls("top"),this.destroyRowCtrls("bottom"),this.destroyRowCtrls("center")}},fRe={moduleName:"CellSpan",version:ut,beans:[cRe,hRe]},pRe=class extends je{constructor(e,t){super(),this.cellCtrl=e,this.staticClasses=[],this.beans=t,this.column=e.column}setComp(e){this.cellComp=e,this.applyUserStyles(),this.applyCellClassRules(),this.applyClassesFromColDef()}applyCellClassRules(){const{column:e,cellComp:t}=this,n=e.colDef,o=n.cellClassRules,s=this.getCellClassParams(e,n);AR(this.beans.expressionSvc,o===this.cellClassRules?void 0:this.cellClassRules,o,s,r=>t.toggleCss(r,!0),r=>t.toggleCss(r,!1)),this.cellClassRules=o}applyUserStyles(){const e=this.column,t=e.colDef,n=t.cellStyle;if(!n)return;let o;if(typeof n=="function"){const s=this.getCellClassParams(e,t);o=n(s)}else o=n;o&&this.cellComp.setUserStyles(o)}applyClassesFromColDef(){const{column:e,cellComp:t}=this,n=e.colDef,o=this.getCellClassParams(e,n);for(const r of this.staticClasses)t.toggleCss(r,!1);const s=this.beans.cellStyles.getStaticCellClasses(n,o);this.staticClasses=s;for(const r of s)t.toggleCss(r,!0)}getCellClassParams(e,t){const{value:n,rowNode:o}=this.cellCtrl;return Ot(this.beans.gos,{value:n,data:o.data,node:o,colDef:t,column:e,rowIndex:o.rowIndex})}},gRe=class extends je{constructor(){super(...arguments),this.beanName="cellStyles"}processAllCellClasses(e,t,n,o){AR(this.beans.expressionSvc,void 0,e.cellClassRules,t,n,o),this.processStaticCellClasses(e,t,n)}getStaticCellClasses(e,t){const{cellClass:n}=e;if(!n)return[];let o;return typeof n=="function"?o=n(t):o=n,typeof o=="string"&&(o=[o]),o||[]}createCellCustomStyleFeature(e,t){return new pRe(e,t)}processStaticCellClasses(e,t,n){this.getStaticCellClasses(e,t).forEach(s=>{n(s)})}},mRe={moduleName:"CellStyle",version:ut,beans:[gRe]},vRe={moduleName:"RowStyle",version:ut,beans:[oCe]};function yRe(e,t){var n;return!!((n=e.colHover)!=null&&n.isHovered(t))}var wRe=class extends je{constructor(e,t){super(),this.columns=e,this.element=t,this.destroyManagedListeners=[],this.enableFeature=n=>{const{beans:o,gos:s,element:r,columns:i}=this,a=o.colHover;if(n??!!s.get("columnHoverHighlight"))this.destroyManagedListeners=this.addManagedElementListeners(r,{mouseover:a.setMouseOver.bind(a,i),mouseout:a.clearMouseOver.bind(a)});else{for(const c of this.destroyManagedListeners)c();this.destroyManagedListeners=[]}}}postConstruct(){this.addManagedPropertyListener("columnHoverHighlight",({currentValue:e})=>{this.enableFeature(e)}),this.enableFeature()}destroy(){super.destroy(),this.destroyManagedListeners=null}},CRe="ag-column-hover",bRe=class extends je{constructor(){super(...arguments),this.beanName="colHover"}postConstruct(){this.addManagedPropertyListener("columnHoverHighlight",({currentValue:e})=>{e||this.clearMouseOver()})}setMouseOver(e){this.updateState(e)}clearMouseOver(){this.updateState(null)}isHovered(e){if(!this.gos.get("columnHoverHighlight"))return!1;const t=this.selectedColumns;return!!t&&t.indexOf(e)>=0}addHeaderColumnHoverListener(e,t,n){const o=()=>{const s=this.isHovered(n);t.toggleCss("ag-column-hover",s)};e.addManagedEventListeners({columnHoverChanged:o}),o()}onCellColumnHover(e,t){if(!t)return;const n=this.isHovered(e);t.toggleCss(CRe,n)}addHeaderFilterColumnHoverListener(e,t,n,o){this.createHoverFeature(e,[n],o);const s=()=>{const r=this.isHovered(n);t.toggleCss("ag-column-hover",r)};e.addManagedEventListeners({columnHoverChanged:s}),s()}createHoverFeature(e,t,n){e.createManagedBean(new wRe(t,n))}updateState(e){this.selectedColumns=e,this.eventSvc.dispatchEvent({type:"columnHoverChanged"})}},SRe={moduleName:"ColumnHover",version:ut,beans:[bRe],apiFunctions:{isColumnHovered:yRe}},ERe=class extends je{constructor(){super(...arguments),this.beanName="apiEventSvc",this.syncListeners=new Map,this.asyncListeners=new Map,this.syncGlobalListeners=new Set,this.globalListenerPairs=new Map}postConstruct(){var e,t;this.wrapSvc=(t=(e=this.beans.frameworkOverrides).createGlobalEventListenerWrapper)==null?void 0:t.call(e)}addListener(e,t){var r;const n=((r=this.wrapSvc)==null?void 0:r.wrap(e,t))??t,o=!_w.has(e),s=o?this.asyncListeners:this.syncListeners;s.has(e)||s.set(e,new Set),s.get(e).add(n),this.eventSvc.addListener(e,n,o)}removeListener(e,t){var r,i;const n=((r=this.wrapSvc)==null?void 0:r.unwrap(e,t))??t,o=this.asyncListeners.get(e),s=!!(o!=null&&o.delete(n));s||(i=this.syncListeners.get(e))==null||i.delete(n),this.eventSvc.removeListener(e,n,s)}addGlobalListener(e){var r;const t=((r=this.wrapSvc)==null?void 0:r.wrapGlobal(e))??e,n=(i,a)=>{_w.has(i)&&t(i,a)},o=(i,a)=>{_w.has(i)||t(i,a)};this.globalListenerPairs.set(e,{syncListener:n,asyncListener:o});const s=this.eventSvc;s.addGlobalListener(n,!1),s.addGlobalListener(o,!0)}removeGlobalListener(e){const{eventSvc:t,wrapSvc:n,globalListenerPairs:o}=this,s=(n==null?void 0:n.unwrapGlobal(e))??e;if(o.has(s)){const{syncListener:i,asyncListener:a}=o.get(s);t.removeGlobalListener(i,!1),t.removeGlobalListener(a,!0),o.delete(e)}else this.syncGlobalListeners.delete(s),t.removeGlobalListener(s,!1)}destroyEventListeners(e,t){e.forEach((n,o)=>{n.forEach(s=>this.eventSvc.removeListener(o,s,t)),n.clear()}),e.clear()}destroyGlobalListeners(e,t){for(const n of e)this.eventSvc.removeGlobalListener(n,t);e.clear()}destroy(){super.destroy(),this.destroyEventListeners(this.syncListeners,!1),this.destroyEventListeners(this.asyncListeners,!0),this.destroyGlobalListeners(this.syncGlobalListeners,!1);const{globalListenerPairs:e,eventSvc:t}=this;e.forEach(({syncListener:n,asyncListener:o})=>{t.removeGlobalListener(n,!1),t.removeGlobalListener(o,!0)}),e.clear()}};function _Re(e,t,n){var o;(o=e.apiEventSvc)==null||o.addListener(t,n)}function RRe(e,t,n){var o;(o=e.apiEventSvc)==null||o.removeListener(t,n)}function TRe(e,t){var n;(n=e.apiEventSvc)==null||n.addGlobalListener(t)}function DRe(e,t){var n;(n=e.apiEventSvc)==null||n.removeGlobalListener(t)}var IRe={moduleName:"EventApi",version:ut,apiFunctions:{addEventListener:_Re,addGlobalListener:TRe,removeEventListener:RRe,removeGlobalListener:DRe},beans:[ERe]},xRe={moduleName:"Locale",version:ut,beans:[sbe]},PRe=class extends je{constructor(){super(...arguments),this.beanName="rowAutoHeight",this.wasEverActive=!1,this._debouncedCalculateRowHeights=qo(this,this.calculateRowHeights.bind(this),1)}requestCheckAutoHeight(){this.wasEverActive&&this._debouncedCalculateRowHeights()}calculateRowHeights(){var a,l,c,u;const{visibleCols:e,rowModel:t,rowSpanSvc:n,pinnedRowModel:o}=this.beans,s=e.autoHeightCols;let r=!1;const i=d=>{var p;const h=d.__autoHeights;let f=Tl(this.beans,d).height;for(const g of s){let v=h==null?void 0:h[g.getColId()];const C=n==null?void 0:n.getCellSpan(g,d);if(C){if(C.getLastNode()!==d)continue;if(v=(p=n==null?void 0:n.getCellSpan(g,d))==null?void 0:p.getLastNodeAutoHeight(),!v)return}if(v==null){if(this.colSpanSkipCell(g,d))continue;return}f=Math.max(v,f)}f!==d.rowHeight&&(d.setRowHeight(f),r=!0)};(a=o==null?void 0:o.forEachPinnedRow)==null||a.call(o,"top",i),(l=o==null?void 0:o.forEachPinnedRow)==null||l.call(o,"bottom",i),(c=t.forEachDisplayedNode)==null||c.call(t,i),r&&((u=t.onRowHeightChanged)==null||u.call(t))}setRowAutoHeight(e,t,n){if(e.__autoHeights??(e.__autoHeights={}),t==null){delete e.__autoHeights[n.getId()];return}const o=e.__autoHeights[n.getId()];e.__autoHeights[n.getId()]=t,o!==t&&this.requestCheckAutoHeight()}colSpanSkipCell(e,t){const{colModel:n,colViewport:o,visibleCols:s}=this.beans;if(!n.colSpanActive)return!1;let r=[];switch(e.getPinned()){case"left":r=s.getLeftColsForRow(t);break;case"right":r=s.getRightColsForRow(t);break;case null:r=o.getColsWithinViewport(t);break}return!r.includes(e)}setupCellAutoHeight(e,t,n){if(!e.column.isAutoHeight()||!t)return!1;this.wasEverActive=!0;const o=t.parentElement,{rowNode:s,column:r}=e,i=this.beans,a=u=>{var S;if((S=this.beans.editSvc)!=null&&S.isEditing(e)||!e.isAlive()||!n.isAlive())return;const{paddingTop:d,paddingBottom:h,borderBottomWidth:f,borderTopWidth:p}=Uc(o),g=d+h+f+p,C=t.offsetHeight+g;if(u<5){const b=Lo(i),y=!(b!=null&&b.contains(t)),_=C==0;if(y||_){window.setTimeout(()=>a(u+1),0);return}}this.setRowAutoHeight(s,C,r)},l=()=>a(0);l();const c=El(i,t,l);return n.addDestroyFunc(()=>{c(),this.setRowAutoHeight(s,void 0,r)}),!0}setAutoHeightActive(e){this.active=e.list.some(t=>t.isVisible()&&t.isAutoHeight())}areRowsMeasured(){if(!this.active)return!0;const e=this.beans.rowRenderer.getAllRowCtrls();let t=null;for(const{rowNode:n}of e)if((!t||this.beans.colModel.colSpanActive)&&(t=this.beans.colViewport.getColsWithinViewport(n).filter(s=>s.isAutoHeight())),t.length!==0){if(!n.__autoHeights)return!1;for(const o of t){const s=n.__autoHeights[o.getColId()];if(!s||n.rowHeight<s)return!1}}return!0}},kRe={moduleName:"RowAutoHeight",version:ut,beans:[PRe]},FRe={moduleName:"AllCommunity",version:ut,dependsOn:[iG,VEe,qEe,Sbe,F0e,A0e,O0e,M0e,N0e,L0e,V0e,k0e,_Se,RSe,TSe,ESe,ISe,xSe,u_e,cEe,x_e,$$,B_e,$_e,q_e,Q_e,vme,iRe,Q0e,BCe,mRe,SRe,vRe,IRe,GCe,s_e,HH,xRe,kRe,mme,kEe,fRe]};let hG=!1;hG||(_ue.registerModules([FRe,iG]),hG=!0);class ARe{constructor(t,n){Tn(this,"gridApi",null);Tn(this,"container");Tn(this,"config");Tn(this,"eventListeners",new Map);this.container=t,this.config=n}init(){if(this.gridApi)throw new Error("Grid already initialized");const{onGridReady:t,onCellClicked:n,onCellFocused:o,onRowSelected:s,...r}=this.config,i={...r,onGridReady:a=>{this.gridApi=a.api,t&&t(a)},onCellClicked:a=>{n&&n(a)},onCellFocused:a=>{o&&o(a)},onRowSelected:a=>{s&&s(a)}};return this.gridApi=ebe(this.container,i),this.gridApi}updateRowData(t){this.gridApi&&this.gridApi.setGridOption("rowData",t)}updateColumnDefs(t){this.gridApi&&this.gridApi.setGridOption("columnDefs",t)}setColumnWidth(t){var n;this.gridApi&&((n=this.gridApi)==null||n.applyColumnState({state:t,applyOrder:!1}))}updateDatasource(t){this.gridApi&&this.gridApi.setGridOption("datasource",t)}refreshInfiniteCache(){this.gridApi&&this.gridApi.refreshInfiniteCache()}sizeColumnsToFit(){this.gridApi}deselectAll(){this.gridApi&&this.gridApi.deselectAll()}getSelectedRows(){var t;return((t=this.gridApi)==null?void 0:t.getSelectedRows())||[]}setQuickFilterText(t){this.gridApi&&this.gridApi.setGridOption("quickFilterText",t)}getColumnState(){var t;return(t=this.gridApi)==null?void 0:t.getColumnState()}addEventListener(t,n){if(!this.gridApi)throw new Error("Grid not initialized");this.eventListeners.has(t)||this.eventListeners.set(t,new Set),this.eventListeners.get(t).add(n),this.gridApi.addEventListener(t,n)}addRow(t,n="bottom"){if(this.gridApi){const o={add:[t],addIndex:n==="bottom"?void 0:0};if(this.gridApi.applyTransaction(o),n==="bottom"){const s=this.gridApi.getDisplayedRowCount();s>0&&this.gridApi.ensureIndexVisible(s-1,"bottom")}}}addRows(t,n="bottom"){if(this.gridApi&&t.length>0){const o={add:t,addIndex:n==="bottom"?void 0:0};if(this.gridApi.applyTransaction(o),n==="bottom"){const s=this.gridApi.getDisplayedRowCount();s>0&&this.gridApi.ensureIndexVisible(s-1,"bottom")}}}destroy(){this.gridApi&&(this.eventListeners.forEach((t,n)=>{t.forEach(o=>{var s;(s=this.gridApi)==null||s.removeEventListener(n,o)})}),this.eventListeners.clear(),this.gridApi.destroy(),this.gridApi=null)}getApi(){return this.gridApi}switchTheme(t){document.body.dataset.agThemeMode=t==="dark"?"dark":"light"}}const ORe=j$.withParams({accentColor:"var(--primary-color)",backgroundColor:"#ffffff",borderColor:"#e5e7eb",borderRadius:4,browserColorScheme:"light",chromeBackgroundColor:"#f9fafb",columnBorder:!0,fontFamily:"inherit",fontSize:14,foregroundColor:"#111827",headerBackgroundColor:"#fff",headerFontSize:14,headerFontWeight:600,headerTextColor:"#374151",iconSize:16,rowBorder:!0,spacing:8,headerHeight:40,rowHeight:32,wrapperBorder:!0,wrapperBorderRadius:4},"light").withParams({accentColor:"var(--primary-color)",backgroundColor:"#1f2937",borderColor:"#374151",borderRadius:4,browserColorScheme:"dark",chromeBackgroundColor:"#111827",columnBorder:!0,fontFamily:"inherit",fontSize:14,foregroundColor:"#f9fafb",headerBackgroundColor:"#374151",headerFontSize:14,headerFontWeight:600,headerTextColor:"#f9fafb",iconSize:16,rowBorder:!0,spacing:8,headerHeight:40,rowHeight:32,wrapperBorder:!0,wrapperBorderRadius:4},"dark"),MRe=tt({__name:"AgTable",props:{statusBar:{},sideBar:{type:[Object,String,Array,Boolean,null]},suppressContextMenu:{type:Boolean},preventDefaultOnContextMenu:{type:Boolean},allowContextMenuWithControlKey:{type:Boolean},columnMenu:{},suppressMenuHide:{type:Boolean},enableBrowserTooltips:{type:Boolean},tooltipTrigger:{},tooltipShowDelay:{},tooltipHideDelay:{},tooltipMouseTrack:{type:Boolean},tooltipShowMode:{},tooltipInteraction:{type:Boolean},popupParent:{},copyHeadersToClipboard:{type:Boolean},copyGroupHeadersToClipboard:{type:Boolean},clipboardDelimiter:{},suppressCopyRowsToClipboard:{type:Boolean},suppressCopySingleCellRanges:{type:Boolean},suppressLastEmptyLineOnPaste:{type:Boolean},suppressClipboardPaste:{type:Boolean},suppressClipboardApi:{type:Boolean},suppressCutToClipboard:{type:Boolean},columnDefs:{},defaultColDef:{},defaultColGroupDef:{},columnTypes:{},dataTypeDefinitions:{},maintainColumnOrder:{type:Boolean},enableStrictPivotColumnOrder:{type:Boolean},suppressFieldDotNotation:{type:Boolean},headerHeight:{},groupHeaderHeight:{},floatingFiltersHeight:{},pivotHeaderHeight:{},pivotGroupHeaderHeight:{},hidePaddedHeaderRows:{type:Boolean},allowDragFromColumnsToolPanel:{type:Boolean},suppressMovableColumns:{type:Boolean},suppressColumnMoveAnimation:{type:Boolean},suppressMoveWhenColumnDragging:{type:Boolean},suppressDragLeaveHidesColumns:{type:Boolean},suppressGroupChangesColumnVisibility:{type:[Boolean,String]},suppressMakeColumnVisibleAfterUnGroup:{type:Boolean},suppressRowGroupHidesColumns:{type:Boolean},colResizeDefault:{},suppressAutoSize:{type:Boolean},autoSizePadding:{},skipHeaderOnAutoSize:{type:Boolean},autoSizeStrategy:{},components:{},editType:{},suppressStartEditOnTab:{type:Boolean},getFullRowEditValidationErrors:{type:Function},invalidEditValueMode:{},singleClickEdit:{type:Boolean},suppressClickEdit:{type:Boolean},readOnlyEdit:{type:Boolean},stopEditingWhenCellsLoseFocus:{type:Boolean},enterNavigatesVertically:{type:Boolean},enterNavigatesVerticallyAfterEdit:{type:Boolean},enableCellEditingOnBackspace:{type:Boolean},undoRedoCellEditing:{type:Boolean},undoRedoCellEditingLimit:{},defaultCsvExportParams:{},suppressCsvExport:{type:Boolean},defaultExcelExportParams:{},suppressExcelExport:{type:Boolean},excelStyles:{},findSearchValue:{},findOptions:{},quickFilterText:{},cacheQuickFilter:{type:Boolean},includeHiddenColumnsInQuickFilter:{type:Boolean},quickFilterParser:{type:Function},quickFilterMatcher:{type:Function},applyQuickFilterBeforePivotOrAgg:{type:Boolean},excludeChildrenWhenTreeDataFiltering:{type:Boolean},enableAdvancedFilter:{type:Boolean},alwaysPassFilter:{type:Function},includeHiddenColumnsInAdvancedFilter:{type:Boolean},advancedFilterParent:{},advancedFilterBuilderParams:{},advancedFilterParams:{},suppressAdvancedFilterEval:{type:Boolean},suppressSetFilterByDefault:{type:Boolean},enableFilterHandlers:{type:Boolean},filterHandlers:{},enableCharts:{type:Boolean},chartThemes:{},customChartThemes:{},chartThemeOverrides:{},chartToolPanelsDef:{},chartMenuItems:{type:[Array,Function]},loadingCellRenderer:{},loadingCellRendererParams:{},loadingCellRendererSelector:{type:Function},localeText:{},masterDetail:{type:Boolean},keepDetailRows:{type:Boolean},keepDetailRowsCount:{},detailCellRenderer:{},detailCellRendererParams:{},detailRowHeight:{},detailRowAutoHeight:{type:Boolean},context:{},alignedGrids:{type:[Array,Function]},tabIndex:{},rowBuffer:{},valueCache:{type:Boolean},valueCacheNeverExpires:{type:Boolean},enableCellExpressions:{type:Boolean},suppressTouch:{type:Boolean},suppressFocusAfterRefresh:{type:Boolean},suppressBrowserResizeObserver:{type:Boolean},suppressPropertyNamesCheck:{type:Boolean},suppressChangeDetection:{type:Boolean},debug:{type:Boolean},loading:{type:Boolean},overlayLoadingTemplate:{},loadingOverlayComponent:{},loadingOverlayComponentParams:{},suppressLoadingOverlay:{type:Boolean},overlayNoRowsTemplate:{},noRowsOverlayComponent:{},noRowsOverlayComponentParams:{},suppressNoRowsOverlay:{type:Boolean},pagination:{type:Boolean},paginationPageSize:{},paginationPageSizeSelector:{type:[Array,Boolean]},paginationAutoPageSize:{type:Boolean},paginateChildRows:{type:Boolean},suppressPaginationPanel:{type:Boolean},pivotMode:{type:Boolean},pivotPanelShow:{},pivotMaxGeneratedColumns:{},pivotDefaultExpanded:{},pivotColumnGroupTotals:{},pivotRowTotals:{},pivotSuppressAutoColumn:{type:Boolean},suppressExpandablePivotGroups:{type:Boolean},functionsReadOnly:{type:Boolean},aggFuncs:{},suppressAggFuncInHeader:{type:Boolean},alwaysAggregateAtRootLevel:{type:Boolean},aggregateOnlyChangedColumns:{type:Boolean},suppressAggFilteredOnly:{type:Boolean},removePivotHeaderRowWhenSingleValueColumn:{type:Boolean},animateRows:{type:Boolean},cellFlashDuration:{},cellFadeDuration:{},allowShowChangeAfterFilter:{type:Boolean},domLayout:{},ensureDomOrder:{type:Boolean},enableCellSpan:{type:Boolean},enableRtl:{type:Boolean},suppressColumnVirtualisation:{type:Boolean},suppressMaxRenderedRowRestriction:{type:Boolean},suppressRowVirtualisation:{type:Boolean},rowDragManaged:{type:Boolean},rowDragInsertDelay:{},suppressRowDrag:{type:Boolean},suppressMoveWhenRowDragging:{type:Boolean},rowDragEntireRow:{type:Boolean},rowDragMultiRow:{type:Boolean},rowDragText:{type:Function},dragAndDropImageComponent:{},dragAndDropImageComponentParams:{},fullWidthCellRenderer:{},fullWidthCellRendererParams:{},embedFullWidthRows:{type:Boolean},groupDisplayType:{},groupDefaultExpanded:{},autoGroupColumnDef:{},groupMaintainOrder:{type:Boolean},groupSelectsChildren:{type:Boolean},groupLockGroupColumns:{},groupAggFiltering:{type:[Boolean,Function]},groupTotalRow:{type:[String,Function]},grandTotalRow:{},suppressStickyTotalRow:{type:[Boolean,String]},groupSuppressBlankHeader:{type:Boolean},groupSelectsFiltered:{type:Boolean},showOpenedGroup:{type:Boolean},groupHideParentOfSingleChild:{type:[Boolean,String]},groupRemoveSingleChildren:{type:Boolean},groupRemoveLowestSingleChildren:{type:Boolean},groupHideOpenParents:{type:Boolean},groupAllowUnbalanced:{type:Boolean},rowGroupPanelShow:{},groupRowRenderer:{},groupRowRendererParams:{},treeData:{type:Boolean},treeDataChildrenField:{},treeDataParentIdField:{},rowGroupPanelSuppressSort:{type:Boolean},suppressGroupRowsSticky:{type:Boolean},groupHierarchyConfig:{},pinnedTopRowData:{},pinnedBottomRowData:{},enableRowPinning:{type:[Boolean,String]},isRowPinnable:{type:Function},isRowPinned:{type:Function},rowModelType:{},rowData:{},asyncTransactionWaitMillis:{},suppressModelUpdateAfterUpdateTransaction:{type:Boolean},datasource:{},cacheOverflowSize:{},infiniteInitialRowCount:{},serverSideInitialRowCount:{},suppressServerSideFullWidthLoadingRow:{type:Boolean},cacheBlockSize:{},maxBlocksInCache:{},maxConcurrentDatasourceRequests:{},blockLoadDebounceMillis:{},purgeClosedRowNodes:{type:Boolean},serverSideDatasource:{},serverSideSortAllLevels:{type:Boolean},serverSideEnableClientSideSort:{type:Boolean},serverSideOnlyRefreshFilteredGroups:{type:Boolean},serverSidePivotResultFieldSeparator:{},viewportDatasource:{},viewportRowModelPageSize:{},viewportRowModelBufferSize:{},alwaysShowHorizontalScroll:{type:Boolean},alwaysShowVerticalScroll:{type:Boolean},debounceVerticalScrollbar:{type:Boolean},suppressHorizontalScroll:{type:Boolean},suppressScrollOnNewData:{type:Boolean},suppressScrollWhenPopupsAreOpen:{type:Boolean},suppressAnimationFrame:{type:Boolean},suppressMiddleClickScrolls:{type:Boolean},suppressPreventDefaultOnMouseWheel:{type:Boolean},scrollbarWidth:{},rowSelection:{},cellSelection:{type:[Boolean,Object]},rowMultiSelectWithClick:{type:Boolean},suppressRowDeselection:{type:Boolean},suppressRowClickSelection:{type:Boolean},suppressCellFocus:{type:Boolean},suppressHeaderFocus:{type:Boolean},selectionColumnDef:{},rowNumbers:{type:[Boolean,Object]},suppressMultiRangeSelection:{type:Boolean},enableCellTextSelection:{type:Boolean},enableRangeSelection:{type:Boolean},enableRangeHandle:{type:Boolean},enableFillHandle:{type:Boolean},fillHandleDirection:{},suppressClearOnFillReduction:{type:Boolean},sortingOrder:{},accentedSort:{type:Boolean},unSortIcon:{type:Boolean},suppressMultiSort:{type:Boolean},alwaysMultiSort:{type:Boolean},multiSortKey:{},suppressMaintainUnsortedOrder:{type:Boolean},icons:{},rowHeight:{},rowStyle:{},rowClass:{},rowClassRules:{},suppressRowHoverHighlight:{type:Boolean},suppressRowTransform:{type:Boolean},columnHoverHighlight:{type:Boolean},gridId:{},deltaSort:{type:Boolean},treeDataDisplayType:{},enableGroupEdit:{type:Boolean},initialState:{},reactiveCustomComponents:{type:Boolean},renderingMode:{},theme:{},loadThemeGoogleFonts:{type:Boolean},themeCssLayer:{},styleNonce:{},themeStyleContainer:{},getContextMenuItems:{type:Function},getMainMenuItems:{type:Function},postProcessPopup:{type:Function},processUnpinnedColumns:{type:Function},processCellForClipboard:{type:Function},processHeaderForClipboard:{type:Function},processGroupHeaderForClipboard:{type:Function},processCellFromClipboard:{type:Function},sendToClipboard:{type:Function},processDataFromClipboard:{type:Function},isExternalFilterPresent:{type:Function},doesExternalFilterPass:{type:Function},getChartToolbarItems:{type:Function},createChartContainer:{type:Function},focusGridInnerElement:{type:Function},navigateToNextHeader:{type:Function},tabToNextHeader:{type:Function},navigateToNextCell:{type:Function},tabToNextCell:{type:Function},getLocaleText:{type:Function},getDocument:{type:Function},paginationNumberFormatter:{type:Function},getGroupRowAgg:{type:Function},isGroupOpenByDefault:{type:Function},ssrmExpandAllAffectsAllRows:{type:Boolean},initialGroupOrderComparator:{type:Function},processPivotResultColDef:{type:Function},processPivotResultColGroupDef:{type:Function},getDataPath:{type:Function},getChildCount:{type:Function},getServerSideGroupLevelParams:{type:Function},isServerSideGroupOpenByDefault:{type:Function},isApplyServerSideTransaction:{type:Function},isServerSideGroup:{type:Function},getServerSideGroupKey:{type:Function},getBusinessKeyForNode:{type:Function},getRowId:{type:Function},resetRowDataOnUpdate:{type:Boolean},processRowPostCreate:{type:Function},isRowSelectable:{type:Function},isRowMaster:{type:Function},fillOperation:{type:Function},postSortRows:{type:Function},getRowStyle:{type:Function},getRowClass:{type:Function},getRowHeight:{type:Function},isFullWidthRow:{type:Function},onToolPanelVisibleChanged:{type:Function},onToolPanelSizeChanged:{type:Function},onColumnMenuVisibleChanged:{type:Function},onContextMenuVisibleChanged:{type:Function},onCutStart:{type:Function},onCutEnd:{type:Function},onPasteStart:{type:Function},onPasteEnd:{type:Function},onColumnVisible:{type:Function},onColumnPinned:{type:Function},onColumnResized:{type:Function},onColumnMoved:{type:Function},onColumnValueChanged:{type:Function},onColumnPivotModeChanged:{type:Function},onColumnPivotChanged:{type:Function},onColumnGroupOpened:{type:Function},onNewColumnsLoaded:{type:Function},onGridColumnsChanged:{type:Function},onDisplayedColumnsChanged:{type:Function},onVirtualColumnsChanged:{type:Function},onColumnEverythingChanged:{type:Function},onColumnsReset:{type:Function},onColumnHeaderMouseOver:{type:Function},onColumnHeaderMouseLeave:{type:Function},onColumnHeaderClicked:{type:Function},onColumnHeaderContextMenu:{type:Function},onComponentStateChanged:{type:Function},onCellValueChanged:{type:Function},onCellEditRequest:{type:Function},onRowValueChanged:{type:Function},onCellEditingStarted:{type:Function},onCellEditingStopped:{type:Function},onRowEditingStarted:{type:Function},onRowEditingStopped:{type:Function},onBulkEditingStarted:{type:Function},onBulkEditingStopped:{type:Function},onBatchEditingStarted:{type:Function},onBatchEditingStopped:{type:Function},onUndoStarted:{type:Function},onUndoEnded:{type:Function},onRedoStarted:{type:Function},onRedoEnded:{type:Function},onCellSelectionDeleteStart:{type:Function},onCellSelectionDeleteEnd:{type:Function},onRangeDeleteStart:{type:Function},onRangeDeleteEnd:{type:Function},onFillStart:{type:Function},onFillEnd:{type:Function},onFilterOpened:{type:Function},onFilterChanged:{type:Function},onFilterModified:{type:Function},onFilterUiChanged:{type:Function},onFloatingFilterUiChanged:{type:Function},onAdvancedFilterBuilderVisibleChanged:{type:Function},onFindChanged:{type:Function},onChartCreated:{type:Function},onChartRangeSelectionChanged:{type:Function},onChartOptionsChanged:{type:Function},onChartDestroyed:{type:Function},onCellKeyDown:{type:Function},onGridReady:{type:Function},onGridPreDestroyed:{type:Function},onFirstDataRendered:{type:Function},onGridSizeChanged:{type:Function},onModelUpdated:{type:Function},onVirtualRowRemoved:{type:Function},onViewportChanged:{type:Function},onBodyScroll:{type:Function},onBodyScrollEnd:{type:Function},onDragStarted:{type:Function},onDragStopped:{type:Function},onDragCancelled:{type:Function},onStateUpdated:{type:Function},onPaginationChanged:{type:Function},onRowDragEnter:{type:Function},onRowDragMove:{type:Function},onRowDragLeave:{type:Function},onRowDragEnd:{type:Function},onRowDragCancel:{type:Function},isRowValidDropPosition:{type:Function},onRowResizeStarted:{type:Function},onRowResizeEnded:{type:Function},onColumnRowGroupChanged:{type:Function},onRowGroupOpened:{type:Function},onExpandOrCollapseAll:{type:Function},onPivotMaxColumnsExceeded:{type:Function},onPinnedRowDataChanged:{type:Function},onPinnedRowsChanged:{type:Function},onRowDataUpdated:{type:Function},onAsyncTransactionsFlushed:{type:Function},onStoreRefreshed:{type:Function},onHeaderFocused:{type:Function},onCellClicked:{type:Function},onCellDoubleClicked:{type:Function},onCellFocused:{type:Function},onCellMouseOver:{type:Function},onCellMouseOut:{type:Function},onCellMouseDown:{type:Function},onRowClicked:{type:Function},onRowDoubleClicked:{type:Function},onRowSelected:{type:Function},onSelectionChanged:{type:Function},onCellContextMenu:{type:Function},onRangeSelectionChanged:{type:Function},onCellSelectionChanged:{type:Function},onTooltipShow:{type:Function},onTooltipHide:{type:Function},onSortChanged:{type:Function},height:{},isSorting:{type:Boolean}},emits:["onGridReady","row-clicked","cell-clicked","cell-focused","row-selected","on-scroll"],setup(e,{expose:t,emit:n}){const o=e,s=n,r=H(null);c0(r,()=>{var v;const g=(v=i.value)==null?void 0:v.getApi();g==null||g.clearFocusedCell()});const i=H(null),a=Y(()=>({width:"100%",height:o.height||"500px"})),l=Y(()=>({...o,theme:ORe}));function c(){var v;if(!r.value){console.warn("Grid container element not found");return}const g={...l.value,height:o.height};i.value=new ARe(r.value,g),i.value.init(),(v=i.value.getApi())==null||v.addEventListener("bodyScroll",()=>{s("on-scroll",new Event("scroll"))}),u()}function u(){var v;const g=((v=i.value)==null?void 0:v.getApi())??null;s("onGridReady",g)}function d(g){var C,S;if(!g)return;(C=i.value)==null||C.updateColumnDefs(g);const v=g.map(b=>b.field&&b.width&&!b.hide?{colId:b.field,width:b.width,flex:null}:null).filter(b=>b!==null);(S=i.value)==null||S.setColumnWidth(v)}function h(){var g;(g=i.value)==null||g.destroy(),i.value=null}function f(){var g;return((g=i.value)==null?void 0:g.getApi())||void 0}function p(){return i.value||null}return Qe(()=>o.columnDefs,(g,v)=>{const C=g==null?void 0:g.filter(b=>!b.hide).map(b=>b.field).join(","),S=v==null?void 0:v.filter(b=>!b.hide).map(b=>b.field).join(",");C!==S&&d(g)},{deep:!0}),Jn(()=>{h()}),t({gridApi:f,gridManager:p,syncColumnDefs:d}),en(()=>{c()}),Jn(()=>{h()}),(g,v)=>(K(),ce("div",{ref_key:"gridContainerRef",ref:r,style:hn(a.value),class:se(["ag-theme-quartz",["ag-table-container",o.isSorting?"is-sorting":""]])},null,6))}});function rh(e){return WV(e)}const NRe=()=>[...[{headerName:"Name",field:"name",sortable:!1,filter:!1,pinned:"left",lockPinned:!0,headerComponent:rh(Mc),suppressMovable:!0},{headerName:"Notes",field:"description",sortable:!1,filter:!1,suppressMovable:!1},{headerName:"Assignee",field:"assignees",sortable:!1,filter:!1,headerComponent:rh(Mc)},{headerName:"Status",field:"status",sortable:!1,filter:!1,headerComponent:rh(Mc)},{headerName:"Date Range",field:"dateRange",sortable:!1,filter:!1,headerComponent:rh(Mc)},{headerName:"Last Updated",field:"lastUpdated",sortable:!1,filter:!1,headerComponent:rh(Mc),cellRendererParams:n=>{var o,s,r;return{...n,value:(o=n==null?void 0:n.data)==null?void 0:o.lastUpdated.value,tooltip:((r=(s=n==null?void 0:n.data)==null?void 0:s.lastUpdated)==null?void 0:r.tooltip)||void 0,readOnly:!0}}},{headerName:"Completed On",field:"completedOn",sortable:!1,filter:!1,headerComponent:rh(Mc),cellRendererParams:n=>{var o,s,r;return{...n,value:(o=n==null?void 0:n.data)==null?void 0:o.completedOn.value,tooltip:((r=(s=n==null?void 0:n.data)==null?void 0:s.completedOn)==null?void 0:r.tooltip)||void 0,readOnly:!0}}}].map(n=>Sp.fromType(n))],Mw={WIDTH:60,HEADER_CLASS:"ag-checkbox-header"},LRe=()=>({field:"__checkboxSelection",checkboxSelection:!0,headerCheckboxSelection:!0,pinned:"left",width:Mw.WIDTH,minWidth:Mw.WIDTH,maxWidth:Mw.WIDTH,cellClass:"ag-checkbox-cell",headerClass:Mw.HEADER_CLASS,headerComponent:Py(Ese),suppressMovable:!0}),fG="blank",VRe=[fG,"__checkboxSelection","options"],BRe=["uiColumnResized","uiColumnMoved","api"],$Re={headerName:"",field:"options",sortable:!1,filter:!1,editable:!0,pinned:"right",lockPosition:!0,suppressMovable:!0,resizable:!1},pG=(e,t)=>t!=null&&t.width?{...e,width:t.width,flex:void 0}:e,HRe=(e,t,n)=>{const{getCachedValue:o,setCachedValue:s}=cf({dbName:"item_table_column_configs",storeName:"column_configs"}),r=async()=>{const d=await o(t);if(!d||typeof d!="string")return null;try{const h=JSON.parse(d);return Array.isArray(h)?h:null}catch(h){return console.error("Failed to parse cached column config:",h),null}},i=H([]),a=LRe();let l=0;const c=async d=>{const h=++l,f=await r();if(h!==l)return;const p=[];f==null||f.forEach(F=>{const{field:z,hide:j,width:Q,pinned:re}=F;p.push([z,j])});const g=new Map(p),v=NRe(),C=Sp.fromType($Re),S=!!f,y=((d==null?void 0:d.map(F=>{var z;return{headerName:F.name,field:`metric_${F.id}`,editable:((z=F==null?void 0:F.auth_permission)==null?void 0:z.permission)==2,sortable:!0,filter:!1,flex:1,context:{...F},hide:S?!g.get(`metric_${F.id}`):!(F.is_primary||F.is_point_metric),cellClass:"ag-cell-optimized",headerComponent:Py(Mc),headerComponentParams:()=>({headerType:F.metric_type.code=="number"||F.metric_type.code=="formula"?"number":"default"})}}))||[]).map(F=>Sp.fromType(F)),_=[a,...v,...y,C],E=[],D=[],T=[];for(const F of _)F.pinned==="left"?E.push(F):F.pinned==="right"||F.field===fG?D.push(F):T.push(F);if(!f||f.length===0){i.value=_;return}const P=new Map(f.map(F=>[F.field,F])),L=new Map(T.map(F=>[F.field,F])),I=[];for(const F of f)if(F.field&&L.has(F.field)){const z=L.get(F.field);I.push({...pG(z,F),hide:F.hide}),L.delete(F.field)}const x=Array.from(L.values()),O=[...I,...x].map(F=>({...F,lockPinned:!0})),N=F=>pG(F,P.get(F.field));i.value=[...E.map(N),...O,...D.map(N)]};Qe(e,d=>c(d),{immediate:!0});const u=mr((d,h)=>{if((d==null?void 0:d.source)!==void 0&&!BRe.includes(d.source))return;const f=n.value,p=f==null?void 0:f.getColumnDefs(),g=new Map;if(f==null||f.getColumnState().forEach(C=>{C.width&&g.set(C.colId,Number(C.width))}),i.value=p||i.value,!h)return;const v=(p??[]).filter(C=>C.field&&!VRe.includes(C.field)).map(C=>({field:C.field,hide:C.hide,width:g.get(C.field)||C.width,pinned:C.pinned}));s(t,JSON.stringify(v))},Ci);return GT(()=>u.cancel()),{columnDefs:i,checkboxColumn:a,saveColumnConfig:u}},GRe=()=>{const e=fn.getInstance().getItem("API_BASE_URL");return e!=null&&e.includes("v1")?e.slice(0,e.lastIndexOf("/v1")):String(e)},URe=e=>{var x,O,N;const{showMessage:t,showErrorNetMessage:n}=Es(),o=ro(),s={domainApi:GRe(),wsCode:fn.getInstance().getItem("ws.code"),entityId:e.value.entityId},r=(N=(O=(x=o==null?void 0:o.appContext)==null?void 0:x.config)==null?void 0:O.globalProperties)==null?void 0:N.apiConfig;if(!r||s.domainApi===""||s.wsCode==="")throw new Error("API configuration is missing in useItems");const i=new JM(r,s);i.on("call-api",F=>{F.success?t(F.apiCode,"success"):n(F)});const a=Go({}),l=H([]),c=H(!1),u=H(null),d=H(null),h=H(1),f=H(20);let p=Promise.resolve();const{setCachedUsers:g}=MY(),v=F=>({workspaceId:e.value.workspaceId,entityIds:[e.value.entityId],orderBy:"id-asc",include_permission:"{include_permission}",include_permission_names:!0,q:F}),C=50,S=async(F,z,j)=>{if(!F.length)return[];const Q=Yj(F,z);return(await Promise.all(Q.map(j))).flat()},b=async F=>{try{return(await i.getPermissionForItems({workspaceId:e.value.workspaceId,itemIds:F})).data.map(j=>[j==null?void 0:j.id,j.permission])}catch(z){return console.error("Failed to fetch item permissions chunk:",z),[]}},y=async(F,z)=>{try{const j=await i.getMetricValues({workspaceId:e.value.workspaceId,item_ids:F,per_page:F.length*z.length,metric_ids:z}),Q=j.data.map(q=>{const V=new Map(q.item_metrics.map(G=>[G.metric_id,{value:G.value,auth_permission:G==null?void 0:G.auth_permission}])),k=Object.fromEntries(z.map(G=>[G,V.get(G)??null]));return[q==null?void 0:q.id,k]}),re=new Set(j.data.map(q=>q==null?void 0:q.id));for(const q of F)if(!re.has(q)){const V=Object.fromEntries(z.map(k=>[k,{value:null,auth_permission:void 0}]));Q.push([q,V])}return Q}catch(j){return console.error("Failed to fetch a chunk of metric values:",j),F.map(re=>[re,Object.fromEntries(z.map(q=>[q,void 0]))])}},_=async F=>{try{const z=await i.getAssignedUser({workspaceId:e.value.workspaceId,item_ids:F,per_page:F.length}),j=z.data.flatMap(Q=>Q.assignees);return g(j),z.data.map(Q=>[Q==null?void 0:Q.id,Q==null?void 0:Q.assignees])}catch(z){return console.error("Failed to fetch a chunk of assigned users:",z),[]}},E=async F=>{if(!F.length)return console.warn("getPermissionForItems: Empty itemIds"),{};try{const z=await S(F,C,b);return Object.fromEntries(z)}catch(z){return console.error("Failed to fetch item permissions:",z),{}}},D=async(F,z)=>!F.length||!z.length?{}:(p=p.then(async()=>{try{const re=[];let q=0;for(let k=0;k<z.length;k+=5){q++;const G=z.slice(k,k+5),ee=[];for(let Fe=0;Fe<G.length;Fe++){const Ge=G[Fe],fe=await S(F,C,X=>y(X,[Ge]));ee.push(fe),await new Promise(X=>setTimeout(X,500))}re.push(...ee);const ge=k+5>=z.length}const V={};for(const k of re.flat()){const[G,ee]=k;V[G]||(V[G]={}),Object.assign(V[G],ee)}return V}catch(j){return console.error("Failed to fetch metric values:",j),{}}}),p),T=async F=>{if(!F.length)return console.warn("getAssignedUsers: Empty itemIds"),{};try{const z=await S(F,C,_);return Object.fromEntries(z)}catch(z){return console.error("Failed to fetch assigned users:",z),{}}};return{items:l,loading:c,error:u,pagination:d,currentPage:h,pageSize:f,cusorMap:a,fetchItems:async F=>{const{cursor:z,offset:j,size:Q,searchQuery:re}=F;let q=[];c.value=!0,u.value=null;try{const V=await i.getAllItem_cursor({...F,cursor:z||void 0,offset:j||void 0,pageSize:Q||f.value,...v(re),sortBy:F.sort_by});return l.value=V.data,d.value=V.meta,h.value=V.meta.current_page||0,q=V.data.map(k=>k==null?void 0:k.id),V}catch(V){throw u.value=V,console.error("Failed to fetch items (cursor):",V),V}finally{const V=async()=>{try{const[k,G]=await Promise.all([T(q),E(q)]);e.value.updateItemData({assignees:k,permission:G},q);const ee=await D(q,e.value.metricIds);e.value.setMetricValues(ee,new Set(q),e.value.metricIds)}catch(k){console.error("Post-fetch processing failed:",k)}};c.value=!1,setTimeout(V)}},getAssignableStatus:async F=>{try{return await i.getAssignableStatus({workspaceId:e.value.workspaceId,itemIds:F})}catch(z){throw console.error("Failed to fetch assignable status:",z),z}},getMetricList:async F=>{try{return await i.getMetricList({workspaceId:e.value.workspaceId,entityId:F})}catch(z){throw console.error("Failed to fetch metric list:",z),z}},getMetricValues:D,getAssignedUsers:T}};function WRe(e){return{updateRowData:(o,s)=>{if(!e.value)return;const r=[],i=new Set,a=e.value.getColumnDefs();if(!a)return;const l=a.map(c=>{if(c.field&&c.field.startsWith("metric_")&&(c.hide===!1||c.hide===void 0))return c.field}).filter(Boolean);s.forEach(c=>{var d;const u=(d=e.value)==null?void 0:d.getRowNode(c);if(u){if(r.push(u),o.assignees){const h=SY((o.assignees[c]||[]).map(aF));u.data.assignees=h,i.add("assignees")}o.permission&&(u.data.permissions=o.permission[c]),l.forEach(h=>{u.data[h]=u.data[h]??null})}}),i.add("assignees"),i.add("status"),i.add("dateRange"),i.add("moreActions"),i.add("name"),i.add("description"),e.value.refreshCells({rowNodes:r,columns:Array.from(i),force:!0})},setMetricValues:(o,s,r)=>{const i=e.value;if(!i)return;const a=new Map(Array.from(s).map(c=>[c,new Map(r.map(u=>[u,{value:null,auth_permission:void 0}]))]));Object.entries(o).forEach(([c,u])=>{Object.entries(u).forEach(([d,h])=>{var f;(f=a.get(c))==null||f.set(d,{value:h==null?void 0:h.value,auth_permission:h==null?void 0:h.auth_permission})})});const l=Array.from(a.entries()).map(([c,u])=>{const d=i.getRowNode(c);return d!=null&&d.data?(u.forEach((h,f)=>{const p=`metric_${f}`;d.data[p]=(h==null?void 0:h.value)||null;const g=`metric_permission_${f}`;d.data[p]=(h==null?void 0:h.value)||null,d.data[g]=(h==null?void 0:h.auth_permission)||null}),d):null});l.length>0&&i.refreshCells({rowNodes:l,columns:Array.from(r).map(c=>`metric_${c}`),force:!0})}}}function zRe(e,t,n,o,s){let r=!0;return{async getRows(i){try{o(!0),r&&(s(!0),r=!1);const a=Math.floor(i.startRow/t)+1,{rows:l,total:c}=await e({page:a,pageSize:t,filterText:n(),sort_by:i.sortModel});let u=-1;Number.isFinite(c)?u=c:l.length<t&&(u=i.startRow+l.length),i.context={pageSize:t,text:n()},i.successCallback(l,u),o(!1),s(!1)}catch(a){console.error("Datasource fetch error:",a),i.failCallback(),o(!1),s(!1)}}}}function jRe(e){const{selectRowData:t,isSidebarOpen:n,quickFilterText:o,gridApi:s,fetcher:r}=e,i=H(!0),a=H(!0),l=H(!1),c=()=>{n.value=!n.value},u=v=>{if(i.value=!1,s.value=v,!v)return null;const{addEventListener:C,setGridOption:S}=v;if(!r)return console.error("Fetcher function is undefined"),null;const b=zRe(r,e.perPage,()=>o.value,y=>{i.value=y},y=>{a.value=y});return S==null||S("datasource",b),C==null||C("selectionChanged",()=>{t.value=v.getSelectedRows()}),v||null},d=v=>{var C,S;if((C=s.value)==null||C.hideOverlay(),v!==void 0&&(o.value=v),(S=s.value)==null||S.deselectAll(),t.value=[],i.value=!0,!s.value||!r){console.error("Grid API or fetcher is not available"),i.value=!1;return}l.value=!0,a.value=!0,s.value.purgeInfiniteCache(),s.value.ensureIndexVisible(0,"top"),setTimeout(()=>{i.value=!1,setTimeout(()=>{l.value=!1},100)},300)},h=()=>{var v;(v=s.value)==null||v.deselectAll(),t.value=[]},f=mr(v=>{d(v)},Ci);return{isLoading:i,toggleSidebar:c,onGridReady:u,onSearch:f,handleUnSelect:h,firstLoad:a,cacheCleared:l,handleSelectAll:()=>{s.value},isSelectAll:H(!1)}}const KRe={changelog:{"1.0.1":{date:"2024-06-20",changes:["Fixed styling issues for archived and deleted rows."]},"1.0.0":{date:"2024-06-15",changes:["Initial release of the Item Table package."]},"0.0.1-alpha.8":{date:"2024-06-10",changes:["Improved performance of row updates.","Added support for custom cell renderers.","Add row hover effect for better UX.","Add loading skeleton for filter","Beta release with core functionalities implemented."]},"0.0.1-alpha.9":{date:"2024-06-05",changes:["Add row selection feature.","Fix bug with column resizing.","Optimize rendering for large datasets.","Implement getLog function to retrieve changelog entries based on version.","Display app version and changelog in the Item Table component tooltip.","Clean up unused autocomplete and memoized config composables.","Update styles for better consistency and readability."]},"0.0.1-alpha.11":{date:"2024-06-18",changes:["Add bulk process status display: items now show an hourglass icon and tooltip when being processed.","Update data model: added isProcessing and bulk_process properties to track item status.","Improve row focus: focused rows now flash for better visibility.","Set 'Last Updated' and 'Completed On' columns as read-only.","Fix: resolve visual fetching issue in useRemoteFiles composable.","Fix: use correct upload icon in PopupCreateScenes component.","Enhance data conversion to include processing status in item rows."]},"0.0.1-alpha.12":{date:"2024-06-12",changes:["feat: enhance Snackbar component and notification handling","Refactor Snackbar.vue for improved readability and styling, including color adjustments for icons and text.","Add showMessage function in notifications store to display messages based on API keys, improving notification management.","Introduce notificationMessage constant to centralize notification messages for various API actions, enhancing maintainability.","Remove unnecessary console logs from useRemoteFiles and improve logging in notification store for better debugging."]},"0.0.1-alpha.16":{date:"2024-06-20",changes:["Add onboarding tour feature and enhance UI components with new dependencies","Refactor UI components for improved styling and functionality","Updated RatingComponent.vue to streamline class bindings and improve accessibility attributes.","Enhanced SearchBox.vue by adding a clear event handler and simplifying icon rendering.","Modified AssigneeGroupEditor.vue and AssigneeGroupRenderer.vue to remove unnecessary size attributes from icons.","Adjusted DateRangeRenderer.vue to remove size attributes from icons for consistency.","Updated HeaderCheckbox.vue to set dropdown placement to 'bottom-start'.","Refined HeaderSorting.vue to simplify sort option labels and improve sorting logic.","Enhanced HeaderWrapper.vue to utilize reactive properties for sorting state.","Improved HyperLinkEditor.vue and HyperLinkInlineEditor.vue by removing size attributes from icons.","Updated PopupLayout.vue to use a CSS variable for box-shadow styling.","Refined Snackbar.vue to standardize icon colors and improve styling consistency.","Adjusted useTippy.ts to set default placement and arrow visibility for tooltips.","Modified notificationMessage.ts to remove error messages for list fetching.","Cleaned up notifications.ts by removing console logs for a cleaner codebase.","Updated sortStore.ts to comment out unnecessary console logs for better performance.","Enhanced styles.scss by defining new icon size variables and standardizing box-shadow styles."]},"0.0.99":{date:"2024-06-24",changes:["Fix: resolve issue with incorrect version display in Item Table component.","Update changelog retrieval logic to ensure accurate version matching.","Enhance tooltip display for app version and changelog in Item Table component."]}}},qRe=e=>{var t;return(t=Object.entries(KRe.changelog).find(([n,o])=>n===e))==null?void 0:t[1].changes},YRe={class:"visual-btn-visual"},XRe={class:"visual-btn--label"},ZRe={key:0,class:"visual-btn--description"},JRe={key:1,class:"visual-btn--description"},QR=bt(tt({__name:"VisualButton",props:{label:{},description:{},disabled:{type:Boolean}},emits:["onClick"],setup(e,{emit:t}){const n=e,o=()=>{n.disabled||s("onClick")},s=t;return(r,i)=>(K(),ce("div",{class:se(["visual-btn",{"visual-btn--disabled":e.disabled}]),onClick:o},[Te("div",YRe,[xt(r.$slots,"visual",{},()=>[i[0]||(i[0]=mz('<svg width="42" height="36" viewBox="0 0 42 36" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-c2003bd7><g clip-path="url(#clip0_4824_13082)" data-v-c2003bd7><path d="M5.14286 18V10.2857H18V18H5.14286ZM5.14286 23.1 429H18V30.8571H5.14286V23.1429ZM23.1429 30.8571V23.1429H36V30.8571H23.1429ZM36 18H23.1429V10.2857H36V18ZM5.14286 0C2.30625 0 0 2.30625 0 5.14286V30.8571C0 33.6937 2.30625 36 5.14286 36H36C38.8366 36 41.1429 33.6937 41.1429 30.8571V5.14286C41.1429 2.30625 38.8366 0 36 0H5.14286Z" fill="#D7D7D7" data-v-c2003bd7></path><path d="M0 5.14286C0 2.30625 2.30625 0 5.14286 0H36C38.8366 0 41.1429 2.30625 41.1429 5.14286V10.318H0V5.14286Z" fill="#A6A6A6" data-v-c2003bd7></path></g><defs data-v-c2003bd7><clipPath id="clip0_4824_13082" data-v-c2003bd7><rect width="41.1429" height="36" fill="white" data-v-c2003bd7></rect></clipPath></defs></svg>',1))],!0)]),Te("div",XRe,it(n.label),1),n.disabled?(K(),ce("div",ZRe," Coming soon ")):(K(),ce("div",JRe,it(n.description),1))],2))}}),[["__scopeId","data-v-c2003bd7"]]),eT="xlsx_toolbox",QRe="TOOLBOX_EXPORT_DATA",eTe="https://app.arbocollab.com",tTe=1e3,gG=()=>sessionStorage.getItem("BASE_URL"),mG=(e,t="xlsx-mapping")=>{const n=In("switchInstance",void 0),o=`${t}:load`,s=`${t}:edit`,r=new Set;let i;const a=()=>{const h={showLoad:!1};n?n(eT,"",h):window.appManager.switchInstance(eT,"",h)},l=(h,f)=>{console.log("Posting to Toolbox:",{type:h,payload:f});const p=setTimeout(()=>{r.delete(p),window.postMessage({type:h,payload:f},`${gG()}`)},tTe);r.add(p)},c=h=>{const f=h==null?void 0:h.source,p=h==null?void 0:h.template;if(!p)throw new Error("template file is missing");a(),l(o,{source:f,template:p})},u=(h,f)=>{if(!h)throw new Error("Error file is missing");a(),l(s,{file:h})},d=h=>{if((h==null?void 0:h.type)!==QRe)return;const{file:f,fileName:p}=h.payload;e(new File([f],p,{type:f.type}),p),window.appManager.hide(eT)};return en(()=>{i=Bte({target:window,allowedOrigins:[gG()||eTe],onMessage:d,onInvalidMessage:(h,f,p)=>{console.warn("Rejected postMessage:",f,p.origin)}})}),Jn(()=>{i==null||i(),r.forEach(clearTimeout),r.clear()}),{openToolbox:c,sendBackErrorFile:u}},nTe={class:"header-name"},oTe={class:"modal-body"},sTe={class:"description"},rTe={key:0,class:"error-message"},iTe={class:"dynamic"},aTe={key:1,class:"choose-method-container"},lTe={key:2,class:"select-status-container"},cTe={key:3,class:"result-container"},uTe={key:4,class:"result-container"},dTe={key:2},vG="text/csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",hTe=20,fTe=bt(tt({__name:"PopupToolboxUploader",props:{workspaceId:{},entityId:{}},emits:["import-success"],setup(e,{expose:t,emit:n}){const o=Kt,s=Y(()=>[1,2].includes(f.value)),r=Y(()=>DS()),i=Y(()=>({1:{title:`Create ${r.value} in bulk`,description:""},2:{title:"Select status",description:"Choose the starting status for the new work."},3:{title:"Import successful",description:"Work will be created in background. Refresh to see updates."},4:{title:"Import failed",description:"Some data doesn't meet the requirements. Review it and try again."},5:{title:"Waiting for Toolbox",description:"Waiting for Toolbox"}})),a={"--popup-pt":"20px","--popup-pb":"20px","--popup-pl":"24px","--popup-pr":"24px"},l=e,c=n,{apiServices:u}=io(!1,l),d=1,h=H(),f=H(d),p=H(null),g=H(null),v=H(null),C=H(void 0),S=H(null),b=Y(()=>i.value[f.value]),y=H(),_=()=>{var V;p.value=null,f.value=d,g.value=null,v.value=null,E.value=null,S.value=null,(V=y.value)==null||V.clear(),C.value=void 0};Qe([g,v],([V,k])=>{f.value===1&&V&&k&&(f.value=2)});const E=H(null),D=V=>Es().getErrorMessageFromResponse(V),T=V=>{if(console.error(V),typeof V=="string"){E.value=V;return}const k=V.response,G=k==null?void 0:k.data,ee=D(G);E.value=ee??V.message,console.log("Error message set to:",{errorMsg:ee,message:V})},P=async(V,k)=>{var ee;if(Q.value=!0,!u.value||!l.workspaceId||!l.entityId){console.error("API services not available");return}const G=new FormData;G.append("file",V),G.append("format",((ee=k??V.name)==null?void 0:ee.split(".").pop())??V.name.split(".").pop()??""),G.append("entity_id",l.entityId),G.append("template_flow_status_id",p.value??"");try{await u.value.addNewSceneViaImportFile(l.workspaceId,l.entityId,G),f.value=3,c("import-success")}catch(ge){console.error("Error uploading file:",ge),T(ge||"An unknown error occurred during file upload."),f.value=4}finally{Q.value=!1}},{openToolbox:L,sendBackErrorFile:I}=mG((V,k)=>{v.value=V,C.value=k??V.name,f.value=2}),x=async()=>{const V=await N();try{L({template:V})}catch(k){console.error("Error opening toolbox:",k),Es().showErrorNetMessage("Failed to open toolbox.")}},O=H(!1),N=async()=>{O.value=!0;const V=l.workspaceId,k=l.entityId;if(!V||!k||!u.value)return console.error("Workspace ID or Entity ID is missing"),Promise.reject(new Error("Workspace ID or Entity ID is missing"));try{const G=await u.value.downloadTemplate(V,k,!1);if(!G)throw new Error("No response from downloadTemplate API");return G}catch(G){return console.error("Error downloading template:",G),Promise.reject(G)}finally{O.value=!1}},F=V=>{const k=vG.includes(V.type);return k||(console.error("Invalid file type:",V.type),Es().addNotification({id:"invalid-file-type",message:"Invalid file type. Please upload a xlsx, xls, csv file.",type:"error"})),k},z=async()=>{const V=document.createElement("input");V.type="file",V.accept=vG,V.onchange=async()=>{var G;const k=(G=V.files)==null?void 0:G[0];if(k){if(!F(k)){_();return}g.value=Hm(k);try{const ee=await N();if(!ee){Es().addNotification({id:"failed-download-template",message:"Failed to download template file.",type:"error"});return}L({source:k,template:ee})}catch(ee){console.error("Error opening toolbox:",ee),Es().addNotification({id:"failed-open-toolbox",message:"Failed to open toolbox.",type:"error"})}}},V.click()},j=async V=>{var k;if(!((k=u.value)!=null&&k.getAssignableStatuses)){console.error("API services not available");return}return u.value.getAssignableStatuses(l.workspaceId,{entity_id:l.entityId,name_like:V.name_like,page:V.page,per_page:hTe})},Q=H(!1),re=()=>{p.value=null,v.value&&C.value&&I(v.value,C.value)},q=()=>{p.value&&v.value&&(Q.value=!0,P(v.value,C.value).finally(()=>{Q.value=!1}))};return t({open:()=>{var V;return(V=h.value)==null?void 0:V.show()},close:()=>{var V;return(V=h.value)==null?void 0:V.hide()}}),(V,k)=>(K(),ze(W(ON),jt({ref_key:"popupRef",ref:h,style:a,onHidden:_},{popupIndex:10,popupName:b.value.title,minWidth:"420px",showOverlay:!0,overlayOpacity:.5,closeOnOverlayClick:!1,closeOnEscape:!0,showCloseBtn:s.value}),Lh({header:be(()=>[Te("span",nTe,it(b.value.title),1)]),default:be(()=>[Te("div",oTe,[Te("div",sTe,it(b.value.description),1),E.value&&f.value===4?(K(),ce("div",rTe,[k[3]||(k[3]=nt(" Error code ",-1)),Te("span",iTe,it(E.value),1)])):Xe("",!0),f.value===1?(K(),ce("div",aTe,[ye(QR,{disabled:!1,label:"Start with a blank sheet",description:`Type or paste ${r.value} details
255
255
  into a table.`,onOnClick:x},{visual:be(()=>[ye(W(ll),{src:"BlankSheet",size:65})]),_:1},8,["description"]),ye(QR,{label:"Import from file",description:`Create ${r.value} from a CSV or
256
256
  Excel file.`,onOnClick:z},{visual:be(()=>[ye(W(ll),{src:"UploadFile",size:65,"max-width":"65"})]),_:1},8,["description"])])):f.value===2?(K(),ce("div",lTe,[ye(W(Ore),{modelValue:p.value,"onUpdate:modelValue":k[0]||(k[0]=G=>p.value=G),"get-status-func":j,"workspace-id":l.workspaceId,id:l.entityId,style:{width:"100%"},"max-width":"372px",ref_key:"selectStatusRef",ref:y},null,8,["modelValue","workspace-id","id"])])):f.value===3?(K(),ce("div",cTe,[ye(W(ll),{src:"Success",width:240,height:180,ratio:"unset"})])):f.value===4?(K(),ce("div",uTe,[ye(W(ll),{src:"Failed",width:240,height:180,ratio:"unset"})])):Xe("",!0)])]),_:2},[f.value===2||f.value===4||f.value===3?{name:"footer",fn:be(()=>[f.value===4?(K(),ze(W(pt),{key:0,variant:"secondary",onClick:k[1]||(k[1]=()=>{var G;_(),(G=h.value)==null||G.hide()})},{default:be(()=>[...k[4]||(k[4]=[nt(" Close ",-1)])]),_:1})):f.value===3?(K(),ze(W(pt),{key:1,variant:"secondary",onClick:k[2]||(k[2]=()=>{var G;_(),(G=h.value)==null||G.hide()})},{default:be(()=>[...k[5]||(k[5]=[nt(" Got it ",-1)])]),_:1})):Xe("",!0),f.value===2?qe((K(),ce("div",dTe,[ye(W(pt),{loading:Q.value,disabled:Q.value||!p.value,onClick:q},{default:be(()=>[...k[6]||(k[6]=[nt(" Import ",-1)])]),_:1},8,["loading","disabled"])])),[[W(o),{content:Q.value||!p.value?"Select a status first":void 0,bypassOverflowCheck:!0}]]):Xe("",!0),f.value===4?(K(),ze(W(pt),{key:3,onClick:re},{default:be(()=>[...k[7]||(k[7]=[nt(" Try Again ",-1)])]),_:1})):Xe("",!0)]),key:"0"}:void 0]),1040))}}),[["__scopeId","data-v-aff6ff8a"]]),pTe={class:"header-name"},gTe={class:"modal-body"},mTe={class:"description"},vTe={key:0,class:"error-message"},yTe={class:"dynamic"},wTe={key:1,class:"choose-method-container"},CTe={key:2,class:"result-container"},bTe={key:3,class:"result-container"},STe={key:2},yG="text/csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",ETe=bt(tt({__name:"PopupBulkUpdate",props:{workspaceId:{},entityId:{}},emits:["import-success"],setup(e,{expose:t,emit:n}){const o=Kt,s=Y(()=>[1,2].includes(f.value)),r=Y(()=>DS()),i=Y(()=>({1:{title:`Update ${r.value} in bulk`,description:""},2:{title:"Select status",description:"Choose the starting status for the new work."},3:{title:"Import successful",description:"Work will be created in background. Refresh to see updates."},4:{title:"Import failed",description:"Some data doesn't meet the requirements. Review it and try again."},5:{title:"Waiting for Toolbox",description:"Waiting for Toolbox"}})),a={"--popup-pt":"20px","--popup-pb":"20px","--popup-pl":"24px","--popup-pr":"24px"},l=e,c=n,{apiServices:u}=io(!1,l),d=1,h=H(),f=H(d),p=H(null),g=H(null),v=H(null),C=H(void 0),S=H(null),b=Y(()=>i.value[f.value]),y=H(),_=()=>{var re;p.value=null,f.value=d,g.value=null,v.value=null,E.value=null,S.value=null,(re=y.value)==null||re.clear(),C.value=void 0};Qe([g,v],([re,q])=>{f.value===1&&re&&q&&(f.value=2)});const E=H(null),D=re=>Es().getErrorMessageFromResponse(re),T=re=>{if(typeof re=="string"){E.value=re;return}const q=re.response,V=q==null?void 0:q.data,k=D(V);E.value=k??re.message,console.log("Error message set to:",{errorMsg:k,message:re})},P=async(re,q)=>{var G;z.value=!0;const V=new FormData,k=((G=re.name.split(".").pop())==null?void 0:G.toString())||"";if(V.append("file",re),V.append("format",k),V.append("entity_id",l.entityId||""),!u.value){console.error("API services not available");return}try{await u.value.overwriteScenesViaImportFile(l.workspaceId,l.entityId,V),f.value=3,c("import-success")}catch(ee){console.error("Error uploading file:",ee),T(ee),f.value=4}finally{z.value=!1}},{openToolbox:L,sendBackErrorFile:I}=mG((re,q)=>{v.value=re,C.value=q??re.name,P(re)},"feedback-merge"),x=H(!1),O=async()=>{x.value=!0;const re=l.workspaceId,q=l.entityId;if(!re||!q||!u.value)return console.error("Workspace ID or Entity ID is missing"),Promise.reject(new Error("Workspace ID or Entity ID is missing"));try{const V=await u.value.downloadExportedItemsFile(re,q,!1);if(!V)throw new Error("No response from downloadTemplate API");return V}catch(V){return console.error("Error downloading template:",V),Promise.reject(V)}finally{x.value=!1}},N=re=>{const q=yG.includes(re.type);return q||(console.error("Invalid file type:",re.type),Es().addNotification({id:"invalid-file-type",message:"Invalid file type. Please upload a xlsx, xls, csv file.",type:"error"})),q},F=async()=>{const re=document.createElement("input");re.type="file",re.accept=yG,re.onchange=async()=>{var V;const q=(V=re.files)==null?void 0:V[0];if(q){if(!N(q)){_();return}g.value=Hm(q);try{const k=await O();if(!k){Es().addNotification({id:"failed-download-template",message:"Failed to download file.",type:"error"});return}L({exportFile:k,feedbackFile:q})}catch(k){console.error("Error opening toolbox:",k),Es().addNotification({id:"failed-open-toolbox",message:"Failed to open toolbox.",type:"error"})}}},re.click()},z=H(!1),j=()=>{p.value=null,v.value&&C.value&&I(v.value,C.value)},Q=()=>{p.value&&v.value&&(z.value=!0,P(v.value,C.value).finally(()=>{z.value=!1}))};return t({open:()=>{var re;return(re=h.value)==null?void 0:re.show()},close:()=>{var re;return(re=h.value)==null?void 0:re.hide()}}),(re,q)=>(K(),ze(W(ON),jt({ref_key:"popupRef",ref:h,style:a,onHidden:_},{popupIndex:10,popupName:b.value.title,minWidth:"420px",showOverlay:!0,overlayOpacity:.5,closeOnOverlayClick:!1,closeOnEscape:!0,showCloseBtn:s.value}),Lh({header:be(()=>[Te("span",pTe,it(b.value.title),1)]),default:be(()=>[Te("div",gTe,[Te("div",mTe,it(b.value.description),1),E.value&&f.value===4?(K(),ce("div",vTe,[q[2]||(q[2]=nt(" Error code ",-1)),Te("span",yTe,it(E.value),1)])):Xe("",!0),f.value===1?(K(),ce("div",wTe,[ye(QR,{disabled:!1,label:"Import from file",description:`Update ${r.value} from a CSV or Excel file.`,onOnClick:F,style:{width:"100%"}},{visual:be(()=>[ye(W(ll),{src:"UploadFile",size:65})]),_:1},8,["description"])])):f.value===3?(K(),ce("div",CTe,[ye(W(ll),{src:"Success",width:240,height:180,ratio:"unset"})])):f.value===4?(K(),ce("div",bTe,[ye(W(ll),{src:"Failed",width:240,height:180,ratio:"unset"})])):Xe("",!0)])]),_:2},[f.value===2||f.value===4||f.value===3?{name:"footer",fn:be(()=>[f.value===4?(K(),ze(W(pt),{key:0,variant:"secondary",onClick:q[0]||(q[0]=()=>{var V;_(),(V=h.value)==null||V.hide()})},{default:be(()=>[...q[3]||(q[3]=[nt(" Close ",-1)])]),_:1})):f.value===3?(K(),ze(W(pt),{key:1,variant:"secondary",onClick:q[1]||(q[1]=()=>{var V;_(),(V=h.value)==null||V.hide()})},{default:be(()=>[...q[4]||(q[4]=[nt(" Got it ",-1)])]),_:1})):Xe("",!0),f.value===2?qe((K(),ce("div",STe,[ye(W(pt),{loading:z.value,disabled:z.value||!p.value,onClick:Q},{default:be(()=>[...q[5]||(q[5]=[nt(" Import ",-1)])]),_:1},8,["loading","disabled"])])),[[W(o),{content:z.value||!p.value?"Select a status first":void 0,bypassOverflowCheck:!0}]]):Xe("",!0),f.value===4?(K(),ze(W(pt),{key:3,onClick:j},{default:be(()=>[...q[6]||(q[6]=[nt(" Try Again ",-1)])]),_:1})):Xe("",!0)]),key:"0"}:void 0]),1040))}}),[["__scopeId","data-v-8e0ab60d"]]),_Te=bt(tt({__name:"item-table",props:{entityId:{},workspaceId:{}},setup(e,{expose:t}){const n=Ns,o=r0(),{setUserPermissions:s,setEntityPermissions:r}=o,{entityPermissions:i}=us(o),a=Kt,l=Uo,c=H(null),u={ROWS_PER_PAGE:50,ROW_HEIGHT:38,GRID_HEIGHT:"650px"},d=H(""),h=Y(()=>{var Ke;const Ne=((Ke=i.value)==null?void 0:Ke.has_create_item_permission)==1||!1;return[{label:"Create in bulk",value:"import_scenes",type:"text",id:"import_scenes_option",hide:!Ne},{label:"Update in bulk",value:"bulk_update",type:"text",hide:!Ne,id:"bulk_update_option"}]}),f=e;Sp.initialize({wrapVueCellRenderer:Py,wrapVueCellEditor:WV});const p=Vf(),{switchInstanceFunc:g}=us(p);en(()=>{const Ne=ro();g.value=Ne==null?void 0:Ne.appContext.config.globalProperties.switchInstance;const Ke=new BroadcastChannel("focusable_channel");ft(()=>{setTimeout(()=>{Ke.postMessage("Focusable elements updated")},7e3)})});const v=H(null),C=H([]),S=qv(),{rowCount:b}=us(S),y=H(!1),_=H(""),E=H(),D=_O(),{metricList:T}=us(D),P=H(""),L=H(!1),I=H(new Set),x=H(new Map),{apiServices:O}=io(!1,f),{columnDefs:N,checkboxColumn:F,saveColumnConfig:z}=HRe(T,f.entityId,v),j=H();Qe(()=>N,()=>{var Ne;(Ne=j.value)==null||Ne.updateColumnDefs(N.value)},{deep:!0});const Q=(Ne,Ke)=>{z(Ne,Ke)},{updateRowData:re,setMetricValues:q}=WRe(v),V=Y(()=>({isSearching:_.value.length>0,isFiltering:!(Object.keys(xe.value||{}).length==1&&Object.keys(xe.value)[0]=="preflight_status")&&Object.keys(xe.value||{}).length>0})),k=Y(rv),G=Y(()=>N.value.filter(Ne=>{var Ke;return((Ke=Ne.field)==null?void 0:Ke.startsWith("metric_"))&&!Ne.hide}).map(Ne=>{var Ke;return((Ke=Ne.field)==null?void 0:Ke.replace("metric_",""))||""}));ui("timezone",k);const ee=Y(()=>({autoFetch:!1,workspaceId:f.workspaceId,entityId:f.entityId,metricIds:G.value,updateItemData:re,setMetricValues:q})),{fetchItems:ge,getMetricList:Fe,cusorMap:Ge,getMetricValues:fe}=URe(ee),X=Y(()=>{if(!v.value)return!1;const Ne=v.value.getSelectedRows().length;return Ne>0&&Ne>=b.value.total}),we=Y(()=>{var Ne;return((Ne=c.value)==null?void 0:Ne.name)||"Items"}),de=Ne=>{setTimeout(()=>{ft(()=>{var Ke,Wt;v.value&&(Ne?(Ke=v.value)==null||Ke.showNoRowsOverlay():(Wt=v.value)==null||Wt.hideOverlay())})},500)},B=(Ne,Ke)=>{var Wt;b.value.total=Ne.meta.total??0,(Wt=Ne.meta.next)!=null&&Wt.cursor&&(Ge[Ke+1]=Ne.meta.next.cursor),P.value=Ne.meta["X-Tsr-signature"]||"",Ne.meta.total===0?de(!0):de(!1)},te=iL(),{setDefaultSort:ne}=te,oe=H(null),{sortingAPIConfiguration:ae,isSortingRunning:ue}=us(te),xe=H({preflight_status:"1"}),le=Y(()=>({...xe.value,search:_.value}));ui("filterParams",le);const M=H([]),$=async({page:Ne,pageSize:Ke,filterText:Wt})=>{var nn,Bo,Po;(nn=v.value)==null||nn.hideOverlay();const gn=Ge[Ne],Js=!gn&&Ne>1?(Ne-1)*Ke:void 0,ks=ae.value;ks.length>0&&(ue.value=!0);try{const uh={cursor:gn,size:Ke,searchQuery:Wt,offset:Js,sort_by:ks,...xe.value},si=await ge(uh);if(!si)return{rows:[],total:0};const iu=(Po=(Bo=si.meta)==null?void 0:Bo.extra)==null?void 0:Po.default_sort;iu&&ne(iu);const ig=(Na=>{const ag=Na.data.map(La=>cF(La,k.value));return ag.forEach(La=>{I.value.add(String(La.id)),x.value.set(String(La.id),{})}),ag})(si);return B(si,Ne),{rows:ig,total:b.value.total}}catch(uh){return console.error("Failed to fetch items:",uh),{rows:[],total:0}}finally{ue.value=!1}},{isLoading:Ce,toggleSidebar:Ee,onGridReady:me,handleUnSelect:$e,handleSelectAll:Ye,onSearch:Se,firstLoad:Me}=jRe({selectRowData:H([]),isSidebarOpen:y,quickFilterText:_,gridApi:v,perPage:u.ROWS_PER_PAGE,fetcher:$}),Ct=H([]),Rt=mr(()=>{var ks;const Ne=((ks=v.value)==null?void 0:ks.getSelectedRows())||[],Ke=new Map(Ne.map(nn=>[nn.id,nn])),Js=Ne.map(nn=>nn.id).map(nn=>{var Bo,Po;return[nn,(Po=(Bo=v.value)==null?void 0:Bo.getRowNode(nn))==null?void 0:Po.rowIndex]}).sort((nn,Bo)=>(nn[1]??0)-(Bo[1]??0)).map(([nn])=>Ke.get(nn));console.log({newSelectedRows:Js}),Ct.value=Js.filter(nn=>nn!==void 0)}),Lt=Go({columnsDisplay:[],rowsDisplay:{fromIndex:0,toIndex:0}}),qt=Y(()=>({blockLoadDebounceMillis:1e3,columnDefs:N.value,rowModelType:"infinite",cacheBlockSize:u.ROWS_PER_PAGE,infiniteInitialRowCount:20,popupParent:document.getElementById("item-table-layout-id")||void 0,rowSelection:{mode:"multiRow",checkboxes:!1,enableClickSelection:!1,enableSelectionWithoutKeys:!1},pagination:!1,rowHeight:u.ROW_HEIGHT,suppressHorizontalScroll:!1,suppressColumnVirtualisation:!1,debounceVerticalScrollbar:!1,animateRows:!1,suppressAnimationFrame:!1,suppressScrollOnNewData:!0,suppressScrollWhenPopupsAreOpen:!1,rowBuffer:20,enableCellTextSelection:!1,suppressDragLeaveHidesColumns:!0,suppressMaxRenderedRowRestriction:!1,height:u.GRID_HEIGHT,stopEditingWhenCellsLoseFocus:!0,onModelUpdated:tn,noRowsOverlayComponent:Py(Lre),noRowsOverlayComponentParams:()=>V.value,defaultColDef:{editable:!1,filter:!1,sortable:!1,flex:1,minWidth:100,suppressNavigable:!1},getRowId:Ne=>Ne.data.id,getRowClass:Ne=>{if(!Ne.data)return["row-empty"];const Ke=["row-highlight"];return Ne.data.id||Ke.push("row-inactive"),Ne.data.isDeleted&&Ke.push("row-deleted"),Ne.data.disabled&&Ke.push("row-deleted"),Ne.data.isArchived&&Ke.push("row-archived"),Ne.data.isLocked&&Ke.push("row-locked"),Ke},suppressRowTransform:!1,singleClickEdit:!0,context:{workspaceId:f.workspaceId,entityId:f.entityId,apiServices:O.value,sorting:ue.value},onCellKeyDown:Ne=>{var Ke,Wt,gn;if(Ne.data.isDeleted)return!1;if(((Ke=Ne==null?void 0:Ne.event)==null?void 0:Ke.key)==="Enter"){const{api:Js,node:ks,column:nn}=Ne,Bo=Js.getCellRendererInstances({rowNodes:[ks],columns:[nn]});if(Bo.length>0){const Po=Bo[0];Po&&typeof((Wt=Po.componsenExposed)==null?void 0:Wt.focus)=="function"&&((gn=Po.componsenExposed)==null||gn.focus())}}},isRowSelectable:Ne=>!Ne.group,suppressKeyboardEvent:Ne=>{var gn;if((gn=Ne.data)!=null&&gn.isDeleted)return!0;const Ke=Ne.event.key,Wt=Ne.editing;return Wt&&Ke==="Tab"?!0:Wt&&Ke==="Enter"?!1:Ke==="Enter"?(Ne.event.preventDefault(),Ne.event.stopPropagation(),!0):Ke==="ArrowUp"||Ke==="ArrowDown"||Ke==="ArrowLeft"||Ke==="ArrowRight"||Ke==="Tab"||Ke==="Enter"},navigateToNextCell:()=>null,onBodyScroll:Ne=>{const Ke=Ne.api.getFirstDisplayedRowIndex(),Wt=Ne.api.getLastDisplayedRowIndex();Lt.rowsDisplay.fromIndex=Ke,Lt.rowsDisplay.toIndex=Wt,Lt.columnsDisplay=Ne.api.getAllDisplayedVirtualColumns().map(gn=>gn.getColId())},onViewportChanged:Ne=>{Lt.columnsDisplay=Ne.api.getAllDisplayedVirtualColumns().map(Ke=>Ke.getColId())},suppressHeaderFocus:!0,onCellEditingStarted(Ne){if(Ne.data.isDeleted&&Ne.api.stopEditing(),Ne.colDef.field=="options"){const Ke=Ne.api.getCellRendererInstances({rowNodes:[Ne.node],columns:[Ne.column]});Ke.length>0&&Ke[0].focusUi()}},tabToNextCell:Ne=>{let Ke=Ne.nextCellPosition;if(Ke&&Ke.column.getColId()==="ag-Grid-SelectionColumn"){const Wt=Ne.api.getAllDisplayedColumns(),gn=Wt.indexOf(Ke.column),Js=Ne.backwards?-1:1,ks=Wt[gn+Js];if(ks)return{rowIndex:Ke.rowIndex,column:ks,rowPinned:Ke.rowPinned}}return Ke}}));function tn(){if(!v.value)return;let Ne=0;v.value.forEachNode(Ke=>{Ke.data&&Ne++}),b.value.loaded=Math.min(Ne,b.value.total)}Qe(()=>ae,()=>{v.value&&(P.value="",I.value.clear(),v.value.deselectAll(),Object.keys(Ge).forEach(Ne=>delete Ge[Number(Ne)]),v.value.purgeInfiniteCache(),v.value.ensureIndexVisible(0))},{deep:!0});const Be=H(),We=H(),Tt=()=>{var Ne;(Ne=We.value)==null||Ne.open()},Yt=H(),Xt=()=>{oi.showPopupBulkUpdate=!0,ft(()=>{var Ne;(Ne=Yt.value)==null||Ne.open()})},ot=()=>{oi.showPopupToolboxUploader=!0,ft(()=>{var Ne;(Ne=Be.value)==null||Ne.open()})},Zn=async()=>{Me.value=!0,v.value&&(P.value="",I.value.clear(),Object.keys(Ge).forEach(Ne=>delete Ge[Number(Ne)]),await v.value.deselectAll(),await v.value.ensureIndexVisible(0,"top"),await v.value.purgeInfiniteCache(),await v.value.refreshInfiniteCache())},ni=Y(()=>fn.getInstance().getItem("ITEM_TABLE_APP_VERSION")||""),Oa=H();Y(()=>{var Ne;return(Ne=qRe(ni.value))==null?void 0:Ne.map(Ke=>`<div>• ${Ke}</div>`).join(`
257
- `)});function Ps(Ne){var Ke;Ne==="new_scene"?(Ke=Oa.value)==null||Ke.show():Ne==="import_scenes"?ot():Ne==="overwrite_scenes"?Tt():Ne==="bulk_update"&&Xt()}const Ma=Ne=>{C.value=Ne.api.getSelectedRows().map(Ke=>Ke.id)},Vl=Ne=>{const Ke=me(Ne);return Ke&&(Ke.addEventListener("modelUpdated",tn),Ke.addEventListener("bodyScroll",()=>Ke.stopEditing()),Ke.addEventListener("selectionChanged",Rt),Ke.addEventListener("columnMoved",gn=>Q(gn,!0)),Ke.addEventListener("columnResized",gn=>Q(gn,!0)),Ke.addEventListener("firstDataRendered",()=>{Me.value=!1}),!document.querySelector(".ag-body-viewport"))||Ne==null||Ne.setColumnsVisible(["ag-Grid-SelectionColumn"],!1),Ke},Fr=()=>{var Ne;d.value=(((Ne=document.getElementById("item-table-layout-id"))==null?void 0:Ne.clientHeight)??0)-78+"px"};en(()=>{ft(()=>{Fr()}),window.addEventListener("resize",Fr);function Ne(){requestAnimationFrame(Ne)}Ne()}),Jn(()=>{window.removeEventListener("resize",Fr)});const Gi=async({code:Ne,name:Ke})=>{await Se(Ne),setTimeout(()=>{var Wt;(Wt=E.value)==null||Wt.setValue(Ke)},300)},Ar=Ne=>{if(!v.value)return;const Ke=v.value.getRowNode(Ne);Ke?(v.value.ensureIndexVisible(Number(Ke.rowIndex),"middle"),v.value.flashCells({rowNodes:[Ke],flashDuration:3e3,fadeDuration:1e3})):v.value.ensureIndexVisible(b.value.total-1,"bottom")},Ui=Ne=>Ne.metric_type.code==="number"?"number":"default",ih=async()=>{if(f.entityId)try{const Ne=await Fe(f.entityId);T.value=Ne.data.map(Ke=>({...Ke,sortType:Ui(Ke)}))}catch(Ne){console.error("Failed to initialize metric list:",Ne),T.value=[]}},Vn=async()=>{if(O.value)try{const Ne=await O.value.getUserPermission(f.workspaceId);s(Ne)}catch(Ne){console.error("Failed to fetch user permissions:",Ne)}},Co=async()=>{if(O.value)try{const Ne=await O.value.getEntityDetail(f.workspaceId,f.entityId);r(Ne.permission),c.value=Ne}catch(Ne){console.error("Failed to fetch entity details:",Ne)}},Nw=yy(),{setUser:ah}=Nw,lh=async()=>{if(O.value)try{const Ne=await O.value.getMe();return ah(Ne),Ne}catch(Ne){console.error("Failed to fetch user details:",Ne)}},ch=async()=>{var Ne;if(O.value)try{const Ke=await O.value.getWorkspaces(f.workspaceId),Wt=(Ne=Ke.data[0])==null?void 0:Ne.ws_user_role_id;return Wt&&Nw.setUserRoleId(Wt),Ke}catch(Ke){console.error("Failed to fetch workspace details:",Ke)}};Qe(()=>[f.entityId,f.workspaceId],async([Ne,Ke])=>{!Ne||!Ke||(lh(),ch(),ih(),Vn(),Co())},{immediate:!0,deep:!0}),Qe(G,(Ne,Ke)=>{const Wt=Ne.filter(gn=>!(Ke!=null&&Ke.includes(gn)));Wt.length>0&&fe(Array.from(I.value),Wt).then(gn=>{q(gn,I.value,Wt)})},{immediate:!0,deep:!0}),Qe(P,(Ne,Ke)=>{L.value=!!(Ke&&Ne&&Ke!==Ne)}),t({refreshTable:Zn});const nT=Ne=>{xe.value=Ne,Zn()},Wi=Ne=>{M.value=Ne,Zn()},Bl=Ne=>{N.value=Ne||[],Q({},!0)},zi=Y(()=>{var gn;const Ne=fn.getInstance().getItem("ws.terminology"),Ke=Ne?JSON.parse(Ne):null;return`New ${((gn=Ke==null?void 0:Ke.find(Js=>Js.code==="scene"))==null?void 0:gn.name)||"Scene"}`}),oi=Go({showPopupBulkUpdate:!1,showPopupToolboxUploader:!1,showPopupSceneCreator:!1,showPopupItemDetails:!1,showPopupOverwriteScenes:!1});return(Ne,Ke)=>(K(),ze(W(mse),{"is-sidebar-open":y.value,onCloseSidebar:W(Ee),onSidebarClear:W(Ee),ref:"itemTableLayoutRef",id:"item-table-layout-id",onSidebarApply:W(Ee)},{"header-left":be(()=>{var Wt;return[((Wt=W(i))==null?void 0:Wt.has_create_item_permission)==1?(K(),ze(W(J0),{key:0,variant:["primary"],options:h.value,onSelect:Ps,onHandleClick:Ke[1]||(Ke[1]=gn=>Ps("new_scene")),id:"create_scene_dropdown",tabIndex:2},{prefix:be(()=>[qe(ye(W(pt),{"data-focus-index":"1",id:"create_new_scene",variant:["primary"],onClick:Ke[0]||(Ke[0]=gn=>Ps("new_scene")),label:zi.value},null,8,["label"]),[[W(l),1]])]),_:1},8,["options"])):Xe("",!0)]}),"header-actions":be(()=>[ye(W(Eie),{"onUpdate:assignees":Wi,onApplyFilter:nT,loading:W(Me),entityId:f.entityId},null,8,["loading","entityId"]),qe(ye(W(u0),{focusIndex:"4",modelValue:_.value,"onUpdate:modelValue":Ke[2]||(Ke[2]=Wt=>_.value=Wt),onSearch:W(Se),class:se(Ne.$style.itemSearchBox),onClear:Ke[3]||(Ke[3]=Wt=>W(Se)("")),id:"item_search_box",ref_key:"searchBoxRef",ref:E},null,8,["modelValue","onSearch","class"]),[[W(n),{isLoading:W(Me),fullwidth:!0}]]),qe((K(),ze(W(yO),{status:W(Ce)?"busy":"active",size:10,id:"refresh_table","status-tooltip":"Data has changed, please refresh the table",color:"var(--warning-color)","show-badge":L.value},{default:be(()=>[qe((K(),ze(W(pt),{variant:["secondary","icon"],disabled:W(Ce),onClick:Zn},{default:be(()=>[ye(W(ct),{src:"ArrowsRotate"})]),_:1},8,["disabled"])),[[W(l),5],[W(a),"Refresh"]])]),_:1},8,["status","show-badge"])),[[W(n),{isLoading:W(Me),fullwidth:!0}]]),qe(ye(W(Cre),{"model-value":W(N),onChange:Ke[4]||(Ke[4]=Wt=>Bl(Wt)),id:"table_customization",gridApi:v.value,ref_key:"tableCustomizationRef",ref:j,"checkbox-column":W(F),tableHeight:d.value},null,8,["model-value","gridApi","checkbox-column","tableHeight"]),[[W(n),{isLoading:W(Me),fullwidth:!0}]])]),grid:be(({availableHeight:Wt})=>[ye(W(MRe),jt({id:"item_table_main",ref_key:"agGrid",ref:oe},qt.value,{height:Wt+"px",isSorting:W(ue),onOnGridReady:Vl,onSelectionChanged:Ma,onOnScroll:Ne.handleScroll}),null,16,["height","isSorting","onOnScroll"])]),footer:be(()=>[Te("div",{class:se(Ne.$style.tableFooter),id:"table_footer"},[Te("span",null,[Ke[7]||(Ke[7]=nt(" Showing ",-1)),Te("b",null,it(W(b).loaded)+" of "+it(W(b).total),1)])],2)]),"new-row":be(()=>[ye(W(tie),{ref_key:"createNewSceneRef",ref:Oa,onSearchForCode:Gi,onFocusOnId:Ar},null,512)]),"bulk-update-actions":be(()=>[!y.value&&C.value.length>0?qe((K(),ze(W(lse),{key:0,selectRowData:Ct.value,"workspace-id":f.workspaceId,"entity-id":f.entityId,"grid-api":v.value,onUnselect:W($e),onSelectAll:W(Ye),"take-name":we.value,"selected-all":X.value,"total-rows":W(b).total,"visible-rows":W(b).loaded,onUpdated:W(Rt),loading:W(Ce),onRefreshSelectedRow:W(Rt)},null,8,["selectRowData","workspace-id","entity-id","grid-api","onUnselect","onSelectAll","take-name","selected-all","total-rows","visible-rows","onUpdated","loading","onRefreshSelectedRow"])),[[lr,!y.value&&C.value.length>0]]):Xe("",!0)]),snackbar:be(()=>[ye(W(xse))]),popup:be(()=>[oi.showPopupToolboxUploader?(K(),ze(fTe,{key:0,ref_key:"popupToolboxUploaderRef",ref:Be,"workspace-id":f.workspaceId,"entity-id":f.entityId,onImportSuccess:Zn,onHide:Ke[5]||(Ke[5]=Wt=>oi.showPopupToolboxUploader=!1)},null,8,["workspace-id","entity-id"])):Xe("",!0),oi.showPopupBulkUpdate?(K(),ze(ETe,{key:1,ref_key:"popupBulkUpdateRef",ref:Yt,"workspace-id":f.workspaceId,"entity-id":f.entityId,onImportSuccess:Zn,onHide:Ke[6]||(Ke[6]=Wt=>oi.showPopupBulkUpdate=!1)},null,8,["workspace-id","entity-id"])):Xe("",!0)]),_:1},8,["is-sidebar-open","onCloseSidebar","onSidebarClear","onSidebarApply"]))}}),[["__cssModules",{$style:{tableTitle:"_tableTitle_1sow5_1",tableFooter:"_tableFooter_1sow5_7",footerStart:"_footerStart_1sow5_17",newRow:"_newRow_1sow5_25","warning-text":"_warning-text_1sow5_43","has-error":"_has-error_1sow5_48",itemSearchBox:"_itemSearchBox_1sow5_52","beta-tag":"_beta-tag_1sow5_56"}}]]),wG="0.1.203",RTe={key:0},TTe=bt(tt({__name:"app",setup(e){const t=Y(()=>n.id.length===0||n.workspaceId.length===0),n=Go({id:"",workspaceId:"",apiConfig:{}}),o=Es(),{showMessage:s,showErrorNetMessage:r}=o,i=["basicInfor","importItems"],a=h=>{h.success?s(h.apiCode,"success"):i.includes(h.apiCode)||r(h)},l=H(null),c=()=>{const h=fn.getInstance().getItem("API_BASE_URL");return h!=null&&h.includes("v1")?h.slice(0,h.lastIndexOf("/v1")):String(h)};Oh(()=>{var h,f,p;sessionStorage.setItem("ITEM_TABLE_APP_VERSION",wG);try{if(l.value=ro(),!l.value)throw new Error("Current instance is null");n.id=((h=l.value)==null?void 0:h.appContext.config.globalProperties.id)||"",n.workspaceId=((f=l.value)==null?void 0:f.appContext.config.globalProperties.workspaceId)||fn.getInstance().getItem("ws.code");const g={domainApi:c(),wsCode:fn.getInstance().getItem("ws.code"),entityId:n.id};if(n.apiConfig=(p=l.value)==null?void 0:p.appContext.config.globalProperties.apiConfig,!g.entityId||!g.wsCode||!g.domainApi)throw new Error("API configuration is missing in dashboardConfig");const v=new JM(n.apiConfig,g);v.on("call-api",a),l.value.appContext.config.globalProperties.apiServices=v}catch(g){console.error("Error getting current instance:",g)}}),Jn(()=>{l.value.appContext.config.globalProperties.apiServices.off("call-api",a)});const u=Y(()=>n.id),d=Y(()=>n.workspaceId);return ui("workspaceId",d),ui("entityId",u),(h,f)=>(K(),ce("div",{class:se(h.$style.dashboardPluginWrapper)},[t.value?(K(),ce("span",RTe," There is no workspaceId or entityIds provided in global properties. Please set them to see the Item Table. ")):u.value?(K(),ze(W(_Te),{key:1,entityId:u.value,workspaceId:d.value},null,8,["entityId","workspaceId"])):Xe("",!0)],2))}}),[["__cssModules",{$style:{dashboardPluginWrapper:"_dashboardPluginWrapper_1f1og_1"}}]]),tT=async(e={},t={})=>{const n=nI(TTe),o=iJ();n.use(o);const s=["apiConfig","workspaceId","id"],r={};Object.entries(e).forEach(([a,l])=>{l!==void 0&&(n.config.globalProperties[a]=l,r[a]=l,s.includes(a)&&typeof l=="string"?sessionStorage.setItem(a,l):console.error(`[Config Error] Key "${a}" has an invalid value and will not be persisted.`))}),n.config.globalProperties.$arboConfig=r,Object.values(t).forEach(a=>{a&&typeof a.install=="function"&&n.use(a)}),n.config.errorHandler=(a,l,c)=>{console.error("[Vue Error]",a),c&&console.error("[Info]",c)},console.log(`%cArbo Dashboard Plugin v${wG}`,"color: #4CAF50; font-weight: bold;"),console.log(n.config.globalProperties),globalThis.window.$switchInstance=n.config.globalProperties.switchInstance,n.provide("switchInstance",n.config.globalProperties.switchInstance),n.directive("tooltip",Kt),n.directive("focusable",Uo);const i=await fce();return n.use(i),n};globalThis.window!==void 0&&(globalThis.window.arboDashboard=tT),Bn.default=tT,Bn.initDashboard=tT,Object.defineProperties(Bn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
257
+ `)});function Ps(Ne){var Ke;Ne==="new_scene"?(Ke=Oa.value)==null||Ke.show():Ne==="import_scenes"?ot():Ne==="overwrite_scenes"?Tt():Ne==="bulk_update"&&Xt()}const Ma=Ne=>{C.value=Ne.api.getSelectedRows().map(Ke=>Ke.id)},Vl=Ne=>{const Ke=me(Ne);return Ke&&(Ke.addEventListener("modelUpdated",tn),Ke.addEventListener("bodyScroll",()=>Ke.stopEditing()),Ke.addEventListener("selectionChanged",Rt),Ke.addEventListener("columnMoved",gn=>Q(gn,!0)),Ke.addEventListener("columnResized",gn=>Q(gn,!0)),Ke.addEventListener("firstDataRendered",()=>{Me.value=!1}),!document.querySelector(".ag-body-viewport"))||Ne==null||Ne.setColumnsVisible(["ag-Grid-SelectionColumn"],!1),Ke},Fr=()=>{var Ne;d.value=(((Ne=document.getElementById("item-table-layout-id"))==null?void 0:Ne.clientHeight)??0)-78+"px"};en(()=>{ft(()=>{Fr()}),window.addEventListener("resize",Fr);function Ne(){requestAnimationFrame(Ne)}Ne()}),Jn(()=>{window.removeEventListener("resize",Fr)});const Gi=async({code:Ne,name:Ke})=>{await Se(Ne),setTimeout(()=>{var Wt;(Wt=E.value)==null||Wt.setValue(Ke)},300)},Ar=Ne=>{if(!v.value)return;const Ke=v.value.getRowNode(Ne);Ke?(v.value.ensureIndexVisible(Number(Ke.rowIndex),"middle"),v.value.flashCells({rowNodes:[Ke],flashDuration:3e3,fadeDuration:1e3})):v.value.ensureIndexVisible(b.value.total-1,"bottom")},Ui=Ne=>Ne.metric_type.code==="number"?"number":"default",ih=async()=>{if(f.entityId)try{const Ne=await Fe(f.entityId);T.value=Ne.data.map(Ke=>({...Ke,sortType:Ui(Ke)}))}catch(Ne){console.error("Failed to initialize metric list:",Ne),T.value=[]}},Vn=async()=>{if(O.value)try{const Ne=await O.value.getUserPermission(f.workspaceId);s(Ne)}catch(Ne){console.error("Failed to fetch user permissions:",Ne)}},Co=async()=>{if(O.value)try{const Ne=await O.value.getEntityDetail(f.workspaceId,f.entityId);r(Ne.permission),c.value=Ne}catch(Ne){console.error("Failed to fetch entity details:",Ne)}},Nw=yy(),{setUser:ah}=Nw,lh=async()=>{if(O.value)try{const Ne=await O.value.getMe();return ah(Ne),Ne}catch(Ne){console.error("Failed to fetch user details:",Ne)}},ch=async()=>{var Ne;if(O.value)try{const Ke=await O.value.getWorkspaces(f.workspaceId),Wt=(Ne=Ke.data[0])==null?void 0:Ne.ws_user_role_id;return Wt&&Nw.setUserRoleId(Wt),Ke}catch(Ke){console.error("Failed to fetch workspace details:",Ke)}};Qe(()=>[f.entityId,f.workspaceId],async([Ne,Ke])=>{!Ne||!Ke||(lh(),ch(),ih(),Vn(),Co())},{immediate:!0,deep:!0}),Qe(G,(Ne,Ke)=>{const Wt=Ne.filter(gn=>!(Ke!=null&&Ke.includes(gn)));Wt.length>0&&fe(Array.from(I.value),Wt).then(gn=>{q(gn,I.value,Wt)})},{immediate:!0,deep:!0}),Qe(P,(Ne,Ke)=>{L.value=!!(Ke&&Ne&&Ke!==Ne)}),t({refreshTable:Zn});const nT=Ne=>{xe.value=Ne,Zn()},Wi=Ne=>{M.value=Ne,Zn()},Bl=Ne=>{N.value=Ne||[],Q({},!0)},zi=Y(()=>{var gn;const Ne=fn.getInstance().getItem("ws.terminology"),Ke=Ne?JSON.parse(Ne):null;return`New ${((gn=Ke==null?void 0:Ke.find(Js=>Js.code==="scene"))==null?void 0:gn.name)||"Scene"}`}),oi=Go({showPopupBulkUpdate:!1,showPopupToolboxUploader:!1,showPopupSceneCreator:!1,showPopupItemDetails:!1,showPopupOverwriteScenes:!1});return(Ne,Ke)=>(K(),ze(W(mse),{"is-sidebar-open":y.value,onCloseSidebar:W(Ee),onSidebarClear:W(Ee),ref:"itemTableLayoutRef",id:"item-table-layout-id",onSidebarApply:W(Ee)},{"header-left":be(()=>{var Wt;return[((Wt=W(i))==null?void 0:Wt.has_create_item_permission)==1?(K(),ze(W(J0),{key:0,variant:["primary"],options:h.value,onSelect:Ps,onHandleClick:Ke[1]||(Ke[1]=gn=>Ps("new_scene")),id:"create_scene_dropdown",tabIndex:2},{prefix:be(()=>[qe(ye(W(pt),{"data-focus-index":"1",id:"create_new_scene",variant:["primary"],onClick:Ke[0]||(Ke[0]=gn=>Ps("new_scene")),label:zi.value},null,8,["label"]),[[W(l),1]])]),_:1},8,["options"])):Xe("",!0)]}),"header-actions":be(()=>[ye(W(Eie),{"onUpdate:assignees":Wi,onApplyFilter:nT,loading:W(Me),entityId:f.entityId},null,8,["loading","entityId"]),qe(ye(W(u0),{focusIndex:"4",modelValue:_.value,"onUpdate:modelValue":Ke[2]||(Ke[2]=Wt=>_.value=Wt),onSearch:W(Se),class:se(Ne.$style.itemSearchBox),onClear:Ke[3]||(Ke[3]=Wt=>W(Se)("")),id:"item_search_box",ref_key:"searchBoxRef",ref:E},null,8,["modelValue","onSearch","class"]),[[W(n),{isLoading:W(Me),fullwidth:!0}]]),qe((K(),ze(W(yO),{status:W(Ce)?"busy":"active",size:10,id:"refresh_table","status-tooltip":"Data has changed, please refresh the table",color:"var(--warning-color)","show-badge":L.value},{default:be(()=>[qe((K(),ze(W(pt),{variant:["secondary","icon"],disabled:W(Ce),onClick:Zn},{default:be(()=>[ye(W(ct),{src:"ArrowsRotate"})]),_:1},8,["disabled"])),[[W(l),5],[W(a),"Refresh"]])]),_:1},8,["status","show-badge"])),[[W(n),{isLoading:W(Me),fullwidth:!0}]]),qe(ye(W(Cre),{"model-value":W(N),onChange:Ke[4]||(Ke[4]=Wt=>Bl(Wt)),id:"table_customization",gridApi:v.value,ref_key:"tableCustomizationRef",ref:j,"checkbox-column":W(F),tableHeight:d.value},null,8,["model-value","gridApi","checkbox-column","tableHeight"]),[[W(n),{isLoading:W(Me),fullwidth:!0}]])]),grid:be(({availableHeight:Wt})=>[ye(W(MRe),jt({id:"item_table_main",ref_key:"agGrid",ref:oe},qt.value,{height:Wt+"px",isSorting:W(ue),onOnGridReady:Vl,onSelectionChanged:Ma,onOnScroll:Ne.handleScroll}),null,16,["height","isSorting","onOnScroll"])]),footer:be(()=>[Te("div",{class:se(Ne.$style.tableFooter),id:"table_footer"},[Te("span",null,[Ke[7]||(Ke[7]=nt(" Showing ",-1)),Te("b",null,it(W(b).loaded)+" of "+it(W(b).total),1)])],2)]),"new-row":be(()=>[ye(W(tie),{ref_key:"createNewSceneRef",ref:Oa,onSearchForCode:Gi,onFocusOnId:Ar},null,512)]),"bulk-update-actions":be(()=>[!y.value&&C.value.length>0?qe((K(),ze(W(lse),{key:0,selectRowData:Ct.value,"workspace-id":f.workspaceId,"entity-id":f.entityId,"grid-api":v.value,onUnselect:W($e),onSelectAll:W(Ye),"take-name":we.value,"selected-all":X.value,"total-rows":W(b).total,"visible-rows":W(b).loaded,onUpdated:W(Rt),loading:W(Ce),onRefreshSelectedRow:W(Rt)},null,8,["selectRowData","workspace-id","entity-id","grid-api","onUnselect","onSelectAll","take-name","selected-all","total-rows","visible-rows","onUpdated","loading","onRefreshSelectedRow"])),[[lr,!y.value&&C.value.length>0]]):Xe("",!0)]),snackbar:be(()=>[ye(W(xse))]),popup:be(()=>[oi.showPopupToolboxUploader?(K(),ze(fTe,{key:0,ref_key:"popupToolboxUploaderRef",ref:Be,"workspace-id":f.workspaceId,"entity-id":f.entityId,onImportSuccess:Zn,onHide:Ke[5]||(Ke[5]=Wt=>oi.showPopupToolboxUploader=!1)},null,8,["workspace-id","entity-id"])):Xe("",!0),oi.showPopupBulkUpdate?(K(),ze(ETe,{key:1,ref_key:"popupBulkUpdateRef",ref:Yt,"workspace-id":f.workspaceId,"entity-id":f.entityId,onImportSuccess:Zn,onHide:Ke[6]||(Ke[6]=Wt=>oi.showPopupBulkUpdate=!1)},null,8,["workspace-id","entity-id"])):Xe("",!0)]),_:1},8,["is-sidebar-open","onCloseSidebar","onSidebarClear","onSidebarApply"]))}}),[["__cssModules",{$style:{tableTitle:"_tableTitle_1sow5_1",tableFooter:"_tableFooter_1sow5_7",footerStart:"_footerStart_1sow5_17",newRow:"_newRow_1sow5_25","warning-text":"_warning-text_1sow5_43","has-error":"_has-error_1sow5_48",itemSearchBox:"_itemSearchBox_1sow5_52","beta-tag":"_beta-tag_1sow5_56"}}]]),wG="0.1.204",RTe={key:0},TTe=bt(tt({__name:"app",setup(e){const t=Y(()=>n.id.length===0||n.workspaceId.length===0),n=Go({id:"",workspaceId:"",apiConfig:{}}),o=Es(),{showMessage:s,showErrorNetMessage:r}=o,i=["basicInfor","importItems"],a=h=>{h.success?s(h.apiCode,"success"):i.includes(h.apiCode)||r(h)},l=H(null),c=()=>{const h=fn.getInstance().getItem("API_BASE_URL");return h!=null&&h.includes("v1")?h.slice(0,h.lastIndexOf("/v1")):String(h)};Oh(()=>{var h,f,p;sessionStorage.setItem("ITEM_TABLE_APP_VERSION",wG);try{if(l.value=ro(),!l.value)throw new Error("Current instance is null");n.id=((h=l.value)==null?void 0:h.appContext.config.globalProperties.id)||"",n.workspaceId=((f=l.value)==null?void 0:f.appContext.config.globalProperties.workspaceId)||fn.getInstance().getItem("ws.code");const g={domainApi:c(),wsCode:fn.getInstance().getItem("ws.code"),entityId:n.id};if(n.apiConfig=(p=l.value)==null?void 0:p.appContext.config.globalProperties.apiConfig,!g.entityId||!g.wsCode||!g.domainApi)throw new Error("API configuration is missing in dashboardConfig");const v=new JM(n.apiConfig,g);v.on("call-api",a),l.value.appContext.config.globalProperties.apiServices=v}catch(g){console.error("Error getting current instance:",g)}}),Jn(()=>{l.value.appContext.config.globalProperties.apiServices.off("call-api",a)});const u=Y(()=>n.id),d=Y(()=>n.workspaceId);return ui("workspaceId",d),ui("entityId",u),(h,f)=>(K(),ce("div",{class:se(h.$style.dashboardPluginWrapper)},[t.value?(K(),ce("span",RTe," There is no workspaceId or entityIds provided in global properties. Please set them to see the Item Table. ")):u.value?(K(),ze(W(_Te),{key:1,entityId:u.value,workspaceId:d.value},null,8,["entityId","workspaceId"])):Xe("",!0)],2))}}),[["__cssModules",{$style:{dashboardPluginWrapper:"_dashboardPluginWrapper_1f1og_1"}}]]),tT=async(e={},t={})=>{const n=nI(TTe),o=iJ();n.use(o);const s=["apiConfig","workspaceId","id"],r={};Object.entries(e).forEach(([a,l])=>{l!==void 0&&(n.config.globalProperties[a]=l,r[a]=l,s.includes(a)&&typeof l=="string"?sessionStorage.setItem(a,l):console.error(`[Config Error] Key "${a}" has an invalid value and will not be persisted.`))}),n.config.globalProperties.$arboConfig=r,Object.values(t).forEach(a=>{a&&typeof a.install=="function"&&n.use(a)}),n.config.errorHandler=(a,l,c)=>{console.error("[Vue Error]",a),c&&console.error("[Info]",c)},console.log(`%cArbo Dashboard Plugin v${wG}`,"color: #4CAF50; font-weight: bold;"),console.log(n.config.globalProperties),globalThis.window.$switchInstance=n.config.globalProperties.switchInstance,n.provide("switchInstance",n.config.globalProperties.switchInstance),n.directive("tooltip",Kt),n.directive("focusable",Uo);const i=await fce();return n.use(i),n};globalThis.window!==void 0&&(globalThis.window.arboDashboard=tT),Bn.default=tT,Bn.initDashboard=tT,Object.defineProperties(Bn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});