UNPKG

jsegd

Version:

Utilitário de ferramentas para desenvolvimento

1 lines 338 kB
let r;function addToExternrefTable0(n){const a=r.__externref_table_alloc();return r.__wbindgen_export_2.set(a,n),a}function handleError(n,a){try{return n.apply(this,a)}catch(n){const a=addToExternrefTable0(n);r.__wbindgen_exn_store(a)}}function isLikeNone(r){return null==r}const n="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&n.decode();let a=null;function getUint8ArrayMemory0(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(r.memory.buffer)),a}function getStringFromWasm0(r,a){return r>>>=0,n.decode(getUint8ArrayMemory0().subarray(r,r+a))}let i=0;const o="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},s="function"==typeof o.encodeInto?function(r,n){return o.encodeInto(r,n)}:function(r,n){const a=o.encode(r);return n.set(a),{read:r.length,written:a.length}};function passStringToWasm0(r,n,a){if(void 0===a){const a=o.encode(r),s=n(a.length,1)>>>0;return getUint8ArrayMemory0().subarray(s,s+a.length).set(a),i=a.length,s}let l=r.length,c=n(l,1)>>>0;const u=getUint8ArrayMemory0();let d=0;for(;d<l;d++){const n=r.charCodeAt(d);if(n>127)break;u[c+d]=n}if(d!==l){0!==d&&(r=r.slice(d)),c=a(c,l,l=d+3*r.length,1)>>>0;const n=getUint8ArrayMemory0().subarray(c+d,c+l);d+=s(r,n).written,c=a(c,l,d,1)>>>0}return i=d,c}let l=null;function getDataViewMemory0(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==r.memory.buffer)&&(l=new DataView(r.memory.buffer)),l}const c="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>{r.__wbindgen_export_5.get(n.dtor)(n.a,n.b)}));function debugString(r){const n=typeof r;if("number"==n||"boolean"==n||null==r)return`${r}`;if("string"==n)return`"${r}"`;if("symbol"==n){const n=r.description;return null==n?"Symbol":`Symbol(${n})`}if("function"==n){const n=r.name;return"string"==typeof n&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(r)){const n=r.length;let a="[";n>0&&(a+=debugString(r[0]));for(let i=1;i<n;i++)a+=", "+debugString(r[i]);return a+="]",a}const a=/\[object ([^\]]+)\]/.exec(toString.call(r));let i;if(!(a&&a.length>1))return toString.call(r);if(i=a[1],"Object"==i)try{return"Object("+JSON.stringify(r)+")"}catch(r){return"Object"}return r instanceof Error?`${r.name}: ${r.message}\n${r.stack}`:i}function clean_and_convert_to_number(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,s=r.clean_and_convert_to_number(a,o);if(s[2])throw function(n){const a=r.__wbindgen_export_2.get(n);return r.__externref_table_dealloc(n),a}(s[1]);return s[0]}function get_element(n,a){const o=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;return r.get_element(o,s,isLikeNone(a)?0:addToExternrefTable0(a))}function get_all(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i,s=r.get_all(a,o);var l=function(n,a){n>>>=0;const i=getDataViewMemory0(),o=[];for(let s=n;s<n+4*a;s+=4)o.push(r.__wbindgen_export_2.get(i.getUint32(s,!0)));return r.__externref_drop_slice(n,a),o}(s[0],s[1]).slice();return r.__wbindgen_free(s[0],4*s[1],4),l}function __wbg_adapter_26(n,a,i){r.closure698_externref_shim(n,a,i)}const u=["same-origin","no-cors","cors","navigate"],d="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>r.__wbg_validate_free(n>>>0,1)));let f=class{__destroy_into_raw(){const r=this.__wbg_ptr;return this.__wbg_ptr=0,d.unregister(this),r}free(){const n=this.__destroy_into_raw();r.__wbg_validate_free(n,0)}static email_validate(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return 0!==r.validate_email_validate(a,o)}static mobile_validate(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return 0!==r.validate_mobile_validate(a,o)}static cnpj_validate(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return 0!==r.validate_cnpj_validate(a,o)}static cpf_validate(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return 0!==r.validate_cpf_validate(a,o)}static cep_validate(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return 0!==r.validate_cep_validate(a,o)}static evp_validate(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return 0!==r.validate_evp_validate(a,o)}};const h="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>r.__wbg_writtenout_free(n>>>0,1)));let m=class{__destroy_into_raw(){const r=this.__wbg_ptr;return this.__wbg_ptr=0,h.unregister(this),r}free(){const n=this.__destroy_into_raw();r.__wbg_writtenout_free(n,0)}static deadline_written_out(n,a){let i,o;try{const s=r.writtenout_deadline_written_out(n,a);return i=s[0],o=s[1],getStringFromWasm0(s[0],s[1])}finally{r.__wbindgen_free(i,o,1)}}static number_written_out(n){let a,i;try{const o=r.writtenout_number_written_out(n);return a=o[0],i=o[1],getStringFromWasm0(o[0],o[1])}finally{r.__wbindgen_free(a,i,1)}}static date_written_out(n){let a,i;try{const o=r.writtenout_date_written_out(n);return a=o[0],i=o[1],getStringFromWasm0(o[0],o[1])}finally{r.__wbindgen_free(a,i,1)}}};function __wbg_get_imports(){const n={wbg:{}};return n.wbg.__wbg_call_672a4d21634d4a24=function(){return handleError((function(r,n){return r.call(n)}),arguments)},n.wbg.__wbg_call_7cccdd69e0791ae2=function(){return handleError((function(r,n,a){return r.call(n,a)}),arguments)},n.wbg.__wbg_documentElement_197a88c262a0aa27=function(r){const n=r.documentElement;return isLikeNone(n)?0:addToExternrefTable0(n)},n.wbg.__wbg_document_d249400bd7bd996d=function(r){const n=r.document;return isLikeNone(n)?0:addToExternrefTable0(n)},n.wbg.__wbg_fetch_b7bf320f681242d2=function(r,n){return r.fetch(n)},n.wbg.__wbg_get_67b2ba62fc30de12=function(){return handleError((function(r,n){return Reflect.get(r,n)}),arguments)},n.wbg.__wbg_get_e27dfaeb6f46bd45=function(r,n){const a=r[n>>>0];return isLikeNone(a)?0:addToExternrefTable0(a)},n.wbg.__wbg_headers_7852a8ea641c1379=function(r){return r.headers},n.wbg.__wbg_instanceof_HtmlElement_51378c201250b16c=function(r){let n;try{n=r instanceof HTMLElement}catch(r){n=!1}return n},n.wbg.__wbg_instanceof_HtmlInputElement_12d71bf2d15dd19e=function(r){let n;try{n=r instanceof HTMLInputElement}catch(r){n=!1}return n},n.wbg.__wbg_instanceof_HtmlSelectElement_2ae72edd07bf938c=function(r){let n;try{n=r instanceof HTMLSelectElement}catch(r){n=!1}return n},n.wbg.__wbg_instanceof_HtmlTextAreaElement_83a92f8ba4fb63ae=function(r){let n;try{n=r instanceof HTMLTextAreaElement}catch(r){n=!1}return n},n.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(r){let n;try{n=r instanceof Response}catch(r){n=!1}return n},n.wbg.__wbg_instanceof_Window_def73ea0955fc569=function(r){let n;try{n=r instanceof Window}catch(r){n=!1}return n},n.wbg.__wbg_json_1671bfa3e3625686=function(){return handleError((function(r){return r.json()}),arguments)},n.wbg.__wbg_length_49b2ba67f0897e97=function(r){return r.length},n.wbg.__wbg_new_23a2665fac83c611=function(n,a){try{var i={a:n,b:a};const o=new Promise(((n,a)=>{const o=i.a;i.a=0;try{return function(n,a,i,o){r.closure710_externref_shim(n,a,i,o)}(o,i.b,n,a)}finally{i.a=o}}));return o}finally{i.a=i.b=0}},n.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},n.wbg.__wbg_newnoargs_105ed471475aaf50=function(r,n){return new Function(getStringFromWasm0(r,n))},n.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return handleError((function(r,n,a){return new Request(getStringFromWasm0(r,n),a)}),arguments)},n.wbg.__wbg_querySelectorAll_40998fd748f057ef=function(){return handleError((function(r,n,a){return r.querySelectorAll(getStringFromWasm0(n,a))}),arguments)},n.wbg.__wbg_querySelector_d638ba83a95cf66a=function(){return handleError((function(r,n,a){const i=r.querySelector(getStringFromWasm0(n,a));return isLikeNone(i)?0:addToExternrefTable0(i)}),arguments)},n.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(r){queueMicrotask(r)},n.wbg.__wbg_queueMicrotask_d3219def82552485=function(r){return r.queueMicrotask},n.wbg.__wbg_resolve_4851785c9c5f573d=function(r){return Promise.resolve(r)},n.wbg.__wbg_set_11cd83f45504cedf=function(){return handleError((function(r,n,a,i,o){r.set(getStringFromWasm0(n,a),getStringFromWasm0(i,o))}),arguments)},n.wbg.__wbg_setmethod_3c5280fe5d890842=function(r,n,a){r.method=getStringFromWasm0(n,a)},n.wbg.__wbg_setmode_5dc300b865044b65=function(r,n){r.mode=u[n]},n.wbg.__wbg_setvalue_08d17a42e5d5069d=function(r,n,a){r.value=getStringFromWasm0(n,a)},n.wbg.__wbg_setvalue_6ad9ef6c692ea746=function(r,n,a){r.value=getStringFromWasm0(n,a)},n.wbg.__wbg_setvalue_f76614f551612e39=function(r,n,a){r.value=getStringFromWasm0(n,a)},n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const r="undefined"==typeof global?null:global;return isLikeNone(r)?0:addToExternrefTable0(r)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const r="undefined"==typeof globalThis?null:globalThis;return isLikeNone(r)?0:addToExternrefTable0(r)},n.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const r="undefined"==typeof self?null:self;return isLikeNone(r)?0:addToExternrefTable0(r)},n.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const r="undefined"==typeof window?null:window;return isLikeNone(r)?0:addToExternrefTable0(r)},n.wbg.__wbg_status_f6360336ca686bf0=function(r){return r.status},n.wbg.__wbg_then_44b73946d2fb3e7d=function(r,n){return r.then(n)},n.wbg.__wbg_then_48b406749878a531=function(r,n,a){return r.then(n,a)},n.wbg.__wbg_value_1d971aac958c6f2f=function(n,a){const o=passStringToWasm0(a.value,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;getDataViewMemory0().setInt32(n+4,s,!0),getDataViewMemory0().setInt32(n+0,o,!0)},n.wbg.__wbg_value_91cbf0dd3ab84c1e=function(n,a){const o=passStringToWasm0(a.value,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;getDataViewMemory0().setInt32(n+4,s,!0),getDataViewMemory0().setInt32(n+0,o,!0)},n.wbg.__wbg_value_d2c3b815cdf98d46=function(n,a){const o=passStringToWasm0(a.value,r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;getDataViewMemory0().setInt32(n+4,s,!0),getDataViewMemory0().setInt32(n+0,o,!0)},n.wbg.__wbindgen_cb_drop=function(r){const n=r.original;if(1==n.cnt--)return n.a=0,!0;return!1},n.wbg.__wbindgen_closure_wrapper2350=function(n,a,i){const o=function(n,a,i,o){const s={a:n,b:a,cnt:1,dtor:i},real=(...n)=>{s.cnt++;const a=s.a;s.a=0;try{return o(a,s.b,...n)}finally{0==--s.cnt?(r.__wbindgen_export_5.get(s.dtor)(a,s.b),c.unregister(s)):s.a=a}};return real.original=s,c.register(real,s,s),real}(n,a,699,__wbg_adapter_26);return o},n.wbg.__wbindgen_debug_string=function(n,a){const o=passStringToWasm0(debugString(a),r.__wbindgen_malloc,r.__wbindgen_realloc),s=i;getDataViewMemory0().setInt32(n+4,s,!0),getDataViewMemory0().setInt32(n+0,o,!0)},n.wbg.__wbindgen_init_externref_table=function(){const n=r.__wbindgen_export_2,a=n.grow(4);n.set(0,void 0),n.set(a+0,void 0),n.set(a+1,null),n.set(a+2,!0),n.set(a+3,!1)},n.wbg.__wbindgen_is_function=function(r){return"function"==typeof r},n.wbg.__wbindgen_is_undefined=function(r){return void 0===r},n.wbg.__wbindgen_jsval_eq=function(r,n){return r===n},n.wbg.__wbindgen_number_get=function(r,n){const a="number"==typeof n?n:void 0;getDataViewMemory0().setFloat64(r+8,isLikeNone(a)?0:a,!0),getDataViewMemory0().setInt32(r+0,!isLikeNone(a),!0)},n.wbg.__wbindgen_string_get=function(n,a){const o="string"==typeof a?a:void 0;var s=isLikeNone(o)?0:passStringToWasm0(o,r.__wbindgen_malloc,r.__wbindgen_realloc),l=i;getDataViewMemory0().setInt32(n+4,l,!0),getDataViewMemory0().setInt32(n+0,s,!0)},n.wbg.__wbindgen_string_new=function(r,n){return getStringFromWasm0(r,n)},n.wbg.__wbindgen_throw=function(r,n){throw new Error(getStringFromWasm0(r,n))},n}async function __wbg_init(n){if(void 0!==r)return r;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("jsegd_bg.wasm",import.meta.url));const i=__wbg_get_imports();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:o,module:s}=await async function(r,n){if("function"==typeof Response&&r instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(r,n)}catch(n){if("application/wasm"==r.headers.get("Content-Type"))throw n;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n)}const a=await r.arrayBuffer();return await WebAssembly.instantiate(a,n)}{const a=await WebAssembly.instantiate(r,n);return a instanceof WebAssembly.Instance?{instance:a,module:r}:a}}(await n,i);return function(n,i){return r=n.exports,__wbg_init.__wbindgen_wasm_module=i,l=null,a=null,r.__wbindgen_start(),r}(o,s)}var g,b=Object.freeze({__proto__:null,default:function(r){return function(r,n,a,i){function _instantiateOrCompile(r,n,a){var i=a?WebAssembly.instantiateStreaming:WebAssembly.instantiate,o=a?WebAssembly.compileStreaming:WebAssembly.compile;return n?i(r,n):o(r)}if("undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node){var o=require("fs"),s=require("path");return new Promise(((r,a)=>{o.readFile(s.resolve(__dirname,n),((n,o)=>{null!=n?a(n):r(_instantiateOrCompile(o,i,!1))}))}))}return _instantiateOrCompile(fetch(n),i,!0)}(0,"jsegd_bg.wasm",0,r)}});class Address{_cep;_logradouro;_complemento;_unidade;_bairro;_localidade;_uf;_estado;_regiao;_ibge;_gia;_ddd;_siafi;constructor(r,n,a,i,o,s,l,c,u,d,f,h,m){this._cep=r,this._logradouro=n,this._complemento=a,this._unidade=i,this._bairro=o,this._localidade=s,this._uf=l,this._estado=c,this._regiao=u,this._ibge=d,this._gia=f,this._ddd=h,this._siafi=m}get cep(){return this._cep}get logradouro(){return this._logradouro}get complemento(){return this._complemento}get unidade(){return this._unidade}get bairro(){return this._bairro}get localidade(){return this._localidade}get uf(){return this._uf}get estado(){return this._estado}get regiao(){return this._regiao}get ibge(){return this._ibge}get gia(){return this._gia}get ddd(){return this._ddd}get siafi(){return this._siafi}}class AddressService{addressRepository;constructor(r){this.addressRepository=r}async buscarPorCep(r){return await this.addressRepository.buscarPorCep(r)}}class AddressRepositoryImpl{async buscarPorCep(n){try{return await function(n){const a=passStringToWasm0(n,r.__wbindgen_malloc,r.__wbindgen_realloc),o=i;return r.pesquisar_por_cep(a,o)}(n)}catch(r){throw r}}}class AddressController{addressService;constructor(){this.addressService=new AddressService(new AddressRepositoryImpl)}async pesquisarPorCep(r){return await this.addressService.buscarPorCep(r)}}!function(r){r.danger="danger",r.success="success",r.warning="warning",r.info="info"}(g||(g={}));class Exception extends Error{type;context;cause;constructor(r,n){super(r),this.name=this.constructor.name,this.type=n?.type,this.context=n?.context,this.cause=n?.cause,Object.setPrototypeOf(this,Exception.prototype),this.notify()}notify(){if("undefined"!=typeof parent&&parent.FLUIGC&&parent.FLUIGC.toast){const r=this.type??g.danger;parent.FLUIGC.toast({title:r?`${r.toUpperCase()}: `:"Atenção: ",message:this.message,type:r,timeout:5e3})}else console.error(`[${this.name}] ${this.message}`),this.context&&console.error(`Contexto: ${this.context}`),this.cause&&console.error("Causa:",this.cause)}}class AttachmentList{datatable;modal;constructor(r,n){this.modal=this.createModal(),this.datatable=this.createTable(r),this.handlerEvents(n)}createTable(r){return parent.FLUIGC.datatable("#targetModal",{dataRequest:r,renderContent:["attachedActivity","attachedUser","description"],header:[{title:"Atividade"},{title:"Solicitante"},{title:"Descrição"}],multiSelect:!1,search:{enabled:!1,onlyEnterkey:!1,searchAreaStyle:"col-12",onSearch:()=>{}},scroll:{enabled:!1},navButtons:{enabled:!1},tableStyle:"table-striped table-hover table-condensed",emptyMessage:"Nenhum dado encontrado",classSelected:"",actions:{enabled:!0,template:"",actionAreaStyle:""},draggable:{enabled:!1,onDrag:()=>{}}})}createModal(){return parent.FLUIGC.modal({title:"Pesquisar",content:'\n <div class="row">\n <div class="col-xs-12 col-sm-12 col-md-12 fs-xs-padding" id="targetModal">\n </div>\n </div>\n ',id:"modalPesquisa",size:"full",actions:[],showHeader:!0,showFooter:!0,headerActions:[],headerContent:"",formModal:!1},(()=>{}))}handlerEvents(r){this.datatable.on("fluig.datatable.onselectrow",(n=>{const a=this.datatable.getRow(n.selectedIndex[0],!1);r(a),this.modal.remove()}))}}class Attach{static instance;static loading;constructor(){this.start(),Attach.loading=parent.FLUIGC.loading(window)}static getInstance(){return Attach.instance||(Attach.instance=new Attach),Attach.instance}start(){const r=document.createElement("script");r.textContent='\n"use strict";\n(() => {\n parent.WKFViewAttachment.successRemoveAttachment = function (data) {\n parent.JSEGD.onDefault();\n var message = "O anexo foi removido";\n if (data.length > 1) {\n var message = "Os anexos foram removidos";\n }\n FLUIGC.toast({\n message: message,\n type: "success",\n });\n };\n $("#ecm_wkfview").off("drop dragover dragenter");\n $("#ecm-workflowView-attachment").off("drop dragover dragenter");\n $("#ecm_navigation_fileupload")\n .off("fileuploadadd")\n .on("fileuploadadd", function (e, data) {\n if (\n parent.ECM.WKFViewAttachment.validateUpload &&\n parent.ECM.WKFViewAttachment.validateUpload()\n ) {\n return false;\n }\n if (ECM.workflowView.userPermissions.indexOf("P") < 0) {\n FLUIGC.toast({\n message: "Usuário não possui permissão para publicar anexos",\n type: "warning",\n });\n return false;\n }\n var duplicatedFiles = [];\n data.files.filter(function (item, index) {\n if (data.files.indexOf(item) != index) {\n duplicatedFiles.push(index);\n }\n });\n duplicatedFiles\n .sort(function (a, b) {\n return b - a;\n })\n .forEach(function (duplicatedFile) {\n data.files.splice(duplicatedFile, 1);\n });\n var item = null;\n var jTarget = null;\n var droppedZipZone = false;\n if (e.originalEvent && e.originalEvent.delegatedEvent) {\n jTarget = $(e.originalEvent.delegatedEvent.target);\n }\n data.files.forEach(function (file, index) {\n item = ECM.attachFileMonitor.add({\n name: file.name,\n fullPath: parent.ECM.WKFViewAttachment.defFullPath,\n droppedZipZone: droppedZipZone,\n hasApprovers: parent.ECM.WKFViewAttachment.defHasApprovers,\n });\n var hasFile = false;\n if (ECM.newAttachmentsDocs.length > 0) {\n hasFile = ECM.newAttachmentsDocs.filter(function (file) {\n return file.name === item.name;\n })[0];\n }\n if (hasFile) {\n ECM.attachFileMonitor.error(\n item,\n "Arquivo duplicado. Você tentou enviar um arquivo já anexado com este nome. "\n );\n parent.JSEGD.statusUpload = false;\n parent.JSEGD.onError();\n return false;\n } else {\n parent.JSEGD.statusUpload = true;\n }\n if (\n ECM.maxUploadSize > 0 &&\n file.size >= ECM.maxUploadSize * 1024 * 1024\n ) {\n ECM.attachFileMonitor.error(\n item,\n "Tamanho total do arquivo ultrapassou o limite de " +\n ECM.core.formatSize(ECM.maxUploadSize)\n );\n parent.JSEGD.onError();\n parent.JSEGD.statusUpload = false;\n return false;\n } else {\n parent.JSEGD.statusUpload = true;\n }\n data.context = item.context;\n });\n if (jTarget && jTarget.attr("id") == "ecm-navigation-inputFile-clone") {\n if (jTarget.attr("data-on-camera") == "true") {\n if (jTarget.get(0).files.length > 1) {\n FLUIGC.toast({\n message:\n "Não é possível realizar upload de mais de um arquivo no método showCamera.",\n type: "danger",\n });\n ECM.attachFileMonitor.error(\n item,\n "Não é possível realizar upload de mais de um arquivo no método showCamera."\n );\n parent.JSEGD.onError();\n parent.JSEGD.statusUpload = false;\n return false;\n }\n }\n } else {\n parent.JSEGD.statusUpload = true;\n }\n if (data) {\n if (parent.ECM.WKFViewAttachment.datasUpload) {\n parent.ECM.WKFViewAttachment.datasUpload[item.id] = data;\n } else {\n datasUpload[item.id] = data;\n }\n }\n })\n .off("fileuploaddone")\n .on("fileuploaddone", function (e, data) {\n data.result.files.forEach(function (file, index) {\n if (data.context) {\n var item = {};\n item.id = data.context.data("item-id");\n item.fullPath = data.context.data("item-full-path");\n item.droppedZipZone = data.context.data("item-dropped-zip-zone");\n }\n if (file.error) {\n parent.JSEGD.statusUpload = false;\n parent.JSEGD.onError();\n ECM.attachFileMonitor.error(item, file.error);\n } else {\n if (item) {\n item.name = file.name;\n item.internalId = Date.now();\n var element = $("#ecm-navigation-inputFile-clone");\n if (element) {\n if (element.attr("data-on-camera") == "true") {\n if (element.attr("data-file-name-camera")) {\n item.description = element.attr("data-file-name-camera");\n }\n element.removeAttr("data-on-camera");\n element.removeAttr("data-file-name-camera");\n }\n }\n item.uploadId = file.uploadId;\n parent.ECM.WKFViewAttachment.startPublishingDocument(null, item);\n parent.JSEGD.statusUpload = true;\n }\n }\n if (parent.JSEGD.statusUpload) {\n parent.JSEGD.onSuccess();\n }\n });\n })\n .off("fileuploadfail")\n .on("fileuploadfail", function (e, data) {\n if (data.context) {\n parent.JSEGD.onError();\n var item = {};\n item.id = data.context.data("item-id");\n ECM.attachFileMonitor.cancel(item);\n }\n });\n})(); \n ',parent.document.body.appendChild(r)}add(r,n){const a=parent.document.getElementById("ecm-navigation-inputFile-clone"),i=this.filterAttachmentsByName(r);n&&a.setAttribute("accept",n),r=this.replaceVersion(r,i),a.setAttribute("data-on-camera","true"),a.setAttribute("data-file-name-camera",r),a.click()}edit(r){this.filterAttachmentsByName(r)}view(r){const n=this.filterAttachmentsByName(r);if(!(n.length>0))throw new Exception("Não há documentos em anexo",{type:g.danger});if(!(this.filterAttachmentsPublished(n).length>0))throw new Exception("Não é possível visualizar documentos anexados nesta etapa do processo",{type:g.warning});new AttachmentList(n,(({colleagueId:r,documentId:n,version:a})=>{const{WKFViewAttachment:i}=parent;if(!i)throw new Error("Falha ao anexar");i.openAttachmentView(r,n,a)}))}remove(r){const n=this.filterAttachmentsByName(r);if(!(n.length>0))throw new Exception("Não há documentos em anexo",{type:g.danger});new AttachmentList(n,(({description:r})=>{const n=parent.ECM.attachmentTable.getData().findIndex((n=>n.description===r)),{WKFViewAttachment:a}=parent;if(!a)throw new Error("Falha ao anexar");a.confirmRemoveAttach([n])}))}filterAttachmentsPublished(r){return r.filter((r=>!0!==r.newAttach))}filterAttachmentsByName(r){const{WKFViewAttachment:n}=parent;if(!n)throw new Error("Falha ao anexar");return"_Z_"===r?n.getAllAttachments().filter((n=>n.description.toLowerCase().includes(r.toLowerCase()))):n.getAllAttachments().filter((n=>n.description.replace(/_V\d+$/,"").toLowerCase()===r.toLowerCase()))}getNextVersion(r){let n=0;return r.forEach((r=>{const a=r.description.match(/_V(\d+)$/);if(a){const r=parseInt(a[1],10);n=Math.max(n,r)}})),n+1}replaceVersion(r,n){if(r.match(/_V(\d+)$/)){const a=this.getNextVersion(n);return r.replace(/_V\d+$/,`_V${a}`)}return`${r}_V${this.getNextVersion(n)}`}}class AttachTable{static instance;constructor(){AttachTable.start()}static getInstance(){return AttachTable.instance||(AttachTable.instance=new AttachTable),AttachTable.instance}static start(){AttachTable.removeMouseEvents(),AttachTable.setEvent(),AttachTable.setTemplate();const r=parent.document.querySelector("#div-btn-attachment");r.querySelector("[data-attachments-download-attach]").style.pointerEvents="auto",r.querySelector("[data-attachments-remove-attach]")?.classList.add("fs-display-none"),parent.document.querySelector("#div-row-new-attachments div:nth-child(1)")?.classList.add("fs-display-none"),parent.document.querySelector("#div-row-new-attachments #attachment-icon-filter")?.classList.add("fs-display-none"),parent.document.querySelector("#div-row-new-attachments #div-buttons-attachment")?.classList.add("fs-display-none")}static setTemplate(){parent.document.querySelector(".attachmentsTpl").textContent='<tr><td style="pointer-events: auto"><input type="checkbox" id="attachmentCheck-{{documentId}}" data-check-attachment/></td><td style="pointer-events: auto">{{#iconUrl}}<img src="/webdesk/{{iconPath}}" class="iconAttachDoc" />{{/iconUrl}} {{^iconUrl}}<i class="fluigicon fluigicon-md {{iconClass}}"></i>{{/iconUrl}}<a href="#" data-attachment-open class="fs-sm-margin-left">{{description}}</a></td><td>{{documentId}}</td><td><span>{{#version}} {{version}} {{/version}} {{^version}} 1000 {{/version}}</span></td><td>{{attachedUser}}</td><td><span>{{#attachedDate}} {{attachedDate}} {{/attachedDate}} {{^attachedDate}} Ainda não publicado {{/attachedDate}}</span></td><td>{{attachedActivity}}</td></tr>'}static removeMouseEvents(){const r=parent.document.getElementById("attachments-tab");r.style.pointerEvents="none",r.style.userSelect="none",r.style.touchAction="none"}static setActionToBody(){parent.document.querySelectorAll("#attachmentsTable table tbody tr").forEach((r=>{r.querySelector("td:nth-child(1)").style.pointerEvents="auto";r.querySelector("td:nth-child(2)").style.pointerEvents="auto";const n=r.querySelector("td:nth-child(8)");n&&(n.classList.remove("fs-display-flex","fs-justify-content-flex-end","fs-no-padding-right"),n.classList.add("fs-display-none"))}))}static setActionToHeader(){const r=parent.document.querySelector("#attachmentsTable table").querySelector("thead tr");r.style.pointerEvents="auto";const n=r.querySelector("th:nth-child(2)"),a=r.querySelector("th:nth-child(5)"),i=r.querySelector("th:nth-child(6)"),o=r.querySelector("th:nth-child(7)");n.appendChild(AttachTable.gettagI()),n.addEventListener("click",AttachTable.sortByTitle),n.setAttribute("data-order","true"),a.appendChild(AttachTable.gettagI()),a.addEventListener("click",AttachTable.sortByUser),a.setAttribute("data-order","true"),i.appendChild(AttachTable.gettagI()),i.addEventListener("click",AttachTable.sortByDate),i.setAttribute("data-order","true"),o.appendChild(AttachTable.gettagI()),o.addEventListener("click",AttachTable.sortByActivity),o.setAttribute("data-order","true")}static gettagI(){const r=document.createElement("i");return r.classList.add("flaticon","flaticon-ordenation","icon-xs"),r.setAttribute("aria-hidden","true"),r.style.marginLeft="10px",r}static setEvent(){parent.WKFViewAttachment.getAllAttachments().length>0?(AttachTable.setActionToBody(),AttachTable.setActionToHeader()):parent.document.querySelector("#tab-attachments")?.addEventListener("click",(r=>{const{target:n}=r,a=n;if(!a.getAttribute("data-attachTable")){parent.WKFViewAttachment.getAllAttachments().length>0&&(AttachTable.setActionToBody(),AttachTable.setActionToHeader(),a.setAttribute("data-attachTable","true"))}}))}static setOrder(r){const n=parent.document.querySelector("#attachmentsTable table tbody");r.forEach((r=>{n.appendChild(r)}))}static getRows(){return Array.from(parent.document.querySelectorAll("#attachmentsTable table tbody tr"))}static sortByActivity(r){const{target:n}=r,a=n,i=a.getAttribute("data-order");if(null!==i){const r="true"===i,n=AttachTable.getRows();n.sort(((n,a)=>{const i=n.querySelector("td:nth-child(7)")?.textContent?.trim(),o=a.querySelector("td:nth-child(7)")?.textContent?.trim();return i&&o?r?i.localeCompare(o):o.localeCompare(i):0})),a.setAttribute("data-order",`${!r}`),AttachTable.setOrder(n)}}static sortByTitle(r){const{target:n}=r,a=n,i=a.getAttribute("data-order");if(null!==i){const r="true"===i,n=AttachTable.getRows();n.sort(((n,a)=>{const i=n.querySelector("td:nth-child(2)")?.textContent?.trim(),o=a.querySelector("td:nth-child(2)")?.textContent?.trim();return i&&o?r?i.localeCompare(o):o.localeCompare(i):0})),a.setAttribute("data-order",`${!r}`),AttachTable.setOrder(n)}}static sortByUser(r){const{target:n}=r,a=n,i=a.getAttribute("data-order");if(null!==i){const r="true"===i,n=AttachTable.getRows();n.sort(((n,a)=>{const i=n.querySelector("td:nth-child(5)")?.textContent?.trim(),o=a.querySelector("td:nth-child(5)")?.textContent?.trim();return i&&o?r?i.localeCompare(o):o.localeCompare(i):0})),a.setAttribute("data-order",`${!r}`),AttachTable.setOrder(n)}}static sortByDate(r){const{target:n}=r,a=n,i=a.getAttribute("data-order");if(null!==i){const r="true"===i,n=AttachTable.getRows();n.sort(((n,a)=>{const i=n.querySelector("td:nth-child(6)")?.textContent?.trim(),o=a.querySelector("td:nth-child(6)")?.textContent?.trim();return i&&o?r?i.localeCompare(o):o.localeCompare(i):0})),a.setAttribute("data-order",`${!r}`),AttachTable.setOrder(n)}}}class AttachButton extends HTMLElement{description;accept;noaddbutton=null;noviewbutton=null;noeditbutton=null;nodeletebutton=null;constructor(){super();const r=this.attachShadow({mode:"open"}),n=document.createElement("style");n.innerHTML=":host {display: inline-block;position: relative;font-family: Arial, sans-serif;}.dropdown {position: relative;display: inline-block;}.dropdown-button {background-color: #fff;color: #555;padding: 6px 10px;font-size: 14px;border: 1px solid #ccc;cursor: pointer;border-radius: 0 5px 5px 0;display: flex;align-items: center;gap: 5px;height: 32px;}.dropdown-button:hover {color: #555;border-color: #adadad;background-color: #e6e6e6;}.dropdown-menu {display: none;position: absolute;top: 100%;right: 0;background-color: #fff;box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);min-width: 150px;list-style: none;padding: 0;margin: 0;border-radius: 0 0 2px 2px;}.dropdown-menu a {display: flex;gap: 10px;padding: 5px;box-sizing: border-box;width: 100%;text-decoration: none;color: #333;font-size: 14px;justify-content: end;align-items: center;line-height: 1.5rem;}.dropdown-menu a:hover {background-color: #f1f1f1;color: #1d1b1b;}.dropdown:hover .dropdown-menu {display: block;z-index: 9999;} .fs-display-none {display:none!important}";const a=document.createElement("template");a.innerHTML='\n <div class="dropdown">\n <button class="dropdown-button">\n <svg\n width="16"\n height="16"\n fill="currentColor"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 18.51"\n >\n <g>\n <path\n d="M11.78,1.68H1.68v11.78H0V1.68c0-.46.16-.85.49-1.18s.72-.49,1.18-.49h10.1v1.68ZM14.3,3.35c.47,0,.87.16,1.2.49.33.33.49.73.49,1.2v11.78c0,.46-.16.86-.49,1.18-.33.33-.73.49-1.2.49H5.05c-.46,0-.86-.16-1.18-.49-.33-.33-.49-.72-.49-1.18V5.05c0-.47.16-.87.49-1.2s.72-.49,1.18-.49h9.25ZM14.3,5.05H5.05v11.78h9.25V5.05ZM7.58,6.73c-.24,0-.44.08-.6.25s-.25.36-.25.6c0,.22.08.42.25.58s.37.25.6.25h1.68c.24,0,.44-.08.6-.25s.25-.36.25-.58c0-.24-.08-.44-.25-.6s-.36-.25-.6-.25h-1.68ZM7.58,10.1c-.24,0-.44.08-.6.25s-.25.36-.25.58c0,.24.08.44.25.6s.37.25.6.25h4.2c.24,0,.44-.08.6-.25s.25-.37.25-.6c0-.22-.08-.42-.25-.58s-.36-.25-.6-.25h-4.2ZM7.58,13.45c-.24,0-.44.08-.6.25s-.25.36-.25.6.08.44.25.6.37.25.6.25h4.2c.24,0,.44-.08.6-.25s.25-.37.25-.6-.08-.44-.25-.6-.36-.25-.6-.25h-4.2Z"\n />\n </g>\n </svg>\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="10"\n height="12"\n viewBox="0 0 16 14"\n >\n <polygon\n points="0,0 8,12 16,0"\n fill="#282828"\n stroke="#282828"\n stroke-width="1"\n />\n </svg>\n </button>\n <ul class="dropdown-menu">\n <li class="fs-display-none">\n <a href="#" class="dropdown-item" id="attach">\n <span>Anexar</span>\n <svg\n width="16"\n height="16"\n fill="currentColor"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 16"\n >\n <g id="Camada_1-2" data-name="Camada 1">\n <path\n d="M14.62,9.83c.16-.16.35-.23.57-.23s.41.08.57.23c.16.16.23.35.23.57v3.2c0,.66-.23,1.23-.7,1.7-.47.47-1.03.7-1.7.7H2.4c-.66,0-1.23-.23-1.7-.7-.47-.47-.7-1.03-.7-1.7v-3.2c0-.22.08-.42.23-.57.16-.16.35-.23.57-.23s.41.08.57.23c.16.16.23.35.23.57v3.2c0,.21.08.4.23.55.16.16.34.23.55.23h11.2c.21,0,.4-.08.55-.23.16-.16.23-.34.23-.55v-3.2c0-.22.08-.42.23-.57ZM4.57,5.38c-.16.15-.35.22-.57.22s-.41-.07-.57-.22c-.15-.16-.22-.35-.22-.57s.07-.41.22-.57L7.44.24c.15-.16.34-.24.56-.24s.41.08.56.24l4.01,3.99c.15.16.22.35.22.57s-.07.41-.22.57c-.16.15-.35.22-.57.22s-.41-.07-.57-.22l-2.62-2.64v7.66c0,.22-.08.42-.23.57-.16.16-.35.23-.57.23s-.42-.08-.57-.23c-.16-.16-.23-.35-.23-.57V2.74l-2.62,2.64Z"\n />\n </g>\n </svg>\n </a>\n </li>\n <li class="fs-display-none">\n <a href="#" class="dropdown-item" id="view">\n <span>Visualizar</span>\n <svg\n width="16"\n height="16"\n fill="currentColor"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 16 12.37"\n >\n <g>\n <path\n d="M8,12.37c-1.25,0-2.37-.3-3.34-.89-.97-.59-1.79-1.25-2.47-1.97s-1.2-1.4-1.56-2.02c-.35-.63-.55-.97-.58-1.04-.03-.1-.05-.2-.05-.31s.02-.2.05-.31c.03-.05.23-.38.58-.99.36-.63.88-1.3,1.56-2.01s1.5-1.37,2.47-1.96c.98-.58,2.09-.87,3.34-.87s2.37.3,3.34.89c.97.58,1.79,1.23,2.47,1.95.68.72,1.2,1.4,1.56,2.02.35.63.55.97.58,1.04.03.1.05.2.05.31s-.02.2-.05.31c-.03.06-.23.39-.58,1.01-.36.61-.88,1.28-1.56,2-.68.72-1.5,1.37-2.47,1.96-.98.59-2.09.89-3.34.89ZM2.17,7.4c.36.53.83,1.07,1.39,1.6.56.53,1.22.99,1.97,1.39.75.4,1.57.6,2.47.6s1.72-.2,2.46-.6c.74-.4,1.39-.86,1.95-1.39.56-.53,1.03-1.06,1.41-1.6.36-.53.63-.94.8-1.23-.15-.27-.41-.68-.78-1.21-.36-.53-.83-1.07-1.39-1.6-.56-.53-1.22-1-1.97-1.4-.75-.4-1.58-.6-2.47-.6s-1.72.2-2.46.6c-.74.4-1.39.86-1.95,1.4-.56.53-1.03,1.07-1.41,1.6-.36.53-.63.94-.8,1.21.15.28.41.69.78,1.23ZM8,8.94c-.74,0-1.37-.27-1.89-.81-.52-.54-.78-1.19-.78-1.95s.26-1.4.78-1.94c.52-.54,1.15-.81,1.89-.81s1.37.27,1.89.81c.52.54.78,1.19.78,1.94s-.26,1.41-.78,1.95c-.52.54-1.15.81-1.89.81ZM7.06,5.21c-.26.27-.39.59-.39.96s.13.71.39.98c.26.27.57.4.94.4s.68-.13.94-.4c.26-.27.39-.59.39-.98s-.13-.7-.39-.96c-.26-.27-.57-.4-.94-.4s-.68.13-.94.4Z"\n />\n </g>\n </svg>\n </a>\n </li>\n <li class="fs-display-none">\n <a href="#" class="dropdown-item" id="edit">\n <span>Editar</span>\n <svg\n width="16px"\n height="16px"\n viewBox="0 0 24 24"\n xmlns="http://www.w3.org/2000/svg"\n >\n <title />\n\n <g id="Complete">\n <g id="edit">\n <g>\n <path\n d="M20,16v4a2,2,0,0,1-2,2H4a2,2,0,0,1-2-2V6A2,2,0,0,1,4,4H8"\n fill="none"\n stroke="#282828"\n stroke-linecap="round"\n stroke-linejoin="round"\n stroke-width="2"\n />\n\n <polygon\n fill="none"\n points="12.5 15.8 22 6.2 17.8 2 8.3 11.5 8 16 12.5 15.8"\n stroke="#282828"\n stroke-linecap="round"\n stroke-linejoin="round"\n stroke-width="2"\n />\n </g>\n </g>\n </g>\n </svg>\n </a>\n </li>\n <li class="fs-display-none">\n <a href="#" class="dropdown-item" id="remove">\n <span>Excluir</span>\n <svg\n id="Camada_2"\n data-name="Camada 2"\n width="16"\n height="16"\n fill="currentColor"\n xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 14.22 16"\n >\n <g>\n <path\n d="M13.52,2.91c.21,0,.38.07.51.2s.19.31.19.54c0,.21-.06.38-.19.52s-.3.2-.51.2h-.72v9.46c0,.62-.2,1.13-.61,1.55s-.91.62-1.52.62H3.56c-.6,0-1.11-.21-1.52-.62s-.61-.93-.61-1.55V4.37h-.72c-.21,0-.38-.07-.51-.2s-.19-.31-.19-.52c0-.22.06-.4.19-.54s.3-.2.51-.2h2.85v-.72c0-.62.2-1.14.61-1.56s.91-.63,1.52-.63h2.85c.6,0,1.11.21,1.52.63s.61.94.61,1.56v.72h2.85ZM11.37,13.83V4.37H2.85v9.46c0,.21.06.38.19.52s.3.2.51.2h7.11c.21,0,.38-.07.51-.2s.19-.31.19-.52ZM4.98,2.19v.72h4.26v-.72c0-.22-.06-.4-.19-.53s-.3-.19-.51-.19h-2.85c-.21,0-.38.06-.51.19s-.19.31-.19.53ZM6.41,7.28c0-.22-.07-.4-.2-.53s-.31-.19-.52-.19-.38.06-.51.19-.19.31-.19.53v4.37c0,.21.06.38.19.52s.3.2.51.2.38-.07.52-.2.2-.31.2-.52v-4.37ZM9.24,7.28c0-.22-.06-.4-.19-.53s-.3-.19-.51-.19-.38.06-.52.19-.2.31-.2.53v4.37c0,.21.07.38.2.52s.31.2.52.2.38-.07.51-.2.19-.31.19-.52v-4.37Z"\n />\n </g>\n </svg>\n </a>\n </li>\n </ul>\n </div> \n ',r.appendChild(n),r.appendChild(a.content.cloneNode(!0)),this.description="",this.accept=null,parent.JSEGD={statusUpload:!1,buttonUpload:document.createElement("button"),onError:()=>{parent.JSEGD.buttonUpload.style.color="rgb(255, 255, 255)",parent.JSEGD.buttonUpload.style.backgroundColor="rgb(204, 61, 61)"},onSuccess:()=>{parent.JSEGD.buttonUpload.style.color="rgb(255, 255, 255)",parent.JSEGD.buttonUpload.style.backgroundColor="rgb(26, 184, 63)"},onDefault:()=>{parent.JSEGD.buttonUpload.style.color="rgb(85, 85, 85)",parent.JSEGD.buttonUpload.style.backgroundColor="rgb(255, 255, 255)"}}}connectedCallback(){AttachTable.getInstance(),this.noaddbutton=this.getAttribute("noAddButton"),this.noviewbutton=this.getAttribute("noViewButton"),this.noeditbutton=this.getAttribute("noEditButton")||"true",this.nodeletebutton=this.getAttribute("noDeleteButton"),this.displayButtons(),this.accept=this.getAttribute("accept"),this.description=this.getAttribute("description")||"";const r=Attach.getInstance();this.addButton(r),this.viewButton(r),this.removeButton(r)}displayButtons(){"true"!==this.noaddbutton&&this.shadowRoot?.querySelector("#attach")?.parentElement?.classList.remove("fs-display-none"),"true"!==this.noviewbutton&&this.shadowRoot?.querySelector("#view")?.parentElement?.classList.remove("fs-display-none"),"true"!==this.noeditbutton&&this.shadowRoot?.querySelector("#edit")?.parentElement?.classList.remove("fs-display-none"),"true"!==this.nodeletebutton&&this.shadowRoot?.querySelector("#remove")?.parentElement?.classList.remove("fs-display-none")}addButton(r){this.shadowRoot?.querySelector("#attach")?.addEventListener("click",(n=>{n.preventDefault();const a=this.shadowRoot?.querySelector(".dropdown-button");parent.JSEGD.buttonUpload=a,this.description?r.add(this.description,this.accept):this.showModal()}))}viewButton(r){this.shadowRoot?.querySelector("#view")?.addEventListener("click",(n=>{n.preventDefault(),r.view(this.description?this.description:"_Z_")}))}removeButton(r){this.shadowRoot?.querySelector("#remove")?.addEventListener("click",(n=>{n.preventDefault(),r.remove(this.description?this.description:"_Z_")}))}showModal(){const r=parent.FLUIGC.modal({title:"Informe a descrição do anexo",content:'\n <div class="row" style="height: 200px;">\n <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">\n <div class="form-group">\n <label for="attach_description">Descrição do anexo</label>\n <input type="text" name="attach_description" id="attach_description"\n class="form-control" />\n </div>\n </div>\n </div>\n <script>\n parent.FLUIGC.autocomplete(\n "#attach_description",\n {\n source: filterGenericAttachments,\n highlight: true,\n displayKey: "description",\n tagClass: "tag-gray",\n type: "autocomplete",\n },\n () => {}\n );\n function filterGenericAttachments(q, cb) {\n const matches = removeDuplicates()\n .filter((description) => {\n return description.toLowerCase().includes(q.toLowerCase());\n })\n .map((description) => {\n return { description };\n });\n cb(matches);\n }\n function getAllAttachments() {\n const { WKFViewAttachment } = parent;\n if (!WKFViewAttachment) throw new Error("Falha ao anexar");\n return WKFViewAttachment.getAllAttachments();\n }\n function getAllDescriptions() {\n const attachments = getAllAttachments();\n return attachments.map((attachment) => {\n return attachment.description;\n });\n }\n function getAllGenericAttachments() {\n const descriptions = getAllDescriptions();\n return descriptions.filter((description) => {\n return description.includes("_Z_");\n });\n }\n function removeGenericInformation() {\n const generics = getAllGenericAttachments();\n return generics.map((description) => {\n return description.substring(0, description.indexOf("_Z_V"));\n });\n }\n function removeDuplicates() {\n const descriptions = removeGenericInformation();\n return [...new Set(descriptions)];\n }\n <\/script>\n ',id:"attachModal",showHeader:!0,showFooter:!0,actions:[{label:"Salvar",bind:"data-save-modal"},{label:"Cancelar",bind:"data-cancel-modal"}],headerActions:[],headerContent:"",size:"large",formModal:!1},((n,a)=>{n||(parent.document.querySelector("[data-save-modal]")?.addEventListener("click",(()=>{const{value:n}=parent.document.querySelector("#attach_description");if(!n)throw new Exception("Informe a descrição do anexo",{type:g.danger});const a=`${n.toUpperCase()}_Z`;r.remove();Attach.getInstance().add(a,this.accept)})),parent.document.querySelector("[data-cancel-modal]")?.addEventListener("click",(()=>{r.remove()})))}))}}customElements.get("attachment-button")||customElements.define("attachment-button",AttachButton);class Bank{_ispb;_name;_code;_fullName;constructor(r,n,a,i){this._ispb=r,this._name=n,this._code=a,this._fullName=i}get ispb(){return this._ispb}get name(){return this._name}get code(){return this._code}get fullName(){return this._fullName}toString(){return`\n {\n "ispb":'${this._ispb}'\n "name":'${this._name}'\n "code":'${this._code}'\n "fullName":'${this._fullName}'\n } \n `}}class BankService{bankRepository;constructor(r){this.bankRepository=r}async list(){return await this.bankRepository.list()}async findByFullName(r){return await this.bankRepository.findByFullName(r)}async filterByCodeOrFullName(r){return await this.bankRepository.filterByCodeOrFullName(r)}}class BankRepositoryImpl{async filterByCodeOrFullName(r){return(await this.getBanks()).filter((n=>n.fullName.toUpperCase().includes(r.toUpperCase())||n.code===parseInt(r)))}async findByFullName(r){return(await this.getBanks()).filter((n=>n.fullName.toUpperCase().includes(r.toUpperCase())))}async list(){return await this.getBanks()}async getBanks(){try{let n=localStorage.getItem("banks");if(n)return JSON.parse(n);let a=this.cleanBanks(await r.list());return localStorage.setItem("banks",JSON.stringify(a)),a}catch(r){throw r}}cleanBanks(r){return r.filter((r=>r.ispb&&r.name&&r.code&&r.fullName))}}class BankController{bankService;constructor(){this.bankService=new BankService(new BankRepositoryImpl)}async list(){return await this.bankService.list()}async findByFullName(r){return await this.bankService.findByFullName(r)}async filterByCodeOrFullName(r){return await this.bankService.filterByCodeOrFullName(r)}}class LocalCache{static instance;dbPromise=null;isInitialized=!1;cacheExpirationMs;storeName;constructor(){}static getInstance(){return LocalCache.instance||(LocalCache.instance=new LocalCache),LocalCache.instance}initialize(r){if(!this.isInitialized){if(void 0===r.cacheExpirationMs||void 0===r.storeName)throw new Error("As opções cacheExpirationMs e storeName são obrigatórias para a inicialização do LocalService.");this.cacheExpirationMs=r.cacheExpirationMs,this.storeName=r.storeName,this.isInitialized=!0}}ensureInitialized(){if(!this.isInitialized||void 0===this.cacheExpirationMs||void 0===this.storeName)throw new Error("LocalService não foi inicializado. Chame getInstance().initialize() primeiro com as opções necessárias.")}promisifyRequest(r){return new Promise(((n,a)=>{r.onsuccess=()=>n(r.result),r.onerror=()=>a(r.error)}))}async openDatabase(){return this.ensureInitialized(),this.dbPromise||(this.dbPromise=new Promise(((r,n)=>{const a=indexedDB.open("ApiCacheDB",1);a.onupgradeneeded=()=>{const r=a.result;r.objectStoreNames.contains(this.storeName)||r.createObjectStore(this.storeName,{keyPath:"key"})},a.onsuccess=()=>r(a.result),a.onerror=()=>{console.error("Erro ao abrir IndexedDB:",a.error),n(a.error)}}))),this.dbPromise}async getCachedData(r){this.ensureInitialized();try{const n=(await this.openDatabase()).transaction(this.storeName,"readonly"),a=n.objectStore(this.storeName).get(r),i=await this.promisifyRequest(a);if(!i)return null;return Date.now()-i.timestamp>this.cacheExpirationMs?(console.info(`Cache expirado para chave: ${r}. Removendo...`),await this.removeCachedData(r).catch((n=>console.error(`Erro ao remover cache expirado para ${r}:`,n))),null):i}catch(n){return console.error(`Erro geral ao obter cache para ${r}:`,n),null}}async setCachedData(r,n){this.ensureInitialized();try{const a=(await this.openDatabase()).transaction(this.storeName,"readwrite"),i=a.objectStore(this.storeName),o={key:r,timestamp:Date.now(),data:n},s=i.put(o);await this.promisifyRequest(s),await new Promise(((r,n)=>{a.oncomplete=()=>r(),a.onerror=()=>{console.error("Erro na transação de escrita de cache:",a.error),n(a.error)}}))}catch(n){throw console.error(`Erro geral ao salvar no cache para ${r}:`,n),n}}async removeCachedData(r){this.ensureInitialized();try{const n=(await this.openDatabase()).transaction(this.storeName,"readwrite"),a=n.objectStore(this.storeName).delete(r);await this.promisifyRequest(a),await new Promise(((r,a)=>{n.oncomplete=()=>r(),n.onerror=()=>{console.error("Erro na transação de remoção de cache:",n.error),a(n.error)}}))}catch(n){throw console.error(`Erro geral ao remover cache para ${r}:`,n),n}}}class WorkerManager{poolSize;pool=[];workerMeta=new Map;taskQueue=[];inFlight=new Map;cache=LocalCache.getInstance();constructor(r=4,n){this.poolSize=r,this.cache.initialize(n);for(let r=0;r<this.poolSize;r++){const r=new Worker(new URL("./worker.ts",import.meta.url),{type:"module"});r.onmessage=n=>this.handleResponse(n.data,r),this.workerMeta.set(r,{busy:!1}),this.pool.push(r)}}search(r,n){const a=this.buildUrl(r,n),i=a,o=this.cache.getCachedData(i).then((r=>r?r.data:this.inFlight.has(i)?this.inFlight.get(i).promise:this.enqueueRequest(i,{requestId:Date.now(),requestUrl:a},i))).then((r=>{if(r&&r.columns&&r.values){const n=r.values[0],a=n?n.code:0;return a>=200&&a<300?(this.cache.setCachedData(i,n).catch((()=>{})),n):n}return r}));let canceller=()=>{};return{promise:new Promise(((r,n)=>{canceller=()=>n(new Error("Requisição cancelada")),o.then(r,n)})),cancel:canceller}}enqueueRequest(r,n,a){let i,o;const s=new Promise(((r,n)=>{i=r,o=n})),l={promise:s,r