import{aQ as k,s as _,bH as s,ct as E,aK as p,I as c,bi as a,t as f,cs as y,u as L,co as j,v as I,ch as D,ci as O,b9 as P,H as N}from"./index-UvaAT40e.js";import{O as R}from"./ObjectBar-BQn-rAYH.js";import{T as S}from"./ThreeColumnLayout-BRd-Jgmr.js";import{L as A}from"./LoadingSpinner-CRcacgcO.js";import{_ as T,P as F}from"./PlaceHolderImage-OI0HV4no.js";import{A as x}from"./Anchor-DbUVFTxQ.js";import{e as B,u as V,a as H,c as U,d as W,S as X}from"./useTriplestore-BZngkwQJ.js";import{M as q}from"./MapViewer-CqxinSFL.js";import{a as v,c as M,p as z}from"./triplestore-YmGWX4yk.js";import"./ChildTreeSearchButton-C65ZPLlZ.js";import"./VDataTable-BagkVmHP.js";import"./VInput-tBjZAjEz.js";import"./VChip-DWC_1h7b.js";import"./VSlideGroup-BkB-Mi6K.js";import"./transform-CA9Jdjju.js";import"./VSliderTrack-BSvqM6gM.js";import"./ObjectCard-Ck5X7LdM.js";import"./_commonjsHelpers-C4iS2aBk.js";const C=` BASE <https://db.antiquitatum-thesaurus.eu> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> PREFIX owl: <http://www.w3.org/2002/07/owl#> `,G={location:"Standort",production_place:"Herstellung",find_place:"Auffindung",prov_place:"Provenienz"},u={location:t=>`?object crm:P55_has_current_location <place/${t}> .`,production_place:t=>`?object crm:P108i_was_produced_by / crm:P7_took_place_at <place/${t}> .`,find_place:t=>`?object crm:O19i_was_objectencountered_at / crm:P7_took_place_at <place/${t}> .`,prov_place:t=>`?object crm:P30i_custody_transferred_through / crm:P9_consists_of / crm:P26_moved_to <place/${t}> .`};function $(t,e,l){let r=[];if(typeof e=="string"&&(e=[e]),e&&e.length)for(const o of e){let[n,i]=o.split("-IS_OR-");if(n=="context"&&l!="context")for(const m of i.split("-OR-"))r.push(m)}return r.length==0&&(r=Object.keys(u)),`{ ${r.map(o=>u[o](t)).join("} UNION {")} }`}async function K({id:t,qfilter:e,signal:l}){let r=` ${C} SELECT (COUNT(DISTINCT ?object_location) as ?location) (COUNT(DISTINCT ?object_prod_place) as ?production_place) (COUNT(DISTINCT ?object_find_place) as ?find_place) (COUNT(DISTINCT ?object_prov_place) as ?prov_place) WHERE { ${$(t,e,"context")} OPTIONAL { ${u.location(t)} BIND(?object as ?object_location) } OPTIONAL { ${u.production_place(t)} BIND(?object as ?object_prod_place) } OPTIONAL { ${u.find_place(t)} BIND(?object as ?object_find_place) } OPTIONAL { ${u.prov_place(t)} BIND(?object as ?object_prov_place) } } `,d=await v(r,{signal:l}),o=[];for(const[n,i]of Object.entries(d.results.bindings[0]))+i.value>0&&o.push({label:G[n],count:+i.value,iri:n});return o}async function Q({id:t,lang:e,signal:l}){let r=` ${C} PREFIX wdt: <http://www.wikidata.org/prop/direct/> SELECT * WHERE { <place/${t}> crm:P1_is_identified_by / crm:P190_has_symbolic_content ?place_name . OPTIONAL { <place/${t}> owl:sameAs ?place_gnd . } SERVICE <https://query.wikidata.org/sparql> { OPTIONAL { ?wd wdt:P227 "${t.replace("gnd_","")}" . { ?wd wdt:P17 ?country . ?country rdfs:label ?country_label . FILTER (LANG(?country_label) = "${e}") . } UNION { ?wd wdt:P625 ?coordinates . } } } } `,d=await v(r,{signal:l}),o=M(d,{place:{wikidata:"wd",gnd:"place_gnd",name:"place_name",country:"country_label",coordinates:["coordinates"]}});return o.place.coordinates&&(o.place.coordinates=o.place.coordinates.map(n=>z(n))),o.place}const b={build_place_condition:$,get_place_aggregation:K,get_place_data:Q},J={key:0},Y={class:"text-body-2"},bt={__name:"Place",setup(t){const{data:e,dataLoading:l}=B(b.get_place_data),{objectsCount:r,iris:d,searchLoading:o}=V({conditionFunction:b.build_place_condition,defaultResultsPerPage:20}),{objectCardsData:n,objectCardsDataLoading:i}=H(d),{objectCardsDataWithRelations:m}=U(n);let h=k({no_grouping:{context:{type:"term_aggregation",loading:!0,values:[],fetch_function:b.get_place_aggregation}}});return W(h,i),(g,w)=>(p(),_(E,null,{default:s(()=>[c(R),c(S,null,{"col-1":s(()=>[g.$vuetify.display.xs?(p(),_(T,{key:0,class:"px-2 mb-3",title:a(e).name},null,8,["title"])):f("",!0),c(y,{border:"",rounded:"",height:430},{default:s(()=>[a(l)?(p(),_(A,{key:0})):a(e).coordinates.length?(p(),_(q,{key:1,coordinates:a(e).coordinates},null,8,["coordinates"])):(p(),_(F,{key:2}))]),_:1})]),"col-2":s(()=>[c(y,{class:"px-2"},{default:s(()=>[g.$vuetify.display.xs?f("",!0):(p(),L("div",J,[c(T,{title:a(e).name},null,8,["title"]),c(j,{class:"my-4"})])),I("span",Y,["country"in a(e)?(p(),_(D,{key:0},{default:s(()=>[c(O,{cols:"4"},{default:s(()=>[I("h5",null,P(g.$t("place_page.country"))+":",1)]),_:1}),c(O,{cols:"8"},{default:s(()=>[N(P(a(e).country)+" ",1),c(x,{url:a(e).wikidata,sup:""},{default:s(()=>w[0]||(w[0]=[N("WD")])),_:1},8,["url"])]),_:1})]),_:1})):f("",!0)])]),_:1})]),_:1}),c(j),c(X,{"object-cards-data":a(n),"object-cards-data-with-relations":a(m),"search-loading":a(o)||a(i),"total-count":a(r),aggregation:a(h),"default-results-per-page":20,"default-sorting":"production_date_asc",mode:"objects_place"},null,8,["object-cards-data","object-cards-data-with-relations","search-loading","total-count","aggregation"])]),_:1}))}};export{bt as default};