@sankhyalabs/sankhyablocks 8.0.2 → 8.1.0-rc.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.
Files changed (138) hide show
  1. package/dist/cjs/{ConfigStorage-e044fff2.js → ConfigStorage-73e7afff.js} +4 -4
  2. package/dist/cjs/{DataFetcher-62b9b2c8.js → DataFetcher-004811c6.js} +13 -0
  3. package/dist/cjs/{SnkFormConfigManager-5d4b4765.js → SnkFormConfigManager-d1f1a222.js} +2 -2
  4. package/dist/cjs/auth-fetcher-58237931.js +34 -0
  5. package/dist/cjs/{dataunit-fetcher-2a3c86b1.js → dataunit-fetcher-029eafbd.js} +1 -1
  6. package/dist/cjs/{filter-bar-config-fetcher-71119171.js → filter-bar-config-fetcher-2b8ed9d0.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-2b32c782.js → form-config-fetcher-181767c9.js} +2 -2
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{pesquisa-fetcher-ee74ae40.js → pesquisa-fetcher-9a97994a.js} +1 -1
  10. package/dist/cjs/{resource-fetcher-18c2d5ad.js → resource-fetcher-c0332609.js} +1 -1
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button.cjs.entry.js +3 -2
  13. package/dist/cjs/snk-application.cjs.entry.js +21 -38
  14. package/dist/cjs/snk-attach.cjs.entry.js +3 -3
  15. package/dist/cjs/snk-crud.cjs.entry.js +11 -4
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -2
  17. package/dist/cjs/{snk-data-unit-807a8684.js → snk-data-unit-cc7a7ed0.js} +5 -0
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +14 -10
  20. package/dist/cjs/snk-filter-bar.cjs.entry.js +6 -5
  21. package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -3
  22. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -5
  23. package/dist/cjs/snk-form-config.cjs.entry.js +4 -3
  24. package/dist/cjs/snk-form.cjs.entry.js +7 -6
  25. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -5
  26. package/dist/cjs/snk-grid.cjs.entry.js +9 -6
  27. package/dist/cjs/{snk-guides-viewer-263de371.js → snk-guides-viewer-27f87d90.js} +5 -4
  28. package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -8
  29. package/dist/cjs/snk-personalized-filter.cjs.entry.js +6 -5
  30. package/dist/cjs/snk-print-selector.cjs.entry.js +2 -1
  31. package/dist/cjs/snk-simple-crud.cjs.entry.js +6 -4
  32. package/dist/collection/components/snk-application/snk-application.js +60 -0
  33. package/dist/collection/components/snk-crud/snk-crud.js +27 -3
  34. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +24 -2
  35. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +20 -1
  36. package/dist/collection/components/snk-data-unit/snk-data-unit.js +39 -0
  37. package/dist/collection/components/snk-grid/snk-grid.js +60 -1
  38. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +21 -2
  39. package/dist/collection/lib/http/data-fetcher/recaller/GraphQLRecaller.js +14 -0
  40. package/dist/components/DataFetcher.js +14 -1
  41. package/dist/components/auth-fetcher.js +32 -0
  42. package/dist/components/snk-application2.js +12 -29
  43. package/dist/components/snk-crud.js +9 -2
  44. package/dist/components/snk-data-unit2.js +6 -0
  45. package/dist/components/snk-detail-view2.js +10 -3
  46. package/dist/components/snk-grid2.js +7 -1
  47. package/dist/components/snk-simple-crud2.js +4 -2
  48. package/dist/esm/{ConfigStorage-6ec80135.js → ConfigStorage-19a7260b.js} +4 -4
  49. package/dist/esm/{DataFetcher-f7cf7302.js → DataFetcher-e0fc5549.js} +14 -1
  50. package/dist/esm/{SnkFormConfigManager-b8091dec.js → SnkFormConfigManager-1a42eb02.js} +2 -2
  51. package/dist/esm/auth-fetcher-83a946f8.js +32 -0
  52. package/dist/esm/{dataunit-fetcher-06e70d4c.js → dataunit-fetcher-6a695723.js} +1 -1
  53. package/dist/esm/{filter-bar-config-fetcher-efd7ab4e.js → filter-bar-config-fetcher-06e02851.js} +1 -1
  54. package/dist/esm/{form-config-fetcher-a5b23cd9.js → form-config-fetcher-9e167008.js} +2 -2
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/{pesquisa-fetcher-f06f4883.js → pesquisa-fetcher-9118eb7a.js} +1 -1
  57. package/dist/esm/{resource-fetcher-92640c2f.js → resource-fetcher-768d5556.js} +1 -1
  58. package/dist/esm/sankhyablocks.js +1 -1
  59. package/dist/esm/snk-actions-button.entry.js +3 -2
  60. package/dist/esm/snk-application.entry.js +19 -36
  61. package/dist/esm/snk-attach.entry.js +3 -3
  62. package/dist/esm/snk-crud.entry.js +11 -4
  63. package/dist/esm/snk-data-exporter.entry.js +3 -2
  64. package/dist/esm/{snk-data-unit-351ef08f.js → snk-data-unit-77508763.js} +5 -0
  65. package/dist/esm/snk-data-unit.entry.js +1 -1
  66. package/dist/esm/snk-detail-view.entry.js +14 -10
  67. package/dist/esm/snk-filter-bar.entry.js +6 -5
  68. package/dist/esm/snk-filter-detail.entry.js +4 -3
  69. package/dist/esm/snk-filter-modal-item.entry.js +6 -5
  70. package/dist/esm/snk-form-config.entry.js +4 -3
  71. package/dist/esm/snk-form.entry.js +7 -6
  72. package/dist/esm/snk-grid-config.entry.js +6 -5
  73. package/dist/esm/snk-grid.entry.js +9 -6
  74. package/dist/esm/{snk-guides-viewer-a6743bd9.js → snk-guides-viewer-c47cd45e.js} +5 -4
  75. package/dist/esm/snk-guides-viewer.entry.js +9 -8
  76. package/dist/esm/snk-personalized-filter.entry.js +6 -5
  77. package/dist/esm/snk-print-selector.entry.js +2 -1
  78. package/dist/esm/snk-simple-crud.entry.js +6 -4
  79. package/dist/sankhyablocks/{p-a54bdcc8.js → p-0a4c753d.js} +2 -2
  80. package/dist/sankhyablocks/{p-6785e5c9.entry.js → p-0ed0fc02.entry.js} +1 -1
  81. package/dist/sankhyablocks/p-22c6fe1a.entry.js +1 -0
  82. package/dist/sankhyablocks/{p-70b8e4a4.js → p-2ac9c585.js} +1 -1
  83. package/dist/sankhyablocks/p-34085ced.entry.js +1 -0
  84. package/dist/sankhyablocks/p-34a1357a.entry.js +1 -0
  85. package/dist/sankhyablocks/p-4721c3db.js +1 -0
  86. package/dist/sankhyablocks/p-6759adae.entry.js +1 -0
  87. package/dist/sankhyablocks/{p-49b24449.js → p-7b8b8ae9.js} +1 -1
  88. package/dist/sankhyablocks/p-7e285d6c.entry.js +11 -0
  89. package/dist/sankhyablocks/p-815a42c0.entry.js +1 -0
  90. package/dist/sankhyablocks/p-8a41172a.entry.js +1 -0
  91. package/dist/sankhyablocks/{p-bdcfbe10.js → p-8f8184ff.js} +1 -1
  92. package/dist/sankhyablocks/p-968741cc.js +1 -0
  93. package/dist/sankhyablocks/{p-e7aefd06.js → p-976e56e9.js} +1 -1
  94. package/dist/sankhyablocks/{p-10a1b3a6.js → p-98f9d076.js} +1 -1
  95. package/dist/sankhyablocks/p-bc735728.entry.js +1 -0
  96. package/dist/sankhyablocks/p-be684b38.entry.js +1 -0
  97. package/dist/sankhyablocks/p-c0f656af.entry.js +1 -0
  98. package/dist/sankhyablocks/p-c44f6aaf.entry.js +1 -0
  99. package/dist/sankhyablocks/p-c57bd935.entry.js +1 -0
  100. package/dist/sankhyablocks/p-cfd7da4a.entry.js +1 -0
  101. package/dist/sankhyablocks/{p-0d8f5882.js → p-d1b89765.js} +1 -1
  102. package/dist/sankhyablocks/p-df8621b4.js +1 -0
  103. package/dist/sankhyablocks/p-e28129aa.entry.js +1 -0
  104. package/dist/sankhyablocks/p-e7e54737.entry.js +1 -0
  105. package/dist/sankhyablocks/p-f31bfdee.entry.js +1 -0
  106. package/dist/sankhyablocks/p-f88c45bf.js +1 -0
  107. package/dist/sankhyablocks/p-fe010e54.entry.js +1 -0
  108. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  109. package/dist/types/components/snk-application/snk-application.d.ts +9 -1
  110. package/dist/types/components/snk-crud/snk-crud.d.ts +5 -0
  111. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +5 -0
  112. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +4 -0
  113. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +8 -0
  114. package/dist/types/components/snk-grid/snk-grid.d.ts +13 -0
  115. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  116. package/dist/types/components.d.ts +72 -1
  117. package/dist/types/lib/http/data-fetcher/recaller/GraphQLRecaller.d.ts +1 -0
  118. package/package.json +1 -1
  119. package/dist/sankhyablocks/p-0e8136f6.entry.js +0 -1
  120. package/dist/sankhyablocks/p-29683966.entry.js +0 -1
  121. package/dist/sankhyablocks/p-2a57f7e1.entry.js +0 -1
  122. package/dist/sankhyablocks/p-3940f1e9.entry.js +0 -1
  123. package/dist/sankhyablocks/p-3e8e3025.entry.js +0 -1
  124. package/dist/sankhyablocks/p-3ef191cf.entry.js +0 -1
  125. package/dist/sankhyablocks/p-424a673f.entry.js +0 -1
  126. package/dist/sankhyablocks/p-5438f093.entry.js +0 -1
  127. package/dist/sankhyablocks/p-5807b3aa.entry.js +0 -1
  128. package/dist/sankhyablocks/p-5932777e.entry.js +0 -1
  129. package/dist/sankhyablocks/p-610e2459.js +0 -1
  130. package/dist/sankhyablocks/p-75cfc68e.entry.js +0 -1
  131. package/dist/sankhyablocks/p-7a43351d.entry.js +0 -11
  132. package/dist/sankhyablocks/p-829ebd26.entry.js +0 -1
  133. package/dist/sankhyablocks/p-8cf9c9ce.entry.js +0 -1
  134. package/dist/sankhyablocks/p-a304b0f3.entry.js +0 -1
  135. package/dist/sankhyablocks/p-a63aedf3.entry.js +0 -1
  136. package/dist/sankhyablocks/p-b8350ecf.entry.js +0 -1
  137. package/dist/sankhyablocks/p-cbc28ca6.js +0 -1
  138. package/dist/sankhyablocks/p-d23356a6.js +0 -1
@@ -1,11 +0,0 @@
1
- import{r as t,c as e,h as s,g as i}from"./p-d2d301a6.js";import{WaitingChangeException as n,WarningException as r,ErrorException as a,ObjectUtils as o,DateUtils as c,StringUtils as h,OnboardingUtils as u,DependencyType as l,ElementIDUtils as p,ApplicationContext as d,ErrorTracking as m,DataType as w}from"@sankhyalabs/core";import{d as f,D as y,U as g}from"./p-cbc28ca6.js";import{ApplicationUtils as P}from"@sankhyalabs/ezui/dist/collection/utils";import{P as I}from"./p-a54bdcc8.js";import{G as v,C as A}from"./p-bdcfbe10.js";import{D as _}from"./p-70b8e4a4.js";import{R as S}from"./p-49b24449.js";import{S as E}from"./p-ae6aff81.js";import"./p-112455b1.js";import"./p-10a1b3a6.js";import"./p-e7aefd06.js";import"./p-584d7212.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";class C{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const e=t.reason;e instanceof n||(e?this.processException(e):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof n||t instanceof r?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((e=>{if(e)if(t instanceof Error)this._app.error(t.name,t.message);else{const e=(null==t?void 0:t.title)||"Erro detectado",s="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(e,s)}}))}}function b(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(b=function(){return t})()}const D=T;function T(t,e){const s=b();return(T=function(t){return s[t-=392]})(t,e)}!function(){const t=T,e=b();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const N=D(396);class j{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",f.gql`query($filters: [InputFilter!] $name: String!) {
2
- $queryAlias$: fetchTotals(name: $name, filters: $filters ){
3
- name
4
- value
5
- }
6
- }`)}fetchTotals(t,e,s=[]){const i=`${t}_${e}`,n=this.cancel.findIndex((t=>t[i]));return n>=0&&(this.cancel[n][i](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,e,s)]).then((t=>{let e=new Map;if(t){e=t;const s=this.cancel.findIndex((t=>t[i]));s>=0&&this.cancel.splice(s,1)}return e}))}getTotals(t,e,s=[]){return new Promise(((i,n)=>{y.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${e}`,filters:s}}).then((t=>{if(t.length>0){const e=new Map;return t.forEach((t=>e.set(t.name,parseFloat(t.value)))),i(e)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}var O;class k{static openAppActivity(t,e){var s;null===(s=window.workspace)||void 0===s||s.openAppActivity(t,e)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}}k.resourceID=null===(O=window.workspace)||void 0===O?void 0:O.resourceID;class L{static webConnectionCaller(t,e,s){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,e,s)}}class U{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",f.gql`query($name: String!) {
7
- $queryAlias$: fetchResource(name: $name){
8
- name
9
- resource
10
- }
11
- }`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return"S"===this.getValue(e)}async asDate(t){const e=await this.getParam(t);return c.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource))return"";try{const e=o.stringToObject(t.resource),[s]=Object.keys(e);return e[s]}catch(t){console.warn("Erro ao converter string JSON.")}}}const $=R;function R(t,e){const s=M();return(R=function(t){return s[t-=378]})(t,e)}function M(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(M=function(){return t})()}!function(){const t=R,e=M();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class F{[$(397)](t){const e=$;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new q("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class q{constructor(t){const e=$;this.isSup=t,this[e(384)]={}}[$(378)](t,e){this[$(384)][t]=e}[$(393)](t){const e=$;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class x extends S{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=o.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var z;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(z||(z={}));const G=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new H,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new U),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||k.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new J(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}initOnboarding(t){return u.getInstance().init(t,window.envContext),Promise.resolve()}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(z).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){k.openAppActivity(t,e)}async webConnection(t,e,s){this.getStringParam(t).then((t=>{L.webConnectionCaller(t,e,s)}))}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e,s,i){return new Promise(((n,r)=>{const a=this.getDuPromissesStack(e),o=a.length>0;if(a.push(new J(n,r)),!o){const n=this.dataUnitFetcher.getDataUnit(t,this.resourceID,s,i);n.loadMetadata().then((()=>{for(e&&this.updateDataunitCache(void 0,e,n);a.length>0;)a.pop().resolve(n)})).catch((t=>{for(;a.length>0;)a.pop().reject(t)}))}}))}async updateDataunitCache(t,e,s){t&&this._duCache.delete(t),this._duCache.set(e,s)}async getDataUnit(t,e,s,i){return new Promise(((n,r)=>{const a=this._duCache.get(e);a?n(a):this.createDataunit(t,e,s,i).then((t=>{n(t)})).catch((t=>r(t)))}))}async addClientEvent(t,e){return new Promise((s=>{y.addClientEvent(t,e),s()}))}async removeClientEvent(t){return new Promise((e=>{y.removeClientEvent(t),e()}))}async hasClientEvent(t){return new Promise((e=>{e(y.hasClientEvent(t))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return P.alert(t,e,s,i)}async error(t,e,s,i){return P.error(t,e,s,i)}async success(t,e,s,i){return P.success(t,e,s,i)}async message(t,e,s,i){return P.message(t,e,s,i)}async confirm(t,e,s,i,n){return P.confirm(t,e,s,i,n)}async info(t,e){return P.info(t,e)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async getAuthList(t){return await(new F).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=g.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new _),this._dataUnitFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new v),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new j),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new I),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new x),this._authFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:n}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let p;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:s.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var e;t.type===l.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||w.TEXT,n=s.getFieldValue(t);if(null==n)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:n,dataType:i}}))})})),this.executePreparedSearch(e,n,{entity:r,entityDescription:h,criteria:p,searchOptions:d})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:n,criteria:r,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s[p.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,r,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(n),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return k.getAppLabel(this._resourceID)}addSearchListener(t,e,s){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,e.dataUnitId,s))}))}importScript(t){return new Promise((e=>{this.getApplicationPath().then((s=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const e=document.createElement("script");e.src=`${s}/${t}`,e.async=!0,document.body.appendChild(e)})),e()}))}))}getApplicationPath(){return new Promise((t=>{"dev"!==window.applicationenv&&t(`/${window.MGE_MODULE_NAME}/labsApps/${window.APPLICATION_NAME}/build`),t("")}))}executeSelectDistinct(t,e,s){return this.dataUnitFetcher.loadSelectDistinct(t,e,s)}getDataFetcher(){return Promise.resolve(y.get())}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new E,d.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${g.getUrlBase()}/mge/upload/file`),d.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),d.setContextValue("__EZUI__GRID_LICENSE__",N),m.init(),A.get()}connectedCallback(){d.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),p.addIDInfo(this._element,`resource_${this._resourceID}`)}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class H{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class J{constructor(t,e){this.resolve=t,this.reject=e}}G.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{G as snk_application}
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as d,ApplicationContext as r,DataType as a}from"@sankhyalabs/core";import{UserInterface as n}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{T as o}from"./p-a2493d11.js";import{C as l}from"./p-bdcfbe10.js";import{P as h}from"./p-5534e08c.js";import{T as c}from"./p-c2beb95c.js";import{s as u}from"./p-6dc031de.js";import{S as v}from"./p-fa9d3f73.js";import{SelectionMode as g}from"@sankhyalabs/core/dist/dataunit/DataUnit";import"./p-10a1b3a6.js";import"./p-cbc28ca6.js";import"./p-112455b1.js";import"./p-49b24449.js";import"./p-e7aefd06.js";import"./p-584d7212.js";const m=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this._multiSelectionListDataSource=new v,this._topTaskbarProcessor=new c({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE"],"snkGridTopTaskbar.finish_edition.secondary":[]}),this._headerTaskbarProcessor=new c({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.detail.unselected":["REFRESH"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"]}),this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this.configName=void 0,this.selectionToastConfig=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=h.PRIMARY,this.messagesBuilder=void 0}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}async reloadFilterBar(){var i;null===(i=this._snkFilterBar)||void 0===i||i.reload()}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._snkGridConfig.selectedIndex=0,this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i}loadConfig(){l.get().then((i=>{i.loadGridConfig(this.configName).then((i=>{this.setGridConfig(i)})).catch((i=>{console.warn(i)}))}))}gridConfigChangeHandler(i){l.saveGridConfig(i.detail,this.configName),i.stopPropagation()}modalConfigChangeHandler(i){const t=i.detail;this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}buildColumnsMetadata(i){const t=[];return null==i||i.forEach((i=>{var s,e;if(i.hidden&&"RECDESP"!==i.name)return;const d=null===(s=this._dataUnit)||void 0===s?void 0:s.getField(i.name);if(t.push({label:i.label,id:i.name,width:i.width,type:null==d?void 0:d.dataType,userInterface:null==d?void 0:d.userInterface}),null!=(null===(e=null==d?void 0:d.properties)||void 0===e?void 0:e.DESCRIPTIONFIELD)){const i=d.properties.mergedFrom;t.push({label:d.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${d.properties.ENTITYNAME}.${d.properties.DESCRIPTIONFIELD}`,width:200,type:a.TEXT,userInterface:n.LONGTEXT})}})),t||[]}getPaginationInfo(){var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getPaginationInfo()}getExporterOffset(i){if(null==i)return;const t=i.firstRecord;return t>0?t-1:t}async dataExporterProviderStore(){var i;const t=await(null===(i=this._snkDataUnit)||void 0===i?void 0:i.getSelectedRecordsIDsInfo()),s={getFilters:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getAppliedFilters()},getColumnsMetadata:async()=>{var i;const t=await(null===(i=this._grid)||void 0===i?void 0:i.getColumnsState());return this.buildColumnsMetadata(t)},getOrders:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getSort()},getResourceURI:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.name},getSelectedNumber:()=>{var i,t;return null===(t=null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)||void 0===t?void 0:t.length},getTotalRecords:()=>{var i,t,s;const{total:e}=(null===(i=this._dataUnit)||void 0===i?void 0:i.getPaginationInfo())||{};return null!=e?e:null===(s=null===(t=this._dataUnit)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length},getSelectedIDs:()=>t||[],getOffset:()=>this.getExporterOffset(this.getPaginationInfo()),getLimit:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.pageSize},getRecordID:()=>{var i,t,s;return null===(s=null===(t=null===(i=this._dataUnit)||void 0===i?void 0:i.records)||void 0===t?void 0:t[0])||void 0===s?void 0:s.__record__id__}};u.set("exporterProviders",Object.assign(Object.assign({},u.get("exporterProviders")),{[this.configName]:s}))}addElementID(){d.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}finshLoading(){this._dataUnitLoadLockerResolver=this._dataUnit.addLoadingLocker(),this.addElementID(),this._multiSelectionListDataSource.setApplication(this._application),this._multiSelectionListDataSource.setDataUnit(this._dataUnit)}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit?this.finshLoading():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.finshLoading()})),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),this._snkDataUnit.addEventListener("dataStateChange",(i=>{this._dataState=i.detail})),this._snkDataUnit.addEventListener("cancelEdition",(()=>{var i;(null===(i=this._dataState)||void 0===i?void 0:i.recordsIsEmpty)&&this._dataUnit.clearSelection()}));break}i=i.parentElement}this.loadConfig()}getHeaderDisabledButtons(){var i;const t=[];return(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)&&(this._dataState.selectionInfo.length>1&&t.push(o.CLONE,"ATTACH"),this._dataState.selectionInfo.isAllRecords()&&t.push("REMOVE")),t}getInvisibleButtons(){let i=[];return this._dataUnit&&0!==this._dataUnit.records.length||i.push("DATA_EXPORTER"),this._dataState&&this._dataState.selectionInfo.mode===g.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}componentWillRender(){var i;const t=this.getInvisibleButtons();let s;s=this._dataState&&(null===(i=this._dataState.selectionInfo)||void 0===i?void 0:i.length)?this.isDetail?"snkGridHeaderTaskbar.detail.selected":"snkGridHeaderTaskbar.selected":this.isDetail?"snkGridHeaderTaskbar.detail.unselected":"snkGridHeaderTaskbar.unselected",this._headerTaskbarProcessor.process(s,this.taskbarManager,this._dataState,this.getHeaderDisabledButtons(),t),this._topTaskbarProcessor.process(this.getTopTaskBarId(this.presentationMode===h.SECONDARY?".secondary":""),this.taskbarManager,this._dataState,void 0,t),this.dataExporterProviderStore()}getTopTaskBarId(i){var t;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)?`snkGridTopTaskbar.finish_edition${i}`:`snkGridTopTaskbar.regular${i}`}getPrimaryButton(){return this.presentationMode===h.PRIMARY?"INSERT":""}onEzGridReady(){var i;null===(i=this._dataUnitLoadLockerResolver)||void 0===i||i.call(this),this._dataUnitLoadLockerResolver=void 0}render(){var i,t;if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"snk-grid__header ez-margin-bottom--medium"},s("snk-filter-bar",{ref:i=>this._snkFilterBar=i,dataUnit:this._dataUnit,"data-element-id":"gridFilter",class:"snk-grid__filter-bar ez-align--top",configName:this.configName,messagesBuilder:this.messagesBuilder}),(null===(t=null===(i=this._snkFilterBar)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.length)>0&&s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"}),s("snk-taskbar",{class:"ez-padding-left--medium","data-element-id":"grid_top",key:"topTaskbar",configName:this.configName,dataUnit:this._dataUnit,messagesBuilder:this.messagesBuilder,buttons:this._topTaskbarProcessor.buttons,disabledButtons:this._topTaskbarProcessor.disabledButtons,customButtons:this._topTaskbarProcessor.customButtons,primaryButton:this.getPrimaryButton()})),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===h.SECONDARY?"snk-grid-container__without-shadow ":"")+"snk-grid__table","data-element-id":"embedded",dataUnit:this._dataUnit,key:"grid-"+this._snkDataUnit.entityName,config:this._gridConfig,onConfigChange:i=>{this.gridConfigChangeHandler(i)},onEzDoubleClick:()=>this.gridDoubleClick.emit(),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,onComponentReady:()=>this.onEzGridReady(),columnfilterDataSource:this._multiSelectionListDataSource,selectionToastConfig:this.selectionToastConfig},s("snk-taskbar",{dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this._headerTaskbarProcessor.buttons,disabledButtons:this._headerTaskbarProcessor.disabledButtons,customButtons:this._headerTaskbarProcessor.customButtons,slot:"leftButtons",actionsList:this.actionsList})),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})),s("ez-modal",{modalSize:"small",closeEsc:!1,closeOutsideClick:!1,opened:this._popUpGridConfig,onEzCloseModal:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(d.DATA_ELEMENT_ID_ATTRIBUTE_NAME),application:this._application,selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig()})))}get _element(){return e(this)}};m.style=".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:300px}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";export{m as snk_grid}
@@ -1 +0,0 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{ObjectUtils as o,ApplicationContext as r,DataType as n,ElementIDUtils as a}from"@sankhyalabs/core";import{ApplicationUtils as l,DialogType as d}from"@sankhyalabs/ezui/dist/collection/utils";import{D as h,a as c,b as p}from"./p-5534e08c.js";import{R as u}from"./p-4a78e118.js";import{D as m}from"./p-cbc28ca6.js";import{S as v}from"./p-d23356a6.js";import"./p-112455b1.js";import"./p-ae6aff81.js";class x{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===h.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===h.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS];if(t===h.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===h.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===h.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===h.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===h.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportByEmail(t,e){t===h.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:h.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:h.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:h.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:h.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:h.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:h.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function f(t){var{methodName:e}=t,i=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(t,["methodName"]);const s=`mgefin-bff@DataExporterSPBean.${e}`,r={serviceName:s,requestBody:i};return new Promise(((t,e)=>{m.get().callServiceBroker(s,o.objectToString(r)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>e(t)))}))}const E=5e3,k=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._items=[],this._showDropdown=!1,this._releasedToExport=[h.EXPORT_TO_PDF,h.EXPORT_TO_XLS,h.EXPORT_BY_EMAIL,h.EXPORT_PDF_TO_EMAIL,h.EXPORT_XLS_TO_EMAIL,h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS],this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=c[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:c.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),l.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=v.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}async resolveExporter(t,e){if(null==this.provider||null==t||null==e)return;const i=this.provider.getFilters(),s=await this.provider.getColumnsMetadata(),o=this.provider.getOrders(),r=this.provider.getResourceURI(),n=this.provider.getSelectedIDs(),a=t.exportOption,d=[h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS];delete t.exportOption;let c=Object.assign({filters:i,columns:s,sort:o,resourceURI:r,selectedIDs:n.slice(0,E)},t);if(d.includes(a)||"page"==t.type){const t=this.provider.getOffset(),e=this.provider.getLimit();c=Object.assign(Object.assign({},c),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(c=Object.assign(Object.assign({},c),{offset:0,limit:E,selectedIDs:[]}));f(c).then((t=>e(t))).catch((t=>l.error(this.getMessage("snkDataExporter.message.exportError"),t?t.statusMessage:this.getMessage("snkDataExporter.message.exportError"))))}getOptionKey(t){return Object.keys(h).find((e=>h[e]===t))}dispatchExporter(t){var e;const i=this.getOptionKey(t),s=null!==(e=p[i])&&void 0!==e?e:p.EXPORT_TO_PDF,o=p[i]===p.EXPORT_TO_XLS;this.resolveExporter({methodName:h[`EXPORT_TO_${s}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:E},(t=>{!function({fileSessionKey:t,isDownload:e}){const i=r.getContextValue("__SNK__APPLICATION__");window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${e?"&download=S":""}`),l.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(i),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:s,isDownload:o}))}))}async processExporter(t){var e,i,s,o;const r=null==t?void 0:t.detail,n=[h.EXPORT_PAGE_TO_PDF,h.EXPORT_PAGE_TO_XLS],a=null===(e=null==r?void 0:r.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==r?void 0:r.id)===h.EXPORT_CURRENT_PAGE)return;const c=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),p=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),u=null===(o=this.provider)||void 0===o?void 0:o.getLimit();let m=!1;if(n.includes(null==r?void 0:r.id)&&u<=E||a?m=!1:(null==c?void 0:c.length)?m=c.length>E:p>E&&(m=!0),m){const t=E.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await l.confirm(e.title,e.description,null,d.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(a)return this.openPersonalizedReports(r.id),void(this._showDropdown=!1);this._releasedToExport.includes(null==r?void 0:r.id)&&(r.id===h.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(r.id),this._showDropdown=!1)}loadItems(){const t=[];this._releasedToExport.forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e;const i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID();if(null==i)return void(this._items=t);const s=await function(t){const e="mgefin-bff@DataExporterSPBean.getPersonalizedReports",i={serviceName:e,requestBody:t};return new Promise(((t,s)=>m.get().callServiceBroker(e,o.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:i});null==s||s.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e;const i=[],s=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(e=this.provider)||void 0===e||e.getSelectedIDs().forEach((({name:t,type:e,value:s},o)=>{const r=[];r.fields=[],0===o&&(i[`PK_${t}`]={type:this.parseDataType(e),value:s},i.pks=[]),r.fields.push({nome:t,tipo:e,valor:s}),i.pks.push(r)})),this._application.openApp(`${u}${s}`,i)}parseDataType(t){switch(t){case n.NUMBER:return"I";case n.DATE:return"D";default:return"S"}}loadDropdown(){var t,e;this._selectedNumber=(null===(e=null===(t=this.provider)||void 0===t?void 0:t.getSelectedIDs())||void 0===e?void 0:e.length)||0,this._itemBuilder=new x(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=r.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(a.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" snk-data-exporter--overlap":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};k.style=".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{k as snk_data_exporter}
@@ -1 +0,0 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-d2d301a6.js";import{P as r}from"./p-cbc28ca6.js";import{ApplicationUtils as h}from"@sankhyalabs/ezui/dist/collection/utils";import{ElementIDUtils as l,ApplicationContext as n}from"@sankhyalabs/core";import a from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status";import"./p-112455b1.js";const o=class{constructor(e){t(this,e),this.APPLY="OK",this.CANCEL="CANCEL",this.CLOSE="CLOSE",this.REMOTE_PRINTERS_TAB="0",this.LOCAL_PRINTERS_TAB="1",this._hasRemotePrinters=!1,this._hasLocalPrinters=!1,this._localPrinters=[],this._isSingleJob=!1,this._saveSubstitute=!1,this.buildIdTabSelector=()=>{const t=[{label:this.getMessage("snkPrintSelector.title.localPrintersTab"),tabKey:this.LOCAL_PRINTERS_TAB,index:Number(this.LOCAL_PRINTERS_TAB)}];return this._printServerActive&&t.unshift({label:this.getMessage("snkPrintSelector.title.remotePrintersTab"),tabKey:this.REMOTE_PRINTERS_TAB,index:Number(this.REMOTE_PRINTERS_TAB)}),[...t]},this._printServerActive=!1,this._selectedPrinter=void 0,this._remotePrintersDataSource=[],this._localPrintersDataSource=[],this._printJobData=void 0}async openPrintSelector(t){return new Promise((e=>{this._printJobData=t,this._isSingleJob=1===this._printJobData.pendingPrinters.length,this._printServerActive=this._printJobData.printServerActive,this._printServerActive?this.buildRemotePrinters():(this.buildLocalPrinters(),this._viewStack.show(+this.LOCAL_PRINTERS_TAB)),this._ezPopup.opened=!0,this._printerResolver=e}))}closePrintSelector(){this._ezPopup.opened=!1,this.element.remove()}handleModalAction(t){switch(t){case this.APPLY:this.handleApply();break;case this.CANCEL:case this.CLOSE:this.handleCancel()}}async handleCancel(){await h.confirm(this.getMessage("snkPrintSelector.title.warning"),this.getMessage("snkPrintSelector.message.canceledPrint"))&&(this.closePrintSelector(),this._printerResolver({selectedPrinter:void 0,saveSubstitute:!1}))}handleApply(){this._printerResolver({selectedPrinter:this._selectedPrinter,saveSubstitute:this._saveSubstitute}),this.closePrintSelector()}onChangeTab(t){t.detail.tabKey===this.LOCAL_PRINTERS_TAB&&this.buildLocalPrinters(),this._viewStack.show(+t.detail.tabKey)}buildRemotePrinters(){const t=[];this._printJobData.printServers.forEach((e=>{t.push({group:e.printServerUri,items:e.printerList.map((t=>({label:t.printerName,group:e.printServerUri})))})})),this._remotePrintersDataSource=t,this._hasRemotePrinters=this._remotePrintersDataSource.length>0}buildLocalPrinters(){this._localPrintersDataSource.length>0||(this._localPrinters=r.getInstance().getLocalPrinters(),this._localPrintersDataSource=this._localPrinters.map((t=>({label:t.nome}))),this._hasLocalPrinters=this._localPrintersDataSource.length>0)}onSelectPrinter(t,e){if(e)return this._hasRemotePrinters&&this._remotePrintersList.removeSelection(),void(this._selectedPrinter=this._localPrinters.find((e=>e.nome===t.label)));this._hasLocalPrinters&&this._localPrintersList.removeSelection();const i=this._printJobData.printServers.find((e=>e.printServerUri===t.group));this._selectedPrinter=null==i?void 0:i.printerList.find((e=>e.printerName===t.label))}renderNoPrinters(){return e("div",{class:"ez-flex ez-flex--justify-center ez-flex--align-items-center ez-size-height--full ez-size-width--full"},e("span",{class:"ez-text ez-text--primary ez-text--medium"},this.getMessage("snkPrintSelector.message.noPrinters")))}buildPrinterIcon(){return e("ez-icon",{iconName:"print",style:{marginRight:"var(--space--small)"}})}getElementID(t){return{[l.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:l.getInternalIDInfo(t)}}getMessage(t){return this._application.messagesBuilder.getMessage(t,void 0)}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__")}componentDidLoad(){this.element&&l.addIDInfo(this.element)}render(){return e(i,null,e("ez-popup",Object.assign({size:"small",heightMode:"full",useHeader:!1,ref:t=>this._ezPopup=t},this.getElementID("snk-print-selector")),e("ez-modal-container",{modalTitle:this.getMessage("snkPrintSelector.title.printerSelection"),okButtonLabel:this.getMessage("snkPrintSelector.button.print"),okButtonStatus:this._selectedPrinter?a.ENABLED:a.DISABLED,cancelButtonLabel:this.getMessage("snkPrintSelector.button.cancel"),onEzModalAction:t=>this.handleModalAction(t.detail)},this._isSingleJob&&e("div",{class:"ez-flex ez-margin-bottom--large"},e("div",{class:"ez-flex ez-margin-right--large"},e("span",{class:"ez-text ez-text--bold ez-text--medium ez-padding-right--small"},this.getMessage("snkPrintSelector.subtitle.document")),e("span",{class:"ez-text ez-text--primary ez-text--medium"},this._printJobData.pendingPrinters[0].docTypeDescription)),e("div",{class:"ez-flex ez-margin-right--large"},e("span",{class:"ez-text ez-text--bold ez-text--medium ez-padding-right--small"},this.getMessage("snkPrintSelector.subtitle.jobs")),e("span",{class:"ez-text ez-text--primary ez-text--medium"},this._printJobData.pendingPrinters[0].printJobCount))),e("ez-tabselector",{tabs:this.buildIdTabSelector(),onEzChange:t=>this.onChangeTab(t),selectedTab:this._printServerActive?this.REMOTE_PRINTERS_TAB:this.LOCAL_PRINTERS_TAB}),e("ez-view-stack",{ref:t=>this._viewStack=t},e("stack-item",{hidePolicy:"hide"},this._printServerActive&&e("div",{class:"list-scroll ez-size-height--full "+(this._isSingleJob?"with-header":"without-header")},e("ez-list",{ref:t=>this._remotePrintersList=t,class:"ez-padding-top--medium "+(this._hasRemotePrinters?"":"hidden"),dataSource:this._remotePrintersDataSource,onEzSelectItem:t=>this.onSelectPrinter(t.detail,!1),itemLeftSlotBuilder:this.buildPrinterIcon,useGroups:!0,ezSelectable:!0,hoverFeedback:!0,"data-element-id":"remotePrintersList"}),!this._hasRemotePrinters&&this.renderNoPrinters())),e("stack-item",{hidePolicy:"hide"},e("div",{class:"list-scroll ez-size-height--full "+(this._isSingleJob?"with-header":"without-header")},e("ez-list",{ref:t=>this._localPrintersList=t,class:"ez-padding-top--medium "+(this._hasLocalPrinters?"":"hidden"),dataSource:this._localPrintersDataSource,onEzSelectItem:t=>this.onSelectPrinter(t.detail,!0),itemLeftSlotBuilder:this.buildPrinterIcon,ezSelectable:!0,hoverFeedback:!0}),!this._hasLocalPrinters&&this.renderNoPrinters()))),e("ez-check",{label:this.getMessage("snkPrintSelector.message.savePrinter"),onEzChange:t=>this._saveSubstitute=t.detail,compact:!0}))))}get element(){return s(this)}};o.style=".sc-snk-print-selector-h{max-height:100%}ez-modal-container.sc-snk-print-selector{--ez-modal-container-overflow-y:hidden}ez-list.sc-snk-print-selector{height:100%}.list-scroll.sc-snk-print-selector{height:100%;overflow-y:auto;padding-right:var(--snk-grid-config__main--padding-right)}.with-header.sc-snk-print-selector{max-height:calc(100% - 125px)}.without-header.sc-snk-print-selector{max-height:calc(100% - 85px)}.list-scroll.sc-snk-print-selector::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.hidden.sc-snk-print-selector{display:none}";export{o as snk_print_selector}
@@ -1 +0,0 @@
1
- export{S as snk_data_unit}from"./p-d23356a6.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-ae6aff81.js";
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as a,ApplicationContext as h}from"@sankhyalabs/core";import{T as n}from"./p-a2493d11.js";import"./p-cbc28ca6.js";import"./p-a54bdcc8.js";import{P as o}from"./p-5534e08c.js";import{c as r}from"./p-4a78e118.js";import"./p-6dc031de.js";import"./p-112455b1.js";const c=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this._viewHistory=[],this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=r.GRID,this.configName=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=o.PRIMARY,this.messagesBuilder=void 0}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===r.GRID,this.setViewMode(r.FORM)}async executeAction(t){return t===n.GRID_MODE?this.setViewMode(r.GRID):t===n.FORM_MODE||t===n.UPDATE?this.gridToForm(t!==n.UPDATE):t===n.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(r.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||r.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t}openConfig(t){this._snkConfigurator.close(),t===r.GRID?this._snkGrid.showConfig():t===r.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){a.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(r.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}componentWillLoad(){let t=this._element.parentElement;for(;t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",(async({detail:t})=>{this._dataState=t,void 0!==t.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}));break}t=t.parentElement}if(!this.configName){const t=h.getContextValue("__SNK__APPLICATION__");this.configName=t.configName}}initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder)}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}render(){return s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,selectionToastConfig:this.selectionToastConfig},s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(r.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form"},s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL")},s("div",{slot:"SnkConfigContainerSlot"},s("slot",{name:"SnkConfigContainerSlot"}))))}get _element(){return e(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};c.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{c as snk_crud}
@@ -1 +0,0 @@
1
- import{StringUtils as t,ApplicationContext as e,ErrorException as n,WarningException as i,ObjectUtils as r}from"@sankhyalabs/core";import{c as s,a as o}from"./p-112455b1.js";var u=s((function(t,e){var n="undefined"!=typeof self?self:o,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,r="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function p(t){var e=new FileReader,n=v(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=v(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=c(t),e=l(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},f.prototype.delete=function(t){delete this.map[c(t)]},f.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},f.prototype.set=function(t,e){this.map[c(t)]=l(e)},f.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),h(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),h(t)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,i,r=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(i=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];O.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function S(t,n){return new Promise((function(i,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL"),i(new O("response"in u?u.response:u.responseText,n))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&r&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=f,t.Request=w,t.Response=O),e.Headers=f,e.Request=w,e.Response=O,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=i;(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e})),a=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=function(t){return"object"==typeof t&&null!==t}})),c=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=function(t,e){if(!Boolean(t))throw new Error(null!=e?e:"Unexpected invariant triggered.")}})),l=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=function(t,e){let i=0,r=1;for(const s of t.body.matchAll(n)){if("number"==typeof s.index||(0,c.invariant)(!1),s.index>=e)break;i=s.index+s[0].length,r+=1}return{line:r,column:e+1-i}};const n=/\r\n|[\n\r]/g})),h=s((function(t,e){function n(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,s=e.line-1,o=e.line+(t.locationOffset.line-1),u=e.column+(1===e.line?n:0),a=`${t.name}:${o}:${u}\n`,c=r.split(/\r\n|[\n\r]/g),l=c[s];if(l.length>120){const t=Math.floor(u/80),e=u%80,n=[];for(let t=0;t<l.length;t+=80)n.push(l.slice(t,t+80));return a+i([[`${o} |`,n[0]],...n.slice(1,t+1).map((t=>["|",t])),["|","^".padStart(e)],["|",n[t+1]]])}return a+i([[o-1+" |",c[s-1]],[`${o} |`,l],["|","^".padStart(u)],[`${o+1} |`,c[s+1]]])}function i(t){const e=t.filter((([t,e])=>void 0!==e)),n=Math.max(...e.map((([t])=>t.length)));return e.map((([t,e])=>t.padStart(n)+(e?" "+e:""))).join("\n")}Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=function(t){return n(t.source,(0,l.getLocation)(t.source,t.start))},e.printSourceLocation=n})),f=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=function(t){return t.toJSON()},e.printError=function(t){return t.toString()};class n extends Error{constructor(t,...e){var r,s,o;const{nodes:u,source:c,positions:h,path:f,originalError:d,extensions:v}=function(t){const e=t[0];return null==e||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}(e);super(t),this.name="GraphQLError",this.path=null!=f?f:void 0,this.originalError=null!=d?d:void 0,this.nodes=i(Array.isArray(u)?u:u?[u]:void 0);const p=i(null===(r=this.nodes)||void 0===r?void 0:r.map((t=>t.loc)).filter((t=>null!=t)));this.source=null!=c?c:null==p||null===(s=p[0])||void 0===s?void 0:s.source,this.positions=null!=h?h:null==p?void 0:p.map((t=>t.start)),this.locations=h&&c?h.map((t=>(0,l.getLocation)(c,t))):null==p?void 0:p.map((t=>(0,l.getLocation)(t.source,t.start)));const m=(0,a.isObjectLike)(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(o=null!=v?v:m)&&void 0!==o?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const e of this.nodes)e.loc&&(t+="\n\n"+(0,h.printLocation)(e.loc));else if(this.source&&this.locations)for(const e of this.locations)t+="\n\n"+(0,h.printSourceLocation)(this.source,e);return t}toJSON(){const t={message:this.message};return null!=this.locations&&(t.locations=this.locations),null!=this.path&&(t.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function i(t){return void 0===t||0===t.length?void 0:t}e.GraphQLError=n})),d=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=function(t,e,n){return new f.GraphQLError(`Syntax Error: ${n}`,{source:t,positions:[e]})}})),v=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=function(t){const e=null==t?void 0:t.kind;return"string"==typeof e&&s.has(e)};class n{constructor(t,e,n){this.start=t.start,this.end=e.end,this.startToken=t,this.endToken=e,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}e.Location=n;class i{constructor(t,e,n,i,r,s){this.kind=t,this.start=e,this.end=n,this.line=i,this.column=r,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}e.Token=i;const r={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};e.QueryDocumentKeys=r;const s=new Set(Object.keys(r));var o;e.OperationTypeNode=o,function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"}(o||(e.OperationTypeNode=o={}))})),p=s((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0,e.DirectiveLocation=n,function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(n||(e.DirectiveLocation=n={}))})),m=s((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0,e.Kind=n,function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(n||(e.Kind=n={}))})),y=s((function(t,e){function n(t){return t>=48&&t<=57}function i(t){return t>=97&&t<=122||t>=65&&t<=90}Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=i,e.isNameContinue=function(t){return i(t)||n(t)||95===t},e.isNameStart=function(t){return i(t)||95===t},e.isWhiteSpace=function(t){return 9===t||32===t}})),b=s((function(t,e){function n(t){let e=0;for(;e<t.length&&(0,y.isWhiteSpace)(t.charCodeAt(e));)++e;return e}Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=function(t){var e;let i=Number.MAX_SAFE_INTEGER,r=null,s=-1;for(let e=0;e<t.length;++e){var o;const u=t[e],a=n(u);a!==u.length&&(r=null!==(o=r)&&void 0!==o?o:e,s=e,0!==e&&a<i&&(i=a))}return t.map(((t,e)=>0===e?t:t.slice(i))).slice(null!==(e=r)&&void 0!==e?e:0,s+1)},e.isPrintableAsBlockString=function(t){if(""===t)return!0;let e=!0,n=!1,i=!0,r=!1;for(let s=0;s<t.length;++s)switch(t.codePointAt(s)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:case 13:return!1;case 10:if(e&&!r)return!1;r=!0,e=!0,n=!1;break;case 9:case 32:n||(n=e);break;default:i&&(i=n),e=!1}return!e&&(!i||!r)},e.printBlockString=function(t,e){const n=t.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,s=i.length>1&&i.slice(1).every((t=>0===t.length||(0,y.isWhiteSpace)(t.charCodeAt(0)))),o=n.endsWith('\\"""'),u=t.endsWith('"')&&!o,a=t.endsWith("\\"),c=u||a,l=!(null!=e&&e.minimize)&&(!r||t.length>70||c||s||o);let h="";const f=r&&(0,y.isWhiteSpace)(t.charCodeAt(0));return(l&&!f||s)&&(h+="\n"),h+=n,(l||c)&&(h+="\n"),'"""'+h+'"""'}})),w=s((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0,e.TokenKind=n,function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"}(n||(e.TokenKind=n={}))})),g=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.isPunctuatorTokenKind=function(t){return t===w.TokenKind.BANG||t===w.TokenKind.DOLLAR||t===w.TokenKind.AMP||t===w.TokenKind.PAREN_L||t===w.TokenKind.PAREN_R||t===w.TokenKind.SPREAD||t===w.TokenKind.COLON||t===w.TokenKind.EQUALS||t===w.TokenKind.AT||t===w.TokenKind.BRACKET_L||t===w.TokenKind.BRACKET_R||t===w.TokenKind.BRACE_L||t===w.TokenKind.PIPE||t===w.TokenKind.BRACE_R};class n{constructor(t){const e=new v.Token(w.TokenKind.SOF,0,0,0,0);this.source=t,this.lastToken=e,this.token=e,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==w.TokenKind.EOF)do{if(t.next)t=t.next;else{const e=c(this,t.end);t.next=e,e.prev=t,t=e}}while(t.kind===w.TokenKind.COMMENT);return t}}function i(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function r(t,e){return s(t.charCodeAt(e))&&o(t.charCodeAt(e+1))}function s(t){return t>=55296&&t<=56319}function o(t){return t>=56320&&t<=57343}function u(t,e){const n=t.source.body.codePointAt(e);if(void 0===n)return w.TokenKind.EOF;if(n>=32&&n<=126){const t=String.fromCodePoint(n);return'"'===t?"'\"'":`"${t}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function a(t,e,n,i,r){return new v.Token(e,n,i,t.line,1+n-t.lineStart,r)}function c(t,e){const n=t.source.body,s=n.length;let o=e;for(;o<s;){const e=n.charCodeAt(o);switch(e){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++t.line,t.lineStart=o;continue;case 13:10===n.charCodeAt(o+1)?o+=2:++o,++t.line,t.lineStart=o;continue;case 35:return l(t,o);case 33:return a(t,w.TokenKind.BANG,o,o+1);case 36:return a(t,w.TokenKind.DOLLAR,o,o+1);case 38:return a(t,w.TokenKind.AMP,o,o+1);case 40:return a(t,w.TokenKind.PAREN_L,o,o+1);case 41:return a(t,w.TokenKind.PAREN_R,o,o+1);case 46:if(46===n.charCodeAt(o+1)&&46===n.charCodeAt(o+2))return a(t,w.TokenKind.SPREAD,o,o+3);break;case 58:return a(t,w.TokenKind.COLON,o,o+1);case 61:return a(t,w.TokenKind.EQUALS,o,o+1);case 64:return a(t,w.TokenKind.AT,o,o+1);case 91:return a(t,w.TokenKind.BRACKET_L,o,o+1);case 93:return a(t,w.TokenKind.BRACKET_R,o,o+1);case 123:return a(t,w.TokenKind.BRACE_L,o,o+1);case 124:return a(t,w.TokenKind.PIPE,o,o+1);case 125:return a(t,w.TokenKind.BRACE_R,o,o+1);case 34:return 34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)?T(t,o):p(t,o)}if((0,y.isDigit)(e)||45===e)return h(t,o,e);if((0,y.isNameStart)(e))return D(t,o);throw(0,d.syntaxError)(t.source,o,39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":i(e)||r(n,o)?`Unexpected character: ${u(t,o)}.`:`Invalid character: ${u(t,o)}.`)}return a(t,w.TokenKind.EOF,s,s)}function l(t,e){const n=t.source.body,s=n.length;let o=e+1;for(;o<s;){const t=n.charCodeAt(o);if(10===t||13===t)break;if(i(t))++o;else{if(!r(n,o))break;o+=2}}return a(t,w.TokenKind.COMMENT,e,o,n.slice(e+1,o))}function h(t,e,n){const i=t.source.body;let r=e,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),(0,y.isDigit)(s))throw(0,d.syntaxError)(t.source,r,`Invalid number, unexpected digit after 0: ${u(t,r)}.`)}else r=f(t,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=f(t,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=f(t,r,s),s=i.charCodeAt(r)),46===s||(0,y.isNameStart)(s))throw(0,d.syntaxError)(t.source,r,`Invalid number, expected digit but got: ${u(t,r)}.`);return a(t,o?w.TokenKind.FLOAT:w.TokenKind.INT,e,r,i.slice(e,r))}function f(t,e,n){if(!(0,y.isDigit)(n))throw(0,d.syntaxError)(t.source,e,`Invalid number, expected digit but got: ${u(t,e)}.`);const i=t.source.body;let r=e+1;for(;(0,y.isDigit)(i.charCodeAt(r));)++r;return r}function p(t,e){const n=t.source.body,s=n.length;let o=e+1,c=o,l="";for(;o<s;){const s=n.charCodeAt(o);if(34===s)return l+=n.slice(c,o),a(t,w.TokenKind.STRING,e,o+1,l);if(92!==s){if(10===s||13===s)break;if(i(s))++o;else{if(!r(n,o))throw(0,d.syntaxError)(t.source,o,`Invalid character within String: ${u(t,o)}.`);o+=2}}else{l+=n.slice(c,o);const e=117===n.charCodeAt(o+1)?123===n.charCodeAt(o+2)?m(t,o):g(t,o):S(t,o);l+=e.value,o+=e.size,c=o}}throw(0,d.syntaxError)(t.source,o,"Unterminated string.")}function m(t,e){const n=t.source.body;let r=0,s=3;for(;s<12;){const t=n.charCodeAt(e+s++);if(125===t){if(s<5||!i(r))break;return{value:String.fromCodePoint(r),size:s}}if(r=r<<4|E(t),r<0)break}throw(0,d.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+s)}".`)}function g(t,e){const n=t.source.body,r=O(n,e+2);if(i(r))return{value:String.fromCodePoint(r),size:6};if(s(r)&&92===n.charCodeAt(e+6)&&117===n.charCodeAt(e+7)){const t=O(n,e+8);if(o(t))return{value:String.fromCodePoint(r,t),size:12}}throw(0,d.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function O(t,e){return E(t.charCodeAt(e))<<12|E(t.charCodeAt(e+1))<<8|E(t.charCodeAt(e+2))<<4|E(t.charCodeAt(e+3))}function E(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function S(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,d.syntaxError)(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function T(t,e){const n=t.source.body,s=n.length;let o=t.lineStart,c=e+3,l=c,h="";const f=[];for(;c<s;){const s=n.charCodeAt(c);if(34===s&&34===n.charCodeAt(c+1)&&34===n.charCodeAt(c+2)){h+=n.slice(l,c),f.push(h);const i=a(t,w.TokenKind.BLOCK_STRING,e,c+3,(0,b.dedentBlockStringLines)(f).join("\n"));return t.line+=f.length-1,t.lineStart=o,i}if(92!==s||34!==n.charCodeAt(c+1)||34!==n.charCodeAt(c+2)||34!==n.charCodeAt(c+3))if(10!==s&&13!==s)if(i(s))++c;else{if(!r(n,c))throw(0,d.syntaxError)(t.source,c,`Invalid character within String: ${u(t,c)}.`);c+=2}else h+=n.slice(l,c),f.push(h),13===s&&10===n.charCodeAt(c+1)?c+=2:++c,h="",l=c,o=c;else h+=n.slice(l,c),l=c+1,c+=4}throw(0,d.syntaxError)(t.source,c,"Unterminated string.")}function D(t,e){const n=t.source.body,i=n.length;let r=e+1;for(;r<i;){const t=n.charCodeAt(r);if(!(0,y.isNameContinue)(t))break;++r}return a(t,w.TokenKind.NAME,e,r,n.slice(e,r))}e.Lexer=n})),O=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=function(t,e){if(!Boolean(t))throw new Error(e)}})),E=s((function(t,e){function n(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return function(t,e){if(null===t)return"null";if(e.includes(t))return"[Circular]";const i=[...e,t];if(function(t){return"function"==typeof t.toJSON}(t)){const e=t.toJSON();if(e!==t)return"string"==typeof e?e:n(e,i)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>2)return"[Array]";const i=Math.min(10,t.length),r=t.length-i,s=[];for(let r=0;r<i;++r)s.push(n(t[r],e));return 1===r?s.push("... 1 more item"):r>1&&s.push(`... ${r} more items`),"["+s.join(", ")+"]"}(t,i);return function(t,e){const i=Object.entries(t);if(0===i.length)return"{}";if(e.length>2)return"["+function(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){const e=t.constructor.name;if("string"==typeof e&&""!==e)return e}return e}(t)+"]";const r=i.map((([t,i])=>t+": "+n(i,e)));return"{ "+r.join(", ")+" }"}(t,i)}(t,e);default:return String(t)}}Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=function(t){return n(t,[])}})),S=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0,e.instanceOf=function(t,e){return t instanceof e}})),T=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=function(t){return(0,S.instanceOf)(t,n)};class n{constructor(t,e="GraphQL request",n={line:1,column:1}){"string"==typeof t||(0,O.devAssert)(!1,`Body must be a string. Received: ${(0,E.inspect)(t)}.`),this.body=t,this.name=e,this.locationOffset=n,this.locationOffset.line>0||(0,O.devAssert)(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,O.devAssert)(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}e.Source=n})),D=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=function(t,e){return new n(t,e).parseDocument()},e.parseConstValue=function(t,e){const i=new n(t,e);i.expectToken(w.TokenKind.SOF);const r=i.parseConstValueLiteral();return i.expectToken(w.TokenKind.EOF),r},e.parseType=function(t,e){const i=new n(t,e);i.expectToken(w.TokenKind.SOF);const r=i.parseTypeReference();return i.expectToken(w.TokenKind.EOF),r},e.parseValue=function(t,e){const i=new n(t,e);i.expectToken(w.TokenKind.SOF);const r=i.parseValueLiteral(!1);return i.expectToken(w.TokenKind.EOF),r};class n{constructor(t,e={}){const n=(0,T.isSource)(t)?t:new T.Source(t);this._lexer=new g.Lexer(n),this._options=e,this._tokenCounter=0}parseName(){const t=this.expectToken(w.TokenKind.NAME);return this.node(t,{kind:m.Kind.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:m.Kind.DOCUMENT,definitions:this.many(w.TokenKind.SOF,this.parseDefinition,w.TokenKind.EOF)})}parseDefinition(){if(this.peek(w.TokenKind.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),e=t?this._lexer.lookahead():this._lexer.token;if(e.kind===w.TokenKind.NAME){switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw(0,d.syntaxError)(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(e.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(e)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(w.TokenKind.BRACE_L))return this.node(t,{kind:m.Kind.OPERATION_DEFINITION,operation:v.OperationTypeNode.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const e=this.parseOperationType();let n;return this.peek(w.TokenKind.NAME)&&(n=this.parseName()),this.node(t,{kind:m.Kind.OPERATION_DEFINITION,operation:e,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(w.TokenKind.NAME);switch(t.value){case"query":return v.OperationTypeNode.QUERY;case"mutation":return v.OperationTypeNode.MUTATION;case"subscription":return v.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(w.TokenKind.PAREN_L,this.parseVariableDefinition,w.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:m.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(w.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(w.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(w.TokenKind.DOLLAR),this.node(t,{kind:m.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:m.Kind.SELECTION_SET,selections:this.many(w.TokenKind.BRACE_L,this.parseSelection,w.TokenKind.BRACE_R)})}parseSelection(){return this.peek(w.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,e=this.parseName();let n,i;return this.expectOptionalToken(w.TokenKind.COLON)?(n=e,i=this.parseName()):i=e,this.node(t,{kind:m.Kind.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(w.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){return this.optionalMany(w.TokenKind.PAREN_L,t?this.parseConstArgument:this.parseArgument,w.TokenKind.PAREN_R)}parseArgument(t=!1){const e=this._lexer.token,n=this.parseName();return this.expectToken(w.TokenKind.COLON),this.node(e,{kind:m.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(w.TokenKind.SPREAD);const e=this.expectOptionalKeyword("on");return!e&&this.peek(w.TokenKind.NAME)?this.node(t,{kind:m.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:m.Kind.INLINE_FRAGMENT,typeCondition:e?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this.node(t,!0===this._options.allowLegacyFragmentVariables?{kind:m.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}:{kind:m.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(t){const e=this._lexer.token;switch(e.kind){case w.TokenKind.BRACKET_L:return this.parseList(t);case w.TokenKind.BRACE_L:return this.parseObject(t);case w.TokenKind.INT:return this.advanceLexer(),this.node(e,{kind:m.Kind.INT,value:e.value});case w.TokenKind.FLOAT:return this.advanceLexer(),this.node(e,{kind:m.Kind.FLOAT,value:e.value});case w.TokenKind.STRING:case w.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case w.TokenKind.NAME:switch(this.advanceLexer(),e.value){case"true":return this.node(e,{kind:m.Kind.BOOLEAN,value:!0});case"false":return this.node(e,{kind:m.Kind.BOOLEAN,value:!1});case"null":return this.node(e,{kind:m.Kind.NULL});default:return this.node(e,{kind:m.Kind.ENUM,value:e.value})}case w.TokenKind.DOLLAR:if(t){if(this.expectToken(w.TokenKind.DOLLAR),this._lexer.token.kind===w.TokenKind.NAME)throw(0,d.syntaxError)(this._lexer.source,e.start,`Unexpected variable "$${this._lexer.token.value}" in constant value.`);throw this.unexpected(e)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:m.Kind.STRING,value:t.value,block:t.kind===w.TokenKind.BLOCK_STRING})}parseList(t){return this.node(this._lexer.token,{kind:m.Kind.LIST,values:this.any(w.TokenKind.BRACKET_L,(()=>this.parseValueLiteral(t)),w.TokenKind.BRACKET_R)})}parseObject(t){return this.node(this._lexer.token,{kind:m.Kind.OBJECT,fields:this.any(w.TokenKind.BRACE_L,(()=>this.parseObjectField(t)),w.TokenKind.BRACE_R)})}parseObjectField(t){const e=this._lexer.token,n=this.parseName();return this.expectToken(w.TokenKind.COLON),this.node(e,{kind:m.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(t)})}parseDirectives(t){const e=[];for(;this.peek(w.TokenKind.AT);)e.push(this.parseDirective(t));return e}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const e=this._lexer.token;return this.expectToken(w.TokenKind.AT),this.node(e,{kind:m.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let e;if(this.expectOptionalToken(w.TokenKind.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(w.TokenKind.BRACKET_R),e=this.node(t,{kind:m.Kind.LIST_TYPE,type:n})}else e=this.parseNamedType();return this.expectOptionalToken(w.TokenKind.BANG)?this.node(t,{kind:m.Kind.NON_NULL_TYPE,type:e}):e}parseNamedType(){return this.node(this._lexer.token,{kind:m.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(w.TokenKind.STRING)||this.peek(w.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(w.TokenKind.BRACE_L,this.parseOperationTypeDefinition,w.TokenKind.BRACE_R);return this.node(t,{kind:m.Kind.SCHEMA_DEFINITION,description:e,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,e=this.parseOperationType();this.expectToken(w.TokenKind.COLON);const n=this.parseNamedType();return this.node(t,{kind:m.Kind.OPERATION_TYPE_DEFINITION,operation:e,type:n})}parseScalarTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:m.Kind.SCALAR_TYPE_DEFINITION,description:e,name:n,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:m.Kind.OBJECT_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(w.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(w.TokenKind.BRACE_L,this.parseFieldDefinition,w.TokenKind.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(w.TokenKind.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(t,{kind:m.Kind.FIELD_DEFINITION,description:e,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(w.TokenKind.PAREN_L,this.parseInputValueDef,w.TokenKind.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName();this.expectToken(w.TokenKind.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(w.TokenKind.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(t,{kind:m.Kind.INPUT_VALUE_DEFINITION,description:e,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:m.Kind.INTERFACE_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:m.Kind.UNION_TYPE_DEFINITION,description:e,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(w.TokenKind.EQUALS)?this.delimitedMany(w.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:m.Kind.ENUM_TYPE_DEFINITION,description:e,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(w.TokenKind.BRACE_L,this.parseEnumValueDefinition,w.TokenKind.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:m.Kind.ENUM_VALUE_DEFINITION,description:e,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw(0,d.syntaxError)(this._lexer.source,this._lexer.token.start,`${i(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:m.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:e,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(w.TokenKind.BRACE_L,this.parseInputValueDef,w.TokenKind.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===w.TokenKind.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const e=this.parseConstDirectives(),n=this.optionalMany(w.TokenKind.BRACE_L,this.parseOperationTypeDefinition,w.TokenKind.BRACE_R);if(0===e.length&&0===n.length)throw this.unexpected();return this.node(t,{kind:m.Kind.SCHEMA_EXTENSION,directives:e,operationTypes:n})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const e=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(t,{kind:m.Kind.SCALAR_TYPE_EXTENSION,name:e,directives:n})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:m.Kind.OBJECT_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:m.Kind.INTERFACE_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:m.Kind.UNION_TYPE_EXTENSION,name:e,directives:n,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:m.Kind.ENUM_TYPE_EXTENSION,name:e,directives:n,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:m.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:e,directives:n,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("directive"),this.expectToken(w.TokenKind.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(t,{kind:m.Kind.DIRECTIVE_DEFINITION,description:e,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(w.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,e=this.parseName();if(Object.prototype.hasOwnProperty.call(p.DirectiveLocation,e.value))return e;throw this.unexpected(t)}node(t,e){return!0!==this._options.noLocation&&(e.loc=new v.Location(t,this._lexer.lastToken,this._lexer.source)),e}peek(t){return this._lexer.token.kind===t}expectToken(t){const e=this._lexer.token;if(e.kind===t)return this.advanceLexer(),e;throw(0,d.syntaxError)(this._lexer.source,e.start,`Expected ${r(t)}, found ${i(e)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t&&(this.advanceLexer(),!0)}expectKeyword(t){const e=this._lexer.token;if(e.kind!==w.TokenKind.NAME||e.value!==t)throw(0,d.syntaxError)(this._lexer.source,e.start,`Expected "${t}", found ${i(e)}.`);this.advanceLexer()}expectOptionalKeyword(t){const e=this._lexer.token;return e.kind===w.TokenKind.NAME&&e.value===t&&(this.advanceLexer(),!0)}unexpected(t){const e=null!=t?t:this._lexer.token;return(0,d.syntaxError)(this._lexer.source,e.start,`Unexpected ${i(e)}.`)}any(t,e,n){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(n);)i.push(e.call(this));return i}optionalMany(t,e,n){if(this.expectOptionalToken(t)){const t=[];do{t.push(e.call(this))}while(!this.expectOptionalToken(n));return t}return[]}many(t,e,n){this.expectToken(t);const i=[];do{i.push(e.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(t,e){this.expectOptionalToken(t);const n=[];do{n.push(e.call(this))}while(this.expectOptionalToken(t));return n}advanceLexer(){const{maxTokens:t}=this._options,e=this._lexer.advance();if(void 0!==t&&e.kind!==w.TokenKind.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw(0,d.syntaxError)(this._lexer.source,e.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function i(t){const e=t.value;return r(t.kind)+(null!=e?` "${e}"`:"")}function r(t){return(0,g.isPunctuatorTokenKind)(t)?`"${t}"`:t}e.Parser=n})),j=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.printString=function(t){return`"${t.replace(n,i)}"`};const n=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function i(t){return r[t.charCodeAt(0)]}const r=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"]})),I=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BREAK=void 0,e.getEnterLeaveForKind=i,e.getVisitFn=function(t,e,n){const{enter:r,leave:s}=i(t,e);return n?s:r},e.visit=function(t,e,r=v.QueryDocumentKeys){const s=new Map;for(const t of Object.values(m.Kind))s.set(t,i(e,t));let o,u,a,c=Array.isArray(t),l=[t],h=-1,f=[],d=t;const p=[],y=[];do{h++;const t=h===l.length,i=t&&0!==f.length;if(t){if(u=0===y.length?void 0:p[p.length-1],d=a,a=y.pop(),i)if(c){d=d.slice();let t=0;for(const[e,n]of f){const i=e-t;null===n?(d.splice(i,1),t++):d[i]=n}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[t,e]of f)d[t]=e}h=o.index,l=o.keys,f=o.edits,c=o.inArray,o=o.prev}else if(a){if(u=c?h:l[h],d=a[u],null==d)continue;p.push(u)}let m;if(!Array.isArray(d)){var b,w;(0,v.isNode)(d)||(0,O.devAssert)(!1,`Invalid AST Node: ${(0,E.inspect)(d)}.`);const i=t?null===(b=s.get(d.kind))||void 0===b?void 0:b.leave:null===(w=s.get(d.kind))||void 0===w?void 0:w.enter;if(m=null==i?void 0:i.call(e,d,u,a,p,y),m===n)break;if(!1===m){if(!t){p.pop();continue}}else if(void 0!==m&&(f.push([u,m]),!t)){if(!(0,v.isNode)(m)){p.pop();continue}d=m}}var g;void 0===m&&i&&f.push([u,d]),t?p.pop():(o={inArray:c,index:h,keys:l,edits:f,prev:o},c=Array.isArray(d),l=c?d:null!==(g=r[d.kind])&&void 0!==g?g:[],h=-1,f=[],a&&y.push(a),a=d)}while(void 0!==o);return 0!==f.length?f[f.length-1][1]:t},e.visitInParallel=function(t){const e=new Array(t.length).fill(null),r=Object.create(null);for(const s of Object.values(m.Kind)){let o=!1;const u=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0);for(let e=0;e<t.length;++e){const{enter:n,leave:r}=i(t[e],s);o||(o=null!=n||null!=r),u[e]=n,a[e]=r}o&&(r[s]={enter(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const a=null===(s=u[o])||void 0===s?void 0:s.apply(t[o],i);if(!1===a)e[o]=r;else if(a===n)e[o]=n;else if(void 0!==a)return a}},leave(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const r=null===(s=a[o])||void 0===s?void 0:s.apply(t[o],i);if(r===n)e[o]=n;else if(void 0!==r&&!1!==r)return r}else e[o]===r&&(e[o]=null)}})}return r};const n=Object.freeze({});function i(t,e){const n=t[e];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}e.BREAK=n})),x=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.print=function(t){return(0,I.visit)(t,n)};const n={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>i(t.definitions,"\n\n")},OperationDefinition:{leave(t){const e=s("(",i(t.variableDefinitions,", "),")"),n=i([t.operation,i([t.name,e]),i(t.directives," ")]," ");return("query"===n?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+s(" = ",n)+s(" ",i(r," "))},SelectionSet:{leave:({selections:t})=>r(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:u}){const a=s("",t,": ")+e;let c=a+s("(",i(n,", "),")");return c.length>80&&(c=a+s("(\n",o(i(n,"\n")),"\n)")),i([c,i(r," "),u]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+s(" ",i(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>i(["...",s("on ",t),i(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:o})=>`fragment ${t}${s("(",i(n,", "),")")} on ${e} ${s("",i(r," ")," ")}`+o},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?(0,b.printBlockString)(t):(0,j.printString)(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+i(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+i(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+s("(",i(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>s("",t,"\n")+i(["schema",i(e," "),r(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i(["scalar",e,i(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:u})=>s("",t,"\n")+i(["type",e,s("implements ",i(n," & ")),i(o," "),r(u)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:a})=>s("",t,"\n")+e+(u(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+": "+r+s(" ",i(a," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:o})=>s("",t,"\n")+i([e+": "+n,s("= ",r),i(o," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:u})=>s("",t,"\n")+i(["interface",e,s("implements ",i(n," & ")),i(o," "),r(u)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>s("",t,"\n")+i(["union",e,i(n," "),s("= ",i(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:o})=>s("",t,"\n")+i(["enum",e,i(n," "),r(o)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i([e,i(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:o})=>s("",t,"\n")+i(["input",e,i(n," "),r(o)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:a})=>s("",t,"\n")+"directive @"+e+(u(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+(r?" repeatable":"")+" on "+i(a," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>i(["extend schema",i(t," "),r(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>i(["extend scalar",t,i(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend type",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend interface",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>i(["extend union",t,i(e," "),s("= ",i(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>i(["extend enum",t,i(e," "),r(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>i(["extend input",t,i(e," "),r(n)]," ")}};function i(t,e=""){var n;return null!==(n=null==t?void 0:t.filter((t=>t)).join(e))&&void 0!==n?n:""}function r(t){return s("{\n",o(i(t,"\n")),"\n}")}function s(t,e,n=""){return null!=e&&""!==e?t+e+n:""}function o(t){return s(" ",t.replace(/\n/g,"\n "))}function u(t){var e;return null!==(e=null==t?void 0:t.some((t=>t.includes("\n"))))&&void 0!==e&&e}})),k=function(t){var e=t.name,n=t.type;this.uri=t.uri,this.name=e,this.type=n},N=function(t){return"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Blob&&t instanceof Blob||t instanceof k},A=function t(e,n,i){var r;void 0===n&&(n=""),void 0===i&&(i=N);var s=new Map;function o(t,e){var n=s.get(e);n?n.push.apply(n,t):s.set(e,t)}if(i(e))r=null,o([n],e);else{var u=n?n+".":"";if("undefined"!=typeof FileList&&e instanceof FileList)r=Array.prototype.map.call(e,(function(t,e){return o([""+u+e],t),null}));else if(Array.isArray(e))r=e.map((function(e,n){var r=t(e,""+u+n,i);return r.files.forEach(o),r.clone}));else if(e&&e.constructor===Object)for(var a in r={},e){var c=t(e[a],""+u+a,i);c.files.forEach(o),r[a]=c.clone}else r=e}return{clone:r,files:s}},_=N,P="object"==typeof self?self.FormData:window.FormData,$=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultJsonSerializer=void 0,e.defaultJsonSerializer={parse:JSON.parse,stringify:JSON.stringify}})),F=s((function(t,e){var n=o&&o.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(P),r=function(t){return _(t)||null!==t&&"object"==typeof t&&"function"==typeof t.pipe};e.default=function(t,e,n,s){void 0===s&&(s=$.defaultJsonSerializer);var o=A({query:t,variables:e,operationName:n},"",r),u=o.clone,a=o.files;if(0===a.size){if(!Array.isArray(t))return s.stringify(u);if(void 0!==e&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");var c=t.reduce((function(t,n,i){return t.push({query:n,variables:e?e[i]:void 0}),t}),[]);return s.stringify(c)}var l=new("undefined"==typeof FormData?i.default:FormData);l.append("operations",s.stringify(u));var h={},f=0;return a.forEach((function(t){h[++f]=t})),l.append("map",s.stringify(h)),f=0,a.forEach((function(t,e){l.append(""+ ++f,e)})),l}})),U=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchRequestsExtendedArgs=e.parseRawRequestExtendedArgs=e.parseRequestExtendedArgs=e.parseBatchRequestArgs=e.parseRawRequestArgs=e.parseRequestArgs=void 0,e.parseRequestArgs=function(t,e,n){return t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0}},e.parseRawRequestArgs=function(t,e,n){return t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0}},e.parseBatchRequestArgs=function(t,e){return t.documents?t:{documents:t,requestHeaders:e,signal:void 0}},e.parseRequestExtendedArgs=function(t,e,n,i){return t.document?t:{url:t,document:e,variables:n,requestHeaders:i,signal:void 0}},e.parseRawRequestExtendedArgs=function(t,e,n,i){return t.query?t:{url:t,query:e,variables:n,requestHeaders:i,signal:void 0}},e.parseBatchRequestsExtendedArgs=function(t,e,n){return t.documents?t:{url:t,documents:e,requestHeaders:n,signal:void 0}}})),q=s((function(t,e){var n,i=o&&o.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.ClientError=void 0;var r=function(t){function e(n,i){var r=this,s=e.extractMessage(n)+": "+JSON.stringify({response:n,request:i});return r=t.call(this,s)||this,Object.setPrototypeOf(r,e.prototype),r.response=n,r.request=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e.extractMessage=function(t){try{return t.errors[0].message}catch(e){return"GraphQL Error (Code: "+t.status+")"}},e}(Error);e.ClientError=r})),C=s((function(t,e){var n=o&&o.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)},i=o&&o.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{a(i.next(t))}catch(t){s(t)}}function u(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((i=i.apply(t,e||[])).next())}))},r=o&&o.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLWebSocketClient=void 0;var s="ping",u="pong",a="complete",c=function(){function t(t,e,n){this._type=t,this._payload=e,this._id=n}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return this._payload},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){var t={type:this.type};return null!=this.id&&null!=this.id&&(t.id=this.id),null!=this.payload&&null!=this.payload&&(t.payload=this.payload),JSON.stringify(t)},enumerable:!1,configurable:!0}),t.parse=function(e,n){var i=JSON.parse(e),r=i.id;return new t(i.type,n(i.payload),r)},t}(),l=function(){function t(t,e){var o=this,l=e.onInit,d=e.onAcknowledged,v=e.onPing,p=e.onPong;this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=t,t.onopen=function(){return i(o,void 0,void 0,(function(){var e,n,i,s;return r(this,(function(r){switch(r.label){case 0:return this.socketState.acknowledged=!1,this.socketState.subscriptions={},n=(e=t).send,i=h,l?[4,l()]:[3,2];case 1:return s=r.sent(),[3,3];case 2:s=null,r.label=3;case 3:return n.apply(e,[i.apply(void 0,[s]).text]),[2]}}))}))},t.onclose=function(){o.socketState.acknowledged=!1,o.socketState.subscriptions={}},t.onerror=function(t){console.error(t)},t.onmessage=function(e){try{var i=(void 0===y&&(y=function(t){return t}),c.parse(e.data,y));switch(i.type){case"connection_ack":return void(o.socketState.acknowledged?console.warn("Duplicate CONNECTION_ACK message ignored"):(o.socketState.acknowledged=!0,d&&d(i.payload)));case s:return void(v?v(i.payload).then((function(e){return t.send(f(e).text)})):t.send(f(null).text));case u:return void(p&&p(i.payload))}if(!o.socketState.acknowledged)return;if(null==i.id||!o.socketState.subscriptions[i.id])return;var r=o.socketState.subscriptions[i.id],l=r.query,h=r.variables,m=r.subscriber;switch(i.type){case"next":return!i.payload.errors&&i.payload.data&&m.next&&m.next(i.payload.data),void(i.payload.errors&&m.error&&m.error(new q.ClientError(n(n({},i.payload),{status:200}),{query:l,variables:h})));case"error":return void(m.error&&m.error(new q.ClientError({errors:i.payload,status:200},{query:l,variables:h})));case a:return m.complete&&m.complete(),void delete o.socketState.subscriptions[i.id]}}catch(e){console.error(e),t.close(1006)}var y;t.close(4400,"Unknown graphql-ws message.")}}return t.prototype.makeSubscribe=function(t,e,n,i){var r,s,o=this,u=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[u]={query:t,variables:n,subscriber:i},this.socket.send((r=u,s={query:t,operationName:e,variables:n},new c("subscribe",s,r)).text),function(){o.socket.send(function(t){return new c(a,void 0,t)}(u).text),delete o.socketState.subscriptions[u]}},t.prototype.rawRequest=function(t,e){var n=this;return new Promise((function(i,r){var s;n.rawSubscribe(t,{next:function(t,e){return s={data:t,extensions:e}},error:r,complete:function(){return i(s)}},e)}))},t.prototype.request=function(t,e){var n=this;return new Promise((function(i,r){var s;n.subscribe(t,{next:function(t){return s=t},error:r,complete:function(){return i(s)}},e)}))},t.prototype.subscribe=function(t,e,n){var i=V.resolveRequestDocument(t);return this.makeSubscribe(i.query,i.operationName,n,e)},t.prototype.rawSubscribe=function(t,e,n){return this.makeSubscribe(t,void 0,n,e)},t.prototype.ping=function(t){this.socket.send(function(t){return new c(s,t,void 0)}(t).text)},t.prototype.close=function(){this.socket.close(1e3)},t.PROTOCOL="graphql-transport-ws",t}();function h(t){return new c("connection_init",t)}function f(t){return new c(u,t,void 0)}e.GraphQLWebSocketClient=l})),V=s((function(t,e){var n=o&&o.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)},i=o&&o.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=o&&o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=o&&o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e},a=o&&o.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{a(i.next(t))}catch(t){s(t)}}function u(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((i=i.apply(t,e||[])).next())}))},c=o&&o.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},l=o&&o.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n},h=o&&o.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLWebSocketClient=e.gql=e.resolveRequestDocument=e.batchRequests=e.request=e.rawRequest=e.GraphQLClient=e.ClientError=void 0;var f=s(u),d=f,v=h(F);Object.defineProperty(e,"ClientError",{enumerable:!0,get:function(){return q.ClientError}});var p=function(t){var e={};return t&&("undefined"!=typeof Headers&&t instanceof Headers||t instanceof d.Headers?e=function(t){var e={};return t.forEach((function(t,n){e[n]=t})),e}(t):Array.isArray(t)?t.forEach((function(t){e[t[0]]=t[1]})):e=t),e},m=function(t){return t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim()},y=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,o=t.headers,u=t.fetch,l=t.fetchOptions;return a(void 0,void 0,void 0,(function(){var t;return c(this,(function(a){switch(a.label){case 0:return t=v.default(i,r,s,l.jsonSerializer),[4,u(e,n({method:"POST",headers:n(n({},"string"==typeof t?{"Content-Type":"application/json"}:{}),o),body:t},l))];case 1:return[2,a.sent()]}}))}))},b=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,o=t.headers,u=t.fetch,l=t.fetchOptions;return a(void 0,void 0,void 0,(function(){var t;return c(this,(function(a){switch(a.label){case 0:return t=function(t){var e=t.query,n=t.variables,i=t.operationName,r=t.jsonSerializer;if(!Array.isArray(e)){var s=["query="+encodeURIComponent(m(e))];return n&&s.push("variables="+encodeURIComponent(r.stringify(n))),i&&s.push("operationName="+encodeURIComponent(i)),s.join("&")}if(void 0!==n&&!Array.isArray(n))throw new Error("Cannot create query with given variable type, array expected");var o=e.reduce((function(t,e,i){return t.push({query:m(e),variables:n?r.stringify(n[i]):void 0}),t}),[]);return"query="+encodeURIComponent(r.stringify(o))}({query:i,variables:r,operationName:s,jsonSerializer:l.jsonSerializer}),[4,u(e+"?"+t,n({method:"GET",headers:o},l))];case 1:return[2,a.sent()]}}))}))},w=function(){function t(t,e){this.url=t,this.options=e||{}}return t.prototype.rawRequest=function(t,e,i){return a(this,void 0,void 0,(function(){var r,s,o,u,a,h,d,v,m,y;return c(this,(function(){return r=U.parseRawRequestArgs(t,e,i),o=(s=this.options).headers,a=void 0===(u=s.fetch)?f.default:u,d=void 0===(h=s.method)?"POST":h,v=l(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(v.signal=r.signal),y=T(r.query).operationName,[2,g({url:m,query:r.query,variables:r.variables,headers:n(n({},p(j(o))),p(r.requestHeaders)),operationName:y,fetch:a,method:d,fetchOptions:v})]}))}))},t.prototype.request=function(t,e,i){return a(this,void 0,void 0,(function(){var r,s,o,u,a,h,d,v,m,y,b;return c(this,(function(c){switch(c.label){case 0:return r=U.parseRequestArgs(t,e,i),o=(s=this.options).headers,a=void 0===(u=s.fetch)?f.default:u,d=void 0===(h=s.method)?"POST":h,v=l(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(v.signal=r.signal),y=T(r.document),b=y.operationName,[4,g({url:m,query:y.query,variables:r.variables,headers:n(n({},p(j(o))),p(r.requestHeaders)),operationName:b,fetch:a,method:d,fetchOptions:v})];case 1:return[2,c.sent().data]}}))}))},t.prototype.batchRequests=function(t,e){return a(this,void 0,void 0,(function(){var i,r,s,o,u,a,h,d,v,m,y;return c(this,(function(c){switch(c.label){case 0:return i=U.parseBatchRequestArgs(t,e),s=(r=this.options).headers,u=void 0===(o=r.fetch)?f.default:o,h=void 0===(a=r.method)?"POST":a,d=l(r,["headers","fetch","method"]),v=this.url,void 0!==i.signal&&(d.signal=i.signal),m=i.documents.map((function(t){return T(t.document).query})),y=i.documents.map((function(t){return t.variables})),[4,g({url:v,query:m,variables:y,headers:n(n({},p(j(s))),p(i.requestHeaders)),operationName:void 0,fetch:u,method:h,fetchOptions:d})];case 1:return[2,c.sent().data]}}))}))},t.prototype.setHeaders=function(t){return this.options.headers=t,this},t.prototype.setHeader=function(t,e){var n,i=this.options.headers;return i?i[t]=e:this.options.headers=((n={})[t]=e,n),this},t.prototype.setEndpoint=function(t){return this.url=t,this},t}();function g(t){var e=t.url,i=t.query,r=t.variables,s=t.headers,o=t.operationName,u=t.fetch,h=t.method,f=void 0===h?"POST":h,d=t.fetchOptions;return a(this,void 0,void 0,(function(){var t,a,h,v,p,m,w,g,O,S;return c(this,(function(c){switch(c.label){case 0:return t="POST"===f.toUpperCase()?y:b,a=Array.isArray(i),[4,t({url:e,query:i,variables:r,operationName:o,headers:s,fetch:u,fetchOptions:d})];case 1:return[4,E(h=c.sent(),d.jsonSerializer)];case 2:if(v=c.sent(),p=a&&Array.isArray(v)?!v.some((function(t){return!t.data})):!!v.data,m=!v.errors||"all"===d.errorPolicy||"ignore"===d.errorPolicy,h.ok&&m&&p)return w=h.headers,g=h.status,O=l(v,["errors"]),S="ignore"===d.errorPolicy?O:v,[2,n(n({},a?{data:S}:S),{headers:w,status:g})];throw new q.ClientError(n(n({},"string"==typeof v?{error:v}:v),{status:h.status,headers:h.headers}),{query:i,variables:r})}}))}))}function O(t,e,i,r){return a(this,void 0,void 0,(function(){var s;return c(this,(function(){return s=U.parseRequestExtendedArgs(t,e,i,r),[2,new w(s.url).request(n({},s))]}))}))}function E(t,e){return void 0===e&&(e=$.defaultJsonSerializer),a(this,void 0,void 0,(function(){var n,i,r;return c(this,(function(s){switch(s.label){case 0:return t.headers.forEach((function(t,e){"content-type"===e.toLowerCase()&&(n=t)})),n&&n.toLowerCase().startsWith("application/json")?(r=(i=e).parse,[4,t.text()]):[3,2];case 1:return[2,r.apply(i,[s.sent()])];case 2:return[2,t.text()]}}))}))}function S(t){var e,n=void 0,i=t.definitions.filter((function(t){return"OperationDefinition"===t.kind}));return 1===i.length&&(n=null===(e=i[0].name)||void 0===e?void 0:e.value),n}function T(t){if("string"==typeof t){var e=void 0;try{e=S(D.parse(t))}catch(t){}return{query:t,operationName:e}}var n=S(t);return{query:x.print(t),operationName:n}}function j(t){return"function"==typeof t?t():t}e.GraphQLClient=w,e.rawRequest=function(t,e,i,r){return a(this,void 0,void 0,(function(){var s;return c(this,(function(){return s=U.parseRawRequestExtendedArgs(t,e,i,r),[2,new w(s.url).rawRequest(n({},s))]}))}))},e.request=O,e.batchRequests=function(t,e,i){return a(this,void 0,void 0,(function(){var r;return c(this,(function(){return r=U.parseBatchRequestsExtendedArgs(t,e,i),[2,new w(r.url).batchRequests(n({},r))]}))}))},e.default=O,e.resolveRequestDocument=T,e.gql=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.reduce((function(t,n,i){return""+t+n+(i in e?e[i]:"")}),"")},Object.defineProperty(e,"GraphQLWebSocketClient",{enumerable:!0,get:function(){return C.GraphQLWebSocketClient}})}));class L{static getQueryParams(t){const e=new Map,n=/[?&]?([^=]+)=([^&]*)/g;let i;for(t=(t=window.unescape(t)).split("+").join(" ");i=n.exec(t);)e.set(window.decodeURIComponent(i[1]),i[2]);return e.set("urlBase",this.getUrlBase()),window.moduleID&&window.URIServiceBroker&&(e.set("moduleID",window.moduleID),e.set("URIServiceBroker",window.URIServiceBroker)),e}static getUrlBase(){return window.mock_url?window.mock_url:`${location.protocol}//${location.hostname}${location.port?":"+location.port:""}`}}class M{constructor(t,e,n,i){this.serviceName=t,this.requestBody=e,this.successCallback=n,this.errorCallback=i}reCall(t){return t&&(this.requestBody=t),J.get().callServiceBroker(this.serviceName,this.requestBody).then(this.successCallback,this.errorCallback)}}class R{constructor(t,e,n){this.req=t,this.resolve=e,this.reject=n}putVariable(t,e){this.req.values[t]=e}reCall(){return J.get().callGraphQL(this.req).then(this.resolve,this.reject)}}class B{constructor(){this.appletImpressao=new G}static getInstance(){return B.instance||(B.instance=new B),B.instance}async processPendingPrinting(t){await this.findPendingPrints(t)}async findPendingPrints(t){const e={transactionIds:[{transactionId:{$:t}}]},n=await J.get().callServiceBroker(B.SERVICE_FIND_PENDING_PRINTS,JSON.stringify(e)),i=this.parsePrintData(n),r=await this.processDirectPrint(i);r.length&&this.openSnkPrintSelector(Object.assign(Object.assign({},i),{pendingPrinters:r}))}getLocalPrinters(){const t=this.appletImpressao.findLocalPrinters(),e=[];for(const n of t)e.push({nome:n,printerUri:B.LOCAL_SERVER_URI+n,isLocal:!0});return e}parsePrintData(t){const e=t.pendindPrintJobData;if(!e)return;let{printServers:{printServer:n},pendingPrinters:{pendingPrinter:i}}=e;n=n?Array.isArray(n)?n:[n]:[],i=i?Array.isArray(i)?i:[i]:[];const r=n.map((t=>{const e=Array.isArray(t.printerLocation)?t.printerLocation:[t.printerLocation];return{printServerUri:t.printServerUri,printerList:e.map(this.normalize)}})),s=i.map(this.normalize);return{transactionId:e.transactionId.$,printServers:r,pendingPrinters:s,printServerActive:"true"===e.printServers.printServerActive}}normalize(t){const e={};return Object.keys(t).forEach((n=>{e[n]=B.ENCODED_PROPERTIES.includes(n)?window.atob(t[n].$):t[n].$})),e}processLocalPrinting(t){const e=t.map((t=>t.transactionId));this.appletImpressao.doLocalPrinting(e.join())}async openSnkPrintSelector(e){let n=document.querySelector("snk-print-selector");n||(n=document.createElement("snk-print-selector"),n.setAttribute("id",t.generateUUID()),window.document.body.appendChild(n));const{selectedPrinter:i,saveSubstitute:r}=await n.openPrintSelector(e);if(!i)return;const s={transactionId:e.transactionId,pendingPrinters:e.pendingPrinters,printerUri:i.printerUri,saveSubstitutePrinters:r};await this.saveSubstitutePrinter(s)}async saveSubstitutePrinter(t){const{transactionId:e,pendingPrinters:n,printerUri:i,saveSubstitutePrinters:r=!1}=t,s={substitutePrintersRequest:{substitutePrinters:{pendingPrinter:n.map((t=>({printerUri:{$:t.printerUri||i},originalPrinterName:{$:t.originalPrinterName},printJobCount:{$:t.printJobCount},docType:{$:t.docType},docTypeDescription:{$:t.docTypeDescription}})))},saveSubstitutePrinters:{$:r.toString()},transactionId:{$:e}}};await J.get().callServiceBroker(B.SERVICE_SAVE_SUBSTITUTE_PRINTER,JSON.stringify(s))}async processDirectPrint(t){if(!this.appletImpressao.checkWebConnection())return[];const e=this.getLocalPrinters();if(!e.length)return[];const n=[],i=t.pendingPrinters.filter((t=>{const i=this.getDefaultPrinterName(t.originalPrinterName);return!(e.find((t=>t.nome===i))||this.isPrinterNameAFile(i))||(n.push(Object.assign(Object.assign({},t),{printerUri:B.LOCAL_SERVER_URI+i})),!1)}));if(!n.length)return i;const r={transactionId:t.transactionId,pendingPrinters:n};return await this.saveSubstitutePrinter(r),i}getDefaultPrinterName(t){const e=this.appletImpressao.getDefaultPrinter(),n=/padr[aã]o/gi.test(t);return e&&n?e:t}isPrinterNameAFile(t){return new RegExp("^(w:)?[/\\ws]+?.w{3}$","mis").test(t)}}B.SERVICE_FIND_PENDING_PRINTS="mge@PrintServiceSP.findPendingPrinters",B.SERVICE_SAVE_SUBSTITUTE_PRINTER="mge@PrintServiceSP.saveSubstitutePrinter",B.LOCAL_SERVER_URI="LOCAL:0/",B.ENCODED_PROPERTIES=["printerName","printerUri"];class G{constructor(){this.appletImpressao=document.getElementById("centralNotaAppletImpressao")}checkWebConnection(){return!!this.appletImpressao&&(!!this.appletImpressao.testRunningWC&&!!this.appletImpressao.testRunningWC())}findLocalPrinters(){if(!this.appletImpressao)return[];const t=this.appletImpressao.getLocalPrinters();return t?t.split(","):[]}doLocalPrinting(t){this.appletImpressao&&this.appletImpressao.doLocalPrinting(t)}getDefaultPrinter(){return this.appletImpressao?this.appletImpressao.getPrintDefault():""}}class J{constructor(){this.GRAPHQL_PATH="/mgefin-bff/graphql",this.watingRequestsById=new Map}static get(){if(!J.instance){J.instance=new J;const t=document.querySelector(this.appTagName);null===t?J.instance.resume():(t.addEventListener("applicationLoading",(()=>J.instance.pause())),t.addEventListener("applicationLoaded",(()=>J.instance.resume())))}return this.instance.application=e.getContextValue("__SNK__APPLICATION__"),this.instance}static addRequestListener(t){J.requestListener.indexOf(t)<0&&J.requestListener.push(t)}static removeRequestListener(t){const e=J.requestListener.indexOf(t);e>-1&&J.requestListener.splice(e,1)}processGraphQlErrorInfo(t){var e,r;const s="Falha detectada",o=t[0];if(o.length>0){const t=o[0],u=(null==t?void 0:t.message)?null==t?void 0:t.message:"Não há mensagem de erro",a=(null===(e=null==t?void 0:t.extensions)||void 0===e?void 0:e.level)?t.extensions.level:"ERROR",c=(null===(r=null==t?void 0:t.extensions)||void 0===r?void 0:r.code)?t.extensions.code:"";return"WARNING"===a?new i(s,u,c):new n(s,u,c)}return new n(s,"Não há informações sobre o erro")}processServiceBrokerErrorInfo(t){const e="Falha detectada";let r,s,{statusMessage:o,tsError:u}=t||{};return o||(o="Não há informações sobre o erro"),u&&(r=u.tsErrorCode,s=u.tsErrorLevel),"WARNING"===s?new i(e,o,r):new n(e,o,r)}async callGraphQL(t){var e;const n=this.getReqKey(t);if(t.queryID=n,t.values.queryID=n,J.clientEventsByID){t.values.registeredEventListeners=[];for(let[e]of J.clientEventsByID)t.values.registeredEventListeners.push(e)}return this.ready?new Promise((async(e,i)=>{let r=this.getQueryTemplate(t);const s=await this.fecthGrapql([{document:r,variables:t.values}]);s.errors.length>0?this.proccesGraphQLClientEvents(null==s?void 0:s.extensions,t,e,i)||i(this.processGraphQlErrorInfo(s.errors)):(e(s.data[0][n]),this.proccesGraphQLClientEvents(null==s?void 0:s.extensions,t,e,i))})):(this.watingRequestsById.has(n)||this.watingRequestsById.set(n,new z(t)),null===(e=this.getWatingRequest(n))||void 0===e?void 0:e.promise)}resolveURL(){return L.getUrlBase()}proccesGraphQLClientEvents(t,e,n,r){if(null==t)return!1;for(const s in t){const{clientEvents:o}=t[s];if(!o)return!1;for(const t in o){if(!J.hasClientEvent(t))throw console.warn(`Client event ${t} not registered`),new i("ClientEvent não registrado",`Ocorreu o client event ${t} porém não há client event registrado na aplicação.`);J.clientEventsByID.get(t).forEach((i=>{i({id:t,content:JSON.parse(o[t])},new R(e,n,r))}))}return Object.keys(o).length>0}return!1}proccessServiceBorkerClientEvents(t,e,n,i,r){(null==t?void 0:t.length)&&t.forEach((t=>{J.hasClientEvent(t.id)&&J.clientEventsByID.get(t.id).forEach((s=>{s({id:t.id,content:t},new M(e,n,i,r))}))}))}processPrinting(t){"true"===(null==t?void 0:t.pendingPrinting)&&B.getInstance().processPendingPrinting(null==t?void 0:t.transactionId),"localPrintings"in t&&B.getInstance().processLocalPrinting(null==t?void 0:t.localPrintings)}getContext(t){var e;const n=L.getQueryParams(location.search);return{baseUrl:`${this.resolveURL()}/${t}/service.sbr`,appName:"SankhyaBlocks",mgeSession:`${window.mgeSession||n.get("mgeSession")}`,globalID:"85C0093DFA240EAB699B4E47A10215BD",resourceID:window.resourceID||(null===(e=window.workspace)||void 0===e?void 0:e.resourceID)}}async callServiceBroker(t,e,i){return new Promise(((s,o)=>{const u=t.split("@"),[a,c]=2===u.length?u:["mge",t],l=this.getContext(a);let h=`${l.baseUrl}?serviceName=${c}&counter=21&application=${l.appName}&outputType=json&preventTransform=false&mgeSession=${l.mgeSession}&resourceID=${l.resourceID}&globalID=${l.globalID}&allowConcurrentCalls=true`;h=this.addUrlParams(i,h),document.cookie=`JSESSIONID=${l.mgeSession};`;const f=new XMLHttpRequest;var d={};"string"==typeof e&&(e=r.stringToObject(e)),e.hasOwnProperty("requestBody")?d=e:d.requestBody=e;for(let[t]of J.clientEventsByID)d.requestBody.hasOwnProperty("clientEventList")||(d.requestBody.clientEventList={clientEvent:[]}),d.requestBody.clientEventList.clientEvent.push({$:t});J.requestListener.forEach((t=>t.onRequestStart({url:h,requestBody:e}))),f.open("POST",h,!0),f.withCredentials=!0,f.send(r.objectToString(d)),f.onreadystatechange=()=>{var i;if(4==f.readyState&&200==f.status)try{const e=JSON.parse(f.responseText);this.isServiceBrokerError(e)?o(this.processServiceBrokerErrorInfo(e)):e.status==J.SERVICE_BROKER_STATUS.SERVICE_CANCELED&&e.statusMessage?console.debug(`[DataFetcher] ${e.statusMessage}`):(s(e.responseBody),e.status==J.SERVICE_BROKER_STATUS.INFO&&(null===(i=this.application)||void 0===i||i.info(e.statusMessage))),this.proccessServiceBorkerClientEvents(null==e?void 0:e.clientEvents,t,d,s,o),this.processPrinting(e)}catch(t){console.warn(`Erro ao executar serviço: ${t}`),o(new n("Erro ao executar serviço",t))}else 4==f.readyState&&200!=f.status&&o(new n(`Erro ao executar serviço: ${t}`,f.responseText));J.requestListener.forEach((t=>t.onRequestEnd({url:h,requestBody:e})))}}))}addUrlParams(t,e){const n=null==t?void 0:t.urlParams;if(!n||0===Object.keys(n).length)return e;e+="&";for(const t in n)n.hasOwnProperty(t)&&(e+=`${t}=${n[t]}`);return e}isServiceBrokerError(t){return!t.hasOwnProperty("status")||t.status==J.SERVICE_BROKER_STATUS.ERROR||t.status==J.SERVICE_BROKER_STATUS.TIMEOUT}getReqKey(e){return window.btoa(t.hashCode(`${e.query}${JSON.stringify(e.values||"")}`)).replace(/=/g,"")}getQueryTemplate(t){return(t.query||"").replaceAll("$queryAlias$",t.queryID)}getWatingRequest(t){return this.watingRequestsById.get(t)}pause(){this.ready=!1}async resume(){if(this.ready=!0,this.watingRequestsById.size>0){const t=[];let e;this.watingRequestsById.forEach((async e=>{let n=this.getQueryTemplate(e.request);t.push({document:n,variables:Object.assign({},e.request.values)})}));let i=[],r=[];e=await this.fecthGrapql(t),i=e.data,r=e.errors,r.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var i;((null===(i=this.getWatingRequest(e.request.variables[e.index].queryID))||void 0===i?void 0:i.reject)||Promise.reject)(new n("Falha detectada",e.message))}))})),i.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(t))||void 0===n?void 0:n.resolve)||Promise.resolve)(e)}))})),this.watingRequestsById.clear()}}async fecthGrapql(t){let e,i=[],r=[],s=`${this.resolveURL()+this.GRAPHQL_PATH}`;const o=[];window.mgeSession&&(s+=`?mgeSession=${window.mgeSession}`),J.requestListener.forEach((e=>e.onRequestStart({url:s,requestBody:t})));try{e=await V.batchRequests(s,t,{"Content-Type":`application/json; charset=${window.SERVER_ENCODING||"UTF-8"}`}),e.forEach(((e,n)=>{var s;(null===(s=null==e?void 0:e.errors)||void 0===s?void 0:s.length)>0?r.push(e.errors.map((e=>this.normalizeErrorResponse(e,t,n)))):i.push(e.data),e.extensions&&o.push(e.extensions)}))}catch(o){if(this.isHttpError(o))throw J.requestListener.forEach((e=>e.onRequestEnd({url:s,requestBody:t}))),new n("Falha de comunicação",o.message);{e=o.response;const t=o.request;Object.entries(e).forEach((([e,n])=>{n.errors?r.push(n.errors.map((n=>(n.request=t,n.index=Number(e),n)))):n.data&&i.push(n.data)}))}}return J.requestListener.forEach((e=>e.onRequestEnd({url:s,requestBody:t}))),{data:i,errors:r,extensions:o}}isHttpError(t){var e;return!t.response&&!t.request||(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)>=300}normalizeErrorResponse(t,e,n){const i=Object.assign({},e[n]),{variables:r}=i;return i.variables=[],i.variables[n]=r,t.request=i,t.index=Number(n),t}static addClientEvent(t,e){let n=J.clientEventsByID.get(t);if(null!=n){if(n.some((t=>t.toString()===e.toString())))return;n.push(e)}else J.clientEventsByID.set(t,[e])}static hasClientEvent(t){return J.clientEventsByID.has(t)}static removeClientEvent(t){return J.clientEventsByID.delete(t)}}J.appTagName="snk-application",J.requestListener=[],J.SERVICE_BROKER_STATUS={ERROR:0,INFO:2,OK:1,TIMEOUT:3,SERVICE_CANCELED:4},J.clientEventsByID=new Map;class z{constructor(t){this._resolve=()=>{},this._reject=()=>{},this._request=void 0,this._request=t,this._promisse=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get resolve(){return this._resolve}get reject(){return this._reject}get promise(){return this._promisse}get request(){return this._request}}export{J as D,B as P,L as U,V as d}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,g as e,H as n}from"./p-d2d301a6.js";import{Action as o,ObjectUtils as a,JSUtils as h,ApplicationContext as r,DataType as l}from"@sankhyalabs/core";import{ApplicationUtils as d,DialogType as c}from"@sankhyalabs/ezui/dist/collection/utils";import{O as v,S as u}from"./p-ae6aff81.js";const f=class{constructor(s){t(this,s),this.dataStateChange=i(this,"dataStateChange",3),this.dataUnitReady=i(this,"dataUnitReady",3),this.messagesBuilderUpdated=i(this,"messagesBuilderUpdated",3),this.insertionMode=i(this,"insertionMode",3),this.cancelEdition=i(this,"cancelEdition",3),this._onDataUnitResolve=[],this._openedAlert=!1,this._dataUnitObserver=t=>{var i,s;const e=this.buildDataState();if(this.dataState=e,t.type===o.DATA_SAVED){const i=this.getMessage("snkDataUnit.saveInfo",t.payload.records[0]);null!=i&&this.showSuccessMessage(i)}if(t.type!==o.RECORDS_ADDED&&t.type!==o.RECORDS_COPIED||this.insertionMode.emit(),t.type===o.EDITION_CANCELED&&this.cancelEdition.emit(),t.type===o.RECORDS_REMOVED){const e=t.payload.cachedRecords;let n;n=(null==e?void 0:e.length)>1?this.getMessage("snkDataUnit.removeAllInfo",{size:e.length}):this.getMessage("snkDataUnit.removeInfo",t.payload.cachedRecords[0]),null!=n&&this.showSuccessMessage(n);const o=null!==(s=null===(i=this.dataUnit.records)||void 0===i?void 0:i.length)&&void 0!==s?s:0,a=this.dataUnit.getPaginationInfo();a&&this.dataUnit.gotoPage(o>0||a.hasMore?a.currentPage:0)}this.messagesBuilder.currentOperation=this.getMessageOperation()},this.dataState=void 0,this.messagesBuilder=void 0,this.dataUnitName=void 0,this.entityName=void 0,this.pageSize=150,this.dataUnit=void 0,this.beforeSave=void 0,this.afterSave=void 0,this.useCancelConfirm=!0,this.configName=void 0}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,i){i!=t&&(this.dataUnit?this._application.updateDataunitCache(i,this.dataUnitName,this.dataUnit):this.loadDataUnit())}observeEntityName(t,i){i!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,i){a.objectToString(i)!=a.objectToString(t)&&this.dataStateChange.emit(t)}observeDataUnit(){this.handlerLinkFields(),this.dataUnitReady.emit(this.dataUnit)}observeMessagesBuilder(t){t&&this.messagesBuilderUpdated.emit(t)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async getSelectedRecordsIDsInfo(){var t;const i=null===(t=this.dataUnit)||void 0===t?void 0:t.getSelectionInfo();if(null==i?void 0:i.isAllRecords())return[];const s=[],e=null==i?void 0:i.records;return(null==e?void 0:e.length)>0&&e.forEach((({__record__id__:t})=>{if(!this.dataUnit.isNewRecord(t)){if(!h.isBase64(t))return void s.push({name:"__record__id__",type:l.TEXT,value:t});const i=JSON.parse(window.atob(t));Object.entries(i).forEach((([t,i])=>{var e;const n=null===(e=this.dataUnit)||void 0===e?void 0:e.getField(t);null!=n&&s.push(Object.assign({name:t,type:n.dataType},i))}))}})),s}async interceptAction(t){return new Promise((i=>{var s,e,n,a,h;switch(t.type){case o.RECORDS_ADDED:this.isAllowed("INSERT")?i(t):d.info(this.getMessage("snkDataUnit.forbiddenInsert"));break;case o.RECORDS_COPIED:this.isAllowed("CLONE")?i(t):d.info(this.getMessage("snkDataUnit.forbiddenClone"));break;case o.DATA_CHANGED:case o.CHANGING_DATA:if(this.isAllowed("UPDATE"))return i(t);if(this._openedAlert)return this.dataUnit.cancelEdition();this._openedAlert=!0,this.dataUnit.cancelEdition(),d.alert(this.getMessage("snkDataUnit.forbidden"),this.getMessage("snkDataUnit.forbiddenUpdate")).then((()=>{this._openedAlert=!1}));break;case o.SAVING_DATA:if(this.beforeSave){const s=this.beforeSave(this.dataUnit);s instanceof Promise?s.then((s=>i(s?t:void 0))):i(s?t:void 0)}else i(t);break;case o.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):i(t);break;case o.EDITION_CANCELED:if(!this.useCancelConfirm)return i(t);if(this.dataState.hasDirtyRecords){const n=this.getMessage("snkDataUnit.cancelConfirmation");if((null===(s=t.payload)||void 0===s?void 0:s.fromParent)||(null===(e=t.payload)||void 0===e?void 0:e.silent))return void i(t);if(null==n)this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo")),i(t);else{const s=this.getMessage("snkDataUnit.cancelConfirmationTitle");d.confirm(s,n).then((s=>{s&&this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo")),i(s?t:void 0)}))}}else i(t);break;case o.REMOVING_RECORDS:if(this.isAllowed("REMOVE")){let s=!1,e=!(null===(n=t.payload)||void 0===n?void 0:n.silent)&&this.getMessage("snkDataUnit.removeConfirmation");const o=null===(a=this.dataUnit)||void 0===a?void 0:a.getSelectionInfo();if(!(null===(h=t.payload)||void 0===h?void 0:h.silent)&&(null==o?void 0:o.length)>1&&(e=this.getMessage("snkDataUnit.removeAllConfirmation",{size:o.length}),s=!0),null==e)i(t);else{const n={canClose:!1,labelCancel:this.getMessage("snkDataUnit.confirm."+(s?"no":"cancel")),labelConfirm:this.getMessage("snkDataUnit.confirm."+(s?"yes":"delete")),btnConfirmDanger:!1},o=this.getMessage("snkDataUnit.removeConfirmationTitle");d.confirm(o,e,null,c.WARN,n).then((s=>i(s?t:void 0)))}}else d.info(this.getMessage("snkDataUnit.forbiddenRemove"));break;default:i(t)}}))}showSuccessMessage(t){d.info(t,{iconName:"check"})}isAllowed(t){return!!this._permissions&&(this._permissions.isSup||this._permissions[t])}buildDataState(){const t=this.dataUnit.getSelectionInfo(),i=(this.dataUnit.hasDirtyRecords()||this.dataUnit.hasWaitingChanges())&&(null==t?void 0:t.isEmpty());return new m({insertionMode:this.dataUnit.hasNewRecord(),isStartingInsertionMode:i,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:this.dataUnit.hasCopiedRecord(),isDirty:this.dataUnit.isDirty(),hasDirtyRecords:this.dataUnit.hasDirtyRecords(),selectedRecords:void 0,selectionInfo:t,selectedRecord:this.dataUnit.getSelectedRecord(),recordsIsEmpty:0===this.dataUnit.records.length})}getMessage(t,i){return i||(i=this.getMessageParams()),this.messagesBuilder.getMessage(t,i)}getMessageParams(){return this.dataState.selectedRecord}getMessageOperation(){return this.dataState.copyMode?v.CLONE:this.dataState.insertionMode||this.dataState.isStartingInsertionMode?v.INSERT:this.dataState.isDirty?v.UPDATE:v.CLEAN}async getDataUnitParentOrChild(){var t;const i=this.dataUnitName?this.dataUnitName:this.entityName;return this._parentSnkDataUnit?(this._parentDataUnit=await(null===(t=this._parentSnkDataUnit)||void 0===t?void 0:t.getDataUnit()),await this._application.getDataUnit(this.entityName,i,this._parentDataUnit,this.configName)):await this._application.getDataUnit(this.entityName,i,null,this.configName)}async loadDataUnit(){if(null==this.dataUnit&&this._application&&this.entityName&&(this.dataUnit=await this.getDataUnitParentOrChild()),this.dataUnit){let t;for(this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver),this.dataState=this.buildDataState();t=this._onDataUnitResolve.pop();)t(this.dataUnit)}}getParentSnkDataUnit(){let t=this.element;for(;t.parentNode;){if("SNK-DATA-UNIT"===t.parentNode.nodeName)return t.parentNode;t=t.parentNode}}handlerLinkFields(){var t,i;const s=Object.assign({},this.dataUnit.metadata);if(!this._parentDataUnit)return;const e=this._parentDataUnit.getChildInfo(this.entityName);if(!e)return;const n=null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.map((t=>t.target));null===(i=null==s?void 0:s.fields)||void 0===i||i.forEach((t=>{(null==n?void 0:n.includes(t.name))&&(t.visible=!1)})),this.dataUnit.metadata=s}static getNearestInstance(t){let i=t.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase())return i;i=i.parentElement}}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application.getAllAccess().then((t=>this._permissions=t)),this._parentSnkDataUnit=this.getParentSnkDataUnit(),null==this.messagesBuilder&&(this.messagesBuilder=new u(this.entityName))}disconnectedCallback(){this.dataUnit&&(this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.removeInterceptor(this))}componentDidLoad(){this.loadDataUnit()}render(){return s(n,null)}get element(){return e(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"],messagesBuilder:["observeMessagesBuilder"]}}};class m{constructor(t){this.copyMode=t.copyMode,this.insertionMode=t.insertionMode,this.isStartingInsertionMode=t.isStartingInsertionMode,this.isDirty=t.isDirty,this.hasDirtyRecords=t.hasDirtyRecords,this.hasNext=t.hasNext,this.hasPrevious=t.hasPrevious,this.selectionInfo=t.selectionInfo,this.selectedRecord=t.selectedRecord,this.recordsIsEmpty=t.recordsIsEmpty}get selectedRecords(){var t;if(console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`."),null===(t=this.selectionInfo)||void 0===t?void 0:t.isAllRecords())throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");return this.selectionInfo.records}}f.style=".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%;width:100%}";export{f as S}