import{r as o,P as Ae,O as b,D as L,Z as Ge,I as re,c as W,b as he,F as gt,l as Oe,U as Zn,d as Yn,S as Qn,j as E,a as er,J as tr}from"./app-BZJf8lgN.js";import{F as nr}from"./fileupload.esm-CWt4e-Qk.js";import{I as Nt}from"./inputtext.esm-B1lZn37a.js";import{V as rr,S as lr,D as ar}from"./dropdown.esm-HqLoOpxI.js";import{C as qe,u as ze,S as ir,T as Dt,P as or,R as Rt,B as ht}from"./button.esm-D_cwsnQR.js";import{u as de,a as cr,b as sr,c as Tt,d as At,e as ur}from"./hooks.esm-UVLztt_0.js";import{C as dr,O as fr}from"./overlayservice.esm-B-BnP5c1.js";import{T as Mt}from"./index.esm-hRnQzR_k.js";import{T as mr}from"./index.esm-B5zYYMSp.js";import{C as pr}from"./csstransition.esm-BNRxTMOa.js";import{C as We}from"./index.esm-CygY3Qsw.js";import{L as vr}from"./layout-DZ5xjWdd.js";import{I as Ot}from"./InputLabel-Dd3VnoK3.js";import{M as br}from"./message.esm-Do6SkgWF.js";import{I as xt}from"./image.esm-DhzuK4QZ.js";import{T as yr}from"./toast.esm-CYGIlaDH.js";import{C as gr}from"./CustomCKEditor-BpmNiC9B.js";import"./index.esm-Ckth6fI3.js";import"./CSSTransition-DBuKQJwM.js";function M(){return M=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var r=arguments[l];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},M.apply(null,arguments)}function xe(e){"@babel/helpers - typeof";return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},xe(e)}function hr(e,l){if(xe(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,l);if(xe(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(e)}function Or(e){var l=hr(e,"string");return xe(l)=="symbol"?l:l+""}function fe(e,l,r){return(l=Or(l))in e?Object.defineProperty(e,l,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[l]=r,e}function Xe(e,l){(l==null||l>e.length)&&(l=e.length);for(var r=0,i=Array(l);r<l;r++)i[r]=e[r];return i}function xr(e){if(Array.isArray(e))return Xe(e)}function Sr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kt(e,l){if(e){if(typeof e=="string")return Xe(e,l);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xe(e,l):void 0}}function Ir(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Er(e){return xr(e)||Sr(e)||Kt(e)||Ir()}function kr(e){throw new TypeError('"'+e+'" is read-only')}function wr(e){if(Array.isArray(e))return e}function Pr(e,l){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,t,S,y,d=[],h=!0,w=!1;try{if(S=(r=r.call(e)).next,l===0){if(Object(r)!==r)return;h=!1}else for(;!(h=(i=S.call(r)).done)&&(d.push(i.value),d.length!==l);h=!0);}catch(O){w=!0,t=O}finally{try{if(!h&&r.return!=null&&(y=r.return(),Object(y)!==y))return}finally{if(w)throw t}}return d}}function Cr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e,l){return wr(e)||Pr(e,l)||Kt(e,l)||Cr()}var Fr={root:function(l){var r,i=l.props,t=l.context,S=l.focusedState,y=l.overlayVisibleState;return W("p-multiselect p-component p-inputwrapper",{"p-multiselect-chip":i.display==="chip"&&(i.maxSelectedLabels==null?!0:((r=i.value)===null||r===void 0?void 0:r.length)<=i.maxSelectedLabels),"p-disabled":i.disabled,"p-invalid":i.invalid,"p-variant-filled":i.variant?i.variant==="filled":t&&t.inputStyle==="filled","p-multiselect-clearable":i.showClear&&!i.disabled,"p-focus":S,"p-inputwrapper-filled":b.isNotEmpty(i.value),"p-inputwrapper-focus":S||y})},label:function(l){var r,i=l.props,t=l.empty;return W("p-multiselect-label",{"p-placeholder":t&&i.placeholder,"p-multiselect-label-empty":t&&!i.placeholder&&!i.selectedItemTemplate,"p-multiselect-items-label":!t&&i.display!=="chip"&&((r=i.value)===null||r===void 0?void 0:r.length)>i.maxSelectedLabels})},panel:function(l){var r=l.panelProps,i=l.context,t=l.allowOptionSelect;return W("p-multiselect-panel p-component",{"p-multiselect-inline":r.inline,"p-multiselect-flex":r.flex,"p-multiselect-limited":!t,"p-input-filled":i&&i.inputStyle==="filled"||he.inputStyle==="filled","p-ripple-disabled":i&&i.ripple===!1||he.ripple===!1})},list:function(l){var r=l.virtualScrollerOptions;return"p-multiselect-items p-component"},labelContainer:"p-multiselect-label-container",triggerIcon:"p-multiselect-trigger-icon p-c",trigger:"p-multiselect-trigger",clearIcon:"p-multiselect-clear-icon",tokenLabel:"p-multiselect-token-label",token:"p-multiselect-token",removeTokenIcon:"p-multiselect-token-icon",wrapper:"p-multiselect-items-wrapper",emptyMessage:"p-multiselect-empty-message",itemGroup:"p-multiselect-item-group",closeButton:"p-multiselect-close p-link",header:"p-multiselect-header",closeIcon:"p-multiselect-close-icon",headerCheckboxContainer:"p-multiselect-select-all",headerCheckboxIcon:"p-multiselect-select-all p-checkbox-icon p-c",headerSelectAllLabel:"p-multiselect-select-all-label",filterContainer:"p-multiselect-filter-container",filterIcon:"p-multiselect-filter-icon",item:function(l){var r=l.itemProps;return W("p-multiselect-item",{"p-highlight":r.selected,"p-disabled":r.disabled,"p-focus":r.focusedOptionIndex===r.index})},checkboxContainer:"p-multiselect-checkbox",checkboxIcon:"p-checkbox-icon p-c",transition:"p-connected-overlay"},jr=`
@layer primereact {
    .p-multiselect {
        display: inline-flex;
        user-select: none;
        cursor: pointer;
    }
    
    .p-multiselect-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        cursor: pointer;
    }
    
    .p-multiselect-label-container {
        overflow: hidden;
        flex: 1 1 auto;
        cursor: pointer;
    }
    
    .p-multiselect-label  {
        display: block;
        white-space: nowrap;
        cursor: pointer;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .p-multiselect-label-empty {
        overflow: hidden;
        visibility: hidden;
    }
    
    .p-multiselect-token {
        cursor: default;
        display: inline-flex;
        align-items: center;
        flex: 0 0 auto;
    }
    
    .p-multiselect-token-icon {
        cursor: pointer;
    }
    
    .p-multiselect .p-multiselect-panel {
        min-width: 100%;
    }
    
    .p-multiselect-inline.p-multiselect-panel {
        border: none;
        position: initial;
        background: none;
        box-shadow: none;
    }
    
    .p-multiselect-inline.p-multiselect-panel .p-multiselect-items {
        padding: 0;
    }
    
    .p-multiselect-flex.p-multiselect-panel .p-multiselect-items {
        display: flex;
        flex-wrap: wrap;
    }
    
    .p-multiselect-items-wrapper {
        overflow: auto;
    }
    
    .p-multiselect-items {
        margin: 0;
        padding: 0;
        list-style-type: none;
    }
    
    .p-multiselect-item {
        cursor: pointer;
        display: flex;
        align-items: center;
        font-weight: normal;
        white-space: nowrap;
        position: relative;
        overflow: hidden;
        outline: none;
    }
    
    .p-multiselect-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .p-multiselect-select-all-label {
        margin-left: 0.5rem;
    }
    
    .p-multiselect-filter-container {
        position: relative;
        flex: 1 1 auto;
    }
    
    .p-multiselect-filter-icon {
        position: absolute;
        top: 50%;
        margin-top: -.5rem;
    }
    
    .p-multiselect-filter-container .p-inputtext {
        width: 100%;
    }
    
    .p-multiselect-close {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        overflow: hidden;
        position: relative;
        margin-left: auto;
    }
    
    .p-multiselect-clear-icon {
        position: absolute;
        top: 50%;
        margin-top: -.5rem;
        right: 3rem;
    }
    
    .p-fluid .p-multiselect {
        display: flex;
    }
}
`,Lr={root:function(l){var r=l.props;return r.showClear&&!r.disabled&&{position:"relative"}},itemGroup:function(l){var r=l.scrollerOptions;return{height:r.props?r.props.itemSize:void 0}}},ge=qe.extend({defaultProps:{__TYPE:"MultiSelect",appendTo:null,ariaLabelledBy:null,checkboxIcon:null,className:null,clearIcon:null,closeIcon:null,dataKey:null,disabled:!1,display:"comma",dropdownIcon:null,emptyFilterMessage:null,emptyMessage:null,filter:!1,filterBy:null,filterDelay:300,filterInputAutoFocus:!0,filterLocale:void 0,selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,fixedPlaceholder:!1,flex:!1,id:null,inline:!1,inputId:null,inputRef:null,invalid:!1,variant:null,itemCheckboxIcon:null,itemClassName:null,itemTemplate:null,loading:!1,loadingIcon:null,maxSelectedLabels:null,name:null,onBlur:null,onChange:null,onClick:null,onFilter:null,onFocus:null,onHide:null,onRemove:null,onSelectAll:null,onShow:null,optionDisabled:null,optionGroupChildren:null,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,overlayVisible:!1,panelClassName:null,panelFooterTemplate:null,panelHeaderTemplate:null,panelStyle:null,placeholder:null,removeIcon:null,resetFilterOnHide:!1,scrollHeight:"200px",selectAll:!1,selectAllLabel:null,selectedItemTemplate:null,selectedItemsLabel:void 0,selectionLimit:null,showClear:!1,showSelectAll:!0,style:null,tabIndex:0,tooltip:null,tooltipOptions:null,transitionOptions:null,useOptionAsValue:!1,value:null,virtualScrollerOptions:null,children:void 0},css:{classes:Fr,styles:jr,inlineStyles:Lr}}),Nr={box:"p-checkbox-box",input:"p-checkbox-input",icon:"p-checkbox-icon",root:function(l){var r=l.props,i=l.checked,t=l.context;return W("p-checkbox p-component",{"p-highlight":i,"p-disabled":r.disabled,"p-invalid":r.invalid,"p-variant-filled":r.variant?r.variant==="filled":t&&t.inputStyle==="filled"})}},De=qe.extend({defaultProps:{__TYPE:"Checkbox",autoFocus:!1,checked:!1,className:null,disabled:!1,falseValue:!1,icon:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,name:null,onChange:null,onContextMenu:null,onMouseDown:null,readOnly:!1,required:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,trueValue:!0,value:null,children:void 0},css:{classes:Nr}});function St(e,l){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);l&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function It(e){for(var l=1;l<arguments.length;l++){var r=arguments[l]!=null?arguments[l]:{};l%2?St(Object(r),!0).forEach(function(i){fe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var Ze=o.memo(o.forwardRef(function(e,l){var r=de(),i=o.useContext(Ae),t=De.getProps(e,i),S=o.useState(!1),y=ne(S,2),d=y[0],h=y[1],w=De.setMetaData({props:t,state:{focused:d},context:{checked:t.checked===t.trueValue,disabled:t.disabled}}),O=w.ptm,N=w.cx,$=w.isUnstyled;ze(De.css.styles,$,{name:"checkbox"});var B=o.useRef(null),j=o.useRef(t.inputRef),X=function(){return t.checked===t.trueValue},V=function(f){if(!(t.disabled||t.readOnly)&&t.onChange){var p,v=X(),P=v?t.falseValue:t.trueValue,A={originalEvent:f,value:t.value,checked:P,stopPropagation:function(){f==null||f.stopPropagation()},preventDefault:function(){f==null||f.preventDefault()},target:{type:"checkbox",name:t.name,id:t.id,value:t.value,checked:P}};if(t==null||(p=t.onChange)===null||p===void 0||p.call(t,A),f.defaultPrevented)return;L.focus(j.current)}},Z=function(f){var p;h(!0),t==null||(p=t.onFocus)===null||p===void 0||p.call(t,f)},H=function(f){var p;h(!1),t==null||(p=t.onBlur)===null||p===void 0||p.call(t,f)};o.useImperativeHandle(l,function(){return{props:t,focus:function(){return L.focus(j.current)},getElement:function(){return B.current},getInput:function(){return j.current}}}),o.useEffect(function(){b.combinedRefs(j,t.inputRef)},[j,t.inputRef]),At(function(){j.current.checked=X()},[t.checked,t.trueValue]),Tt(function(){t.autoFocus&&L.focus(j.current,t.autoFocus)});var T=X(),K=b.isNotEmpty(t.tooltip),R=De.getOtherProps(t),u=r({id:t.id,className:W(t.className,N("root",{checked:T,context:i})),style:t.style,"data-p-highlight":T,"data-p-disabled":t.disabled,onContextMenu:t.onContextMenu,onMouseDown:t.onMouseDown},R,O("root")),k=function(){var f=b.reduceKeys(R,L.ARIA_PROPS),p=r(It({id:t.inputId,type:"checkbox",className:N("input"),name:t.name,tabIndex:t.tabIndex,onFocus:function(P){return Z(P)},onBlur:function(P){return H(P)},onChange:function(P){return V(P)},disabled:t.disabled,readOnly:t.readOnly,required:t.required,"aria-invalid":t.invalid,checked:T},f),O("input"));return o.createElement("input",M({ref:j},p))},x=function(){var f=r({className:N("icon")},O("icon")),p=r({className:N("box",{checked:T}),"data-p-highlight":T,"data-p-disabled":t.disabled},O("box")),v=T?t.icon||o.createElement(We,f):null,P=re.getJSXIcon(v,It({},f),{props:t,checked:T});return o.createElement("div",p,P)};return o.createElement(o.Fragment,null,o.createElement("div",M({ref:B},u),k(),x()),K&&o.createElement(Dt,M({target:B,content:t.tooltip,pt:O("tooltip")},t.tooltipOptions)))}));Ze.displayName="Checkbox";function Et(e,l){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);l&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Re(e){for(var l=1;l<arguments.length;l++){var r=arguments[l]!=null?arguments[l]:{};l%2?Et(Object(r),!0).forEach(function(i){fe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Et(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var Vt=o.memo(function(e){var l=de(),r=e.ptm,i=e.cx,t=e.isUnstyled,S={filter:function(p){return d(p)},reset:function(){return e.resetFilter()}},y=function(p,v){return r(p,Re({hostName:e.hostName},v))},d=function(p){e.onFilter&&e.onFilter({originalEvent:p,query:p.target.value})},h=function(p){if(e.onSelectAll)e.onSelectAll({originalEvent:p,checked:e.selectAll});else{var v=e.isAllSelected()?[]:e.visibleOptions.filter(function(P){return e.isValidOption(P)}).map(function(P){return e.getOptionValue(P)});e.updateModel(p,v,v)}},w=function(){var p=l({className:i("filterIcon")},y("filterIcon")),v=e.filterIcon||o.createElement(lr,p),P=re.getJSXIcon(v,Re({},p),{props:e});if(e.filter){var A=l({className:i("filterContainer")},y("filterContainer")),C=o.createElement("div",A,o.createElement(Nt,{ref:e.filterRef,type:"text",role:"searchbox",value:e.filterValue,onChange:d,className:"p-multiselect-filter",placeholder:e.filterPlaceholder,pt:r("filterInput"),unstyled:e.unstyled,__parentMetadata:{parent:e.metaData}}),P);if(e.filterTemplate){var U={className:A.className,element:C,filterOptions:S,onFilter:d,filterIconClassName:e.filterIconClassName,props:e};C=b.getJSXElement(e.filterTemplate,U)}return o.createElement(o.Fragment,null,C)}return null},O=w(),N=e.id?e.id+"_selectall":Zn(),$=l({htmlFor:N,className:i("headerSelectAllLabel")},y("headerSelectAllLabel")),B=l({className:i("headerCheckboxIcon")},y("headerCheckbox.icon")),j=l({className:i("headerCheckboxContainer")},y("headerCheckboxContainer")),X=e.itemCheckboxIcon||o.createElement(We,B),V=re.getJSXIcon(X,Re({},B),{selected:e.selected}),Z=e.showSelectAll&&o.createElement("div",j,o.createElement(Ze,{id:N,checked:e.selectAll,onChange:h,role:"checkbox","aria-checked":e.selectAll,icon:V,pt:r("headerCheckbox"),unstyled:t()}),!e.filter&&o.createElement("label",$,e.selectAllLabel)),H=l({className:i("closeIcon"),"aria-hidden":!0},y("closeIcon")),T=e.closeIcon||o.createElement(Mt,H),K=re.getJSXIcon(T,Re({},H),{props:e}),R=l({className:i("header")},y("header")),u=l({type:"button",className:i("closeButton"),"aria-label":Yn("close"),onClick:e.onClose},y("closeButton")),k=o.createElement("button",u,K,o.createElement(Rt,null)),x=o.createElement("div",R,Z,O,k);if(e.template){var I={className:"p-multiselect-header",checkboxElement:Z,checked:e.selectAll,onChange:h,filterElement:O,closeElement:k,closeElementClassName:"p-multiselect-close p-link",closeIconClassName:"p-multiselect-close-icon",onCloseClick:e.onClose,element:x,itemCheckboxIcon:V,props:e};return b.getJSXElement(e.template,I)}return x});Vt.displayName="MultiSelectHeader";function kt(e,l){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);l&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Dr(e){for(var l=1;l<arguments.length;l++){var r=arguments[l]!=null?arguments[l]:{};l%2?kt(Object(r),!0).forEach(function(i){fe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var Ht=o.memo(function(e){var l=o.useState(!1),r=ne(l,2),i=r[0],t=r[1],S=o.useRef(null),y=de(),d=e.ptm,h=e.cx,w=e.isUnstyled,O=function(R){return d(R,{hostName:e.hostName,context:{selected:e.selected,disabled:e.disabled,focused:i,focusedIndex:e.focusedIndex,index:e.index}})},N=function(R){var u;t(!0),S==null||(u=S.current)===null||u===void 0||u.getInput().focus()},$=function(R){t(!1)},B=function(R){e.onClick&&e.onClick(R,e.option),R.preventDefault(),R.stopPropagation()},j=y({className:h("checkboxIcon")},O("checkbox.icon")),X=e.checkboxIcon||o.createElement(We,j),V=e.selected?re.getJSXIcon(X,Dr({},j),{selected:e.selected}):null,Z=e.template?b.getJSXElement(e.template,e.option):e.label,H=y({className:h("checkboxContainer")},O("checkboxContainer")),T=y({className:W(e.className,e.option.className,h("item",{itemProps:e})),style:e.style,onClick:B,onFocus:N,onBlur:$,onMouseMove:function(R){return e==null?void 0:e.onMouseMove(R,e.index)},role:"option","aria-selected":e.selected,"data-p-highlight":e.selected,"data-p-disabled":e.disabled},O("item"));return o.createElement("li",M({},T,{key:e.index+"_multiselectitem"}),o.createElement("div",H,o.createElement(Ze,{ref:S,checked:e.selected,icon:V,pt:d("checkbox"),unstyled:w(),tabIndex:-1})),o.createElement("span",null,Z),o.createElement(Rt,null))});Ht.displayName="MultiSelectItem";function wt(e,l){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);l&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function se(e){for(var l=1;l<arguments.length;l++){var r=arguments[l]!=null?arguments[l]:{};l%2?wt(Object(r),!0).forEach(function(i){fe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var _t=o.memo(o.forwardRef(function(e,l){var r=o.useRef(null),i=o.useRef(null),t=de(),S=o.useContext(Ae),y=e.ptm,d=e.cx,h=e.sx,w=e.isUnstyled,O=function(f,p){return y(f,se({hostName:e.hostName},p))},N=function(){e.onEnter(function(){if(r.current){var f=e.getSelectedOptionIndex();f!==-1&&setTimeout(function(){return r.current.scrollToIndex(f)},0)}})},$=function(){e.onEntered(function(){e.filter&&e.filterInputAutoFocus&&i.current&&L.focus(i.current,!1)})},B=function(f){r.current&&r.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(f)},j=function(){return!(e.visibleOptions&&e.visibleOptions.length)&&e.hasFilter},X=function(){return o.createElement(Vt,{hostName:e.hostName,id:e.id,filter:e.filter,filterRef:i,filterValue:e.filterValue,filterTemplate:e.filterTemplate,visibleOptions:e.visibleOptions,isValidOption:e.isValidOption,getOptionValue:e.getOptionValue,updateModel:e.updateModel,onFilter:B,filterPlaceholder:e.filterPlaceholder,onClose:e.onCloseClick,showSelectAll:e.showSelectAll,selectAll:e.isAllSelected(),selectAllLabel:e.selectAllLabel,onSelectAll:e.onSelectAll,template:e.panelHeaderTemplate,resetFilter:e.resetFilter,closeIcon:e.closeIcon,filterIcon:e.filterIcon,itemCheckboxIcon:e.itemCheckboxIcon,ptm:y,cx:d,isUnstyled:w,metaData:e.metaData})},V=function(){if(e.panelFooterTemplate){var f=b.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide);return o.createElement("div",{className:"p-multiselect-footer"},f)}return null},Z=function(f,p){if(e.focusOnHover){var v;e==null||(v=e.changeFocusedOptionIndex)===null||v===void 0||v.call(e,f,p)}},H=function(){var f=b.getJSXElement(e.emptyFilterMessage,e)||Oe("emptyFilterMessage"),p=t({className:d("emptyMessage")},O("emptyMessage"));return o.createElement("li",M({},p,{key:"emptyFilterMessage"}),f)},T=function(){var f=b.getJSXElement(e.emptyMessage,e)||Oe("emptyMessage"),p=t({className:d("emptyMessage")},O("emptyMessage"));return o.createElement("li",M({},p,{key:"emptyMessage"}),f)},K=function(f,p){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P={height:v.props?v.props.itemSize:void 0},A=f.group===!0&&e.optionGroupLabel;if(A){var C=e.optionGroupTemplate?b.getJSXElement(e.optionGroupTemplate,f,p):e.getOptionGroupLabel(f),U=p+"_"+e.getOptionGroupRenderKey(f),le=t({className:d("itemGroup"),style:h("itemGroup",{scrollerOptions:v})},O("itemGroup"));return o.createElement("li",M({key:U},le),C)}var Ie=e.getOptionLabel(f),G=p+"_"+e.getOptionRenderKey(f),Ee=e.isOptionDisabled(f),_=e.isSelected(f);return o.createElement(Ht,{hostName:e.hostName,key:G,focusedOptionIndex:e.focusedOptionIndex,label:Ie,option:f,style:P,index:p,template:e.itemTemplate,selected:_,onClick:e.onOptionSelect,onMouseMove:Z,disabled:Ee,className:e.itemClassName,checkboxIcon:e.checkboxIcon,isUnstyled:w,ptm:y,cx:d})},R=function(){return b.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(K):e.hasFilter?H():T()},u=function(){if(e.virtualScrollerOptions){var f=se(se({},e.virtualScrollerOptions),{style:se(se({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:W("p-multiselect-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(C){return e.virtualScrollerOptions.onLazyLoad(se(se({},C),{filter:e.filterValue}))},itemTemplate:function(C,U){return C&&K(C,U.index,U)},contentTemplate:function(C){var U=j()?H():C.children,le=t({ref:C.contentRef,style:C.style,className:W(C.className,d("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox","aria-multiselectable":!0},O("list"));return o.createElement("ul",le,U)}});return o.createElement(rr,M({ref:r},f,{pt:y("virtualScroller"),__parentMetadata:{parent:e.metaData}}))}var p=R(),v=t({className:d("wrapper"),style:{maxHeight:e.scrollHeight}},O("wrapper")),P=t({className:d("list"),role:"listbox","aria-multiselectable":!0},O("list"));return o.createElement("div",v,o.createElement("ul",P,p))},k=function(){var f=e.allowOptionSelect(),p=X(),v=u(),P=V(),A=t({className:W(e.panelClassName,d("panel",{panelProps:e,context:S,allowOptionSelect:f})),style:e.panelStyle,onClick:e.onClick},O("panel"));if(e.inline)return o.createElement("div",M({ref:l},A),v,P);var C=t({classNames:d("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,appear:!0,unmountOnExit:!0,onEnter:N,onEntered:$,onExit:e.onExit,onExited:e.onExited},O("transition")),U=t({ref:e.firstHiddenFocusableElementOnOverlay,role:"presentation",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:e.onFirstHiddenFocus,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},y("hiddenFirstFocusableEl")),le=t({ref:e.lastHiddenFocusableElementOnOverlay,role:"presentation",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:e.onLastHiddenFocus,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},y("hiddenLastFocusableEl"));return o.createElement(pr,M({nodeRef:l},C),o.createElement("div",M({ref:l},A),o.createElement("span",U),p,v,P,o.createElement("span",le)))},x=k();return e.inline?x:o.createElement(or,{element:x,appendTo:e.appendTo})}));_t.displayName="MultiSelectPanel";function Pt(e,l){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);l&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function z(e){for(var l=1;l<arguments.length;l++){var r=arguments[l]!=null?arguments[l]:{};l%2?Pt(Object(r),!0).forEach(function(i){fe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Ct(e,l){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Rr(e))||l){r&&(e=r);var i=0,t=function(){};return{s:t,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(w){throw w},f:t}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var S,y=!0,d=!1;return{s:function(){r=r.call(e)},n:function(){var w=r.next();return y=w.done,w},e:function(w){d=!0,S=w},f:function(){try{y||r.return==null||r.return()}finally{if(d)throw S}}}}function Rr(e,l){if(e){if(typeof e=="string")return Ft(e,l);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ft(e,l):void 0}}function Ft(e,l){(l==null||l>e.length)&&(l=e.length);for(var r=0,i=Array(l);r<l;r++)i[r]=e[r];return i}var $t=o.memo(o.forwardRef(function(e,l){var r=de(),i=o.useContext(Ae),t=ge.getProps(e,i),S=o.useState(null),y=ne(S,2),d=y[0],h=y[1],w=o.useState(!1),O=ne(w,2),N=O[0],$=O[1],B=cr("",t.filterDelay||0),j=ne(B,3),X=j[0],V=j[1],Z=j[2],H=o.useState(-1),T=ne(H,2),K=T[0],R=T[1],u=o.useState(!1),k=ne(u,2),x=k[0],I=k[1],f=o.useState(t.inline),p=ne(f,2),v=p[0],P=p[1],A=o.useRef(null),C=o.useRef(null),U=o.useRef(null),le=o.useRef(null),Ie=o.useRef(null),G=o.useRef(t.inputRef),Ee=o.useRef(null),_=o.useRef(null),Ye=o.useRef(null),ke=V&&V.trim().length>0,me=b.isEmpty(t.value),ue=t.optionValue?null:t.dataKey,Qe={props:t,state:{filterState:V,focused:x,overlayVisible:v}},we=ge.setMetaData(Qe),J=we.ptm,ee=we.cx,et=we.sx,tt=we.isUnstyled;ze(ge.css.styles,tt,{name:"multiselect"});var Bt=sr({target:A,overlay:_,listener:function(n,a){var c=a.type,m=a.valid;m&&(c==="outside"?!ut(n)&&!fn(n)&&te():i.hideOverlaysOnDocumentScrolling?te():L.isDocument(n.target)||Ce())},when:v}),nt=ne(Bt,2),Ut=nt[0],Gt=nt[1],Xt=function(n){var a=n.relatedTarget===G.current?L.getFirstFocusableElement(_.current,':not([data-p-hidden-focusable="true"])'):G.current;L.focus(a)},Jt=function(n){var a=n.relatedTarget===G.current?L.getLastFocusableElement(_.current,':not([data-p-hidden-focusable="true"])'):G.current;L.focus(a)},qt=function(n){fr.emit("overlay-click",{originalEvent:n,target:A.current})},rt=function(){return!t.selectionLimit||!t.value||t.value&&t.value.length<t.selectionLimit},lt=function(n){var a=je()&&n<D.length-1?D.slice(n+1).findIndex(function(c){return Ve(c)}):-1;return a>-1?a+n+1:-1},at=function(n){var a=je()&&n>0?b.findLastIndex(D.slice(0,n),function(c){return Ve(c)}):-1;return a>-1?a:-1},it=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=-1;return je()&&(a?(c=at(n),c=c===-1?lt(n):c):(c=lt(n),c=c===-1?at(n):c)),c>-1?c:n},Pe=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1;if(a===-1&&(a=it(c,!0)),c===-1&&(c=it(a)),a!==-1&&c!==-1){var m=Math.min(a,c),g=Math.max(a,c),F=D.slice(m,g+1).filter(function(q){return Q(q)}).map(function(q){return Y(q)});ae(n,F,F)}},pe=function(n,a){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1;if(!(t.disabled||ye(a))){var m=ve(a),g=null;m?g=t.value.filter(function(F){return!b.equals(F,Y(a),ue)}):g=[].concat(Er(t.value||[]),[Y(a)]),ae(n,g,a),c!==-1&&h(c)}},zt=function(n){!t.inline&&!t.disabled&&!t.loading&&!mn(n)&&!ut(n)&&(v?te():ie(),L.focus(G.current),n.preventDefault()),$(!0)},ot=function(n){if(!v)ie(),t.editable&&ce(n,Le());else{var a=d!==-1?Pn(d):N?_e():He();n.shiftKey&&Pe(n,K,a),ce(n,a)}n.preventDefault()},Wt=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(n.altKey&&!a)d!==-1&&pe(n,D[d]),v&&te(),n.preventDefault();else{var c=d!==-1?Cn(d):N?$e():wn();ce(n,c),!v&&ie(),n.preventDefault()}},Zt=function(n){v?d!==-1&&(n.shiftKey?Pe(n,d):pe(n,D[d])):(h(-1),ot(n)),n.preventDefault()},Yt=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=n.currentTarget;if(a){var m=c.value.length;c.setSelectionRange(0,n.shiftKey?m:0),h(-1)}else{var g=n.metaKey||n.ctrlKey,F=_e();n.shiftKey&&g&&Pe(n,F,K),ce(n,F),!v&&ie()}n.preventDefault()},Qt=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=n.currentTarget;if(a){var m=c.value.length;c.setSelectionRange(n.shiftKey?0:m,m),kr("focusedOptionIndex")}else{var g=n.metaKey||n.ctrlKey,F=$e();n.shiftKey&&g&&Pe(n,K,F),ce(n,F),!v&&ie()}n.preventDefault()},en=function(n){n.preventDefault()},tn=function(n){n.preventDefault()},nn=function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a||(v&&kn()?(L.focus(n.shiftKey?Ie.current:le.current),n.preventDefault()):(d!==-1&&pe(n,D[d]),v&&te(filter)))},rn=function(){R(d)},ln=function(n){var a=n.metaKey||n.ctrlKey;switch(n.code){case"ArrowUp":if(t.inline)break;Wt(n);break;case"ArrowDown":if(t.inline)break;ot(n);break;case"Space":case"NumpadEnter":case"Enter":if(t.inline)break;Zt(n);break;case"Home":if(t.inline)break;Yt(n),n.preventDefault();break;case"End":if(t.inline)break;Qt(n),n.preventDefault();break;case"PageDown":tn(n);break;case"PageUp":en(n);break;case"Escape":if(t.inline)break;te();break;case"Tab":nn(n);break;case"ShiftLeft":case"ShiftRight":rn();break;default:if(n.key==="a"&&a){var c=D.filter(function(m){return Q(m)}).map(function(m){return Y(m)});ae(n,c,c),n.preventDefault();break}!a&&b.isPrintableCharacter(n.key)&&(!v&&ie(),Fn(n),n.preventDefault());break}$(!1)},an=function(n){if(t.onSelectAll)t.onSelectAll(n);else{var a=null;if(n.checked)a=[];else{var c=D.filter(function(m){return Q(m)&&!ye(m)});c&&(a=c.map(function(m){return Y(m)}))}t.selectionLimit&&a&&a.length&&(a=a.slice(0,t.selectionLimit)),ae(n.originalEvent,a,a)}},ae=function(n,a,c){t.onChange&&(t.onChange({originalEvent:n,value:a,selectedOption:c,stopPropagation:function(){n==null||n.stopPropagation()},preventDefault:function(){n==null||n.preventDefault()},target:{name:t.name,id:t.id,value:a}}),L.focus(G.current))},on=function(n){var a=n.query;Z(a),t.onFilter&&t.onFilter({originalEvent:n,filter:a})},ct=function(){Z(""),t.onFilter&&t.onFilter({filter:""})},st=function(n){if(v){var a;n?a=n.currentTarget:a=L.findSingle(_.current,'li[data-p-highlight="true"]'),a&&a.scrollIntoView&&a.scrollIntoView({block:"nearest",inline:"nearest"})}},ie=function(){P(!0),h(d!==-1?d:t.autoOptionFocus?He():Le()),L.focus(G.current)},te=function(){h(-1),P(!1),$(!1)},cn=function(n){Ge.set("overlay",_.current,i&&i.autoZIndex||he.autoZIndex,i&&i.zIndex.overlay||he.zIndex.overlay),L.addStyles(_.current,{position:"absolute",top:"0",left:"0"}),Ce(),st(),n&&n()},sn=function(n){n&&n(),Ut(),t.onShow&&t.onShow()},un=function(){Gt()},dn=function(){t.filter&&t.resetFilterOnHide&&ct(),Ge.clear(_.current),t.onHide&&t.onHide()},Ce=function(){!t.inline&&L.alignOverlay(_.current,Ee.current.parentElement,t.appendTo||i&&i.appendTo||he.appendTo)},ut=function(n){return L.getAttribute(n.target,"data-pc-section")==="clearicon"},fn=function(n){return L.getAttribute(n.target,"data-pc-section")==="headercheckboxcontainer"},mn=function(n){return _.current&&_.current.contains(n.target)},pn=function(n){te(),L.focus(G.current),n.preventDefault(),n.stopPropagation()},vn=function(){if(t.value!=null&&t.options){if(t.optionGroupLabel){var n=0,a=t.options.findIndex(function(c,m){return(n=m)&&dt(t.value,be(c))!==-1});return a!==-1?{group:n,option:a}:-1}return dt(t.value,t.options)}return-1},dt=function(n,a){return a.findIndex(function(c){return n.some(function(m){return b.equals(m,Y(c),ue)})})},bn=function(n,a){return b.equals(n,a,ue)},ve=function(n){if(t.value){var a=Y(n),c=In(n);return t.value.some(function(m){return b.equals(c?m:Y(m),a,ue)})}return!1},ft=function(n){var a;if(t.options)if(t.optionGroupLabel){var c=Ct(t.options),m;try{for(c.s();!(m=c.n()).done;){var g=m.value;if(a=Me(n,be(g)),a)break}}catch(F){c.e(F)}finally{c.f()}}else a=Me(n,t.options),b.isEmpty(a)&&(a=Me(n,t.value));return a?Fe(a):null},Me=function(n,a){return a.find(function(c){return b.equals(Y(c),n,ue)})},yn=function(n){I(!0),t.onFocus&&t.onFocus(n)},gn=function(n){I(!1),t.onBlur&&t.onBlur(n)},hn=function(){if(t.onSelectAll)return t.selectAll;if(b.isEmpty(D))return!1;var n=D.filter(function(a){return!ye(a)&&Q(a)});return!n.some(function(a){return!ve(a)})},Fe=function(n){return t.optionLabel?b.resolveFieldData(n,t.optionLabel):n&&n.label!==void 0?n.label:n},Y=function(n){return t.useOptionAsValue?n:t.optionValue?b.resolveFieldData(n,t.optionValue):n&&n.value!==void 0?n.value:n},On=function(n){return t.dataKey?b.resolveFieldData(n,t.dataKey):Fe(n)},xn=function(n){return b.resolveFieldData(n,t.optionGroupLabel)},Sn=function(n){return b.resolveFieldData(n,t.optionGroupLabel)},be=function(n){return b.resolveFieldData(n,t.optionGroupChildren)},ye=function(n){var a;if(!rt()&&!ve(n))return!0;var c=t.optionDisabled;return c?b.isFunction(c)?c(n):b.resolveFieldData(n,c):n&&((a=n.disabled)!==null&&a!==void 0?a:!1)},In=function(n){return!t.useOptionAsValue&&t.optionValue||n&&n.value!==void 0},En=function(n){return t.optionGroupLabel&&n.group},je=function(){return b.isNotEmpty(t.value)},kn=function(){return L.getFocusableElements(_.current,':not([data-p-hidden-focusable="true"])').length>0},Ke=function(n){var a;return Q(n)&&((a=Fe(n))===null||a===void 0?void 0:a.toLocaleLowerCase(t.filterLocale).startsWith(C.current.toLocaleLowerCase(t.filterLocale)))},Q=function(n){return b.isNotEmpty(n)&&!(ye(n)||En(n))},Ve=function(n){return Q(n)&&ve(n)},Le=function(){if(je()){for(var n=function(){var g=t.value[c],F=D.findIndex(function(q){return Ve(q)&&bn(g,Y(q))});if(F>-1)return{v:F}},a,c=t.value.length-1;c>=0;c--)if(a=n(),a)return a.v}return-1},He=function(){var n=Le();return n<0?_e():n},wn=function(){var n=Le();return n<0?$e():n},_e=function(){return D.findIndex(function(n){return Q(n)})},$e=function(){return b.findLastIndex(D,function(n){return Q(n)})},Pn=function(n){var a=n<D.length-1?D.slice(n+1).findIndex(function(c){return Q(c)}):-1;return a>-1?a+n+1:n},Cn=function(n){var a=n>0?b.findLastIndex(D.slice(0,n),function(c){return Q(c)}):-1;return a>-1?a:n},Fn=function(n){C.current=(C.current||"")+n.key;var a=-1;b.isNotEmpty(C.current)&&(d!==-1?(a=D.slice(d).findIndex(function(c){return Ke(c)}),a=a===-1?D.slice(0,d).findIndex(function(c){return Ke(c)}):a+d):a=D.findIndex(function(c){return Ke(c)}),a===-1&&d===-1&&(a=He()),a!==-1&&ce(n,a)),U.current&&clearTimeout(U.current),U.current=setTimeout(function(){C.current="",U.current=null},500)},ce=function(n,a){d!==a&&(h(a),st(n),t.selectOnFocus&&pe(n,D[a],!1))},mt=function(n,a){if(n.stopPropagation(),!!jn(n.currentTarget)){var c=t.value.filter(function(m){return!b.equals(m,a,ue)});t.onRemove&&t.onRemove({originalEvent:n,value:c}),ae(n,c,a)}},jn=function(n){var a=Ye.current,c=a.clientWidth<a.scrollWidth;if(!c)return!0;var m=n.closest('[data-pc-section="token"]'),g=window.getComputedStyle(a),F=window.getComputedStyle(m),q=a.clientWidth-parseFloat(g.paddingLeft)-parseFloat(g.paddingRight),oe=m.getBoundingClientRect().right+parseFloat(F.marginRight)-a.getBoundingClientRect().left;return oe<=q},pt=function(){var n=/{(.*?)}/,a=t.selectedItemsLabel||Oe("selectionMessage"),c=t.value?t.value.length:0;return n.test(a)?a.replace(a.match(n)[0],c+""):a},vt=function(){var n;if(!me&&!t.fixedPlaceholder){var a;return b.isNotEmpty(t.maxSelectedLabels)&&((a=t.value)===null||a===void 0?void 0:a.length)>t.maxSelectedLabels?pt():b.isArray(t.value)?t.value.reduce(function(c,m,g){return c+(g!==0?", ":"")+ft(m)},""):""}return n},Ln=function(){var n=t.value?t.value.length:0;if(b.isNotEmpty(t.maxSelectedLabels)&&n>t.maxSelectedLabels)return pt();if(t.selectedItemTemplate)return me?b.getJSXElement(t.selectedItemTemplate):t.value.map(function(c,m){var g=b.getJSXElement(t.selectedItemTemplate,c);return o.createElement(o.Fragment,{key:m},g)});if(t.display==="chip"&&!me){var a=t.value.slice(0,t.maxSelectedLabels||n);return a.map(function(c,m){var g={context:{value:c,index:m}},F=ft(c),q=F+"_"+m,oe=r({"aria-label":Oe("removeTokenIcon"),className:ee("removeTokenIcon"),onClick:function(Ue){return mt(Ue,c)},onKeyDown:function(Ue){return Rn(Ue,c)},tabIndex:t.tabIndex||"0"},J("removeTokenIcon",g)),Be=!t.disabled&&(t.removeIcon?re.getJSXIcon(t.removeIcon,z({},oe),{props:t}):o.createElement(mr,oe)),qn=r({className:ee("token")},J("token",g)),zn=r({className:ee("tokenLabel")},J("tokenLabel",g));return o.createElement("div",M({},qn,{key:q}),o.createElement("span",zn,F),Be)})}return vt()},Nn=function(){var n=t.optionGroupLabel?bt(t.options):t.options;if(ke){var a=V.trim().toLocaleLowerCase(t.filterLocale),c=t.filterBy?t.filterBy.split(","):[t.optionLabel||"label"];if(t.optionGroupLabel){var m=[],g=Ct(t.options),F;try{for(g.s();!(F=g.n()).done;){var q=F.value,oe=gt.filter(be(q),c,a,t.filterMatchMode,t.filterLocale);oe&&oe.length&&m.push(z(z({},q),fe({},t.optionGroupChildren,oe)))}}catch(Be){g.e(Be)}finally{g.f()}return bt(m)}return gt.filter(n,c,a,t.filterMatchMode,t.filterLocale)}return n},bt=function(n){return(n||[]).reduce(function(a,c,m){a.push(z(z({},c),{},{group:!0,index:m}));var g=be(c);return g&&g.forEach(function(F){return a.push(F)}),a},[])},Dn=function(n){switch(n.code){case"Space":case"NumpadEnter":case"Enter":if(t.inline)break;ae(n,[],[]),n.preventDefault(),n.stopPropagation();break}},Rn=function(n,a){switch(n.code){case"Space":case"NumpadEnter":case"Enter":if(t.inline)break;mt(n,a),n.preventDefault(),n.stopPropagation();break}};o.useImperativeHandle(l,function(){return{props:t,show:ie,hide:te,focus:function(){return L.focus(G.current)},getElement:function(){return A.current},getOverlay:function(){return _.current},getInput:function(){return G.current}}}),Tt(function(){Ce()}),o.useEffect(function(){b.combinedRefs(G,t.inputRef)},[G,t.inputRef]),o.useEffect(function(){t.overlayVisible===!0?ie():t.overlayVisible===!1&&te()},[t.overlayVisible]),At(function(){v&&V&&ke&&Ce()},[v,V,ke]),ur(function(){Ge.clear(_.current)});var Tn=function(){var n=r({className:ee("clearIcon"),"aria-label":Oe("clear"),onClick:function(g){return ae(g,[],[])},onKeyDown:function(g){return Dn(g)},tabIndex:t.tabIndex||"0"},J("clearIcon")),a=t.clearIcon||o.createElement(Mt,n),c=re.getJSXIcon(a,z({},n),{props:t});return!me&&t.showClear&&!t.disabled?c:null},An=function(){var n=Ln(),a=r({ref:Ee,className:ee("labelContainer")},J("labelContainer")),c=r({ref:Ye,className:ee("label",{empty:me})},J("label"));return o.createElement("div",a,o.createElement("div",c,n||t.placeholder||t.emptyMessage||"empty"))},D=Nn(),Mn=b.isNotEmpty(t.tooltip),yt=ge.getOtherProps(t),Kn=b.reduceKeys(yt,L.ARIA_PROPS),Ne=r({className:ee("triggerIcon")},J("triggerIcon")),Vn=r({className:ee("trigger")},J("trigger")),Hn=t.loadingIcon?re.getJSXIcon(t.loadingIcon,z({},Ne),{props:t}):o.createElement(ir,M({spin:!0},Ne)),_n=t.dropdownIcon?re.getJSXIcon(t.dropdownIcon,z({},Ne),{props:t}):o.createElement(dr,Ne),$n=o.createElement("div",Vn,t.loading?Hn:_n),Bn=!t.inline&&An(),Un=!t.inline&&Tn(),Gn=r(z(z({ref:A,id:t.id,style:z(z({},t.style),et("root")),className:W(t.className,ee("root",{focusedState:x,context:i,overlayVisibleState:v}))},yt),{},{onClick:zt}),ge.getOtherProps(t),J("root")),Xn=r({className:"p-hidden-accessible","data-p-hidden-accessible":!0},J("hiddenInputWrapper")),Jn=r(z({ref:G,id:t.inputId,name:t.name,type:"text",onFocus:yn,onBlur:gn,onKeyDown:ln,role:"combobox","aria-expanded":v,disabled:t.disabled,tabIndex:t.disabled?-1:t.tabIndex,value:vt()},Kn),J("input"));return o.createElement(o.Fragment,null,o.createElement("div",Gn,o.createElement("div",Xn,o.createElement("input",M({},Jn,{readOnly:!0}))),!t.inline&&o.createElement(o.Fragment,null,Bn,Un,$n),o.createElement(_t,M({hostName:"MultiSelect",ref:_,visibleOptions:D},t,{onClick:qt,onOverlayHide:te,filterValue:X,focusedOptionIndex:d,onFirstHiddenFocus:Xt,onLastHiddenFocus:Jt,firstHiddenFocusableElementOnOverlay:le,lastHiddenFocusableElementOnOverlay:Ie,setFocusedOptionIndex:h,hasFilter:ke,isValidOption:Q,getOptionValue:Y,updateModel:ae,onFilterInputChange:on,resetFilter:ct,onCloseClick:pn,onSelectAll:an,getOptionLabel:Fe,getOptionRenderKey:On,isOptionDisabled:ye,getOptionGroupChildren:be,getOptionGroupLabel:Sn,getOptionGroupRenderKey:xn,isSelected:ve,getSelectedOptionIndex:vn,isAllSelected:hn,onOptionSelect:pe,allowOptionSelect:rt,in:v,onEnter:cn,onEntered:sn,onExit:un,onExited:dn,ptm:J,cx:ee,sx:et,isUnstyled:tt,metaData:Qe,changeFocusedOptionIndex:ce}))),Mn&&o.createElement(Dt,M({target:A,content:t.tooltip,pt:J("tooltip")},t.tooltipOptions)))}));$t.displayName="MultiSelect";function Se(e){"@babel/helpers - typeof";return Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},Se(e)}function Tr(e,l){if(Se(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,l);if(Se(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(e)}function Ar(e){var l=Tr(e,"string");return Se(l)=="symbol"?l:l+""}function Mr(e,l,r){return(l=Ar(l))in e?Object.defineProperty(e,l,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[l]=r,e}var Kr={root:function(l){var r=l.props;return W("p-skeleton p-component",{"p-skeleton-circle":r.shape==="circle","p-skeleton-none":r.animation==="none"})}},Vr=`
@layer primereact {
    .p-skeleton {
        position: relative;
        overflow: hidden;
    }
    
    .p-skeleton::after {
        content: "";
        animation: p-skeleton-animation 1.2s infinite;
        height: 100%;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 1;
    }
    
    .p-skeleton-circle {
        border-radius: 50%;
    }
    
    .p-skeleton-none::after {
        animation: none;
    }
}

@keyframes p-skeleton-animation {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(100%);
    }
}
`,Hr={root:{position:"relative"}},Te=qe.extend({defaultProps:{__TYPE:"Skeleton",shape:"rectangle",size:null,width:"100%",height:"1rem",borderRadius:null,animation:"wave",style:null,className:null},css:{classes:Kr,inlineStyles:Hr,styles:Vr}});function jt(e,l){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);l&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Lt(e){for(var l=1;l<arguments.length;l++){var r=arguments[l]!=null?arguments[l]:{};l%2?jt(Object(r),!0).forEach(function(i){Mr(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var Je=o.memo(o.forwardRef(function(e,l){var r=de(),i=o.useContext(Ae),t=Te.getProps(e,i),S=Te.setMetaData({props:t}),y=S.ptm,d=S.cx,h=S.sx,w=S.isUnstyled;ze(Te.css.styles,w,{name:"skeleton"});var O=o.useRef(null);o.useImperativeHandle(l,function(){return{props:t,getElement:function(){return O.current}}});var N=t.size?{width:t.size,height:t.size,borderRadius:t.borderRadius}:{width:t.width,height:t.height,borderRadius:t.borderRadius},$=r({ref:O,className:W(t.className,d("root")),style:Lt(Lt({},N),h("root")),"aria-hidden":!0},Te.getOtherProps(t),y("root"));return o.createElement("div",$)}));Je.displayName="Skeleton";const il=({fields:e=[],routes:l,isEdit:r,seccionName:i,producto:t={},productosRelacionados:S=[]})=>{const{data:y,setData:d,post:h,delete:w,errors:O}=Qn({}),N=o.useRef(null),[$,B]=o.useState(r),[j,X]=o.useState(r?t.imagenes:[]),[V,Z]=o.useState(S?S.map(Number):[]);o.useEffect(()=>{if(r&&Object.keys(t).length>0){let u={_method:"PUT"};e.forEach(k=>{u[k.name]=t[k.name]||"",k.name==="prodsRel"&&k.multiple&&(u[k.name]=S||[])}),d(u),B(!1)}},[r,t,e]);const H=(u,k)=>d(u,k),T=(u,k,x)=>{const I=u.files;d(k,x?I:I[0]||null)},K=u=>{if(j.length<=1){N.current.show({severity:"error",summary:"Error",detail:"Debe haber al menos una imagen.",life:3e3});return}w(route("image.delete",u),{onSuccess:()=>{N.current.show({severity:"success",summary:"Éxito",detail:"Imagen Eliminada",life:3e3}),X(k=>k.filter(x=>x.id!==u))},onError:()=>{N.current.show({severity:"error",summary:"Error",detail:"Ocurrió un error al eliminar la imagen.",life:3e3})}})},R=u=>{u.preventDefault();const k=r&&l.edit?l.edit:l.create;h(k,{onSuccess:x=>{N.current.show({severity:"success",summary:"Éxito",detail:r?"Contenido Editado":"Contenido Agregado",life:3e3}),r&&X(x.props.producto.imagenes),r||setTimeout(()=>location.reload(),1e3)}})};return E.jsxs(vr,{children:[E.jsx(yr,{ref:N}),E.jsx(er,{title:`${r?"Editar":"Agregar"} ${i}`}),E.jsxs("div",{className:"card p-4",children:[l.indexUrl&&E.jsx("div",{className:"flex justify-end mb-4",children:E.jsx(tr,{className:"p-button",href:l.indexUrl,style:{color:"white"},children:"Volver"})}),$?e.map((u,k)=>E.jsxs("div",{className:"mb-4",children:[E.jsx(Je,{width:"100%",height:"2rem",className:"mb-2"}),E.jsx(Je,{width:"100%",height:"2.5rem"})]},k)):E.jsxs("form",{onSubmit:R,children:[e.map((u,k)=>E.jsxs("div",{className:"field mb-4",children:[E.jsx(Ot,{htmlFor:u.name,className:"block mb-2",children:u.label}),u.type==="longText"&&E.jsx(gr,{data:y[u.name]||"",onChange:x=>H(u.name,x),placeholder:u.placeholder||"Escribe aquí..."}),u.type==="File"&&E.jsxs(E.Fragment,{children:[E.jsx(nr,{name:u.name,customUpload:!0,uploadHandler:x=>T(x,u.name,u.multiple),auto:!0,mode:"basic",chooseLabel:u.multiple?"Seleccionar Archivos":"Seleccionar Archivo",multiple:u.multiple}),E.jsx(Ot,{children:u.fileDetails}),r&&u.isImage&&!u.multiple&&y[u.name]&&E.jsx("div",{className:"mt-2",children:E.jsx(xt,{src:y[u.name],alt:u.name,width:"250"})}),r&&u.isImage&&u.multiple&&j.length>0&&E.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:j.map(x=>E.jsxs("div",{className:"relative",children:[E.jsx(xt,{src:x.url,alt:x.id,width:"250"}),E.jsx(ht,{type:"button",icon:"pi pi-times",severity:"danger",size:"small",className:"absolute top-0 right-0",onClick:()=>K(x.id)})]},x.id))})]}),u.type==="select"&&u.options&&(u.multiple?E.jsx($t,{id:u.name,value:y[u.name]||[],options:u.options,optionLabel:u.fieldLabel,optionValue:u.optionValue,onChange:x=>H(u.name,x.value),display:"chip",className:`w-full mb-2 ${O[u.name]?"p-invalid":""}`}):E.jsx(ar,{id:u.name,value:y[u.name]||null,options:u.options,optionLabel:u.fieldLabel,optionValue:u.optionValue,onChange:x=>H(u.name,x.value),placeholder:"Seleccionar...",className:`w-full mb-2 ${O[u.name]?"p-invalid":""}`})),u.type!=="File"&&u.type!=="longText"&&u.type!=="select"&&E.jsx(Nt,{id:u.name,value:y[u.name]||"",onChange:x=>H(u.name,x.target.value),className:`w-full mb-2 ${O[u.name]?"p-invalid":""}`}),O[u.name]&&E.jsx(br,{severity:"error",text:O[u.name]})]},k)),E.jsx(ht,{type:"submit",className:"mt-5 block mx-auto",children:r?"Editar":"Agregar"})]})]})]})};export{il as default};
//# sourceMappingURL=DinamicForm-DM6Hv4DI.js.map
