1import{f as L,g as W,h as X,i as Z,o as ee,r as te,t as ie,u as ne}from"./chunk-NGTHJOO7.js";import{a as J}from"./chunk-3OGZCIMY.js";import{a as K,b as y,c as $,g as q}from"./chunk-STAJSGIL.js";import{b as j}from"./chunk-FUSFJZ2X.js";import{a as Y}from"./chunk-EIPVTNUH.js";import{a as G}from"./chunk-OOXGXSH6.js";import{a as z}from"./chunk-GHQ76MSG.js";import"./chunk-PVOIA725.js";import{c as H}from"./chunk-RLNSLDM4.js";import"./chunk-YPIUQ4OQ.js";import"./chunk-CC72V6IX.js";import{a as V}from"./chunk-UNTZTYVU.js";import{a as Q}from"./chunk-M7MH3SN4.js";import{a as E}from"./chunk-277VYQ3G.js";import"./chunk-2ITVIAKQ.js";import"./chunk-PPYMVQ4K.js";import"./chunk-ALF373LA.js";import{a as S}from"./chunk-53MXLG3J.js";import{a as k}from"./chunk-MQDYVSBZ.js";import"./chunk-MARJNDOE.js";import"./chunk-OONTQ2G6.js";import"./chunk-HLZC33O3.js";import{f as O,h as U}from"./chunk-KE67Y5LU.js";import{$b as g,Ab as R,Bb as v,Cb as w,Db as r,Ea as P,Eb as a,Fb as d,Ha as m,Ic as h,Jb as D,Kb as c,Lb as u,Uc as A,Wa as l,Zb as p,ac as B,fb as b,lb as C,ma as x,sa as I,sb as f,ta as F,yb as T,za as N}from"./chunk-KA4KRCJ4.js";import{k as M}from"./chunk-5KTCK5IS.js";var ae=(()=>{class e{constructor(){this.back=P()}onBack(){this.back.emit()}onTutorial(){window.open(K,"_blank","noopener")}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=b({type:e,selectors:[["app-field-mapping-list-header"]],outputs:{back:"back"},decls:7,vars:2,consts:[[1,"py-4","flex","justify-between","items-center"],[1,"flex","items-center","gap-2.5"],["icon","icon-navigate_backwards","role","button","aria-label","Voltar","tabindex","0",1,"text-xl","text-primary","cursor-pointer",3,"click","keydown.enter","keydown.space"],["htmlTag","h1","type","body-large-highlight","className","text-primary"],[1,"flex","items-center","gap-4"],["type","unfocus","size","medium",3,"onClick","icon","iconOnly"]],template:function(i,n){i&1&&(r(0,"div",0)(1,"div",1)(2,"ps-icon",2),c("click",function(){return n.onBack()})("keydown.enter",function(){return n.onBack()})("keydown.space",function(){return n.onBack()}),a(),r(3,"ui-text",3),p(4," Mapeamento de campos "),a()(),r(5,"div",4)(6,"ui-button",5),c("onClick",function(){return n.onTutorial()}),a()()()),i&2&&(l(6),f("icon","icon-tutorial")("iconOnly",!0))},dependencies:[S,E,k],encapsulation:2,changeDetection:0})}}return e})();function le(e,o){e&1&&(r(0,"div",1)(1,"div",2),d(2,"ps-skeleton",3)(3,"ps-skeleton",4),a(),d(4,"ps-skeleton",5),r(5,"div",2),d(6,"ps-skeleton",6)(7,"ps-skeleton",7),a(),d(8,"ps-skeleton",8),a())}var re=(()=>{class e{constructor(){this.rowIndexes=[1,2,3]}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=b({type:e,selectors:[["app-field-mapping-list-skeleton"]],decls:3,vars:0,consts:[[1,"flex","flex-col","gap-4"],[1,"p-4","bg-white","rounded-2xl","border","border-border-default","flex","items-center","gap-6"],[1,"flex-1","flex","items-center","gap-2"],["baseColor","surface-selected","height","1rem","width","6rem","borderRadius","0.25rem"],["baseColor","surface-selected","height","0.875rem","width","10rem","borderRadius","0.25rem"],["baseColor","surface-selected","height","1.25rem","width","1.25rem","borderRadius","0.25rem"],["baseColor","surface-selected","height","1rem","width","8rem","borderRadius","0.25rem"],["baseColor","surface-selected","height","0.875rem","width","6rem","borderRadius","0.25rem"],["baseColor","surface-selected","height","1.5rem","
1width","5rem","borderRadius","0.25rem"]],template:function(i,n){i&1&&(r(0,"div",0),v(1,le,9,0,"div",1,R),a()),i&2&&(l(),w(n.rowIndexes))},dependencies:[z],encapsulation:2,changeDetection:0})}}return e})();function se(e){let o=new Set(Object.values(y)),t=[];for(let i of e)if(o.has(i.entity))for(let n of i.fields??[]){let s=pe(i,n);s&&t.push(s)}return t}function pe(e,o){let t=ie(o);if(!t)return null;let i=de(t);return{settingId:e.id,fieldId:o.id,sourceLabel:i.label,sourceDetail:i.detail,searchText:[...i.searchTerms,o.displayName,o.name].join(" ").toLowerCase(),destinationDisplayName:o.displayName,destinationInternalName:o.name,entity:e.entity}}function de(e){return te(e)?me(e):ce(e)}function me(e){let o=Z(e.path);return{label:X(L(e.path)),detail:o.length>1?W(o):"",searchTerms:[e.path]}}function ce(e){return{label:L(e.desiredField),detail:ee(e),searchTerms:[e.arrayPath,e.desiredField,e.comparisonProperty,e.comparisonValue]}}var ue=(e,o)=>o.fieldId;function fe(e,o){e&1&&d(0,"app-field-mapping-list-skeleton")}function ge(e,o){if(e&1){let t=D();d(0,"ui-info-alert",10),r(1,"ui-button",11),c("onClick",function(){I(t);let n=u();return F(n.loadSettings())}),a()}e&2&&f("isVisible",!0)}function he(e,o){e&1&&(r(0,"div",7)(1,"ui-text",12),p(2," Esta integra\xE7\xE3o ainda n\xE3o tem mapeamentos salvos. "),a()())}function _e(e,o){if(e&1&&p(0),e&2){let t=u(2);B(' Nenhum mapeamento encontrado para "',t.searchQuery(),'" em ',t.activeTabLabel(),". ")}}function xe(e,o){if(e&1&&p(0),e&2){let t=u(2);g(' Nenhum mapeamento encontrado para "',t.searchQuery(),'". ')}}function be(e,o){if(e&1&&p(0),e&2){let t=u(2);g(" Nenhum mapeamento de ",t.activeTabLabel()," nesta integra\xE7\xE3o. ")}}function ye(e,o){if(e&1&&(r(0,"div",8)(1,"ui-text",13),C(2,_e,1,2)(3,xe,1,1)(4,be,1,1),a()()),e&2){let t=u();l(2),T(t.searchQuery()&&t.activeTab()!=="ALL"?2:t.searchQuery()?3:4)}}function Ce(e,o){if(e&1&&(r(0,"ui-text",17),p(1),a()),e&2){let t=u().$implicit;l(),g(" ",t.sourceDetail," ")}}function Te(e,o){if(e&1&&(r(0,"div",14)(1,"div",15)(2,"ui-text",16),p(3),a(),C(4,Ce,2,1,"ui-text",17),a(),d(5,"ps-icon",18),r(6,"div",15)(7,"ui-text",16),p(8),a(),r(9,"ui-text",17),p(10),a()(),r(11,"div",19),d(12,"ps-icon",20),r(13,"ui-text",21),p(14),a()()()),e&2){let t=o.$implicit,i=u(2);l(3),g(" ",t.sourceLabel," "),l(),T(t.sourceDetail?4:-1),l(4),g(" ",t.destinationDisplayName," "),l(2),g(" ",i.getInternalTag(t.destinationInternalName)," "),l(2),f("icon",i.ENTITY_ICONS[t.entity]),l(2),g(" ",i.ENTITY_LABELS[t.entity]," ")}}function ve(e,o){if(e&1&&(r(0,"div",9),v(1,Te,15,6,"div",14,ue),a()),e&2){let t=u();l(),w(t.filteredRows())}}var rt=(()=>{class e{constructor(){this.route=x(O),this.router=x(U),this.location=x(A),this.fieldMapperService=x(ne),this.modal=x(H),this.destroyRef=x(N),this.integrationType=m("erp"),this.providerKey=m(""),this.integrationId=m(""),this.allSettings=m([]),this.loading=m(!1),this.error=m(!1),this.tabs=[{label:"Todos",id:"ALL"},{label:"Pedido",id:y.ORDER},{label:"Produto",id:y.PRODUCT},{label:"Cliente",id:y.CUSTOMER}],this.selectedTabIndex=m(0),this.activeTab=h(()=>this.tabs[this.selectedTabIndex()].id),this.searchQuery=m(""),this.settingsForIntegration=h(()=>{let t=this.allSettings(),i=this.integrationType(),n=this.integrationId();return t.filter(s=>i==="ecommerce"?s.keyId===n:s.erpKeyId===n)}),this.unfilteredRows=h(()=>se(this.settingsForIntegration())),this.filteredRows=h(()=>{let t=this.activeTab(),i=this.unfilteredRows(),n=t==="ALL"?i:i.filter(_=>_.entity===t),s=this.searchQuery().trim().toLowerCase();return s?n.filter(_=>_.searchText.includes(s)):n}),this.hasNoMappings=h(()=>this.unfilteredRows().length===0),this.activeTabLabel=h(()=>this.tabs[this.selectedTabIndex()].label),this.isEmpty=h(()=>!this.loading()&&!this.error()&&this.filteredRows().length===0),this.ENTITY_ICONS=q,this.ENTITY_LABELS=$}ngOnInit(){this.route.paramMap.pipe(Q(this.destroyRef)).subscribe(t=>{let i=t.get("type")??"erp",n=t.get("provider")??"",s=t.get("integrationId")??"";this.integrationType.set(i),this.providerKey.set(n),this.integrationId.set(s),this.loadSettings()})}loadSettings(){return M(this,null,function*(){this.loading.set(!0),this.error.set(!1);
1try{let t=yield this.fieldMapperService.findAll();this.allSettings.set(t)}catch(t){console.error("FieldMappingListPage: findAll failed",t),this.allSettings.set([]),this.error.set(!0)}finally{this.loading.set(!1)}})}onBack(){if(window.history.length>1){this.location.back();return}this.router.navigate([V.routes.integrations,this.integrationType(),this.providerKey(),"details",this.integrationId()])}onTabChange(t){this.selectedTabIndex.set(t),this.searchQuery.set("")}onSearchChange(t){this.searchQuery.set(t)}getInternalTag(t){return`{{${t}}}`}onEditClick(){let t=this.activeTab();if(t==="ALL"){let i={mode:"edit",onSelect:n=>this.navigateToEdit(n)};this.modal.open({component:J,data:i});return}this.navigateToEdit(t)}navigateToEdit(t){this.router.navigate(["/dashboard/field-mapping",this.integrationType(),this.providerKey(),this.integrationId()],{queryParams:{entity:t}})}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=b({type:e,selectors:[["app-field-mapping-list"]],hostAttrs:[1,"flex","flex-col","flex-1","min-h-0","overflow-y-auto"],decls:12,vars:11,consts:[[1,"flex","flex-col","min-h-full","gap-6","px-4","pt-4","md:px-16","md:pt-8"],[3,"back"],[1,"flex","flex-col","gap-6"],[3,"onTabChange","items","selected","borderBottom","showNumber"],[1,"flex","flex-col","md:flex-row","md:justify-between","md:items-center","gap-4"],["placeholder","Buscar","searchStyle","border",1,"w-full","md:w-96",3,"onChanged","text","debounce","disabled"],["type","primary","size","medium","text","Editar mapeamento","icon","icon-edit_square",3,"onClick","iconBefore","wide","disabled"],[1,"py-20","flex","flex-col","items-center","gap-4"],[1,"py-8","flex","flex-col","items-center"],[1,"flex","flex-col","gap-4"],["type","error","icon","error","title","N\xE3o foi poss\xEDvel carregar os mapeamentos.","description","Tente novamente em instantes.",3,"isVisible"],["type","unfocus","size","medium","text","Tentar novamente",3,"onClick"],["htmlTag","p","type","body-large","className","text-neutral text-center"],["htmlTag","p","type","body","className","text-neutral text-center"],[1,"p-4","bg-white","rounded-2xl","border","border-border-default","flex","flex-col","md:flex-row","md:items-center","gap-4","md:gap-6"],[1,"flex-1","min-w-0","flex","flex-col","md:flex-row","md:items-start","gap-1","md:gap-2"],["htmlTag","span","type","body-highlight","className","text-default break-words"],["htmlTag","span","type","body","className","text-neutral break-words"],["icon","icon-arrow_forward",1,"text-xl","text-primary","self-center","rotate-90","md:rotate-0"],[1,"px-2","py-0.5","bg-surface-primary","rounded","flex","items-center","gap-1","self-start","md:self-auto","shrink-0"],[1,"text-base","text-primary",3,"icon"],["htmlTag","span","type","body","className","text-primary font-medium"]],template:function(i,n){i&1&&(r(0,"div",0)(1,"app-field-mapping-list-header",1),c("back",function(){return n.onBack()}),a(),r(2,"div",2)(3,"ui-tab",3),c("onTabChange",function(_){return n.onTabChange(_)}),a(),r(4,"div",4)(5,"ps-search-bar",5),c("onChanged",function(_){return n.onSearchChange(_)}),a(),r(6,"ui-button",6),c("onClick",function(){return n.onEditClick()}),a()(),C(7,fe,1,0,"app-field-mapping-list-skeleton")(8,ge,2,1)(9,he,3,0,"div",7)(10,ye,5,1,"div",8)(11,ve,3,0,"div",9),a()()),i&2&&(l(3),f("items",n.tabs)("selected",n.selectedTabIndex())("borderBottom",!0)("showNumber",!1),l(2),f("text",n.searchQuery())("debounce",0)("disabled",n.loading()||n.error()),l(),f("iconBefore",!0)("wide",!1)("disabled",n.hasNoMappings()),l(),T(n.loading()?7:n.error()?8:n.hasNoMappings()?9:n.isEmpty()?10:11))},dependencies:[ae,re,G,j,S,E,k,Y],encapsulation:2,changeDetection:0})}}return e})();export{rt as FieldMappingListPageComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.