import{o as e}from"./chunk-jRWAZmH_.js";import{n as t}from"./jsx-runtime-CEixWuwE.js";import{In as n,Ln as r,br as i,fr as a,gr as o,hr as s,jt as c}from"./axios-v6FV69Ne.js";import{i as l}from"./ctiAxios-BIVP6fGU.js";import{O as u}from"./index-BqyXv5bE.js";var d=e(t());r();var f={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM575.34 477.84l-61.22 102.3L452.3 477.8a12 12 0 00-10.27-5.79h-38.44a12 12 0 00-6.4 1.85 12 12 0 00-3.75 16.56l82.34 130.42-83.45 132.78a12 12 0 00-1.84 6.39 12 12 0 0012 12h34.46a12 12 0 0010.21-5.7l62.7-101.47 62.3 101.45a12 12 0 0010.23 5.72h37.48a12 12 0 006.48-1.9 12 12 0 003.62-16.58l-83.83-130.55 85.3-132.47a12 12 0 001.9-6.5 12 12 0 00-12-12h-35.7a12 12 0 00-10.29 5.84z`}}]},name:`file-excel`,theme:`filled`},p=d.forwardRef(function(e,t){return d.createElement(c,n(n({},e),{},{ref:t,icon:f}))}),m=e(u());function h(e){let t=e.getElementsByTagName(`HTTP_SERVICE`)[0];return{schema:o(t).schema,tables:n(t),refTables:r(t)};function n(e){let t={};return s(e,`TABLE`).forEach((e,n)=>{let r=o(e),s=a(e);i(s)||(r.listes=s);let l=c(e);i(l)||(r.groups=l),t[`${r.table_id}-${n}`]=r}),t}function r(e){let t={};return s(e,`REFTABLE`).forEach(e=>{let n=o(e),r=a(e);i(r)||(n.listes=r);let s=c(e);i(s)||(n.groups=s),t[(0,m.default)(n.table_id)]=n}),t}function a(e){let t={};return s(e,`LISTE`).forEach(e=>{let n=o(e);t[(0,m.default)(n.liste_id)]=n}),t}function c(e){let t={};return s(e,`GROUP`).forEach(e=>{let n=o(e),r=c(e);i(r)||(n.groups=r);let s=a(e);i(s)||(n.listes=s),t[(0,m.default)(n.texte)]=n}),t}}function g(e){let t=e.getElementsByTagName(`HTTP_SERVICE`)[0],n=s(t,`LISTE`)[0],r=o(n),i=s(n,`COLUMN`);if(i){let e={};i.forEach(t=>{let n=o(t);e[n.name]=n}),r.columns=e}let a=s(n,`RECORD`);if(a){let e={};a.forEach(t=>{let n=o(t);e[n.oid]=n}),r.records=e}let c=s(n,`OID`);if(c){let e={};c.forEach(t=>{let n=o(t);e[n.code.replace(/\s/gm,``)]=n}),r.oids=e}return r}var _=async e=>h(await l(`modules/base/php/getListes.php`,{softCode:e})),v=async(e,t,n)=>g(await l(`modules/base/php/getListe.php`,{table_id:t,liste_id:n,schema:e})),y=`modules/base/php/setListe.php`;async function b(e){await l(y,e)}async function x(e,t,n,r){await l(y,{action:`refcopy`,softCode:t,refoid:e,schema:n,database:r})}async function S(e){let t=a()+`modules/base/php/getListeSaisieCode.php`,n=new FormData;for(let t in e)n.append(t,e[t]);return(await fetch(t,{method:`POST`,credentials:`include`,cache:`no-cache`,body:n})).json()}var C=/\w*\*?/gm;function w(e,t,n){let r=t.match(C),i=e.filter(e=>r.includes(e.code)?!0:r.length!==1&&r[0]!==``?r.some(t=>t!==``&&t.slice(-1)===`*`?e.code.startsWith(t.slice(0,-1)):!1):!0);if(n){let e=n.match(C);i=i.filter(t=>e.includes(t.code)?!1:e.length!==1&&e[0]!==``?e.some(e=>e!==``&&e.slice(-1)===`*`?!t.code.startsWith(e.slice(0,-1)):!0):!0)}return i}export{S as a,_ as i,x as n,b as o,v as r,p as s,w as t};