(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(`.df-ui-lozenge[data-v-c5d470d7]{--lozenge-color: #000;--lozenge-border-color: var(--django-filtering-ui-tertiary);--lozenge-background-color: var(--django-filtering-ui-tertiary-shaded);display:flex;align-items:center;gap:.25em;padding:2px .75em;border-radius:10px;color:var(--lozenge-color);border:1px solid var(--lozenge-border-color);background-color:var(--lozenge-background-color)}.df-ui-lozenge-value[data-v-c5d470d7]{font-weight:700}.df-ui-lozenge-clear[data-v-c5d470d7]{text-decoration:none;color:var(--lozenge-border-color)}.df-ui-lozenge-clear[data-v-c5d470d7]:before{content:"|";margin-left:.25em}.df-ui-lozenge-clear[data-v-c5d470d7]:after{content:"×";margin-left:.5em}.df-ui-lozenges-form[data-v-b5a6cf70]{display:none}.df-ui-lozenges[data-v-b5a6cf70]{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;margin:20px 0;gap:5px}.df-ui-lozenges-preamble[data-v-b5a6cf70]{margin-right:5px}
.df-ui-debug-data[data-v-03e54b24]{margin:20px 0}.df-ui-debug-data-header[data-v-03e54b24]{display:flex}.df-ui-debug-data-header h4[data-v-03e54b24]{margin:0;flex:1}.df-ui-filtering[data-v-b919a4a5]{margin:30px 0}.df-ui-row.df-ui-match-type[data-v-b919a4a5]{margin:20px 0}.df-ui-row.df-ui-condition[data-v-b919a4a5]{display:flex;margin:10px 0;align-items:center;gap:10px}[data-v-b919a4a5] .df-ui-row.df-ui-condition .df-ui-col{flex:1}[data-v-b919a4a5] .df-ui-row.df-ui-condition input[type=text],[data-v-b919a4a5] .df-ui-row.df-ui-condition select{width:100%}[data-v-b919a4a5] .df-ui-row.df-ui-condition .df-ui-row-actions{display:flex;gap:5px;justify-content:right}.df-ui-form-actions[data-v-b919a4a5]{display:flex;gap:10px;margin:30px 0}
:root{--django-filtering-ui-primary-light: #fff;--django-filtering-ui-primary-dark: #000;--django-filtering-ui-primary: var(--django-filtering-ui-primary-light);--django-filtering-ui-primary-inverse: var( --django-filtering-ui-primary-dark );--django-filtering-ui-secondary: #ffc20e;--django-filtering-ui-secondary-shaded: rgba(255, 194, 14, .4);--django-filtering-ui-tertiary: #e07e26;--django-filtering-ui-tertiary-shaded: rgba(224, 126, 39, .2);--django-filtering-ui-shaded: #494948;--django-filtering-ui-shaded-more: #acacac}`)),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
import{_ as F,c as g,a as s,o as n,b as u,d as b,t as d,F as v,e as p,u as O,f as N,i as y,g as a,r as z,h as P,j as C,n as V,k as U,D as q}from"./assets/useQueryFilters-3i8om310.js";const S=(e,[l,o])=>{if(Array.isArray(o))for(const m of o)S(e,m);else e.push([l,o]);return e},M={class:"df-ui-lozenge"},Q=["data-value"],G=["data-value"],H=["data-value"],J={__name:"Lozenge",props:["schema","condition","disableRemove"],setup(e){const l=g(()=>e.schema.filter(t=>t.name==e.condition.identifier)[0]),o=g(()=>l.value.lookups[e.condition.relative]),m=g(()=>o.value.label),h=()=>o.value.choices.reduce(S,[]).filter(([t])=>t===e.condition.value)[0][1];return(t,c)=>(n(),s("div",M,[u("span",{class:"df-ui-lozenge-identifier","data-value":e.condition.identifier},d(l.value.label),9,Q),u("span",{class:"df-ui-lozenge-relative","data-value":e.condition.relative},d(m.value),9,G),u("span",{class:"df-ui-lozenge-value","data-value":e.condition.value},[l.value.lookups[e.condition.relative].type=="choice"?(n(),s(v,{key:0},[p(d(h()),1)],64)):l.value.lookups[e.condition.relative].type=="date-range"?(n(),s(v,{key:1},[p(d(new Date(e.condition.value[0]).toLocaleDateString())+" - "+d(new Date(e.condition.value[1]).toLocaleDateString()),1)],64)):(n(),s(v,{key:2},[p(d(e.condition.value),1)],64))],8,H),e.disableRemove?b("",!0):(n(),s("a",{key:0,class:"df-ui-lozenge-clear",href:"#",title:"clear",onClick:c[0]||(c[0]=R=>t.$emit("remove"))}))]))}},$=F(J,[["__scopeId","data-v-c5d470d7"]]),K={and:"all",or:"any",not:"none"},W=e=>K[e],X=["action"],Y=["value"],Z=["value"],ee={key:0,class:"df-ui-lozenges"},te={class:"df-ui-lozenges-preamble"},ne={__name:"Listing",setup(e){const l=O(),o=y("filtering-options-schema");y("model-listing-url");const m=y("model-filtering-url"),h=P("filteringForm"),{grouping:t,stickies:c,changedStickies:R,rendered:A}=N({optionsSchema:o}),_=Object.entries(o.filters).map(([r,f])=>({name:r,...f})),B=t?W(t.operation):null,E=g(()=>!!(t.conditions.length||c.value.length)),L=()=>{V(()=>h.value.dispatchEvent(new Event("submit")))},I=r=>{t.removeConditions(r),L()},T=r=>{const f=c.value.findIndex(w=>w.id===r.id),[i,{lookup:k,value:j}]=o.filters[r.identifier].sticky_default;c.value[f].lookup=k,c.value[f].value=j,L()};return(r,f)=>(n(),s(v,null,[u("form",{class:"df-ui-lozenges-form",ref_key:"filteringForm",ref:h,method:"post",action:a(m)},[u("input",{type:"hidden",name:"csrfmiddlewaretoken",value:a(l)},null,8,Y),u("input",{type:"hidden",name:"q",value:a(A)},null,8,Z)],8,X),E.value?(n(),s("div",ee,[u("span",te,"Results match "+d(a(B))+" of:",1),(n(!0),s(v,null,z(a(c),i=>(n(),C($,{key:i.id,condition:i,schema:a(_),disableRemove:!a(R).includes(i),onRemove:k=>T(i)},null,8,["condition","schema","disableRemove","onRemove"]))),128)),a(t)?(n(!0),s(v,{key:0},z(a(t).conditions,i=>(n(),C($,{key:i.id,condition:i,schema:a(_),onRemove:k=>I(i)},null,8,["condition","schema","onRemove"]))),128)):b("",!0)])):b("",!0)],64))}},oe=F(ne,[["__scopeId","data-v-b5a6cf70"]]),D=document.getElementById("vue-app"),x=U(oe);x.use(q,{rootElement:D});x.mount(D);
