(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(`.df-ui-lozenge[data-v-f6531cc4]{--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-f6531cc4]{font-weight:700}.df-ui-lozenge-clear[data-v-f6531cc4]{text-decoration:none;color:var(--lozenge-border-color)}.df-ui-lozenge-clear[data-v-f6531cc4]:before{content:"|";margin-left:.25em}.df-ui-lozenge-clear[data-v-f6531cc4]: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-2b2d361b]{margin:30px 0}.df-ui-row.df-ui-match-type[data-v-2b2d361b]{margin:20px 0}.df-ui-row.df-ui-condition[data-v-2b2d361b]{display:flex;margin:10px 0;align-items:center;gap:10px}[data-v-2b2d361b] .df-ui-row.df-ui-condition .df-ui-col{flex:1}[data-v-2b2d361b] .df-ui-row.df-ui-condition input[type=text],[data-v-2b2d361b] .df-ui-row.df-ui-condition select{width:100%}[data-v-2b2d361b] .df-ui-row.df-ui-condition .df-ui-row-actions{display:flex;gap:5px;justify-content:right}.df-ui-form-actions[data-v-2b2d361b]{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(e)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
import{A as v,l as g,c as k}from"./vendor-Bid8UQhM.js";const b=(o,t)=>{const i=o.__vccOpts||o;for(const[e,s]of t)i[e]=s;return i};function y(o){let t=null;if(document.cookie&&document.cookie!==""){const i=document.cookie.split(";");for(let e=0;e<i.length;e++){const s=i[e].trim();if(s.substring(0,o.length+1)===o+"="){t=decodeURIComponent(s.substring(o.length+1));break}}}return t}const w=()=>y("csrftoken");function p(){return Math.random().toString(36).substring(2,8)}class l{constructor(t,i,e){this.id=p(),this.identifier=t,this.relative=i,this._value=e}get value(){return this._value}set value(t){t!==null?this._value=t.toString():this._value=t}toObject(){return[this.identifier,{lookup:this.relative,value:this.value}]}}class u{constructor(t,i){this.id=p(),this.state=v({operation:t||"and",conditions:i||[]})}toObject(){return[this.operation.toLowerCase(),[...this.conditions.map(t=>t.toObject())]]}static fromObject(t){const i=t[1].map(e=>new l(e[0],e[1].lookup,e[1].value));return new u(t[0],i)}get operation(){return this.state.operation}set operation(t){this.state.operation=t}get conditions(){return this.state.conditions}set conditions(t){this.state.conditions=t}addConditions(...t){this.state.conditions.push(...t)}addConditionsAfter(t,...i){const s=this.state.conditions.findIndex(n=>n.id==t.id)+1;this.state.conditions.splice(s,0,...i)}removeConditions(...t){const i=t.map(e=>e.id);this.state.conditions=this.state.conditions.filter(e=>{if(!i.includes(e.id))return e})}}const _=()=>{const o=window.location.search;return new URLSearchParams(o)},S=(o,t)=>{const i=[];for(const[e,s]of Object.entries(t.filters).filter(([n,r])=>r.is_sticky)){const n=o.conditions.filter(r=>r.identifier===e);if(n.length>0){const r=n[0];i.push(r)}else i.push(new l(s.sticky_default[0],s.sticky_default[1].lookup,s.sticky_default[1].value))}return o.removeConditions(...i),i},C=o=>{const t=[];for(const[i,e]of Object.entries(o.filters).filter(([s,n])=>n.is_sticky))t.push(new l(e.sticky_default[0],e.sticky_default[1].lookup,e.sticky_default[1].value));return t},j=(o={})=>{const{optionsSchema:t}=o;if(typeof t>"u")throw Error("must supply the options schema");const e=_().get("q");let s=null;if(e)try{s=JSON.parse(e)}catch(c){console.error("Error parsing JSON:",c)}let n=null,r=[],d=null;s?(n=u.fromObject(s),r=S(n,t),n.conditions.length==0&&o.createDefault&&n.addConditions(new l),d=s):(o.createDefault?n=new u("and",[new l]):n=new u("and"),r=C(t)),r=g(r);const f=k(()=>{const c=[];if(r.value.length>0)for(const a of r.value){const h=t.filters[a.identifier].sticky_default;(a.relative!==h[1].lookup||a.value!==h[1].value)&&c.push(a)}return c}),m=k(()=>{const c=n.toObject();for(const a of f.value.toReversed())c[1].unshift(a.toObject());return JSON.stringify(c)});return{grouping:n,stickies:r,changedStickies:f,original:d,rendered:m}};export{l as C,b as _,j as a,w as u};
