stadata-js 0.1.0 → 0.1.1
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.
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var neverthrow=require('neverthrow');var Re=class o{constructor(){this.container=new Map;this.factories=new Map;}static getInstance(){return o.instance||(o.instance=new o),o.instance}register(e,t){this.container.set(e,t);}registerFactory(e,t){this.factories.set(e,t);}resolve(e){if(this.container.has(e))return this.container.get(e);if(this.factories.has(e)){let t=this.factories.get(e);if(t){let r=t();return this.container.set(e,r),r}}throw new Error(`Dependency not found: ${e}`)}has(e){return this.container.has(e)||this.factories.has(e)}clear(){this.container.clear(),this.factories.clear();}remove(e){this.container.delete(e),this.factories.delete(e);}};var k=class o{constructor(e,t){this.message=e;this.code=t;}toString(){return `${this.constructor.name}: ${this.message}${this.code?` (${this.code})`:""}`}equals(e){return e instanceof o?this.message===e.message&&this.code===e.code&&this.constructor.name===e.constructor.name:false}},v=class extends k{constructor(t,r,i){super(t,i);this.statusCode=r;}},fe=class extends k{constructor(e="Request was cancelled"){super(e,"CANCELLED");}},Se=class extends k{constructor(e){super(e,"NETWORK_ERROR");}},we=class extends k{constructor(e="Request timeout"){super(e,"TIMEOUT");}},he=class extends v{constructor(e="Resource not found"){super(e,404,"NOT_FOUND");}},Pe=class extends v{constructor(e="Unauthorized"){super(e,401,"UNAUTHORIZED");}},be=class extends v{constructor(e="Forbidden"){super(e,403,"FORBIDDEN");}},Ae=class extends v{constructor(e="Server error",t=500){super(e,t,"SERVER_ERROR");}},a=class extends k{constructor(e){super(e,"PARSE_ERROR");}},Qt=class extends k{constructor(e){super(e,"VALIDATION_ERROR");}};var Ee=class{constructor(e={}){this.baseURL=e.baseURL||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.interceptors=e.interceptors||[];}addInterceptor(e){this.interceptors.push(e);}removeInterceptor(e){let t=this.interceptors.indexOf(e);t!==-1&&this.interceptors.splice(t,1);}async get(e,t){return this.request("GET",e,t)}async post(e,t){return this.request("POST",e,t)}async put(e,t){return this.request("PUT",e,t)}async delete(e,t){return this.request("DELETE",e,t)}async patch(e,t){return this.request("PATCH",e,t)}async request(e,t,r={}){try{let i=this.buildUrl(t),s={method:e,headers:{...this.defaultHeaders,...r.headers}};e!=="GET"&&r.body&&(s.body=JSON.stringify(r.body)),r.cancelToken&&(s.signal=r.cancelToken.signal);for(let Y of this.interceptors)Y.onRequest&&(s=await Y.onRequest(i,s));let m=await this.fetchWithTimeout(i,s,r.timeout||this.timeout);for(let Y of this.interceptors)Y.onResponse&&(m=await Y.onResponse(m));if(!m.ok)return neverthrow.err(await this.handleErrorResponse(m));let V=await m.json();return neverthrow.ok(V)}catch(i){return neverthrow.err(await this.handleError(i,r.cancelToken))}}async fetchWithTimeout(e,t,r){let i=new AbortController,s=setTimeout(()=>i.abort(),r);try{let u=t.signal&&t.signal instanceof AbortSignal?this.combineSignals(t.signal,i.signal):i.signal;return await fetch(e,{...t,signal:u})}finally{clearTimeout(s);}}combineSignals(e,t){let r=new AbortController,i=()=>r.abort();return e.addEventListener("abort",i),t.addEventListener("abort",i),r.signal}buildUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.baseURL}${e}`}async handleErrorResponse(e){let{status:t}=e,r;try{let i=await e.json();r=i.message||i.error||e.statusText;}catch{r=e.statusText;}switch(t){case 401:return new Pe(r);case 403:return new be(r);case 404:return new he(r);case 500:case 502:case 503:case 504:return new Ae(r,t);default:return new v(r,t)}}async handleError(e,t){let r=e instanceof Error?e:new Error(String(e));for(let i of this.interceptors)if(i.onError){let s=await i.onError(r);s&&(r=s);}return t?.isCancelled||e.name==="AbortError"?new fe(t?.reason):r.name==="AbortError"||r.message.includes("timeout")||r.message.includes("aborted")?new we:r.message.includes("network")||r.message.includes("fetch")||r.message.includes("ECONNREFUSED")?new Se(r.message):new v(r.message)}};var F=class{};var Ce=class extends F{constructor(t){super();this.apiKey=t;}onRequest(t,r){return new URL(t).searchParams.set("key",this.apiKey),{...r}}setApiKey(t){this.apiKey=t;}getApiKey(){return this.apiKey}};var dt=(u=>(u[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.FATAL=4]="FATAL",u[u.NONE=5]="NONE",u))(dt||{}),pt=class{print(e){let t=dt[e.level],i=`[${e.timestamp.toISOString()}] [${t}] ${e.message}`;switch(e.level){case 0:console.debug(i,e.data);break;case 1:console.info(i,e.data);break;case 2:console.warn(i,e.data);break;case 3:case 4:console.error(i,e.error||e.data);break}}},B=class{constructor(e=1){this.minLevel=e;}shouldLog(e){return e.level>=this.minLevel}},U=class o{constructor(e=new pt,t=new B){this.enabled=true;this.printer=e,this.filter=t;}static getInstance(){return o.instance||(o.instance=new o),o.instance}configure(e){e.printer&&(this.printer=e.printer),e.filter&&(this.filter=e.filter),e.enabled!==void 0&&(this.enabled=e.enabled);}debug(e,t){this.log(0,e,t);}info(e,t){this.log(1,e,t);}warn(e,t){this.log(2,e,t);}error(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(3,e,i,r);}fatal(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(4,e,i,r);}log(e,t,r,i){if(!this.enabled)return;let s={level:e,message:t,timestamp:new Date,data:r,error:i};this.filter.shouldLog(s)&&this.printer.print(s);}enable(){this.enabled=true;}disable(){this.enabled=false;}};var Zt=class extends F{constructor(e){super(),this.logger=e||U.getInstance();}onRequest(e,t){return this.logger.debug(`HTTP Request: ${t.method||"GET"} ${e}`,{headers:t.headers,body:t.body}),t}onResponse(e){return this.logger.debug(`HTTP Response: ${e.status} ${e.url}`,{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}),e}onError(e){return this.logger.error(`HTTP Error: ${e.message}`,e),e}};var Xt=class extends F{constructor(t={},r){super();this.retryCount=new Map;this.logger=r||U.getInstance(),this.config={maxRetries:t.maxRetries??3,retryDelay:t.retryDelay??1e3,retryableStatusCodes:t.retryableStatusCodes??[408,429,500,502,503,504],exponentialBackoff:t.exponentialBackoff??true};}async onResponse(t){let r=t.url,i=this.retryCount.get(r)||0;if(!t.ok&&this.config.retryableStatusCodes.includes(t.status)&&i<this.config.maxRetries){this.retryCount.set(r,i+1);let s=this.config.exponentialBackoff?this.config.retryDelay*Math.pow(2,i):this.config.retryDelay;throw this.logger.warn(`Retrying request (${i+1}/${this.config.maxRetries}) after ${s}ms: ${t.url}`),await this.sleep(s),new Error(`RETRY_NEEDED:${r}`)}return (t.ok||i>=this.config.maxRetries)&&this.retryCount.delete(r),t}sleep(t){return new Promise(r=>setTimeout(r,t))}resetRetryCount(t){this.retryCount.delete(t);}clearAllRetryCounts(){this.retryCount.clear();}};var gt={BASE_URL:"https://webapi.bps.go.id/v1/api",DEFAULT_TIMEOUT:3e4,API_VERSION:"v1",DEFAULT_PAGE_SIZE:10,MAX_PAGE_SIZE:100};var n={DOMAIN_LIST:"/list/domain",DOMAIN_VIEW:"/view/domain",PUBLICATION_LIST:"/list/publication",PUBLICATION_VIEW:"/view/publication",INFOGRAPHIC_LIST:"/list/infographic",INFOGRAPHIC_VIEW:"/view/infographic",STATIC_TABLE_LIST:"/list/statictable",STATIC_TABLE_VIEW:"/view/statictable",NEWS_LIST:"/list/news",NEWS_VIEW:"/view/news",NEWS_CATEGORY_LIST:"/list/newscategory",NEWS_CATEGORY_VIEW:"/view/newscategory",PRESS_RELEASE_LIST:"/list/pressrelease",PRESS_RELEASE_VIEW:"/view/pressrelease",SUBJECT_LIST:"/list/subject",SUBJECT_VIEW:"/view/subject",SUBJECT_CATEGORY_LIST:"/list/subjectcat",SUBJECT_CATEGORY_VIEW:"/view/subjectcat",STRATEGIC_INDICATOR_LIST:"/list/stratind",STRATEGIC_INDICATOR_VIEW:"/view/stratind",VARIABLE_LIST:"/list/var",VARIABLE_VIEW:"/view/var",VERTICAL_VARIABLE_LIST:"/list/vervar",VERTICAL_VARIABLE_VIEW:"/view/vervar",UNIT_LIST:"/list/unit",UNIT_VIEW:"/view/unit",PERIOD_LIST:"/list/period",PERIOD_VIEW:"/view/period",DERIVED_PERIOD_LIST:"/list/turth",DERIVED_PERIOD_VIEW:"/view/turth",DERIVED_VARIABLE_LIST:"/list/turvar",DERIVED_VARIABLE_VIEW:"/view/turvar",DYNAMIC_TABLE_LIST:"/list/dynamictable",STATISTIC_CLASSIFICATION_LIST:"/list/kbli",STATISTIC_CLASSIFICATION_VIEW:"/view/kbli",CENSUS_LIST:"/list/sensus",CENSUS_VIEW:"/view/sensus",TRADE:"/dataexim"};var hr={KEY:"key",DOMAIN:"domain",LANG:"lang",PAGE:"page",PER_PAGE:"per_page",KEYWORD:"keyword",MONTH:"month",YEAR:"year",SUBJECT:"subj",VARIABLE:"var",TURVAR:"turvar",TURTH:"turth",PERIOD:"th",TYPE:"type",TABLE:"table",MODEL:"model",ID:"id",SHOW_DELETED:"show_deleted"};var ne=class o{constructor(){this._apiKey=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}setApiKey(e){this._apiKey=e;}getApiKey(){if(!this._apiKey)throw new Error("API key not set. Call setApiKey() first.");return this._apiKey}hasApiKey(){return this._apiKey!==null}clearApiKey(){this._apiKey=null;}};var l=class o{toString(){return JSON.stringify(this.toJson(),null,2)}equals(e){return e instanceof o?JSON.stringify(this.toJson())===JSON.stringify(e.toJson()):false}copyWith(e){let r={...this.toJson(),...e};return Object.assign(Object.create(Object.getPrototypeOf(this)),r)}};var N=class{},er=class extends N{call(){return this.execute()}};var le=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.url=i;}toJson(){return {domain_id:this.id,domain_name:this.name,domain_url:this.url}}static fromJson(t){return new o(t.domain_id||t.id||"",t.domain_name||t.name||"",t.domain_url||t.url||"")}};var Ie=class extends N{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getAll(t)}};var Te=class extends N{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getById(t)}};var yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.perPage&&(t.per_page=e.perPage.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang),e.id&&(t.id=e.id.toString());let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_VIEW}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var x=class o extends l{constructor(t,r,i,s,u){super();this.page=t;this.perPage=r;this.total=i;this.pages=s;this.count=u;}get hasNextPage(){return this.page<this.pages}get hasPreviousPage(){return this.page>1}get nextPage(){return this.hasNextPage?this.page+1:null}get previousPage(){return this.hasPreviousPage?this.page-1:null}toJson(){return {page:this.page,per_page:this.perPage,total:this.total,pages:this.pages,count:this.count}}static fromJson(t){return new o(t.page||1,t.per_page||10,t.total||0,t.pages||0,t.count||0)}};var tr=class o extends l{constructor(t,r,i){super();this.data=t;this.dataAvailability=r;this.pagination=i;}get isAvailable(){return this.dataAvailability==="available"}get totalItems(){return this.pagination?.total||this.data.length}get hasData(){return this.data.length>0}toJson(){return {data:this.data,data_availability:this.dataAvailability,pagination:this.pagination?.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(V=>r(V)),u=t.pagination,m=u?x.fromJson(u):void 0;return new o(s,t["data-availability"]||"available",m)}};var c=class o extends l{constructor(t,r){super();this.data=t;this.pagination=r;}get hasMore(){return this.pagination.hasNextPage}get totalItems(){return this.pagination.total}get items(){return this.data}get itemCount(){return this.data.length}toJson(){return {data:this.data,pagination:this.pagination.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(V=>r(V)),u=t.pagination,m=x.fromJson(u);return new o(s,m)}};var Rt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(u=>le.fromJson(u)),s=r.pagination?x.fromJson(r.pagination):new x(1,i.length,i.length,1,i.length);return new c(i,s)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Domain not found");let i=r.data[0];if(!i)throw new a("Domain data is empty");return le.fromJson(i)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var R=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Rt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ie(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Te(r)});}static getAllDomainsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDomainByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};R.REMOTE_DATA_SOURCE="DomainRemoteDataSource",R.REPOSITORY="DomainRepository",R.GET_ALL_USE_CASE="GetAllDomains",R.GET_BY_ID_USE_CASE="GetDomainById";var _e=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.releaseDate=i;this.url=s;this.cover=u;}toJson(){return {id:this.id,title:this.title,rl_date:this.releaseDate.toISOString().split("T")[0],url:this.url,cover:this.cover}}static fromJson(t){return new o(String(t.id||""),String(t.title||""),new Date(String(t.rl_date||t.release_date||t.releaseDate||"")),String(t.url||""),String(t.cover||""))}};var q=class o extends l{constructor(t,r,i,s,u,m,V,Y,yr,Rr,fr,Sr,Er){super();this.id=t;this.title=r;this.issn=i;this.cover=s;this.pdf=u;this.size=m;this.scheduledDate=V;this.releaseDate=Y;this.updateDate=yr;this.abstract=Rr;this.catalogueNumber=fr;this.publicationNumber=Sr;this.relatedPublications=Er;}toJson(){return {id:this.id,title:this.title,issn:this.issn,cover:this.cover,pdf:this.pdf,size:this.size,scheduled_date:this.scheduledDate?.toISOString().split("T")[0]||null,rl_date:this.releaseDate?.toISOString().split("T")[0]||null,updt_date:this.updateDate?.toISOString().split("T")[0]||null,abstract:this.abstract,catalogue_number:this.catalogueNumber,publication_number:this.publicationNumber,related_publications:this.relatedPublications.map(t=>t.toJson())}}static fromJson(t){let r=t.related_publications||t.relatedPublications,i=Array.isArray(r)?r.map(s=>_e.fromJson(s)):[];return new o(String(t.id||""),String(t.title||""),String(t.issn||""),String(t.cover||""),String(t.pdf||""),String(t.size||""),t.scheduled_date||t.scheduledDate?new Date(String(t.scheduled_date||t.scheduledDate)):null,t.rl_date||t.release_date||t.releaseDate?new Date(String(t.rl_date||t.release_date||t.releaseDate)):null,t.updt_date||t.update_date||t.updateDate?new Date(String(t.updt_date||t.update_date||t.updateDate)):null,t.abstract?String(t.abstract):null,t.catalogue_number||t.catalogueNumber?String(t.catalogue_number||t.catalogueNumber):null,t.publication_number||t.publicationNumber?String(t.publication_number||t.publicationNumber):null,i)}};var De=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Le=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var ft=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var St=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>q.fromJson(s))}catch(i){throw new a(`Failed to parse publications: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Publication not found");let i=r.data[0];if(!i)throw new a("Publication data is empty");return q.fromJson(i)}catch(i){throw new a(`Failed to parse publication data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var f=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new St(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new De(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Le(r)});}static getAllPublicationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPublicationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};f.REMOTE_DATA_SOURCE="PublicationRemoteDataSource",f.REPOSITORY="PublicationRepository",f.GET_ALL_USE_CASE="GetAllPublications",f.GET_BY_ID_USE_CASE="GetPublicationById";var M=class o extends l{constructor(t,r,i,s,u,m){super();this.id=t;this.title=r;this.image=i;this.category=s;this.downloadUrl=u;this.description=m;}toJson(){return {inf_id:this.id,title:this.title,img:this.image,category:this.category,dl:this.downloadUrl,desc:this.description}}static fromJson(t){return new o(String(t.inf_id||t.id||""),String(t.title||""),String(t.img||t.image||""),Number(t.category||0),String(t.dl||t.downloadUrl||""),t.desc||t.description?String(t.desc||t.description):null)}};var ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var wt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ht=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>M.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>M.fromJson(s))}catch(i){throw new a(`Failed to parse infographics: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Infographic not found");let i=r.data[0];if(!i)throw new a("Infographic data is empty");return M.fromJson(i)}catch(i){throw new a(`Failed to parse infographic data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var S=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new wt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ht(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new xe(r)});}static getAllInfographicsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getInfographicByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};S.REMOTE_DATA_SOURCE="InfographicRemoteDataSource",S.REPOSITORY="InfographicRepository",S.GET_ALL_USE_CASE="GetAllInfographics",S.GET_BY_ID_USE_CASE="GetInfographicById";var W=class o extends Error{constructor(e){super(e),this.name="StadataException",Object.setPrototypeOf(this,o.prototype);}},K=class o extends W{constructor(t,r,i){super(t);this.statusCode=r;this.response=i;this.name="ApiException",Object.setPrototypeOf(this,o.prototype);}},ke=class o extends W{constructor(e="Request was cancelled"){super(e),this.name="CancelledException",Object.setPrototypeOf(this,o.prototype);}},rr=class o extends W{constructor(e){super(e),this.name="NetworkException",Object.setPrototypeOf(this,o.prototype);}},ir=class o extends W{constructor(e="Request timeout"){super(e),this.name="TimeoutException",Object.setPrototypeOf(this,o.prototype);}},or=class o extends K{constructor(e="Resource not found"){super(e,404),this.name="NotFoundException",Object.setPrototypeOf(this,o.prototype);}},sr=class o extends K{constructor(e="Unauthorized"){super(e,401),this.name="UnauthorizedException",Object.setPrototypeOf(this,o.prototype);}},ar=class o extends K{constructor(e="Forbidden"){super(e,403),this.name="ForbiddenException",Object.setPrototypeOf(this,o.prototype);}},nr=class o extends K{constructor(e="Server error",t=500){super(e,t),this.name="ServerException",Object.setPrototypeOf(this,o.prototype);}};var lr=class o{constructor(){this._isCancelled=false;this.abortController=new AbortController;}get signal(){return this.abortController.signal}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isCancelled||(this._isCancelled=true,this._reason=e,this.abortController.abort());}throwIfCancelled(){if(this._isCancelled)throw new ke(this._reason||"Request was cancelled")}static create(){return new o}static source(){let e=new o;return {token:e,cancel:t=>e.cancel(t)}}};var cr=class{static parse(e){if(!e)return null;try{let t=new Date(e);return isNaN(t.getTime())?null:t}catch{return null}}static format(e){if(!e||!(e instanceof Date))return null;try{return e.toISOString()}catch{return null}}static formatReadable(e){if(!e||!(e instanceof Date))return null;try{return e.toLocaleDateString("id-ID",{year:"numeric",month:"long",day:"numeric"})}catch{return null}}static isValid(e){return this.parse(e)!==null}static toTimestamp(e){let t=this.parse(e);return t?t.getTime():null}static fromTimestamp(e){return new Date(e)}static now(){return new Date().toISOString()}static nowTimestamp(){return Date.now()}};var G=class o extends l{constructor(t,r,i,s,u,m){super();this.id=t;this.title=r;this.content=i;this.releaseDate=s;this.categoryId=u;this.picture=m;}toJson(){return {news_id:this.id,title:this.title,news_content:this.content,rl_date:this.releaseDate,category_id:this.categoryId,picture:this.picture}}static fromJson(t){return new o(String(t.news_id||t.id||""),String(t.title||""),String(t.news_content||t.content||""),String(t.rl_date||t.releaseDate||""),Number(t.category_id||t.categoryId||0),t.picture?String(t.picture):null)}};var ce=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ue=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ue=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString()),e.newsCategoryId&&(t.news_category_id=e.newsCategoryId);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Oe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>G.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>G.fromJson(s))}catch(i){throw new a(`Failed to parse news: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News not found");let i=r.data[0];if(!i)throw new a("News data is empty");return G.fromJson(i)}catch(i){throw new a(`Failed to parse news data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var d=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ue(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Oe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ce(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ue(r)});}static getAllNewsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};d.REMOTE_DATA_SOURCE="NewsRemoteDataSource",d.REPOSITORY="NewsRepository",d.GET_ALL_USE_CASE="GetAllNews",d.GET_BY_ID_USE_CASE="GetNewsById";var j=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {category_id:this.id,category_name:this.name}}static fromJson(t){return new o(String(t.category_id||t.id||""),String(t.category_name||t.name||""))}};var Ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Fe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Pt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>j.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>j.fromJson(s))}catch(i){throw new a(`Failed to parse news category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News category not found");let i=r.data[0];if(!i)throw new a("News category data is empty");return j.fromJson(i)}catch(i){throw new a(`Failed to parse news category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var w=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Pt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Fe(r)});}static getAllNewsCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};w.REMOTE_DATA_SOURCE="NewsCategoryRemoteDataSource",w.REPOSITORY="NewsCategoryRepository",w.GET_ALL_USE_CASE="GetAllNewsCategories",w.GET_BY_ID_USE_CASE="GetNewsCategoryById";var $=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.abstract=i;this.releaseDate=s;this.picture=u;}toJson(){return {rl_id:this.id,title:this.title,abstract:this.abstract,rl_date:this.releaseDate,picture:this.picture}}static fromJson(t){return new o(String(t.rl_id||t.id||""),String(t.title||""),String(t.abstract||""),String(t.rl_date||t.releaseDate||""),t.picture?String(t.picture):null)}};var me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var pe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Be=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ne=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>$.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>$.fromJson(s))}catch(i){throw new a(`Failed to parse press releases: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Press release not found");let i=r.data[0];if(!i)throw new a("Press release data is empty");return $.fromJson(i)}catch(i){throw new a(`Failed to parse press release data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var g=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Be(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ne(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new me(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new pe(r)});}static getAllPressReleasesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPressReleaseByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};g.REMOTE_DATA_SOURCE="PressReleaseRemoteDataSource",g.REPOSITORY="PressReleaseRepository",g.GET_ALL_USE_CASE="GetAllPressReleases",g.GET_BY_ID_USE_CASE="GetPressReleaseById";var J=class o extends l{constructor(t,r,i,s,u,m){super();this.id=t;this.title=r;this.subjectId=i;this.size=s;this.updatedAt=u;this.excelUrl=m;}toJson(){return {table_id:this.id,title:this.title,subj_id:this.subjectId,size:this.size,updt_date:this.updatedAt,excel:this.excelUrl}}static fromJson(t){return new o(String(t.table_id||t.id||""),String(t.title||""),Number(t.subj_id||t.subjectId||0),String(t.size||""),String(t.updt_date||t.updatedAt||""),String(t.excel||t.excelUrl||""))}};var de=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ge=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ge=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var $e=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>J.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>J.fromJson(s))}catch(i){throw new a(`Failed to parse static tables: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Static table not found");let i=r.data[0];if(!i)throw new a("Static table data is empty");return J.fromJson(i)}catch(i){throw new a(`Failed to parse static table data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var y=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ge(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new $e(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new de(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ge(r)});}static getAllStaticTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStaticTableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};y.REMOTE_DATA_SOURCE="StaticTableRemoteDataSource",y.REPOSITORY="StaticTableRepository",y.GET_ALL_USE_CASE="GetAllStaticTables",y.GET_BY_ID_USE_CASE="GetStaticTableById";var z=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.categoryId=i;}toJson(){return {subj_id:this.id,title:this.name,subcatid:this.categoryId}}static fromJson(t){return new o(Number(t.subj_id||t.id||0),String(t.title||t.name||""),Number(t.subcatid||t.categoryId||0))}};var Je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ye=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var At=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Et=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>z.fromJson(s))}catch(i){throw new a(`Failed to parse subject: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject not found");let i=r.data[0];if(!i)throw new a("Subject data is empty");return z.fromJson(i)}catch(i){throw new a(`Failed to parse subject data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var h=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new At(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Et(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ye(r)});}static getAllSubjectsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};h.REMOTE_DATA_SOURCE="SubjectRemoteDataSource",h.REPOSITORY="SubjectRepository",h.GET_ALL_USE_CASE="GetAllSubjects",h.GET_BY_ID_USE_CASE="GetSubjectById";var H=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {subcat_id:this.id,subcat_name:this.name}}static fromJson(t){return new o(Number(t.subcat_id||t.id||0),String(t.subcat_name||t.name||""))}};var qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ct=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var It=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>H.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>H.fromJson(s))}catch(i){throw new a(`Failed to parse subject category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject category not found");let i=r.data[0];if(!i)throw new a("Subject category data is empty");return H.fromJson(i)}catch(i){throw new a(`Failed to parse subject category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var P=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ct(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new It(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new qe(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Me(r)});}static getAllSubjectCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};P.REMOTE_DATA_SOURCE="SubjectCategoryRemoteDataSource",P.REPOSITORY="SubjectCategoryRepository",P.GET_ALL_USE_CASE="GetAllSubjectCategories",P.GET_BY_ID_USE_CASE="GetSubjectCategoryById";var Q=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {ind_id:this.id,ind_name:this.name}}static fromJson(t){return new o(Number(t.ind_id||t.id||0),String(t.ind_name||t.name||""))}};var We=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ke=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Tt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var _t=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Q.fromJson(s))}catch(i){throw new a(`Failed to parse strategic indicator: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Strategic indicator not found");let i=r.data[0];if(!i)throw new a("Strategic indicator data is empty");return Q.fromJson(i)}catch(i){throw new a(`Failed to parse strategic indicator data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var b=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Tt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new _t(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new We(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ke(r)});}static getAllStrategicIndicatorsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStrategicIndicatorByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};b.REMOTE_DATA_SOURCE="StrategicIndicatorRemoteDataSource",b.REPOSITORY="StrategicIndicatorRepository",b.GET_ALL_USE_CASE="GetAllStrategicIndicators",b.GET_BY_ID_USE_CASE="GetStrategicIndicatorById";var Z=class o extends l{constructor(t,r,i,s,u,m,V){super();this.id=t;this.title=r;this.subjectId=i;this.unit=s;this.verticalVariableCount=u;this.derivedVariableCount=m;this.graph=V;}toJson(){return {var_id:this.id,title:this.title,subject_id:this.subjectId,unit:this.unit,vertical_variable:this.verticalVariableCount,derived_variable:this.derivedVariableCount,graph:this.graph}}static fromJson(t){let r=t.graph||t.graphs,i=[];return Array.isArray(r)?i=r.map(s=>String(s)):typeof r=="string"&&(i=[r]),new o(Number(t.var_id||t.id||0),String(t.title||t.name||""),Number(t.subject_id||t.subjectId||0),String(t.unit||""),Number(t.vertical_variable||t.verticalVariableCount||0),Number(t.derived_variable||t.derivedVariableCount||0),i)}};var je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Dt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.subjectId&&(t.subject=e.subjectId.toString()),e?.showDeleted!==void 0&&(t.show_deleted=e.showDeleted?"1":"0");let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Lt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Z.fromJson(s))}catch(i){throw new a(`Failed to parse variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Variable not found");let i=r.data[0];if(!i)throw new a("Variable data is empty");return Z.fromJson(i)}catch(i){throw new a(`Failed to parse variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var A=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Dt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Lt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ze(r)});}static getAllVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};A.REMOTE_DATA_SOURCE="VariableRemoteDataSource",A.REPOSITORY="VariableRepository",A.GET_ALL_USE_CASE="GetAllVariables",A.GET_BY_ID_USE_CASE="GetVariableById";var X=class o extends l{constructor(t,r,i,s){super();this.id=t;this.variableId=r;this.label=i;this.alias=s;}toJson(){return {vervar_id:this.id,var_id:this.variableId,label:this.label,alias:this.alias}}static fromJson(t){return new o(Number(t.vervar_id||t.id||0),Number(t.var_id||t.variableId||0),String(t.label||""),String(t.alias||""))}};var He=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var vt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var xt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>X.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>X.fromJson(s))}catch(i){throw new a(`Failed to parse vertical variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Vertical variable not found");let i=r.data[0];if(!i)throw new a("Vertical variable data is empty");return X.fromJson(i)}catch(i){throw new a(`Failed to parse vertical variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var E=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new vt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new xt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new He(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Qe(r)});}static getAllVerticalVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVerticalVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};E.REMOTE_DATA_SOURCE="VerticalVariableRemoteDataSource",E.REPOSITORY="VerticalVariableRepository",E.GET_ALL_USE_CASE="GetAllVerticalVariables",E.GET_BY_ID_USE_CASE="GetVerticalVariableById";var ee=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {unit_id:this.id,unit:this.name}}static fromJson(t){return new o(Number(t.unit_id||t.id||0),String(t.unit||t.name||""))}};var Ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var kt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.UNIT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.UNIT_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ut=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ee.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ee.fromJson(s))}catch(i){throw new a(`Failed to parse unit: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Unit not found");let i=r.data[0];if(!i)throw new a("Unit data is empty");return ee.fromJson(i)}catch(i){throw new a(`Failed to parse unit data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var C=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new kt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ut(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ze(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Xe(r)});}static getAllUnitsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getUnitByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};C.REMOTE_DATA_SOURCE="UnitRemoteDataSource",C.REPOSITORY="UnitRepository",C.GET_ALL_USE_CASE="GetAllUnits",C.GET_BY_ID_USE_CASE="GetUnitById";var te=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.period_id||t.id||0),String(t.label||t.name||""))}};var et=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var tt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ot=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Vt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>te.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>te.fromJson(s))}catch(i){throw new a(`Failed to parse period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Period not found");let i=r.data[0];if(!i)throw new a("Period data is empty");return te.fromJson(i)}catch(i){throw new a(`Failed to parse period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var I=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ot(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Vt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new et(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new tt(r)});}static getAllPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};I.REMOTE_DATA_SOURCE="PeriodRemoteDataSource",I.REPOSITORY="PeriodRepository",I.GET_ALL_USE_CASE="GetAllPeriods",I.GET_BY_ID_USE_CASE="GetPeriodById";var re=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {derived_period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.derived_period_id||t.id||0),String(t.label||t.name||""))}};var rt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var it=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Ft=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>re.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>re.fromJson(s))}catch(i){throw new a(`Failed to parse derived period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived period not found");let i=r.data[0];if(!i)throw new a("Derived period data is empty");return re.fromJson(i)}catch(i){throw new a(`Failed to parse derived period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var T=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new rt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new it(r)});}static getAllDerivedPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};T.REMOTE_DATA_SOURCE="DerivedPeriodRemoteDataSource",T.REPOSITORY="DerivedPeriodRepository",T.GET_ALL_USE_CASE="GetAllDerivedPeriods",T.GET_BY_ID_USE_CASE="GetDerivedPeriodById";var ie=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {derived_variable_id:this.id,derived_variable:this.name}}static fromJson(t){return new o(Number(t.derived_variable_id||t.id||0),String(t.derived_variable||t.name||""))}};var ot=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var st=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Nt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Gt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ie.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ie.fromJson(s))}catch(i){throw new a(`Failed to parse derived variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived variable not found");let i=r.data[0];if(!i)throw new a("Derived variable data is empty");return ie.fromJson(i)}catch(i){throw new a(`Failed to parse derived variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var _=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Nt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Gt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ot(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new st(r)});}static getAllDerivedVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};_.REMOTE_DATA_SOURCE="DerivedVariableRemoteDataSource",_.REPOSITORY="DerivedVariableRepository",_.GET_ALL_USE_CASE="GetAllDerivedVariables",_.GET_BY_ID_USE_CASE="GetDerivedVariableById";var oe=class o extends l{constructor(t,r){super();this.id=t;this.title=r;}toJson(){return {kbli_id:this.id,title:this.title}}static fromJson(t){return new o(String(t.kbli_id||t.id||""),String(t.title||t.name||""))}};var at=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var nt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var $t=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Jt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>oe.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>oe.fromJson(s))}catch(i){throw new a(`Failed to parse statistic classification: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Statistic classification not found");let i=r.data[0];if(!i)throw new a("Statistic classification data is empty");return oe.fromJson(i)}catch(i){throw new a(`Failed to parse statistic classification data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var D=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new $t(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Jt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new at(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new nt(r)});}static getAllStatisticClassificationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStatisticClassificationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};D.REMOTE_DATA_SOURCE="StatisticClassificationRemoteDataSource",D.REPOSITORY="StatisticClassificationRepository",D.GET_ALL_USE_CASE="GetAllStatisticClassifications",D.GET_BY_ID_USE_CASE="GetStatisticClassificationById";var se=class o extends l{constructor(t,r,i){super();this.id=t;this.activity=r;this.year=i;}toJson(){return {id:this.id,kegiatan:this.activity,tahun_kegiatan:this.year}}static fromJson(t){return new o(Number(t.id||0),String(t.kegiatan||t.activity||""),String(t.tahun_kegiatan||t.year||""))}};var lt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ct=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var dr=(t=>(t.ID="ind",t.EN="eng",t))(dr||{});var gr=(r=>(r.AVAILABLE="available",r.NOT_AVAILABLE="not-available",r.LIST_NOT_AVAILABLE="list-not-available",r))(gr||{});var qt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>se.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>se.fromJson(s))}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{return se.fromJson(r)}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var L=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new qt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new lt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ct(r)});}static getAllCensusesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getCensusByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};L.REMOTE_DATA_SOURCE="CensusRemoteDataSource",L.REPOSITORY="CensusRepository",L.GET_ALL_USE_CASE="GetAllCensuses",L.GET_BY_ID_USE_CASE="GetCensusById";var ye=class o extends l{constructor(t,r,i,s,u,m,V,Y,yr,Rr,fr,Sr){super();this.variableId=t;this.title=r;this.subjectId=i;this.subjectName=s;this.notes=u;this.unit=m;this.verticalVariableId=V;this.domain=Y;this.csaSubjectId=yr;this.csaSubjectName=Rr;this.graphId=fr;this.graphName=Sr;}toJson(){return {var:this.variableId,label:this.title,subj:this.subjectId,subj_label:this.subjectName,notes:this.notes,unit:this.unit,vervar:this.verticalVariableId,table:this.domain,subcsa:this.csaSubjectId,subcsa_label:this.csaSubjectName,graph:this.graphId,graph_label:this.graphName}}static fromJson(t){let r=t.var,i=t.subj;return new o(typeof r=="number"?r:parseInt(String(r||0)),String(t.label||""),typeof i=="number"?i:parseInt(String(i||0)),String(t.subj_label||""),String(t.notes||""),String(t.unit||""),Number(t.vervar||0),String(t.table||""),t.subcsa!==void 0?Number(t.subcsa):void 0,t.subcsa_label!==void 0?String(t.subcsa_label):void 0,t.graph!==void 0?Number(t.graph):void 0,t.graph_label!==void 0?String(t.graph_label):void 0)}};var ut=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Mt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain?t.domain=e.domain:t.domain=e.tableId,e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Wt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ye.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ye.fromJson(s))}catch(i){throw new a(`Failed to parse dynamic table: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var O=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Mt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Wt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ut(r)});}static getAllDynamicTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};O.REMOTE_DATA_SOURCE="DynamicTableRemoteDataSource",O.REPOSITORY="DynamicTableRepository",O.GET_ALL_USE_CASE="GetAllDynamicTables";var Kt=class{constructor(e){this.injector=e;}async domains(e){return R.getAllDomainsUseCase(this.injector).execute(e)}async publications(e){return f.getAllPublicationsUseCase(this.injector).execute(e)}async infographics(e){return S.getAllInfographicsUseCase(this.injector).execute(e)}async news(e){return d.getAllNewsUseCase(this.injector).execute(e)}async newsCategories(e){return w.getAllNewsCategoriesUseCase(this.injector).execute(e)}async pressReleases(e){return g.getAllPressReleasesUseCase(this.injector).execute(e)}async staticTables(e){return y.getAllStaticTablesUseCase(this.injector).execute(e)}async subjects(e){return h.getAllSubjectsUseCase(this.injector).execute(e)}async subjectCategories(e){return P.getAllSubjectCategoriesUseCase(this.injector).execute(e)}async strategicIndicators(e){return b.getAllStrategicIndicatorsUseCase(this.injector).execute(e)}async variables(e){return A.getAllVariablesUseCase(this.injector).execute(e)}async verticalVariables(e){return E.getAllVerticalVariablesUseCase(this.injector).execute(e)}async units(e){return C.getAllUnitsUseCase(this.injector).execute(e)}async periods(e){return I.getAllPeriodsUseCase(this.injector).execute(e)}async derivedPeriods(e){return T.getAllDerivedPeriodsUseCase(this.injector).execute(e)}async derivedVariables(e){return _.getAllDerivedVariablesUseCase(this.injector).execute(e)}async statisticClassifications(e){return D.getAllStatisticClassificationsUseCase(this.injector).execute(e)}async censuses(e){return L.getAllCensusesUseCase(this.injector).execute(e)}async dynamicTables(e){return O.getAllDynamicTablesUseCase(this.injector).execute(e)}};var jt=class{constructor(e){this.injector=e;}async domain(e){return R.getDomainByIdUseCase(this.injector).execute(e)}async publication(e){return f.getPublicationByIdUseCase(this.injector).execute(e)}async infographic(e){return S.getInfographicByIdUseCase(this.injector).execute(e)}async news(e){return d.getNewsByIdUseCase(this.injector).execute(e)}async newsCategory(e){return w.getNewsCategoryByIdUseCase(this.injector).execute(e)}async pressRelease(e){return g.getPressReleaseByIdUseCase(this.injector).execute(e)}async staticTable(e){return y.getStaticTableByIdUseCase(this.injector).execute(e)}async subject(e){return h.getSubjectByIdUseCase(this.injector).execute(e)}async subjectCategory(e){return P.getSubjectCategoryByIdUseCase(this.injector).execute(e)}async strategicIndicator(e){return b.getStrategicIndicatorByIdUseCase(this.injector).execute(e)}async variable(e){return A.getVariableByIdUseCase(this.injector).execute(e)}async verticalVariable(e){return E.getVerticalVariableByIdUseCase(this.injector).execute(e)}async unit(e){return C.getUnitByIdUseCase(this.injector).execute(e)}async period(e){return I.getPeriodByIdUseCase(this.injector).execute(e)}async derivedPeriod(e){return T.getDerivedPeriodByIdUseCase(this.injector).execute(e)}async derivedVariable(e){return _.getDerivedVariableByIdUseCase(this.injector).execute(e)}async statisticClassification(e){return D.getStatisticClassificationByIdUseCase(this.injector).execute(e)}async census(e){return L.getCensusByIdUseCase(this.injector).execute(e)}};var ur=class o extends l{constructor(t,r,i,s,u,m){super();this.value=t;this.netWeight=r;this.hsCode=i;this.port=s;this.country=u;this.year=m;}toJson(){return {value:this.value,netweight:this.netWeight,kodehs:this.hsCode,pod:this.port,ctr:this.country,tahun:this.year}}static fromJson(t){return new o(Number(t.value||0),Number(t.netweight||0),String(t.kodehs||""),String(t.pod||""),String(t.ctr||""),String(t.tahun||""))}};var mt=class{constructor(e){this.repository=e;}execute(e){return this.repository.get(e)}};var zt=class{constructor(e){this.client=e;}async get(e){let t={sumber:e.source.toString(),periode:e.period.toString(),kodehs:e.hsCode,jenishs:e.hsType.toString(),Tahun:e.year},r=new URLSearchParams(t).toString(),i=`${n.TRADE}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ht=class{constructor(e){this.remoteDataSource=e;}get(e){return this.remoteDataSource.get(e)}};var ae=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new zt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ht(r)}),e.registerFactory(this.GET_TRADE_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new mt(r)});}static getTradeUseCase(e){return e.resolve(this.GET_TRADE_USE_CASE)}};ae.REMOTE_DATA_SOURCE="TradeRemoteDataSource",ae.REPOSITORY="TradeRepository",ae.GET_TRADE_USE_CASE="GetTrade";var p=class p{constructor(e){this.logger=U.getInstance(),this.logger.configure({enabled:e.debug??false,filter:new B(e.logLevel??1)}),ne.getInstance().setApiKey(e.apiKey),this.authInterceptor=new Ce(e.apiKey);let t=[this.authInterceptor,...e.interceptors||[]];this.networkClient=new Ee({baseURL:e.baseURL||gt.BASE_URL,timeout:e.timeout||gt.DEFAULT_TIMEOUT,interceptors:t}),this.injector=Re.getInstance(),this.setupDependencies(),this._list=new Kt(this.injector),this._view=new jt(this.injector),this.logger.info("StadataJS initialized successfully");}static get instance(){if(!p._instance)throw new Error("StadataJS not initialized. Call StadataJS.init() first.");return p._instance}static init(e){return p._instance&&p._instance.logger.warn("StadataJS already initialized. Reinitializing..."),p._instance=new p(e),p._instance}static isInitialized(){return p._instance!==null}static destroy(){p._instance&&(p._instance.cleanup(),p._instance=null);}get list(){return this._list}get view(){return this._view}setApiKey(e){ne.getInstance().setApiKey(e),this.authInterceptor.setApiKey(e),this.logger.info("API key updated");}addInterceptor(e){this.networkClient.addInterceptor(e),this.logger.debug("Interceptor added");}removeInterceptor(e){this.networkClient.removeInterceptor(e),this.logger.debug("Interceptor removed");}enableDebug(){this.logger.enable(),this.logger.configure({filter:new B(0)});}disableDebug(){this.logger.configure({filter:new B(1)});}async trade(e){return this.injector.resolve("GetTrade").execute(e)}setupDependencies(){R.register(this.injector,this.networkClient),f.register(this.injector,this.networkClient),S.register(this.injector,this.networkClient),d.register(this.injector,this.networkClient),w.register(this.injector,this.networkClient),g.register(this.injector,this.networkClient),y.register(this.injector,this.networkClient),h.register(this.injector,this.networkClient),P.register(this.injector,this.networkClient),b.register(this.injector,this.networkClient),A.register(this.injector,this.networkClient),E.register(this.injector,this.networkClient),C.register(this.injector,this.networkClient),I.register(this.injector,this.networkClient),T.register(this.injector,this.networkClient),_.register(this.injector,this.networkClient),D.register(this.injector,this.networkClient),L.register(this.injector,this.networkClient),O.register(this.injector,this.networkClient),ae.register(this.injector,this.networkClient);}cleanup(){this.injector.clear(),ne.getInstance().clearApiKey(),this.logger.info("StadataJS cleaned up");}};p._instance=null;var mr=p;var Pr=(t=>(t[t.Export=1]="Export",t[t.Import=2]="Import",t))(Pr||{}),br=(t=>(t[t.Monthly=1]="Monthly",t[t.Annually=2]="Annually",t))(br||{}),Ar=(t=>(t[t.TwoDigit=1]="TwoDigit",t[t.Full=2]="Full",t))(Ar||{});
|
|
2
|
-
exports.ApiConstant=gt;exports.ApiEndpoint=n;exports.ApiException=
|
|
1
|
+
'use strict';var neverthrow=require('neverthrow');var Re=class o{constructor(){this.container=new Map;this.factories=new Map;}static getInstance(){return o.instance||(o.instance=new o),o.instance}register(e,t){this.container.set(e,t);}registerFactory(e,t){this.factories.set(e,t);}resolve(e){if(this.container.has(e))return this.container.get(e);if(this.factories.has(e)){let t=this.factories.get(e);if(t){let r=t();return this.container.set(e,r),r}}throw new Error(`Dependency not found: ${e}`)}has(e){return this.container.has(e)||this.factories.has(e)}clear(){this.container.clear(),this.factories.clear();}remove(e){this.container.delete(e),this.factories.delete(e);}};var O=class o{constructor(e,t){this.message=e;this.code=t;}toString(){return `${this.constructor.name}: ${this.message}${this.code?` (${this.code})`:""}`}equals(e){return e instanceof o?this.message===e.message&&this.code===e.code&&this.constructor.name===e.constructor.name:false}},k=class extends O{constructor(t,r,i){super(t,i);this.statusCode=r;}},fe=class extends O{constructor(e="Request was cancelled"){super(e,"CANCELLED");}},Se=class extends O{constructor(e){super(e,"NETWORK_ERROR");}},we=class extends O{constructor(e="Request timeout"){super(e,"TIMEOUT");}},he=class extends k{constructor(e="Resource not found"){super(e,404,"NOT_FOUND");}},Pe=class extends k{constructor(e="Unauthorized"){super(e,401,"UNAUTHORIZED");}},be=class extends k{constructor(e="Forbidden"){super(e,403,"FORBIDDEN");}},Ae=class extends k{constructor(e="Server error",t=500){super(e,t,"SERVER_ERROR");}},a=class extends O{constructor(e){super(e,"PARSE_ERROR");}},Xt=class extends O{constructor(e){super(e,"VALIDATION_ERROR");}};var Ee=class{constructor(e={}){this.baseURL=e.baseURL||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.interceptors=e.interceptors||[];}addInterceptor(e){this.interceptors.push(e);}removeInterceptor(e){let t=this.interceptors.indexOf(e);t!==-1&&this.interceptors.splice(t,1);}async get(e,t){return this.request("GET",e,t)}async post(e,t){return this.request("POST",e,t)}async put(e,t){return this.request("PUT",e,t)}async delete(e,t){return this.request("DELETE",e,t)}async patch(e,t){return this.request("PATCH",e,t)}async request(e,t,r={}){try{let i=this.buildUrl(t),s={};e!=="GET"?Object.assign(s,this.defaultHeaders):Object.entries(this.defaultHeaders).forEach(([x,Zt])=>{x.toLowerCase()!=="content-type"&&(s[x]=Zt);}),Object.assign(s,r.headers);let u={method:e,headers:s};e!=="GET"&&r.body&&(u.body=JSON.stringify(r.body)),r.cancelToken&&(u.signal=r.cancelToken.signal);for(let x of this.interceptors)x.onRequest&&(u=await x.onRequest(i,u));let R=await this.fetchWithTimeout(i,u,r.timeout||this.timeout);for(let x of this.interceptors)x.onResponse&&(R=await x.onResponse(R));if(!R.ok)return neverthrow.err(await this.handleErrorResponse(R));let Qt=await R.json();return neverthrow.ok(Qt)}catch(i){return neverthrow.err(await this.handleError(i,r.cancelToken))}}async fetchWithTimeout(e,t,r){let i=new AbortController,s=setTimeout(()=>i.abort(),r);try{let u=t.signal&&t.signal instanceof AbortSignal?this.combineSignals(t.signal,i.signal):i.signal;return await fetch(e,{...t,signal:u})}finally{clearTimeout(s);}}combineSignals(e,t){let r=new AbortController,i=()=>r.abort();return e.addEventListener("abort",i),t.addEventListener("abort",i),r.signal}buildUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.baseURL}${e}`}async handleErrorResponse(e){let{status:t}=e,r;try{let i=await e.json();r=i.message||i.error||e.statusText;}catch{r=e.statusText;}switch(t){case 401:return new Pe(r);case 403:return new be(r);case 404:return new he(r);case 500:case 502:case 503:case 504:return new Ae(r,t);default:return new k(r,t)}}async handleError(e,t){let r=e instanceof Error?e:new Error(String(e));for(let i of this.interceptors)if(i.onError){let s=await i.onError(r);s&&(r=s);}return t?.isCancelled||e.name==="AbortError"?new fe(t?.reason):r.name==="AbortError"||r.message.includes("timeout")||r.message.includes("aborted")?new we:r.message.includes("network")||r.message.includes("fetch")||r.message.includes("ECONNREFUSED")?new Se(r.message):new k(r.message)}};var B=class{};var Ce=class extends B{constructor(t){super();this.apiKey=t;}onRequest(t,r){return new URL(t).searchParams.set("key",this.apiKey),{...r}}setApiKey(t){this.apiKey=t;}getApiKey(){return this.apiKey}};var dt=(u=>(u[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.FATAL=4]="FATAL",u[u.NONE=5]="NONE",u))(dt||{}),pt=class{print(e){let t=dt[e.level],i=`[${e.timestamp.toISOString()}] [${t}] ${e.message}`;switch(e.level){case 0:console.debug(i,e.data);break;case 1:console.info(i,e.data);break;case 2:console.warn(i,e.data);break;case 3:case 4:console.error(i,e.error||e.data);break}}},N=class{constructor(e=1){this.minLevel=e;}shouldLog(e){return e.level>=this.minLevel}},V=class o{constructor(e=new pt,t=new N){this.enabled=true;this.printer=e,this.filter=t;}static getInstance(){return o.instance||(o.instance=new o),o.instance}configure(e){e.printer&&(this.printer=e.printer),e.filter&&(this.filter=e.filter),e.enabled!==void 0&&(this.enabled=e.enabled);}debug(e,t){this.log(0,e,t);}info(e,t){this.log(1,e,t);}warn(e,t){this.log(2,e,t);}error(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(3,e,i,r);}fatal(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(4,e,i,r);}log(e,t,r,i){if(!this.enabled)return;let s={level:e,message:t,timestamp:new Date,data:r,error:i};this.filter.shouldLog(s)&&this.printer.print(s);}enable(){this.enabled=true;}disable(){this.enabled=false;}};var er=class extends B{constructor(e){super(),this.logger=e||V.getInstance();}onRequest(e,t){return this.logger.debug(`HTTP Request: ${t.method||"GET"} ${e}`,{headers:t.headers,body:t.body}),t}onResponse(e){return this.logger.debug(`HTTP Response: ${e.status} ${e.url}`,{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}),e}onError(e){return this.logger.error(`HTTP Error: ${e.message}`,e),e}};var tr=class extends B{constructor(t={},r){super();this.retryCount=new Map;this.logger=r||V.getInstance(),this.config={maxRetries:t.maxRetries??3,retryDelay:t.retryDelay??1e3,retryableStatusCodes:t.retryableStatusCodes??[408,429,500,502,503,504],exponentialBackoff:t.exponentialBackoff??true};}async onResponse(t){let r=t.url,i=this.retryCount.get(r)||0;if(!t.ok&&this.config.retryableStatusCodes.includes(t.status)&&i<this.config.maxRetries){this.retryCount.set(r,i+1);let s=this.config.exponentialBackoff?this.config.retryDelay*Math.pow(2,i):this.config.retryDelay;throw this.logger.warn(`Retrying request (${i+1}/${this.config.maxRetries}) after ${s}ms: ${t.url}`),await this.sleep(s),new Error(`RETRY_NEEDED:${r}`)}return (t.ok||i>=this.config.maxRetries)&&this.retryCount.delete(r),t}sleep(t){return new Promise(r=>setTimeout(r,t))}resetRetryCount(t){this.retryCount.delete(t);}clearAllRetryCounts(){this.retryCount.clear();}};var gt={BASE_URL:"https://webapi.bps.go.id/v1/api",DEFAULT_TIMEOUT:3e4,API_VERSION:"v1",DEFAULT_PAGE_SIZE:10,MAX_PAGE_SIZE:100};var n={DOMAIN_LIST:"/list/domain",DOMAIN_VIEW:"/view/domain",PUBLICATION_LIST:"/list/publication",PUBLICATION_VIEW:"/view/publication",INFOGRAPHIC_LIST:"/list/infographic",INFOGRAPHIC_VIEW:"/view/infographic",STATIC_TABLE_LIST:"/list/statictable",STATIC_TABLE_VIEW:"/view/statictable",NEWS_LIST:"/list/news",NEWS_VIEW:"/view/news",NEWS_CATEGORY_LIST:"/list/newscategory",NEWS_CATEGORY_VIEW:"/view/newscategory",PRESS_RELEASE_LIST:"/list/pressrelease",PRESS_RELEASE_VIEW:"/view/pressrelease",SUBJECT_LIST:"/list/subject",SUBJECT_VIEW:"/view/subject",SUBJECT_CATEGORY_LIST:"/list/subjectcat",SUBJECT_CATEGORY_VIEW:"/view/subjectcat",STRATEGIC_INDICATOR_LIST:"/list/stratind",STRATEGIC_INDICATOR_VIEW:"/view/stratind",VARIABLE_LIST:"/list/var",VARIABLE_VIEW:"/view/var",VERTICAL_VARIABLE_LIST:"/list/vervar",VERTICAL_VARIABLE_VIEW:"/view/vervar",UNIT_LIST:"/list/unit",UNIT_VIEW:"/view/unit",PERIOD_LIST:"/list/period",PERIOD_VIEW:"/view/period",DERIVED_PERIOD_LIST:"/list/turth",DERIVED_PERIOD_VIEW:"/view/turth",DERIVED_VARIABLE_LIST:"/list/turvar",DERIVED_VARIABLE_VIEW:"/view/turvar",DYNAMIC_TABLE_LIST:"/list/dynamictable",STATISTIC_CLASSIFICATION_LIST:"/list/kbli",STATISTIC_CLASSIFICATION_VIEW:"/view/kbli",CENSUS_LIST:"/list/sensus",CENSUS_VIEW:"/view/sensus",TRADE:"/dataexim"};var hr={KEY:"key",DOMAIN:"domain",LANG:"lang",PAGE:"page",PER_PAGE:"per_page",KEYWORD:"keyword",MONTH:"month",YEAR:"year",SUBJECT:"subj",VARIABLE:"var",TURVAR:"turvar",TURTH:"turth",PERIOD:"th",TYPE:"type",TABLE:"table",MODEL:"model",ID:"id",SHOW_DELETED:"show_deleted"};var ne=class o{constructor(){this._apiKey=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}setApiKey(e){this._apiKey=e;}getApiKey(){if(!this._apiKey)throw new Error("API key not set. Call setApiKey() first.");return this._apiKey}hasApiKey(){return this._apiKey!==null}clearApiKey(){this._apiKey=null;}};var l=class o{toString(){return JSON.stringify(this.toJson(),null,2)}equals(e){return e instanceof o?JSON.stringify(this.toJson())===JSON.stringify(e.toJson()):false}copyWith(e){let r={...this.toJson(),...e};return Object.assign(Object.create(Object.getPrototypeOf(this)),r)}};var G=class{},rr=class extends G{call(){return this.execute()}};var le=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.url=i;}toJson(){return {domain_id:this.id,domain_name:this.name,domain_url:this.url}}static fromJson(t){return new o(t.domain_id||t.id||"",t.domain_name||t.name||"",t.domain_url||t.url||"")}};var Ie=class extends G{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getAll(t)}};var Te=class extends G{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getById(t)}};var yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.perPage&&(t.per_page=e.perPage.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang),e.id&&(t.id=e.id.toString());let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_VIEW}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var U=class o extends l{constructor(t,r,i,s,u){super();this.page=t;this.perPage=r;this.total=i;this.pages=s;this.count=u;}get hasNextPage(){return this.page<this.pages}get hasPreviousPage(){return this.page>1}get nextPage(){return this.hasNextPage?this.page+1:null}get previousPage(){return this.hasPreviousPage?this.page-1:null}toJson(){return {page:this.page,per_page:this.perPage,total:this.total,pages:this.pages,count:this.count}}static fromJson(t){return new o(t.page||1,t.per_page||10,t.total||0,t.pages||0,t.count||0)}};var ir=class o extends l{constructor(t,r,i){super();this.data=t;this.dataAvailability=r;this.pagination=i;}get isAvailable(){return this.dataAvailability==="available"}get totalItems(){return this.pagination?.total||this.data.length}get hasData(){return this.data.length>0}toJson(){return {data:this.data,data_availability:this.dataAvailability,pagination:this.pagination?.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(R=>r(R)),u=t.pagination,y=u?U.fromJson(u):void 0;return new o(s,t["data-availability"]||"available",y)}};var c=class o extends l{constructor(t,r){super();this.data=t;this.pagination=r;}get hasMore(){return this.pagination.hasNextPage}get totalItems(){return this.pagination.total}get items(){return this.data}get itemCount(){return this.data.length}toJson(){return {data:this.data,pagination:this.pagination.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(R=>r(R)),u=t.pagination,y=U.fromJson(u);return new o(s,y)}};var Rt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(u=>le.fromJson(u)),s=r.pagination?U.fromJson(r.pagination):new U(1,i.length,i.length,1,i.length);return new c(i,s)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Domain not found");let i=r.data[0];if(!i)throw new a("Domain data is empty");return le.fromJson(i)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var f=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Rt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ie(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Te(r)});}static getAllDomainsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDomainByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};f.REMOTE_DATA_SOURCE="DomainRemoteDataSource",f.REPOSITORY="DomainRepository",f.GET_ALL_USE_CASE="GetAllDomains",f.GET_BY_ID_USE_CASE="GetDomainById";var _e=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.releaseDate=i;this.url=s;this.cover=u;}toJson(){return {id:this.id,title:this.title,rl_date:this.releaseDate.toISOString().split("T")[0],url:this.url,cover:this.cover}}static fromJson(t){return new o(String(t.id||""),String(t.title||""),new Date(String(t.rl_date||t.release_date||t.releaseDate||"")),String(t.url||""),String(t.cover||""))}};var q=class o extends l{constructor(t,r,i,s,u,y,R,Qt,x,Zt,fr,Sr,Er){super();this.id=t;this.title=r;this.issn=i;this.cover=s;this.pdf=u;this.size=y;this.scheduledDate=R;this.releaseDate=Qt;this.updateDate=x;this.abstract=Zt;this.catalogueNumber=fr;this.publicationNumber=Sr;this.relatedPublications=Er;}toJson(){return {id:this.id,title:this.title,issn:this.issn,cover:this.cover,pdf:this.pdf,size:this.size,scheduled_date:this.scheduledDate?.toISOString().split("T")[0]||null,rl_date:this.releaseDate?.toISOString().split("T")[0]||null,updt_date:this.updateDate?.toISOString().split("T")[0]||null,abstract:this.abstract,catalogue_number:this.catalogueNumber,publication_number:this.publicationNumber,related_publications:this.relatedPublications.map(t=>t.toJson())}}static fromJson(t){let r=t.related_publications||t.relatedPublications,i=Array.isArray(r)?r.map(s=>_e.fromJson(s)):[];return new o(String(t.id||""),String(t.title||""),String(t.issn||""),String(t.cover||""),String(t.pdf||""),String(t.size||""),t.scheduled_date||t.scheduledDate?new Date(String(t.scheduled_date||t.scheduledDate)):null,t.rl_date||t.release_date||t.releaseDate?new Date(String(t.rl_date||t.release_date||t.releaseDate)):null,t.updt_date||t.update_date||t.updateDate?new Date(String(t.updt_date||t.update_date||t.updateDate)):null,t.abstract?String(t.abstract):null,t.catalogue_number||t.catalogueNumber?String(t.catalogue_number||t.catalogueNumber):null,t.publication_number||t.publicationNumber?String(t.publication_number||t.publicationNumber):null,i)}};var De=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Le=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var ft=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var St=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>q.fromJson(s))}catch(i){throw new a(`Failed to parse publications: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Publication not found");let i=r.data[0];if(!i)throw new a("Publication data is empty");return q.fromJson(i)}catch(i){throw new a(`Failed to parse publication data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var S=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new St(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new De(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Le(r)});}static getAllPublicationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPublicationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};S.REMOTE_DATA_SOURCE="PublicationRemoteDataSource",S.REPOSITORY="PublicationRepository",S.GET_ALL_USE_CASE="GetAllPublications",S.GET_BY_ID_USE_CASE="GetPublicationById";var M=class o extends l{constructor(t,r,i,s,u,y){super();this.id=t;this.title=r;this.image=i;this.category=s;this.downloadUrl=u;this.description=y;}toJson(){return {inf_id:this.id,title:this.title,img:this.image,category:this.category,dl:this.downloadUrl,desc:this.description}}static fromJson(t){return new o(String(t.inf_id||t.id||""),String(t.title||""),String(t.img||t.image||""),Number(t.category||0),String(t.dl||t.downloadUrl||""),t.desc||t.description?String(t.desc||t.description):null)}};var ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var wt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ht=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>M.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>M.fromJson(s))}catch(i){throw new a(`Failed to parse infographics: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Infographic not found");let i=r.data[0];if(!i)throw new a("Infographic data is empty");return M.fromJson(i)}catch(i){throw new a(`Failed to parse infographic data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var w=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new wt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ht(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new xe(r)});}static getAllInfographicsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getInfographicByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};w.REMOTE_DATA_SOURCE="InfographicRemoteDataSource",w.REPOSITORY="InfographicRepository",w.GET_ALL_USE_CASE="GetAllInfographics",w.GET_BY_ID_USE_CASE="GetInfographicById";var W=class o extends Error{constructor(e){super(e),this.name="StadataException",Object.setPrototypeOf(this,o.prototype);}},j=class o extends W{constructor(t,r,i){super(t);this.statusCode=r;this.response=i;this.name="ApiException",Object.setPrototypeOf(this,o.prototype);}},ke=class o extends W{constructor(e="Request was cancelled"){super(e),this.name="CancelledException",Object.setPrototypeOf(this,o.prototype);}},or=class o extends W{constructor(e){super(e),this.name="NetworkException",Object.setPrototypeOf(this,o.prototype);}},sr=class o extends W{constructor(e="Request timeout"){super(e),this.name="TimeoutException",Object.setPrototypeOf(this,o.prototype);}},ar=class o extends j{constructor(e="Resource not found"){super(e,404),this.name="NotFoundException",Object.setPrototypeOf(this,o.prototype);}},nr=class o extends j{constructor(e="Unauthorized"){super(e,401),this.name="UnauthorizedException",Object.setPrototypeOf(this,o.prototype);}},lr=class o extends j{constructor(e="Forbidden"){super(e,403),this.name="ForbiddenException",Object.setPrototypeOf(this,o.prototype);}},cr=class o extends j{constructor(e="Server error",t=500){super(e,t),this.name="ServerException",Object.setPrototypeOf(this,o.prototype);}};var ur=class o{constructor(){this._isCancelled=false;this.abortController=new AbortController;}get signal(){return this.abortController.signal}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isCancelled||(this._isCancelled=true,this._reason=e,this.abortController.abort());}throwIfCancelled(){if(this._isCancelled)throw new ke(this._reason||"Request was cancelled")}static create(){return new o}static source(){let e=new o;return {token:e,cancel:t=>e.cancel(t)}}};var mr=class{static parse(e){if(!e)return null;try{let t=new Date(e);return isNaN(t.getTime())?null:t}catch{return null}}static format(e){if(!e||!(e instanceof Date))return null;try{return e.toISOString()}catch{return null}}static formatReadable(e){if(!e||!(e instanceof Date))return null;try{return e.toLocaleDateString("id-ID",{year:"numeric",month:"long",day:"numeric"})}catch{return null}}static isValid(e){return this.parse(e)!==null}static toTimestamp(e){let t=this.parse(e);return t?t.getTime():null}static fromTimestamp(e){return new Date(e)}static now(){return new Date().toISOString()}static nowTimestamp(){return Date.now()}};var $=class o extends l{constructor(t,r,i,s,u,y){super();this.id=t;this.title=r;this.content=i;this.releaseDate=s;this.categoryId=u;this.picture=y;}toJson(){return {news_id:this.id,title:this.title,news_content:this.content,rl_date:this.releaseDate,category_id:this.categoryId,picture:this.picture}}static fromJson(t){return new o(String(t.news_id||t.id||""),String(t.title||""),String(t.news_content||t.content||""),String(t.rl_date||t.releaseDate||""),Number(t.category_id||t.categoryId||0),t.picture?String(t.picture):null)}};var ce=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ue=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ue=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString()),e.newsCategoryId&&(t.news_category_id=e.newsCategoryId);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Oe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>$.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>$.fromJson(s))}catch(i){throw new a(`Failed to parse news: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News not found");let i=r.data[0];if(!i)throw new a("News data is empty");return $.fromJson(i)}catch(i){throw new a(`Failed to parse news data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var p=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ue(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Oe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ce(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ue(r)});}static getAllNewsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};p.REMOTE_DATA_SOURCE="NewsRemoteDataSource",p.REPOSITORY="NewsRepository",p.GET_ALL_USE_CASE="GetAllNews",p.GET_BY_ID_USE_CASE="GetNewsById";var K=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {category_id:this.id,category_name:this.name}}static fromJson(t){return new o(String(t.category_id||t.id||""),String(t.category_name||t.name||""))}};var Ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Fe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Pt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>K.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>K.fromJson(s))}catch(i){throw new a(`Failed to parse news category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News category not found");let i=r.data[0];if(!i)throw new a("News category data is empty");return K.fromJson(i)}catch(i){throw new a(`Failed to parse news category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var h=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Pt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Fe(r)});}static getAllNewsCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};h.REMOTE_DATA_SOURCE="NewsCategoryRemoteDataSource",h.REPOSITORY="NewsCategoryRepository",h.GET_ALL_USE_CASE="GetAllNewsCategories",h.GET_BY_ID_USE_CASE="GetNewsCategoryById";var J=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.abstract=i;this.releaseDate=s;this.picture=u;}toJson(){return {rl_id:this.id,title:this.title,abstract:this.abstract,rl_date:this.releaseDate,picture:this.picture}}static fromJson(t){return new o(String(t.rl_id||t.id||""),String(t.title||""),String(t.abstract||""),String(t.rl_date||t.releaseDate||""),t.picture?String(t.picture):null)}};var me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var pe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Be=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ne=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>J.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>J.fromJson(s))}catch(i){throw new a(`Failed to parse press releases: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Press release not found");let i=r.data[0];if(!i)throw new a("Press release data is empty");return J.fromJson(i)}catch(i){throw new a(`Failed to parse press release data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var d=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Be(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ne(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new me(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new pe(r)});}static getAllPressReleasesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPressReleaseByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};d.REMOTE_DATA_SOURCE="PressReleaseRemoteDataSource",d.REPOSITORY="PressReleaseRepository",d.GET_ALL_USE_CASE="GetAllPressReleases",d.GET_BY_ID_USE_CASE="GetPressReleaseById";var Y=class o extends l{constructor(t,r,i,s,u,y){super();this.id=t;this.title=r;this.subjectId=i;this.size=s;this.updatedAt=u;this.excelUrl=y;}toJson(){return {table_id:this.id,title:this.title,subj_id:this.subjectId,size:this.size,updt_date:this.updatedAt,excel:this.excelUrl}}static fromJson(t){return new o(String(t.table_id||t.id||""),String(t.title||""),Number(t.subj_id||t.subjectId||0),String(t.size||""),String(t.updt_date||t.updatedAt||""),String(t.excel||t.excelUrl||""))}};var de=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ge=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ge=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var $e=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Y.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Y.fromJson(s))}catch(i){throw new a(`Failed to parse static tables: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Static table not found");let i=r.data[0];if(!i)throw new a("Static table data is empty");return Y.fromJson(i)}catch(i){throw new a(`Failed to parse static table data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var g=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ge(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new $e(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new de(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ge(r)});}static getAllStaticTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStaticTableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};g.REMOTE_DATA_SOURCE="StaticTableRemoteDataSource",g.REPOSITORY="StaticTableRepository",g.GET_ALL_USE_CASE="GetAllStaticTables",g.GET_BY_ID_USE_CASE="GetStaticTableById";var z=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.categoryId=i;}toJson(){return {subj_id:this.id,title:this.name,subcatid:this.categoryId}}static fromJson(t){return new o(Number(t.subj_id||t.id||0),String(t.title||t.name||""),Number(t.subcatid||t.categoryId||0))}};var Je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ye=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var At=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Et=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>z.fromJson(s))}catch(i){throw new a(`Failed to parse subject: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject not found");let i=r.data[0];if(!i)throw new a("Subject data is empty");return z.fromJson(i)}catch(i){throw new a(`Failed to parse subject data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var P=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new At(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Et(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ye(r)});}static getAllSubjectsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};P.REMOTE_DATA_SOURCE="SubjectRemoteDataSource",P.REPOSITORY="SubjectRepository",P.GET_ALL_USE_CASE="GetAllSubjects",P.GET_BY_ID_USE_CASE="GetSubjectById";var H=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {subcat_id:this.id,subcat_name:this.name}}static fromJson(t){return new o(Number(t.subcat_id||t.id||0),String(t.subcat_name||t.name||""))}};var qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ct=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var It=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>H.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>H.fromJson(s))}catch(i){throw new a(`Failed to parse subject category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject category not found");let i=r.data[0];if(!i)throw new a("Subject category data is empty");return H.fromJson(i)}catch(i){throw new a(`Failed to parse subject category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var b=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ct(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new It(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new qe(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Me(r)});}static getAllSubjectCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};b.REMOTE_DATA_SOURCE="SubjectCategoryRemoteDataSource",b.REPOSITORY="SubjectCategoryRepository",b.GET_ALL_USE_CASE="GetAllSubjectCategories",b.GET_BY_ID_USE_CASE="GetSubjectCategoryById";var Q=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {ind_id:this.id,ind_name:this.name}}static fromJson(t){return new o(Number(t.ind_id||t.id||0),String(t.ind_name||t.name||""))}};var We=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Tt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var _t=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Q.fromJson(s))}catch(i){throw new a(`Failed to parse strategic indicator: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Strategic indicator not found");let i=r.data[0];if(!i)throw new a("Strategic indicator data is empty");return Q.fromJson(i)}catch(i){throw new a(`Failed to parse strategic indicator data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var A=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Tt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new _t(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new We(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new je(r)});}static getAllStrategicIndicatorsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStrategicIndicatorByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};A.REMOTE_DATA_SOURCE="StrategicIndicatorRemoteDataSource",A.REPOSITORY="StrategicIndicatorRepository",A.GET_ALL_USE_CASE="GetAllStrategicIndicators",A.GET_BY_ID_USE_CASE="GetStrategicIndicatorById";var Z=class o extends l{constructor(t,r,i,s,u,y,R){super();this.id=t;this.title=r;this.subjectId=i;this.unit=s;this.verticalVariableCount=u;this.derivedVariableCount=y;this.graph=R;}toJson(){return {var_id:this.id,title:this.title,subject_id:this.subjectId,unit:this.unit,vertical_variable:this.verticalVariableCount,derived_variable:this.derivedVariableCount,graph:this.graph}}static fromJson(t){let r=t.graph||t.graphs,i=[];return Array.isArray(r)?i=r.map(s=>String(s)):typeof r=="string"&&(i=[r]),new o(Number(t.var_id||t.id||0),String(t.title||t.name||""),Number(t.subject_id||t.subjectId||0),String(t.unit||""),Number(t.vertical_variable||t.verticalVariableCount||0),Number(t.derived_variable||t.derivedVariableCount||0),i)}};var Ke=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Dt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.subjectId&&(t.subject=e.subjectId.toString()),e?.showDeleted!==void 0&&(t.show_deleted=e.showDeleted?"1":"0");let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Lt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Z.fromJson(s))}catch(i){throw new a(`Failed to parse variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Variable not found");let i=r.data[0];if(!i)throw new a("Variable data is empty");return Z.fromJson(i)}catch(i){throw new a(`Failed to parse variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var E=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Dt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Lt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ke(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ze(r)});}static getAllVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};E.REMOTE_DATA_SOURCE="VariableRemoteDataSource",E.REPOSITORY="VariableRepository",E.GET_ALL_USE_CASE="GetAllVariables",E.GET_BY_ID_USE_CASE="GetVariableById";var X=class o extends l{constructor(t,r,i,s){super();this.id=t;this.variableId=r;this.label=i;this.alias=s;}toJson(){return {vervar_id:this.id,var_id:this.variableId,label:this.label,alias:this.alias}}static fromJson(t){return new o(Number(t.vervar_id||t.id||0),Number(t.var_id||t.variableId||0),String(t.label||""),String(t.alias||""))}};var He=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var vt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var xt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>X.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>X.fromJson(s))}catch(i){throw new a(`Failed to parse vertical variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Vertical variable not found");let i=r.data[0];if(!i)throw new a("Vertical variable data is empty");return X.fromJson(i)}catch(i){throw new a(`Failed to parse vertical variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var C=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new vt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new xt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new He(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Qe(r)});}static getAllVerticalVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVerticalVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};C.REMOTE_DATA_SOURCE="VerticalVariableRemoteDataSource",C.REPOSITORY="VerticalVariableRepository",C.GET_ALL_USE_CASE="GetAllVerticalVariables",C.GET_BY_ID_USE_CASE="GetVerticalVariableById";var ee=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {unit_id:this.id,unit:this.name}}static fromJson(t){return new o(Number(t.unit_id||t.id||0),String(t.unit||t.name||""))}};var Ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var kt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.UNIT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.UNIT_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ut=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ee.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ee.fromJson(s))}catch(i){throw new a(`Failed to parse unit: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Unit not found");let i=r.data[0];if(!i)throw new a("Unit data is empty");return ee.fromJson(i)}catch(i){throw new a(`Failed to parse unit data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var I=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new kt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ut(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ze(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Xe(r)});}static getAllUnitsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getUnitByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};I.REMOTE_DATA_SOURCE="UnitRemoteDataSource",I.REPOSITORY="UnitRepository",I.GET_ALL_USE_CASE="GetAllUnits",I.GET_BY_ID_USE_CASE="GetUnitById";var te=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.period_id||t.id||0),String(t.label||t.name||""))}};var et=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var tt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ot=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Vt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>te.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>te.fromJson(s))}catch(i){throw new a(`Failed to parse period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Period not found");let i=r.data[0];if(!i)throw new a("Period data is empty");return te.fromJson(i)}catch(i){throw new a(`Failed to parse period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var T=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ot(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Vt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new et(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new tt(r)});}static getAllPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};T.REMOTE_DATA_SOURCE="PeriodRemoteDataSource",T.REPOSITORY="PeriodRepository",T.GET_ALL_USE_CASE="GetAllPeriods",T.GET_BY_ID_USE_CASE="GetPeriodById";var re=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {derived_period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.derived_period_id||t.id||0),String(t.label||t.name||""))}};var rt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var it=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Ft=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>re.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>re.fromJson(s))}catch(i){throw new a(`Failed to parse derived period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived period not found");let i=r.data[0];if(!i)throw new a("Derived period data is empty");return re.fromJson(i)}catch(i){throw new a(`Failed to parse derived period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var _=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new rt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new it(r)});}static getAllDerivedPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};_.REMOTE_DATA_SOURCE="DerivedPeriodRemoteDataSource",_.REPOSITORY="DerivedPeriodRepository",_.GET_ALL_USE_CASE="GetAllDerivedPeriods",_.GET_BY_ID_USE_CASE="GetDerivedPeriodById";var ie=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {derived_variable_id:this.id,derived_variable:this.name}}static fromJson(t){return new o(Number(t.derived_variable_id||t.id||0),String(t.derived_variable||t.name||""))}};var ot=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var st=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Nt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Gt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ie.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ie.fromJson(s))}catch(i){throw new a(`Failed to parse derived variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived variable not found");let i=r.data[0];if(!i)throw new a("Derived variable data is empty");return ie.fromJson(i)}catch(i){throw new a(`Failed to parse derived variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var D=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Nt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Gt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ot(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new st(r)});}static getAllDerivedVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};D.REMOTE_DATA_SOURCE="DerivedVariableRemoteDataSource",D.REPOSITORY="DerivedVariableRepository",D.GET_ALL_USE_CASE="GetAllDerivedVariables",D.GET_BY_ID_USE_CASE="GetDerivedVariableById";var oe=class o extends l{constructor(t,r){super();this.id=t;this.title=r;}toJson(){return {kbli_id:this.id,title:this.title}}static fromJson(t){return new o(String(t.kbli_id||t.id||""),String(t.title||t.name||""))}};var at=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var nt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var $t=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Jt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>oe.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>oe.fromJson(s))}catch(i){throw new a(`Failed to parse statistic classification: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Statistic classification not found");let i=r.data[0];if(!i)throw new a("Statistic classification data is empty");return oe.fromJson(i)}catch(i){throw new a(`Failed to parse statistic classification data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var L=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new $t(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Jt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new at(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new nt(r)});}static getAllStatisticClassificationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStatisticClassificationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};L.REMOTE_DATA_SOURCE="StatisticClassificationRemoteDataSource",L.REPOSITORY="StatisticClassificationRepository",L.GET_ALL_USE_CASE="GetAllStatisticClassifications",L.GET_BY_ID_USE_CASE="GetStatisticClassificationById";var se=class o extends l{constructor(t,r,i){super();this.id=t;this.activity=r;this.year=i;}toJson(){return {id:this.id,kegiatan:this.activity,tahun_kegiatan:this.year}}static fromJson(t){return new o(Number(t.id||0),String(t.kegiatan||t.activity||""),String(t.tahun_kegiatan||t.year||""))}};var lt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ct=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var yr=(t=>(t.ID="ind",t.EN="eng",t))(yr||{});var Rr=(r=>(r.AVAILABLE="available",r.NOT_AVAILABLE="not-available",r.LIST_NOT_AVAILABLE="list-not-available",r))(Rr||{});var qt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>se.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>se.fromJson(s))}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{return se.fromJson(r)}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var v=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new qt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new lt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ct(r)});}static getAllCensusesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getCensusByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};v.REMOTE_DATA_SOURCE="CensusRemoteDataSource",v.REPOSITORY="CensusRepository",v.GET_ALL_USE_CASE="GetAllCensuses",v.GET_BY_ID_USE_CASE="GetCensusById";var ye=class o extends l{constructor(t,r,i,s,u,y,R,Qt,x,Zt,fr,Sr){super();this.variableId=t;this.title=r;this.subjectId=i;this.subjectName=s;this.notes=u;this.unit=y;this.verticalVariableId=R;this.domain=Qt;this.csaSubjectId=x;this.csaSubjectName=Zt;this.graphId=fr;this.graphName=Sr;}toJson(){return {var:this.variableId,label:this.title,subj:this.subjectId,subj_label:this.subjectName,notes:this.notes,unit:this.unit,vervar:this.verticalVariableId,table:this.domain,subcsa:this.csaSubjectId,subcsa_label:this.csaSubjectName,graph:this.graphId,graph_label:this.graphName}}static fromJson(t){let r=t.var,i=t.subj;return new o(typeof r=="number"?r:parseInt(String(r||0)),String(t.label||""),typeof i=="number"?i:parseInt(String(i||0)),String(t.subj_label||""),String(t.notes||""),String(t.unit||""),Number(t.vervar||0),String(t.table||""),t.subcsa!==void 0?Number(t.subcsa):void 0,t.subcsa_label!==void 0?String(t.subcsa_label):void 0,t.graph!==void 0?Number(t.graph):void 0,t.graph_label!==void 0?String(t.graph_label):void 0)}};var ut=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Mt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain?t.domain=e.domain:t.domain=e.tableId,e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Wt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ye.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ye.fromJson(s))}catch(i){throw new a(`Failed to parse dynamic table: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var F=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Mt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Wt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ut(r)});}static getAllDynamicTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};F.REMOTE_DATA_SOURCE="DynamicTableRemoteDataSource",F.REPOSITORY="DynamicTableRepository",F.GET_ALL_USE_CASE="GetAllDynamicTables";var jt=class{constructor(e){this.injector=e;}async domains(e){return f.getAllDomainsUseCase(this.injector).execute(e)}async publications(e){return S.getAllPublicationsUseCase(this.injector).execute(e)}async infographics(e){return w.getAllInfographicsUseCase(this.injector).execute(e)}async news(e){return p.getAllNewsUseCase(this.injector).execute(e)}async newsCategories(e){return h.getAllNewsCategoriesUseCase(this.injector).execute(e)}async pressReleases(e){return d.getAllPressReleasesUseCase(this.injector).execute(e)}async staticTables(e){return g.getAllStaticTablesUseCase(this.injector).execute(e)}async subjects(e){return P.getAllSubjectsUseCase(this.injector).execute(e)}async subjectCategories(e){return b.getAllSubjectCategoriesUseCase(this.injector).execute(e)}async strategicIndicators(e){return A.getAllStrategicIndicatorsUseCase(this.injector).execute(e)}async variables(e){return E.getAllVariablesUseCase(this.injector).execute(e)}async verticalVariables(e){return C.getAllVerticalVariablesUseCase(this.injector).execute(e)}async units(e){return I.getAllUnitsUseCase(this.injector).execute(e)}async periods(e){return T.getAllPeriodsUseCase(this.injector).execute(e)}async derivedPeriods(e){return _.getAllDerivedPeriodsUseCase(this.injector).execute(e)}async derivedVariables(e){return D.getAllDerivedVariablesUseCase(this.injector).execute(e)}async statisticClassifications(e){return L.getAllStatisticClassificationsUseCase(this.injector).execute(e)}async censuses(e){return v.getAllCensusesUseCase(this.injector).execute(e)}async dynamicTables(e){return F.getAllDynamicTablesUseCase(this.injector).execute(e)}};var Kt=class{constructor(e){this.injector=e;}async domain(e){return f.getDomainByIdUseCase(this.injector).execute(e)}async publication(e){return S.getPublicationByIdUseCase(this.injector).execute(e)}async infographic(e){return w.getInfographicByIdUseCase(this.injector).execute(e)}async news(e){return p.getNewsByIdUseCase(this.injector).execute(e)}async newsCategory(e){return h.getNewsCategoryByIdUseCase(this.injector).execute(e)}async pressRelease(e){return d.getPressReleaseByIdUseCase(this.injector).execute(e)}async staticTable(e){return g.getStaticTableByIdUseCase(this.injector).execute(e)}async subject(e){return P.getSubjectByIdUseCase(this.injector).execute(e)}async subjectCategory(e){return b.getSubjectCategoryByIdUseCase(this.injector).execute(e)}async strategicIndicator(e){return A.getStrategicIndicatorByIdUseCase(this.injector).execute(e)}async variable(e){return E.getVariableByIdUseCase(this.injector).execute(e)}async verticalVariable(e){return C.getVerticalVariableByIdUseCase(this.injector).execute(e)}async unit(e){return I.getUnitByIdUseCase(this.injector).execute(e)}async period(e){return T.getPeriodByIdUseCase(this.injector).execute(e)}async derivedPeriod(e){return _.getDerivedPeriodByIdUseCase(this.injector).execute(e)}async derivedVariable(e){return D.getDerivedVariableByIdUseCase(this.injector).execute(e)}async statisticClassification(e){return L.getStatisticClassificationByIdUseCase(this.injector).execute(e)}async census(e){return v.getCensusByIdUseCase(this.injector).execute(e)}};var pr=class o extends l{constructor(t,r,i,s,u,y){super();this.value=t;this.netWeight=r;this.hsCode=i;this.port=s;this.country=u;this.year=y;}toJson(){return {value:this.value,netweight:this.netWeight,kodehs:this.hsCode,pod:this.port,ctr:this.country,tahun:this.year}}static fromJson(t){return new o(Number(t.value||0),Number(t.netweight||0),String(t.kodehs||""),String(t.pod||""),String(t.ctr||""),String(t.tahun||""))}};var mt=class{constructor(e){this.repository=e;}execute(e){return this.repository.get(e)}};var zt=class{constructor(e){this.client=e;}async get(e){let t={sumber:e.source.toString(),periode:e.period.toString(),kodehs:e.hsCode,jenishs:e.hsType.toString(),Tahun:e.year},r=new URLSearchParams(t).toString(),i=`${n.TRADE}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ht=class{constructor(e){this.remoteDataSource=e;}get(e){return this.remoteDataSource.get(e)}};var ae=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new zt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ht(r)}),e.registerFactory(this.GET_TRADE_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new mt(r)});}static getTradeUseCase(e){return e.resolve(this.GET_TRADE_USE_CASE)}};ae.REMOTE_DATA_SOURCE="TradeRemoteDataSource",ae.REPOSITORY="TradeRepository",ae.GET_TRADE_USE_CASE="GetTrade";var m=class m{constructor(e){this.logger=V.getInstance(),this.logger.configure({enabled:e.debug??false,filter:new N(e.logLevel??1)}),ne.getInstance().setApiKey(e.apiKey),this.authInterceptor=new Ce(e.apiKey);let t=[this.authInterceptor,...e.interceptors||[]];this.networkClient=new Ee({baseURL:e.baseURL||gt.BASE_URL,timeout:e.timeout||gt.DEFAULT_TIMEOUT,interceptors:t}),this.injector=Re.getInstance(),this.setupDependencies(),this._list=new jt(this.injector),this._view=new Kt(this.injector),this.logger.info("StadataJS initialized successfully");}static get instance(){if(!m._instance)throw new Error("StadataJS not initialized. Call StadataJS.init() first.");return m._instance}static init(e){return m._instance&&m._instance.logger.warn("StadataJS already initialized. Reinitializing..."),m._instance=new m(e),m._instance}static isInitialized(){return m._instance!==null}static destroy(){m._instance&&(m._instance.cleanup(),m._instance=null);}get list(){return this._list}get view(){return this._view}setApiKey(e){ne.getInstance().setApiKey(e),this.authInterceptor.setApiKey(e),this.logger.info("API key updated");}addInterceptor(e){this.networkClient.addInterceptor(e),this.logger.debug("Interceptor added");}removeInterceptor(e){this.networkClient.removeInterceptor(e),this.logger.debug("Interceptor removed");}enableDebug(){this.logger.enable(),this.logger.configure({filter:new N(0)});}disableDebug(){this.logger.configure({filter:new N(1)});}async trade(e){return this.injector.resolve("GetTrade").execute(e)}setupDependencies(){f.register(this.injector,this.networkClient),S.register(this.injector,this.networkClient),w.register(this.injector,this.networkClient),p.register(this.injector,this.networkClient),h.register(this.injector,this.networkClient),d.register(this.injector,this.networkClient),g.register(this.injector,this.networkClient),P.register(this.injector,this.networkClient),b.register(this.injector,this.networkClient),A.register(this.injector,this.networkClient),E.register(this.injector,this.networkClient),C.register(this.injector,this.networkClient),I.register(this.injector,this.networkClient),T.register(this.injector,this.networkClient),_.register(this.injector,this.networkClient),D.register(this.injector,this.networkClient),L.register(this.injector,this.networkClient),v.register(this.injector,this.networkClient),F.register(this.injector,this.networkClient),ae.register(this.injector,this.networkClient);}cleanup(){this.injector.clear(),ne.getInstance().clearApiKey(),this.logger.info("StadataJS cleaned up");}};m._instance=null;var dr=m;var Pr=(t=>(t[t.Export=1]="Export",t[t.Import=2]="Import",t))(Pr||{}),br=(t=>(t[t.Monthly=1]="Monthly",t[t.Annually=2]="Annually",t))(br||{}),Ar=(t=>(t[t.TwoDigit=1]="TwoDigit",t[t.Full=2]="Full",t))(Ar||{});
|
|
2
|
+
exports.ApiConstant=gt;exports.ApiEndpoint=n;exports.ApiException=j;exports.ApiFailure=k;exports.ApiResponse=ir;exports.AuthInterceptor=Ce;exports.BaseEntity=l;exports.CancelToken=ur;exports.CancelledException=ke;exports.CancelledFailure=fe;exports.Census=se;exports.ConsoleLogPrinter=pt;exports.DataAvailability=Rr;exports.DataLanguage=yr;exports.DateHelper=mr;exports.DerivedPeriod=re;exports.DerivedVariable=ie;exports.Domain=le;exports.DynamicTable=ye;exports.Failure=O;exports.ForbiddenException=lr;exports.ForbiddenFailure=be;exports.GetAllCensuses=lt;exports.GetAllDerivedPeriods=rt;exports.GetAllDerivedVariables=ot;exports.GetAllDomains=Ie;exports.GetAllDynamicTables=ut;exports.GetAllInfographics=ve;exports.GetAllNews=ce;exports.GetAllNewsCategories=Ve;exports.GetAllPeriods=et;exports.GetAllPressReleases=me;exports.GetAllPublications=De;exports.GetAllStaticTables=de;exports.GetAllStatisticClassifications=at;exports.GetAllStrategicIndicators=We;exports.GetAllSubjectCategories=qe;exports.GetAllSubjects=Je;exports.GetAllUnits=Ze;exports.GetAllVariables=Ke;exports.GetAllVerticalVariables=He;exports.GetCensusById=ct;exports.GetDerivedPeriodById=it;exports.GetDerivedVariableById=st;exports.GetDomainById=Te;exports.GetInfographicById=xe;exports.GetNewsById=ue;exports.GetNewsCategoryById=Fe;exports.GetPeriodById=tt;exports.GetPressReleaseById=pe;exports.GetPublicationById=Le;exports.GetStaticTableById=ge;exports.GetStatisticClassificationById=nt;exports.GetStrategicIndicatorById=je;exports.GetSubjectById=Ye;exports.GetSubjectCategoryById=Me;exports.GetTrade=mt;exports.GetUnitById=Xe;exports.GetVariableById=ze;exports.GetVerticalVariableById=Qe;exports.HSCodeType=Ar;exports.Infographic=M;exports.Injector=Re;exports.ListResult=c;exports.LogLevel=dt;exports.Logger=V;exports.LoggingInterceptor=er;exports.NetworkClient=Ee;exports.NetworkException=or;exports.NetworkFailure=Se;exports.News=$;exports.NewsCategory=K;exports.NoParamsUseCase=rr;exports.NotFoundException=ar;exports.NotFoundFailure=he;exports.Pagination=U;exports.ParseFailure=a;exports.Period=te;exports.PressRelease=J;exports.ProductionLogFilter=N;exports.Publication=q;exports.QueryParamConstant=hr;exports.RelatedPublication=_e;exports.RetryInterceptor=tr;exports.ServerException=cr;exports.ServerFailure=Ae;exports.StadataException=W;exports.StadataJS=dr;exports.StaticTable=Y;exports.StatisticClassification=oe;exports.StrategicIndicator=Q;exports.Subject=z;exports.SubjectCategory=H;exports.TimeoutException=sr;exports.TimeoutFailure=we;exports.Trade=pr;exports.TradePeriod=br;exports.TradeSource=Pr;exports.UnauthorizedException=nr;exports.UnauthorizedFailure=Pe;exports.Unit=ee;exports.UseCase=G;exports.ValidationFailure=Xt;exports.Variable=Z;exports.VerticalVariable=X;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {err,ok}from'neverthrow';var Re=class o{constructor(){this.container=new Map;this.factories=new Map;}static getInstance(){return o.instance||(o.instance=new o),o.instance}register(e,t){this.container.set(e,t);}registerFactory(e,t){this.factories.set(e,t);}resolve(e){if(this.container.has(e))return this.container.get(e);if(this.factories.has(e)){let t=this.factories.get(e);if(t){let r=t();return this.container.set(e,r),r}}throw new Error(`Dependency not found: ${e}`)}has(e){return this.container.has(e)||this.factories.has(e)}clear(){this.container.clear(),this.factories.clear();}remove(e){this.container.delete(e),this.factories.delete(e);}};var k=class o{constructor(e,t){this.message=e;this.code=t;}toString(){return `${this.constructor.name}: ${this.message}${this.code?` (${this.code})`:""}`}equals(e){return e instanceof o?this.message===e.message&&this.code===e.code&&this.constructor.name===e.constructor.name:false}},v=class extends k{constructor(t,r,i){super(t,i);this.statusCode=r;}},fe=class extends k{constructor(e="Request was cancelled"){super(e,"CANCELLED");}},Se=class extends k{constructor(e){super(e,"NETWORK_ERROR");}},we=class extends k{constructor(e="Request timeout"){super(e,"TIMEOUT");}},he=class extends v{constructor(e="Resource not found"){super(e,404,"NOT_FOUND");}},Pe=class extends v{constructor(e="Unauthorized"){super(e,401,"UNAUTHORIZED");}},be=class extends v{constructor(e="Forbidden"){super(e,403,"FORBIDDEN");}},Ae=class extends v{constructor(e="Server error",t=500){super(e,t,"SERVER_ERROR");}},a=class extends k{constructor(e){super(e,"PARSE_ERROR");}},Qt=class extends k{constructor(e){super(e,"VALIDATION_ERROR");}};var Ee=class{constructor(e={}){this.baseURL=e.baseURL||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.interceptors=e.interceptors||[];}addInterceptor(e){this.interceptors.push(e);}removeInterceptor(e){let t=this.interceptors.indexOf(e);t!==-1&&this.interceptors.splice(t,1);}async get(e,t){return this.request("GET",e,t)}async post(e,t){return this.request("POST",e,t)}async put(e,t){return this.request("PUT",e,t)}async delete(e,t){return this.request("DELETE",e,t)}async patch(e,t){return this.request("PATCH",e,t)}async request(e,t,r={}){try{let i=this.buildUrl(t),s={method:e,headers:{...this.defaultHeaders,...r.headers}};e!=="GET"&&r.body&&(s.body=JSON.stringify(r.body)),r.cancelToken&&(s.signal=r.cancelToken.signal);for(let Y of this.interceptors)Y.onRequest&&(s=await Y.onRequest(i,s));let m=await this.fetchWithTimeout(i,s,r.timeout||this.timeout);for(let Y of this.interceptors)Y.onResponse&&(m=await Y.onResponse(m));if(!m.ok)return err(await this.handleErrorResponse(m));let V=await m.json();return ok(V)}catch(i){return err(await this.handleError(i,r.cancelToken))}}async fetchWithTimeout(e,t,r){let i=new AbortController,s=setTimeout(()=>i.abort(),r);try{let u=t.signal&&t.signal instanceof AbortSignal?this.combineSignals(t.signal,i.signal):i.signal;return await fetch(e,{...t,signal:u})}finally{clearTimeout(s);}}combineSignals(e,t){let r=new AbortController,i=()=>r.abort();return e.addEventListener("abort",i),t.addEventListener("abort",i),r.signal}buildUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.baseURL}${e}`}async handleErrorResponse(e){let{status:t}=e,r;try{let i=await e.json();r=i.message||i.error||e.statusText;}catch{r=e.statusText;}switch(t){case 401:return new Pe(r);case 403:return new be(r);case 404:return new he(r);case 500:case 502:case 503:case 504:return new Ae(r,t);default:return new v(r,t)}}async handleError(e,t){let r=e instanceof Error?e:new Error(String(e));for(let i of this.interceptors)if(i.onError){let s=await i.onError(r);s&&(r=s);}return t?.isCancelled||e.name==="AbortError"?new fe(t?.reason):r.name==="AbortError"||r.message.includes("timeout")||r.message.includes("aborted")?new we:r.message.includes("network")||r.message.includes("fetch")||r.message.includes("ECONNREFUSED")?new Se(r.message):new v(r.message)}};var F=class{};var Ce=class extends F{constructor(t){super();this.apiKey=t;}onRequest(t,r){return new URL(t).searchParams.set("key",this.apiKey),{...r}}setApiKey(t){this.apiKey=t;}getApiKey(){return this.apiKey}};var dt=(u=>(u[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.FATAL=4]="FATAL",u[u.NONE=5]="NONE",u))(dt||{}),pt=class{print(e){let t=dt[e.level],i=`[${e.timestamp.toISOString()}] [${t}] ${e.message}`;switch(e.level){case 0:console.debug(i,e.data);break;case 1:console.info(i,e.data);break;case 2:console.warn(i,e.data);break;case 3:case 4:console.error(i,e.error||e.data);break}}},B=class{constructor(e=1){this.minLevel=e;}shouldLog(e){return e.level>=this.minLevel}},U=class o{constructor(e=new pt,t=new B){this.enabled=true;this.printer=e,this.filter=t;}static getInstance(){return o.instance||(o.instance=new o),o.instance}configure(e){e.printer&&(this.printer=e.printer),e.filter&&(this.filter=e.filter),e.enabled!==void 0&&(this.enabled=e.enabled);}debug(e,t){this.log(0,e,t);}info(e,t){this.log(1,e,t);}warn(e,t){this.log(2,e,t);}error(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(3,e,i,r);}fatal(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(4,e,i,r);}log(e,t,r,i){if(!this.enabled)return;let s={level:e,message:t,timestamp:new Date,data:r,error:i};this.filter.shouldLog(s)&&this.printer.print(s);}enable(){this.enabled=true;}disable(){this.enabled=false;}};var Zt=class extends F{constructor(e){super(),this.logger=e||U.getInstance();}onRequest(e,t){return this.logger.debug(`HTTP Request: ${t.method||"GET"} ${e}`,{headers:t.headers,body:t.body}),t}onResponse(e){return this.logger.debug(`HTTP Response: ${e.status} ${e.url}`,{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}),e}onError(e){return this.logger.error(`HTTP Error: ${e.message}`,e),e}};var Xt=class extends F{constructor(t={},r){super();this.retryCount=new Map;this.logger=r||U.getInstance(),this.config={maxRetries:t.maxRetries??3,retryDelay:t.retryDelay??1e3,retryableStatusCodes:t.retryableStatusCodes??[408,429,500,502,503,504],exponentialBackoff:t.exponentialBackoff??true};}async onResponse(t){let r=t.url,i=this.retryCount.get(r)||0;if(!t.ok&&this.config.retryableStatusCodes.includes(t.status)&&i<this.config.maxRetries){this.retryCount.set(r,i+1);let s=this.config.exponentialBackoff?this.config.retryDelay*Math.pow(2,i):this.config.retryDelay;throw this.logger.warn(`Retrying request (${i+1}/${this.config.maxRetries}) after ${s}ms: ${t.url}`),await this.sleep(s),new Error(`RETRY_NEEDED:${r}`)}return (t.ok||i>=this.config.maxRetries)&&this.retryCount.delete(r),t}sleep(t){return new Promise(r=>setTimeout(r,t))}resetRetryCount(t){this.retryCount.delete(t);}clearAllRetryCounts(){this.retryCount.clear();}};var gt={BASE_URL:"https://webapi.bps.go.id/v1/api",DEFAULT_TIMEOUT:3e4,API_VERSION:"v1",DEFAULT_PAGE_SIZE:10,MAX_PAGE_SIZE:100};var n={DOMAIN_LIST:"/list/domain",DOMAIN_VIEW:"/view/domain",PUBLICATION_LIST:"/list/publication",PUBLICATION_VIEW:"/view/publication",INFOGRAPHIC_LIST:"/list/infographic",INFOGRAPHIC_VIEW:"/view/infographic",STATIC_TABLE_LIST:"/list/statictable",STATIC_TABLE_VIEW:"/view/statictable",NEWS_LIST:"/list/news",NEWS_VIEW:"/view/news",NEWS_CATEGORY_LIST:"/list/newscategory",NEWS_CATEGORY_VIEW:"/view/newscategory",PRESS_RELEASE_LIST:"/list/pressrelease",PRESS_RELEASE_VIEW:"/view/pressrelease",SUBJECT_LIST:"/list/subject",SUBJECT_VIEW:"/view/subject",SUBJECT_CATEGORY_LIST:"/list/subjectcat",SUBJECT_CATEGORY_VIEW:"/view/subjectcat",STRATEGIC_INDICATOR_LIST:"/list/stratind",STRATEGIC_INDICATOR_VIEW:"/view/stratind",VARIABLE_LIST:"/list/var",VARIABLE_VIEW:"/view/var",VERTICAL_VARIABLE_LIST:"/list/vervar",VERTICAL_VARIABLE_VIEW:"/view/vervar",UNIT_LIST:"/list/unit",UNIT_VIEW:"/view/unit",PERIOD_LIST:"/list/period",PERIOD_VIEW:"/view/period",DERIVED_PERIOD_LIST:"/list/turth",DERIVED_PERIOD_VIEW:"/view/turth",DERIVED_VARIABLE_LIST:"/list/turvar",DERIVED_VARIABLE_VIEW:"/view/turvar",DYNAMIC_TABLE_LIST:"/list/dynamictable",STATISTIC_CLASSIFICATION_LIST:"/list/kbli",STATISTIC_CLASSIFICATION_VIEW:"/view/kbli",CENSUS_LIST:"/list/sensus",CENSUS_VIEW:"/view/sensus",TRADE:"/dataexim"};var hr={KEY:"key",DOMAIN:"domain",LANG:"lang",PAGE:"page",PER_PAGE:"per_page",KEYWORD:"keyword",MONTH:"month",YEAR:"year",SUBJECT:"subj",VARIABLE:"var",TURVAR:"turvar",TURTH:"turth",PERIOD:"th",TYPE:"type",TABLE:"table",MODEL:"model",ID:"id",SHOW_DELETED:"show_deleted"};var ne=class o{constructor(){this._apiKey=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}setApiKey(e){this._apiKey=e;}getApiKey(){if(!this._apiKey)throw new Error("API key not set. Call setApiKey() first.");return this._apiKey}hasApiKey(){return this._apiKey!==null}clearApiKey(){this._apiKey=null;}};var l=class o{toString(){return JSON.stringify(this.toJson(),null,2)}equals(e){return e instanceof o?JSON.stringify(this.toJson())===JSON.stringify(e.toJson()):false}copyWith(e){let r={...this.toJson(),...e};return Object.assign(Object.create(Object.getPrototypeOf(this)),r)}};var N=class{},er=class extends N{call(){return this.execute()}};var le=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.url=i;}toJson(){return {domain_id:this.id,domain_name:this.name,domain_url:this.url}}static fromJson(t){return new o(t.domain_id||t.id||"",t.domain_name||t.name||"",t.domain_url||t.url||"")}};var Ie=class extends N{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getAll(t)}};var Te=class extends N{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getById(t)}};var yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.perPage&&(t.per_page=e.perPage.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang),e.id&&(t.id=e.id.toString());let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_VIEW}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var x=class o extends l{constructor(t,r,i,s,u){super();this.page=t;this.perPage=r;this.total=i;this.pages=s;this.count=u;}get hasNextPage(){return this.page<this.pages}get hasPreviousPage(){return this.page>1}get nextPage(){return this.hasNextPage?this.page+1:null}get previousPage(){return this.hasPreviousPage?this.page-1:null}toJson(){return {page:this.page,per_page:this.perPage,total:this.total,pages:this.pages,count:this.count}}static fromJson(t){return new o(t.page||1,t.per_page||10,t.total||0,t.pages||0,t.count||0)}};var tr=class o extends l{constructor(t,r,i){super();this.data=t;this.dataAvailability=r;this.pagination=i;}get isAvailable(){return this.dataAvailability==="available"}get totalItems(){return this.pagination?.total||this.data.length}get hasData(){return this.data.length>0}toJson(){return {data:this.data,data_availability:this.dataAvailability,pagination:this.pagination?.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(V=>r(V)),u=t.pagination,m=u?x.fromJson(u):void 0;return new o(s,t["data-availability"]||"available",m)}};var c=class o extends l{constructor(t,r){super();this.data=t;this.pagination=r;}get hasMore(){return this.pagination.hasNextPage}get totalItems(){return this.pagination.total}get items(){return this.data}get itemCount(){return this.data.length}toJson(){return {data:this.data,pagination:this.pagination.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(V=>r(V)),u=t.pagination,m=x.fromJson(u);return new o(s,m)}};var Rt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(u=>le.fromJson(u)),s=r.pagination?x.fromJson(r.pagination):new x(1,i.length,i.length,1,i.length);return new c(i,s)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Domain not found");let i=r.data[0];if(!i)throw new a("Domain data is empty");return le.fromJson(i)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var R=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Rt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ie(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Te(r)});}static getAllDomainsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDomainByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};R.REMOTE_DATA_SOURCE="DomainRemoteDataSource",R.REPOSITORY="DomainRepository",R.GET_ALL_USE_CASE="GetAllDomains",R.GET_BY_ID_USE_CASE="GetDomainById";var _e=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.releaseDate=i;this.url=s;this.cover=u;}toJson(){return {id:this.id,title:this.title,rl_date:this.releaseDate.toISOString().split("T")[0],url:this.url,cover:this.cover}}static fromJson(t){return new o(String(t.id||""),String(t.title||""),new Date(String(t.rl_date||t.release_date||t.releaseDate||"")),String(t.url||""),String(t.cover||""))}};var q=class o extends l{constructor(t,r,i,s,u,m,V,Y,yr,Rr,fr,Sr,Er){super();this.id=t;this.title=r;this.issn=i;this.cover=s;this.pdf=u;this.size=m;this.scheduledDate=V;this.releaseDate=Y;this.updateDate=yr;this.abstract=Rr;this.catalogueNumber=fr;this.publicationNumber=Sr;this.relatedPublications=Er;}toJson(){return {id:this.id,title:this.title,issn:this.issn,cover:this.cover,pdf:this.pdf,size:this.size,scheduled_date:this.scheduledDate?.toISOString().split("T")[0]||null,rl_date:this.releaseDate?.toISOString().split("T")[0]||null,updt_date:this.updateDate?.toISOString().split("T")[0]||null,abstract:this.abstract,catalogue_number:this.catalogueNumber,publication_number:this.publicationNumber,related_publications:this.relatedPublications.map(t=>t.toJson())}}static fromJson(t){let r=t.related_publications||t.relatedPublications,i=Array.isArray(r)?r.map(s=>_e.fromJson(s)):[];return new o(String(t.id||""),String(t.title||""),String(t.issn||""),String(t.cover||""),String(t.pdf||""),String(t.size||""),t.scheduled_date||t.scheduledDate?new Date(String(t.scheduled_date||t.scheduledDate)):null,t.rl_date||t.release_date||t.releaseDate?new Date(String(t.rl_date||t.release_date||t.releaseDate)):null,t.updt_date||t.update_date||t.updateDate?new Date(String(t.updt_date||t.update_date||t.updateDate)):null,t.abstract?String(t.abstract):null,t.catalogue_number||t.catalogueNumber?String(t.catalogue_number||t.catalogueNumber):null,t.publication_number||t.publicationNumber?String(t.publication_number||t.publicationNumber):null,i)}};var De=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Le=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var ft=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var St=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>q.fromJson(s))}catch(i){throw new a(`Failed to parse publications: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Publication not found");let i=r.data[0];if(!i)throw new a("Publication data is empty");return q.fromJson(i)}catch(i){throw new a(`Failed to parse publication data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var f=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new St(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new De(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Le(r)});}static getAllPublicationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPublicationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};f.REMOTE_DATA_SOURCE="PublicationRemoteDataSource",f.REPOSITORY="PublicationRepository",f.GET_ALL_USE_CASE="GetAllPublications",f.GET_BY_ID_USE_CASE="GetPublicationById";var M=class o extends l{constructor(t,r,i,s,u,m){super();this.id=t;this.title=r;this.image=i;this.category=s;this.downloadUrl=u;this.description=m;}toJson(){return {inf_id:this.id,title:this.title,img:this.image,category:this.category,dl:this.downloadUrl,desc:this.description}}static fromJson(t){return new o(String(t.inf_id||t.id||""),String(t.title||""),String(t.img||t.image||""),Number(t.category||0),String(t.dl||t.downloadUrl||""),t.desc||t.description?String(t.desc||t.description):null)}};var ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var wt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ht=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>M.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>M.fromJson(s))}catch(i){throw new a(`Failed to parse infographics: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Infographic not found");let i=r.data[0];if(!i)throw new a("Infographic data is empty");return M.fromJson(i)}catch(i){throw new a(`Failed to parse infographic data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var S=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new wt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ht(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new xe(r)});}static getAllInfographicsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getInfographicByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};S.REMOTE_DATA_SOURCE="InfographicRemoteDataSource",S.REPOSITORY="InfographicRepository",S.GET_ALL_USE_CASE="GetAllInfographics",S.GET_BY_ID_USE_CASE="GetInfographicById";var W=class o extends Error{constructor(e){super(e),this.name="StadataException",Object.setPrototypeOf(this,o.prototype);}},K=class o extends W{constructor(t,r,i){super(t);this.statusCode=r;this.response=i;this.name="ApiException",Object.setPrototypeOf(this,o.prototype);}},ke=class o extends W{constructor(e="Request was cancelled"){super(e),this.name="CancelledException",Object.setPrototypeOf(this,o.prototype);}},rr=class o extends W{constructor(e){super(e),this.name="NetworkException",Object.setPrototypeOf(this,o.prototype);}},ir=class o extends W{constructor(e="Request timeout"){super(e),this.name="TimeoutException",Object.setPrototypeOf(this,o.prototype);}},or=class o extends K{constructor(e="Resource not found"){super(e,404),this.name="NotFoundException",Object.setPrototypeOf(this,o.prototype);}},sr=class o extends K{constructor(e="Unauthorized"){super(e,401),this.name="UnauthorizedException",Object.setPrototypeOf(this,o.prototype);}},ar=class o extends K{constructor(e="Forbidden"){super(e,403),this.name="ForbiddenException",Object.setPrototypeOf(this,o.prototype);}},nr=class o extends K{constructor(e="Server error",t=500){super(e,t),this.name="ServerException",Object.setPrototypeOf(this,o.prototype);}};var lr=class o{constructor(){this._isCancelled=false;this.abortController=new AbortController;}get signal(){return this.abortController.signal}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isCancelled||(this._isCancelled=true,this._reason=e,this.abortController.abort());}throwIfCancelled(){if(this._isCancelled)throw new ke(this._reason||"Request was cancelled")}static create(){return new o}static source(){let e=new o;return {token:e,cancel:t=>e.cancel(t)}}};var cr=class{static parse(e){if(!e)return null;try{let t=new Date(e);return isNaN(t.getTime())?null:t}catch{return null}}static format(e){if(!e||!(e instanceof Date))return null;try{return e.toISOString()}catch{return null}}static formatReadable(e){if(!e||!(e instanceof Date))return null;try{return e.toLocaleDateString("id-ID",{year:"numeric",month:"long",day:"numeric"})}catch{return null}}static isValid(e){return this.parse(e)!==null}static toTimestamp(e){let t=this.parse(e);return t?t.getTime():null}static fromTimestamp(e){return new Date(e)}static now(){return new Date().toISOString()}static nowTimestamp(){return Date.now()}};var G=class o extends l{constructor(t,r,i,s,u,m){super();this.id=t;this.title=r;this.content=i;this.releaseDate=s;this.categoryId=u;this.picture=m;}toJson(){return {news_id:this.id,title:this.title,news_content:this.content,rl_date:this.releaseDate,category_id:this.categoryId,picture:this.picture}}static fromJson(t){return new o(String(t.news_id||t.id||""),String(t.title||""),String(t.news_content||t.content||""),String(t.rl_date||t.releaseDate||""),Number(t.category_id||t.categoryId||0),t.picture?String(t.picture):null)}};var ce=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ue=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ue=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString()),e.newsCategoryId&&(t.news_category_id=e.newsCategoryId);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Oe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>G.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>G.fromJson(s))}catch(i){throw new a(`Failed to parse news: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News not found");let i=r.data[0];if(!i)throw new a("News data is empty");return G.fromJson(i)}catch(i){throw new a(`Failed to parse news data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var d=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ue(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Oe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ce(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ue(r)});}static getAllNewsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};d.REMOTE_DATA_SOURCE="NewsRemoteDataSource",d.REPOSITORY="NewsRepository",d.GET_ALL_USE_CASE="GetAllNews",d.GET_BY_ID_USE_CASE="GetNewsById";var j=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {category_id:this.id,category_name:this.name}}static fromJson(t){return new o(String(t.category_id||t.id||""),String(t.category_name||t.name||""))}};var Ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Fe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Pt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>j.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>j.fromJson(s))}catch(i){throw new a(`Failed to parse news category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News category not found");let i=r.data[0];if(!i)throw new a("News category data is empty");return j.fromJson(i)}catch(i){throw new a(`Failed to parse news category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var w=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Pt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Fe(r)});}static getAllNewsCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};w.REMOTE_DATA_SOURCE="NewsCategoryRemoteDataSource",w.REPOSITORY="NewsCategoryRepository",w.GET_ALL_USE_CASE="GetAllNewsCategories",w.GET_BY_ID_USE_CASE="GetNewsCategoryById";var $=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.abstract=i;this.releaseDate=s;this.picture=u;}toJson(){return {rl_id:this.id,title:this.title,abstract:this.abstract,rl_date:this.releaseDate,picture:this.picture}}static fromJson(t){return new o(String(t.rl_id||t.id||""),String(t.title||""),String(t.abstract||""),String(t.rl_date||t.releaseDate||""),t.picture?String(t.picture):null)}};var me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var pe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Be=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ne=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>$.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>$.fromJson(s))}catch(i){throw new a(`Failed to parse press releases: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Press release not found");let i=r.data[0];if(!i)throw new a("Press release data is empty");return $.fromJson(i)}catch(i){throw new a(`Failed to parse press release data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var g=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Be(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ne(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new me(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new pe(r)});}static getAllPressReleasesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPressReleaseByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};g.REMOTE_DATA_SOURCE="PressReleaseRemoteDataSource",g.REPOSITORY="PressReleaseRepository",g.GET_ALL_USE_CASE="GetAllPressReleases",g.GET_BY_ID_USE_CASE="GetPressReleaseById";var J=class o extends l{constructor(t,r,i,s,u,m){super();this.id=t;this.title=r;this.subjectId=i;this.size=s;this.updatedAt=u;this.excelUrl=m;}toJson(){return {table_id:this.id,title:this.title,subj_id:this.subjectId,size:this.size,updt_date:this.updatedAt,excel:this.excelUrl}}static fromJson(t){return new o(String(t.table_id||t.id||""),String(t.title||""),Number(t.subj_id||t.subjectId||0),String(t.size||""),String(t.updt_date||t.updatedAt||""),String(t.excel||t.excelUrl||""))}};var de=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ge=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ge=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var $e=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>J.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>J.fromJson(s))}catch(i){throw new a(`Failed to parse static tables: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Static table not found");let i=r.data[0];if(!i)throw new a("Static table data is empty");return J.fromJson(i)}catch(i){throw new a(`Failed to parse static table data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var y=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ge(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new $e(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new de(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ge(r)});}static getAllStaticTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStaticTableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};y.REMOTE_DATA_SOURCE="StaticTableRemoteDataSource",y.REPOSITORY="StaticTableRepository",y.GET_ALL_USE_CASE="GetAllStaticTables",y.GET_BY_ID_USE_CASE="GetStaticTableById";var z=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.categoryId=i;}toJson(){return {subj_id:this.id,title:this.name,subcatid:this.categoryId}}static fromJson(t){return new o(Number(t.subj_id||t.id||0),String(t.title||t.name||""),Number(t.subcatid||t.categoryId||0))}};var Je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ye=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var At=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Et=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>z.fromJson(s))}catch(i){throw new a(`Failed to parse subject: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject not found");let i=r.data[0];if(!i)throw new a("Subject data is empty");return z.fromJson(i)}catch(i){throw new a(`Failed to parse subject data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var h=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new At(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Et(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ye(r)});}static getAllSubjectsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};h.REMOTE_DATA_SOURCE="SubjectRemoteDataSource",h.REPOSITORY="SubjectRepository",h.GET_ALL_USE_CASE="GetAllSubjects",h.GET_BY_ID_USE_CASE="GetSubjectById";var H=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {subcat_id:this.id,subcat_name:this.name}}static fromJson(t){return new o(Number(t.subcat_id||t.id||0),String(t.subcat_name||t.name||""))}};var qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ct=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var It=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>H.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>H.fromJson(s))}catch(i){throw new a(`Failed to parse subject category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject category not found");let i=r.data[0];if(!i)throw new a("Subject category data is empty");return H.fromJson(i)}catch(i){throw new a(`Failed to parse subject category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var P=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ct(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new It(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new qe(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Me(r)});}static getAllSubjectCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};P.REMOTE_DATA_SOURCE="SubjectCategoryRemoteDataSource",P.REPOSITORY="SubjectCategoryRepository",P.GET_ALL_USE_CASE="GetAllSubjectCategories",P.GET_BY_ID_USE_CASE="GetSubjectCategoryById";var Q=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {ind_id:this.id,ind_name:this.name}}static fromJson(t){return new o(Number(t.ind_id||t.id||0),String(t.ind_name||t.name||""))}};var We=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ke=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Tt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var _t=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Q.fromJson(s))}catch(i){throw new a(`Failed to parse strategic indicator: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Strategic indicator not found");let i=r.data[0];if(!i)throw new a("Strategic indicator data is empty");return Q.fromJson(i)}catch(i){throw new a(`Failed to parse strategic indicator data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var b=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Tt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new _t(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new We(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ke(r)});}static getAllStrategicIndicatorsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStrategicIndicatorByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};b.REMOTE_DATA_SOURCE="StrategicIndicatorRemoteDataSource",b.REPOSITORY="StrategicIndicatorRepository",b.GET_ALL_USE_CASE="GetAllStrategicIndicators",b.GET_BY_ID_USE_CASE="GetStrategicIndicatorById";var Z=class o extends l{constructor(t,r,i,s,u,m,V){super();this.id=t;this.title=r;this.subjectId=i;this.unit=s;this.verticalVariableCount=u;this.derivedVariableCount=m;this.graph=V;}toJson(){return {var_id:this.id,title:this.title,subject_id:this.subjectId,unit:this.unit,vertical_variable:this.verticalVariableCount,derived_variable:this.derivedVariableCount,graph:this.graph}}static fromJson(t){let r=t.graph||t.graphs,i=[];return Array.isArray(r)?i=r.map(s=>String(s)):typeof r=="string"&&(i=[r]),new o(Number(t.var_id||t.id||0),String(t.title||t.name||""),Number(t.subject_id||t.subjectId||0),String(t.unit||""),Number(t.vertical_variable||t.verticalVariableCount||0),Number(t.derived_variable||t.derivedVariableCount||0),i)}};var je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Dt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.subjectId&&(t.subject=e.subjectId.toString()),e?.showDeleted!==void 0&&(t.show_deleted=e.showDeleted?"1":"0");let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Lt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Z.fromJson(s))}catch(i){throw new a(`Failed to parse variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Variable not found");let i=r.data[0];if(!i)throw new a("Variable data is empty");return Z.fromJson(i)}catch(i){throw new a(`Failed to parse variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var A=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Dt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Lt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ze(r)});}static getAllVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};A.REMOTE_DATA_SOURCE="VariableRemoteDataSource",A.REPOSITORY="VariableRepository",A.GET_ALL_USE_CASE="GetAllVariables",A.GET_BY_ID_USE_CASE="GetVariableById";var X=class o extends l{constructor(t,r,i,s){super();this.id=t;this.variableId=r;this.label=i;this.alias=s;}toJson(){return {vervar_id:this.id,var_id:this.variableId,label:this.label,alias:this.alias}}static fromJson(t){return new o(Number(t.vervar_id||t.id||0),Number(t.var_id||t.variableId||0),String(t.label||""),String(t.alias||""))}};var He=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var vt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var xt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>X.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>X.fromJson(s))}catch(i){throw new a(`Failed to parse vertical variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Vertical variable not found");let i=r.data[0];if(!i)throw new a("Vertical variable data is empty");return X.fromJson(i)}catch(i){throw new a(`Failed to parse vertical variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var E=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new vt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new xt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new He(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Qe(r)});}static getAllVerticalVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVerticalVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};E.REMOTE_DATA_SOURCE="VerticalVariableRemoteDataSource",E.REPOSITORY="VerticalVariableRepository",E.GET_ALL_USE_CASE="GetAllVerticalVariables",E.GET_BY_ID_USE_CASE="GetVerticalVariableById";var ee=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {unit_id:this.id,unit:this.name}}static fromJson(t){return new o(Number(t.unit_id||t.id||0),String(t.unit||t.name||""))}};var Ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var kt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.UNIT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.UNIT_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ut=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ee.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ee.fromJson(s))}catch(i){throw new a(`Failed to parse unit: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Unit not found");let i=r.data[0];if(!i)throw new a("Unit data is empty");return ee.fromJson(i)}catch(i){throw new a(`Failed to parse unit data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var C=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new kt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ut(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ze(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Xe(r)});}static getAllUnitsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getUnitByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};C.REMOTE_DATA_SOURCE="UnitRemoteDataSource",C.REPOSITORY="UnitRepository",C.GET_ALL_USE_CASE="GetAllUnits",C.GET_BY_ID_USE_CASE="GetUnitById";var te=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.period_id||t.id||0),String(t.label||t.name||""))}};var et=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var tt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ot=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Vt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>te.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>te.fromJson(s))}catch(i){throw new a(`Failed to parse period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Period not found");let i=r.data[0];if(!i)throw new a("Period data is empty");return te.fromJson(i)}catch(i){throw new a(`Failed to parse period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var I=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ot(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Vt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new et(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new tt(r)});}static getAllPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};I.REMOTE_DATA_SOURCE="PeriodRemoteDataSource",I.REPOSITORY="PeriodRepository",I.GET_ALL_USE_CASE="GetAllPeriods",I.GET_BY_ID_USE_CASE="GetPeriodById";var re=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {derived_period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.derived_period_id||t.id||0),String(t.label||t.name||""))}};var rt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var it=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Ft=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>re.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>re.fromJson(s))}catch(i){throw new a(`Failed to parse derived period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived period not found");let i=r.data[0];if(!i)throw new a("Derived period data is empty");return re.fromJson(i)}catch(i){throw new a(`Failed to parse derived period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var T=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new rt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new it(r)});}static getAllDerivedPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};T.REMOTE_DATA_SOURCE="DerivedPeriodRemoteDataSource",T.REPOSITORY="DerivedPeriodRepository",T.GET_ALL_USE_CASE="GetAllDerivedPeriods",T.GET_BY_ID_USE_CASE="GetDerivedPeriodById";var ie=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {derived_variable_id:this.id,derived_variable:this.name}}static fromJson(t){return new o(Number(t.derived_variable_id||t.id||0),String(t.derived_variable||t.name||""))}};var ot=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var st=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Nt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Gt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ie.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ie.fromJson(s))}catch(i){throw new a(`Failed to parse derived variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived variable not found");let i=r.data[0];if(!i)throw new a("Derived variable data is empty");return ie.fromJson(i)}catch(i){throw new a(`Failed to parse derived variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var _=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Nt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Gt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ot(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new st(r)});}static getAllDerivedVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};_.REMOTE_DATA_SOURCE="DerivedVariableRemoteDataSource",_.REPOSITORY="DerivedVariableRepository",_.GET_ALL_USE_CASE="GetAllDerivedVariables",_.GET_BY_ID_USE_CASE="GetDerivedVariableById";var oe=class o extends l{constructor(t,r){super();this.id=t;this.title=r;}toJson(){return {kbli_id:this.id,title:this.title}}static fromJson(t){return new o(String(t.kbli_id||t.id||""),String(t.title||t.name||""))}};var at=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var nt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var $t=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Jt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>oe.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>oe.fromJson(s))}catch(i){throw new a(`Failed to parse statistic classification: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Statistic classification not found");let i=r.data[0];if(!i)throw new a("Statistic classification data is empty");return oe.fromJson(i)}catch(i){throw new a(`Failed to parse statistic classification data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var D=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new $t(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Jt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new at(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new nt(r)});}static getAllStatisticClassificationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStatisticClassificationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};D.REMOTE_DATA_SOURCE="StatisticClassificationRemoteDataSource",D.REPOSITORY="StatisticClassificationRepository",D.GET_ALL_USE_CASE="GetAllStatisticClassifications",D.GET_BY_ID_USE_CASE="GetStatisticClassificationById";var se=class o extends l{constructor(t,r,i){super();this.id=t;this.activity=r;this.year=i;}toJson(){return {id:this.id,kegiatan:this.activity,tahun_kegiatan:this.year}}static fromJson(t){return new o(Number(t.id||0),String(t.kegiatan||t.activity||""),String(t.tahun_kegiatan||t.year||""))}};var lt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ct=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var dr=(t=>(t.ID="ind",t.EN="eng",t))(dr||{});var gr=(r=>(r.AVAILABLE="available",r.NOT_AVAILABLE="not-available",r.LIST_NOT_AVAILABLE="list-not-available",r))(gr||{});var qt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>se.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>se.fromJson(s))}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{return se.fromJson(r)}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var L=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new qt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new lt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ct(r)});}static getAllCensusesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getCensusByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};L.REMOTE_DATA_SOURCE="CensusRemoteDataSource",L.REPOSITORY="CensusRepository",L.GET_ALL_USE_CASE="GetAllCensuses",L.GET_BY_ID_USE_CASE="GetCensusById";var ye=class o extends l{constructor(t,r,i,s,u,m,V,Y,yr,Rr,fr,Sr){super();this.variableId=t;this.title=r;this.subjectId=i;this.subjectName=s;this.notes=u;this.unit=m;this.verticalVariableId=V;this.domain=Y;this.csaSubjectId=yr;this.csaSubjectName=Rr;this.graphId=fr;this.graphName=Sr;}toJson(){return {var:this.variableId,label:this.title,subj:this.subjectId,subj_label:this.subjectName,notes:this.notes,unit:this.unit,vervar:this.verticalVariableId,table:this.domain,subcsa:this.csaSubjectId,subcsa_label:this.csaSubjectName,graph:this.graphId,graph_label:this.graphName}}static fromJson(t){let r=t.var,i=t.subj;return new o(typeof r=="number"?r:parseInt(String(r||0)),String(t.label||""),typeof i=="number"?i:parseInt(String(i||0)),String(t.subj_label||""),String(t.notes||""),String(t.unit||""),Number(t.vervar||0),String(t.table||""),t.subcsa!==void 0?Number(t.subcsa):void 0,t.subcsa_label!==void 0?String(t.subcsa_label):void 0,t.graph!==void 0?Number(t.graph):void 0,t.graph_label!==void 0?String(t.graph_label):void 0)}};var ut=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Mt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain?t.domain=e.domain:t.domain=e.tableId,e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Wt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ye.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ye.fromJson(s))}catch(i){throw new a(`Failed to parse dynamic table: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var O=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Mt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Wt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ut(r)});}static getAllDynamicTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};O.REMOTE_DATA_SOURCE="DynamicTableRemoteDataSource",O.REPOSITORY="DynamicTableRepository",O.GET_ALL_USE_CASE="GetAllDynamicTables";var Kt=class{constructor(e){this.injector=e;}async domains(e){return R.getAllDomainsUseCase(this.injector).execute(e)}async publications(e){return f.getAllPublicationsUseCase(this.injector).execute(e)}async infographics(e){return S.getAllInfographicsUseCase(this.injector).execute(e)}async news(e){return d.getAllNewsUseCase(this.injector).execute(e)}async newsCategories(e){return w.getAllNewsCategoriesUseCase(this.injector).execute(e)}async pressReleases(e){return g.getAllPressReleasesUseCase(this.injector).execute(e)}async staticTables(e){return y.getAllStaticTablesUseCase(this.injector).execute(e)}async subjects(e){return h.getAllSubjectsUseCase(this.injector).execute(e)}async subjectCategories(e){return P.getAllSubjectCategoriesUseCase(this.injector).execute(e)}async strategicIndicators(e){return b.getAllStrategicIndicatorsUseCase(this.injector).execute(e)}async variables(e){return A.getAllVariablesUseCase(this.injector).execute(e)}async verticalVariables(e){return E.getAllVerticalVariablesUseCase(this.injector).execute(e)}async units(e){return C.getAllUnitsUseCase(this.injector).execute(e)}async periods(e){return I.getAllPeriodsUseCase(this.injector).execute(e)}async derivedPeriods(e){return T.getAllDerivedPeriodsUseCase(this.injector).execute(e)}async derivedVariables(e){return _.getAllDerivedVariablesUseCase(this.injector).execute(e)}async statisticClassifications(e){return D.getAllStatisticClassificationsUseCase(this.injector).execute(e)}async censuses(e){return L.getAllCensusesUseCase(this.injector).execute(e)}async dynamicTables(e){return O.getAllDynamicTablesUseCase(this.injector).execute(e)}};var jt=class{constructor(e){this.injector=e;}async domain(e){return R.getDomainByIdUseCase(this.injector).execute(e)}async publication(e){return f.getPublicationByIdUseCase(this.injector).execute(e)}async infographic(e){return S.getInfographicByIdUseCase(this.injector).execute(e)}async news(e){return d.getNewsByIdUseCase(this.injector).execute(e)}async newsCategory(e){return w.getNewsCategoryByIdUseCase(this.injector).execute(e)}async pressRelease(e){return g.getPressReleaseByIdUseCase(this.injector).execute(e)}async staticTable(e){return y.getStaticTableByIdUseCase(this.injector).execute(e)}async subject(e){return h.getSubjectByIdUseCase(this.injector).execute(e)}async subjectCategory(e){return P.getSubjectCategoryByIdUseCase(this.injector).execute(e)}async strategicIndicator(e){return b.getStrategicIndicatorByIdUseCase(this.injector).execute(e)}async variable(e){return A.getVariableByIdUseCase(this.injector).execute(e)}async verticalVariable(e){return E.getVerticalVariableByIdUseCase(this.injector).execute(e)}async unit(e){return C.getUnitByIdUseCase(this.injector).execute(e)}async period(e){return I.getPeriodByIdUseCase(this.injector).execute(e)}async derivedPeriod(e){return T.getDerivedPeriodByIdUseCase(this.injector).execute(e)}async derivedVariable(e){return _.getDerivedVariableByIdUseCase(this.injector).execute(e)}async statisticClassification(e){return D.getStatisticClassificationByIdUseCase(this.injector).execute(e)}async census(e){return L.getCensusByIdUseCase(this.injector).execute(e)}};var ur=class o extends l{constructor(t,r,i,s,u,m){super();this.value=t;this.netWeight=r;this.hsCode=i;this.port=s;this.country=u;this.year=m;}toJson(){return {value:this.value,netweight:this.netWeight,kodehs:this.hsCode,pod:this.port,ctr:this.country,tahun:this.year}}static fromJson(t){return new o(Number(t.value||0),Number(t.netweight||0),String(t.kodehs||""),String(t.pod||""),String(t.ctr||""),String(t.tahun||""))}};var mt=class{constructor(e){this.repository=e;}execute(e){return this.repository.get(e)}};var zt=class{constructor(e){this.client=e;}async get(e){let t={sumber:e.source.toString(),periode:e.period.toString(),kodehs:e.hsCode,jenishs:e.hsType.toString(),Tahun:e.year},r=new URLSearchParams(t).toString(),i=`${n.TRADE}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ht=class{constructor(e){this.remoteDataSource=e;}get(e){return this.remoteDataSource.get(e)}};var ae=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new zt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ht(r)}),e.registerFactory(this.GET_TRADE_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new mt(r)});}static getTradeUseCase(e){return e.resolve(this.GET_TRADE_USE_CASE)}};ae.REMOTE_DATA_SOURCE="TradeRemoteDataSource",ae.REPOSITORY="TradeRepository",ae.GET_TRADE_USE_CASE="GetTrade";var p=class p{constructor(e){this.logger=U.getInstance(),this.logger.configure({enabled:e.debug??false,filter:new B(e.logLevel??1)}),ne.getInstance().setApiKey(e.apiKey),this.authInterceptor=new Ce(e.apiKey);let t=[this.authInterceptor,...e.interceptors||[]];this.networkClient=new Ee({baseURL:e.baseURL||gt.BASE_URL,timeout:e.timeout||gt.DEFAULT_TIMEOUT,interceptors:t}),this.injector=Re.getInstance(),this.setupDependencies(),this._list=new Kt(this.injector),this._view=new jt(this.injector),this.logger.info("StadataJS initialized successfully");}static get instance(){if(!p._instance)throw new Error("StadataJS not initialized. Call StadataJS.init() first.");return p._instance}static init(e){return p._instance&&p._instance.logger.warn("StadataJS already initialized. Reinitializing..."),p._instance=new p(e),p._instance}static isInitialized(){return p._instance!==null}static destroy(){p._instance&&(p._instance.cleanup(),p._instance=null);}get list(){return this._list}get view(){return this._view}setApiKey(e){ne.getInstance().setApiKey(e),this.authInterceptor.setApiKey(e),this.logger.info("API key updated");}addInterceptor(e){this.networkClient.addInterceptor(e),this.logger.debug("Interceptor added");}removeInterceptor(e){this.networkClient.removeInterceptor(e),this.logger.debug("Interceptor removed");}enableDebug(){this.logger.enable(),this.logger.configure({filter:new B(0)});}disableDebug(){this.logger.configure({filter:new B(1)});}async trade(e){return this.injector.resolve("GetTrade").execute(e)}setupDependencies(){R.register(this.injector,this.networkClient),f.register(this.injector,this.networkClient),S.register(this.injector,this.networkClient),d.register(this.injector,this.networkClient),w.register(this.injector,this.networkClient),g.register(this.injector,this.networkClient),y.register(this.injector,this.networkClient),h.register(this.injector,this.networkClient),P.register(this.injector,this.networkClient),b.register(this.injector,this.networkClient),A.register(this.injector,this.networkClient),E.register(this.injector,this.networkClient),C.register(this.injector,this.networkClient),I.register(this.injector,this.networkClient),T.register(this.injector,this.networkClient),_.register(this.injector,this.networkClient),D.register(this.injector,this.networkClient),L.register(this.injector,this.networkClient),O.register(this.injector,this.networkClient),ae.register(this.injector,this.networkClient);}cleanup(){this.injector.clear(),ne.getInstance().clearApiKey(),this.logger.info("StadataJS cleaned up");}};p._instance=null;var mr=p;var Pr=(t=>(t[t.Export=1]="Export",t[t.Import=2]="Import",t))(Pr||{}),br=(t=>(t[t.Monthly=1]="Monthly",t[t.Annually=2]="Annually",t))(br||{}),Ar=(t=>(t[t.TwoDigit=1]="TwoDigit",t[t.Full=2]="Full",t))(Ar||{});
|
|
2
|
-
export{gt as ApiConstant,n as ApiEndpoint,
|
|
1
|
+
import {err,ok}from'neverthrow';var Re=class o{constructor(){this.container=new Map;this.factories=new Map;}static getInstance(){return o.instance||(o.instance=new o),o.instance}register(e,t){this.container.set(e,t);}registerFactory(e,t){this.factories.set(e,t);}resolve(e){if(this.container.has(e))return this.container.get(e);if(this.factories.has(e)){let t=this.factories.get(e);if(t){let r=t();return this.container.set(e,r),r}}throw new Error(`Dependency not found: ${e}`)}has(e){return this.container.has(e)||this.factories.has(e)}clear(){this.container.clear(),this.factories.clear();}remove(e){this.container.delete(e),this.factories.delete(e);}};var O=class o{constructor(e,t){this.message=e;this.code=t;}toString(){return `${this.constructor.name}: ${this.message}${this.code?` (${this.code})`:""}`}equals(e){return e instanceof o?this.message===e.message&&this.code===e.code&&this.constructor.name===e.constructor.name:false}},k=class extends O{constructor(t,r,i){super(t,i);this.statusCode=r;}},fe=class extends O{constructor(e="Request was cancelled"){super(e,"CANCELLED");}},Se=class extends O{constructor(e){super(e,"NETWORK_ERROR");}},we=class extends O{constructor(e="Request timeout"){super(e,"TIMEOUT");}},he=class extends k{constructor(e="Resource not found"){super(e,404,"NOT_FOUND");}},Pe=class extends k{constructor(e="Unauthorized"){super(e,401,"UNAUTHORIZED");}},be=class extends k{constructor(e="Forbidden"){super(e,403,"FORBIDDEN");}},Ae=class extends k{constructor(e="Server error",t=500){super(e,t,"SERVER_ERROR");}},a=class extends O{constructor(e){super(e,"PARSE_ERROR");}},Xt=class extends O{constructor(e){super(e,"VALIDATION_ERROR");}};var Ee=class{constructor(e={}){this.baseURL=e.baseURL||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.interceptors=e.interceptors||[];}addInterceptor(e){this.interceptors.push(e);}removeInterceptor(e){let t=this.interceptors.indexOf(e);t!==-1&&this.interceptors.splice(t,1);}async get(e,t){return this.request("GET",e,t)}async post(e,t){return this.request("POST",e,t)}async put(e,t){return this.request("PUT",e,t)}async delete(e,t){return this.request("DELETE",e,t)}async patch(e,t){return this.request("PATCH",e,t)}async request(e,t,r={}){try{let i=this.buildUrl(t),s={};e!=="GET"?Object.assign(s,this.defaultHeaders):Object.entries(this.defaultHeaders).forEach(([x,Zt])=>{x.toLowerCase()!=="content-type"&&(s[x]=Zt);}),Object.assign(s,r.headers);let u={method:e,headers:s};e!=="GET"&&r.body&&(u.body=JSON.stringify(r.body)),r.cancelToken&&(u.signal=r.cancelToken.signal);for(let x of this.interceptors)x.onRequest&&(u=await x.onRequest(i,u));let R=await this.fetchWithTimeout(i,u,r.timeout||this.timeout);for(let x of this.interceptors)x.onResponse&&(R=await x.onResponse(R));if(!R.ok)return err(await this.handleErrorResponse(R));let Qt=await R.json();return ok(Qt)}catch(i){return err(await this.handleError(i,r.cancelToken))}}async fetchWithTimeout(e,t,r){let i=new AbortController,s=setTimeout(()=>i.abort(),r);try{let u=t.signal&&t.signal instanceof AbortSignal?this.combineSignals(t.signal,i.signal):i.signal;return await fetch(e,{...t,signal:u})}finally{clearTimeout(s);}}combineSignals(e,t){let r=new AbortController,i=()=>r.abort();return e.addEventListener("abort",i),t.addEventListener("abort",i),r.signal}buildUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.baseURL}${e}`}async handleErrorResponse(e){let{status:t}=e,r;try{let i=await e.json();r=i.message||i.error||e.statusText;}catch{r=e.statusText;}switch(t){case 401:return new Pe(r);case 403:return new be(r);case 404:return new he(r);case 500:case 502:case 503:case 504:return new Ae(r,t);default:return new k(r,t)}}async handleError(e,t){let r=e instanceof Error?e:new Error(String(e));for(let i of this.interceptors)if(i.onError){let s=await i.onError(r);s&&(r=s);}return t?.isCancelled||e.name==="AbortError"?new fe(t?.reason):r.name==="AbortError"||r.message.includes("timeout")||r.message.includes("aborted")?new we:r.message.includes("network")||r.message.includes("fetch")||r.message.includes("ECONNREFUSED")?new Se(r.message):new k(r.message)}};var B=class{};var Ce=class extends B{constructor(t){super();this.apiKey=t;}onRequest(t,r){return new URL(t).searchParams.set("key",this.apiKey),{...r}}setApiKey(t){this.apiKey=t;}getApiKey(){return this.apiKey}};var dt=(u=>(u[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.FATAL=4]="FATAL",u[u.NONE=5]="NONE",u))(dt||{}),pt=class{print(e){let t=dt[e.level],i=`[${e.timestamp.toISOString()}] [${t}] ${e.message}`;switch(e.level){case 0:console.debug(i,e.data);break;case 1:console.info(i,e.data);break;case 2:console.warn(i,e.data);break;case 3:case 4:console.error(i,e.error||e.data);break}}},N=class{constructor(e=1){this.minLevel=e;}shouldLog(e){return e.level>=this.minLevel}},V=class o{constructor(e=new pt,t=new N){this.enabled=true;this.printer=e,this.filter=t;}static getInstance(){return o.instance||(o.instance=new o),o.instance}configure(e){e.printer&&(this.printer=e.printer),e.filter&&(this.filter=e.filter),e.enabled!==void 0&&(this.enabled=e.enabled);}debug(e,t){this.log(0,e,t);}info(e,t){this.log(1,e,t);}warn(e,t){this.log(2,e,t);}error(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(3,e,i,r);}fatal(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(4,e,i,r);}log(e,t,r,i){if(!this.enabled)return;let s={level:e,message:t,timestamp:new Date,data:r,error:i};this.filter.shouldLog(s)&&this.printer.print(s);}enable(){this.enabled=true;}disable(){this.enabled=false;}};var er=class extends B{constructor(e){super(),this.logger=e||V.getInstance();}onRequest(e,t){return this.logger.debug(`HTTP Request: ${t.method||"GET"} ${e}`,{headers:t.headers,body:t.body}),t}onResponse(e){return this.logger.debug(`HTTP Response: ${e.status} ${e.url}`,{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}),e}onError(e){return this.logger.error(`HTTP Error: ${e.message}`,e),e}};var tr=class extends B{constructor(t={},r){super();this.retryCount=new Map;this.logger=r||V.getInstance(),this.config={maxRetries:t.maxRetries??3,retryDelay:t.retryDelay??1e3,retryableStatusCodes:t.retryableStatusCodes??[408,429,500,502,503,504],exponentialBackoff:t.exponentialBackoff??true};}async onResponse(t){let r=t.url,i=this.retryCount.get(r)||0;if(!t.ok&&this.config.retryableStatusCodes.includes(t.status)&&i<this.config.maxRetries){this.retryCount.set(r,i+1);let s=this.config.exponentialBackoff?this.config.retryDelay*Math.pow(2,i):this.config.retryDelay;throw this.logger.warn(`Retrying request (${i+1}/${this.config.maxRetries}) after ${s}ms: ${t.url}`),await this.sleep(s),new Error(`RETRY_NEEDED:${r}`)}return (t.ok||i>=this.config.maxRetries)&&this.retryCount.delete(r),t}sleep(t){return new Promise(r=>setTimeout(r,t))}resetRetryCount(t){this.retryCount.delete(t);}clearAllRetryCounts(){this.retryCount.clear();}};var gt={BASE_URL:"https://webapi.bps.go.id/v1/api",DEFAULT_TIMEOUT:3e4,API_VERSION:"v1",DEFAULT_PAGE_SIZE:10,MAX_PAGE_SIZE:100};var n={DOMAIN_LIST:"/list/domain",DOMAIN_VIEW:"/view/domain",PUBLICATION_LIST:"/list/publication",PUBLICATION_VIEW:"/view/publication",INFOGRAPHIC_LIST:"/list/infographic",INFOGRAPHIC_VIEW:"/view/infographic",STATIC_TABLE_LIST:"/list/statictable",STATIC_TABLE_VIEW:"/view/statictable",NEWS_LIST:"/list/news",NEWS_VIEW:"/view/news",NEWS_CATEGORY_LIST:"/list/newscategory",NEWS_CATEGORY_VIEW:"/view/newscategory",PRESS_RELEASE_LIST:"/list/pressrelease",PRESS_RELEASE_VIEW:"/view/pressrelease",SUBJECT_LIST:"/list/subject",SUBJECT_VIEW:"/view/subject",SUBJECT_CATEGORY_LIST:"/list/subjectcat",SUBJECT_CATEGORY_VIEW:"/view/subjectcat",STRATEGIC_INDICATOR_LIST:"/list/stratind",STRATEGIC_INDICATOR_VIEW:"/view/stratind",VARIABLE_LIST:"/list/var",VARIABLE_VIEW:"/view/var",VERTICAL_VARIABLE_LIST:"/list/vervar",VERTICAL_VARIABLE_VIEW:"/view/vervar",UNIT_LIST:"/list/unit",UNIT_VIEW:"/view/unit",PERIOD_LIST:"/list/period",PERIOD_VIEW:"/view/period",DERIVED_PERIOD_LIST:"/list/turth",DERIVED_PERIOD_VIEW:"/view/turth",DERIVED_VARIABLE_LIST:"/list/turvar",DERIVED_VARIABLE_VIEW:"/view/turvar",DYNAMIC_TABLE_LIST:"/list/dynamictable",STATISTIC_CLASSIFICATION_LIST:"/list/kbli",STATISTIC_CLASSIFICATION_VIEW:"/view/kbli",CENSUS_LIST:"/list/sensus",CENSUS_VIEW:"/view/sensus",TRADE:"/dataexim"};var hr={KEY:"key",DOMAIN:"domain",LANG:"lang",PAGE:"page",PER_PAGE:"per_page",KEYWORD:"keyword",MONTH:"month",YEAR:"year",SUBJECT:"subj",VARIABLE:"var",TURVAR:"turvar",TURTH:"turth",PERIOD:"th",TYPE:"type",TABLE:"table",MODEL:"model",ID:"id",SHOW_DELETED:"show_deleted"};var ne=class o{constructor(){this._apiKey=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}setApiKey(e){this._apiKey=e;}getApiKey(){if(!this._apiKey)throw new Error("API key not set. Call setApiKey() first.");return this._apiKey}hasApiKey(){return this._apiKey!==null}clearApiKey(){this._apiKey=null;}};var l=class o{toString(){return JSON.stringify(this.toJson(),null,2)}equals(e){return e instanceof o?JSON.stringify(this.toJson())===JSON.stringify(e.toJson()):false}copyWith(e){let r={...this.toJson(),...e};return Object.assign(Object.create(Object.getPrototypeOf(this)),r)}};var G=class{},rr=class extends G{call(){return this.execute()}};var le=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.url=i;}toJson(){return {domain_id:this.id,domain_name:this.name,domain_url:this.url}}static fromJson(t){return new o(t.domain_id||t.id||"",t.domain_name||t.name||"",t.domain_url||t.url||"")}};var Ie=class extends G{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getAll(t)}};var Te=class extends G{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getById(t)}};var yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.perPage&&(t.per_page=e.perPage.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang),e.id&&(t.id=e.id.toString());let r=new URLSearchParams(t).toString(),i=`${n.DOMAIN_VIEW}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var U=class o extends l{constructor(t,r,i,s,u){super();this.page=t;this.perPage=r;this.total=i;this.pages=s;this.count=u;}get hasNextPage(){return this.page<this.pages}get hasPreviousPage(){return this.page>1}get nextPage(){return this.hasNextPage?this.page+1:null}get previousPage(){return this.hasPreviousPage?this.page-1:null}toJson(){return {page:this.page,per_page:this.perPage,total:this.total,pages:this.pages,count:this.count}}static fromJson(t){return new o(t.page||1,t.per_page||10,t.total||0,t.pages||0,t.count||0)}};var ir=class o extends l{constructor(t,r,i){super();this.data=t;this.dataAvailability=r;this.pagination=i;}get isAvailable(){return this.dataAvailability==="available"}get totalItems(){return this.pagination?.total||this.data.length}get hasData(){return this.data.length>0}toJson(){return {data:this.data,data_availability:this.dataAvailability,pagination:this.pagination?.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(R=>r(R)),u=t.pagination,y=u?U.fromJson(u):void 0;return new o(s,t["data-availability"]||"available",y)}};var c=class o extends l{constructor(t,r){super();this.data=t;this.pagination=r;}get hasMore(){return this.pagination.hasNextPage}get totalItems(){return this.pagination.total}get items(){return this.data}get itemCount(){return this.data.length}toJson(){return {data:this.data,pagination:this.pagination.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(R=>r(R)),u=t.pagination,y=U.fromJson(u);return new o(s,y)}};var Rt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(u=>le.fromJson(u)),s=r.pagination?U.fromJson(r.pagination):new U(1,i.length,i.length,1,i.length);return new c(i,s)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Domain not found");let i=r.data[0];if(!i)throw new a("Domain data is empty");return le.fromJson(i)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var f=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Rt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ie(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Te(r)});}static getAllDomainsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDomainByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};f.REMOTE_DATA_SOURCE="DomainRemoteDataSource",f.REPOSITORY="DomainRepository",f.GET_ALL_USE_CASE="GetAllDomains",f.GET_BY_ID_USE_CASE="GetDomainById";var _e=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.releaseDate=i;this.url=s;this.cover=u;}toJson(){return {id:this.id,title:this.title,rl_date:this.releaseDate.toISOString().split("T")[0],url:this.url,cover:this.cover}}static fromJson(t){return new o(String(t.id||""),String(t.title||""),new Date(String(t.rl_date||t.release_date||t.releaseDate||"")),String(t.url||""),String(t.cover||""))}};var q=class o extends l{constructor(t,r,i,s,u,y,R,Qt,x,Zt,fr,Sr,Er){super();this.id=t;this.title=r;this.issn=i;this.cover=s;this.pdf=u;this.size=y;this.scheduledDate=R;this.releaseDate=Qt;this.updateDate=x;this.abstract=Zt;this.catalogueNumber=fr;this.publicationNumber=Sr;this.relatedPublications=Er;}toJson(){return {id:this.id,title:this.title,issn:this.issn,cover:this.cover,pdf:this.pdf,size:this.size,scheduled_date:this.scheduledDate?.toISOString().split("T")[0]||null,rl_date:this.releaseDate?.toISOString().split("T")[0]||null,updt_date:this.updateDate?.toISOString().split("T")[0]||null,abstract:this.abstract,catalogue_number:this.catalogueNumber,publication_number:this.publicationNumber,related_publications:this.relatedPublications.map(t=>t.toJson())}}static fromJson(t){let r=t.related_publications||t.relatedPublications,i=Array.isArray(r)?r.map(s=>_e.fromJson(s)):[];return new o(String(t.id||""),String(t.title||""),String(t.issn||""),String(t.cover||""),String(t.pdf||""),String(t.size||""),t.scheduled_date||t.scheduledDate?new Date(String(t.scheduled_date||t.scheduledDate)):null,t.rl_date||t.release_date||t.releaseDate?new Date(String(t.rl_date||t.release_date||t.releaseDate)):null,t.updt_date||t.update_date||t.updateDate?new Date(String(t.updt_date||t.update_date||t.updateDate)):null,t.abstract?String(t.abstract):null,t.catalogue_number||t.catalogueNumber?String(t.catalogue_number||t.catalogueNumber):null,t.publication_number||t.publicationNumber?String(t.publication_number||t.publicationNumber):null,i)}};var De=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Le=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var ft=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PUBLICATION_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var St=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>q.fromJson(s))}catch(i){throw new a(`Failed to parse publications: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Publication not found");let i=r.data[0];if(!i)throw new a("Publication data is empty");return q.fromJson(i)}catch(i){throw new a(`Failed to parse publication data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var S=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new St(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new De(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Le(r)});}static getAllPublicationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPublicationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};S.REMOTE_DATA_SOURCE="PublicationRemoteDataSource",S.REPOSITORY="PublicationRepository",S.GET_ALL_USE_CASE="GetAllPublications",S.GET_BY_ID_USE_CASE="GetPublicationById";var M=class o extends l{constructor(t,r,i,s,u,y){super();this.id=t;this.title=r;this.image=i;this.category=s;this.downloadUrl=u;this.description=y;}toJson(){return {inf_id:this.id,title:this.title,img:this.image,category:this.category,dl:this.downloadUrl,desc:this.description}}static fromJson(t){return new o(String(t.inf_id||t.id||""),String(t.title||""),String(t.img||t.image||""),Number(t.category||0),String(t.dl||t.downloadUrl||""),t.desc||t.description?String(t.desc||t.description):null)}};var ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var wt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.INFOGRAPHIC_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ht=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>M.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>M.fromJson(s))}catch(i){throw new a(`Failed to parse infographics: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Infographic not found");let i=r.data[0];if(!i)throw new a("Infographic data is empty");return M.fromJson(i)}catch(i){throw new a(`Failed to parse infographic data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var w=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new wt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ht(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new xe(r)});}static getAllInfographicsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getInfographicByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};w.REMOTE_DATA_SOURCE="InfographicRemoteDataSource",w.REPOSITORY="InfographicRepository",w.GET_ALL_USE_CASE="GetAllInfographics",w.GET_BY_ID_USE_CASE="GetInfographicById";var W=class o extends Error{constructor(e){super(e),this.name="StadataException",Object.setPrototypeOf(this,o.prototype);}},j=class o extends W{constructor(t,r,i){super(t);this.statusCode=r;this.response=i;this.name="ApiException",Object.setPrototypeOf(this,o.prototype);}},ke=class o extends W{constructor(e="Request was cancelled"){super(e),this.name="CancelledException",Object.setPrototypeOf(this,o.prototype);}},or=class o extends W{constructor(e){super(e),this.name="NetworkException",Object.setPrototypeOf(this,o.prototype);}},sr=class o extends W{constructor(e="Request timeout"){super(e),this.name="TimeoutException",Object.setPrototypeOf(this,o.prototype);}},ar=class o extends j{constructor(e="Resource not found"){super(e,404),this.name="NotFoundException",Object.setPrototypeOf(this,o.prototype);}},nr=class o extends j{constructor(e="Unauthorized"){super(e,401),this.name="UnauthorizedException",Object.setPrototypeOf(this,o.prototype);}},lr=class o extends j{constructor(e="Forbidden"){super(e,403),this.name="ForbiddenException",Object.setPrototypeOf(this,o.prototype);}},cr=class o extends j{constructor(e="Server error",t=500){super(e,t),this.name="ServerException",Object.setPrototypeOf(this,o.prototype);}};var ur=class o{constructor(){this._isCancelled=false;this.abortController=new AbortController;}get signal(){return this.abortController.signal}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isCancelled||(this._isCancelled=true,this._reason=e,this.abortController.abort());}throwIfCancelled(){if(this._isCancelled)throw new ke(this._reason||"Request was cancelled")}static create(){return new o}static source(){let e=new o;return {token:e,cancel:t=>e.cancel(t)}}};var mr=class{static parse(e){if(!e)return null;try{let t=new Date(e);return isNaN(t.getTime())?null:t}catch{return null}}static format(e){if(!e||!(e instanceof Date))return null;try{return e.toISOString()}catch{return null}}static formatReadable(e){if(!e||!(e instanceof Date))return null;try{return e.toLocaleDateString("id-ID",{year:"numeric",month:"long",day:"numeric"})}catch{return null}}static isValid(e){return this.parse(e)!==null}static toTimestamp(e){let t=this.parse(e);return t?t.getTime():null}static fromTimestamp(e){return new Date(e)}static now(){return new Date().toISOString()}static nowTimestamp(){return Date.now()}};var $=class o extends l{constructor(t,r,i,s,u,y){super();this.id=t;this.title=r;this.content=i;this.releaseDate=s;this.categoryId=u;this.picture=y;}toJson(){return {news_id:this.id,title:this.title,news_content:this.content,rl_date:this.releaseDate,category_id:this.categoryId,picture:this.picture}}static fromJson(t){return new o(String(t.news_id||t.id||""),String(t.title||""),String(t.news_content||t.content||""),String(t.rl_date||t.releaseDate||""),Number(t.category_id||t.categoryId||0),t.picture?String(t.picture):null)}};var ce=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ue=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ue=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString()),e.newsCategoryId&&(t.news_category_id=e.newsCategoryId);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Oe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>$.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>$.fromJson(s))}catch(i){throw new a(`Failed to parse news: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News not found");let i=r.data[0];if(!i)throw new a("News data is empty");return $.fromJson(i)}catch(i){throw new a(`Failed to parse news data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var p=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ue(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Oe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ce(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ue(r)});}static getAllNewsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};p.REMOTE_DATA_SOURCE="NewsRemoteDataSource",p.REPOSITORY="NewsRepository",p.GET_ALL_USE_CASE="GetAllNews",p.GET_BY_ID_USE_CASE="GetNewsById";var K=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {category_id:this.id,category_name:this.name}}static fromJson(t){return new o(String(t.category_id||t.id||""),String(t.category_name||t.name||""))}};var Ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Fe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Pt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.NEWS_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>K.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>K.fromJson(s))}catch(i){throw new a(`Failed to parse news category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News category not found");let i=r.data[0];if(!i)throw new a("News category data is empty");return K.fromJson(i)}catch(i){throw new a(`Failed to parse news category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var h=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Pt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Fe(r)});}static getAllNewsCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};h.REMOTE_DATA_SOURCE="NewsCategoryRemoteDataSource",h.REPOSITORY="NewsCategoryRepository",h.GET_ALL_USE_CASE="GetAllNewsCategories",h.GET_BY_ID_USE_CASE="GetNewsCategoryById";var J=class o extends l{constructor(t,r,i,s,u){super();this.id=t;this.title=r;this.abstract=i;this.releaseDate=s;this.picture=u;}toJson(){return {rl_id:this.id,title:this.title,abstract:this.abstract,rl_date:this.releaseDate,picture:this.picture}}static fromJson(t){return new o(String(t.rl_id||t.id||""),String(t.title||""),String(t.abstract||""),String(t.rl_date||t.releaseDate||""),t.picture?String(t.picture):null)}};var me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var pe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Be=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PRESS_RELEASE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ne=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>J.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>J.fromJson(s))}catch(i){throw new a(`Failed to parse press releases: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Press release not found");let i=r.data[0];if(!i)throw new a("Press release data is empty");return J.fromJson(i)}catch(i){throw new a(`Failed to parse press release data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var d=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Be(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ne(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new me(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new pe(r)});}static getAllPressReleasesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPressReleaseByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};d.REMOTE_DATA_SOURCE="PressReleaseRemoteDataSource",d.REPOSITORY="PressReleaseRepository",d.GET_ALL_USE_CASE="GetAllPressReleases",d.GET_BY_ID_USE_CASE="GetPressReleaseById";var Y=class o extends l{constructor(t,r,i,s,u,y){super();this.id=t;this.title=r;this.subjectId=i;this.size=s;this.updatedAt=u;this.excelUrl=y;}toJson(){return {table_id:this.id,title:this.title,subj_id:this.subjectId,size:this.size,updt_date:this.updatedAt,excel:this.excelUrl}}static fromJson(t){return new o(String(t.table_id||t.id||""),String(t.title||""),Number(t.subj_id||t.subjectId||0),String(t.size||""),String(t.updt_date||t.updatedAt||""),String(t.excel||t.excelUrl||""))}};var de=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ge=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ge=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATIC_TABLE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var $e=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Y.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Y.fromJson(s))}catch(i){throw new a(`Failed to parse static tables: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Static table not found");let i=r.data[0];if(!i)throw new a("Static table data is empty");return Y.fromJson(i)}catch(i){throw new a(`Failed to parse static table data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var g=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ge(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new $e(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new de(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ge(r)});}static getAllStaticTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStaticTableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};g.REMOTE_DATA_SOURCE="StaticTableRemoteDataSource",g.REPOSITORY="StaticTableRepository",g.GET_ALL_USE_CASE="GetAllStaticTables",g.GET_BY_ID_USE_CASE="GetStaticTableById";var z=class o extends l{constructor(t,r,i){super();this.id=t;this.name=r;this.categoryId=i;}toJson(){return {subj_id:this.id,title:this.name,subcatid:this.categoryId}}static fromJson(t){return new o(Number(t.subj_id||t.id||0),String(t.title||t.name||""),Number(t.subcatid||t.categoryId||0))}};var Je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ye=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var At=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Et=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>z.fromJson(s))}catch(i){throw new a(`Failed to parse subject: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject not found");let i=r.data[0];if(!i)throw new a("Subject data is empty");return z.fromJson(i)}catch(i){throw new a(`Failed to parse subject data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var P=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new At(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Et(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ye(r)});}static getAllSubjectsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};P.REMOTE_DATA_SOURCE="SubjectRemoteDataSource",P.REPOSITORY="SubjectRepository",P.GET_ALL_USE_CASE="GetAllSubjects",P.GET_BY_ID_USE_CASE="GetSubjectById";var H=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {subcat_id:this.id,subcat_name:this.name}}static fromJson(t){return new o(Number(t.subcat_id||t.id||0),String(t.subcat_name||t.name||""))}};var qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ct=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.SUBJECT_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var It=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>H.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>H.fromJson(s))}catch(i){throw new a(`Failed to parse subject category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject category not found");let i=r.data[0];if(!i)throw new a("Subject category data is empty");return H.fromJson(i)}catch(i){throw new a(`Failed to parse subject category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var b=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ct(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new It(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new qe(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Me(r)});}static getAllSubjectCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};b.REMOTE_DATA_SOURCE="SubjectCategoryRemoteDataSource",b.REPOSITORY="SubjectCategoryRepository",b.GET_ALL_USE_CASE="GetAllSubjectCategories",b.GET_BY_ID_USE_CASE="GetSubjectCategoryById";var Q=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {ind_id:this.id,ind_name:this.name}}static fromJson(t){return new o(Number(t.ind_id||t.id||0),String(t.ind_name||t.name||""))}};var We=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Tt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STRATEGIC_INDICATOR_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var _t=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Q.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Q.fromJson(s))}catch(i){throw new a(`Failed to parse strategic indicator: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Strategic indicator not found");let i=r.data[0];if(!i)throw new a("Strategic indicator data is empty");return Q.fromJson(i)}catch(i){throw new a(`Failed to parse strategic indicator data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var A=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Tt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new _t(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new We(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new je(r)});}static getAllStrategicIndicatorsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStrategicIndicatorByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};A.REMOTE_DATA_SOURCE="StrategicIndicatorRemoteDataSource",A.REPOSITORY="StrategicIndicatorRepository",A.GET_ALL_USE_CASE="GetAllStrategicIndicators",A.GET_BY_ID_USE_CASE="GetStrategicIndicatorById";var Z=class o extends l{constructor(t,r,i,s,u,y,R){super();this.id=t;this.title=r;this.subjectId=i;this.unit=s;this.verticalVariableCount=u;this.derivedVariableCount=y;this.graph=R;}toJson(){return {var_id:this.id,title:this.title,subject_id:this.subjectId,unit:this.unit,vertical_variable:this.verticalVariableCount,derived_variable:this.derivedVariableCount,graph:this.graph}}static fromJson(t){let r=t.graph||t.graphs,i=[];return Array.isArray(r)?i=r.map(s=>String(s)):typeof r=="string"&&(i=[r]),new o(Number(t.var_id||t.id||0),String(t.title||t.name||""),Number(t.subject_id||t.subjectId||0),String(t.unit||""),Number(t.vertical_variable||t.verticalVariableCount||0),Number(t.derived_variable||t.derivedVariableCount||0),i)}};var Ke=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Dt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.subjectId&&(t.subject=e.subjectId.toString()),e?.showDeleted!==void 0&&(t.show_deleted=e.showDeleted?"1":"0");let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Lt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>Z.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>Z.fromJson(s))}catch(i){throw new a(`Failed to parse variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Variable not found");let i=r.data[0];if(!i)throw new a("Variable data is empty");return Z.fromJson(i)}catch(i){throw new a(`Failed to parse variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var E=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Dt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Lt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ke(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ze(r)});}static getAllVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};E.REMOTE_DATA_SOURCE="VariableRemoteDataSource",E.REPOSITORY="VariableRepository",E.GET_ALL_USE_CASE="GetAllVariables",E.GET_BY_ID_USE_CASE="GetVariableById";var X=class o extends l{constructor(t,r,i,s){super();this.id=t;this.variableId=r;this.label=i;this.alias=s;}toJson(){return {vervar_id:this.id,var_id:this.variableId,label:this.label,alias:this.alias}}static fromJson(t){return new o(Number(t.vervar_id||t.id||0),Number(t.var_id||t.variableId||0),String(t.label||""),String(t.alias||""))}};var He=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var vt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.VERTICAL_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var xt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>X.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>X.fromJson(s))}catch(i){throw new a(`Failed to parse vertical variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Vertical variable not found");let i=r.data[0];if(!i)throw new a("Vertical variable data is empty");return X.fromJson(i)}catch(i){throw new a(`Failed to parse vertical variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var C=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new vt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new xt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new He(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Qe(r)});}static getAllVerticalVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVerticalVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};C.REMOTE_DATA_SOURCE="VerticalVariableRemoteDataSource",C.REPOSITORY="VerticalVariableRepository",C.GET_ALL_USE_CASE="GetAllVerticalVariables",C.GET_BY_ID_USE_CASE="GetVerticalVariableById";var ee=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {unit_id:this.id,unit:this.name}}static fromJson(t){return new o(Number(t.unit_id||t.id||0),String(t.unit||t.name||""))}};var Ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var kt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.UNIT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.UNIT_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ut=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ee.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ee.fromJson(s))}catch(i){throw new a(`Failed to parse unit: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Unit not found");let i=r.data[0];if(!i)throw new a("Unit data is empty");return ee.fromJson(i)}catch(i){throw new a(`Failed to parse unit data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var I=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new kt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ut(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ze(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Xe(r)});}static getAllUnitsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getUnitByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};I.REMOTE_DATA_SOURCE="UnitRemoteDataSource",I.REPOSITORY="UnitRepository",I.GET_ALL_USE_CASE="GetAllUnits",I.GET_BY_ID_USE_CASE="GetUnitById";var te=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.period_id||t.id||0),String(t.label||t.name||""))}};var et=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var tt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ot=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Vt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>te.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>te.fromJson(s))}catch(i){throw new a(`Failed to parse period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Period not found");let i=r.data[0];if(!i)throw new a("Period data is empty");return te.fromJson(i)}catch(i){throw new a(`Failed to parse period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var T=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ot(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Vt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new et(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new tt(r)});}static getAllPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};T.REMOTE_DATA_SOURCE="PeriodRemoteDataSource",T.REPOSITORY="PeriodRepository",T.GET_ALL_USE_CASE="GetAllPeriods",T.GET_BY_ID_USE_CASE="GetPeriodById";var re=class o extends l{constructor(t,r){super();this.id=t;this.label=r;}toJson(){return {derived_period_id:this.id,label:this.label}}static fromJson(t){return new o(Number(t.derived_period_id||t.id||0),String(t.label||t.name||""))}};var rt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var it=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Ft=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>re.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>re.fromJson(s))}catch(i){throw new a(`Failed to parse derived period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived period not found");let i=r.data[0];if(!i)throw new a("Derived period data is empty");return re.fromJson(i)}catch(i){throw new a(`Failed to parse derived period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var _=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new rt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new it(r)});}static getAllDerivedPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};_.REMOTE_DATA_SOURCE="DerivedPeriodRemoteDataSource",_.REPOSITORY="DerivedPeriodRepository",_.GET_ALL_USE_CASE="GetAllDerivedPeriods",_.GET_BY_ID_USE_CASE="GetDerivedPeriodById";var ie=class o extends l{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {derived_variable_id:this.id,derived_variable:this.name}}static fromJson(t){return new o(Number(t.derived_variable_id||t.id||0),String(t.derived_variable||t.name||""))}};var ot=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var st=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Nt=class{constructor(e){this.client=e;}async getAll(e){let t={var:e.variableId.toString()};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.DERIVED_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Gt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ie.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ie.fromJson(s))}catch(i){throw new a(`Failed to parse derived variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived variable not found");let i=r.data[0];if(!i)throw new a("Derived variable data is empty");return ie.fromJson(i)}catch(i){throw new a(`Failed to parse derived variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var D=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Nt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Gt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ot(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new st(r)});}static getAllDerivedVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};D.REMOTE_DATA_SOURCE="DerivedVariableRemoteDataSource",D.REPOSITORY="DerivedVariableRepository",D.GET_ALL_USE_CASE="GetAllDerivedVariables",D.GET_BY_ID_USE_CASE="GetDerivedVariableById";var oe=class o extends l{constructor(t,r){super();this.id=t;this.title=r;}toJson(){return {kbli_id:this.id,title:this.title}}static fromJson(t){return new o(String(t.kbli_id||t.id||""),String(t.title||t.name||""))}};var at=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var nt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var $t=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.STATISTIC_CLASSIFICATION_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Jt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>oe.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>oe.fromJson(s))}catch(i){throw new a(`Failed to parse statistic classification: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Statistic classification not found");let i=r.data[0];if(!i)throw new a("Statistic classification data is empty");return oe.fromJson(i)}catch(i){throw new a(`Failed to parse statistic classification data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var L=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new $t(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Jt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new at(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new nt(r)});}static getAllStatisticClassificationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStatisticClassificationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};L.REMOTE_DATA_SOURCE="StatisticClassificationRemoteDataSource",L.REPOSITORY="StatisticClassificationRepository",L.GET_ALL_USE_CASE="GetAllStatisticClassifications",L.GET_BY_ID_USE_CASE="GetStatisticClassificationById";var se=class o extends l{constructor(t,r,i){super();this.id=t;this.activity=r;this.year=i;}toJson(){return {id:this.id,kegiatan:this.activity,tahun_kegiatan:this.year}}static fromJson(t){return new o(Number(t.id||0),String(t.kegiatan||t.activity||""),String(t.tahun_kegiatan||t.year||""))}};var lt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ct=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Yt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${n.CENSUS_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var yr=(t=>(t.ID="ind",t.EN="eng",t))(yr||{});var Rr=(r=>(r.AVAILABLE="available",r.NOT_AVAILABLE="not-available",r.LIST_NOT_AVAILABLE="list-not-available",r))(Rr||{});var qt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>se.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>se.fromJson(s))}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{return se.fromJson(r)}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var v=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Yt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new qt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new lt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ct(r)});}static getAllCensusesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getCensusByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};v.REMOTE_DATA_SOURCE="CensusRemoteDataSource",v.REPOSITORY="CensusRepository",v.GET_ALL_USE_CASE="GetAllCensuses",v.GET_BY_ID_USE_CASE="GetCensusById";var ye=class o extends l{constructor(t,r,i,s,u,y,R,Qt,x,Zt,fr,Sr){super();this.variableId=t;this.title=r;this.subjectId=i;this.subjectName=s;this.notes=u;this.unit=y;this.verticalVariableId=R;this.domain=Qt;this.csaSubjectId=x;this.csaSubjectName=Zt;this.graphId=fr;this.graphName=Sr;}toJson(){return {var:this.variableId,label:this.title,subj:this.subjectId,subj_label:this.subjectName,notes:this.notes,unit:this.unit,vervar:this.verticalVariableId,table:this.domain,subcsa:this.csaSubjectId,subcsa_label:this.csaSubjectName,graph:this.graphId,graph_label:this.graphName}}static fromJson(t){let r=t.var,i=t.subj;return new o(typeof r=="number"?r:parseInt(String(r||0)),String(t.label||""),typeof i=="number"?i:parseInt(String(i||0)),String(t.subj_label||""),String(t.notes||""),String(t.unit||""),Number(t.vervar||0),String(t.table||""),t.subcsa!==void 0?Number(t.subcsa):void 0,t.subcsa_label!==void 0?String(t.subcsa_label):void 0,t.graph!==void 0?Number(t.graph):void 0,t.graph_label!==void 0?String(t.graph_label):void 0)}};var ut=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Mt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain?t.domain=e.domain:t.domain=e.tableId,e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${n.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Wt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{let i=r.data.map(s=>ye.fromJson(s));return c.fromJson({data:i,pagination:r.pagination},s=>ye.fromJson(s))}catch(i){throw new a(`Failed to parse dynamic table: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var F=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Mt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Wt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ut(r)});}static getAllDynamicTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};F.REMOTE_DATA_SOURCE="DynamicTableRemoteDataSource",F.REPOSITORY="DynamicTableRepository",F.GET_ALL_USE_CASE="GetAllDynamicTables";var jt=class{constructor(e){this.injector=e;}async domains(e){return f.getAllDomainsUseCase(this.injector).execute(e)}async publications(e){return S.getAllPublicationsUseCase(this.injector).execute(e)}async infographics(e){return w.getAllInfographicsUseCase(this.injector).execute(e)}async news(e){return p.getAllNewsUseCase(this.injector).execute(e)}async newsCategories(e){return h.getAllNewsCategoriesUseCase(this.injector).execute(e)}async pressReleases(e){return d.getAllPressReleasesUseCase(this.injector).execute(e)}async staticTables(e){return g.getAllStaticTablesUseCase(this.injector).execute(e)}async subjects(e){return P.getAllSubjectsUseCase(this.injector).execute(e)}async subjectCategories(e){return b.getAllSubjectCategoriesUseCase(this.injector).execute(e)}async strategicIndicators(e){return A.getAllStrategicIndicatorsUseCase(this.injector).execute(e)}async variables(e){return E.getAllVariablesUseCase(this.injector).execute(e)}async verticalVariables(e){return C.getAllVerticalVariablesUseCase(this.injector).execute(e)}async units(e){return I.getAllUnitsUseCase(this.injector).execute(e)}async periods(e){return T.getAllPeriodsUseCase(this.injector).execute(e)}async derivedPeriods(e){return _.getAllDerivedPeriodsUseCase(this.injector).execute(e)}async derivedVariables(e){return D.getAllDerivedVariablesUseCase(this.injector).execute(e)}async statisticClassifications(e){return L.getAllStatisticClassificationsUseCase(this.injector).execute(e)}async censuses(e){return v.getAllCensusesUseCase(this.injector).execute(e)}async dynamicTables(e){return F.getAllDynamicTablesUseCase(this.injector).execute(e)}};var Kt=class{constructor(e){this.injector=e;}async domain(e){return f.getDomainByIdUseCase(this.injector).execute(e)}async publication(e){return S.getPublicationByIdUseCase(this.injector).execute(e)}async infographic(e){return w.getInfographicByIdUseCase(this.injector).execute(e)}async news(e){return p.getNewsByIdUseCase(this.injector).execute(e)}async newsCategory(e){return h.getNewsCategoryByIdUseCase(this.injector).execute(e)}async pressRelease(e){return d.getPressReleaseByIdUseCase(this.injector).execute(e)}async staticTable(e){return g.getStaticTableByIdUseCase(this.injector).execute(e)}async subject(e){return P.getSubjectByIdUseCase(this.injector).execute(e)}async subjectCategory(e){return b.getSubjectCategoryByIdUseCase(this.injector).execute(e)}async strategicIndicator(e){return A.getStrategicIndicatorByIdUseCase(this.injector).execute(e)}async variable(e){return E.getVariableByIdUseCase(this.injector).execute(e)}async verticalVariable(e){return C.getVerticalVariableByIdUseCase(this.injector).execute(e)}async unit(e){return I.getUnitByIdUseCase(this.injector).execute(e)}async period(e){return T.getPeriodByIdUseCase(this.injector).execute(e)}async derivedPeriod(e){return _.getDerivedPeriodByIdUseCase(this.injector).execute(e)}async derivedVariable(e){return D.getDerivedVariableByIdUseCase(this.injector).execute(e)}async statisticClassification(e){return L.getStatisticClassificationByIdUseCase(this.injector).execute(e)}async census(e){return v.getCensusByIdUseCase(this.injector).execute(e)}};var pr=class o extends l{constructor(t,r,i,s,u,y){super();this.value=t;this.netWeight=r;this.hsCode=i;this.port=s;this.country=u;this.year=y;}toJson(){return {value:this.value,netweight:this.netWeight,kodehs:this.hsCode,pod:this.port,ctr:this.country,tahun:this.year}}static fromJson(t){return new o(Number(t.value||0),Number(t.netweight||0),String(t.kodehs||""),String(t.pod||""),String(t.ctr||""),String(t.tahun||""))}};var mt=class{constructor(e){this.repository=e;}execute(e){return this.repository.get(e)}};var zt=class{constructor(e){this.client=e;}async get(e){let t={sumber:e.source.toString(),periode:e.period.toString(),kodehs:e.hsCode,jenishs:e.hsType.toString(),Tahun:e.year},r=new URLSearchParams(t).toString(),i=`${n.TRADE}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ht=class{constructor(e){this.remoteDataSource=e;}get(e){return this.remoteDataSource.get(e)}};var ae=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new zt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ht(r)}),e.registerFactory(this.GET_TRADE_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new mt(r)});}static getTradeUseCase(e){return e.resolve(this.GET_TRADE_USE_CASE)}};ae.REMOTE_DATA_SOURCE="TradeRemoteDataSource",ae.REPOSITORY="TradeRepository",ae.GET_TRADE_USE_CASE="GetTrade";var m=class m{constructor(e){this.logger=V.getInstance(),this.logger.configure({enabled:e.debug??false,filter:new N(e.logLevel??1)}),ne.getInstance().setApiKey(e.apiKey),this.authInterceptor=new Ce(e.apiKey);let t=[this.authInterceptor,...e.interceptors||[]];this.networkClient=new Ee({baseURL:e.baseURL||gt.BASE_URL,timeout:e.timeout||gt.DEFAULT_TIMEOUT,interceptors:t}),this.injector=Re.getInstance(),this.setupDependencies(),this._list=new jt(this.injector),this._view=new Kt(this.injector),this.logger.info("StadataJS initialized successfully");}static get instance(){if(!m._instance)throw new Error("StadataJS not initialized. Call StadataJS.init() first.");return m._instance}static init(e){return m._instance&&m._instance.logger.warn("StadataJS already initialized. Reinitializing..."),m._instance=new m(e),m._instance}static isInitialized(){return m._instance!==null}static destroy(){m._instance&&(m._instance.cleanup(),m._instance=null);}get list(){return this._list}get view(){return this._view}setApiKey(e){ne.getInstance().setApiKey(e),this.authInterceptor.setApiKey(e),this.logger.info("API key updated");}addInterceptor(e){this.networkClient.addInterceptor(e),this.logger.debug("Interceptor added");}removeInterceptor(e){this.networkClient.removeInterceptor(e),this.logger.debug("Interceptor removed");}enableDebug(){this.logger.enable(),this.logger.configure({filter:new N(0)});}disableDebug(){this.logger.configure({filter:new N(1)});}async trade(e){return this.injector.resolve("GetTrade").execute(e)}setupDependencies(){f.register(this.injector,this.networkClient),S.register(this.injector,this.networkClient),w.register(this.injector,this.networkClient),p.register(this.injector,this.networkClient),h.register(this.injector,this.networkClient),d.register(this.injector,this.networkClient),g.register(this.injector,this.networkClient),P.register(this.injector,this.networkClient),b.register(this.injector,this.networkClient),A.register(this.injector,this.networkClient),E.register(this.injector,this.networkClient),C.register(this.injector,this.networkClient),I.register(this.injector,this.networkClient),T.register(this.injector,this.networkClient),_.register(this.injector,this.networkClient),D.register(this.injector,this.networkClient),L.register(this.injector,this.networkClient),v.register(this.injector,this.networkClient),F.register(this.injector,this.networkClient),ae.register(this.injector,this.networkClient);}cleanup(){this.injector.clear(),ne.getInstance().clearApiKey(),this.logger.info("StadataJS cleaned up");}};m._instance=null;var dr=m;var Pr=(t=>(t[t.Export=1]="Export",t[t.Import=2]="Import",t))(Pr||{}),br=(t=>(t[t.Monthly=1]="Monthly",t[t.Annually=2]="Annually",t))(br||{}),Ar=(t=>(t[t.TwoDigit=1]="TwoDigit",t[t.Full=2]="Full",t))(Ar||{});
|
|
2
|
+
export{gt as ApiConstant,n as ApiEndpoint,j as ApiException,k as ApiFailure,ir as ApiResponse,Ce as AuthInterceptor,l as BaseEntity,ur as CancelToken,ke as CancelledException,fe as CancelledFailure,se as Census,pt as ConsoleLogPrinter,Rr as DataAvailability,yr as DataLanguage,mr as DateHelper,re as DerivedPeriod,ie as DerivedVariable,le as Domain,ye as DynamicTable,O as Failure,lr as ForbiddenException,be as ForbiddenFailure,lt as GetAllCensuses,rt as GetAllDerivedPeriods,ot as GetAllDerivedVariables,Ie as GetAllDomains,ut as GetAllDynamicTables,ve as GetAllInfographics,ce as GetAllNews,Ve as GetAllNewsCategories,et as GetAllPeriods,me as GetAllPressReleases,De as GetAllPublications,de as GetAllStaticTables,at as GetAllStatisticClassifications,We as GetAllStrategicIndicators,qe as GetAllSubjectCategories,Je as GetAllSubjects,Ze as GetAllUnits,Ke as GetAllVariables,He as GetAllVerticalVariables,ct as GetCensusById,it as GetDerivedPeriodById,st as GetDerivedVariableById,Te as GetDomainById,xe as GetInfographicById,ue as GetNewsById,Fe as GetNewsCategoryById,tt as GetPeriodById,pe as GetPressReleaseById,Le as GetPublicationById,ge as GetStaticTableById,nt as GetStatisticClassificationById,je as GetStrategicIndicatorById,Ye as GetSubjectById,Me as GetSubjectCategoryById,mt as GetTrade,Xe as GetUnitById,ze as GetVariableById,Qe as GetVerticalVariableById,Ar as HSCodeType,M as Infographic,Re as Injector,c as ListResult,dt as LogLevel,V as Logger,er as LoggingInterceptor,Ee as NetworkClient,or as NetworkException,Se as NetworkFailure,$ as News,K as NewsCategory,rr as NoParamsUseCase,ar as NotFoundException,he as NotFoundFailure,U as Pagination,a as ParseFailure,te as Period,J as PressRelease,N as ProductionLogFilter,q as Publication,hr as QueryParamConstant,_e as RelatedPublication,tr as RetryInterceptor,cr as ServerException,Ae as ServerFailure,W as StadataException,dr as StadataJS,Y as StaticTable,oe as StatisticClassification,Q as StrategicIndicator,z as Subject,H as SubjectCategory,sr as TimeoutException,we as TimeoutFailure,pr as Trade,br as TradePeriod,Pr as TradeSource,nr as UnauthorizedException,Pe as UnauthorizedFailure,ee as Unit,G as UseCase,Xt as ValidationFailure,Z as Variable,X as VerticalVariable};
|