@trintel/zooy 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { n as h, t as bt } from "./component-library-registry-DB5UeqC2.js";
2
- import { i as Et, n as W, r } from "./zoo-DsyOHBKi.js";
2
+ import { i as Et, n as W, r } from "./zoo-Cztpe9qH.js";
3
3
  import { isDefAndNotNull as Wt, objToPaths as St } from "badu";
4
4
  import * as _ from "ramda";
5
5
  import { TABLE_SORT_DIRECTION as It } from "@carbon/web-components/lib/components/data-table/defs.js";
@@ -1 +1 @@
1
- var St=Object.create;var K=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var kt=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Wt(e))!Pt.call(t,a)&&a!==n&&K(t,a,{get:()=>e[a],enumerable:!(s=At(e,a))||s.enumerable});return t};var l=(t,e,n)=>(n=t!=null?St(It(t)):{},kt(e||!t||!t.__esModule?K(n,"default",{value:t,enumerable:!0}):n,t));const m=require("./component-library-registry-BBQV6Kpv.js"),c=require("./zoo-C2JHuTvn.js");let at=require("badu"),B=require("ramda");B=m.__toESM(B);let _t=require("@carbon/web-components/lib/components/data-table/defs.js");var Ct=m.__exportAll({cdsTableWrap:()=>Dt}),Q=(t,e,n)=>{const s=customElements.get("cds-table"),a=customElements.get("cds-pagination"),o=customElements.get(s.selectorTableBatchActions);customElements.get("cds-popover");const r=e.dataBinder,d=e.pagination,u=e.skeleton,A=e.querySelector(s.selectorTableToolbarSearch),W=e.querySelector(s.selectorTableBatchActions),x=e.querySelector(s.selectorTableBody),O=["button","a","input","select","textarea",'[role="button"]',".cds--table-expand",".cds--table-column-checkbox"].join(","),V=e.querySelectorAll(s.selectorHeaderCell+"[is-sortable]"),ot=e.isSortable||V.length>0,z=Symbol(),F=Symbol(),w=new Map,rt=i=>{t.listen(e,"click",p=>{const v=p.target.closest(s.selectorTableRow);if(!v||p.composedPath().some(f=>f.matches&&f.matches(O)))return;p.stopPropagation();const g=c.getSemanticAttributes(v);t.dispatchPanelEvent(i,{...g})})},ct=i=>{t.listen(e,s.eventExpandoToggle,p=>{const v=p.target,g=v.tagName==="CDS-TABLE-HEADER-ROW",f=p.detail.expanded,E={tableAttrs:n,...c.getSemanticAttributes(v),target:v,allRows:g,didExpand:f};t.dispatchPanelEvent(i,E)})},it=i=>{w.set(z,p=>{t.dispatchPanelEvent(i,p)})},lt=i=>{w.set(F,p=>{const v=p.detail.selectedRows,g=Math.min(v.length,W.totalRowsCount),f=p.target,E=c.getSemanticAttributes(f),I=v.map(c.getSemanticAttributes),_={tableAttrs:n,...E,target:f,selectCount:g,selection:I};t.dispatchPanelEvent(i,_)})},dt=i=>{t.listen(e,s.eventTableRowSelect,p=>{const v=p.target,g=p.detail.selectedRows||[],f=g.length,E=g.map(c.getSemanticAttributes),I={tableAttrs:n,...c.getSemanticAttributes(v),selectCount:f,selection:E,target:v};t.dispatchPanelEvent(i,I)})},pt=()=>{t.listen(e,s.eventBeforeSort,i=>{const p=i.target,v=i.detail.oldSortDirection,g=i.detail.sortDirection,f=c.getSemanticAttributes(p),E=f.sortField,I=g===_t.TABLE_SORT_DIRECTION.DESCENDING?`-${E}`:E;i.cancelBubble=!0,i.stopPropagation(),i.preventDefault(),x.innerHTML="",u&&u.show(),V.forEach((C,b)=>{C===p?(C.setAttribute("sort-active","true"),C.setAttribute("sort-direction",g)):(C.removeAttribute("sort-active"),C.setAttribute("sort-direction","none"))});const _={ordering:I};r.fetchData(_).then(()=>{d.setData(r),u&&u.hide()}),w.has(z)&&w.get(z)({tableAttrs:n,...f,sortNow:g,sortWas:v,sortField:E,ordering:I,target:p})})},ut=()=>{t.listen(e,s.eventTableRowSelectAll,i=>{i.detail.selectedRows.length===0&&e.querySelectorAll(s.selectorTableRow).forEach(p=>{p.disabled=!1,p.selected=!1}),w.has(F)&&w.get(F)(i)})},vt=()=>{t.listen(e,s.eventBeforeChangeSelectionAll,i=>{i.stopPropagation(),i.detail.callback&&i.detail.callback()})},mt=i=>{const p=e.querySelector("cds-table-header-row");t.listen(i,o.eventClickSelectAll,v=>{v.stopPropagation(),p.dispatchEvent(new CustomEvent(s.eventBeforeChangeSelectionAll,{bubbles:!0,cancelable:!0,composed:!0,detail:{selected:!0,callback:()=>{i.selectedRowsCount=i.totalRowsCount,e.querySelectorAll(s.selectorTableRow).forEach(g=>{g.disabled=!0})}}}))})},gt=i=>{t.listen(i,"keydown",p=>{if(p.key==="Enter"){u&&u.show(),d.totalItems=0,e.querySelector("cds-table-body").replaceChildren();const v={search:i.value||"",offset:0};r.fetchData(v).then(()=>{d.setData(r),u&&u.hide()})}})},ht=i=>{t.listen(i,s.eventSearchInput,p=>{if((p.detail.value||"")===""){const v={search:"",offset:0};u&&u.show(),r.fetchData(v).then(()=>{u&&u.hide(),d.setData(r)})}})},ft=i=>{i.caret=!1;const p=i.querySelector("cds-icon-button, button:not([slot])"),v=i.querySelectorAll("cds-checkbox"),g=i.querySelectorAll("cds-modal-footer-button"),f=[...i.querySelectorAll("cds-checkbox-group")].map(c.getSemanticAttributes).map(B.pathOr("noop",["zoo","filter","field"])).reduce((b,S)=>(b[S]=null,b),{offset:0});if(!p||!g){console.error("Improperly configured Batch Filter popover");return}new MutationObserver(()=>{i.classList.toggle("cds--overflow-menu--open",i.open)}).observe(i,{attributes:!0,attributeFilter:["open"]});const E=Symbol(),I=Symbol(),_=[...g].reduce((b,S,y)=>(S.hasAttribute("reset-filter")&&b.set(E,S),S.hasAttribute("apply-filter")&&b.set(I,S),b),new Map),C=()=>{const b=new Map;return v.forEach(S=>{const y=S.getAttribute("id");if(!y||!y.includes(":"))return;const[N,M]=y.split(":");b.has(N)||b.set(N,[]),S.checked&&b.get(N).push(M)}),b};if(_.has(E)){const b=S=>S.checked=!1;t.listen(_.get(E),"click",S=>{S.stopPropagation(),v.forEach(b),u&&u.show(),r.fetchData(f).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})})}_.has(I)&&t.listen(_.get(I),"click",b=>{b.stopPropagation();const S=[...C()].reduce((y,[N,M])=>(y[N]=Array.isArray(M)&&M.length===0?null:M,y),{offset:0});u&&u.show(),r.fetchData(S).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})}),t.listen(p,"click",b=>{b.stopPropagation(),i.open=!i.open,i.classList.toggle("cds--overflow-menu--open",i.open)})},bt=()=>{t.listen(d,a.eventPageSizeChanged,i=>{const p={limit:d.pageSize,offset:0};r.fetchData(p).then(()=>{d.setData(r)})})},Et=()=>{let i=null;t.listen(d,a.eventChangeCurrent,p=>{const{page:v}=p.detail,g=d.pageSize,f=(v-1)*g;if(f!==i){i=f;const E={limit:g,offset:f};r.fetchData(E).then(()=>{d.setData(r),u&&u.hide()})}})};r&&d&&(bt(),Et()),r&&A&&(gt(A),ht(A));const Z=e.querySelector(s.selectorTableToolbarContent);if(Z){const i=Z.querySelectorAll("cds-popover[data-batch-filter]");r&&i&&i.forEach(ft)}e.isSelectable&&(ut(),vt(),W&&mt(W)),r&&ot&&pt();const J={zoo:{event:{row:{click:rt,expand:ct,check:{one:dt,all:lt}},column:{sort:it}}}};(0,at.objToPaths)(n).forEach(([i,p])=>{B.hasPath(i,J)&&B.path(i,J)(p)})},yt=t=>{const e=document.createElement("cds-pagination");return e.backwardText="Previous page",e.forwardText="Next page",e.itemsPerPageText="Items per page:",e.pageSize=t.limit,e.size="lg",[10,25,50,100,500].forEach(n=>{const s=document.createElement("cds-select-item");s.value=n.toString(),s.textContent=n.toString(),e.appendChild(s)}),e.setData=n=>{if(n.isPaginated){const{count:s}=B.pick(["count"],n.data);e.pagesUnknown=Math.ceil(s/n.limit)>100,e.totalItems=s,e.pagesUnknown?e.formatStatusWithIndeterminateTotal=({start:a,end:o})=>`${a}–${o} of ${s} item${s<=1?"":"s"}`:delete e.formatStatusWithIndeterminateTotal}},e},xt=t=>{if(!t.parentNode){console.error("[Carbon Table] Cannot create skeleton: table has no parent node");return}const e=!!t.querySelector("cds-table-header-title"),n=!!t.querySelector("cds-table-header-description"),s=!!t.querySelector("cds-table-toolbar"),a=[...t.querySelectorAll("cds-table-header-cell")].length,o=t.hasAttribute("zebra"),r=t.getAttribute("size"),d=document.createElement("cds-table-skeleton");d.showHeader=e||n,d.showToolbar=s,d.zebra=o,d.columnCount=a,d.size=r,d.show=()=>d.classList.remove("hidden"),d.hide=()=>d.classList.add("hidden");const u=document.createElement("div");return u.classList.add("zoo-datatable-skeleton-wrapper"),t.parentNode.insertBefore(u,t),u.appendChild(d),u.appendChild(t),d},wt=(t,e)=>{const n=e.getAttribute("zoo-url-api"),s=parseInt(e.getAttribute("data-page-size")||25,10);if(n)return new c.Binder(t,n,e,{urlParams:{limit:s}})},Dt={selector:"cds-table",init:function(t){const e=c.getSemanticAttributes(t),n=this,s=wt(n,t);if((0,at.isDefAndNotNull)(s)){t.dataBinder=s;const a=xt(t);t.skeleton=a;const o=yt(s);t.pagination=o,t.after(o),s.fetchData().then(r=>{a.hide(),o.setData(s),Q(n,t,e)})}else Q(n,t,e)}},Bt=m.__exportAll({cdsPaginationWrap:()=>Nt}),Nt={selector:"cds-pagination",init:function(t){const e=this,n=customElements.get("cds-pagination");let s=null;e.listen(t,n.eventChangeCurrent,a=>{const o=a.detail.page,r=t.pageSize,d=(o-1)*r;d!==s&&(s=d,e.dispatchPanelEvent("pagination-changed-current",{detail:{page:o,pageSize:r,action:"page-change"}}))}),e.listen(t,n.eventPageSizeChanged,a=>{const o=t.pageSize;s=null,e.dispatchPanelEvent("pagination-changed-page-size",{detail:{page:1,pageSize:o,action:"page-size-change"}})})}},Mt=m.__exportAll({cdsModalBodyContentWrap:()=>Lt,cdsModalBodyWrap:()=>Rt,cdsModalCloseButWrap:()=>Ft,cdsModalFooterButWrap:()=>Ut,cdsModalFooterWrap:()=>Ht,cdsModalHeaderWrap:()=>qt,cdsModalHeadingWrap:()=>Ot,cdsModalLabelWrap:()=>zt,cdsModalWrap:()=>Tt}),Tt={selector:"cds-modal",init:function(t){const e=customElements.get("cds-modal"),n=c.getSemanticAttributes(t),s=c.getEventAttribute(t,"open-event","event");s&&this.listen(t,"cds-modal-beingopened",r=>{this.dispatchPanelEvent(s,{...n,action:"opened"})});const a=t.getAttribute("before-close-event");a&&this.listen(t,e.eventBeforeClose,r=>{this.dispatchPanelEvent(a,{...n,action:"closing",cancelable:!0})}),this.listen(t,e.eventClose,r=>{this.dispatchPanelEvent("destroy_me",{...n,action:"closed",triggeredBy:r.detail?.triggeredBy})});const o=c.getEventAttribute(t,"primary-event","event");o&&this.listen(t,"cds-modal-primary-focus",r=>{this.dispatchPanelEvent(o,{...n,action:"primary"})})}},qt={selector:"cds-modal-header"},Ot={selector:"cds-modal-heading"},zt={selector:"cds-modal-label"},Ft={selector:"cds-modal-close-button"},Rt={selector:"cds-modal-body"},Lt={selector:"cds-modal-body-content"},Ht={selector:"cds-modal-footer"},Ut={selector:"cds-modal-footer-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,e)})}},jt=m.__exportAll({cdsMenuButtonWrap:()=>$t,cdsMenuWrap:()=>Gt}),Gt={selector:"cds-menu",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-menu-opened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-menu-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})}),this.listen(t,"click",a=>{if(a.target.tagName==="CDS-MENU-ITEM"){const o=c.getSemanticAttributes(a.target),r=o.event||e.event;r&&(a.stopPropagation(),this.dispatchPanelEvent(r,{...e,...o}))}}),this.listen(t,"cds-item-changed",a=>{const o=a.detail.triggeredBy,r=c.getSemanticAttributes(o),d=r.event||e.event;d&&this.dispatchPanelEvent(d,{...e,...r,action:"selection-changed"})})}},$t={selector:"cds-menu-button",init:function(t){const e=c.getSemanticAttributes(t),n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||e.event;o&&(s.stopPropagation(),this.dispatchPanelEvent(o,{...e,...a}))}})}},Vt=m.__exportAll({cdsButFabWrap:()=>Qt,cdsButtonWrap:()=>Zt,cdsComboButWrap:()=>Yt,cdsCopyButWrap:()=>Xt,cdsIconButToggleWrap:()=>Kt,cdsIconButWrap:()=>Jt}),Zt={selector:"cds-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,c.getSemanticAttributes(t))})}},Jt={selector:"cds-icon-button:not([data-toggle])",event:"click",getData:(t,e)=>e},Kt={selector:"cds-icon-button[data-toggle]",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",n=>{n.stopPropagation(),t.isSelected=!t.isSelected,this.dispatchPanelEvent(e.event,{...e,isOn:t.isSelected})})}},Qt={selector:"cds-button[data-fab]",event:"click",getData:(t,e)=>e},Xt={selector:"cds-copy-button",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"click",a=>{a.stopPropagation(),this.dispatchPanelEvent(n,{...e,action:"copy"})});const s=t.getAttribute("success-event");if(s){const a=new MutationObserver(()=>{t.hasAttribute("feedback-shown")&&this.dispatchPanelEvent(s,{...e,action:"copied"})});a.observe(t,{attributes:!0,attributeFilter:["feedback-shown"]}),t._copyObserver=a}}},Yt={selector:"cds-combo-button",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",s=>{const a=s.composedPath(),o=a.some(d=>d.tagName==="CDS-MENU-ITEM"),r=a.some(d=>d.tagName==="CDS-ICON-BUTTON");!o&&!r&&(s.stopPropagation(),this.dispatchPanelEvent(e.event,{...e,action:"primary"}))});const n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||c.getEventAttribute(t,"menu-event","event");o&&this.dispatchPanelEvent(o,{...e,...a,action:"menu-item"})}})}},te=m.__exportAll({cdsComboBoxWrap:()=>se,cdsDropdownWrap:()=>ee,cdsMultiSelectWrap:()=>ne}),ee={selector:"cds-dropdown",init:function(t){const e=customElements.get("cds-dropdown"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:o.detail?.item?.value,selectedText:o.detail?.item?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},se={selector:"cds-combo-box",init:function(t){const e=customElements.get("cds-combo-box"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=o.detail?.item;this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:r?.value,selectedText:r?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ne={selector:"cds-multi-select",init:function(t){const e=customElements.get("cds-multi-select"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=t.value?t.value.split(","):[];this.dispatchPanelEvent(s,{...n,selectedItems:r})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ae=m.__exportAll({cdsDatePickerWrap:()=>oe,cdsTimePickerWrap:()=>re}),oe={selector:"cds-date-picker",init:function(t){const e=customElements.get("cds-date-picker"),n=c.getSemanticAttributes(t),s=t.querySelector('cds-date-picker-input[kind="from"]'),a=t.querySelector('cds-date-picker-input[kind="to"]'),o=s&&a,r=n.event;r&&this.listen(t,e.eventChange,u=>{let A;o?A={from:s.value||"",to:a.value||""}:A=t.value,this.dispatchPanelEvent(r,{...n,value:A})});const d=t.getAttribute("error-event");d&&this.listen(t,e.eventFlatpickrError,u=>{this.dispatchPanelEvent(d,{...n,error:u.detail})})}},re={selector:"cds-time-picker",event:"cds-time-picker-changed",getData:(t,e,n)=>({...e,value:n.value})},ce=m.__exportAll({cdsFileUploaderWrap:()=>ie}),ie={selector:"cds-file-uploader",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const a=t.querySelector('input[type="file"]');a&&this.listen(a,"change",o=>{this.dispatchPanelEvent(n,{...e,files:Array.from(o.target.files||[])})})}const s=t.getAttribute("delete-event");s&&this.listen(t,"cds-file-uploader-item-deleted",a=>{this.dispatchPanelEvent(s,{...e,fileName:a.detail?.fileName,fileId:a.detail?.fileId})})}},le=m.__exportAll({cdsAccordionWrap:()=>pe,cdsContentSwitcherWrap:()=>ue,cdsTabsWrap:()=>de}),de={selector:"cds-tabs",init:function(t){const e=customElements.get("cds-tabs"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,tabValue:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,tabValue:o.detail.value})})}},pe={selector:"cds-accordion",init:function(t){const e=customElements.get("cds-accordion-item"),n=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-accordion-item")].forEach(s=>{const a=c.getSemanticAttributes(s),o=a.event||n.event;o&&this.listen(s,e.eventToggle,r=>{this.dispatchPanelEvent(o,{...n,...a,open:r.detail.open})})})}},ue={selector:"cds-content-switcher",init:function(t){const e=customElements.get("cds-content-switcher"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,value:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,value:r.getAttribute("value")})})}},ve=m.__exportAll({cdsBreadCrumbWrap:()=>he,cdsBreadcrumbItemWrap:()=>me,cdsBreadcrumbLinkWrap:()=>ge}),me={selector:"cds-breadcrumb-item"},ge={selector:"cds-breadcrumb-link",event:"click",getData:(t,e,n)=>(t.preventDefault(),{...e,href:n.getAttribute("href")})},he={selector:"cds-breadcrumb",init:function(t){const e=this,n=c.getSemanticAttributes(t),s=n.event;if(s){const a=r=>{e.dispatchPanelEvent(s,{...n,...r})};e.listen(t,"click",r=>{const d=r.target.closest("cds-breadcrumb-link");d&&(r.preventDefault(),r.stopPropagation(),a(c.getSemanticAttributes(d)))});const o=t.querySelector("cds-overflow-menu-body");o&&e.listen(o,"cds-overflow-menu-item-clicked",r=>{r.stopPropagation(),a(c.getSemanticAttributes(r.target))})}}},fe=m.__exportAll({cdsNumberInputWrap:()=>Se,cdsPasswordInputWrap:()=>Ae,cdsSearchWrap:()=>We,cdsTextAreaWrap:()=>Ee,cdsTextInputWrap:()=>be}),be={selector:"cds-text-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Ee={selector:"cds-textarea",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Se={selector:"cds-number-input",event:"cds-number-input",getData:(t,e,n)=>({...e,value:t.detail.value,direction:t.detail.direction})},Ae={selector:"cds-password-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},We={selector:"cds-search",event:"cds-search-input",getData:(t,e,n)=>({...e,value:n.value})},Ie=m.__exportAll({cdsCheckboxWrap:()=>Pe,cdsRadioButGroupWrap:()=>ke,cdsSelectWrap:()=>Ce,cdsSliderWrap:()=>ye,cdsToggleWrap:()=>_e}),Pe={selector:"cds-checkbox",event:"cds-checkbox-changed",getData:(t,e,n)=>({...e,checked:t.detail.checked,value:n.value})},ke={selector:"cds-radio-button-group",event:"cds-radio-button-group-changed",getData:(t,e)=>({...e,value:t.detail?.value})},_e={selector:"cds-toggle",event:"cds-toggle-changed",getData:(t,e)=>({...e,isOn:t.detail.checked,value:t.detail.checked})},Ce={selector:"cds-select",event:"cds-select-selected",getData:(t,e)=>({...e,value:t.detail.value})},ye={selector:"cds-slider",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-slider-changed",a=>{this.dispatchPanelEvent(n,{...e,value:a.detail.value})});const s=t.getAttribute("input-event");s&&this.listen(t,"cds-slider-input-changed",a=>{this.dispatchPanelEvent(s,{...e,value:a.detail.value})})}},xe=m.__exportAll({cdsFilterTagWrap:()=>Be,cdsSDismissibleTagWrap:()=>De,cdsTagsWrap:()=>we}),we={selector:"cds-tag",event:"click",getData:(t,e)=>e},De={selector:"cds-dismissible-tag",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("click-event");n&&this.listen(t,"click",a=>{a.target.closest("button")||this.dispatchPanelEvent(n,{...e})});const s=e.event;s&&this.listen(t,"cds-dismissible-tag-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},Be={selector:"cds-filter-tag",event:"cds-filter-tag-closed",getData:(t,e)=>({...e,action:"remove"})},Ne=m.__exportAll({cdsContainedListDescriptionWrap:()=>Oe,cdsContainedListItemWrap:()=>ze,cdsContainedListWrap:()=>qe,cdsOverflowMenuWrap:()=>Me,cdsStructuredListWrap:()=>Te,cdsTreeViewWrap:()=>Fe}),Me={selector:"cds-overflow-menu",init:function(t){const e=c.getSemanticAttributes(t),n=e.event,s=t.querySelector("cds-overflow-menu-body");n&&s&&this.listen(s,"cds-overflow-menu-item-clicked",a=>{a.stopPropagation();const o=c.getSemanticAttributes(a.target);this.dispatchPanelEvent(n,{...e,...o})})}},Te={selector:"cds-structured-list",init:function(t){const e=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-structured-list-row")].forEach(n=>{const s=c.getSemanticAttributes(n),a=s.event||e.event;a&&this.listen(n,"click",o=>{o.stopPropagation(),this.dispatchPanelEvent(a,{...e,...s})})}),t.hasAttribute("selection")&&this.listen(t,"cds-structured-list-selected",n=>{const s=n.detail.row,a=c.getSemanticAttributes(s),o=e.event;o&&this.dispatchPanelEvent(o,{...e,...a})})}},qe={selector:"cds-contained-list"},Oe={selector:"cds-contained-list-description"},ze={selector:"cds-contained-list-item",event:"cds-contained-list-item-click",getData:(t,e)=>e},Fe={selector:"cds-tree-view",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-tree-node-selected",s=>{const a=s.detail.node,o=c.getSemanticAttributes(a),r=o.event||e.event;r&&this.dispatchPanelEvent(r,{...e,...o,nodeId:a.id,label:a.getAttribute("label")})});const n=c.getEventAttribute(t,"expand-event");n&&this.listen(t,"cds-tree-node-expanded",s=>{this.dispatchPanelEvent(n,{...e,nodeId:s.detail.node.id,expanded:s.detail.expanded})})}},Re=m.__exportAll({cdsActionableNotificationWrap:()=>Ue,cdsInlineNotificationWrap:()=>He,cdsToastNotificationWrap:()=>Le}),Le={selector:"cds-toast-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},He={selector:"cds-inline-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},Ue={selector:"cds-actionable-notification",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"close-event","event");n&&this.listen(t,"cds-notification-closed",a=>{this.dispatchPanelEvent(n,{...e,action:"closed"})});const s=c.getEventAttribute(t,"action-event");s&&this.listen(t,"cds-notification-actioned",a=>{this.dispatchPanelEvent(s,{...e,action:"actioned"})})}},je=m.__exportAll({cdsClickableTileWrap:()=>$e,cdsExpandableTileWrap:()=>Ve,cdsRadioTileWrap:()=>Je,cdsSelectableTileWrap:()=>Ze,cdsTileGroupWrap:()=>Ke,cdsTileWrap:()=>Ge}),Ge={selector:"cds-tile"},$e={selector:"cds-clickable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const s=e.href||t.getAttribute("href")||"";t.removeAttribute("href"),t.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.dispatchPanelEvent(n,{...e,href:s})},!0)}}},Ve={selector:"cds-expandable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("before-toggle-event");n&&this.listen(t,"cds-expandable-tile-beingtoggled",a=>{this.dispatchPanelEvent(n,{...e,expanded:a.detail.expanded,cancelable:!0})});const s=e.event;s&&this.listen(t,"cds-expandable-tile-toggled",a=>{this.dispatchPanelEvent(s,{...e,expanded:a.detail.expanded})})}},Ze={selector:"cds-selectable-tile",event:"cds-selectable-tile-changed",getData:(t,e,n)=>({...e,selected:t.detail.selected,value:n.value})},Je={selector:"cds-radio-tile",event:"cds-radio-tile-selected",getData:(t,e,n)=>({...e,selected:t.detail.selected,name:t.detail.name,value:n.value})},Ke={selector:"cds-tile-group",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&(this.listen(t,"cds-current-radio-tile-selection",s=>{const a=s.detail.target;this.dispatchPanelEvent(n,{...e,value:a?.value,name:a?.name,selected:a?.selected})}),this.listen(t,"cds-current-selectable-tile-selections",s=>{const a=s.detail.currentSelections||[];this.dispatchPanelEvent(n,{...e,values:a.map(o=>o.value),names:a.map(o=>o.name),count:a.length})}))}},Qe=m.__exportAll({cdsInlineLoadingWrap:()=>ts,cdsProgressBarWrap:()=>Xe,cdsProgressIndicatorWrap:()=>Ye}),Xe={selector:"cds-progress-bar",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(()=>{const s=parseFloat(t.getAttribute("value")||"0");s>=parseFloat(t.getAttribute("max")||"100")&&this.dispatchPanelEvent(e.event,{...e,value:s,status:"complete"})});n.observe(t,{attributes:!0,attributeFilter:["value"]}),t._progressObserver=n}}},Ye={selector:"cds-progress-indicator",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-progress-step-click",n=>{const s=n.target,a=c.getSemanticAttributes(s),o=a.event||e.event;o&&this.dispatchPanelEvent(o,{...e,...a,stepIndex:s.getAttribute("data-index"),stepLabel:s.getAttribute("label")})})}},ts={selector:"cds-inline-loading",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-inline-loading-onsuccess",a=>{this.dispatchPanelEvent(n,{...e,status:"finished"})});const s=t.getAttribute("status-event");if(s){const a=new MutationObserver(o=>{o.forEach(r=>{if(r.attributeName==="status"){const d=t.getAttribute("status");this.dispatchPanelEvent(s,{...e,status:d})}})});a.observe(t,{attributes:!0,attributeFilter:["status"]}),t._statusObserver=a}}},es=m.__exportAll({cdsPopoverWrap:()=>ns,cdsToggletipWrap:()=>as,cdsTooltipWrap:()=>ss}),ss={selector:"cds-tooltip",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-tooltip-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-tooltip-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},ns={selector:"cds-popover",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-popover-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-popover-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},as={selector:"cds-toggletip",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(s=>{s.forEach(a=>{if(a.attributeName==="open"){const o=t.hasAttribute("open");this.dispatchPanelEvent(e.event,{...e,action:o?"opened":"closed",open:o})}})});n.observe(t,{attributes:!0,attributeFilter:["open"]}),t._toggletipObserver=n}}},os=m.__exportAll({cdsCodeSnipWrap:()=>cs,cdsLinkWrap:()=>rs}),rs={selector:"cds-link",event:"click",getData:(t,e,n)=>({...e,href:n.getAttribute("href")})},cs={selector:"cds-code-snippet",event:"cds-copy-button-clicked",getData:(t,e)=>({...e,action:"copied"})},is=m.__exportAll({cdsBadgeIndicatorWrap:()=>fs,cdsFormGroupWrap:()=>ps,cdsFormItemWrap:()=>ds,cdsFormWrap:()=>ls,cdsHeadingWrap:()=>vs,cdsIconIndicatorWrap:()=>hs,cdsIconWrap:()=>gs,cdsLoadingWrap:()=>bs,cdsSectionWrap:()=>ms,cdsSkeletonPlaceholderWrap:()=>Ss,cdsSkeletonTextWrap:()=>Es,cdsStackWrap:()=>us}),ls={selector:"cds-form"},ds={selector:"cds-form-item"},ps={selector:"cds-form-group"},us={selector:"cds-stack"},vs={selector:"cds-heading"},ms={selector:"cds-section"},gs={selector:"cds-icon"},hs={selector:"cds-icon-indicator"},fs={selector:"cds-badge-indicator"},bs={selector:"cds-loading"},Es={selector:"cds-skeleton-text"},Ss={selector:"cds-skeleton-placeholder"};function h(t){return Object.values(t).filter(e=>typeof e=="object"&&e!==null&&e.selector)}var As=[...h(Bt),...h(Ct),...h(Mt),...h(jt),...h(Vt),...h(te),...h(ae),...h(ce),...h(le),...h(ve),...h(fe),...h(Ie),...h(xe),...h(Ne),...h(Re),...h(je),...h(Qe),...h(es),...h(os),...h(is)];function Ws(){const t=new Map;return As.forEach(e=>{t.set(e.selector,e)}),t}var Is=()=>import("@carbon/web-components/es/components/accordion/index.js"),R=()=>import("@carbon/web-components/es/components/breadcrumb/index.js"),Ps=()=>import("@carbon/web-components/es/components/stack/index.js"),ks=()=>import("@carbon/web-components/es/components/structured-list/index.js"),L=()=>import("@carbon/web-components/es/components/contained-list/index.js"),D=()=>import("@carbon/web-components/es/components/tile/index.js"),_s=()=>import("@carbon/web-components/es/components/tree-view/index.js"),Cs=()=>import("@carbon/web-components/es/components/link/index.js"),ys=()=>import("@carbon/web-components/es/components/tabs/index.js"),xs=()=>import("@carbon/web-components/es/components/content-switcher/index.js"),X=()=>import("@carbon/web-components/es/components/menu/index.js"),ws=()=>import("@carbon/web-components/es/components/overflow-menu/index.js"),H=()=>import("@carbon/web-components/es/components/button/index.js"),Y=()=>import("@carbon/web-components/es/components/icon-button/index.js"),Ds=()=>import("@carbon/web-components/es/components/combo-button/index.js"),Bs=()=>import("@carbon/web-components/es/components/copy-button/index.js"),Ns=()=>import("@carbon/web-components/es/components/checkbox/index.js"),Ms=()=>import("@carbon/web-components/es/components/radio-button/index.js"),Ts=()=>import("@carbon/web-components/es/components/toggle/index.js"),U=()=>import("@carbon/web-components/es/components/select/index.js"),qs=()=>import("@carbon/web-components/es/components/slider/index.js"),j=()=>import("@carbon/web-components/es/components/text-input/index.js"),Os=()=>import("@carbon/web-components/es/components/textarea/index.js"),zs=()=>import("@carbon/web-components/es/components/number-input/index.js"),Fs=()=>import("@carbon/web-components/es/components/password-input/index.js"),tt=()=>import("@carbon/web-components/es/components/search/index.js"),Rs=()=>import("@carbon/web-components/es/components/combo-box/index.js"),Ls=()=>import("@carbon/web-components/es/components/dropdown/index.js"),Hs=()=>import("@carbon/web-components/es/components/multi-select/index.js"),Us=()=>import("@carbon/web-components/es/components/date-picker/index.js"),js=()=>import("@carbon/web-components/es/components/time-picker/index.js"),Gs=()=>import("@carbon/web-components/es/components/file-uploader/index.js"),et=()=>import("@carbon/web-components/es/components/form/index.js"),$s=()=>import("@carbon/web-components/es/components/form-group/index.js"),Vs=()=>import("@carbon/web-components/es/components/data-table/index.js"),st=()=>import("@carbon/web-components/es/components/pagination/index.js"),Zs=()=>import("@carbon/web-components/es/components/code-snippet/index.js"),G=()=>import("@carbon/web-components/es/components/tag/index.js"),Js=()=>import("@carbon/web-components/es/components/badge-indicator/index.js"),$=()=>import("@carbon/web-components/es/components/notification/index.js"),Ks=()=>import("@carbon/web-components/es/components/loading/index.js"),Qs=()=>import("@carbon/web-components/es/components/inline-loading/index.js"),Xs=()=>import("@carbon/web-components/es/components/progress-bar/index.js"),Ys=()=>import("@carbon/web-components/es/components/progress-indicator/index.js"),tn=()=>import("@carbon/web-components/es/components/skeleton-placeholder/index.js"),en=()=>import("@carbon/web-components/es/components/skeleton-text/index.js"),P=()=>import("@carbon/web-components/es/components/modal/index.js"),k=()=>import("@carbon/web-components/es/components/tooltip/index.js"),sn=()=>import("@carbon/web-components/es/components/popover/index.js"),nn=()=>import("@carbon/web-components/es/components/toggle-tip/index.js"),nt=()=>import("@carbon/web-components/es/components/heading/index.js"),an=()=>import("@carbon/web-components/es/components/icon/index.js"),on=()=>import("@carbon/web-components/es/components/icon-indicator/index.js"),q={"cds-table":[k,H,j,tt,U,st,Vs],"cds-pagination":[U,j,st],"cds-button":[k,H],"cds-icon-button:not([data-toggle])":[k,Y],"cds-icon-button[data-toggle]":[k,Y],"cds-button[data-fab]":[k,H],"cds-copy-button":[k,Bs],"cds-combo-button":[k,Ds],"cds-checkbox":[Ns],"cds-radio-button-group":[Ms],"cds-toggle":[Ts],"cds-select":[U],"cds-slider":[qs],"cds-text-input":[j],"cds-textarea":[Os],"cds-number-input":[zs],"cds-password-input":[k,Fs],"cds-search":[tt],"cds-dropdown":[Ls],"cds-combo-box":[Rs],"cds-multi-select":[Hs],"cds-date-picker":[Us],"cds-time-picker":[js],"cds-file-uploader":[Gs],"cds-tabs":[ys],"cds-accordion":[Is],"cds-content-switcher":[xs],"cds-breadcrumb":[R],"cds-breadcrumb-item":[R],"cds-breadcrumb-link":[R],"cds-menu":[X],"cds-menu-button":[X],"cds-overflow-menu":[ws],"cds-structured-list":[ks],"cds-contained-list":[L],"cds-contained-list-item":[L],"cds-contained-list-description":[L],"cds-tree-view":[_s],"cds-modal":[P],"cds-modal-header":[P],"cds-modal-heading":[P],"cds-modal-label":[P],"cds-modal-close-button":[P],"cds-modal-body":[P],"cds-modal-body-content":[P],"cds-modal-footer":[P],"cds-modal-footer-button":[P],"cds-toast-notification":[$],"cds-inline-notification":[$],"cds-actionable-notification":[$],"cds-tile":[D],"cds-tile-group":[D],"cds-clickable-tile":[D],"cds-expandable-tile":[D],"cds-selectable-tile":[D],"cds-radio-tile":[D],"cds-progress-bar":[Xs],"cds-progress-indicator":[Ys],"cds-inline-loading":[Qs],"cds-tooltip":[k],"cds-popover":[sn],"cds-toggletip":[nn],"cds-tag":[G],"cds-dismissible-tag":[G],"cds-filter-tag":[G],"cds-link":[Cs],"cds-code-snippet":[Zs],"cds-form":[et],"cds-form-item":[et],"cds-form-group":[$s],"cds-stack":[Ps],"cds-heading":[nt],"cds-section":[nt],"cds-icon":[an],"cds-icon-indicator":[on],"cds-badge-indicator":[Js],"cds-loading":[Ks],"cds-skeleton-text":[en],"cds-skeleton-placeholder":[tn]};function rn(t){const e=new Map;if(!t||!(t instanceof Element))return e;for(const s of Object.keys(T))e.set(s,[]);for(const[s]of Object.entries(T))t.matches(s)&&e.get(s).push(t);const n=t.querySelectorAll("*");for(const s of n)for(const[a]of Object.entries(T))s.matches(a)&&e.get(a).push(s);for(const[s,a]of e.entries())a.length===0&&e.delete(s);return e}function cn(t){const e=new Set;for(const[n,s]of t.entries())s.length>0&&q[n]&&q[n].forEach(a=>e.add(a));return e}async function ln(t,e){if(t.size===0)return;const n=Array.from(t).map(async s=>(e.has(s)||e.set(s,s()),e.get(s)));await Promise.all(n)}function dn(t,e){let n=0;for(const[s,a]of t.entries()){const o=T[s];a.forEach(r=>{if(o.init){o.init.call(e,r);return}if(o.multiEvent){const A=c.getSemanticAttributes(r);o.events.forEach(W=>{const x=c.getEventAttribute(r,W.attrName,"event");x&&e.listen(r,W.type,O=>{e.dispatchPanelEvent(x,W.getData(O,A,r))})});return}const d=c.getSemanticAttributes(r),u=d.event;u&&e.listen(r,o.event,A=>{A.stopPropagation();const W=o.getData(A,d,r),x=W._eventOverride||u;delete W._eventOverride,e.dispatchPanelEvent(x,W)})}),n+=a.length}return n}var T=Object.fromEntries(Ws()),pn=async function(t,e){const n=rn(t);if(n.size===0){this.debugMe("[Carbon] No Carbon components found in panel");return}this.carbonComponents||(this.carbonComponents=new Map);for(const[o,r]of n.entries())this.carbonComponents.set(o,r);const s=cn(n);if(s.size>0)try{await ln(s,e)}catch(o){console.error("[Carbon] Failed to load some component modules:",o)}const a=dn(n,this);a>0&&this.debugMe(`[Carbon] Total components initialized: ${a}`)},un=(t={})=>{const{preload:e=[]}=t,n=new Map;if(e.length>0){const s=e.filter(o=>q[o]?!0:(console.warn(`[Carbon] No import found for selector: ${o}`),!1)),a=s.flatMap(o=>q[o].map(r=>(n.has(r)||n.set(r,r()),n.get(r))));Promise.all(a).then(()=>console.debug(`[Carbon] Preloaded: ${s.join(", ")}`)).catch(o=>console.warn("[Carbon] Preload error:",o))}m.ComponentLibraryRegistry.register("carbon",{cache:n,render:async function(s,a){try{await pn.call(this,s,a)}catch(o){console.error("[Carbon] Initialization error:",o)}},dispose:function(s){},config:{version:"2.0",description:"IBM Carbon Design System Web Components"}}),console.debug("[Zooy] Carbon Design System library registered")};exports.registerCarbonLibrary=un;
1
+ var St=Object.create;var K=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var kt=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Wt(e))!Pt.call(t,a)&&a!==n&&K(t,a,{get:()=>e[a],enumerable:!(s=At(e,a))||s.enumerable});return t};var l=(t,e,n)=>(n=t!=null?St(It(t)):{},kt(e||!t||!t.__esModule?K(n,"default",{value:t,enumerable:!0}):n,t));const m=require("./component-library-registry-BBQV6Kpv.js"),c=require("./zoo-B8_zFikt.js");let at=require("badu"),B=require("ramda");B=m.__toESM(B);let _t=require("@carbon/web-components/lib/components/data-table/defs.js");var Ct=m.__exportAll({cdsTableWrap:()=>Dt}),Q=(t,e,n)=>{const s=customElements.get("cds-table"),a=customElements.get("cds-pagination"),o=customElements.get(s.selectorTableBatchActions);customElements.get("cds-popover");const r=e.dataBinder,d=e.pagination,u=e.skeleton,A=e.querySelector(s.selectorTableToolbarSearch),W=e.querySelector(s.selectorTableBatchActions),x=e.querySelector(s.selectorTableBody),O=["button","a","input","select","textarea",'[role="button"]',".cds--table-expand",".cds--table-column-checkbox"].join(","),V=e.querySelectorAll(s.selectorHeaderCell+"[is-sortable]"),ot=e.isSortable||V.length>0,z=Symbol(),F=Symbol(),w=new Map,rt=i=>{t.listen(e,"click",p=>{const v=p.target.closest(s.selectorTableRow);if(!v||p.composedPath().some(f=>f.matches&&f.matches(O)))return;p.stopPropagation();const g=c.getSemanticAttributes(v);t.dispatchPanelEvent(i,{...g})})},ct=i=>{t.listen(e,s.eventExpandoToggle,p=>{const v=p.target,g=v.tagName==="CDS-TABLE-HEADER-ROW",f=p.detail.expanded,E={tableAttrs:n,...c.getSemanticAttributes(v),target:v,allRows:g,didExpand:f};t.dispatchPanelEvent(i,E)})},it=i=>{w.set(z,p=>{t.dispatchPanelEvent(i,p)})},lt=i=>{w.set(F,p=>{const v=p.detail.selectedRows,g=Math.min(v.length,W.totalRowsCount),f=p.target,E=c.getSemanticAttributes(f),I=v.map(c.getSemanticAttributes),_={tableAttrs:n,...E,target:f,selectCount:g,selection:I};t.dispatchPanelEvent(i,_)})},dt=i=>{t.listen(e,s.eventTableRowSelect,p=>{const v=p.target,g=p.detail.selectedRows||[],f=g.length,E=g.map(c.getSemanticAttributes),I={tableAttrs:n,...c.getSemanticAttributes(v),selectCount:f,selection:E,target:v};t.dispatchPanelEvent(i,I)})},pt=()=>{t.listen(e,s.eventBeforeSort,i=>{const p=i.target,v=i.detail.oldSortDirection,g=i.detail.sortDirection,f=c.getSemanticAttributes(p),E=f.sortField,I=g===_t.TABLE_SORT_DIRECTION.DESCENDING?`-${E}`:E;i.cancelBubble=!0,i.stopPropagation(),i.preventDefault(),x.innerHTML="",u&&u.show(),V.forEach((C,b)=>{C===p?(C.setAttribute("sort-active","true"),C.setAttribute("sort-direction",g)):(C.removeAttribute("sort-active"),C.setAttribute("sort-direction","none"))});const _={ordering:I};r.fetchData(_).then(()=>{d.setData(r),u&&u.hide()}),w.has(z)&&w.get(z)({tableAttrs:n,...f,sortNow:g,sortWas:v,sortField:E,ordering:I,target:p})})},ut=()=>{t.listen(e,s.eventTableRowSelectAll,i=>{i.detail.selectedRows.length===0&&e.querySelectorAll(s.selectorTableRow).forEach(p=>{p.disabled=!1,p.selected=!1}),w.has(F)&&w.get(F)(i)})},vt=()=>{t.listen(e,s.eventBeforeChangeSelectionAll,i=>{i.stopPropagation(),i.detail.callback&&i.detail.callback()})},mt=i=>{const p=e.querySelector("cds-table-header-row");t.listen(i,o.eventClickSelectAll,v=>{v.stopPropagation(),p.dispatchEvent(new CustomEvent(s.eventBeforeChangeSelectionAll,{bubbles:!0,cancelable:!0,composed:!0,detail:{selected:!0,callback:()=>{i.selectedRowsCount=i.totalRowsCount,e.querySelectorAll(s.selectorTableRow).forEach(g=>{g.disabled=!0})}}}))})},gt=i=>{t.listen(i,"keydown",p=>{if(p.key==="Enter"){u&&u.show(),d.totalItems=0,e.querySelector("cds-table-body").replaceChildren();const v={search:i.value||"",offset:0};r.fetchData(v).then(()=>{d.setData(r),u&&u.hide()})}})},ht=i=>{t.listen(i,s.eventSearchInput,p=>{if((p.detail.value||"")===""){const v={search:"",offset:0};u&&u.show(),r.fetchData(v).then(()=>{u&&u.hide(),d.setData(r)})}})},ft=i=>{i.caret=!1;const p=i.querySelector("cds-icon-button, button:not([slot])"),v=i.querySelectorAll("cds-checkbox"),g=i.querySelectorAll("cds-modal-footer-button"),f=[...i.querySelectorAll("cds-checkbox-group")].map(c.getSemanticAttributes).map(B.pathOr("noop",["zoo","filter","field"])).reduce((b,S)=>(b[S]=null,b),{offset:0});if(!p||!g){console.error("Improperly configured Batch Filter popover");return}new MutationObserver(()=>{i.classList.toggle("cds--overflow-menu--open",i.open)}).observe(i,{attributes:!0,attributeFilter:["open"]});const E=Symbol(),I=Symbol(),_=[...g].reduce((b,S,y)=>(S.hasAttribute("reset-filter")&&b.set(E,S),S.hasAttribute("apply-filter")&&b.set(I,S),b),new Map),C=()=>{const b=new Map;return v.forEach(S=>{const y=S.getAttribute("id");if(!y||!y.includes(":"))return;const[N,M]=y.split(":");b.has(N)||b.set(N,[]),S.checked&&b.get(N).push(M)}),b};if(_.has(E)){const b=S=>S.checked=!1;t.listen(_.get(E),"click",S=>{S.stopPropagation(),v.forEach(b),u&&u.show(),r.fetchData(f).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})})}_.has(I)&&t.listen(_.get(I),"click",b=>{b.stopPropagation();const S=[...C()].reduce((y,[N,M])=>(y[N]=Array.isArray(M)&&M.length===0?null:M,y),{offset:0});u&&u.show(),r.fetchData(S).then(()=>{d&&d.setData(r),u&&u.hide(),i.open=!1})}),t.listen(p,"click",b=>{b.stopPropagation(),i.open=!i.open,i.classList.toggle("cds--overflow-menu--open",i.open)})},bt=()=>{t.listen(d,a.eventPageSizeChanged,i=>{const p={limit:d.pageSize,offset:0};r.fetchData(p).then(()=>{d.setData(r)})})},Et=()=>{let i=null;t.listen(d,a.eventChangeCurrent,p=>{const{page:v}=p.detail,g=d.pageSize,f=(v-1)*g;if(f!==i){i=f;const E={limit:g,offset:f};r.fetchData(E).then(()=>{d.setData(r),u&&u.hide()})}})};r&&d&&(bt(),Et()),r&&A&&(gt(A),ht(A));const Z=e.querySelector(s.selectorTableToolbarContent);if(Z){const i=Z.querySelectorAll("cds-popover[data-batch-filter]");r&&i&&i.forEach(ft)}e.isSelectable&&(ut(),vt(),W&&mt(W)),r&&ot&&pt();const J={zoo:{event:{row:{click:rt,expand:ct,check:{one:dt,all:lt}},column:{sort:it}}}};(0,at.objToPaths)(n).forEach(([i,p])=>{B.hasPath(i,J)&&B.path(i,J)(p)})},yt=t=>{const e=document.createElement("cds-pagination");return e.backwardText="Previous page",e.forwardText="Next page",e.itemsPerPageText="Items per page:",e.pageSize=t.limit,e.size="lg",[10,25,50,100,500].forEach(n=>{const s=document.createElement("cds-select-item");s.value=n.toString(),s.textContent=n.toString(),e.appendChild(s)}),e.setData=n=>{if(n.isPaginated){const{count:s}=B.pick(["count"],n.data);e.pagesUnknown=Math.ceil(s/n.limit)>100,e.totalItems=s,e.pagesUnknown?e.formatStatusWithIndeterminateTotal=({start:a,end:o})=>`${a}–${o} of ${s} item${s<=1?"":"s"}`:delete e.formatStatusWithIndeterminateTotal}},e},xt=t=>{if(!t.parentNode){console.error("[Carbon Table] Cannot create skeleton: table has no parent node");return}const e=!!t.querySelector("cds-table-header-title"),n=!!t.querySelector("cds-table-header-description"),s=!!t.querySelector("cds-table-toolbar"),a=[...t.querySelectorAll("cds-table-header-cell")].length,o=t.hasAttribute("zebra"),r=t.getAttribute("size"),d=document.createElement("cds-table-skeleton");d.showHeader=e||n,d.showToolbar=s,d.zebra=o,d.columnCount=a,d.size=r,d.show=()=>d.classList.remove("hidden"),d.hide=()=>d.classList.add("hidden");const u=document.createElement("div");return u.classList.add("zoo-datatable-skeleton-wrapper"),t.parentNode.insertBefore(u,t),u.appendChild(d),u.appendChild(t),d},wt=(t,e)=>{const n=e.getAttribute("zoo-url-api"),s=parseInt(e.getAttribute("data-page-size")||25,10);if(n)return new c.Binder(t,n,e,{urlParams:{limit:s}})},Dt={selector:"cds-table",init:function(t){const e=c.getSemanticAttributes(t),n=this,s=wt(n,t);if((0,at.isDefAndNotNull)(s)){t.dataBinder=s;const a=xt(t);t.skeleton=a;const o=yt(s);t.pagination=o,t.after(o),s.fetchData().then(r=>{a.hide(),o.setData(s),Q(n,t,e)})}else Q(n,t,e)}},Bt=m.__exportAll({cdsPaginationWrap:()=>Nt}),Nt={selector:"cds-pagination",init:function(t){const e=this,n=customElements.get("cds-pagination");let s=null;e.listen(t,n.eventChangeCurrent,a=>{const o=a.detail.page,r=t.pageSize,d=(o-1)*r;d!==s&&(s=d,e.dispatchPanelEvent("pagination-changed-current",{detail:{page:o,pageSize:r,action:"page-change"}}))}),e.listen(t,n.eventPageSizeChanged,a=>{const o=t.pageSize;s=null,e.dispatchPanelEvent("pagination-changed-page-size",{detail:{page:1,pageSize:o,action:"page-size-change"}})})}},Mt=m.__exportAll({cdsModalBodyContentWrap:()=>Lt,cdsModalBodyWrap:()=>Rt,cdsModalCloseButWrap:()=>Ft,cdsModalFooterButWrap:()=>Ut,cdsModalFooterWrap:()=>Ht,cdsModalHeaderWrap:()=>qt,cdsModalHeadingWrap:()=>Ot,cdsModalLabelWrap:()=>zt,cdsModalWrap:()=>Tt}),Tt={selector:"cds-modal",init:function(t){const e=customElements.get("cds-modal"),n=c.getSemanticAttributes(t),s=c.getEventAttribute(t,"open-event","event");s&&this.listen(t,"cds-modal-beingopened",r=>{this.dispatchPanelEvent(s,{...n,action:"opened"})});const a=t.getAttribute("before-close-event");a&&this.listen(t,e.eventBeforeClose,r=>{this.dispatchPanelEvent(a,{...n,action:"closing",cancelable:!0})}),this.listen(t,e.eventClose,r=>{this.dispatchPanelEvent("destroy_me",{...n,action:"closed",triggeredBy:r.detail?.triggeredBy})});const o=c.getEventAttribute(t,"primary-event","event");o&&this.listen(t,"cds-modal-primary-focus",r=>{this.dispatchPanelEvent(o,{...n,action:"primary"})})}},qt={selector:"cds-modal-header"},Ot={selector:"cds-modal-heading"},zt={selector:"cds-modal-label"},Ft={selector:"cds-modal-close-button"},Rt={selector:"cds-modal-body"},Lt={selector:"cds-modal-body-content"},Ht={selector:"cds-modal-footer"},Ut={selector:"cds-modal-footer-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,e)})}},jt=m.__exportAll({cdsMenuButtonWrap:()=>$t,cdsMenuWrap:()=>Gt}),Gt={selector:"cds-menu",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-menu-opened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-menu-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})}),this.listen(t,"click",a=>{if(a.target.tagName==="CDS-MENU-ITEM"){const o=c.getSemanticAttributes(a.target),r=o.event||e.event;r&&(a.stopPropagation(),this.dispatchPanelEvent(r,{...e,...o}))}}),this.listen(t,"cds-item-changed",a=>{const o=a.detail.triggeredBy,r=c.getSemanticAttributes(o),d=r.event||e.event;d&&this.dispatchPanelEvent(d,{...e,...r,action:"selection-changed"})})}},$t={selector:"cds-menu-button",init:function(t){const e=c.getSemanticAttributes(t),n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||e.event;o&&(s.stopPropagation(),this.dispatchPanelEvent(o,{...e,...a}))}})}},Vt=m.__exportAll({cdsButFabWrap:()=>Qt,cdsButtonWrap:()=>Zt,cdsComboButWrap:()=>Yt,cdsCopyButWrap:()=>Xt,cdsIconButToggleWrap:()=>Kt,cdsIconButWrap:()=>Jt}),Zt={selector:"cds-button",init:function(t){const e=c.getSemanticAttributes(t);if(t.getAttribute("type")==="submit"){this.listen(t,"click",s=>{let a=t.closest("form");if(!a){const o=t.getAttribute("form");o&&(a=document.getElementById(o))}a&&a.requestSubmit()});return}const n=e.event;n&&this.listen(t,"click",s=>{s.stopPropagation(),this.dispatchPanelEvent(n,c.getSemanticAttributes(t))})}},Jt={selector:"cds-icon-button:not([data-toggle])",event:"click",getData:(t,e)=>e},Kt={selector:"cds-icon-button[data-toggle]",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",n=>{n.stopPropagation(),t.isSelected=!t.isSelected,this.dispatchPanelEvent(e.event,{...e,isOn:t.isSelected})})}},Qt={selector:"cds-button[data-fab]",event:"click",getData:(t,e)=>e},Xt={selector:"cds-copy-button",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"click",a=>{a.stopPropagation(),this.dispatchPanelEvent(n,{...e,action:"copy"})});const s=t.getAttribute("success-event");if(s){const a=new MutationObserver(()=>{t.hasAttribute("feedback-shown")&&this.dispatchPanelEvent(s,{...e,action:"copied"})});a.observe(t,{attributes:!0,attributeFilter:["feedback-shown"]}),t._copyObserver=a}}},Yt={selector:"cds-combo-button",init:function(t){const e=c.getSemanticAttributes(t);e.event&&this.listen(t,"click",s=>{const a=s.composedPath(),o=a.some(d=>d.tagName==="CDS-MENU-ITEM"),r=a.some(d=>d.tagName==="CDS-ICON-BUTTON");!o&&!r&&(s.stopPropagation(),this.dispatchPanelEvent(e.event,{...e,action:"primary"}))});const n=t.querySelector("cds-menu");n&&this.listen(n,"click",s=>{if(s.target.tagName==="CDS-MENU-ITEM"){const a=c.getSemanticAttributes(s.target),o=a.event||c.getEventAttribute(t,"menu-event","event");o&&this.dispatchPanelEvent(o,{...e,...a,action:"menu-item"})}})}},te=m.__exportAll({cdsComboBoxWrap:()=>se,cdsDropdownWrap:()=>ee,cdsMultiSelectWrap:()=>ne}),ee={selector:"cds-dropdown",init:function(t){const e=customElements.get("cds-dropdown"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:o.detail?.item?.value,selectedText:o.detail?.item?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},se={selector:"cds-combo-box",init:function(t){const e=customElements.get("cds-combo-box"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=o.detail?.item;this.dispatchPanelEvent(s,{...n,value:t.value,selectedValue:r?.value,selectedText:r?.textContent?.trim()})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ne={selector:"cds-multi-select",init:function(t){const e=customElements.get("cds-multi-select"),n=c.getSemanticAttributes(t),s=n.event;s&&this.listen(t,e.eventSelect,o=>{const r=t.value?t.value.split(","):[];this.dispatchPanelEvent(s,{...n,selectedItems:r})});const a=t.getAttribute("toggle-event");a&&this.listen(t,e.eventToggle,o=>{this.dispatchPanelEvent(a,{...n,open:t.hasAttribute("open")})})}},ae=m.__exportAll({cdsDatePickerWrap:()=>oe,cdsTimePickerWrap:()=>re}),oe={selector:"cds-date-picker",init:function(t){const e=customElements.get("cds-date-picker"),n=c.getSemanticAttributes(t),s=t.querySelector('cds-date-picker-input[kind="from"]'),a=t.querySelector('cds-date-picker-input[kind="to"]'),o=s&&a,r=n.event;r&&this.listen(t,e.eventChange,u=>{let A;o?A={from:s.value||"",to:a.value||""}:A=t.value,this.dispatchPanelEvent(r,{...n,value:A})});const d=t.getAttribute("error-event");d&&this.listen(t,e.eventFlatpickrError,u=>{this.dispatchPanelEvent(d,{...n,error:u.detail})})}},re={selector:"cds-time-picker",event:"cds-time-picker-changed",getData:(t,e,n)=>({...e,value:n.value})},ce=m.__exportAll({cdsFileUploaderWrap:()=>ie}),ie={selector:"cds-file-uploader",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const a=t.querySelector('input[type="file"]');a&&this.listen(a,"change",o=>{this.dispatchPanelEvent(n,{...e,files:Array.from(o.target.files||[])})})}const s=t.getAttribute("delete-event");s&&this.listen(t,"cds-file-uploader-item-deleted",a=>{this.dispatchPanelEvent(s,{...e,fileName:a.detail?.fileName,fileId:a.detail?.fileId})})}},le=m.__exportAll({cdsAccordionWrap:()=>pe,cdsContentSwitcherWrap:()=>ue,cdsTabsWrap:()=>de}),de={selector:"cds-tabs",init:function(t){const e=customElements.get("cds-tabs"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,tabValue:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,tabValue:o.detail.value})})}},pe={selector:"cds-accordion",init:function(t){const e=customElements.get("cds-accordion-item"),n=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-accordion-item")].forEach(s=>{const a=c.getSemanticAttributes(s),o=a.event||n.event;o&&this.listen(s,e.eventToggle,r=>{this.dispatchPanelEvent(o,{...n,...a,open:r.detail.open})})})}},ue={selector:"cds-content-switcher",init:function(t){const e=customElements.get("cds-content-switcher"),n=c.getSemanticAttributes(t),s=t.getAttribute("before-select-event");s&&this.listen(t,e.eventBeforeSelect,o=>{this.dispatchPanelEvent(s,{...n,value:o.detail.value,cancelable:!0})});const a=n.event;a&&this.listen(t,e.eventSelect,o=>{const r=o.detail.item,d=c.getSemanticAttributes(r);this.dispatchPanelEvent(a,{...n,...d,value:r.getAttribute("value")})})}},ve=m.__exportAll({cdsBreadCrumbWrap:()=>he,cdsBreadcrumbItemWrap:()=>me,cdsBreadcrumbLinkWrap:()=>ge}),me={selector:"cds-breadcrumb-item"},ge={selector:"cds-breadcrumb-link",event:"click",getData:(t,e,n)=>(t.preventDefault(),{...e,href:n.getAttribute("href")})},he={selector:"cds-breadcrumb",init:function(t){const e=this,n=c.getSemanticAttributes(t),s=n.event;if(s){const a=r=>{e.dispatchPanelEvent(s,{...n,...r})};e.listen(t,"click",r=>{const d=r.target.closest("cds-breadcrumb-link");d&&(r.preventDefault(),r.stopPropagation(),a(c.getSemanticAttributes(d)))});const o=t.querySelector("cds-overflow-menu-body");o&&e.listen(o,"cds-overflow-menu-item-clicked",r=>{r.stopPropagation(),a(c.getSemanticAttributes(r.target))})}}},fe=m.__exportAll({cdsNumberInputWrap:()=>Se,cdsPasswordInputWrap:()=>Ae,cdsSearchWrap:()=>We,cdsTextAreaWrap:()=>Ee,cdsTextInputWrap:()=>be}),be={selector:"cds-text-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Ee={selector:"cds-textarea",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},Se={selector:"cds-number-input",event:"cds-number-input",getData:(t,e,n)=>({...e,value:t.detail.value,direction:t.detail.direction})},Ae={selector:"cds-password-input",multiEvent:!0,events:[{type:"input",attrName:"event",getData:(t,e)=>({...e,value:t.currentTarget.value})},{type:"change",attrName:"change-event",getData:(t,e)=>({...e,value:t.currentTarget.value})}]},We={selector:"cds-search",event:"cds-search-input",getData:(t,e,n)=>({...e,value:n.value})},Ie=m.__exportAll({cdsCheckboxWrap:()=>Pe,cdsRadioButGroupWrap:()=>ke,cdsSelectWrap:()=>Ce,cdsSliderWrap:()=>ye,cdsToggleWrap:()=>_e}),Pe={selector:"cds-checkbox",event:"cds-checkbox-changed",getData:(t,e,n)=>({...e,checked:t.detail.checked,value:n.value})},ke={selector:"cds-radio-button-group",event:"cds-radio-button-group-changed",getData:(t,e)=>({...e,value:t.detail?.value})},_e={selector:"cds-toggle",event:"cds-toggle-changed",getData:(t,e)=>({...e,isOn:t.detail.checked,value:t.detail.checked})},Ce={selector:"cds-select",event:"cds-select-selected",getData:(t,e)=>({...e,value:t.detail.value})},ye={selector:"cds-slider",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-slider-changed",a=>{this.dispatchPanelEvent(n,{...e,value:a.detail.value})});const s=t.getAttribute("input-event");s&&this.listen(t,"cds-slider-input-changed",a=>{this.dispatchPanelEvent(s,{...e,value:a.detail.value})})}},xe=m.__exportAll({cdsFilterTagWrap:()=>Be,cdsSDismissibleTagWrap:()=>De,cdsTagsWrap:()=>we}),we={selector:"cds-tag",event:"click",getData:(t,e)=>e},De={selector:"cds-dismissible-tag",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("click-event");n&&this.listen(t,"click",a=>{a.target.closest("button")||this.dispatchPanelEvent(n,{...e})});const s=e.event;s&&this.listen(t,"cds-dismissible-tag-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},Be={selector:"cds-filter-tag",event:"cds-filter-tag-closed",getData:(t,e)=>({...e,action:"remove"})},Ne=m.__exportAll({cdsContainedListDescriptionWrap:()=>Oe,cdsContainedListItemWrap:()=>ze,cdsContainedListWrap:()=>qe,cdsOverflowMenuWrap:()=>Me,cdsStructuredListWrap:()=>Te,cdsTreeViewWrap:()=>Fe}),Me={selector:"cds-overflow-menu",init:function(t){const e=c.getSemanticAttributes(t),n=e.event,s=t.querySelector("cds-overflow-menu-body");n&&s&&this.listen(s,"cds-overflow-menu-item-clicked",a=>{a.stopPropagation();const o=c.getSemanticAttributes(a.target);this.dispatchPanelEvent(n,{...e,...o})})}},Te={selector:"cds-structured-list",init:function(t){const e=c.getSemanticAttributes(t);[...t.querySelectorAll("cds-structured-list-row")].forEach(n=>{const s=c.getSemanticAttributes(n),a=s.event||e.event;a&&this.listen(n,"click",o=>{o.stopPropagation(),this.dispatchPanelEvent(a,{...e,...s})})}),t.hasAttribute("selection")&&this.listen(t,"cds-structured-list-selected",n=>{const s=n.detail.row,a=c.getSemanticAttributes(s),o=e.event;o&&this.dispatchPanelEvent(o,{...e,...a})})}},qe={selector:"cds-contained-list"},Oe={selector:"cds-contained-list-description"},ze={selector:"cds-contained-list-item",event:"cds-contained-list-item-click",getData:(t,e)=>e},Fe={selector:"cds-tree-view",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-tree-node-selected",s=>{const a=s.detail.node,o=c.getSemanticAttributes(a),r=o.event||e.event;r&&this.dispatchPanelEvent(r,{...e,...o,nodeId:a.id,label:a.getAttribute("label")})});const n=c.getEventAttribute(t,"expand-event");n&&this.listen(t,"cds-tree-node-expanded",s=>{this.dispatchPanelEvent(n,{...e,nodeId:s.detail.node.id,expanded:s.detail.expanded})})}},Re=m.__exportAll({cdsActionableNotificationWrap:()=>Ue,cdsInlineNotificationWrap:()=>He,cdsToastNotificationWrap:()=>Le}),Le={selector:"cds-toast-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},He={selector:"cds-inline-notification",event:"cds-notification-closed",getData:(t,e)=>({...e,action:"closed"})},Ue={selector:"cds-actionable-notification",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"close-event","event");n&&this.listen(t,"cds-notification-closed",a=>{this.dispatchPanelEvent(n,{...e,action:"closed"})});const s=c.getEventAttribute(t,"action-event");s&&this.listen(t,"cds-notification-actioned",a=>{this.dispatchPanelEvent(s,{...e,action:"actioned"})})}},je=m.__exportAll({cdsClickableTileWrap:()=>$e,cdsExpandableTileWrap:()=>Ve,cdsRadioTileWrap:()=>Je,cdsSelectableTileWrap:()=>Ze,cdsTileGroupWrap:()=>Ke,cdsTileWrap:()=>Ge}),Ge={selector:"cds-tile"},$e={selector:"cds-clickable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;if(n){const s=e.href||t.getAttribute("href")||"";t.removeAttribute("href"),t.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this.dispatchPanelEvent(n,{...e,href:s})},!0)}}},Ve={selector:"cds-expandable-tile",init:function(t){const e=c.getSemanticAttributes(t),n=t.getAttribute("before-toggle-event");n&&this.listen(t,"cds-expandable-tile-beingtoggled",a=>{this.dispatchPanelEvent(n,{...e,expanded:a.detail.expanded,cancelable:!0})});const s=e.event;s&&this.listen(t,"cds-expandable-tile-toggled",a=>{this.dispatchPanelEvent(s,{...e,expanded:a.detail.expanded})})}},Ze={selector:"cds-selectable-tile",event:"cds-selectable-tile-changed",getData:(t,e,n)=>({...e,selected:t.detail.selected,value:n.value})},Je={selector:"cds-radio-tile",event:"cds-radio-tile-selected",getData:(t,e,n)=>({...e,selected:t.detail.selected,name:t.detail.name,value:n.value})},Ke={selector:"cds-tile-group",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&(this.listen(t,"cds-current-radio-tile-selection",s=>{const a=s.detail.target;this.dispatchPanelEvent(n,{...e,value:a?.value,name:a?.name,selected:a?.selected})}),this.listen(t,"cds-current-selectable-tile-selections",s=>{const a=s.detail.currentSelections||[];this.dispatchPanelEvent(n,{...e,values:a.map(o=>o.value),names:a.map(o=>o.name),count:a.length})}))}},Qe=m.__exportAll({cdsInlineLoadingWrap:()=>ts,cdsProgressBarWrap:()=>Xe,cdsProgressIndicatorWrap:()=>Ye}),Xe={selector:"cds-progress-bar",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(()=>{const s=parseFloat(t.getAttribute("value")||"0");s>=parseFloat(t.getAttribute("max")||"100")&&this.dispatchPanelEvent(e.event,{...e,value:s,status:"complete"})});n.observe(t,{attributes:!0,attributeFilter:["value"]}),t._progressObserver=n}}},Ye={selector:"cds-progress-indicator",init:function(t){const e=c.getSemanticAttributes(t);this.listen(t,"cds-progress-step-click",n=>{const s=n.target,a=c.getSemanticAttributes(s),o=a.event||e.event;o&&this.dispatchPanelEvent(o,{...e,...a,stepIndex:s.getAttribute("data-index"),stepLabel:s.getAttribute("label")})})}},ts={selector:"cds-inline-loading",init:function(t){const e=c.getSemanticAttributes(t),n=e.event;n&&this.listen(t,"cds-inline-loading-onsuccess",a=>{this.dispatchPanelEvent(n,{...e,status:"finished"})});const s=t.getAttribute("status-event");if(s){const a=new MutationObserver(o=>{o.forEach(r=>{if(r.attributeName==="status"){const d=t.getAttribute("status");this.dispatchPanelEvent(s,{...e,status:d})}})});a.observe(t,{attributes:!0,attributeFilter:["status"]}),t._statusObserver=a}}},es=m.__exportAll({cdsPopoverWrap:()=>ns,cdsToggletipWrap:()=>as,cdsTooltipWrap:()=>ss}),ss={selector:"cds-tooltip",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-tooltip-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-tooltip-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},ns={selector:"cds-popover",init:function(t){const e=c.getSemanticAttributes(t),n=c.getEventAttribute(t,"open-event");n&&this.listen(t,"cds-popover-beingopened",a=>{this.dispatchPanelEvent(n,{...e,action:"opened"})});const s=c.getEventAttribute(t,"close-event");s&&this.listen(t,"cds-popover-closed",a=>{this.dispatchPanelEvent(s,{...e,action:"closed"})})}},as={selector:"cds-toggletip",init:function(t){const e=c.getSemanticAttributes(t);if(e.event){const n=new MutationObserver(s=>{s.forEach(a=>{if(a.attributeName==="open"){const o=t.hasAttribute("open");this.dispatchPanelEvent(e.event,{...e,action:o?"opened":"closed",open:o})}})});n.observe(t,{attributes:!0,attributeFilter:["open"]}),t._toggletipObserver=n}}},os=m.__exportAll({cdsCodeSnipWrap:()=>cs,cdsLinkWrap:()=>rs}),rs={selector:"cds-link",event:"click",getData:(t,e,n)=>({...e,href:n.getAttribute("href")})},cs={selector:"cds-code-snippet",event:"cds-copy-button-clicked",getData:(t,e)=>({...e,action:"copied"})},is=m.__exportAll({cdsBadgeIndicatorWrap:()=>fs,cdsFormGroupWrap:()=>ps,cdsFormItemWrap:()=>ds,cdsFormWrap:()=>ls,cdsHeadingWrap:()=>vs,cdsIconIndicatorWrap:()=>hs,cdsIconWrap:()=>gs,cdsLoadingWrap:()=>bs,cdsSectionWrap:()=>ms,cdsSkeletonPlaceholderWrap:()=>Ss,cdsSkeletonTextWrap:()=>Es,cdsStackWrap:()=>us}),ls={selector:"cds-form"},ds={selector:"cds-form-item"},ps={selector:"cds-form-group"},us={selector:"cds-stack"},vs={selector:"cds-heading"},ms={selector:"cds-section"},gs={selector:"cds-icon"},hs={selector:"cds-icon-indicator"},fs={selector:"cds-badge-indicator"},bs={selector:"cds-loading"},Es={selector:"cds-skeleton-text"},Ss={selector:"cds-skeleton-placeholder"};function h(t){return Object.values(t).filter(e=>typeof e=="object"&&e!==null&&e.selector)}var As=[...h(Bt),...h(Ct),...h(Mt),...h(jt),...h(Vt),...h(te),...h(ae),...h(ce),...h(le),...h(ve),...h(fe),...h(Ie),...h(xe),...h(Ne),...h(Re),...h(je),...h(Qe),...h(es),...h(os),...h(is)];function Ws(){const t=new Map;return As.forEach(e=>{t.set(e.selector,e)}),t}var Is=()=>import("@carbon/web-components/es/components/accordion/index.js"),R=()=>import("@carbon/web-components/es/components/breadcrumb/index.js"),Ps=()=>import("@carbon/web-components/es/components/stack/index.js"),ks=()=>import("@carbon/web-components/es/components/structured-list/index.js"),L=()=>import("@carbon/web-components/es/components/contained-list/index.js"),D=()=>import("@carbon/web-components/es/components/tile/index.js"),_s=()=>import("@carbon/web-components/es/components/tree-view/index.js"),Cs=()=>import("@carbon/web-components/es/components/link/index.js"),ys=()=>import("@carbon/web-components/es/components/tabs/index.js"),xs=()=>import("@carbon/web-components/es/components/content-switcher/index.js"),X=()=>import("@carbon/web-components/es/components/menu/index.js"),ws=()=>import("@carbon/web-components/es/components/overflow-menu/index.js"),H=()=>import("@carbon/web-components/es/components/button/index.js"),Y=()=>import("@carbon/web-components/es/components/icon-button/index.js"),Ds=()=>import("@carbon/web-components/es/components/combo-button/index.js"),Bs=()=>import("@carbon/web-components/es/components/copy-button/index.js"),Ns=()=>import("@carbon/web-components/es/components/checkbox/index.js"),Ms=()=>import("@carbon/web-components/es/components/radio-button/index.js"),Ts=()=>import("@carbon/web-components/es/components/toggle/index.js"),U=()=>import("@carbon/web-components/es/components/select/index.js"),qs=()=>import("@carbon/web-components/es/components/slider/index.js"),j=()=>import("@carbon/web-components/es/components/text-input/index.js"),Os=()=>import("@carbon/web-components/es/components/textarea/index.js"),zs=()=>import("@carbon/web-components/es/components/number-input/index.js"),Fs=()=>import("@carbon/web-components/es/components/password-input/index.js"),tt=()=>import("@carbon/web-components/es/components/search/index.js"),Rs=()=>import("@carbon/web-components/es/components/combo-box/index.js"),Ls=()=>import("@carbon/web-components/es/components/dropdown/index.js"),Hs=()=>import("@carbon/web-components/es/components/multi-select/index.js"),Us=()=>import("@carbon/web-components/es/components/date-picker/index.js"),js=()=>import("@carbon/web-components/es/components/time-picker/index.js"),Gs=()=>import("@carbon/web-components/es/components/file-uploader/index.js"),et=()=>import("@carbon/web-components/es/components/form/index.js"),$s=()=>import("@carbon/web-components/es/components/form-group/index.js"),Vs=()=>import("@carbon/web-components/es/components/data-table/index.js"),st=()=>import("@carbon/web-components/es/components/pagination/index.js"),Zs=()=>import("@carbon/web-components/es/components/code-snippet/index.js"),G=()=>import("@carbon/web-components/es/components/tag/index.js"),Js=()=>import("@carbon/web-components/es/components/badge-indicator/index.js"),$=()=>import("@carbon/web-components/es/components/notification/index.js"),Ks=()=>import("@carbon/web-components/es/components/loading/index.js"),Qs=()=>import("@carbon/web-components/es/components/inline-loading/index.js"),Xs=()=>import("@carbon/web-components/es/components/progress-bar/index.js"),Ys=()=>import("@carbon/web-components/es/components/progress-indicator/index.js"),tn=()=>import("@carbon/web-components/es/components/skeleton-placeholder/index.js"),en=()=>import("@carbon/web-components/es/components/skeleton-text/index.js"),P=()=>import("@carbon/web-components/es/components/modal/index.js"),k=()=>import("@carbon/web-components/es/components/tooltip/index.js"),sn=()=>import("@carbon/web-components/es/components/popover/index.js"),nn=()=>import("@carbon/web-components/es/components/toggle-tip/index.js"),nt=()=>import("@carbon/web-components/es/components/heading/index.js"),an=()=>import("@carbon/web-components/es/components/icon/index.js"),on=()=>import("@carbon/web-components/es/components/icon-indicator/index.js"),q={"cds-table":[k,H,j,tt,U,st,Vs],"cds-pagination":[U,j,st],"cds-button":[k,H],"cds-icon-button:not([data-toggle])":[k,Y],"cds-icon-button[data-toggle]":[k,Y],"cds-button[data-fab]":[k,H],"cds-copy-button":[k,Bs],"cds-combo-button":[k,Ds],"cds-checkbox":[Ns],"cds-radio-button-group":[Ms],"cds-toggle":[Ts],"cds-select":[U],"cds-slider":[qs],"cds-text-input":[j],"cds-textarea":[Os],"cds-number-input":[zs],"cds-password-input":[k,Fs],"cds-search":[tt],"cds-dropdown":[Ls],"cds-combo-box":[Rs],"cds-multi-select":[Hs],"cds-date-picker":[Us],"cds-time-picker":[js],"cds-file-uploader":[Gs],"cds-tabs":[ys],"cds-accordion":[Is],"cds-content-switcher":[xs],"cds-breadcrumb":[R],"cds-breadcrumb-item":[R],"cds-breadcrumb-link":[R],"cds-menu":[X],"cds-menu-button":[X],"cds-overflow-menu":[ws],"cds-structured-list":[ks],"cds-contained-list":[L],"cds-contained-list-item":[L],"cds-contained-list-description":[L],"cds-tree-view":[_s],"cds-modal":[P],"cds-modal-header":[P],"cds-modal-heading":[P],"cds-modal-label":[P],"cds-modal-close-button":[P],"cds-modal-body":[P],"cds-modal-body-content":[P],"cds-modal-footer":[P],"cds-modal-footer-button":[P],"cds-toast-notification":[$],"cds-inline-notification":[$],"cds-actionable-notification":[$],"cds-tile":[D],"cds-tile-group":[D],"cds-clickable-tile":[D],"cds-expandable-tile":[D],"cds-selectable-tile":[D],"cds-radio-tile":[D],"cds-progress-bar":[Xs],"cds-progress-indicator":[Ys],"cds-inline-loading":[Qs],"cds-tooltip":[k],"cds-popover":[sn],"cds-toggletip":[nn],"cds-tag":[G],"cds-dismissible-tag":[G],"cds-filter-tag":[G],"cds-link":[Cs],"cds-code-snippet":[Zs],"cds-form":[et],"cds-form-item":[et],"cds-form-group":[$s],"cds-stack":[Ps],"cds-heading":[nt],"cds-section":[nt],"cds-icon":[an],"cds-icon-indicator":[on],"cds-badge-indicator":[Js],"cds-loading":[Ks],"cds-skeleton-text":[en],"cds-skeleton-placeholder":[tn]};function rn(t){const e=new Map;if(!t||!(t instanceof Element))return e;for(const s of Object.keys(T))e.set(s,[]);for(const[s]of Object.entries(T))t.matches(s)&&e.get(s).push(t);const n=t.querySelectorAll("*");for(const s of n)for(const[a]of Object.entries(T))s.matches(a)&&e.get(a).push(s);for(const[s,a]of e.entries())a.length===0&&e.delete(s);return e}function cn(t){const e=new Set;for(const[n,s]of t.entries())s.length>0&&q[n]&&q[n].forEach(a=>e.add(a));return e}async function ln(t,e){if(t.size===0)return;const n=Array.from(t).map(async s=>(e.has(s)||e.set(s,s()),e.get(s)));await Promise.all(n)}function dn(t,e){let n=0;for(const[s,a]of t.entries()){const o=T[s];a.forEach(r=>{if(o.init){o.init.call(e,r);return}if(o.multiEvent){const A=c.getSemanticAttributes(r);o.events.forEach(W=>{const x=c.getEventAttribute(r,W.attrName,"event");x&&e.listen(r,W.type,O=>{e.dispatchPanelEvent(x,W.getData(O,A,r))})});return}const d=c.getSemanticAttributes(r),u=d.event;u&&e.listen(r,o.event,A=>{A.stopPropagation();const W=o.getData(A,d,r),x=W._eventOverride||u;delete W._eventOverride,e.dispatchPanelEvent(x,W)})}),n+=a.length}return n}var T=Object.fromEntries(Ws()),pn=async function(t,e){const n=rn(t);if(n.size===0){this.debugMe("[Carbon] No Carbon components found in panel");return}this.carbonComponents||(this.carbonComponents=new Map);for(const[o,r]of n.entries())this.carbonComponents.set(o,r);const s=cn(n);if(s.size>0)try{await ln(s,e)}catch(o){console.error("[Carbon] Failed to load some component modules:",o)}const a=dn(n,this);a>0&&this.debugMe(`[Carbon] Total components initialized: ${a}`)},un=(t={})=>{const{preload:e=[]}=t,n=new Map;if(e.length>0){const s=e.filter(o=>q[o]?!0:(console.warn(`[Carbon] No import found for selector: ${o}`),!1)),a=s.flatMap(o=>q[o].map(r=>(n.has(r)||n.set(r,r()),n.get(r))));Promise.all(a).then(()=>console.debug(`[Carbon] Preloaded: ${s.join(", ")}`)).catch(o=>console.warn("[Carbon] Preload error:",o))}m.ComponentLibraryRegistry.register("carbon",{cache:n,render:async function(s,a){try{await pn.call(this,s,a)}catch(o){console.error("[Carbon] Initialization error:",o)}},dispose:function(s){},config:{version:"2.0",description:"IBM Carbon Design System Web Components"}}),console.debug("[Zooy] Carbon Design System library registered")};exports.registerCarbonLibrary=un;
@@ -0,0 +1,52 @@
1
+ const A=require("./component-library-registry-BBQV6Kpv.js");let p=require("badu"),u=require("ramda"),o=require("lit");var T={json:e=>JSON.stringify(e,null,2),tpl:(e,t,r)=>{const i=r?.getAttribute("zoo-bind-attr-tpl")||r?.getAttribute("zoo-bind-tpl");if(!i)return e;try{return new Function("value","data",`return \`${i}\`;`)(e,t)}catch(n){return console.warn("[Binder] Invalid template:",i,n),e}}},w=class{#s;#t;#r;#e=null;#i;constructor(e,t,r,i={}){if(!t)throw new Error("Binder requires a URL");if(!r||!(r instanceof Element))throw new Error("Binder requires a valid rootEl Element");this.#s=e,this.#t=new URL(t,window.location.origin),this.#r=r,this.#i={...T,...i.formatters},i.urlParams?this.#a(i.urlParams):this.#n()}get url(){return this.#t}get data(){return this.#e}get limit(){return parseInt(this.#t.searchParams.get("limit")||"0",10)}get offset(){return parseInt(this.#t.searchParams.get("offset")||"0",10)}get isPaginated(){return(0,u.both)((0,u.has)("count"),(0,u.has)("results"))(this.#e)}#a(e){return Object.entries(e).forEach(([t,r])=>{if(!(0,p.isDefAndNotNull)(r)||r===""||Array.isArray(r)&&r.length<1){this.#t.searchParams.delete(t);return}if(Array.isArray(r)){this.#t.searchParams.set(t,r.join(","));return}this.#t.searchParams.set(t,r)}),this.#n(),this.#t}#n(){const e=this.#t.href.split(this.url.origin)[1].slice(1);this.#r.querySelectorAll("[zoo-bind-binderurl]").forEach(t=>{t.setAttribute("zoo-bind-binderurl",e)})}async fetchData(e={}){const t=await this.#s.user.fetchJson(this.#a(e).toString(),this.#s.abortController.signal);return this.setData(t)}setData(e){return this.#e=e,this.render()}async render(){if(!(0,p.isDefAndNotNull)(this.#e)){console.warn("[Binder] No data to render");return}this.#n(),this.#o(this.#r,this.#e,0),await this.#c()}#o(e,t,r=0,i={}){const n=i.removeAttributes??!1;e.querySelectorAll("[zoo-bind-attr]").forEach(s=>{s.closest("[zoo-template]")||(s.getAttribute("zoo-bind-attr").split(",").forEach(a=>{const[l,c]=a.split(":").map(f=>f.trim()),[h,d]=c.split("|").map(f=>f.trim());let m=this.#l(t,h,r);d&&this.#i[d]&&(m=this.#i[d](m,t,s)),(0,p.isDefAndNotNull)(m)&&s.setAttribute(l,m)}),n&&(s.removeAttribute("zoo-bind-attr"),s.removeAttribute("zoo-bind-attr-tpl")))}),e.querySelectorAll("[zoo-bind]").forEach(s=>{if(s.closest("[zoo-template]"))return;const[a,l]=s.getAttribute("zoo-bind").split("|").map(h=>h.trim());let c=this.#l(t,a,r);l&&this.#i[l]&&(c=this.#i[l](c,t,s)),s.textContent=c??"",n&&(s.removeAttribute("zoo-bind"),s.removeAttribute("zoo-bind-tpl"))})}async#c(){const e=this.#r.querySelectorAll("[zoo-template]");for(const t of e){const r=t.getAttribute("zoo-template"),i=t.getAttribute("zoo-template-bind");if(!r){console.warn("[Binder] Consumer missing template ID",t);continue}const n=this.#r.querySelector(`#${r}`);if(!n||n.tagName!=="TEMPLATE"){console.error(`[DataBinder] Template not found or invalid: ${r}`);continue}const s=i?(0,u.path)(i.split("."),this.#e):this.#e;if(!s){console.warn(`[DataBinder] Data slice is undefined. Path: ${i}. Skipping render for this consumer.`);continue}if(!Array.isArray(s)){console.error(`[DataBinder] Data slice is not an array. Path: ${i}`,s);continue}t.replaceChildren(),s.forEach((a,l)=>{const c=this.#u(n,a,l);t.appendChild(c)}),await this.#s.parseContent(t)}}#u(e,t,r){const i=e.content.cloneNode(!0);return this.#o(i,t,r,{removeAttributes:!0}),i}#l(e,t,r){const i={$index:()=>r,$index__paged:()=>this.offset+r,$index1:()=>r+1,$index1__paged:()=>this.offset+r+1};return i[t]?i[t]():(0,u.path)(t.split("."),e)}},g=new Map(Object.entries({event:"event",endpoint:"endpoint",href:"href",url:"url",target:"target","record-id":"recordId","zoo-sort-field":"sortField","zoo-view":"view","zoo-event":"event","zoo-href":"href"})),v=e=>{let t={};return Array.from(e.attributes).forEach(r=>{const i=r.name,n=r.value;g.has(i)?t[g.get(i)]=n:(i.startsWith("data-")||i.startsWith("zoo-"))&&(t=(0,u.assocPath)(i.split("-"),n,t))}),t},b=(e,t,r="event")=>e.getAttribute(t)||e.getAttribute(r),y=class extends o.LitElement{static properties={token:{type:String},prefix:{type:String},postfix:{type:String}};static styles=o.css`
2
+ :host {
3
+ display: inline-block;
4
+ }
5
+
6
+ .tag {
7
+ text-align: center;
8
+ display: inline-flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ line-height: initial;
12
+ width: max-content;
13
+ padding: 0.2em 1em;
14
+ border-radius: 1em;
15
+ font-size: var(--zoo-theme-chips-font-size, 0.75rem);
16
+ white-space: nowrap;
17
+ word-break: break-word;
18
+ box-sizing: border-box;
19
+ }
20
+ `;render(){const e=`${this.prefix??""}${this.token??"default"}${this.postfix??""}`;return o.html`
21
+ <span
22
+ class="tag"
23
+ style="
24
+ background-color: var(--zoo-tag-${e}-bg, var(--zoo-tag-default-bg, #9e9e9e));
25
+ color: var(--zoo-tag-${e}-fg, var(--zoo-tag-default-fg, #ffffff));
26
+ "
27
+ >
28
+ <slot></slot>
29
+ </span>
30
+ `}};customElements.get("zoo-tag")||customElements.define("zoo-tag",y);var _=e=>{const t=Math.floor((new Date-e)/1e3),r=[{name:"year",seconds:31536e3},{name:"month",seconds:2592e3},{name:"week",seconds:604800},{name:"day",seconds:86400},{name:"hour",seconds:3600},{name:"minute",seconds:60},{name:"second",seconds:1}];if(t<0){const i=Math.abs(t);for(const n of r){const s=Math.floor(i/n.seconds);if(s>=1)return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(s,n.name)}return"just now"}for(const i of r){const n=Math.floor(t/i.seconds);if(n>=1)return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-n,i.name)}return"just now"},k=e=>{const[{value:t},,{value:r},,{value:i},,{value:n},,{value:s},,{value:a}]=new Intl.DateTimeFormat("en",{day:"2-digit",month:"short",year:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(e);return`${r} ${t} ${i} ${n}:${s}:${a}`},$=e=>{const[{value:t},,{value:r},,{value:i}]=new Intl.DateTimeFormat("en",{day:"2-digit",month:"short",year:"2-digit"}).formatToParts(e);return`${r} ${t} ${i}`},z=class extends o.LitElement{static properties={timestamp:{type:Number},kind:{type:String},concat:{type:String}};static styles=o.css`
31
+ :host {
32
+ display: inline;
33
+ }
34
+
35
+ .relative {
36
+ color: var(--zoo-timestamp-relative-color, inherit);
37
+ font-weight: var(--zoo-timestamp-relative-weight, inherit);
38
+ font-size: var(--zoo-timestamp-relative-size, inherit);
39
+ }
40
+
41
+ .static {
42
+ color: var(--zoo-timestamp-static-color, inherit);
43
+ font-weight: var(--zoo-timestamp-static-weight, inherit);
44
+ font-size: var(--zoo-timestamp-static-size, inherit);
45
+ }
46
+
47
+ .separator {
48
+ color: var(--zoo-timestamp-separator-color, inherit);
49
+ }
50
+ `;constructor(){super(),this.timestamp=Date.now(),this.kind="both",this.concat="r (s)",this._boundTickHandler=this._onTimeTick.bind(this),this._isListening=!1}_shouldListenToTicks(){return this.kind==="relative"||this.kind==="both"}connectedCallback(){super.connectedCallback(),this._updateTickListener()}disconnectedCallback(){this._removeTickListener(),super.disconnectedCallback()}updated(e){super.updated(e),e.has("kind")&&this._updateTickListener()}_updateTickListener(){const e=this._shouldListenToTicks();e&&!this._isListening?(document.addEventListener("zoo-tick-60",this._boundTickHandler),this._isListening=!0):!e&&this._isListening&&this._removeTickListener()}_removeTickListener(){this._isListening&&(document.removeEventListener("zoo-tick-60",this._boundTickHandler),this._isListening=!1)}_onTimeTick(){this.requestUpdate()}_parseTemplate(e){const t=[];let r=e;for(;r.length>0;){const i=r.indexOf("r"),n=[i,r.indexOf("s")].filter(s=>s!==-1).sort((s,a)=>s-a)[0];if(n===void 0){r.length>0&&t.push({type:"text",value:r});break}n>0&&t.push({type:"text",value:r.substring(0,n)}),n===i?t.push({type:"relative",value:""}):t.push({type:"static",value:""}),r=r.substring(n+1)}return t}_getFormattedParts(){let e=this.timestamp;e<9466848e5&&(e=e*1e3);const t=new Date(e),r=_(t),i=k(t),n=$(t);switch(this.kind){case"relative":return[{type:"relative",value:r}];case"datetime":return[{type:"static",value:i}];case"date":return[{type:"static",value:n}];case"both":return this._parseTemplate(this.concat).map(s=>s.type==="relative"?{type:"relative",value:r}:s.type==="static"?{type:"static",value:i}:s);default:return this._parseTemplate(this.concat).map(s=>s.type==="relative"?{type:"relative",value:r}:s.type==="static"?{type:"static",value:i}:s)}}render(){let e=this.timestamp;e<9466848e5&&(e=e*1e3);const t=new Date(e),r=this._getFormattedParts();return o.html`<time datetime="${t.toISOString()}">
51
+ ${r.map(i=>i.type==="relative"?o.html`<span class="relative">${i.value}</span>`:i.type==="static"?o.html`<span class="static">${i.value}</span>`:o.html`<span class="separator">${i.value}</span>`)}
52
+ </time>`}};customElements.get("zoo-timestamp")||customElements.define("zoo-timestamp",z);var E=A.__exportAll({ZooTag:()=>y,ZooTimestamp:()=>z,getEventAttribute:()=>b,getSemanticAttributes:()=>v});Object.defineProperty(exports,"Binder",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"getEventAttribute",{enumerable:!0,get:function(){return b}});Object.defineProperty(exports,"getSemanticAttributes",{enumerable:!0,get:function(){return v}});Object.defineProperty(exports,"zoo_exports",{enumerable:!0,get:function(){return E}});
@@ -3,29 +3,29 @@ import { isDefAndNotNull as f } from "badu";
3
3
  import { assocPath as w, both as k, has as p, path as v } from "ramda";
4
4
  import { LitElement as b, css as y, html as c } from "lit";
5
5
  var _ = {
6
- json: (t) => JSON.stringify(t, null, 2),
7
- tpl: (t, i, e) => {
8
- const r = e?.getAttribute("zoo-bind-attr-tpl") || e?.getAttribute("zoo-bind-tpl");
9
- if (!r) return t;
6
+ json: (e) => JSON.stringify(e, null, 2),
7
+ tpl: (e, t, i) => {
8
+ const r = i?.getAttribute("zoo-bind-attr-tpl") || i?.getAttribute("zoo-bind-tpl");
9
+ if (!r) return e;
10
10
  try {
11
- return new Function("value", "data", `return \`${r}\`;`)(t, i);
12
- } catch (a) {
13
- return console.warn("[Binder] Invalid template:", r, a), t;
11
+ return new Function("value", "data", `return \`${r}\`;`)(e, t);
12
+ } catch (n) {
13
+ return console.warn("[Binder] Invalid template:", r, n), e;
14
14
  }
15
15
  }
16
- }, C = class {
16
+ }, B = class {
17
17
  #s;
18
18
  #t;
19
19
  #i;
20
20
  #e = null;
21
21
  #r;
22
- constructor(t, i, e, r = {}) {
23
- if (!i) throw new Error("Binder requires a URL");
24
- if (!e || !(e instanceof Element)) throw new Error("Binder requires a valid rootEl Element");
25
- this.#s = t, this.#t = new URL(i, window.location.origin), this.#i = e, this.#r = {
22
+ constructor(e, t, i, r = {}) {
23
+ if (!t) throw new Error("Binder requires a URL");
24
+ if (!i || !(i instanceof Element)) throw new Error("Binder requires a valid rootEl Element");
25
+ this.#s = e, this.#t = new URL(t, window.location.origin), this.#i = i, this.#r = {
26
26
  ..._,
27
27
  ...r.formatters
28
- }, r.urlParams ? this.#n(r.urlParams) : this.#a();
28
+ }, r.urlParams ? this.#a(r.urlParams) : this.#n();
29
29
  }
30
30
  get url() {
31
31
  return this.#t;
@@ -42,93 +42,94 @@ var _ = {
42
42
  get isPaginated() {
43
43
  return k(p("count"), p("results"))(this.#e);
44
44
  }
45
- #n(t) {
46
- return Object.entries(t).forEach(([i, e]) => {
47
- if (!f(e) || e === "" || Array.isArray(e) && e.length < 1) {
48
- this.#t.searchParams.delete(i);
45
+ #a(e) {
46
+ return Object.entries(e).forEach(([t, i]) => {
47
+ if (!f(i) || i === "" || Array.isArray(i) && i.length < 1) {
48
+ this.#t.searchParams.delete(t);
49
49
  return;
50
50
  }
51
- if (Array.isArray(e)) {
52
- this.#t.searchParams.set(i, e.join(","));
51
+ if (Array.isArray(i)) {
52
+ this.#t.searchParams.set(t, i.join(","));
53
53
  return;
54
54
  }
55
- this.#t.searchParams.set(i, e);
56
- }), this.#a(), this.#t;
55
+ this.#t.searchParams.set(t, i);
56
+ }), this.#n(), this.#t;
57
57
  }
58
- #a() {
59
- const t = this.#t.href.split(this.url.origin)[1].slice(1);
60
- this.#i.querySelectorAll("[zoo-bind-binderurl]").forEach((i) => {
61
- i.setAttribute("zoo-bind-binderurl", t);
58
+ #n() {
59
+ const e = this.#t.href.split(this.url.origin)[1].slice(1);
60
+ this.#i.querySelectorAll("[zoo-bind-binderurl]").forEach((t) => {
61
+ t.setAttribute("zoo-bind-binderurl", e);
62
62
  });
63
63
  }
64
- async fetchData(t = {}) {
65
- const i = await this.#s.user.fetchJson(this.#n(t).toString(), this.#s.abortController.signal);
66
- this.setData(i);
64
+ async fetchData(e = {}) {
65
+ const t = await this.#s.user.fetchJson(this.#a(e).toString(), this.#s.abortController.signal);
66
+ return this.setData(t);
67
67
  }
68
- setData(t) {
69
- this.#e = t, this.render();
68
+ setData(e) {
69
+ return this.#e = e, this.render();
70
70
  }
71
- render() {
71
+ async render() {
72
72
  if (!f(this.#e)) {
73
73
  console.warn("[Binder] No data to render");
74
74
  return;
75
75
  }
76
- this.#a(), this.#o(this.#i, this.#e, 0), this.#c();
76
+ this.#n(), this.#o(this.#i, this.#e, 0), await this.#c();
77
77
  }
78
- #o(t, i, e = 0, r = {}) {
79
- const a = r.removeAttributes ?? !1;
80
- t.querySelectorAll("[zoo-bind-attr]").forEach((s) => {
81
- s.closest("[zoo-template]") || (s.getAttribute("zoo-bind-attr").split(",").forEach((n) => {
82
- const [o, l] = n.split(":").map((d) => d.trim()), [h, m] = l.split("|").map((d) => d.trim());
83
- let u = this.#l(i, h, e);
84
- m && this.#r[m] && (u = this.#r[m](u, i, s)), f(u) && s.setAttribute(o, u);
85
- }), a && (s.removeAttribute("zoo-bind-attr"), s.removeAttribute("zoo-bind-attr-tpl")));
86
- }), t.querySelectorAll("[zoo-bind]").forEach((s) => {
78
+ #o(e, t, i = 0, r = {}) {
79
+ const n = r.removeAttributes ?? !1;
80
+ e.querySelectorAll("[zoo-bind-attr]").forEach((s) => {
81
+ s.closest("[zoo-template]") || (s.getAttribute("zoo-bind-attr").split(",").forEach((a) => {
82
+ const [o, l] = a.split(":").map((d) => d.trim()), [m, h] = l.split("|").map((d) => d.trim());
83
+ let u = this.#l(t, m, i);
84
+ h && this.#r[h] && (u = this.#r[h](u, t, s)), f(u) && s.setAttribute(o, u);
85
+ }), n && (s.removeAttribute("zoo-bind-attr"), s.removeAttribute("zoo-bind-attr-tpl")));
86
+ }), e.querySelectorAll("[zoo-bind]").forEach((s) => {
87
87
  if (s.closest("[zoo-template]")) return;
88
- const [n, o] = s.getAttribute("zoo-bind").split("|").map((h) => h.trim());
89
- let l = this.#l(i, n, e);
90
- o && this.#r[o] && (l = this.#r[o](l, i, s)), s.textContent = l ?? "", a && (s.removeAttribute("zoo-bind"), s.removeAttribute("zoo-bind-tpl"));
88
+ const [a, o] = s.getAttribute("zoo-bind").split("|").map((m) => m.trim());
89
+ let l = this.#l(t, a, i);
90
+ o && this.#r[o] && (l = this.#r[o](l, t, s)), s.textContent = l ?? "", n && (s.removeAttribute("zoo-bind"), s.removeAttribute("zoo-bind-tpl"));
91
91
  });
92
92
  }
93
- #c() {
94
- this.#i.querySelectorAll("[zoo-template]").forEach((t) => {
95
- const i = t.getAttribute("zoo-template"), e = t.getAttribute("zoo-template-bind");
93
+ async #c() {
94
+ const e = this.#i.querySelectorAll("[zoo-template]");
95
+ for (const t of e) {
96
+ const i = t.getAttribute("zoo-template"), r = t.getAttribute("zoo-template-bind");
96
97
  if (!i) {
97
98
  console.warn("[Binder] Consumer missing template ID", t);
98
- return;
99
+ continue;
99
100
  }
100
- const r = this.#i.querySelector(`#${i}`);
101
- if (!r || r.tagName !== "TEMPLATE") {
101
+ const n = this.#i.querySelector(`#${i}`);
102
+ if (!n || n.tagName !== "TEMPLATE") {
102
103
  console.error(`[DataBinder] Template not found or invalid: ${i}`);
103
- return;
104
+ continue;
104
105
  }
105
- const a = e ? v(e.split("."), this.#e) : this.#e;
106
- if (!a) {
107
- console.warn(`[DataBinder] Data slice is undefined. Path: ${e}. Skipping render for this consumer.`);
108
- return;
106
+ const s = r ? v(r.split("."), this.#e) : this.#e;
107
+ if (!s) {
108
+ console.warn(`[DataBinder] Data slice is undefined. Path: ${r}. Skipping render for this consumer.`);
109
+ continue;
109
110
  }
110
- if (!Array.isArray(a)) {
111
- console.error(`[DataBinder] Data slice is not an array. Path: ${e}`, a);
112
- return;
111
+ if (!Array.isArray(s)) {
112
+ console.error(`[DataBinder] Data slice is not an array. Path: ${r}`, s);
113
+ continue;
113
114
  }
114
- t.innerHTML = "", a.forEach((s, n) => {
115
- const o = this.#u(r, s, n);
116
- t.appendChild(o);
117
- });
118
- });
115
+ t.replaceChildren(), s.forEach((a, o) => {
116
+ const l = this.#u(n, a, o);
117
+ t.appendChild(l);
118
+ }), await this.#s.parseContent(t);
119
+ }
119
120
  }
120
- #u(t, i, e) {
121
- const r = t.content.cloneNode(!0);
122
- return this.#o(r, i, e, { removeAttributes: !0 }), r;
121
+ #u(e, t, i) {
122
+ const r = e.content.cloneNode(!0);
123
+ return this.#o(r, t, i, { removeAttributes: !0 }), r;
123
124
  }
124
- #l(t, i, e) {
125
+ #l(e, t, i) {
125
126
  const r = {
126
- $index: () => e,
127
- $index__paged: () => this.offset + e,
128
- $index1: () => e + 1,
129
- $index1__paged: () => this.offset + e + 1
127
+ $index: () => i,
128
+ $index__paged: () => this.offset + i,
129
+ $index1: () => i + 1,
130
+ $index1__paged: () => this.offset + i + 1
130
131
  };
131
- return r[i] ? r[i]() : v(i.split("."), t);
132
+ return r[t] ? r[t]() : v(t.split("."), e);
132
133
  }
133
134
  }, g = new Map(Object.entries({
134
135
  event: "event",
@@ -141,13 +142,13 @@ var _ = {
141
142
  "zoo-view": "view",
142
143
  "zoo-event": "event",
143
144
  "zoo-href": "href"
144
- })), $ = (t) => {
145
- let i = {};
146
- return Array.from(t.attributes).forEach((e) => {
147
- const r = e.name, a = e.value;
148
- g.has(r) ? i[g.get(r)] = a : (r.startsWith("data-") || r.startsWith("zoo-")) && (i = w(r.split("-"), a, i));
149
- }), i;
150
- }, E = (t, i, e = "event") => t.getAttribute(i) || t.getAttribute(e), z = class extends b {
145
+ })), $ = (e) => {
146
+ let t = {};
147
+ return Array.from(e.attributes).forEach((i) => {
148
+ const r = i.name, n = i.value;
149
+ g.has(r) ? t[g.get(r)] = n : (r.startsWith("data-") || r.startsWith("zoo-")) && (t = w(r.split("-"), n, t));
150
+ }), t;
151
+ }, E = (e, t, i = "event") => e.getAttribute(t) || e.getAttribute(i), z = class extends b {
151
152
  static properties = {
152
153
  token: { type: String },
153
154
  prefix: { type: String },
@@ -174,13 +175,13 @@ var _ = {
174
175
  }
175
176
  `;
176
177
  render() {
177
- const t = `${this.prefix ?? ""}${this.token ?? "default"}${this.postfix ?? ""}`;
178
+ const e = `${this.prefix ?? ""}${this.token ?? "default"}${this.postfix ?? ""}`;
178
179
  return c`
179
180
  <span
180
181
  class="tag"
181
182
  style="
182
- background-color: var(--zoo-tag-${t}-bg, var(--zoo-tag-default-bg, #9e9e9e));
183
- color: var(--zoo-tag-${t}-fg, var(--zoo-tag-default-fg, #ffffff));
183
+ background-color: var(--zoo-tag-${e}-bg, var(--zoo-tag-default-bg, #9e9e9e));
184
+ color: var(--zoo-tag-${e}-fg, var(--zoo-tag-default-fg, #ffffff));
184
185
  "
185
186
  >
186
187
  <slot></slot>
@@ -189,8 +190,8 @@ var _ = {
189
190
  }
190
191
  };
191
192
  customElements.get("zoo-tag") || customElements.define("zoo-tag", z);
192
- var L = (t) => {
193
- const i = Math.floor((/* @__PURE__ */ new Date() - t) / 1e3), e = [
193
+ var x = (e) => {
194
+ const t = Math.floor((/* @__PURE__ */ new Date() - e) / 1e3), i = [
194
195
  {
195
196
  name: "year",
196
197
  seconds: 31536e3
@@ -220,21 +221,21 @@ var L = (t) => {
220
221
  seconds: 1
221
222
  }
222
223
  ];
223
- if (i < 0) {
224
- const r = Math.abs(i);
225
- for (const a of e) {
226
- const s = Math.floor(r / a.seconds);
227
- if (s >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(s, a.name);
224
+ if (t < 0) {
225
+ const r = Math.abs(t);
226
+ for (const n of i) {
227
+ const s = Math.floor(r / n.seconds);
228
+ if (s >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(s, n.name);
228
229
  }
229
230
  return "just now";
230
231
  }
231
- for (const r of e) {
232
- const a = Math.floor(i / r.seconds);
233
- if (a >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(-a, r.name);
232
+ for (const r of i) {
233
+ const n = Math.floor(t / r.seconds);
234
+ if (n >= 1) return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(-n, r.name);
234
235
  }
235
236
  return "just now";
236
- }, x = (t) => {
237
- const [{ value: i }, , { value: e }, , { value: r }, , { value: a }, , { value: s }, , { value: n }] = new Intl.DateTimeFormat("en", {
237
+ }, L = (e) => {
238
+ const [{ value: t }, , { value: i }, , { value: r }, , { value: n }, , { value: s }, , { value: a }] = new Intl.DateTimeFormat("en", {
238
239
  day: "2-digit",
239
240
  month: "short",
240
241
  year: "2-digit",
@@ -242,15 +243,15 @@ var L = (t) => {
242
243
  minute: "2-digit",
243
244
  second: "2-digit",
244
245
  hourCycle: "h23"
245
- }).formatToParts(t);
246
- return `${e} ${i} ${r} ${a}:${s}:${n}`;
247
- }, S = (t) => {
248
- const [{ value: i }, , { value: e }, , { value: r }] = new Intl.DateTimeFormat("en", {
246
+ }).formatToParts(e);
247
+ return `${i} ${t} ${r} ${n}:${s}:${a}`;
248
+ }, S = (e) => {
249
+ const [{ value: t }, , { value: i }, , { value: r }] = new Intl.DateTimeFormat("en", {
249
250
  day: "2-digit",
250
251
  month: "short",
251
252
  year: "2-digit"
252
- }).formatToParts(t);
253
- return `${e} ${i} ${r}`;
253
+ }).formatToParts(e);
254
+ return `${i} ${t} ${r}`;
254
255
  }, T = class extends b {
255
256
  static properties = {
256
257
  timestamp: { type: Number },
@@ -290,12 +291,12 @@ var L = (t) => {
290
291
  disconnectedCallback() {
291
292
  this._removeTickListener(), super.disconnectedCallback();
292
293
  }
293
- updated(t) {
294
- super.updated(t), t.has("kind") && this._updateTickListener();
294
+ updated(e) {
295
+ super.updated(e), e.has("kind") && this._updateTickListener();
295
296
  }
296
297
  _updateTickListener() {
297
- const t = this._shouldListenToTicks();
298
- t && !this._isListening ? (document.addEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !0) : !t && this._isListening && this._removeTickListener();
298
+ const e = this._shouldListenToTicks();
299
+ e && !this._isListening ? (document.addEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !0) : !e && this._isListening && this._removeTickListener();
299
300
  }
300
301
  _removeTickListener() {
301
302
  this._isListening && (document.removeEventListener("zoo-tick-60", this._boundTickHandler), this._isListening = !1);
@@ -303,40 +304,40 @@ var L = (t) => {
303
304
  _onTimeTick() {
304
305
  this.requestUpdate();
305
306
  }
306
- _parseTemplate(t) {
307
- const i = [];
308
- let e = t;
309
- for (; e.length > 0; ) {
310
- const r = e.indexOf("r"), a = [r, e.indexOf("s")].filter((s) => s !== -1).sort((s, n) => s - n)[0];
311
- if (a === void 0) {
312
- e.length > 0 && i.push({
307
+ _parseTemplate(e) {
308
+ const t = [];
309
+ let i = e;
310
+ for (; i.length > 0; ) {
311
+ const r = i.indexOf("r"), n = [r, i.indexOf("s")].filter((s) => s !== -1).sort((s, a) => s - a)[0];
312
+ if (n === void 0) {
313
+ i.length > 0 && t.push({
313
314
  type: "text",
314
- value: e
315
+ value: i
315
316
  });
316
317
  break;
317
318
  }
318
- a > 0 && i.push({
319
+ n > 0 && t.push({
319
320
  type: "text",
320
- value: e.substring(0, a)
321
- }), a === r ? i.push({
321
+ value: i.substring(0, n)
322
+ }), n === r ? t.push({
322
323
  type: "relative",
323
324
  value: ""
324
- }) : i.push({
325
+ }) : t.push({
325
326
  type: "static",
326
327
  value: ""
327
- }), e = e.substring(a + 1);
328
+ }), i = i.substring(n + 1);
328
329
  }
329
- return i;
330
+ return t;
330
331
  }
331
332
  _getFormattedParts() {
332
- let t = this.timestamp;
333
- t < 9466848e5 && (t = t * 1e3);
334
- const i = new Date(t), e = L(i), r = x(i), a = S(i);
333
+ let e = this.timestamp;
334
+ e < 9466848e5 && (e = e * 1e3);
335
+ const t = new Date(e), i = x(t), r = L(t), n = S(t);
335
336
  switch (this.kind) {
336
337
  case "relative":
337
338
  return [{
338
339
  type: "relative",
339
- value: e
340
+ value: i
340
341
  }];
341
342
  case "datetime":
342
343
  return [{
@@ -346,12 +347,12 @@ var L = (t) => {
346
347
  case "date":
347
348
  return [{
348
349
  type: "static",
349
- value: a
350
+ value: n
350
351
  }];
351
352
  case "both":
352
353
  return this._parseTemplate(this.concat).map((s) => s.type === "relative" ? {
353
354
  type: "relative",
354
- value: e
355
+ value: i
355
356
  } : s.type === "static" ? {
356
357
  type: "static",
357
358
  value: r
@@ -359,7 +360,7 @@ var L = (t) => {
359
360
  default:
360
361
  return this._parseTemplate(this.concat).map((s) => s.type === "relative" ? {
361
362
  type: "relative",
362
- value: e
363
+ value: i
363
364
  } : s.type === "static" ? {
364
365
  type: "static",
365
366
  value: r
@@ -367,11 +368,11 @@ var L = (t) => {
367
368
  }
368
369
  }
369
370
  render() {
370
- let t = this.timestamp;
371
- t < 9466848e5 && (t = t * 1e3);
372
- const i = new Date(t), e = this._getFormattedParts();
373
- return c`<time datetime="${i.toISOString()}">
374
- ${e.map((r) => r.type === "relative" ? c`<span class="relative">${r.value}</span>` : r.type === "static" ? c`<span class="static">${r.value}</span>` : c`<span class="separator">${r.value}</span>`)}
371
+ let e = this.timestamp;
372
+ e < 9466848e5 && (e = e * 1e3);
373
+ const t = new Date(e), i = this._getFormattedParts();
374
+ return c`<time datetime="${t.toISOString()}">
375
+ ${i.map((r) => r.type === "relative" ? c`<span class="relative">${r.value}</span>` : r.type === "static" ? c`<span class="static">${r.value}</span>` : c`<span class="separator">${r.value}</span>`)}
375
376
  </time>`;
376
377
  }
377
378
  };
@@ -383,7 +384,7 @@ var F = /* @__PURE__ */ A({
383
384
  getSemanticAttributes: () => $
384
385
  });
385
386
  export {
386
- C as i,
387
+ B as i,
387
388
  E as n,
388
389
  $ as r,
389
390
  F as t
package/dist/zooy.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("./chunks/component-library-registry-BBQV6Kpv.js"),p=require("./chunks/tree-utils-B_lCUFMV.js"),U=require("./chunks/zoo-C2JHuTvn.js");let a=require("badu"),De=require("ramda");var L=class extends EventTarget{#e=!1;#t=!1;#s=new Map;#r=new Set;#i=new Set;static makeEvent(e,t){return new CustomEvent(e,{detail:t})}set debugMode(e){if(typeof e!="boolean")throw new Error("This must be a boolean");this.#e=e}get debugMode(){return this.#e}get disposed(){return this.#t}get listeningTo(){return this.#s}get isObservedBy(){return this.#r}get activeIntervals(){return this.#i}debugMe(...e){this.#e&&console.log.apply(null,[this.constructor.name,"DEBUG:",...e])}isListenedToBy(e){this.#r.add(e)}listen(e,t,s,r=!1){e.addEventListener(t,s,r);const i=this.listeningTo.get(e)||{};i[t]=()=>e.removeEventListener(t,s,r),this.listeningTo.set(e,i),(0,a.isDef)(e.isListenedToBy)&&e.isListenedToBy(this)}stopBeingListenedTo(){for(const e of this.isObservedBy)e.stopListeningTo(this),this.isObservedBy.delete(e)}stopListeningTo(e,t){e&&this.listeningTo.has(e)&&((0,a.isDef)(e.isObservedBy)&&e.isObservedBy.delete(this),(0,a.isDef)(t)?(Object.entries(this.listeningTo.get(e)).forEach(([s,r])=>{s===t&&r()}),Object.keys(this.listeningTo.get(e)).length||this.listeningTo.delete(e)):(Object.values(this.listeningTo.get(e)).forEach(s=>s()),this.listeningTo.delete(e)))}removeAllListener(){for(const e of this.listeningTo.keys())this.stopListeningTo(e)}clearAllIntervals(){for(const e of this.activeIntervals)clearInterval(e),this.activeIntervals.delete(e)}doOnBeat(e,t){const s=setInterval(e,t);this.activeIntervals.add(s)}disposeInternal(){this.stopBeingListenedTo(),this.removeAllListener(),this.clearAllIntervals(),this.#t=!0}dispose(){this.disposeInternal()}},k=class{constructor(e,t){this.value_=e,this.data_=t||{}}getValue(){return this.value_}getData(){return this.data_}},u={COMP:(0,a.randomId)(),COMP_DRAG_START:(0,a.randomId)(),COMP_DRAG_MOVE:(0,a.randomId)(),COMP_DRAG_END:(0,a.randomId)(),PANEL:(0,a.randomId)(),VIEW:(0,a.randomId)(),SPLIT:(0,a.randomId)(),SPLIT_WILL_OPEN:(0,a.randomId)(),SPLIT_DID_OPEN:(0,a.randomId)(),SPLIT_WILL_CLOSE:(0,a.randomId)(),SPLIT_DID_CLOSE:(0,a.randomId)(),SPLIT_TRANSITION_END:(0,a.randomId)(),READY:(0,a.randomId)(),PANEL_MINIMIZE:(0,a.randomId)(),FORM_SUBMIT_SUCCESS:(0,a.randomId)()},A={NOT_SUPPORTED:"Method not supported",DECORATE_INVALID:"Invalid element to decorate",ALREADY_RENDERED:"Component already rendered",ALREADY_DISPOSED:"Component already disposed",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document",STATE_INVALID:"Invalid component state"},w=class extends L{static compEventCode(){return u.COMP}static compReadyCode(){return u.READY}static compErrors(){return A}#e;#t;#s;#r;#i;#n;#o;#a;constructor(){super(),this.#e=()=>document.createElement("div"),this.#t=!1,this.#s=void 0,this.#r=void 0,this.#i=void 0,this.#n=void 0,this.#o=new Map,this.outOfTreeElements=[],this.placeholderDom=void 0,this.#a=()=>{}}set target(e){this.#i=e}get target(){return this.#i}set model(e){this.#r=e}get model(){return this.#r}set isInDocument(e){this.#t=e}get isInDocument(){return this.#t}set domFunc(e){this.#e=e}set readyFunc(e){this.#a=e}setElementInternal_(e){this.#s=e}getElement(){return this.#s}createDom(){this.#s=this.#e()}assertCanRenderAsync(){if(this.disposed)throw new Error(A.ALREADY_DISPOSED)}render(e){this.render_(e)}render_(e){if(this.disposed)throw new Error(A.ALREADY_DISPOSED);if(this.isInDocument)throw new Error(A.ALREADY_RENDERED);this.#s||this.createDom();const t=this.#s;e&&(this.#i=e),this.placeholderDom&&p.removeNode(this.placeholderDom),this.#i?p.isInPage(t)||this.#i.insertBefore(t,null):p.isInPage(t)||document.body.appendChild(t),(!this.#n||this.#n.isInDocument)&&this.enterDocument()}hoist(e,t=void 0){t||(t=document.querySelector("body")),t.appendChild(e),this.outOfTreeElements.push(e)}executeBeforeReady(){this.#a()}enterDocument(){this.disposed?p.removeNode(this.getElement()):(this.isInDocument=!0,[...this.#o.values()].forEach(e=>{!e.isInDocument&&e.getElement()&&e.enterDocument()}),this.executeBeforeReady(),this.dispatchCompEvent(u.READY))}exitDocument(){[...this.#o.values()].forEach(e=>{e.isInDocument&&e.exitDocument()}),this.stopBeingListenedTo(),this.removeAllListener(),this.isInDocument=!1,p.removeNode(this.getElement()),this.placeholderDom&&p.removeNode(this.placeholderDom)}disposeInternal(){this.isInDocument&&this.exitDocument(),this.#o&&[...this.#o.values()].forEach(e=>e.disposeInternal()),this.outOfTreeElements.forEach(p.removeNode),this.#s&&p.removeNode(this.#s),this.placeholderDom&&p.removeNode(this.placeholderDom),this.#o=null,this.#s=void 0,this.#r=null,this.#n=null,super.disposeInternal()}dispose(){this.abortController&&this.abortController.abort();const e=this.getElement();if(e)for(const t of M.ComponentLibraryRegistry.getRegisteredLibraries())try{const s=M.ComponentLibraryRegistry.get(t);s.dispose&&s.dispose(e)}catch(s){console.debug(`[${t}] Cleanup error during component disposal (non-critical):`,s)}super.dispose()}dispatchCompEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.COMP,s);return this.dispatchEvent(r)}},c={CLICK:"click",RIGHTCLICK:"rightclick",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",MOUSEENTER:"mouseenter",MOUSELEAVE:"mouseleave",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel",SUBMIT:"submit",CHANGE:"change",INPUT:"input",INVALID:"invalid",DRAGSTART:"dragstart",DRAGEND:"dragend",DRAGOVER:"dragover",DRAGENTER:"dragenter",DRAGEXIT:"dragexit",DRAGLEAVE:"dragleave",DROP:"drop",TRANSITIONEND:"transitionend",ANIMATIONEND:"animationend"},Ce=[c.TOUCHMOVE,c.TOUCHSTART,c.TOUCHEND],Me=e=>Ce.includes(e.type),x=e=>(Me(e)&&(e.clientX=e.targetTouches[0].clientX,e.clientY=e.targetTouches[0].clientY),e),be=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i),h=o.currentTarget,[g,_]=p.getPos(h),E=o.clientX-g,D=o.clientY-_,n=e(g,_,E,D,h),l=s(g,_,E,D,h),d=t(g,_,E,D,h);let m=Te(d,h,E,D);["x","ew"].includes(r)?m=ye(d,h,E,D):["y","ns"].includes(r)&&(m=Le(d,h,E,D));let v=!1;const f=b=>{v=!0,m(b)},S=b=>{document.removeEventListener(c.MOUSEMOVE,f,!0),document.removeEventListener(c.TOUCHMOVE,f,!0),document.removeEventListener(c.MOUSEUP,S,!0),document.removeEventListener(c.TOUCHEND,S,!0),v&&l(b)};return document.addEventListener(c.MOUSEUP,S,!0),document.addEventListener(c.TOUCHEND,S,!0),document.addEventListener(c.MOUSEMOVE,f,!0),document.addEventListener(c.TOUCHMOVE,f,!0),n(i),S},Te=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.left=`${o.clientX-s}px`,t.style.top=`${o.clientY-r}px`,e(o)},ye=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.left=`${o.clientX-s}px`,e(o)},Le=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.top=`${o.clientY-r}px`,e(o)},q=(e,t)=>(s,r,i,o,h)=>g=>{e.dispatchCompEvent(t,{component:e,browserEvent:g,left:s,top:r,clientX:g.clientX,clientY:g.clientY,xOrg:i,yOrg:o,deltaX:g.clientX-i-s,deltaY:g.clientY-o-r,target:h})},z=class extends w{#e;#t;#s;#r;constructor(e="xy"){super(),this.#e=["x","y","xy","ew","ns"].includes(e.toLowerCase())?e.toLowerCase():"xy",this.#t=void 0,this.#s=!0,this.#r=t=>null}cancelDrag(e){this.#r(e)}set moveFreedom(e){this.#e=e,this.#s||(this.lock(),this.unlock())}get moveFreedom(){return this.#e}executeBeforeReady(){this.unlock(),super.executeBeforeReady()}unlock(){const e=t=>s=>{this.#r=t(s)};if(this.isInDocument&&this.#s){const t=q(this,u.COMP_DRAG_MOVE),s=be(q(this,u.COMP_DRAG_START),t,q(this,u.COMP_DRAG_END),this.#e);this.#s=!1,this.#t=this.#t||this.getElement(),this.listen(this.#t,c.MOUSEDOWN,e(s)),this.listen(this.#t,c.TOUCHSTART,s),this.#t.classList.remove("locked")}}lock(){this.stopListeningTo(this.#t,c.MOUSEDOWN),this.stopListeningTo(this.#t,c.TOUCHSTART),this.#s=!0,this.#t.classList.add("locked")}},se=M.__exportAll({getPath:()=>j,getQueryData:()=>oe,objectToUrlParms:()=>ae,queryDataToMap:()=>le}),we=new RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$"),re={SCHEME:1,USER_INFO:2,DOMAIN:3,PORT:4,PATH:5,QUERY_DATA:6,FRAGMENT:7},ie=e=>e.match(we),ne=(e,t)=>e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):"",j=e=>ne(ie(e)[re.PATH],!0),oe=e=>ne(ie(e)[re.QUERY_DATA],!0),ae=e=>Object.entries(e).map(t=>`${t[0]}=${t[1]}`).join("&"),Q=e=>e!=null&&e!=="",le=e=>e.split("&").reduce((t,s)=>{const[r,i]=s.split("=");return Q(r)&&Q(i)&&t.set(r,i),t},new Map),Ie=(0,a.stripLeadingChar)(" "),Oe=(0,a.stripLeadingChar)("/"),Re=e=>document.cookie.split(";").map(t=>t.split("=")).reduce((t,s)=>t.set(Ie(s[0]),s[1]),new Map).get(e),Pe=e=>{let t=0,s;const r=i=>{const o=i>0;return o?t+=1:t-=1,o?t===1:t===0};return i=>{s=s||document.getElementById(e),s&&r(i)&&s.classList.toggle("viz",t>0)}},ce=Pe("the_loader"),$=()=>Promise.resolve(ce(1)),V=e=>(ce(0),Promise.resolve(e)),I=e=>e.ok?Promise.resolve(e):Promise.reject(new Error(`${e.url} ${e.status} (${e.statusText})`)),Ae=e=>t=>{if(t.type==="opaqueredirect"||t.redirected){const s=Oe(j(t.url));e.setIsRedirected(!0,s),console.log("Redirect detected",s)}return I(t)},R=e=>e.json(),H=e=>e.text().then(t=>Promise.resolve(t),t=>Promise.reject(new Error(`Could not get text from response: ${t}`))),Ne=e=>e.headers.get("Content-Type")==="application/json"?R(e):H(e),N=(e,t,s="POST",r=void 0)=>{const i=new Headers;i.append("Content-type","application/json"),i.append("X-Requested-With","XMLHttpRequest"),e&&e!==""&&i.append("Authorization",`Bearer ${e}`);const o={cache:"no-cache",method:s,headers:i,credentials:"include",body:JSON.stringify(t)};return r&&(o.signal=r),o},he=(e,t,s=!1,r=void 0)=>{const i=new Headers;if(t&&t!==""&&i.append("Authorization",`Bearer ${t}`),i.append("X-Requested-With","XMLHttpRequest"),s){const h=Re("csrftoken");h&&s&&i.append("X-CSRFToken",h)}const o={cache:"no-cache",method:e,headers:i,redirect:"follow",credentials:"include"};return r&&(o.signal=r),o},Ve=(e,t,s=void 0)=>{const r=he("POST",e,!1,s);return r.body=new FormData(t.formEl),r},Z=(e,t=void 0)=>{const s=new Headers;s.append("Authorization",`Bearer ${e}`),s.append("X-Requested-With","XMLHttpRequest");const r={cache:"no-cache",headers:s,credentials:"include"};return t&&(r.signal=t),r},Ue=(e,t)=>{const s=new Request(e);return fetch(s,t).then(I).then(H)},y=(e,t=void 0)=>s=>(V("").then(a.identity),s.name==="AbortError"?console.info(e,"ABORTED!"):console.error(e,s),t),P=class{constructor(e){this.user_={},this.jwt="",e&&this.updateProfileFromJwt(e).then(()=>{})}updateProfileFromJwt(e,t=!1){return t&&this.jwt!==""?Promise.resolve("User Profile Already exists"):e.non_field_errors?Promise.reject(new Error(`JWT ${e.non_field_errors}`)):(this.updateToken(e.token),this.updateProfile(e.user),Promise.resolve("User Profile Updated"))}updateProfile(e){this.user_=e}updateToken(e){this.jwt=e}get id(){return this.user_.id}get name(){return this.user_.name}get surname(){return this.user_.surname}get salutation(){let e=this.name;const t=this.surname;return t&&(e=e+" "+t),e}formSubmit(e){const t=new Request(e.uri.toString()),s=e.processSubmitReply.bind(e),r=y("Form submit error");return $().then(()=>fetch(t,Ve(this.jwt,e,e.abortController.signal))).then(Ae(e)).then(V).then(Ne).then(s).catch(r)}putNoBody(e,t=void 0,s=!1){const r=y("putNobody error");return Ue(e,he("PUT",this.jwt,s,t)).catch(r)}fetch(e,t=void 0){const s=new Request(e.toString()),r=y(`UMan Text GET Fetch: ${e}`);return $().then(()=>fetch(s,Z(this.jwt,t))).then(I).then(V).then(H).catch(r)}fetchAndSplit(e,t=void 0){const s=y(`fetchAndSplit: ${e}`);return this.fetch(e,t).then(p.handleTemplateProm).catch(s)}async fetchJson(e,t=void 0,s=void 0){const r=new Request(e.toString()),i=y(`fetchJson: ${e}`,s),o=Z(this.jwt,t);await $();let h;try{h=await(await fetch(r,o)).json()}catch(g){return i(g)}return await V(),h}patchJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`patchJson: ${e}`),o=N(this.jwt,t,"PATCH",s);return fetch(r,o).then(I).then(R).catch(i)}postJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`postJson: ${e}`),o=N(this.jwt,t,"POST",s);return fetch(r,o).then(I).then(R).catch(i)}putJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`putJson: ${e}`),o=N(this.jwt,t,"PUT",s);return fetch(r,o).then(I).then(R).catch(i)}delJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`delJson: ${e}`),o=N(this.jwt,t,"DELETE",s);return fetch(r,o).then(I).then(R).catch(i)}},B=class extends w{static panelEventCode(){return u.PANEL}static compReadyCode(){return u.READY}constructor(e){super(),this.qParamMap_=new Map,this.uri_="",e&&this.parseUri(e),this.evalScripts=p.evalScripts(this),this.evalModules=p.evalModules(this),this.redirected=!1,this.responseObject={html:null,scripts:null},this.user_=void 0,"AbortController"in window?this.abortController=new AbortController:this.abortController={signal:void 0,abort:()=>{}},this.listMap=new Map}get uri(){const e=this.qParamMap_.size>0?"?"+ae(Object.fromEntries(this.qParamMap_)):"";return this.uri_+e}set user(e){this.user_=e}get user(){return this.user_||(this.user_=new P),this.user_}parseUri(e){this.uri_=j(e),this.qParamMap_=le(oe(e))}addToQParams(e,t){this.qParamMap_.set(e,t)}removeFromQParams(e){this.qParamMap_.delete(e)}clearQParams(){this.qParamMap_.clear()}getCarbonComponents(e){return this.carbonComponents?.get(e)||[]}getCarbonComponentById(e){if(this.carbonComponents)for(const t of this.carbonComponents.values()){const s=t.find(r=>r.id===e);if(s)return s}}renderPlaceHolder(e){this.target&&(this.placeholderDom=e,this.target.insertBefore(this.placeholderDom,null))}renderWithTemplate(e){const t=this.user;return t?t.fetch(this.uri,this.abortController.signal).then(s=>(this.assertCanRenderAsync(),e&&e(this),this.onRenderWithTemplateReply(s).catch(r=>{r.message!==w.compErrors().ALREADY_DISPOSED&&console.error("RenderWithTemplate Err:",r)}),this)).catch(s=>{throw console.error("Panel.renderWithTemplate fetch failed:",s),s}):Promise.reject(new Error("No UserManager instance available for Panel.renderWithTemplate()"))}onRenderWithTemplateReply(e){return this.responseObject=p.splitScripts(e),this.domFunc=()=>this.responseObject.html,this.render(),Promise.resolve(this)}onReplacePartialDom(e,t){const s=this.getElement();if((0,a.isUndefined)(s))return;const r=e.html;if(t.startsWith("."))[...s.querySelectorAll(t)].filter(i=>(0,a.isDefAndNotNull)(i.id)).map(i=>[i,r.querySelector(`#${i.id}`)]).filter(([i,o])=>(0,a.isDefAndNotNull)(o)).forEach(([i,o])=>{i.parentNode.replaceChild(o,i),this.parseContent(o)});else if(t.startsWith("#")){const i=r.querySelector(t),o=s.querySelector(t);o.parentNode.replaceChild(i,o),this.parseContent(i)}this.evalScripts(e.scripts),this.evalModules(e.modules)}renderWithJSON(e){return this.user?this.user.fetchJson(this.uri_,this.abortController.signal).then(t=>{this.assertCanRenderAsync(),e&&e(t,this),this.onRenderWithJSON(t).then(a.identity)}).catch(t=>{throw console.error("Panel.renderWithJSON fetch failed:",t),t}):Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"))}onRenderWithJSON(e){return Promise.resolve(this)}onAsyncJsonReply(e,t,s){}onAsyncHtmlReply(e,t){}onViewDataBroadcast(e){}parseContent(e){if(this.debugMe("Enable interactions. Panel:",e),typeof window.customElements<"u"&&M.ComponentLibraryRegistry.has("carbon")){const n=M.ComponentLibraryRegistry.get("carbon");n.render.call(this,e,n.cache).catch(l=>console.error("[Zooy] Carbon initialization failed:",l))}if(M.ComponentLibraryRegistry.has("mdc")){const n=M.ComponentLibraryRegistry.get("mdc");n.render.call(this,e,n.cache)}e.classList.contains("zoo__modal-base")&&e.classList.contains("close_on_click")&&this.listen(e,c.CLICK,n=>{n.target===e&&this.dispatchPanelEvent("destroy_me")}),[...e.querySelectorAll(".zoo__button:not(.external):not(.mdc-data-table__row)")].forEach(n=>{this.listen(n,c.CLICK,l=>{l.stopPropagation();const d=l.currentTarget,m=p.getElDataMap(d);this.dispatchPanelEvent(m.zv,Object.assign({orgEvt:l,trigger:d,href:d.href||m.href},m))})}),[...e.querySelectorAll("[href]:not(.external):not([event])")].forEach(n=>{this.listen(n,c.CLICK,l=>{const d=l.currentTarget;l.preventDefault(),l.stopPropagation();const m=p.getElDataMap(d),v=m.zv||"href";this.dispatchPanelEvent(v,Object.assign({orgEvt:l,trigger:l.target,href:d.href||m.href},m))})}),[...e.querySelectorAll("form.intercept_submit")].forEach(n=>{n.noValidate=!0,this.listen(n,c.SUBMIT,l=>{l.preventDefault(),l.stopPropagation();const d=p.getElDataMap(n),m=p.formToJSON(n.elements);this.dispatchPanelEvent(d.zv,Object.assign({orgEvt:l,trigger:l.target,formData:m,href:d.href},d))})}),[...e.querySelectorAll(".zoo__toggle_class_driver")].forEach(n=>{const l=p.getElDataMap(n),d=l.toggle_class_target_id,m=l.toggle_class,v=e.querySelector(`#${d}`);v&&m&&n.addEventListener(c.CLICK,f=>{f.stopPropagation(),v.classList.toggle(m)})});const t=Array.from(e.querySelectorAll(".folder_drop_zone")),s=Array.from(e.querySelectorAll("[draggable]")),r=n=>{n.preventDefault(),n.target.classList.add("drag_over")},i=n=>{n.preventDefault()},o=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},h=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},g=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},_=n=>{n.dataTransfer.dropEffect="move";const l=p.getElDataMap(n.target);n.dataTransfer.setData("text/plain",JSON.stringify(l)),n.target.classList.add("drag_in_progress")},E=n=>{n.target.classList.remove("drag_in_progress")},D=n=>{g(n),n.stopPropagation();const l=JSON.parse(n.dataTransfer.getData("text/plain")),d=p.getElDataMap(n.target);return this.dispatchPanelEvent("drop_on",{custom:{on:d,from:l}}),!1};t.forEach(n=>{this.listen(n,c.DRAGOVER,i),this.listen(n,c.DRAGENTER,r),this.listen(n,c.DRAGEXIT,h),this.listen(n,c.DRAGLEAVE,o),this.listen(n,c.DROP,D)}),s.forEach(n=>{this.listen(n,c.DRAGSTART,_),this.listen(n,c.DRAGEND,E)}),[...e.querySelectorAll(".zoo_async_json")].forEach(n=>{const l=p.getElDataMap(n),d=l.href,m=this.onAsyncJsonReply.bind(this,n,l);this.user.fetchJson(d,this.abortController.signal).then(m);const v=l.z_json_reusable;v&&(this.jsonCallFuncs=this.jsonCallFuncs||{},this.jsonCallFuncs[v]=()=>{this.user.fetchJson(d,this.abortController.signal).then(m)});const f=(0,a.toNumber)(l.z_interval);(0,a.isNumber)(f)&&this.doOnBeat(()=>{this.user.fetchJson(d,this.abortController.signal).then(m)},f*60*1e3)}),[...e.querySelectorAll(".zoo_async_html")].forEach(n=>{const l=p.getElDataMap(n),d=l.href;this.user.fetchAndSplit(d,this.abortController.signal).then(v=>{n.appendChild(v.html),this.parseContent(n),this.evalScripts(v.scripts),this.evalModules(v.modules),this.onAsyncHtmlReply(n,l)});const m=(0,a.toNumber)(l.z_interval);(0,a.isNumber)(m)&&this.doOnBeat(()=>{this.user.fetchAndSplit(d,this.abortController.signal).then(v=>{n.replaceChildren(v.html),this.parseContent(n),this.evalScripts(v.scripts),this.evalModules(v.modules)})},m*60*1e3)})}enterDocument(){const e=this.getElement();this.parseContent(e),this.evalScripts(this.responseObject.scripts),this.evalModules(this.responseObject.modules),super.enterDocument()}exitDocument(){this.abortController.abort(),super.exitDocument()}setIsRedirected(e,t){this.redirected=e,this.redirected&&t&&(this.uri_=t)}dispatchPanelEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.PANEL,s);return this.debugMe(`PANEL EVENT FIRED:
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("./chunks/component-library-registry-BBQV6Kpv.js"),p=require("./chunks/tree-utils-B_lCUFMV.js"),U=require("./chunks/zoo-B8_zFikt.js");let a=require("badu"),De=require("ramda");var L=class extends EventTarget{#e=!1;#t=!1;#s=new Map;#r=new Set;#i=new Set;static makeEvent(e,t){return new CustomEvent(e,{detail:t})}set debugMode(e){if(typeof e!="boolean")throw new Error("This must be a boolean");this.#e=e}get debugMode(){return this.#e}get disposed(){return this.#t}get listeningTo(){return this.#s}get isObservedBy(){return this.#r}get activeIntervals(){return this.#i}debugMe(...e){this.#e&&console.log.apply(null,[this.constructor.name,"DEBUG:",...e])}isListenedToBy(e){this.#r.add(e)}listen(e,t,s,r=!1){e.addEventListener(t,s,r);const i=this.listeningTo.get(e)||{};i[t]=()=>e.removeEventListener(t,s,r),this.listeningTo.set(e,i),(0,a.isDef)(e.isListenedToBy)&&e.isListenedToBy(this)}stopBeingListenedTo(){for(const e of this.isObservedBy)e.stopListeningTo(this),this.isObservedBy.delete(e)}stopListeningTo(e,t){e&&this.listeningTo.has(e)&&((0,a.isDef)(e.isObservedBy)&&e.isObservedBy.delete(this),(0,a.isDef)(t)?(Object.entries(this.listeningTo.get(e)).forEach(([s,r])=>{s===t&&r()}),Object.keys(this.listeningTo.get(e)).length||this.listeningTo.delete(e)):(Object.values(this.listeningTo.get(e)).forEach(s=>s()),this.listeningTo.delete(e)))}removeAllListener(){for(const e of this.listeningTo.keys())this.stopListeningTo(e)}clearAllIntervals(){for(const e of this.activeIntervals)clearInterval(e),this.activeIntervals.delete(e)}doOnBeat(e,t){const s=setInterval(e,t);this.activeIntervals.add(s)}disposeInternal(){this.stopBeingListenedTo(),this.removeAllListener(),this.clearAllIntervals(),this.#t=!0}dispose(){this.disposeInternal()}},k=class{constructor(e,t){this.value_=e,this.data_=t||{}}getValue(){return this.value_}getData(){return this.data_}},u={COMP:(0,a.randomId)(),COMP_DRAG_START:(0,a.randomId)(),COMP_DRAG_MOVE:(0,a.randomId)(),COMP_DRAG_END:(0,a.randomId)(),PANEL:(0,a.randomId)(),VIEW:(0,a.randomId)(),SPLIT:(0,a.randomId)(),SPLIT_WILL_OPEN:(0,a.randomId)(),SPLIT_DID_OPEN:(0,a.randomId)(),SPLIT_WILL_CLOSE:(0,a.randomId)(),SPLIT_DID_CLOSE:(0,a.randomId)(),SPLIT_TRANSITION_END:(0,a.randomId)(),READY:(0,a.randomId)(),PANEL_MINIMIZE:(0,a.randomId)(),FORM_SUBMIT_SUCCESS:(0,a.randomId)()},A={NOT_SUPPORTED:"Method not supported",DECORATE_INVALID:"Invalid element to decorate",ALREADY_RENDERED:"Component already rendered",ALREADY_DISPOSED:"Component already disposed",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document",STATE_INVALID:"Invalid component state"},w=class extends L{static compEventCode(){return u.COMP}static compReadyCode(){return u.READY}static compErrors(){return A}#e;#t;#s;#r;#i;#n;#o;#a;constructor(){super(),this.#e=()=>document.createElement("div"),this.#t=!1,this.#s=void 0,this.#r=void 0,this.#i=void 0,this.#n=void 0,this.#o=new Map,this.outOfTreeElements=[],this.placeholderDom=void 0,this.#a=()=>{}}set target(e){this.#i=e}get target(){return this.#i}set model(e){this.#r=e}get model(){return this.#r}set isInDocument(e){this.#t=e}get isInDocument(){return this.#t}set domFunc(e){this.#e=e}set readyFunc(e){this.#a=e}setElementInternal_(e){this.#s=e}getElement(){return this.#s}createDom(){this.#s=this.#e()}assertCanRenderAsync(){if(this.disposed)throw new Error(A.ALREADY_DISPOSED)}render(e){this.render_(e)}render_(e){if(this.disposed)throw new Error(A.ALREADY_DISPOSED);if(this.isInDocument)throw new Error(A.ALREADY_RENDERED);this.#s||this.createDom();const t=this.#s;e&&(this.#i=e),this.placeholderDom&&p.removeNode(this.placeholderDom),this.#i?p.isInPage(t)||this.#i.insertBefore(t,null):p.isInPage(t)||document.body.appendChild(t),(!this.#n||this.#n.isInDocument)&&this.enterDocument()}hoist(e,t=void 0){t||(t=document.querySelector("body")),t.appendChild(e),this.outOfTreeElements.push(e)}executeBeforeReady(){this.#a()}enterDocument(){this.disposed?p.removeNode(this.getElement()):(this.isInDocument=!0,[...this.#o.values()].forEach(e=>{!e.isInDocument&&e.getElement()&&e.enterDocument()}),this.executeBeforeReady(),this.dispatchCompEvent(u.READY))}exitDocument(){[...this.#o.values()].forEach(e=>{e.isInDocument&&e.exitDocument()}),this.stopBeingListenedTo(),this.removeAllListener(),this.isInDocument=!1,p.removeNode(this.getElement()),this.placeholderDom&&p.removeNode(this.placeholderDom)}disposeInternal(){this.isInDocument&&this.exitDocument(),this.#o&&[...this.#o.values()].forEach(e=>e.disposeInternal()),this.outOfTreeElements.forEach(p.removeNode),this.#s&&p.removeNode(this.#s),this.placeholderDom&&p.removeNode(this.placeholderDom),this.#o=null,this.#s=void 0,this.#r=null,this.#n=null,super.disposeInternal()}dispose(){this.abortController&&this.abortController.abort();const e=this.getElement();if(e)for(const t of M.ComponentLibraryRegistry.getRegisteredLibraries())try{const s=M.ComponentLibraryRegistry.get(t);s.dispose&&s.dispose(e)}catch(s){console.debug(`[${t}] Cleanup error during component disposal (non-critical):`,s)}super.dispose()}dispatchCompEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.COMP,s);return this.dispatchEvent(r)}},c={CLICK:"click",RIGHTCLICK:"rightclick",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",MOUSEENTER:"mouseenter",MOUSELEAVE:"mouseleave",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel",SUBMIT:"submit",CHANGE:"change",INPUT:"input",INVALID:"invalid",DRAGSTART:"dragstart",DRAGEND:"dragend",DRAGOVER:"dragover",DRAGENTER:"dragenter",DRAGEXIT:"dragexit",DRAGLEAVE:"dragleave",DROP:"drop",TRANSITIONEND:"transitionend",ANIMATIONEND:"animationend"},Ce=[c.TOUCHMOVE,c.TOUCHSTART,c.TOUCHEND],Me=e=>Ce.includes(e.type),x=e=>(Me(e)&&(e.clientX=e.targetTouches[0].clientX,e.clientY=e.targetTouches[0].clientY),e),be=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i),h=o.currentTarget,[g,_]=p.getPos(h),E=o.clientX-g,D=o.clientY-_,n=e(g,_,E,D,h),l=s(g,_,E,D,h),d=t(g,_,E,D,h);let m=Te(d,h,E,D);["x","ew"].includes(r)?m=ye(d,h,E,D):["y","ns"].includes(r)&&(m=Le(d,h,E,D));let v=!1;const f=b=>{v=!0,m(b)},S=b=>{document.removeEventListener(c.MOUSEMOVE,f,!0),document.removeEventListener(c.TOUCHMOVE,f,!0),document.removeEventListener(c.MOUSEUP,S,!0),document.removeEventListener(c.TOUCHEND,S,!0),v&&l(b)};return document.addEventListener(c.MOUSEUP,S,!0),document.addEventListener(c.TOUCHEND,S,!0),document.addEventListener(c.MOUSEMOVE,f,!0),document.addEventListener(c.TOUCHMOVE,f,!0),n(i),S},Te=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.left=`${o.clientX-s}px`,t.style.top=`${o.clientY-r}px`,e(o)},ye=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.left=`${o.clientX-s}px`,e(o)},Le=(e,t,s,r)=>i=>{i.preventDefault();const o=x(i);t.style.top=`${o.clientY-r}px`,e(o)},q=(e,t)=>(s,r,i,o,h)=>g=>{e.dispatchCompEvent(t,{component:e,browserEvent:g,left:s,top:r,clientX:g.clientX,clientY:g.clientY,xOrg:i,yOrg:o,deltaX:g.clientX-i-s,deltaY:g.clientY-o-r,target:h})},z=class extends w{#e;#t;#s;#r;constructor(e="xy"){super(),this.#e=["x","y","xy","ew","ns"].includes(e.toLowerCase())?e.toLowerCase():"xy",this.#t=void 0,this.#s=!0,this.#r=t=>null}cancelDrag(e){this.#r(e)}set moveFreedom(e){this.#e=e,this.#s||(this.lock(),this.unlock())}get moveFreedom(){return this.#e}executeBeforeReady(){this.unlock(),super.executeBeforeReady()}unlock(){const e=t=>s=>{this.#r=t(s)};if(this.isInDocument&&this.#s){const t=q(this,u.COMP_DRAG_MOVE),s=be(q(this,u.COMP_DRAG_START),t,q(this,u.COMP_DRAG_END),this.#e);this.#s=!1,this.#t=this.#t||this.getElement(),this.listen(this.#t,c.MOUSEDOWN,e(s)),this.listen(this.#t,c.TOUCHSTART,s),this.#t.classList.remove("locked")}}lock(){this.stopListeningTo(this.#t,c.MOUSEDOWN),this.stopListeningTo(this.#t,c.TOUCHSTART),this.#s=!0,this.#t.classList.add("locked")}},se=M.__exportAll({getPath:()=>j,getQueryData:()=>oe,objectToUrlParms:()=>ae,queryDataToMap:()=>le}),we=new RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$"),re={SCHEME:1,USER_INFO:2,DOMAIN:3,PORT:4,PATH:5,QUERY_DATA:6,FRAGMENT:7},ie=e=>e.match(we),ne=(e,t)=>e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):"",j=e=>ne(ie(e)[re.PATH],!0),oe=e=>ne(ie(e)[re.QUERY_DATA],!0),ae=e=>Object.entries(e).map(t=>`${t[0]}=${t[1]}`).join("&"),Q=e=>e!=null&&e!=="",le=e=>e.split("&").reduce((t,s)=>{const[r,i]=s.split("=");return Q(r)&&Q(i)&&t.set(r,i),t},new Map),Ie=(0,a.stripLeadingChar)(" "),Oe=(0,a.stripLeadingChar)("/"),Re=e=>document.cookie.split(";").map(t=>t.split("=")).reduce((t,s)=>t.set(Ie(s[0]),s[1]),new Map).get(e),Pe=e=>{let t=0,s;const r=i=>{const o=i>0;return o?t+=1:t-=1,o?t===1:t===0};return i=>{s=s||document.getElementById(e),s&&r(i)&&s.classList.toggle("viz",t>0)}},ce=Pe("the_loader"),$=()=>Promise.resolve(ce(1)),V=e=>(ce(0),Promise.resolve(e)),I=e=>e.ok?Promise.resolve(e):Promise.reject(new Error(`${e.url} ${e.status} (${e.statusText})`)),Ae=e=>t=>{if(t.type==="opaqueredirect"||t.redirected){const s=Oe(j(t.url));e.setIsRedirected(!0,s),console.log("Redirect detected",s)}return I(t)},R=e=>e.json(),H=e=>e.text().then(t=>Promise.resolve(t),t=>Promise.reject(new Error(`Could not get text from response: ${t}`))),Ne=e=>e.headers.get("Content-Type")==="application/json"?R(e):H(e),N=(e,t,s="POST",r=void 0)=>{const i=new Headers;i.append("Content-type","application/json"),i.append("X-Requested-With","XMLHttpRequest"),e&&e!==""&&i.append("Authorization",`Bearer ${e}`);const o={cache:"no-cache",method:s,headers:i,credentials:"include",body:JSON.stringify(t)};return r&&(o.signal=r),o},he=(e,t,s=!1,r=void 0)=>{const i=new Headers;if(t&&t!==""&&i.append("Authorization",`Bearer ${t}`),i.append("X-Requested-With","XMLHttpRequest"),s){const h=Re("csrftoken");h&&s&&i.append("X-CSRFToken",h)}const o={cache:"no-cache",method:e,headers:i,redirect:"follow",credentials:"include"};return r&&(o.signal=r),o},Ve=(e,t,s=void 0)=>{const r=he("POST",e,!1,s);return r.body=new FormData(t.formEl),r},Z=(e,t=void 0)=>{const s=new Headers;s.append("Authorization",`Bearer ${e}`),s.append("X-Requested-With","XMLHttpRequest");const r={cache:"no-cache",headers:s,credentials:"include"};return t&&(r.signal=t),r},Ue=(e,t)=>{const s=new Request(e);return fetch(s,t).then(I).then(H)},y=(e,t=void 0)=>s=>(V("").then(a.identity),s.name==="AbortError"?console.info(e,"ABORTED!"):console.error(e,s),t),P=class{constructor(e){this.user_={},this.jwt="",e&&this.updateProfileFromJwt(e).then(()=>{})}updateProfileFromJwt(e,t=!1){return t&&this.jwt!==""?Promise.resolve("User Profile Already exists"):e.non_field_errors?Promise.reject(new Error(`JWT ${e.non_field_errors}`)):(this.updateToken(e.token),this.updateProfile(e.user),Promise.resolve("User Profile Updated"))}updateProfile(e){this.user_=e}updateToken(e){this.jwt=e}get id(){return this.user_.id}get name(){return this.user_.name}get surname(){return this.user_.surname}get salutation(){let e=this.name;const t=this.surname;return t&&(e=e+" "+t),e}formSubmit(e){const t=new Request(e.uri.toString()),s=e.processSubmitReply.bind(e),r=y("Form submit error");return $().then(()=>fetch(t,Ve(this.jwt,e,e.abortController.signal))).then(Ae(e)).then(V).then(Ne).then(s).catch(r)}putNoBody(e,t=void 0,s=!1){const r=y("putNobody error");return Ue(e,he("PUT",this.jwt,s,t)).catch(r)}fetch(e,t=void 0){const s=new Request(e.toString()),r=y(`UMan Text GET Fetch: ${e}`);return $().then(()=>fetch(s,Z(this.jwt,t))).then(I).then(V).then(H).catch(r)}fetchAndSplit(e,t=void 0){const s=y(`fetchAndSplit: ${e}`);return this.fetch(e,t).then(p.handleTemplateProm).catch(s)}async fetchJson(e,t=void 0,s=void 0){const r=new Request(e.toString()),i=y(`fetchJson: ${e}`,s),o=Z(this.jwt,t);await $();let h;try{h=await(await fetch(r,o)).json()}catch(g){return i(g)}return await V(),h}patchJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`patchJson: ${e}`),o=N(this.jwt,t,"PATCH",s);return fetch(r,o).then(I).then(R).catch(i)}postJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`postJson: ${e}`),o=N(this.jwt,t,"POST",s);return fetch(r,o).then(I).then(R).catch(i)}putJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`putJson: ${e}`),o=N(this.jwt,t,"PUT",s);return fetch(r,o).then(I).then(R).catch(i)}delJson(e,t,s=void 0){const r=new Request(e.toString()),i=y(`delJson: ${e}`),o=N(this.jwt,t,"DELETE",s);return fetch(r,o).then(I).then(R).catch(i)}},B=class extends w{static panelEventCode(){return u.PANEL}static compReadyCode(){return u.READY}constructor(e){super(),this.qParamMap_=new Map,this.uri_="",e&&this.parseUri(e),this.evalScripts=p.evalScripts(this),this.evalModules=p.evalModules(this),this.redirected=!1,this.responseObject={html:null,scripts:null},this.user_=void 0,"AbortController"in window?this.abortController=new AbortController:this.abortController={signal:void 0,abort:()=>{}},this.listMap=new Map}get uri(){const e=this.qParamMap_.size>0?"?"+ae(Object.fromEntries(this.qParamMap_)):"";return this.uri_+e}set user(e){this.user_=e}get user(){return this.user_||(this.user_=new P),this.user_}parseUri(e){this.uri_=j(e),this.qParamMap_=le(oe(e))}addToQParams(e,t){this.qParamMap_.set(e,t)}removeFromQParams(e){this.qParamMap_.delete(e)}clearQParams(){this.qParamMap_.clear()}getCarbonComponents(e){return this.carbonComponents?.get(e)||[]}getCarbonComponentById(e){if(this.carbonComponents)for(const t of this.carbonComponents.values()){const s=t.find(r=>r.id===e);if(s)return s}}renderPlaceHolder(e){this.target&&(this.placeholderDom=e,this.target.insertBefore(this.placeholderDom,null))}renderWithTemplate(e){const t=this.user;return t?t.fetch(this.uri,this.abortController.signal).then(s=>(this.assertCanRenderAsync(),e&&e(this),this.onRenderWithTemplateReply(s).catch(r=>{r.message!==w.compErrors().ALREADY_DISPOSED&&console.error("RenderWithTemplate Err:",r)}),this)).catch(s=>{throw console.error("Panel.renderWithTemplate fetch failed:",s),s}):Promise.reject(new Error("No UserManager instance available for Panel.renderWithTemplate()"))}onRenderWithTemplateReply(e){return this.responseObject=p.splitScripts(e),this.domFunc=()=>this.responseObject.html,this.render(),Promise.resolve(this)}onReplacePartialDom(e,t){const s=this.getElement();if((0,a.isUndefined)(s))return;const r=e.html;if(t.startsWith("."))[...s.querySelectorAll(t)].filter(i=>(0,a.isDefAndNotNull)(i.id)).map(i=>[i,r.querySelector(`#${i.id}`)]).filter(([i,o])=>(0,a.isDefAndNotNull)(o)).forEach(([i,o])=>{i.parentNode.replaceChild(o,i),this.parseContent(o)});else if(t.startsWith("#")){const i=r.querySelector(t),o=s.querySelector(t);o.parentNode.replaceChild(i,o),this.parseContent(i)}this.evalScripts(e.scripts),this.evalModules(e.modules)}renderWithJSON(e){return this.user?this.user.fetchJson(this.uri_,this.abortController.signal).then(t=>{this.assertCanRenderAsync(),e&&e(t,this),this.onRenderWithJSON(t).then(a.identity)}).catch(t=>{throw console.error("Panel.renderWithJSON fetch failed:",t),t}):Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"))}onRenderWithJSON(e){return Promise.resolve(this)}onAsyncJsonReply(e,t,s){}onAsyncHtmlReply(e,t){}onViewDataBroadcast(e){}async parseContent(e){if(this.debugMe("Enable interactions. Panel:",e),M.ComponentLibraryRegistry.has("mdc")){const n=M.ComponentLibraryRegistry.get("mdc");n.render.call(this,e,n.cache)}if(typeof window.customElements<"u"&&M.ComponentLibraryRegistry.has("carbon")){const n=M.ComponentLibraryRegistry.get("carbon");try{await n.render.call(this,e,n.cache)}catch(l){console.error("[Zooy] Carbon initialization failed:",l)}}e.classList.contains("zoo__modal-base")&&e.classList.contains("close_on_click")&&this.listen(e,c.CLICK,n=>{n.target===e&&this.dispatchPanelEvent("destroy_me")}),[...e.querySelectorAll(".zoo__button:not(.external):not(.mdc-data-table__row)")].forEach(n=>{this.listen(n,c.CLICK,l=>{l.stopPropagation();const d=l.currentTarget,m=p.getElDataMap(d);this.dispatchPanelEvent(m.zv,Object.assign({orgEvt:l,trigger:d,href:d.href||m.href},m))})}),[...e.querySelectorAll("[href]:not(.external):not([event])")].forEach(n=>{this.listen(n,c.CLICK,l=>{const d=l.currentTarget;l.preventDefault(),l.stopPropagation();const m=p.getElDataMap(d),v=m.zv||"href";this.dispatchPanelEvent(v,Object.assign({orgEvt:l,trigger:l.target,href:d.href||m.href},m))})}),[...e.querySelectorAll("form.intercept_submit")].forEach(n=>{n.noValidate=!0,this.listen(n,c.SUBMIT,l=>{l.preventDefault(),l.stopPropagation();const d=p.getElDataMap(n),m=p.formToJSON(n.elements);this.dispatchPanelEvent(d.zv,Object.assign({orgEvt:l,trigger:l.target,formData:m,href:d.href},d))})}),[...e.querySelectorAll(".zoo__toggle_class_driver")].forEach(n=>{const l=p.getElDataMap(n),d=l.toggle_class_target_id,m=l.toggle_class,v=e.querySelector(`#${d}`);v&&m&&n.addEventListener(c.CLICK,f=>{f.stopPropagation(),v.classList.toggle(m)})});const t=Array.from(e.querySelectorAll(".folder_drop_zone")),s=Array.from(e.querySelectorAll("[draggable]")),r=n=>{n.preventDefault(),n.target.classList.add("drag_over")},i=n=>{n.preventDefault()},o=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},h=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},g=n=>{n.preventDefault(),n.target.classList.remove("drag_over")},_=n=>{n.dataTransfer.dropEffect="move";const l=p.getElDataMap(n.target);n.dataTransfer.setData("text/plain",JSON.stringify(l)),n.target.classList.add("drag_in_progress")},E=n=>{n.target.classList.remove("drag_in_progress")},D=n=>{g(n),n.stopPropagation();const l=JSON.parse(n.dataTransfer.getData("text/plain")),d=p.getElDataMap(n.target);return this.dispatchPanelEvent("drop_on",{custom:{on:d,from:l}}),!1};t.forEach(n=>{this.listen(n,c.DRAGOVER,i),this.listen(n,c.DRAGENTER,r),this.listen(n,c.DRAGEXIT,h),this.listen(n,c.DRAGLEAVE,o),this.listen(n,c.DROP,D)}),s.forEach(n=>{this.listen(n,c.DRAGSTART,_),this.listen(n,c.DRAGEND,E)}),[...e.querySelectorAll(".zoo_async_json")].forEach(n=>{const l=p.getElDataMap(n),d=l.href,m=this.onAsyncJsonReply.bind(this,n,l);this.user.fetchJson(d,this.abortController.signal).then(m);const v=l.z_json_reusable;v&&(this.jsonCallFuncs=this.jsonCallFuncs||{},this.jsonCallFuncs[v]=()=>{this.user.fetchJson(d,this.abortController.signal).then(m)});const f=(0,a.toNumber)(l.z_interval);(0,a.isNumber)(f)&&this.doOnBeat(()=>{this.user.fetchJson(d,this.abortController.signal).then(m)},f*60*1e3)}),[...e.querySelectorAll(".zoo_async_html")].forEach(n=>{const l=p.getElDataMap(n),d=l.href;this.user.fetchAndSplit(d,this.abortController.signal).then(v=>{n.appendChild(v.html),this.parseContent(n),this.evalScripts(v.scripts),this.evalModules(v.modules),this.onAsyncHtmlReply(n,l)});const m=(0,a.toNumber)(l.z_interval);(0,a.isNumber)(m)&&this.doOnBeat(()=>{this.user.fetchAndSplit(d,this.abortController.signal).then(v=>{n.replaceChildren(v.html),this.parseContent(n),this.evalScripts(v.scripts),this.evalModules(v.modules)})},m*60*1e3)})}enterDocument(){const e=this.getElement();this.parseContent(e),this.evalScripts(this.responseObject.scripts),this.evalModules(this.responseObject.modules),super.enterDocument()}exitDocument(){this.abortController.abort(),super.exitDocument()}setIsRedirected(e,t){this.redirected=e,this.redirected&&t&&(this.uri_=t)}dispatchPanelEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.PANEL,s);return this.debugMe(`PANEL EVENT FIRED:
2
2
  value:${e}
3
3
  data:${t}`),this.dispatchEvent(r)}},de=class extends B{#e=null;#t=new Map;#s=!0;constructor(e,t=!0){super(e),this.#s=t,this.onSubmitSucFunc=(s,r)=>null}get formEl(){return this.#e}enterDocument(){super.enterDocument(),this.formIdElementToForm_()}formIdElementToForm_(){this.#e=this.getFormFromId(),this.#e&&(this.#a(this.#e),this.#r())}getFormFromId(e){let t=null,s=this.getElement().querySelector("form");return e&&(s=document.getElementById(e)||s),s&&s.tagName.toLowerCase()==="form"&&(t=s),t}#r(){this.#e&&(this.listen(this.#e,c.CHANGE,e=>{this.#o(e)},{passive:!0}),this.listen(this.#e,c.INPUT,e=>{this.clearAllValidationErrors(),this.#o(e)}),this.listen(this.#e,c.INVALID,e=>{e.preventDefault();const t=e.target;this.#n(t),this.displayFieldError(t)},{passive:!0}))}checkAllFields(){const e=[...this.#e.elements].map(t=>[this.#i(t),t]).filter(t=>!t[0]);return e.forEach(t=>this.displayFieldError(t[1])),e.length===0}clearAllValidationErrors(){[...this.#e?this.#e.elements:[]].forEach(e=>this.#n(e)),[...this.#e.querySelectorAll(".non-field-errors")].forEach(e=>e.classList.remove("alert-error"))}displayAlert_(e,t,s){const r=document.getElementById(`${e.id}-helper-text`)||document.createElement("p");r.textContent=t,this.#t.set(e,r)}#i(e){this.#n(e);let t=!e.willValidate;return e.willValidate&&(t=e.checkValidity()),t}#n(e){e.classList.remove("error"),this.#t.has(e)&&(this.#t.get(e).textContent=""),this.#t.delete(e)}displayFieldError(e,t){const s=t||e.validationMessage;e.classList.add("error"),this.displayAlert_(e,s,"alert-error")}displayFieldSuccess(e,t){this.displayAlert_(e,t,"alert-success")}displayFieldInfo(e,t){this.displayAlert_(e,t,"alert-info")}#o(e){this.#i(e.target)}#a(e){if(e&&this.#s){e.noValidate=!0;const t=this.user;this.listen(e,c.SUBMIT,s=>{s.preventDefault(),this.debugMe("Intercepted from SUBMIT"),this.checkAllFields()&&t&&t.formSubmit(this)})}return e}onSubmitSuccess(e){this.onSubmitSucFunc=e}replaceForm(e){if(this.responseObject=p.splitScripts(e),this.responseObject.html){if(this.redirected){this.removeAllListener();const t=this.getElement(),s=t.parentNode;this.setElementInternal_(this.responseObject.html),s.replaceChild(this.getElement(),t)}else{const t=this.responseObject.html.querySelector("form");t&&p.replaceNode(t,this.#e);const s=this.responseObject.html.querySelector('[type="submit"]'),r=this.getElement().querySelector('[type="submit"]');s&&r&&p.replaceNode(s,r)}this.enterDocument()}}refreshFromFromServer(){const e=this.user,t=this.uri;return e?e.fetch(t,this.abortController.signal).then(s=>this.replaceForm(s)):Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"))}processSubmitReply(e){this.clearAllValidationErrors();let t=!1;if((0,a.whatType)(e)==="object"&&e.success)return Promise.resolve(this).then(()=>{this.onSubmitSucFunc(this,e),this.dispatchCompEvent(u.FORM_SUBMIT_SUCCESS)});if(e==="success"?(this.debugMe(`
4
4
  1.REDIRECTED: ${this.redirected}
@@ -16,4 +16,4 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
16
16
  SUCCESS: ${t}`)}},ue=class extends w{static splitEventCode(){return u.SPLIT}constructor(){super(),this.dragImage_=document.createElement("canvas"),this.nestMap_=new Map,this.nestCallbackMap_=new Map,this.splitNests_=new Set}get nests(){return[...this.nestMap_.entries()].filter(([e,{nestEl:t}])=>t)}getNest(e){return this.nestMap_.get(e)?.nestEl}get nestNames(){return[...this.nestMap_.entries()].filter(([e,t])=>!this.splitNests_.has(t)).map(([e])=>e)}closeAndLockAll(e=a.identity,t=!1){this.nestNames.forEach(s=>this.closeAndLock(s,e,t))}openAndUnlockAll(e=a.identity,t=!1){this.nestNames.forEach(s=>this.openAndUnlock(s,e,t))}lock(e){const{dragEl:t}=this.nestMap_.get(e);t.classList.add("locked")}unlock(e){const{dragEl:t}=this.nestMap_.get(e);t.classList.remove("locked")}resize(e,t,s=a.identity,r=!1){const{sizeNow:i,nestEl:o,canResize:h}=this.nestMap_.get(e);h&&(r||i===t?(o.classList.remove("animated"),o.style.flexBasis=`${t}px`,this.nestMap_.get(e).sizeNow=t,s()):(o.classList.add("animated"),this.nestCallbackMap_.set(e,()=>{o.classList.remove("animated"),this.nestMap_.get(e).sizeNow=t,s()}),o.style.flexBasis=`${t}px`))}closeAndLock(e,t=a.identity,s=!1){const{nestEl:r,dragEl:i,canResize:o}=this.nestMap_.get(e);if(!o)return;const h=()=>{i.classList.add("locked","closed"),r.classList.add("closed"),t()};this.resize(e,0,h,s)}closeAndUnlock(e,t=a.identity,s=!1){const{nestEl:r,dragEl:i,canResize:o}=this.nestMap_.get(e);if(!o)return;const h=()=>{r.classList.remove("closed"),i.classList.remove("closed","locked"),i.classList.add("collapsed"),t()};this.resize(e,0,h,s)}openAndUnlock(e,t,s,r=!1){const{nestEl:i,dragEl:o,defSize:h,lastSize:g,canResize:_}=this.nestMap_.get(e);if(!_)return;const E=t||g||h;i.classList.remove("closed"),o.classList.remove("closed","locked","collapsed"),setTimeout(()=>{this.resize(e,E,s,r)},50)}openAndLock(e,t,s,r=!1){const{nestEl:i,dragEl:o,defSize:h,lastSize:g,canResize:_}=this.nestMap_.get(e);if(!_)return;const E=t||g||h;i.classList.remove("closed"),o.classList.remove("closed","collapsed"),setTimeout(()=>{this.resize(e,E,s,r)},50)}close(e,t=a.identity,s=!1){const{dragEl:r,canResize:i,nestEl:o}=this.nestMap_.get(e);if(!i)return;this.dispatchSplitEvent(u.SPLIT_WILL_CLOSE,{nestName:e,nestEl:o});const h=()=>{r.classList.add("collapsed"),this.dispatchSplitEvent(u.SPLIT_DID_CLOSE,{nestName:e,nestEl:o}),t()};this.resize(e,0,h,s)}open(e,t=a.identity,s=!1){const{defSize:r,lastSize:i,dragEl:o,canResize:h,nestEl:g}=this.nestMap_.get(e);if(!h)return;this.dispatchSplitEvent(u.SPLIT_WILL_OPEN,{nestName:e,nestEl:g}),o.classList.remove("collapsed","closed");const _=i||r,E=()=>{this.dispatchSplitEvent(u.SPLIT_DID_OPEN,{nestName:e,nestEl:g}),t()};this.resize(e,_,E,s)}toggle(e,t,s=!1){this.nestMap_.get(e).sizeNow===0?this.open(e,t,s):this.close(e,t,s)}addSplit(e=void 0,t="EW",s=100,r=100,i=[],o=[],h=[],g=[],_=[]){const E=e||this.getElement();if(this.splitNests_.has(E))return["Already used!",E];ze(E,t),this.splitNests_.add(E);let D="";if(e){const C=[...this.nestMap_.entries()].find(([T,{nestEl:O}])=>O===e);if(C)D=C[0];else return["Element not managed by this component",e]}const n=`${D}A`,l=ee(s,["zoo_nest__A",n,...i]),d=new z(t);d.domFunc=te([`zoo_drag_${n}`,...g],_),d.render(E),this.nestMap_.set(n,{side:"A",nestEl:l,dragger:d,dragEl:d.getElement(),defSize:s,sizeNow:-1,canResize:!0});const m=`${D}B`,v=ke(["zoo_nest__B",m,...o]);this.nestMap_.set(m,{nestEl:v,canResize:!1});const f=`${D}C`,S=new z(t);S.domFunc=te([`zoo_drag_${f}`,...g],_),S.render(E);const b=ee(r,["zoo_nest__C",f,...h]);this.nestMap_.set(f,{side:"C",nestEl:b,dragger:S,dragEl:S.getElement(),defSize:r,sizeNow:-1,canResize:!0}),[l,d.getElement(),v,S.getElement(),b].forEach(C=>E.appendChild(C));let J=0;const G=(C,T,O,_e)=>{let F;const Y=C==="NS"?"height":"width",Se=C==="NS"?"deltaY":"deltaX";return X=>{switch(X.detail.value_){case u.COMP_DRAG_START:F=T.getBoundingClientRect()[Y],J=v.getBoundingClientRect()[Y]+F,this.nestMap_.get(O).dragEl.classList.remove("collapsed");break;case u.COMP_DRAG_MOVE:{const K=Math.min(J,F+_e*X.detail.data_[Se]);this.nestMap_.get(O).lastSize=K,T.style.flexBasis=K+"px";break}case u.COMP_DRAG_END:this.dispatchSplitEvent(u.COMP_DRAG_END,this.nestMap_.get(O));break;default:break}}};this.listen(d,w.compEventCode(),G(t,l,n,1)),this.listen(S,w.compEventCode(),G(t,b,f,-1)),this.listen(d.getElement(),c.DBLCLICK,()=>this.toggle(n)),this.listen(S.getElement(),c.DBLCLICK,()=>this.toggle(f)),this.listen(d.getElement().querySelector(".zoo_grabber"),c.CLICK,()=>this.toggle(n)),this.listen(S.getElement().querySelector(".zoo_grabber"),c.CLICK,()=>this.toggle(f)),this.listen(l,c.TRANSITIONEND,C=>{if(C.propertyName==="flex-basis"&&C.target===l){const T=this.nestCallbackMap_.get(n);this.nestCallbackMap_.delete(n),T&&T(),this.dispatchSplitEvent(u.SPLIT_TRANSITION_END,this.nestMap_.get(n))}}),this.listen(b,c.TRANSITIONEND,C=>{if(C.propertyName==="flex-basis"&&C.target===b){const T=this.nestCallbackMap_.get(f);this.nestCallbackMap_.delete(f),T&&T(),this.dispatchSplitEvent(u.SPLIT_TRANSITION_END,this.nestMap_.get(f))}})}dispatchSplitEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.SPLIT,s);return this.dispatchEvent(r)}},ze=(e,t)=>(e.classList.add("zoo_split",`zoo_split__${t.toLowerCase()}`),e),ee=(e,t=[])=>{const s=document.createElement("div");return s.setAttribute("id",(0,a.randomId)(7)),s.classList.add("zoo_nest","zoo_nest__outer",...t),s.style.flexBasis=e+"px",s},ke=(e=[])=>{const t=document.createElement("div");return t.setAttribute("id",(0,a.randomId)(7)),t.classList.add("zoo_nest","zoo_nest__inner",...e),t},te=(e=[],t=[])=>()=>{const s=document.createElement("div");s.setAttribute("id",(0,a.randomId)(7)),s.classList.add("zoo_dragger",...e);const r=document.createElement("div");return r.classList.add("zoo_grabber",...t),s.appendChild(r),s},xe={toggle_tree:function(e,t){p.toggleTree(e,t)},"tree_toggle-children":function(e,t){p.toggleTreeChildren(t,e)}},pe={search:function(e,t){let s=`${e.href}`;const r=e.formData.q,i=e.targetval;if(r!==""&&(s=`${s}?q=${r}`),i!==""){let o=i;i.includes("page=")&&(o=i.split("&").filter(h=>!h.includes("page=")).join("&")),s=r!==""?`${s}&${o}`:`${s}?${o}`}this.user.fetchAndSplit(s,t.abortController.signal).then(o=>t.onReplacePartialDom(o,e.zvptarget))},reset_search:function(e,t){const s=e.trigger.closest("form");t.removeFromQParams("q"),s.elements.q.value="",s.dispatchEvent(new Event("submit"))}},me={paginate:function(e,t){const s=`${e.href}?${e.targetval}`;this.user.fetchAndSplit(s,t.abortController.signal).then(r=>t.onReplacePartialDom(r,e.zvptarget))},list_filter:function(e,t){const s=`${e.href}?${e.targetval}`;this.user.fetchAndSplit(s,t.abortController.signal).then(r=>t.onReplacePartialDom(r,e.zvptarget))}},ge=M.__exportAll({MdcTreeHandlers:()=>xe,QueryParamHandlers:()=>me,SearchHandlers:()=>pe}),W=class extends L{#e=void 0;#t=void 0;#s={};static viewEventCode(){return u.VIEW}constructor(){super(),this.panelMap=new Map,this.user_=void 0,this.split_=void 0,this.panelEventMap_=this.initPanelEventsInternal_(),this.switchViewMap_=new Map,this.metaData_=new Map}set recordHistory(e){this.#t=e}get recordHistory(){return this.#t}set registerViewConstructor(e){this.#e=e}get registerViewConstructor(){return this.#e}set utils(e){this.#s=e}get utils(){return this.#s}set split(e){this.split_=e,this.listen(this.split_,u.SPLIT,t=>{const s=t.detail.getValue(),r=t.detail.getData();switch(s){case u.SPLIT_WILL_OPEN:this.onSplitWillOpen(r);break;case u.SPLIT_WILL_CLOSE:this.onSplitWillClose(r);break;case u.SPLIT_DID_CLOSE:this.onSplitDidClose(r);break;case u.SPLIT_DID_OPEN:this.onSplitDidOpen(r);break;case u.SPLIT_TRANSITION_END:break;default:(0,a.identity)()}})}get split(){if(!this.split_)throw new Error("No SPLIT component available");return this.split_}set user(e){this.user_=e,this.panelMap.forEach(t=>t.user=e)}get user(){return this.user_||(this.user_=new P),this.user_}render(){this.initPanelEvents(),this.preRender(),this.configurePanels(),this.displayPanels(),this.postRender()}initPanelEvents(){}preRender(){}configurePanels(){}displayPanels(){}postRender(){}dispose(){[...this.panelMap.values()].forEach(e=>e.dispose()),super.dispose()}addPanelToView(e,t){t.user=this.user,this.removePanelByName(e),this.panelMap.set(e,t),this.listen(t,B.panelEventCode(),this.onPanelEvent.bind(this))}removePanelByName(e){this.panelMap.has(e)&&this.panelMap.get(e).dispose()}removePanel(e){const[t,s]=[...this.panelMap.entries()].find(([r,i])=>i===e);t&&s&&(s.dispose(),this.panelMap.delete(t))}getPanelByName(e){return this.panelMap.get(e)}broadcastToPanels(e){[...this.panelMap.values()].forEach(t=>t.onViewDataBroadcast(e))}initPanelEventsInternal_(){const e=new Map;return e.set("destroy_me",(t,s)=>{this.removePanel(s)}),e.set("switch_view",(t,s)=>{this.debugMe("switch_view received: eventData",t);const r=t.view;this.switchViewMap_.has(r)?this.switchViewMap_.get(r)(t,s):this.debugMe("NO VIEW FOUND FOR:",r,this.switchViewMap_)}),Object.entries({...pe,...me}).forEach(([t,s])=>{e.set(t,s.bind(this))}),e}mapPanEv(e,t){this.panelEventMap_.set(e,t)}mapSwitchView(e,t){this.switchViewMap_.set(e,t)}onPanelEvent(e){let t=e.detail.getValue();if(this.debugMe(`PanelEvent Value: ${t}`),!(0,a.isDefAndNotNull)(t)){this.debugMe(`The panel received an event without a value.
17
17
  There is nothing we can do with that.`);return}const s=e.detail.getData();t?.startsWith("switch_view:")&&(s.view=t.split(":")[1],t="switch_view");const r=e.target;this.panelEventMap_.has(t)?this.panelEventMap_.get(t)(s,r):this.debugMe(`NO EVENT MATCH - This usually you are missing
18
18
  a "mapPanEv(${t} ..." statement in your panel JS
19
- or you have a "event='${t}'" attribute in your panel HTML`,{event:e,eventValue:t,eventData:s,panel:r.constructor.name})}onSplitWillOpen(e){}onSplitWillClose(e){}onSplitDidClose(e){}onSplitDidOpen(e){}dispatchViewEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.VIEW,s);return this.dispatchEvent(r)}get metaData(){return this.metaData_}setMetaData(e,t){return this.metaData_.set(e,t),this.metaData}getMetaData(e){return this.metaData_.get(e)}hasMetaData(e){return this.metaData_.has(e)}},Ee=class extends L{#e=new Map;#t=null;#s=void 0;#r=void 0;#i=new Map;#n={};constructor(){super(),this.#i=this.#o(),window.addEventListener("popstate",e=>{e.state!==null&&this.navTo(e.state)}),this.doOnBeat(()=>{document.dispatchEvent(new CustomEvent("zoo-tick-60",{detail:{timestamp:Date.now()}}))},6e4)}set split(e){this.#r=e}get split(){if(!this.#r)throw new Error("No SPLIT component available");return this.#r}set user(e){this.#s=e,this.#t&&(this.#t.user=this.user)}get user(){return this.#s||(this.#s=new P),this.#s}get utils(){return this.#n}registerUtil(e){this.#n=(0,De.mergeRight)(this.#n,e)}#o(){return new Map().set("switch_view",(e,t)=>{if(this.#e.has(e.view)){const s=this.#e.get(e.view)(e.pk||e.recordId,e);this.switchView(s)}})}mapViewEv(e,t){this.#i.set(e,t)}registerViewConstructor(e,t){this.#e.set(e,t)}onViewEvent(e){const t=e.detail.getValue(),s=e.detail.getData(),r=e.target;this.#i.has(t)?this.#i.get(t)(s,r):console.warn("Unhandled VIEW Event:",e,t,s,r)}setActiveView(e){this.#t&&(this.stopListeningTo(this.#t),this.#t.dispose(),this.#t=null),this.#t=e,this.#t.render()}initView(e){return e.user=this.user,e.split=this.split,e.utils=this.utils,e.recordHistory=this.recordHistory.bind(this),e.registerViewConstructor=this.registerViewConstructor.bind(this),this.listen(e,W.viewEventCode(),this.onViewEvent.bind(this)),e}switchView(e){this.setActiveView(this.initView(e))}recordHistory(e){this.debugMe("HISTORY",e),e.init?history.replaceState(e,"",document.location.href):e.history||history.pushState(e,"",null)}navTo=e=>{e.history=!0;const t=e.view,s=this.#t;if(s.switchViewMap_.has(t))this.debugMe("NAV:VIEW:MAP",e),s.switchViewMap_.get(t)(e);else if(this.#e.has(t)){const r=this.#e.get(t)(e.pk,e);this.debugMe("NAV:NEW:VIEW",e),this.switchView(r)}}};async function ve(e={}){const{registerCarbonLibrary:t}=await Promise.resolve().then(()=>require("./chunks/register-qMbg83pa.js"));return t(e)}async function fe(){const{registerMdcLibrary:e}=await Promise.resolve().then(()=>require("./chunks/register-IdhOodSA.js"));return e()}var Be={Evt:L,Component:w,Dragger:z,Panel:B,FormPanel:de,Split:ue,UserManager:P,View:W,Conductor:Ee,DataBinder:U.Binder,UiEventType:u,domUtils:p.utils_exports,uriUtils:se,registerCarbonLibrary:ve,registerMdcLibrary:fe,ComponentLibraryRegistry:M.ComponentLibraryRegistry,handlers:ge,zoo:U.zoo_exports};exports.Binder=U.Binder;exports.Component=w;exports.ComponentLibraryRegistry=M.ComponentLibraryRegistry;exports.Conductor=Ee;exports.Dragger=z;exports.Evt=L;exports.FormPanel=de;exports.Panel=B;exports.Split=ue;exports.UiEventType=u;exports.UserManager=P;exports.View=W;exports.default=Be;Object.defineProperty(exports,"domUtils",{enumerable:!0,get:function(){return p.utils_exports}});Object.defineProperty(exports,"handlers",{enumerable:!0,get:function(){return ge}});exports.registerCarbonLibrary=ve;exports.registerMdcLibrary=fe;Object.defineProperty(exports,"uriUtils",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"zoo",{enumerable:!0,get:function(){return U.zoo_exports}});
19
+ or you have a "event='${t}'" attribute in your panel HTML`,{event:e,eventValue:t,eventData:s,panel:r.constructor.name})}onSplitWillOpen(e){}onSplitWillClose(e){}onSplitDidClose(e){}onSplitDidOpen(e){}dispatchViewEvent(e,t){const s=new k(e,t),r=L.makeEvent(u.VIEW,s);return this.dispatchEvent(r)}get metaData(){return this.metaData_}setMetaData(e,t){return this.metaData_.set(e,t),this.metaData}getMetaData(e){return this.metaData_.get(e)}hasMetaData(e){return this.metaData_.has(e)}},Ee=class extends L{#e=new Map;#t=null;#s=void 0;#r=void 0;#i=new Map;#n={};constructor(){super(),this.#i=this.#o(),window.addEventListener("popstate",e=>{e.state!==null&&this.navTo(e.state)}),this.doOnBeat(()=>{document.dispatchEvent(new CustomEvent("zoo-tick-60",{detail:{timestamp:Date.now()}}))},6e4)}set split(e){this.#r=e}get split(){if(!this.#r)throw new Error("No SPLIT component available");return this.#r}set user(e){this.#s=e,this.#t&&(this.#t.user=this.user)}get user(){return this.#s||(this.#s=new P),this.#s}get utils(){return this.#n}registerUtil(e){this.#n=(0,De.mergeRight)(this.#n,e)}#o(){return new Map().set("switch_view",(e,t)=>{if(this.#e.has(e.view)){const s=this.#e.get(e.view)(e.pk||e.recordId,e);this.switchView(s)}})}mapViewEv(e,t){this.#i.set(e,t)}registerViewConstructor(e,t){this.#e.set(e,t)}onViewEvent(e){const t=e.detail.getValue(),s=e.detail.getData(),r=e.target;this.#i.has(t)?this.#i.get(t)(s,r):console.warn("Unhandled VIEW Event:",e,t,s,r)}setActiveView(e){this.#t&&(this.stopListeningTo(this.#t),this.#t.dispose(),this.#t=null),this.#t=e,this.#t.render()}initView(e){return e.user=this.user,e.split=this.split,e.utils=this.utils,e.recordHistory=this.recordHistory.bind(this),e.registerViewConstructor=this.registerViewConstructor.bind(this),this.listen(e,W.viewEventCode(),this.onViewEvent.bind(this)),e}switchView(e){this.setActiveView(this.initView(e))}recordHistory(e){this.debugMe("HISTORY",e),e.init?history.replaceState(e,"",document.location.href):e.history||history.pushState(e,"",null)}navTo=e=>{e.history=!0;const t=e.view,s=this.#t;if(s.switchViewMap_.has(t))this.debugMe("NAV:VIEW:MAP",e),s.switchViewMap_.get(t)(e);else if(this.#e.has(t)){const r=this.#e.get(t)(e.pk,e);this.debugMe("NAV:NEW:VIEW",e),this.switchView(r)}}};async function ve(e={}){const{registerCarbonLibrary:t}=await Promise.resolve().then(()=>require("./chunks/register-Cdc1Dawc.js"));return t(e)}async function fe(){const{registerMdcLibrary:e}=await Promise.resolve().then(()=>require("./chunks/register-IdhOodSA.js"));return e()}var Be={Evt:L,Component:w,Dragger:z,Panel:B,FormPanel:de,Split:ue,UserManager:P,View:W,Conductor:Ee,DataBinder:U.Binder,UiEventType:u,domUtils:p.utils_exports,uriUtils:se,registerCarbonLibrary:ve,registerMdcLibrary:fe,ComponentLibraryRegistry:M.ComponentLibraryRegistry,handlers:ge,zoo:U.zoo_exports};exports.Binder=U.Binder;exports.Component=w;exports.ComponentLibraryRegistry=M.ComponentLibraryRegistry;exports.Conductor=Ee;exports.Dragger=z;exports.Evt=L;exports.FormPanel=de;exports.Panel=B;exports.Split=ue;exports.UiEventType=u;exports.UserManager=P;exports.View=W;exports.default=Be;Object.defineProperty(exports,"domUtils",{enumerable:!0,get:function(){return p.utils_exports}});Object.defineProperty(exports,"handlers",{enumerable:!0,get:function(){return ge}});exports.registerCarbonLibrary=ve;exports.registerMdcLibrary=fe;Object.defineProperty(exports,"uriUtils",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"zoo",{enumerable:!0,get:function(){return U.zoo_exports}});
package/dist/zooy.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as le, t as R } from "./chunks/component-library-registry-DB5UeqC2.js";
2
- import { a as Me, c as be, d as O, f as ee, i as we, l as Le, m as Oe, n as Ie, o as Re, p as ce, s as w, t as ye, u as te } from "./chunks/tree-utils-CIi6B6uU.js";
3
- import { i as Ae, t as Pe } from "./chunks/zoo-DsyOHBKi.js";
2
+ import { a as Me, c as we, d as O, f as ee, i as be, l as Le, m as Oe, n as Ie, o as Re, p as ce, s as b, t as ye, u as te } from "./chunks/tree-utils-CIi6B6uU.js";
3
+ import { i as Ae, t as Pe } from "./chunks/zoo-Cztpe9qH.js";
4
4
  import { identity as C, isDef as F, isDefAndNotNull as j, isNumber as se, isUndefined as Ne, randomId as f, stripLeadingChar as he, toNumber as ie, whatType as Ve } from "badu";
5
5
  import { mergeRight as Ue } from "ramda";
6
6
  var L = class extends EventTarget {
@@ -244,7 +244,7 @@ var L = class extends EventTarget {
244
244
  l.TOUCHEND
245
245
  ], ze = (e) => ke.includes(e.type), z = (e) => (ze(e) && (e.clientX = e.targetTouches[0].clientX, e.clientY = e.targetTouches[0].clientY), e), xe = (e, t, s, i) => (r) => {
246
246
  r.preventDefault();
247
- const o = z(r), c = o.currentTarget, [p, v] = be(c), m = o.clientX - p, S = o.clientY - v, n = e(p, v, m, S, c), a = s(p, v, m, S, c), h = t(p, v, m, S, c);
247
+ const o = z(r), c = o.currentTarget, [p, v] = we(c), m = o.clientX - p, S = o.clientY - v, n = e(p, v, m, S, c), a = s(p, v, m, S, c), h = t(p, v, m, S, c);
248
248
  let u = Be(h, c, m, S);
249
249
  ["x", "ew"].includes(i) ? u = Fe(h, c, m, S) : ["y", "ns"].includes(i) && (u = $e(h, c, m, S));
250
250
  let E = !1;
@@ -389,7 +389,7 @@ var L = class extends EventTarget {
389
389
  }, Qe = (e, t) => {
390
390
  const s = new Request(e);
391
391
  return fetch(s, t).then(I).then(J);
392
- }, b = (e, t = void 0) => (s) => (U("").then(C), s.name === "AbortError" ? console.info(e, "ABORTED!") : console.error(e, s), t), x = class {
392
+ }, w = (e, t = void 0) => (s) => (U("").then(C), s.name === "AbortError" ? console.info(e, "ABORTED!") : console.error(e, s), t), x = class {
393
393
  constructor(e) {
394
394
  this.user_ = {}, this.jwt = "", e && this.updateProfileFromJwt(e).then(() => {
395
395
  });
@@ -418,23 +418,23 @@ var L = class extends EventTarget {
418
418
  return t && (e = e + " " + t), e;
419
419
  }
420
420
  formSubmit(e) {
421
- const t = new Request(e.uri.toString()), s = e.processSubmitReply.bind(e), i = b("Form submit error");
421
+ const t = new Request(e.uri.toString()), s = e.processSubmitReply.bind(e), i = w("Form submit error");
422
422
  return q().then(() => fetch(t, Ke(this.jwt, e, e.abortController.signal))).then(Ye(e)).then(U).then(Xe).then(s).catch(i);
423
423
  }
424
424
  putNoBody(e, t = void 0, s = !1) {
425
- const i = b("putNobody error");
425
+ const i = w("putNobody error");
426
426
  return Qe(e, ve("PUT", this.jwt, s, t)).catch(i);
427
427
  }
428
428
  fetch(e, t = void 0) {
429
- const s = new Request(e.toString()), i = b(`UMan Text GET Fetch: ${e}`);
429
+ const s = new Request(e.toString()), i = w(`UMan Text GET Fetch: ${e}`);
430
430
  return q().then(() => fetch(s, ne(this.jwt, t))).then(I).then(U).then(J).catch(i);
431
431
  }
432
432
  fetchAndSplit(e, t = void 0) {
433
- const s = b(`fetchAndSplit: ${e}`);
433
+ const s = w(`fetchAndSplit: ${e}`);
434
434
  return this.fetch(e, t).then(Le).catch(s);
435
435
  }
436
436
  async fetchJson(e, t = void 0, s = void 0) {
437
- const i = new Request(e.toString()), r = b(`fetchJson: ${e}`, s), o = ne(this.jwt, t);
437
+ const i = new Request(e.toString()), r = w(`fetchJson: ${e}`, s), o = ne(this.jwt, t);
438
438
  await q();
439
439
  let c;
440
440
  try {
@@ -445,19 +445,19 @@ var L = class extends EventTarget {
445
445
  return await U(), c;
446
446
  }
447
447
  patchJson(e, t, s = void 0) {
448
- const i = new Request(e.toString()), r = b(`patchJson: ${e}`), o = V(this.jwt, t, "PATCH", s);
448
+ const i = new Request(e.toString()), r = w(`patchJson: ${e}`), o = V(this.jwt, t, "PATCH", s);
449
449
  return fetch(i, o).then(I).then(P).catch(r);
450
450
  }
451
451
  postJson(e, t, s = void 0) {
452
- const i = new Request(e.toString()), r = b(`postJson: ${e}`), o = V(this.jwt, t, "POST", s);
452
+ const i = new Request(e.toString()), r = w(`postJson: ${e}`), o = V(this.jwt, t, "POST", s);
453
453
  return fetch(i, o).then(I).then(P).catch(r);
454
454
  }
455
455
  putJson(e, t, s = void 0) {
456
- const i = new Request(e.toString()), r = b(`putJson: ${e}`), o = V(this.jwt, t, "PUT", s);
456
+ const i = new Request(e.toString()), r = w(`putJson: ${e}`), o = V(this.jwt, t, "PUT", s);
457
457
  return fetch(i, o).then(I).then(P).catch(r);
458
458
  }
459
459
  delJson(e, t, s = void 0) {
460
- const i = new Request(e.toString()), r = b(`delJson: ${e}`), o = V(this.jwt, t, "DELETE", s);
460
+ const i = new Request(e.toString()), r = w(`delJson: ${e}`), o = V(this.jwt, t, "DELETE", s);
461
461
  return fetch(i, o).then(I).then(P).catch(r);
462
462
  }
463
463
  }, G = class extends y {
@@ -468,7 +468,7 @@ var L = class extends EventTarget {
468
468
  return d.READY;
469
469
  }
470
470
  constructor(e) {
471
- super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "", e && this.parseUri(e), this.evalScripts = Me(this), this.evalModules = we(this), this.redirected = !1, this.responseObject = {
471
+ super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "", e && this.parseUri(e), this.evalScripts = Me(this), this.evalModules = be(this), this.redirected = !1, this.responseObject = {
472
472
  html: null,
473
473
  scripts: null
474
474
  }, this.user_ = void 0, "AbortController" in window ? this.abortController = new AbortController() : this.abortController = {
@@ -552,21 +552,25 @@ var L = class extends EventTarget {
552
552
  }
553
553
  onViewDataBroadcast(e) {
554
554
  }
555
- parseContent(e) {
556
- if (this.debugMe("Enable interactions. Panel:", e), typeof window.customElements < "u" && R.has("carbon")) {
557
- const n = R.get("carbon");
558
- n.render.call(this, e, n.cache).catch((a) => console.error("[Zooy] Carbon initialization failed:", a));
559
- }
560
- if (R.has("mdc")) {
555
+ async parseContent(e) {
556
+ if (this.debugMe("Enable interactions. Panel:", e), R.has("mdc")) {
561
557
  const n = R.get("mdc");
562
558
  n.render.call(this, e, n.cache);
563
559
  }
560
+ if (typeof window.customElements < "u" && R.has("carbon")) {
561
+ const n = R.get("carbon");
562
+ try {
563
+ await n.render.call(this, e, n.cache);
564
+ } catch (a) {
565
+ console.error("[Zooy] Carbon initialization failed:", a);
566
+ }
567
+ }
564
568
  e.classList.contains("zoo__modal-base") && e.classList.contains("close_on_click") && this.listen(e, l.CLICK, (n) => {
565
569
  n.target === e && this.dispatchPanelEvent("destroy_me");
566
570
  }), [...e.querySelectorAll(".zoo__button:not(.external):not(.mdc-data-table__row)")].forEach((n) => {
567
571
  this.listen(n, l.CLICK, (a) => {
568
572
  a.stopPropagation();
569
- const h = a.currentTarget, u = w(h);
573
+ const h = a.currentTarget, u = b(h);
570
574
  this.dispatchPanelEvent(u.zv, Object.assign({
571
575
  orgEvt: a,
572
576
  trigger: h,
@@ -577,7 +581,7 @@ var L = class extends EventTarget {
577
581
  this.listen(n, l.CLICK, (a) => {
578
582
  const h = a.currentTarget;
579
583
  a.preventDefault(), a.stopPropagation();
580
- const u = w(h), E = u.zv || "href";
584
+ const u = b(h), E = u.zv || "href";
581
585
  this.dispatchPanelEvent(E, Object.assign({
582
586
  orgEvt: a,
583
587
  trigger: a.target,
@@ -587,7 +591,7 @@ var L = class extends EventTarget {
587
591
  }), [...e.querySelectorAll("form.intercept_submit")].forEach((n) => {
588
592
  n.noValidate = !0, this.listen(n, l.SUBMIT, (a) => {
589
593
  a.preventDefault(), a.stopPropagation();
590
- const h = w(n), u = Re(n.elements);
594
+ const h = b(n), u = Re(n.elements);
591
595
  this.dispatchPanelEvent(h.zv, Object.assign({
592
596
  orgEvt: a,
593
597
  trigger: a.target,
@@ -596,7 +600,7 @@ var L = class extends EventTarget {
596
600
  }, h));
597
601
  });
598
602
  }), [...e.querySelectorAll(".zoo__toggle_class_driver")].forEach((n) => {
599
- const a = w(n), h = a.toggle_class_target_id, u = a.toggle_class, E = e.querySelector(`#${h}`);
603
+ const a = b(n), h = a.toggle_class_target_id, u = a.toggle_class, E = e.querySelector(`#${h}`);
600
604
  E && u && n.addEventListener(l.CLICK, (g) => {
601
605
  g.stopPropagation(), E.classList.toggle(u);
602
606
  });
@@ -613,13 +617,13 @@ var L = class extends EventTarget {
613
617
  n.preventDefault(), n.target.classList.remove("drag_over");
614
618
  }, v = (n) => {
615
619
  n.dataTransfer.dropEffect = "move";
616
- const a = w(n.target);
620
+ const a = b(n.target);
617
621
  n.dataTransfer.setData("text/plain", JSON.stringify(a)), n.target.classList.add("drag_in_progress");
618
622
  }, m = (n) => {
619
623
  n.target.classList.remove("drag_in_progress");
620
624
  }, S = (n) => {
621
625
  p(n), n.stopPropagation();
622
- const a = JSON.parse(n.dataTransfer.getData("text/plain")), h = w(n.target);
626
+ const a = JSON.parse(n.dataTransfer.getData("text/plain")), h = b(n.target);
623
627
  return this.dispatchPanelEvent("drop_on", { custom: {
624
628
  on: h,
625
629
  from: a
@@ -630,7 +634,7 @@ var L = class extends EventTarget {
630
634
  }), s.forEach((n) => {
631
635
  this.listen(n, l.DRAGSTART, v), this.listen(n, l.DRAGEND, m);
632
636
  }), [...e.querySelectorAll(".zoo_async_json")].forEach((n) => {
633
- const a = w(n), h = a.href, u = this.onAsyncJsonReply.bind(this, n, a);
637
+ const a = b(n), h = a.href, u = this.onAsyncJsonReply.bind(this, n, a);
634
638
  this.user.fetchJson(h, this.abortController.signal).then(u);
635
639
  const E = a.z_json_reusable;
636
640
  E && (this.jsonCallFuncs = this.jsonCallFuncs || {}, this.jsonCallFuncs[E] = () => {
@@ -641,7 +645,7 @@ var L = class extends EventTarget {
641
645
  this.user.fetchJson(h, this.abortController.signal).then(u);
642
646
  }, g * 60 * 1e3);
643
647
  }), [...e.querySelectorAll(".zoo_async_html")].forEach((n) => {
644
- const a = w(n), h = a.href;
648
+ const a = b(n), h = a.href;
645
649
  this.user.fetchAndSplit(h, this.abortController.signal).then((E) => {
646
650
  n.appendChild(E.html), this.parseContent(n), this.evalScripts(E.scripts), this.evalModules(E.modules), this.onAsyncHtmlReply(n, a);
647
651
  });
@@ -1262,7 +1266,7 @@ var L = class extends EventTarget {
1262
1266
  };
1263
1267
  };
1264
1268
  async function ot(e = {}) {
1265
- const { registerCarbonLibrary: t } = await import("./chunks/register-Ckx0JaFw.js");
1269
+ const { registerCarbonLibrary: t } = await import("./chunks/register-BW7XFFn2.js");
1266
1270
  return t(e);
1267
1271
  }
1268
1272
  async function at() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trintel/zooy",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "UI Building Blocks",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -1,52 +0,0 @@
1
- const A=require("./component-library-registry-BBQV6Kpv.js");let p=require("badu"),c=require("ramda"),o=require("lit");var T={json:t=>JSON.stringify(t,null,2),tpl:(t,r,e)=>{const i=e?.getAttribute("zoo-bind-attr-tpl")||e?.getAttribute("zoo-bind-tpl");if(!i)return t;try{return new Function("value","data",`return \`${i}\`;`)(t,r)}catch(n){return console.warn("[Binder] Invalid template:",i,n),t}}},w=class{#s;#t;#r;#e=null;#i;constructor(t,r,e,i={}){if(!r)throw new Error("Binder requires a URL");if(!e||!(e instanceof Element))throw new Error("Binder requires a valid rootEl Element");this.#s=t,this.#t=new URL(r,window.location.origin),this.#r=e,this.#i={...T,...i.formatters},i.urlParams?this.#a(i.urlParams):this.#n()}get url(){return this.#t}get data(){return this.#e}get limit(){return parseInt(this.#t.searchParams.get("limit")||"0",10)}get offset(){return parseInt(this.#t.searchParams.get("offset")||"0",10)}get isPaginated(){return(0,c.both)((0,c.has)("count"),(0,c.has)("results"))(this.#e)}#a(t){return Object.entries(t).forEach(([r,e])=>{if(!(0,p.isDefAndNotNull)(e)||e===""||Array.isArray(e)&&e.length<1){this.#t.searchParams.delete(r);return}if(Array.isArray(e)){this.#t.searchParams.set(r,e.join(","));return}this.#t.searchParams.set(r,e)}),this.#n(),this.#t}#n(){const t=this.#t.href.split(this.url.origin)[1].slice(1);this.#r.querySelectorAll("[zoo-bind-binderurl]").forEach(r=>{r.setAttribute("zoo-bind-binderurl",t)})}async fetchData(t={}){const r=await this.#s.user.fetchJson(this.#a(t).toString(),this.#s.abortController.signal);this.setData(r)}setData(t){this.#e=t,this.render()}render(){if(!(0,p.isDefAndNotNull)(this.#e)){console.warn("[Binder] No data to render");return}this.#n(),this.#o(this.#r,this.#e,0),this.#c()}#o(t,r,e=0,i={}){const n=i.removeAttributes??!1;t.querySelectorAll("[zoo-bind-attr]").forEach(s=>{s.closest("[zoo-template]")||(s.getAttribute("zoo-bind-attr").split(",").forEach(a=>{const[l,u]=a.split(":").map(f=>f.trim()),[m,d]=u.split("|").map(f=>f.trim());let h=this.#l(r,m,e);d&&this.#i[d]&&(h=this.#i[d](h,r,s)),(0,p.isDefAndNotNull)(h)&&s.setAttribute(l,h)}),n&&(s.removeAttribute("zoo-bind-attr"),s.removeAttribute("zoo-bind-attr-tpl")))}),t.querySelectorAll("[zoo-bind]").forEach(s=>{if(s.closest("[zoo-template]"))return;const[a,l]=s.getAttribute("zoo-bind").split("|").map(m=>m.trim());let u=this.#l(r,a,e);l&&this.#i[l]&&(u=this.#i[l](u,r,s)),s.textContent=u??"",n&&(s.removeAttribute("zoo-bind"),s.removeAttribute("zoo-bind-tpl"))})}#c(){this.#r.querySelectorAll("[zoo-template]").forEach(t=>{const r=t.getAttribute("zoo-template"),e=t.getAttribute("zoo-template-bind");if(!r){console.warn("[Binder] Consumer missing template ID",t);return}const i=this.#r.querySelector(`#${r}`);if(!i||i.tagName!=="TEMPLATE"){console.error(`[DataBinder] Template not found or invalid: ${r}`);return}const n=e?(0,c.path)(e.split("."),this.#e):this.#e;if(!n){console.warn(`[DataBinder] Data slice is undefined. Path: ${e}. Skipping render for this consumer.`);return}if(!Array.isArray(n)){console.error(`[DataBinder] Data slice is not an array. Path: ${e}`,n);return}t.innerHTML="",n.forEach((s,a)=>{const l=this.#u(i,s,a);t.appendChild(l)})})}#u(t,r,e){const i=t.content.cloneNode(!0);return this.#o(i,r,e,{removeAttributes:!0}),i}#l(t,r,e){const i={$index:()=>e,$index__paged:()=>this.offset+e,$index1:()=>e+1,$index1__paged:()=>this.offset+e+1};return i[r]?i[r]():(0,c.path)(r.split("."),t)}},g=new Map(Object.entries({event:"event",endpoint:"endpoint",href:"href",url:"url",target:"target","record-id":"recordId","zoo-sort-field":"sortField","zoo-view":"view","zoo-event":"event","zoo-href":"href"})),v=t=>{let r={};return Array.from(t.attributes).forEach(e=>{const i=e.name,n=e.value;g.has(i)?r[g.get(i)]=n:(i.startsWith("data-")||i.startsWith("zoo-"))&&(r=(0,c.assocPath)(i.split("-"),n,r))}),r},b=(t,r,e="event")=>t.getAttribute(r)||t.getAttribute(e),y=class extends o.LitElement{static properties={token:{type:String},prefix:{type:String},postfix:{type:String}};static styles=o.css`
2
- :host {
3
- display: inline-block;
4
- }
5
-
6
- .tag {
7
- text-align: center;
8
- display: inline-flex;
9
- align-items: center;
10
- justify-content: center;
11
- line-height: initial;
12
- width: max-content;
13
- padding: 0.2em 1em;
14
- border-radius: 1em;
15
- font-size: var(--zoo-theme-chips-font-size, 0.75rem);
16
- white-space: nowrap;
17
- word-break: break-word;
18
- box-sizing: border-box;
19
- }
20
- `;render(){const t=`${this.prefix??""}${this.token??"default"}${this.postfix??""}`;return o.html`
21
- <span
22
- class="tag"
23
- style="
24
- background-color: var(--zoo-tag-${t}-bg, var(--zoo-tag-default-bg, #9e9e9e));
25
- color: var(--zoo-tag-${t}-fg, var(--zoo-tag-default-fg, #ffffff));
26
- "
27
- >
28
- <slot></slot>
29
- </span>
30
- `}};customElements.get("zoo-tag")||customElements.define("zoo-tag",y);var _=t=>{const r=Math.floor((new Date-t)/1e3),e=[{name:"year",seconds:31536e3},{name:"month",seconds:2592e3},{name:"week",seconds:604800},{name:"day",seconds:86400},{name:"hour",seconds:3600},{name:"minute",seconds:60},{name:"second",seconds:1}];if(r<0){const i=Math.abs(r);for(const n of e){const s=Math.floor(i/n.seconds);if(s>=1)return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(s,n.name)}return"just now"}for(const i of e){const n=Math.floor(r/i.seconds);if(n>=1)return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-n,i.name)}return"just now"},k=t=>{const[{value:r},,{value:e},,{value:i},,{value:n},,{value:s},,{value:a}]=new Intl.DateTimeFormat("en",{day:"2-digit",month:"short",year:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(t);return`${e} ${r} ${i} ${n}:${s}:${a}`},E=t=>{const[{value:r},,{value:e},,{value:i}]=new Intl.DateTimeFormat("en",{day:"2-digit",month:"short",year:"2-digit"}).formatToParts(t);return`${e} ${r} ${i}`},z=class extends o.LitElement{static properties={timestamp:{type:Number},kind:{type:String},concat:{type:String}};static styles=o.css`
31
- :host {
32
- display: inline;
33
- }
34
-
35
- .relative {
36
- color: var(--zoo-timestamp-relative-color, inherit);
37
- font-weight: var(--zoo-timestamp-relative-weight, inherit);
38
- font-size: var(--zoo-timestamp-relative-size, inherit);
39
- }
40
-
41
- .static {
42
- color: var(--zoo-timestamp-static-color, inherit);
43
- font-weight: var(--zoo-timestamp-static-weight, inherit);
44
- font-size: var(--zoo-timestamp-static-size, inherit);
45
- }
46
-
47
- .separator {
48
- color: var(--zoo-timestamp-separator-color, inherit);
49
- }
50
- `;constructor(){super(),this.timestamp=Date.now(),this.kind="both",this.concat="r (s)",this._boundTickHandler=this._onTimeTick.bind(this),this._isListening=!1}_shouldListenToTicks(){return this.kind==="relative"||this.kind==="both"}connectedCallback(){super.connectedCallback(),this._updateTickListener()}disconnectedCallback(){this._removeTickListener(),super.disconnectedCallback()}updated(t){super.updated(t),t.has("kind")&&this._updateTickListener()}_updateTickListener(){const t=this._shouldListenToTicks();t&&!this._isListening?(document.addEventListener("zoo-tick-60",this._boundTickHandler),this._isListening=!0):!t&&this._isListening&&this._removeTickListener()}_removeTickListener(){this._isListening&&(document.removeEventListener("zoo-tick-60",this._boundTickHandler),this._isListening=!1)}_onTimeTick(){this.requestUpdate()}_parseTemplate(t){const r=[];let e=t;for(;e.length>0;){const i=e.indexOf("r"),n=[i,e.indexOf("s")].filter(s=>s!==-1).sort((s,a)=>s-a)[0];if(n===void 0){e.length>0&&r.push({type:"text",value:e});break}n>0&&r.push({type:"text",value:e.substring(0,n)}),n===i?r.push({type:"relative",value:""}):r.push({type:"static",value:""}),e=e.substring(n+1)}return r}_getFormattedParts(){let t=this.timestamp;t<9466848e5&&(t=t*1e3);const r=new Date(t),e=_(r),i=k(r),n=E(r);switch(this.kind){case"relative":return[{type:"relative",value:e}];case"datetime":return[{type:"static",value:i}];case"date":return[{type:"static",value:n}];case"both":return this._parseTemplate(this.concat).map(s=>s.type==="relative"?{type:"relative",value:e}:s.type==="static"?{type:"static",value:i}:s);default:return this._parseTemplate(this.concat).map(s=>s.type==="relative"?{type:"relative",value:e}:s.type==="static"?{type:"static",value:i}:s)}}render(){let t=this.timestamp;t<9466848e5&&(t=t*1e3);const r=new Date(t),e=this._getFormattedParts();return o.html`<time datetime="${r.toISOString()}">
51
- ${e.map(i=>i.type==="relative"?o.html`<span class="relative">${i.value}</span>`:i.type==="static"?o.html`<span class="static">${i.value}</span>`:o.html`<span class="separator">${i.value}</span>`)}
52
- </time>`}};customElements.get("zoo-timestamp")||customElements.define("zoo-timestamp",z);var $=A.__exportAll({ZooTag:()=>y,ZooTimestamp:()=>z,getEventAttribute:()=>b,getSemanticAttributes:()=>v});Object.defineProperty(exports,"Binder",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"getEventAttribute",{enumerable:!0,get:function(){return b}});Object.defineProperty(exports,"getSemanticAttributes",{enumerable:!0,get:function(){return v}});Object.defineProperty(exports,"zoo_exports",{enumerable:!0,get:function(){return $}});