sanity-plugin-taxonomy-manager 3.1.5 → 3.2.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.
- package/README.md +74 -8
- package/lib/index.d.ts +5 -0
- package/lib/index.esm.d.mts +5 -0
- package/lib/index.esm.esm.js +1 -1
- package/lib/index.esm.esm.js.map +1 -1
- package/lib/index.esm.mjs +1 -1
- package/lib/index.esm.mjs.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/inputs/hierarchy/InputOrphans.tsx +1 -1
- package/src/components/inputs/hierarchy/InputTopConcepts.tsx +2 -2
- package/src/index.ts +10 -3
- package/src/skosConcept.tsx +4 -3
- package/src/skosConceptScheme.tsx +7 -3
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Sanity Taxonomy Manager
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|

|
|
5
4
|

|
|
6
5
|
|
|
@@ -11,19 +10,20 @@
|
|
|
11
10
|
The Taxonomy Manager document schema is based on the [World Wide Web Consortium](https://www.w3.org/) (W3C) [Simple Knowledge Organization Scheme](https://www.w3.org/TR/skos-reference/) (SKOS) recommendation. Concept and concept scheme editor tools include standard SKOS properties, hints for creating consistent concepts and vocabularies, and validation functions for preventing consistency errors. -->
|
|
12
11
|
|
|
13
12
|
|  |
|
|
14
|
-
|
|
|
13
|
+
| ----------------------------------------------------------------------- |
|
|
15
14
|
|
|
16
15
|
## Documentation
|
|
17
16
|
|
|
18
17
|
For full documentation, visit [sanitytaxonomymanager.com](https://sanitytaxonomymanager.com).
|
|
19
18
|
|
|
20
19
|
## Features
|
|
20
|
+
|
|
21
21
|
<!-- make this more concise -->
|
|
22
|
+
|
|
22
23
|
- Adds two document types to your Sanity schema which are used to generate [SKOS](https://www.w3.org/TR/skos-primer/) compliant concepts and taxonomies: `skosConcept` and `skosConceptScheme`
|
|
23
24
|
- Includes reference filter helpers to allow you to easily include a specific taxonomy, or particular branch of a taxonomy in your Sanity documents
|
|
24
25
|
- Encourages taxonomy and thesaurus design best practices by enforcing [disjunction between Broader and Related relationships](https://www.w3.org/TR/skos-reference/#L2422) and [disjunction between Preferred and Alternate/Hidden labels](https://www.w3.org/TR/skos-reference/#L1567)
|
|
25
|
-
- Standards compliant architecture means that taxonomy terms and structures can be migrated to standards compliant standalone tools when you need higher level taxonomy and knowledge graph support.
|
|
26
|
-
|
|
26
|
+
- Standards compliant architecture means that taxonomy terms and structures can be migrated to standards compliant standalone tools when you need higher level taxonomy and knowledge graph support.
|
|
27
27
|
|
|
28
28
|
## Installation
|
|
29
29
|
|
|
@@ -62,6 +62,16 @@ export default defineConfig({
|
|
|
62
62
|
taxonomyManager({
|
|
63
63
|
// Optional: Set a Base URI to use for new concepts & concept schemes
|
|
64
64
|
baseUri: 'https://example.com/',
|
|
65
|
+
// Optional: Use `customConceptFields` and `customSchemeFields` keys to add custom fields to Concept or Concept Scheme document types
|
|
66
|
+
customConceptFields: [
|
|
67
|
+
{
|
|
68
|
+
name: 'sameAs',
|
|
69
|
+
title: 'Same As',
|
|
70
|
+
type: 'url',
|
|
71
|
+
description:
|
|
72
|
+
'Specify a fully qualified IRI that identifies the same concept in another vocabulary',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
65
75
|
}),
|
|
66
76
|
],
|
|
67
77
|
schema: {
|
|
@@ -96,9 +106,7 @@ export default defineConfig({
|
|
|
96
106
|
),
|
|
97
107
|
]),
|
|
98
108
|
}),
|
|
99
|
-
taxonomyManager(
|
|
100
|
-
baseUri: 'https://example.com/',
|
|
101
|
-
}),
|
|
109
|
+
taxonomyManager(),
|
|
102
110
|
],
|
|
103
111
|
schema: {
|
|
104
112
|
types: schemaTypes,
|
|
@@ -107,7 +115,65 @@ export default defineConfig({
|
|
|
107
115
|
```
|
|
108
116
|
|
|
109
117
|
## Contributing
|
|
110
|
-
|
|
118
|
+
|
|
119
|
+
Community collaboration is highly encouraged. To make sure your contributions are aligned with project goals and principles, please read the [contributing docs](https://sanitytaxonomymanager.com/#/contributing) before submitting a pull request.
|
|
120
|
+
|
|
121
|
+
- This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
122
|
+
with default configuration for build & watch scripts.
|
|
123
|
+
|
|
124
|
+
- See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
|
|
125
|
+
on how to run the plugin with hot-reload in the studio.
|
|
126
|
+
|
|
127
|
+
### Component Diagrams
|
|
128
|
+
|
|
129
|
+
The following diagrams map out the relationships between the components used in this plugin and are intended to help those interested in contributing to the project orient themselves. The Taxonomy Manager tree view is designed to support polyhierarchy, and to provide UI affordances common to other taxonomy management tools, both of which lend some complexity to the component structure.
|
|
130
|
+
|
|
131
|
+
> [!TIP]
|
|
132
|
+
> You **do not** need to understand any of this to use the plugin!
|
|
133
|
+
|
|
134
|
+
<Details>
|
|
135
|
+
<Summary><h4>Tree View</h4></Summary>
|
|
136
|
+
|
|
137
|
+
The [Tree View component](docs/_images/taxonomyManager.png) creates the user interface for interacting with a given taxonomy (SKOS Concept Scheme) visually in the Sanity Structure tool.
|
|
138
|
+
|
|
139
|
+
```mermaid
|
|
140
|
+
graph BT
|
|
141
|
+
subgraph SchemeContext.Provider
|
|
142
|
+
direction BT
|
|
143
|
+
Hierarchy.tsx-->TreeView.tsx
|
|
144
|
+
subgraph TreeContext.Provider
|
|
145
|
+
direction BT
|
|
146
|
+
TreeStructure.tsx-->Hierarchy.tsx
|
|
147
|
+
TopConcepts.tsx[
|
|
148
|
+
TopConcepts.tsx
|
|
149
|
+
<i style="color: gray; font-size: small">uses SchemeContext</i>
|
|
150
|
+
<i style="color: gray; font-size: small">uses TreeContext</i>
|
|
151
|
+
]-->TreeStructure.tsx
|
|
152
|
+
Orphans.tsx[
|
|
153
|
+
Orphans.tsx
|
|
154
|
+
<i style="color: gray; font-size: small">uses SchemeContext</i>
|
|
155
|
+
<i style="color: gray; font-size: small">uses TreeContext</i>
|
|
156
|
+
]-->TreeStructure.tsx
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
%% Sequence below maintains RTL ordering:
|
|
160
|
+
ConceptDetailLink.tsx-->TopConcepts.tsx
|
|
161
|
+
ConceptDetailLink.tsx-->Orphans.tsx
|
|
162
|
+
|
|
163
|
+
ChildConcepts.tsx-->TopConcepts.tsx
|
|
164
|
+
ChildConcepts.tsx-->Orphans.tsx
|
|
165
|
+
Children.tsx-->ChildConcepts.tsx
|
|
166
|
+
|
|
167
|
+
ConceptDetailDialogue.tsx-->Orphans.tsx
|
|
168
|
+
ConceptDetailDialogue.tsx-->TopConcepts.tsx
|
|
169
|
+
|
|
170
|
+
ConceptDetailLink.tsx-->Children.tsx
|
|
171
|
+
ConceptDetailDialogue.tsx-->Children.tsx
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
</Details>
|
|
111
177
|
|
|
112
178
|
## License
|
|
113
179
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {FieldDefinition} from 'sanity'
|
|
1
2
|
import {JSX as JSX_2} from 'react'
|
|
2
3
|
import {ObjectFieldProps} from 'sanity'
|
|
3
4
|
import {Plugin as Plugin_2} from 'sanity'
|
|
@@ -31,6 +32,8 @@ export declare function HierarchyInput(props: ObjectFieldProps): JSX_2.Element
|
|
|
31
32
|
|
|
32
33
|
declare interface Options {
|
|
33
34
|
baseUri?: string
|
|
35
|
+
customConceptFields?: FieldDefinition[]
|
|
36
|
+
customSchemeFields?: FieldDefinition[]
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
/**
|
|
@@ -57,6 +60,8 @@ declare type SchemeOptions = {
|
|
|
57
60
|
* BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
|
|
58
61
|
* @param options - Optional configuration options for the plugin.
|
|
59
62
|
* @param options.baseUri - The base URI to use for SKOS concepts and concept schemes.
|
|
63
|
+
* @param options.customConceptFields - An array of additional fields to add to the skosConcept type.
|
|
64
|
+
* @param options.customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
|
|
60
65
|
* @returns A Sanity plugin object.
|
|
61
66
|
*/
|
|
62
67
|
export declare const taxonomyManager: Plugin_2<Options | undefined>
|
package/lib/index.esm.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {FieldDefinition} from 'sanity'
|
|
1
2
|
import {JSX as JSX_2} from 'react'
|
|
2
3
|
import {ObjectFieldProps} from 'sanity'
|
|
3
4
|
import {Plugin as Plugin_2} from 'sanity'
|
|
@@ -31,6 +32,8 @@ export declare function HierarchyInput(props: ObjectFieldProps): JSX_2.Element
|
|
|
31
32
|
|
|
32
33
|
declare interface Options {
|
|
33
34
|
baseUri?: string
|
|
35
|
+
customConceptFields?: FieldDefinition[]
|
|
36
|
+
customSchemeFields?: FieldDefinition[]
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
/**
|
|
@@ -57,6 +60,8 @@ declare type SchemeOptions = {
|
|
|
57
60
|
* BaseURI should follow an IANA http/s scheme and should terminate with either a / or #.
|
|
58
61
|
* @param options - Optional configuration options for the plugin.
|
|
59
62
|
* @param options.baseUri - The base URI to use for SKOS concepts and concept schemes.
|
|
63
|
+
* @param options.customConceptFields - An array of additional fields to add to the skosConcept type.
|
|
64
|
+
* @param options.customSchemeFields - An array of additional fields to add to the skosConceptScheme type.
|
|
60
65
|
* @returns A Sanity plugin object.
|
|
61
66
|
*/
|
|
62
67
|
export declare const taxonomyManager: Plugin_2<Options | undefined>
|
package/lib/index.esm.esm.js
CHANGED
|
@@ -141,4 +141,4 @@ import{useFormValue as e,set as t,defineField as n,defineType as r,defineArrayMe
|
|
|
141
141
|
}
|
|
142
142
|
`,rr=Bn.p`
|
|
143
143
|
color: ${V.gray[800].hex};
|
|
144
|
-
`;const or=e=>{const{onChange:n}=e,r=z(),o=P((()=>{n(t(C(6))),r.push({status:"success",title:"Identifier created.",closable:!0})}),[n,r]);return d(R,{space:2,children:d(H,{space:[3,3,4],children:d(L,{tone:"primary",fontSize:2,onClick:o,text:"Generate Identifier"})})})};var ir=[n({name:"baseIri",title:"Base URI",type:"url",validation:e=>e.required().error("Please supply a base URI in the format 'http://example.com/'"),description:l(Gn,{children:[d("summary",{children:"The root URI (Uniform Resource Identifier) used to create unique concept identifiers."}),l("div",{children:["Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between ",d("code",{children:"https://shipparts.com/vocab#Bow"})," and ",d("code",{children:"https://wrappingsupplies.com/vocab#Bow"}),"."]}),d("div",{children:"In most cases, it makes sense for your base URI to be the root or a subdirectory of your website. In all cases, the URI you choose should be in a domain that you control."}),d("div",{children:"For new Concepts and Concept Schemes, the Base URI field is pre-populated based on the most recently used Base URI value."})]}),options:{collapsible:!0},components:{input:function(t){const n=e(["conceptId"]),r=e(["schemeId"]);return l(R,{space:2,children:[t.renderDefault(t),d(M,{muted:!0,size:1,onResize:void 0,onResizeCapture:void 0,children:l(p,{children:[d("strong",{children:"RDF URI: "}),t.value?t.value:"[base URI not defined] ",n||r||" [identifier not assigned]"]})})]})}}})];function ar(e){return r({name:"skosConcept",title:"Concept",type:"document",icon:_,initialValue:async(t,n)=>{if(e)return{baseIri:e,broader:[],related:[]};const{getClient:r}=n;return{baseIri:await r({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0,broader:[],related:[]}},fields:[n({name:"prefLabel",title:"Preferred Label",type:"string",description:"The preferred lexical label for this concept.",validation:e=>e.required().custom(((e,t)=>{const{getClient:n}=t;return n({apiVersion:"2022-12-14"}).fetch(`*[_type == "skosConcept" && prefLabel == "${e}" && !(_id in path("drafts.**"))][0]._id`).then((e=>!e||e===t.document?._id.replace("drafts.","")||"Preferred Label must be unique."))}))}),n({name:"definition",title:"Definition",type:"text",description:l(Gn,{children:[d("summary",{children:"A complete explanation of the intended meaning of the concept."}),l("div",{children:[l("kbd",{children:["Example: documentation",d("br",{}),'Definition: "The process of storing and retrieving information in all fields of knowledge."']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"example",title:"Examples",type:"text",description:l(Gn,{children:[d("summary",{children:"An example of the use of the concept."}),l("div",{children:[l("kbd",{children:["Example: organizations of science and culture",d("br",{}),'Example: "academies of science, general museums, world fairs"']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"scopeNote",title:"Scope Note",type:"text",description:l(Gn,{children:[d("summary",{children:"A brief statement on the intended meaning of this concept, especially as an indication of how the use of the concept is limited in indexing practice."}),l("div",{children:[l("kbd",{children:["Example: microwave frequencies",d("br",{}),'Scope Note: "Used for frequencies between 1Ghz and 300Ghz"']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"altLabel",title:"Alternate Label(s)",type:"array",description:l(Gn,{children:[d("summary",{children:"Synonyms, near-synonyms, abbreviations, and acronyms to a concept."}),d("div",{children:l("p",{children:[d(h,{})," Preferred, alternative, and hidden label sets must not overlap."]})})]}),of:[{type:"string"}],validation:e=>e.unique()}),n({name:"hiddenLabel",title:"Hidden Label(s)",type:"array",description:l(Gn,{children:[d("summary",{children:"Character strings that need to be accessible to applications performing text-based indexing and search operations, but which should not be displayed to end users."}),l("div",{children:[d("p",{children:"Hidden labels may for instance be used to include misspelled variants of other lexical labels."}),l("p",{children:[d(h,{})," Preferred, alternative, and hidden label sets must not overlap."]})]})]}),of:[{type:"string"}],validation:e=>e.unique()}),...ir,n({name:"conceptId",title:"Identifier",description:"This concept does not yet have a unique identifier.",type:"string",initialValue:()=>`${C(6)}`,hidden:({document:e})=>!!e?.conceptId,readOnly:({document:e})=>!!e?.conceptId,components:{input:or}}),n({name:"broader",title:"Broader Concept(s)",description:l(Gn,{children:[d("summary",{children:"Create hierarchy between concepts, for example to create category/subcategory, part/whole, or class/instance relationships."}),d("div",{children:d("p",{children:"Broader and Associated relationships are mutually exclusive."})})]}),type:"array",of:[{type:"reference",to:{type:"skosConcept"},options:{filter:({document:e})=>({filter:'!(_id in $broader || _id in $related || _id in path("drafts.**") || _id == $self)',params:{self:e._id.replace("drafts.",""),broader:e.broader.map((({_ref:e})=>e)),related:e.related.map((({_ref:e})=>e))}})}}]}),n({name:"related",title:"Related Concept(s)",description:l(Gn,{children:[d("summary",{children:'Indicate that two concepts are inherently "related", but that one is not in any way more general than the other.'}),d("div",{children:d("p",{children:"Broader and Associated relationships are mutually exclusive."})})]}),type:"array",of:[{type:"reference",to:[{type:"skosConcept"}]}]}),n({name:"historyNote",title:"History Notes",type:"text",description:l(Gn,{children:[d("summary",{children:"Significant changes to the meaning of the form of this concept."}),l("div",{children:[l("kbd",{children:["Example: person with disabilities",d("br",{}),'History Note: "Estab. 1992; heading was: handicapped [1884 - 1992]."']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"editorialNote",title:"Editorial Notes",type:"text",description:l(Gn,{children:[d("summary",{children:"Information to aid in administrative housekeeping, such as reminders of editorial work still to be done, or warnings in the event that future editorial changes might be made."}),l("div",{children:[l("kbd",{children:["Example: doubleclick",d("br",{}),'Editorial Note: "Review this term after the company merger is complete."']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"changeNote",title:"Change Notes",type:"text",description:l(Gn,{children:[d("summary",{children:"Fine-grained changes to a concept, for the purposes of administration and maintenance."}),l("div",{children:[l("kbd",{children:["Example: tomato",d("br",{}),"Change Note: \"Moved from under 'fruits' to under 'vegetables' by Horace Gray\""]}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3})],orderings:[{title:"Top Concepts",name:"topConcept",by:[{field:"topConcept",direction:"desc"},{field:"prefLabel",direction:"asc"}]},{title:"Preferred Label",name:"prefLabel",by:[{field:"prefLabel",direction:"asc"}]}],preview:{select:{title:"prefLabel"},prepare:({title:e})=>({title:e,media:k})}})}function sr(){return d("svg",{"data-sanity-icon":!0,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M5.5 6.5V5.9H4.9V6.5H5.5ZM11.5 6.5H12.1V5.9H11.5V6.5ZM5.5 9H4.9V9.6H5.5V9ZM11.5 9V9.6H12.1V9H11.5ZM13.5 11V10.4H12.9V11H13.5ZM19.5 11H20.1V10.4H19.5V11ZM13.5 13.5H12.9V14.1H13.5V13.5ZM19.5 13.5V14.1H20.1V13.5H19.5ZM13.5 16V15.4H12.9V16H13.5ZM19.5 16H20.1V15.4H19.5V16ZM13.5 18.5H12.9V19.1H13.5V18.5ZM19.5 18.5V19.1H20.1V18.5H19.5ZM5.5 7.1H11.5V5.9H5.5V7.1ZM6.1 9V6.5H4.9V9H6.1ZM11.5 8.4H5.5V9.6H11.5V8.4ZM10.9 6.5V9H12.1V6.5H10.9ZM13.5 11.6H19.5V10.4H13.5V11.6ZM14.1 13.5V11H12.9V13.5H14.1ZM19.5 12.9H13.5V14.1H19.5V12.9ZM18.9 11V13.5H20.1V11H18.9ZM13.5 16.6H19.5V15.4H13.5V16.6ZM14.1 18.5V16H12.9V18.5H14.1ZM19.5 17.9H13.5V19.1H19.5V17.9ZM18.9 16V18.5H20.1V16H18.9ZM8 17.85H13.5V16.65H8V17.85ZM8 12.85H13.5V11.65H8V12.85ZM7.9 9.5V17.85H9.1V9.5H7.9Z",fill:"currentColor"})})}function cr(e){return r({name:"skosConceptScheme",title:"Concept Scheme",type:"document",icon:sr,initialValue:async(t,n)=>{if(e)return{baseIri:e};const{getClient:r}=n;return{baseIri:await r({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0}},fields:[n({name:"title",title:"Title",type:"string",description:"Taxonomy schemes group concepts into defined sets, such as thesauri, classification schemes, or facets. Concepts may belong on many (or no) concept schemes, and you may create as many (or few) concept schemes as you like"}),n({name:"description",title:"Description",type:"text",rows:5,description:"Describe the intended use of this scheme."}),n({name:"controls",title:"Concept Management Controls",description:"Show concept management controls in hierarchy view",type:"boolean",initialValue:!0}),...ir,n({name:"schemeId",title:"Identifier",description:"This scheme does not yet have a unique identifier.",type:"string",initialValue:()=>`${C(6)}`,hidden:({document:e})=>!!e?.schemeId,readOnly:({document:e})=>!!e?.schemeId,components:{input:or}}),n({name:"topConcepts",title:"Top Concepts",type:"array",validation:e=>e.unique(),of:[o({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),n({name:"concepts",title:"Concepts",type:"array",validation:e=>e.unique(),of:[o({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}})],preview:{select:{title:"title"},prepare:({title:e})=>({title:e,media:sr})}})}var lr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dr={},pr={},hr={};Object.defineProperty(hr,"__esModule",{value:!0});var ur="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";hr.default=function(e){var t=e.split("-"),n=t[1],r=t[2],o=t[3];if(!n||!r||!o)throw new Error("Malformed asset _ref '".concat(e,"'. Expected an id like \"").concat(ur,'".'));var i=r.split("x"),a=+i[0],s=+i[1];if(!(isFinite(a)&&isFinite(s)))throw new Error("Malformed asset _ref '".concat(e,"'. Expected an id like \"").concat(ur,'".'));return{id:n,width:a,height:s,format:o}};var fr={},mr=lr&&lr.__assign||function(){return mr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mr.apply(this,arguments)};Object.defineProperty(fr,"__esModule",{value:!0});function gr(e){var t=e.split("/").slice(-1);return"image-".concat(t[0]).replace(/\.([a-z]+)$/,"-$1")}fr.default=function(e){if(!e)return null;var t,n;if("string"==typeof e&&/^https?:\/\//.test("".concat(e)))t={asset:{_ref:gr(e)}};else if("string"==typeof e)t={asset:{_ref:e}};else if((n=e)&&"string"==typeof n._ref)t={asset:e};else if(function(e){return!!e&&"string"==typeof e._id}(e))t={asset:{_ref:e._id||""}};else if(function(e){var t=e;return!(!t||!t.asset)&&"string"==typeof t.asset.url}(e))t={asset:{_ref:gr(e.asset.url)}};else{if("object"!=typeof e.asset)return null;t=mr({},e)}var r=e;return r.crop&&(t.crop=r.crop),r.hotspot&&(t.hotspot=r.hotspot),function(e){if(e.crop&&e.hotspot)return e;var t=mr({},e);return t.crop||(t.crop={left:0,top:0,bottom:0,right:0}),t.hotspot||(t.hotspot={x:.5,y:.5,height:1,width:1}),t}(t)},function(e){var t=lr&&lr.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)},n=lr&&lr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.parseSource=e.SPEC_NAME_TO_URL_NAME_MAPPINGS=void 0;var r=n(hr),o=n(fr);e.parseSource=o.default,e.SPEC_NAME_TO_URL_NAME_MAPPINGS=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"],["saturation","sat"],["auto","auto"],["dpr","dpr"],["pad","pad"]],e.default=function(n){var i=t({},n||{}),a=i.source;delete i.source;var s=(0,o.default)(a);if(!s)throw new Error("Unable to resolve image URL from source (".concat(JSON.stringify(a),")"));var c=s.asset._ref||s.asset._id||"",l=(0,r.default)(c),d=Math.round(s.crop.left*l.width),p=Math.round(s.crop.top*l.height),h={left:d,top:p,width:Math.round(l.width-s.crop.right*l.width-d),height:Math.round(l.height-s.crop.bottom*l.height-p)},u=s.hotspot.height*l.height/2,f=s.hotspot.width*l.width/2,m=s.hotspot.x*l.width,g=s.hotspot.y*l.height,y={left:m-f,top:g-u,right:m+f,bottom:g+u};return i.rect||i.focalPoint||i.ignoreImageParams||i.crop||(i=t(t({},i),function(e,t){var n,r=t.width,o=t.height;if(!r||!o)return{width:r,height:o,rect:e.crop};var i=e.crop,a=e.hotspot,s=r/o,c=i.width/i.height;if(c>s){var l=Math.round(i.height),d=Math.round(l*s),p=Math.max(0,Math.round(i.top)),h=Math.round((a.right-a.left)/2+a.left);(u=Math.max(0,Math.round(h-d/2)))<i.left?u=i.left:u+d>i.left+i.width&&(u=i.left+i.width-d),n={left:u,top:p,width:d,height:l}}else{d=i.width,l=Math.round(d/s);var u=Math.max(0,Math.round(i.left)),f=Math.round((a.bottom-a.top)/2+a.top),m=Math.max(0,Math.round(f-l/2));m<i.top?m=i.top:m+l>i.top+i.height&&(m=i.top+i.height-l),n={left:u,top:m,width:d,height:l}}return{width:r,height:o,rect:n}}({crop:h,hotspot:y},i))),function(t){var n=(t.baseUrl||"https://cdn.sanity.io").replace(/\/+$/,""),r="".concat(t.asset.id,"-").concat(t.asset.width,"x").concat(t.asset.height,".").concat(t.asset.format),o="".concat(n,"/images/").concat(t.projectId,"/").concat(t.dataset,"/").concat(r),i=[];if(t.rect){var a=t.rect,s=a.left,c=a.top,l=a.width,d=a.height;(0!==s||0!==c||d!==t.asset.height||l!==t.asset.width)&&i.push("rect=".concat(s,",").concat(c,",").concat(l,",").concat(d))}t.bg&&i.push("bg=".concat(t.bg)),t.focalPoint&&(i.push("fp-x=".concat(t.focalPoint.x)),i.push("fp-y=".concat(t.focalPoint.y)));var p=[t.flipHorizontal&&"h",t.flipVertical&&"v"].filter(Boolean).join("");return p&&i.push("flip=".concat(p)),e.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach((function(e){var n=e[0],r=e[1];typeof t[n]<"u"?i.push("".concat(r,"=").concat(encodeURIComponent(t[n]))):typeof t[r]<"u"&&i.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),0===i.length?o:"".concat(o,"?").concat(i.join("&"))}(t(t({},i),{asset:l}))}}(pr);var yr=lr&&lr.__assign||function(){return yr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},yr.apply(this,arguments)},br=lr&&lr.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),vr=lr&&lr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wr=lr&&lr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&br(t,e,n);return vr(t,e),t};Object.defineProperty(dr,"__esModule",{value:!0}),dr.ImageUrlBuilder=void 0;var Cr=wr(pr),_r=["clip","crop","fill","fillmax","max","scale","min"],kr=["top","bottom","left","right","center","focalpoint","entropy"],Sr=["format"];function xr(e){for(var t=0,n=Cr.SPEC_NAME_TO_URL_NAME_MAPPINGS;t<n.length;t++){var r=n[t],o=r[0],i=r[1];if(e===o||e===i)return o}return e}dr.default=function(e){if(function(e){return!(!e||!("config"in e))&&"function"==typeof e.config}(e)){var t=e.config(),n=t.apiHost,r=t.projectId,o=t.dataset;return new Ir(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:r,dataset:o})}var i=e;if(function(e){return!(!e||!("clientConfig"in e))&&"object"==typeof e.clientConfig}(i)){var a=i.clientConfig;n=a.apiHost,r=a.projectId,o=a.dataset;return new Ir(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:r,dataset:o})}return new Ir(null,e)};var Ir=function(){function e(e,t){this.options=yr(e?yr({},e.options||{}):{},t||{})}return e.prototype.withOptions=function(t){var n=t.baseUrl||this.options.baseUrl,r={baseUrl:n};for(var o in t)if(t.hasOwnProperty(o)){r[xr(o)]=t[o]}return new e(this,yr({baseUrl:n},r))},e.prototype.image=function(e){return this.withOptions({source:e})},e.prototype.dataset=function(e){return this.withOptions({dataset:e})},e.prototype.projectId=function(e){return this.withOptions({projectId:e})},e.prototype.bg=function(e){return this.withOptions({bg:e})},e.prototype.dpr=function(e){return this.withOptions(e&&1!==e?{dpr:e}:{})},e.prototype.width=function(e){return this.withOptions({width:e})},e.prototype.height=function(e){return this.withOptions({height:e})},e.prototype.focalPoint=function(e,t){return this.withOptions({focalPoint:{x:e,y:t}})},e.prototype.maxWidth=function(e){return this.withOptions({maxWidth:e})},e.prototype.minWidth=function(e){return this.withOptions({minWidth:e})},e.prototype.maxHeight=function(e){return this.withOptions({maxHeight:e})},e.prototype.minHeight=function(e){return this.withOptions({minHeight:e})},e.prototype.size=function(e,t){return this.withOptions({width:e,height:t})},e.prototype.blur=function(e){return this.withOptions({blur:e})},e.prototype.sharpen=function(e){return this.withOptions({sharpen:e})},e.prototype.rect=function(e,t,n,r){return this.withOptions({rect:{left:e,top:t,width:n,height:r}})},e.prototype.format=function(e){return this.withOptions({format:e})},e.prototype.invert=function(e){return this.withOptions({invert:e})},e.prototype.orientation=function(e){return this.withOptions({orientation:e})},e.prototype.quality=function(e){return this.withOptions({quality:e})},e.prototype.forceDownload=function(e){return this.withOptions({download:e})},e.prototype.flipHorizontal=function(){return this.withOptions({flipHorizontal:!0})},e.prototype.flipVertical=function(){return this.withOptions({flipVertical:!0})},e.prototype.ignoreImageParams=function(){return this.withOptions({ignoreImageParams:!0})},e.prototype.fit=function(e){if(-1===_r.indexOf(e))throw new Error('Invalid fit mode "'.concat(e,'"'));return this.withOptions({fit:e})},e.prototype.crop=function(e){if(-1===kr.indexOf(e))throw new Error('Invalid crop mode "'.concat(e,'"'));return this.withOptions({crop:e})},e.prototype.saturation=function(e){return this.withOptions({saturation:e})},e.prototype.auto=function(e){if(-1===Sr.indexOf(e))throw new Error('Invalid auto mode "'.concat(e,'"'));return this.withOptions({auto:e})},e.prototype.pad=function(e){return this.withOptions({pad:e})},e.prototype.url=function(){return(0,Cr.default)(this.options)},e.prototype.toString=function(){return this.url()},e}();dr.ImageUrlBuilder=Ir,(lr&&lr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(dr);const Nr={},Or={apiVersion:"v2023-05-01"},Pr=null;function Er(e){const t=T((()=>JSON.stringify(e||{})),[e]);return T((()=>JSON.parse(t)),[t])}function $r(e,t){let{params:n=Nr,options:r=Or,initialValue:o=Pr}=t;const[a,s]=E(!0),[c,l]=E(!1),[d,p]=E(o),h=Er(n),u=Er(r),f=x(null),m=i();return $((()=>{if(e&&!c&&!f.current)try{f.current=m.listenQuery(e,h,u).pipe(J(X),Q((e=>(console.error(e),l(e),s(!1),p(null),e)))).subscribe((e=>{p((t=>X(t,e)?t:e)),s(!1),l(!1)}))}catch(e){console.error(e),s(!1),l(e)}return c&&f.current&&f.current.unsubscribe(),()=>{var e;f.current&&(null==(e=f?.current)||e.unsubscribe(),f.current=null)}}),[e,c,h,u,m]),{data:d,loading:a,error:c}}var Tr,Ar,Vr,Rr=Object.freeze,Mr=Object.defineProperty,zr=(e,t)=>Rr(Mr(e,"raw",{value:Rr(e.slice())}));Bn((function(){return d(D,{as:"table",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>jn(Tr||(Tr=zr(["\n display: table;\n width: 100%;\n border-collapse: collapse;\n\n &:not([hidden]) {\n display: table;\n border-collapse: collapse;\n }\n "])))));Bn((function(){return d(D,{as:"tr",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>jn(Ar||(Ar=zr(["\n display: table-row;\n\n &:not([hidden]) {\n display: table-row;\n }\n "])))));function Hr(e){const t=z(),n=a({apiVersion:"2021-10-21"}),r=function(){const e=O(te),{routerPanesState:t,groupIndex:n}=ee();return P((r=>{if(!e||!r)return;const o=[...t];o.splice(n+1,n+1,[{id:r,params:{type:"skosConcept"}}]);const i=e.resolvePathFromState({panes:o});e.navigateUrl({path:i})}),[e,t,n])}(),o=e.displayed.baseIri;return P(((i,a,s)=>{let c;c=a?{_id:`drafts.${C()}`,_type:"skosConcept",conceptId:`${C(6)}`,prefLabel:"",baseIri:o,broader:[a&&{_key:C(6),_ref:a,_type:"reference"}],related:[]}:{_id:`drafts.${C()}`,_type:"skosConcept",conceptId:`${C(6)}`,prefLabel:"",baseIri:o,broader:[],related:[]};const l=JSON.parse(JSON.stringify(e.displayed));l._id.includes("drafts.")||(l._id=`drafts.${l._id}`),n.transaction().createIfNotExists(l).create(c).patch(l._id,(e=>"topConcept"==i?e.setIfMissing({topConcepts:[]}).append("topConcepts",[{_ref:c._id.replace("drafts.",""),_type:"reference",_key:C(6),_weak:!0,_strengthenOnPublish:{_type:"skosConcept",weak:!0,template:{id:"skosConcept",params:"undefined"}}}]):e.setIfMissing({concepts:[]}).insert("after","concepts[-1]",[{_ref:c._id.replace("drafts.",""),_type:"reference",_key:C(6),_weak:!0,_strengthenOnPublish:{_type:"skosConcept",weak:void 0,template:{id:"skosConcept",params:"undefined"}}}]))).commit({autoGenerateArrayKeys:!0}).then((e=>{t.push({closable:!0,status:"success",title:"Created new concept"}),r(c._id)})).catch((e=>{t.push({closable:!0,status:"error",title:"Error creating concept",description:e.message})}))}),[e.displayed,n,o,t,r])}function Lr(e){const t=z(),n=a({apiVersion:"2021-10-21"});return P(((r,o,i)=>{const a="topConcept"==o?"topConcepts":"concepts",s=JSON.parse(JSON.stringify(e.displayed));s._id.includes("drafts.")||(s._id=`drafts.${s._id}`),n.transaction().createIfNotExists(s).patch(s._id,(e=>e.unset([`${a}[_ref=="${r.replace("drafts.","")}"]`]))).commit().then((e=>{t.push({closable:!0,status:"success",title:(i?`"${i}"`:"Concept")+" removed from scheme"})})).catch((e=>{t.push({closable:!0,status:"error",title:"Error removing concept",description:e.message})}))}),[n,e.displayed,t])}Bn((function(){return d(D,{as:"td",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>jn(Vr||(Vr=zr(["\n display: table-cell;\n\n &:not([hidden]) {\n display: table-cell;\n }\n "])))));const Dr=(e=1)=>e>6?"":`"childConcepts": *[\n (_id in $draftConceptIds ||\n (\n _id in $conceptIds &&\n !(conceptId in $draftConceptIds)\n )\n ) && ^._id in broader[]._ref ]|order(prefLabel){\n "id": _id,\n "level": ${e},\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Dr(e+1)}\n }`,jr=(e=1)=>e>6?"":`"childConcepts": *[_id in *[_id == $id][0].concepts[]._ref && ^._id in broader[]._ref ]|order(prefLabel){\n "id": _id,\n "level": ${e},\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr(e+1)}\n }`,Ur=A(null),Fr=A({editControls:!1});function Br({concept:e}){const t=O(te),{routerPanesState:n,groupIndex:r}=ee(),{id:o,prefLabel:i}=e??{},a=P((()=>{if(!t||!o)return;const e=[...n];e.splice(r+1,r+1,[{id:o,params:{type:"skosConcept"}}]);const i=t.resolvePathFromState({panes:e});t.navigateUrl({path:i})}),[o,t,n,r]);return d(nr,{href:"#",onClick:a,children:i})}const qr=({concept:e})=>{const[t,n]=E(!1),r=P((()=>n(!1)),[]),o=P((()=>n(!0)),[]);return e&&(e.definition||e.example||e.scopeNote)?l(p,{children:[d(Kn,{className:"action","aria-label":"info",onClick:o,type:"button",children:d(u,{className:"info"})}),t&&d(j,{header:e.prefLabel,id:"dialog-example",onClose:r,zOffset:1e3,width:1,children:d(U,{padding:4,paddingBottom:5,children:l(R,{space:4,children:[e.definition&&l(R,{space:2,children:[d(F,{size:1,children:"Definition"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.definition})]}),e.example&&l(R,{space:2,children:[d(F,{size:1,children:"Example"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.example})]}),e.scopeNote&&l(R,{space:2,children:[d(F,{size:1,children:"Scope Note"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.scopeNote})]})]})})})]}):null},Gr=({concept:e,selectConcept:t,inputComponent:n=!1})=>{const r=O(Ur)||{},{globalVisibility:{treeVisibility:o}}=O(Fr)||{},{editControls:i}=O(Fr)||{editControls:!1},a=Hr(r),s=Lr(r),c=P((()=>{a("concept",e?.id,e?.prefLabel)}),[e?.id,e?.prefLabel,a]),p=P((()=>{s(e.id,"concept",e?.prefLabel)}),[e.id,e?.prefLabel,s]),[h,v]=E(o),w=P((()=>{"open"==h?v("closed"):"closed"==h&&v("open")}),[h]);return l(tr,{className:h,children:[l(H,{space:2,children:[l(H,{space:1,children:[l(H,{space:1,children:[e?.childConcepts&&e.childConcepts.length>0&&d(Xn,{onClick:w,type:"button","aria-expanded":"open"==h,children:d(f,{})}),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Br,{concept:e})]}),!i&&d(qr,{concept:e})]}),i&&e?.level&&e.level<5&&l(H,{space:2,children:[d(Kn,{onClick:c,type:"button",className:"action","aria-label":"Add child a child concept",children:d(g,{className:"add"})}),d(Kn,{onClick:p,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})]}),i&&0==e.childConcepts?.length&&5==e.level&&l(H,{space:2,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"This concept is at the maximum Taxonomy Manager hierarchy depth of 5 levels."})})}),fallbackPlacements:["right","left"],placement:"top",children:d(u,{className:"info warning"})}),d(Kn,{onClick:p,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})]}),e?.childConcepts&&e?.childConcepts?.length>0&&5==e.level&&l(H,{space:1,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:l(R,{padding:1,space:2,children:[d(M,{muted:!0,size:1,children:"This concept has unlisted child concepts."}),d(M,{muted:!0,size:1,children:"The maximum hierarchy depth is 5 levels."})]})}),fallbackPlacements:["right","left"],placement:"top",children:d(b,{className:"info error"})}),r.displayed?.controls&&d(Kn,{onClick:p,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&e?.level&&e.level<5&&d(Yr,{concepts:e.childConcepts,selectConcept:t,inputComponent:n})]})};function Zr({concept:e,selectConcept:t}){const{prefLabel:n,id:r}=e??{},o=P((()=>{t({_ref:r,_type:"reference"})}),[r,t]);return d(p,{children:t?d(nr,{href:"#",onClick:o,children:n}):d(rr,{children:n})})}const Wr=({concept:e,selectConcept:t,inputComponent:n=!1})=>{const{globalVisibility:{treeVisibility:r}={treeVisibility:"open"}}=O(Fr)||{},[o,i]=E(r),a=P((()=>{"open"==o?i("closed"):"closed"==o&&i("open")}),[o]);return l(tr,{className:o,children:[l(H,{space:2,children:[l(H,{space:1,children:[l(H,{space:1,children:[e?.childConcepts&&e.childConcepts.length>0&&d(Xn,{onClick:a,type:"button","aria-expanded":"open"==o,children:d(f,{})}),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Zr,{concept:e,selectConcept:t})]}),d(qr,{concept:e})]}),e?.childConcepts&&e?.childConcepts?.length>0&&5==e.level&&d(H,{space:1,children:d(B,{content:d(U,{padding:2,sizing:"border",children:l(R,{padding:1,space:2,children:[d(M,{muted:!0,size:1,children:"This concept has unlisted child concepts."}),d(M,{muted:!0,size:1,children:"The maximum hierarchy depth is 5 levels."})]})}),fallbackPlacements:["right","left"],placement:"top",children:d(b,{className:"info error"})})})]}),e?.childConcepts&&e.childConcepts.length>0&&e?.level&&e.level<5&&d(Yr,{concepts:e.childConcepts,selectConcept:t,inputComponent:n})]})},Yr=({concepts:e,inputComponent:t=!1,selectConcept:n})=>d(er,{children:e.map((e=>d(t?Wr:Gr,{concept:e,selectConcept:n,inputComponent:t},e.id)))}),Kr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=O(Ur)||{},{editControls:i}=O(Fr)||{editControls:!1},a=Hr(o),s=Lr(o),[c,p]=E(t),h=P((()=>{"open"==c?p("closed"):"closed"==c&&p("open")}),[c]),u=P((()=>{a("concept",e?.id,e?.prefLabel)}),[e?.id,e?.prefLabel,a]),b=P((()=>{s(e?.id,"topConcept",e?.prefLabel)}),[e?.id,e?.prefLabel,s]);return l(Jn,{className:c,children:[l(H,{space:2,children:[l(H,{space:0,children:[e?.childConcepts&&e.childConcepts.length>0&&d(Xn,{onClick:h,type:"button","aria-expanded":"open"==c,children:d(f,{})}),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(n?Zr:Br,{concept:e})]}),d(M,{size:1,muted:!0,children:"top concept"}),!i&&d(qr,{concept:e}),i&&l(H,{space:2,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Add a child concept"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:u,type:"button",className:"action","aria-label":"Add child a child concept",children:d(g,{className:"add"})})}),d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Remove concept from scheme"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:b,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},Xr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const[o,i]=E(t),a=P((()=>{"open"==o?i("closed"):"closed"==o&&i("open")}),[o]);return l(Jn,{className:o,children:[l(H,{space:2,children:[l(H,{space:0,children:[e?.childConcepts&&e.childConcepts.length>0&&(n?d(m,{className:"spacer"}):d(Xn,{onClick:a,type:"button","aria-expanded":"open"==o,children:d(f,{})})),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Zr,{concept:e,selectConcept:r})]}),d(M,{size:1,muted:!0,children:"top concept"}),d(qr,{concept:e})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},Jr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=O(Ur)||{},{editControls:i}=O(Fr)||{editControls:!1},a=Hr(o),s=Lr(o),[c,p]=E(t),h=P((()=>{"open"==c?p("closed"):"closed"==c&&p("open")}),[c]),u=P((()=>{a("concept",e?.id,e?.prefLabel)}),[e?.id,e?.prefLabel,a]),b=P((()=>{s(e.id,"concept",e?.prefLabel)}),[e.id,e?.prefLabel,s]);return l(Qn,{className:c,children:[l(H,{space:2,children:[e?.childConcepts&&e.childConcepts.length>0&&(n?d(m,{className:"spacer"}):d(Xn,{onClick:h,type:"button","aria-expanded":"open"==c,children:d(f,{})})),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(n?Zr:Br,{concept:e}),o.displayed?.topConcepts?.length>0&&d(M,{size:1,muted:!0,children:"orphan"}),!i&&d(qr,{concept:e}),!n&&i&&l(H,{space:2,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Add a child concept"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:u,type:"button",className:"action","aria-label":"Add child a child concept",children:d(g,{className:"add"})})}),d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Remove concept from scheme"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:b,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},Qr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=O(Ur)||{},[i,a]=E(t),s=P((()=>{"open"==i?a("closed"):"closed"==i&&a("open")}),[i]);return l(Qn,{className:i,children:[l(H,{space:2,children:[e?.childConcepts&&e.childConcepts.length>0&&(n?d(m,{className:"spacer"}):d(Xn,{onClick:s,type:"button","aria-expanded":"open"==i,children:d(f,{})})),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Zr,{concept:e,selectConcept:r}),o.displayed?.topConcepts?.length>0&&d(M,{size:1,muted:!0,children:"orphan"}),d(qr,{concept:e})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},eo=({document:e})=>{const[t,n]=E(!1),[r,o]=E(""),[i,s]=E(""),c=P((()=>n(!1)),[]),p=P((()=>n(!0)),[]),h=P((e=>{o(e.currentTarget.value)}),[]),u=P((e=>{s(e.currentTarget.value)}),[]),f=function(){const e=z(),t=a({apiVersion:"2021-10-21"});return P(((n,r,o)=>{const i=n.displayed?._id,a=n.displayed?.baseIri,s=n.displayed?.schemeId,c={_id:`drafts.${i}`,_type:"skosConceptScheme",schemeId:s,controls:!0,baseIri:a,title:r,description:o||""};t.createIfNotExists(c).then((t=>o?e.push({closable:!0,status:"success",title:"Title and Description added."}):e.push({closable:!0,status:"success",title:"Title added."}))).catch((t=>{e.push({closable:!0,status:"error",title:"There has been an error",description:t.message})}))}),[t,e])}(),m=P((()=>{f(e,r,i)}),[f,i,e,r]);return l(Zn,{children:[d(D,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:l(R,{space:6,children:[l(R,{space:4,children:[d(F,{size:4,children:"New Concept Scheme"}),d(M,{size:2,children:'To start using hierarchy view taxonomy builder, first give your concept scheme a name and optional description. You can also use the "Editor" tab to add concepts to the tree manually.'})]}),d(L,{tone:"primary",fontSize:2,icon:v,onClick:p,text:"Add Title"})]})}),t&&d(j,{header:"Title & Description",id:"title-description",onClose:c,zOffset:1e3,width:1,children:d(U,{padding:4,children:l(R,{space:4,children:[l(R,{space:2,children:[d(F,{size:1,children:"Title"}),d(M,{size:1,muted:!0,children:"Describe the concept scheme in one or two words."})]}),d(q,{fontSize:2,onChange:h,padding:3,placeholder:"",value:r}),l(R,{space:2,children:[d(F,{size:1,children:"Description (optional)"}),d(M,{size:1,muted:!0,children:"Describe the intended use of this concept scheme."})]}),d(G,{fontSize:2,onChange:u,padding:3,placeholder:"",value:i,rows:3}),d(L,{tone:"primary",fontSize:2,onClick:m,text:"Save"})]})})})]})},to=()=>d(Zn,{children:d(D,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:l(R,{space:4,children:[d(F,{size:4,children:"No Concepts"}),d(M,{size:2,children:"There are not yet any concepts assigned to this scheme. To create a multi-level hierarchy with specific entry points, create Top Concepts first, then add children to them. To create a flat list of concepts, create Entry Concepts directly."})]})})}),no=({concepts:e,inputComponent:t,selectConcept:n})=>{const{globalVisibility:{treeId:r,treeVisibility:o}={treeId:123,treeVisibility:"open"}}=O(Fr)||{};return null===e.topConcepts&&0===e.orphans.length?d(to,{}):l(Wn,{children:[e.topConcepts&&e.topConcepts.map((e=>d(t?Xr:Kr,{concept:e,treeVisibility:o,inputComponent:t,selectConcept:n},e?.id+r))),e.orphans.map((e=>d(t?Qr:Jr,{concept:e,treeVisibility:o,inputComponent:t,selectConcept:n},e.id+r)))]})},ro=({branchId:e="",selectConcept:t,inputComponent:n=!1})=>{const r=O(Ur)||{},o=r.displayed?._id,i=r.displayed?.concepts?.map((e=>e?._ref))||[],a=r.displayed?.concepts?.map((e=>`drafts.${e?._ref}`))||[],s=r.displayed?.topConcepts?.map((e=>e?._ref))||[],c=r.displayed?.topConcepts?.map((e=>`drafts.${e?._ref}`))||[],h=Hr(r),u=P((()=>{h("topConcept")}),[h]),f=P((()=>{h("concept")}),[h]),[m,y]=E({treeId:C(3),treeVisibility:"open"}),[b,v]=E(!1);$((()=>{r.displayed._id.includes("drafts.")||v(!1)}),[r.displayed._id]);const _=P((()=>{y({treeId:C(3),treeVisibility:"open"})}),[]),k=P((()=>{y({treeId:C(3),treeVisibility:"closed"})}),[]),S=P((()=>{v(!0)}),[]),{data:x,loading:I,error:N}=$r({fetch:`*[_id == $id][0] {\n _updatedAt,\n "topConcepts": *[_id in $draftTopConceptIds ||\n (\n _id in $topConceptIds &&\n !(conceptId in *[_id in $draftTopConceptIds].conceptId)\n )\n ]|order(prefLabel) {\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Dr()}\n },\n "orphans": *[_id in $draftConceptIds ||\n (\n _id in $conceptIds &&\n !(conceptId in *[_id in $draftConceptIds].conceptId)\n ) &&\n count(\n (broader[]._ref) [@ in coalesce(\n *[_id == 'drafts.' + $id][0], \n *[_id == $id][0]\n ).topConcepts[]._ref]) < 1 &&\n count(\n (broader[]._ref) [@ in coalesce(\n *[_id == 'drafts.' + $id][0], \n *[_id == $id][0]\n ).concepts[]._ref]) < 1\n ]|order(prefLabel){\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Dr()}\n }\n }`,listen:'*[_type == "skosConcept" || _id == $id ]'},{params:{id:o,branchId:e,conceptIds:i,draftConceptIds:a,topConceptIds:s,draftTopConceptIds:c}});return I?d(U,{padding:5,children:l(Z,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[d(W,{muted:!0}),d(M,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):N?(console.error(N),d("div",{children:"Error here"})):x?d(Fr.Provider,{value:{globalVisibility:m,editControls:b},children:d(U,{padding:4,paddingTop:2,children:l(p,{children:[d(R,{space:4,children:d(D,{borderBottom:!0,paddingBottom:1,display:"flex",flex:1,children:l(Z,{justify:"space-between",flex:1,children:[d(D,{children:(x.topConcepts?.filter((e=>(e?.childConcepts?.length??0)>0)).length>0||x.orphans?.filter((e=>(e?.childConcepts?.length??0)>0)).length>0)&&l(H,{space:2,children:[d(Yn,{type:"button",onClick:k,children:d(M,{weight:"semibold",muted:!0,size:1,children:"Collapse"})}),d(M,{weight:"semibold",muted:!0,size:1,children:"|"}),d(Yn,{type:"button",onClick:_,children:d(M,{weight:"semibold",muted:!0,size:1,children:"Expand"})})]})}),d(D,{children:b?l(H,{space:4,children:[d(Yn,{type:"button",className:"add",onClick:u,children:l(M,{weight:"semibold",muted:!0,size:1,children:[d(g,{})," Add Top Concept"]})}),d(Yn,{type:"button",className:"add",onClick:f,children:l(M,{weight:"semibold",muted:!0,size:1,children:[d(g,{})," Add Concept"]})})]}):d(H,{space:2,children:d(Yn,{type:"button",onClick:S,children:l(M,{weight:"semibold",muted:!0,size:1,children:[d(w,{})," Edit"]})})})})]})})}),d(no,{concepts:x,inputComponent:n,selectConcept:t})]})})}):d(eo,{document:r})},oo=({branchId:e="",selectConcept:t,inputComponent:n=!1})=>{const r=O(Ur)||{},o=r.displayed?._id,{data:i,loading:a,error:s}=$r({fetch:`\n select($branchId != null => \n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":*[_type == "skosConcept" && conceptId == $branchId]{\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr()}\n }, \n "orphans": []\n },\n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":topConcepts[]->|order(prefLabel){\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr()}\n }, \n "orphans": *[\n _id in coalesce(*[_id == 'drafts.' + $id][0], *[_id == $id][0]).concepts[]._ref &&\n count((broader[]._ref) [@ in coalesce(*[_id == 'drafts.' + $id][0], *[_id == $id][0]).topConcepts[]._ref]) < 1 &&\n count((broader[]._ref) [@ in coalesce(*[_id == 'drafts.' + $id][0], *[_id == $id][0]).concepts[]._ref]) < 1\n ]|order(prefLabel){\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr()}\n }\n }\n )`,listen:'*[_type == "skosConcept" || _id == $id]'},{params:{id:o,branchId:e}});return a?d(U,{padding:5,children:l(Z,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[d(W,{muted:!0}),d(M,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):s?(console.warn(s),d("div",{children:"error"})):i?d(Fr.Provider,{value:{globalVisibility:{treeId:"123",treeVisibility:"open"}},children:d(U,{padding:4,children:d(no,{concepts:i,inputComponent:n,selectConcept:t})})}):d(eo,{document:r})},io=({document:e,branchId:t,selectConcept:n,inputComponent:r=!1})=>d(Ur.Provider,{value:e,children:r?d(oo,{inputComponent:r,branchId:t,selectConcept:n}):l(Y,{width:1,style:{paddingTop:"1.25rem"},children:[e?.displayed?.description&&d(U,{padding:4,children:d(R,{space:4,children:l(R,{space:2,children:[d(M,{size:1,weight:"semibold",children:"Description"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e?.displayed.description})]})})}),d(ro,{inputComponent:r,branchId:t})]})});function ao(e){const{schemeId:t}=e||{};return{filter:'!(_id in path("drafts.**"))\n && _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref\n || _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].topConcepts[]._ref',params:{schemeId:t}}}function so(e){const{schemeId:t,branchId:n}=e||{};return{filter:'!(_id in path("drafts.**")) && _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref \n && $branchId in broader[]->conceptId\n || $branchId in broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->broader[]->conceptId',params:{schemeId:t,branchId:n}}}function co(t){const{name:n,title:r}=t,o=e(["_id"]),i=a({apiVersion:"2021-10-21"}),[s,c]=E(!1),[p,h]=E({}),{filter:u}=t.schemaType.options,f=u(),{schemeId:m,branchId:g=null}=f.params;$((()=>{i.fetch(`{"displayed": *[schemeId == "${m}"][0]}`).then((e=>{h(e)})).catch((e=>console.warn(e)))}),[i,m]);const y=P((()=>{c(!0)}),[]),b=P((()=>{c(!1)}),[]),v=P((e=>{o.includes("drafts.")?i.patch(o).set({[n]:e}).commit().then((()=>c(!1))).catch((e=>console.error(e))):i.fetch(`*[_id == "${o}"][0]`).then((t=>{t._id=`drafts.${t._id}`,t[n]=e,i.create(t)})).then((()=>c(!1))).catch((e=>console.error(e)))}),[i,o,n]);return l(R,{space:3,children:[t.renderDefault(t),d(K,{columns:1,gap:3,children:d(L,{text:"Browse Taxonomy Tree",mode:"ghost",onClick:y})}),s&&d(j,{header:r,id:"concept-select-dialog",onClose:b,zOffset:900,width:1,children:d(U,{padding:10,children:d(io,{document:p,branchId:g,inputComponent:!0,selectConcept:v})})})]})}const lo=e=>e.list().title("Taxonomy Manager").items([e.documentTypeListItem("skosConceptScheme").title("Concept Schemes"),e.documentTypeListItem("skosConcept").title("Concepts")]),po=(e,{schemaType:t})=>{switch(t){case"skosConceptScheme":return e.document().views([e.view.component(io).title("Tree View").icon(sr),e.view.form().icon(w)]);case"skosConcept":return e.document().views([e.view.form().icon(w)]);default:e.view.form()}},ho=s((e=>{const{baseUri:t}=e||{};return{name:"taxonomyManager",options:e,schema:{types:[ar(t),cr(t)]},plugins:[c({name:"taxonomy",title:"Taxonomy",structure:lo,defaultDocumentNode:po,icon:sr})]}}));export{co as HierarchyInput,io as TreeView,so as branchFilter,ao as schemeFilter,ho as taxonomyManager};//# sourceMappingURL=index.esm.esm.js.map
|
|
144
|
+
`;const or=e=>{const{onChange:n}=e,r=z(),o=P((()=>{n(t(C(6))),r.push({status:"success",title:"Identifier created.",closable:!0})}),[n,r]);return d(R,{space:2,children:d(H,{space:[3,3,4],children:d(L,{tone:"primary",fontSize:2,onClick:o,text:"Generate Identifier"})})})};var ir=[n({name:"baseIri",title:"Base URI",type:"url",validation:e=>e.required().error("Please supply a base URI in the format 'http://example.com/'"),description:l(Gn,{children:[d("summary",{children:"The root URI (Uniform Resource Identifier) used to create unique concept identifiers."}),l("div",{children:["Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between ",d("code",{children:"https://shipparts.com/vocab#Bow"})," and ",d("code",{children:"https://wrappingsupplies.com/vocab#Bow"}),"."]}),d("div",{children:"In most cases, it makes sense for your base URI to be the root or a subdirectory of your website. In all cases, the URI you choose should be in a domain that you control."}),d("div",{children:"For new Concepts and Concept Schemes, the Base URI field is pre-populated based on the most recently used Base URI value."})]}),options:{collapsible:!0},components:{input:function(t){const n=e(["conceptId"]),r=e(["schemeId"]);return l(R,{space:2,children:[t.renderDefault(t),d(M,{muted:!0,size:1,onResize:void 0,onResizeCapture:void 0,children:l(p,{children:[d("strong",{children:"RDF URI: "}),t.value?t.value:"[base URI not defined] ",n||r||" [identifier not assigned]"]})})]})}}})];function ar(e,t=[]){return r({name:"skosConcept",title:"Concept",type:"document",icon:_,initialValue:async(t,n)=>{if(e)return{baseIri:e,broader:[],related:[]};const{getClient:r}=n;return{baseIri:await r({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0,broader:[],related:[]}},fields:[n({name:"prefLabel",title:"Preferred Label",type:"string",description:"The preferred lexical label for this concept.",validation:e=>e.required().custom(((e,t)=>{const{getClient:n}=t;return n({apiVersion:"2022-12-14"}).fetch(`*[_type == "skosConcept" && prefLabel == "${e}" && !(_id in path("drafts.**"))][0]._id`).then((e=>!e||e===t.document?._id.replace("drafts.","")||"Preferred Label must be unique."))}))}),n({name:"definition",title:"Definition",type:"text",description:l(Gn,{children:[d("summary",{children:"A complete explanation of the intended meaning of the concept."}),l("div",{children:[l("kbd",{children:["Example: documentation",d("br",{}),'Definition: "The process of storing and retrieving information in all fields of knowledge."']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"example",title:"Examples",type:"text",description:l(Gn,{children:[d("summary",{children:"An example of the use of the concept."}),l("div",{children:[l("kbd",{children:["Example: organizations of science and culture",d("br",{}),'Example: "academies of science, general museums, world fairs"']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"scopeNote",title:"Scope Note",type:"text",description:l(Gn,{children:[d("summary",{children:"A brief statement on the intended meaning of this concept, especially as an indication of how the use of the concept is limited in indexing practice."}),l("div",{children:[l("kbd",{children:["Example: microwave frequencies",d("br",{}),'Scope Note: "Used for frequencies between 1Ghz and 300Ghz"']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"altLabel",title:"Alternate Label(s)",type:"array",description:l(Gn,{children:[d("summary",{children:"Synonyms, near-synonyms, abbreviations, and acronyms to a concept."}),d("div",{children:l("p",{children:[d(h,{})," Preferred, alternative, and hidden label sets must not overlap."]})})]}),of:[{type:"string"}],validation:e=>e.unique()}),n({name:"hiddenLabel",title:"Hidden Label(s)",type:"array",description:l(Gn,{children:[d("summary",{children:"Character strings that need to be accessible to applications performing text-based indexing and search operations, but which should not be displayed to end users."}),l("div",{children:[d("p",{children:"Hidden labels may for instance be used to include misspelled variants of other lexical labels."}),l("p",{children:[d(h,{})," Preferred, alternative, and hidden label sets must not overlap."]})]})]}),of:[{type:"string"}],validation:e=>e.unique()}),...ir,n({name:"conceptId",title:"Identifier",description:"This concept does not yet have a unique identifier.",type:"string",initialValue:()=>`${C(6)}`,hidden:({document:e})=>!!e?.conceptId,readOnly:({document:e})=>!!e?.conceptId,components:{input:or}}),n({name:"broader",title:"Broader Concept(s)",description:l(Gn,{children:[d("summary",{children:"Create hierarchy between concepts, for example to create category/subcategory, part/whole, or class/instance relationships."}),d("div",{children:d("p",{children:"Broader and Associated relationships are mutually exclusive."})})]}),type:"array",of:[{type:"reference",to:{type:"skosConcept"},options:{filter:({document:e})=>({filter:'!(_id in $broader || _id in $related || _id in path("drafts.**") || _id == $self)',params:{self:e._id.replace("drafts.",""),broader:e.broader.map((({_ref:e})=>e)),related:e.related.map((({_ref:e})=>e))}})}}]}),n({name:"related",title:"Related Concept(s)",description:l(Gn,{children:[d("summary",{children:'Indicate that two concepts are inherently "related", but that one is not in any way more general than the other.'}),d("div",{children:d("p",{children:"Broader and Associated relationships are mutually exclusive."})})]}),type:"array",of:[{type:"reference",to:[{type:"skosConcept"}]}]}),...t,n({name:"historyNote",title:"History Notes",type:"text",description:l(Gn,{children:[d("summary",{children:"Significant changes to the meaning of the form of this concept."}),l("div",{children:[l("kbd",{children:["Example: person with disabilities",d("br",{}),'History Note: "Estab. 1992; heading was: handicapped [1884 - 1992]."']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"editorialNote",title:"Editorial Notes",type:"text",description:l(Gn,{children:[d("summary",{children:"Information to aid in administrative housekeeping, such as reminders of editorial work still to be done, or warnings in the event that future editorial changes might be made."}),l("div",{children:[l("kbd",{children:["Example: doubleclick",d("br",{}),'Editorial Note: "Review this term after the company merger is complete."']}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),n({name:"changeNote",title:"Change Notes",type:"text",description:l(Gn,{children:[d("summary",{children:"Fine-grained changes to a concept, for the purposes of administration and maintenance."}),l("div",{children:[l("kbd",{children:["Example: tomato",d("br",{}),"Change Note: \"Moved from under 'fruits' to under 'vegetables' by Horace Gray\""]}),l("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",l("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3})],orderings:[{title:"Top Concepts",name:"topConcept",by:[{field:"topConcept",direction:"desc"},{field:"prefLabel",direction:"asc"}]},{title:"Preferred Label",name:"prefLabel",by:[{field:"prefLabel",direction:"asc"}]}],preview:{select:{title:"prefLabel"},prepare:({title:e})=>({title:e,media:k})}})}function sr(){return d("svg",{"data-sanity-icon":!0,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M5.5 6.5V5.9H4.9V6.5H5.5ZM11.5 6.5H12.1V5.9H11.5V6.5ZM5.5 9H4.9V9.6H5.5V9ZM11.5 9V9.6H12.1V9H11.5ZM13.5 11V10.4H12.9V11H13.5ZM19.5 11H20.1V10.4H19.5V11ZM13.5 13.5H12.9V14.1H13.5V13.5ZM19.5 13.5V14.1H20.1V13.5H19.5ZM13.5 16V15.4H12.9V16H13.5ZM19.5 16H20.1V15.4H19.5V16ZM13.5 18.5H12.9V19.1H13.5V18.5ZM19.5 18.5V19.1H20.1V18.5H19.5ZM5.5 7.1H11.5V5.9H5.5V7.1ZM6.1 9V6.5H4.9V9H6.1ZM11.5 8.4H5.5V9.6H11.5V8.4ZM10.9 6.5V9H12.1V6.5H10.9ZM13.5 11.6H19.5V10.4H13.5V11.6ZM14.1 13.5V11H12.9V13.5H14.1ZM19.5 12.9H13.5V14.1H19.5V12.9ZM18.9 11V13.5H20.1V11H18.9ZM13.5 16.6H19.5V15.4H13.5V16.6ZM14.1 18.5V16H12.9V18.5H14.1ZM19.5 17.9H13.5V19.1H19.5V17.9ZM18.9 16V18.5H20.1V16H18.9ZM8 17.85H13.5V16.65H8V17.85ZM8 12.85H13.5V11.65H8V12.85ZM7.9 9.5V17.85H9.1V9.5H7.9Z",fill:"currentColor"})})}function cr(e,t=[]){return r({name:"skosConceptScheme",title:"Concept Scheme",type:"document",icon:sr,initialValue:async(t,n)=>{if(e)return{baseIri:e};const{getClient:r}=n;return{baseIri:await r({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0}},fields:[n({name:"title",title:"Title",type:"string",description:"Taxonomy schemes group concepts into defined sets, such as thesauri, classification schemes, or facets. Concepts may belong on many (or no) concept schemes, and you may create as many (or few) concept schemes as you like"}),n({name:"description",title:"Description",type:"text",rows:5,description:"Describe the intended use of this scheme."}),n({name:"controls",title:"Concept Management Controls",description:"Show concept management controls in hierarchy view",type:"boolean",initialValue:!0}),...ir,n({name:"schemeId",title:"Identifier",description:"This scheme does not yet have a unique identifier.",type:"string",initialValue:()=>`${C(6)}`,hidden:({document:e})=>!!e?.schemeId,readOnly:({document:e})=>!!e?.schemeId,components:{input:or}}),n({name:"topConcepts",title:"Top Concepts",type:"array",validation:e=>e.unique(),of:[o({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),n({name:"concepts",title:"Concepts",type:"array",validation:e=>e.unique(),of:[o({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),...t],preview:{select:{title:"title"},prepare:({title:e})=>({title:e,media:sr})}})}var lr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},dr={},pr={},hr={};Object.defineProperty(hr,"__esModule",{value:!0});var ur="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";hr.default=function(e){var t=e.split("-"),n=t[1],r=t[2],o=t[3];if(!n||!r||!o)throw new Error("Malformed asset _ref '".concat(e,"'. Expected an id like \"").concat(ur,'".'));var i=r.split("x"),a=+i[0],s=+i[1];if(!(isFinite(a)&&isFinite(s)))throw new Error("Malformed asset _ref '".concat(e,"'. Expected an id like \"").concat(ur,'".'));return{id:n,width:a,height:s,format:o}};var fr={},mr=lr&&lr.__assign||function(){return mr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mr.apply(this,arguments)};Object.defineProperty(fr,"__esModule",{value:!0});function gr(e){var t=e.split("/").slice(-1);return"image-".concat(t[0]).replace(/\.([a-z]+)$/,"-$1")}fr.default=function(e){if(!e)return null;var t,n;if("string"==typeof e&&/^https?:\/\//.test("".concat(e)))t={asset:{_ref:gr(e)}};else if("string"==typeof e)t={asset:{_ref:e}};else if((n=e)&&"string"==typeof n._ref)t={asset:e};else if(function(e){return!!e&&"string"==typeof e._id}(e))t={asset:{_ref:e._id||""}};else if(function(e){var t=e;return!(!t||!t.asset)&&"string"==typeof t.asset.url}(e))t={asset:{_ref:gr(e.asset.url)}};else{if("object"!=typeof e.asset)return null;t=mr({},e)}var r=e;return r.crop&&(t.crop=r.crop),r.hotspot&&(t.hotspot=r.hotspot),function(e){if(e.crop&&e.hotspot)return e;var t=mr({},e);return t.crop||(t.crop={left:0,top:0,bottom:0,right:0}),t.hotspot||(t.hotspot={x:.5,y:.5,height:1,width:1}),t}(t)},function(e){var t=lr&&lr.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)},n=lr&&lr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.parseSource=e.SPEC_NAME_TO_URL_NAME_MAPPINGS=void 0;var r=n(hr),o=n(fr);e.parseSource=o.default,e.SPEC_NAME_TO_URL_NAME_MAPPINGS=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"],["saturation","sat"],["auto","auto"],["dpr","dpr"],["pad","pad"]],e.default=function(n){var i=t({},n||{}),a=i.source;delete i.source;var s=(0,o.default)(a);if(!s)throw new Error("Unable to resolve image URL from source (".concat(JSON.stringify(a),")"));var c=s.asset._ref||s.asset._id||"",l=(0,r.default)(c),d=Math.round(s.crop.left*l.width),p=Math.round(s.crop.top*l.height),h={left:d,top:p,width:Math.round(l.width-s.crop.right*l.width-d),height:Math.round(l.height-s.crop.bottom*l.height-p)},u=s.hotspot.height*l.height/2,f=s.hotspot.width*l.width/2,m=s.hotspot.x*l.width,g=s.hotspot.y*l.height,y={left:m-f,top:g-u,right:m+f,bottom:g+u};return i.rect||i.focalPoint||i.ignoreImageParams||i.crop||(i=t(t({},i),function(e,t){var n,r=t.width,o=t.height;if(!r||!o)return{width:r,height:o,rect:e.crop};var i=e.crop,a=e.hotspot,s=r/o,c=i.width/i.height;if(c>s){var l=Math.round(i.height),d=Math.round(l*s),p=Math.max(0,Math.round(i.top)),h=Math.round((a.right-a.left)/2+a.left);(u=Math.max(0,Math.round(h-d/2)))<i.left?u=i.left:u+d>i.left+i.width&&(u=i.left+i.width-d),n={left:u,top:p,width:d,height:l}}else{d=i.width,l=Math.round(d/s);var u=Math.max(0,Math.round(i.left)),f=Math.round((a.bottom-a.top)/2+a.top),m=Math.max(0,Math.round(f-l/2));m<i.top?m=i.top:m+l>i.top+i.height&&(m=i.top+i.height-l),n={left:u,top:m,width:d,height:l}}return{width:r,height:o,rect:n}}({crop:h,hotspot:y},i))),function(t){var n=(t.baseUrl||"https://cdn.sanity.io").replace(/\/+$/,""),r="".concat(t.asset.id,"-").concat(t.asset.width,"x").concat(t.asset.height,".").concat(t.asset.format),o="".concat(n,"/images/").concat(t.projectId,"/").concat(t.dataset,"/").concat(r),i=[];if(t.rect){var a=t.rect,s=a.left,c=a.top,l=a.width,d=a.height;(0!==s||0!==c||d!==t.asset.height||l!==t.asset.width)&&i.push("rect=".concat(s,",").concat(c,",").concat(l,",").concat(d))}t.bg&&i.push("bg=".concat(t.bg)),t.focalPoint&&(i.push("fp-x=".concat(t.focalPoint.x)),i.push("fp-y=".concat(t.focalPoint.y)));var p=[t.flipHorizontal&&"h",t.flipVertical&&"v"].filter(Boolean).join("");return p&&i.push("flip=".concat(p)),e.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach((function(e){var n=e[0],r=e[1];typeof t[n]<"u"?i.push("".concat(r,"=").concat(encodeURIComponent(t[n]))):typeof t[r]<"u"&&i.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),0===i.length?o:"".concat(o,"?").concat(i.join("&"))}(t(t({},i),{asset:l}))}}(pr);var yr=lr&&lr.__assign||function(){return yr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},yr.apply(this,arguments)},br=lr&&lr.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),vr=lr&&lr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wr=lr&&lr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&br(t,e,n);return vr(t,e),t};Object.defineProperty(dr,"__esModule",{value:!0}),dr.ImageUrlBuilder=void 0;var Cr=wr(pr),_r=["clip","crop","fill","fillmax","max","scale","min"],kr=["top","bottom","left","right","center","focalpoint","entropy"],Sr=["format"];function xr(e){for(var t=0,n=Cr.SPEC_NAME_TO_URL_NAME_MAPPINGS;t<n.length;t++){var r=n[t],o=r[0],i=r[1];if(e===o||e===i)return o}return e}dr.default=function(e){if(function(e){return!(!e||!("config"in e))&&"function"==typeof e.config}(e)){var t=e.config(),n=t.apiHost,r=t.projectId,o=t.dataset;return new Ir(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:r,dataset:o})}var i=e;if(function(e){return!(!e||!("clientConfig"in e))&&"object"==typeof e.clientConfig}(i)){var a=i.clientConfig;n=a.apiHost,r=a.projectId,o=a.dataset;return new Ir(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:r,dataset:o})}return new Ir(null,e)};var Ir=function(){function e(e,t){this.options=yr(e?yr({},e.options||{}):{},t||{})}return e.prototype.withOptions=function(t){var n=t.baseUrl||this.options.baseUrl,r={baseUrl:n};for(var o in t)if(t.hasOwnProperty(o)){r[xr(o)]=t[o]}return new e(this,yr({baseUrl:n},r))},e.prototype.image=function(e){return this.withOptions({source:e})},e.prototype.dataset=function(e){return this.withOptions({dataset:e})},e.prototype.projectId=function(e){return this.withOptions({projectId:e})},e.prototype.bg=function(e){return this.withOptions({bg:e})},e.prototype.dpr=function(e){return this.withOptions(e&&1!==e?{dpr:e}:{})},e.prototype.width=function(e){return this.withOptions({width:e})},e.prototype.height=function(e){return this.withOptions({height:e})},e.prototype.focalPoint=function(e,t){return this.withOptions({focalPoint:{x:e,y:t}})},e.prototype.maxWidth=function(e){return this.withOptions({maxWidth:e})},e.prototype.minWidth=function(e){return this.withOptions({minWidth:e})},e.prototype.maxHeight=function(e){return this.withOptions({maxHeight:e})},e.prototype.minHeight=function(e){return this.withOptions({minHeight:e})},e.prototype.size=function(e,t){return this.withOptions({width:e,height:t})},e.prototype.blur=function(e){return this.withOptions({blur:e})},e.prototype.sharpen=function(e){return this.withOptions({sharpen:e})},e.prototype.rect=function(e,t,n,r){return this.withOptions({rect:{left:e,top:t,width:n,height:r}})},e.prototype.format=function(e){return this.withOptions({format:e})},e.prototype.invert=function(e){return this.withOptions({invert:e})},e.prototype.orientation=function(e){return this.withOptions({orientation:e})},e.prototype.quality=function(e){return this.withOptions({quality:e})},e.prototype.forceDownload=function(e){return this.withOptions({download:e})},e.prototype.flipHorizontal=function(){return this.withOptions({flipHorizontal:!0})},e.prototype.flipVertical=function(){return this.withOptions({flipVertical:!0})},e.prototype.ignoreImageParams=function(){return this.withOptions({ignoreImageParams:!0})},e.prototype.fit=function(e){if(-1===_r.indexOf(e))throw new Error('Invalid fit mode "'.concat(e,'"'));return this.withOptions({fit:e})},e.prototype.crop=function(e){if(-1===kr.indexOf(e))throw new Error('Invalid crop mode "'.concat(e,'"'));return this.withOptions({crop:e})},e.prototype.saturation=function(e){return this.withOptions({saturation:e})},e.prototype.auto=function(e){if(-1===Sr.indexOf(e))throw new Error('Invalid auto mode "'.concat(e,'"'));return this.withOptions({auto:e})},e.prototype.pad=function(e){return this.withOptions({pad:e})},e.prototype.url=function(){return(0,Cr.default)(this.options)},e.prototype.toString=function(){return this.url()},e}();dr.ImageUrlBuilder=Ir,(lr&&lr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(dr);const Nr={},Or={apiVersion:"v2023-05-01"},Pr=null;function Er(e){const t=T((()=>JSON.stringify(e||{})),[e]);return T((()=>JSON.parse(t)),[t])}function $r(e,t){let{params:n=Nr,options:r=Or,initialValue:o=Pr}=t;const[a,s]=E(!0),[c,l]=E(!1),[d,p]=E(o),h=Er(n),u=Er(r),f=x(null),m=i();return $((()=>{if(e&&!c&&!f.current)try{f.current=m.listenQuery(e,h,u).pipe(J(X),Q((e=>(console.error(e),l(e),s(!1),p(null),e)))).subscribe((e=>{p((t=>X(t,e)?t:e)),s(!1),l(!1)}))}catch(e){console.error(e),s(!1),l(e)}return c&&f.current&&f.current.unsubscribe(),()=>{var e;f.current&&(null==(e=f?.current)||e.unsubscribe(),f.current=null)}}),[e,c,h,u,m]),{data:d,loading:a,error:c}}var Tr,Ar,Vr,Rr=Object.freeze,Mr=Object.defineProperty,zr=(e,t)=>Rr(Mr(e,"raw",{value:Rr(e.slice())}));Bn((function(){return d(D,{as:"table",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>jn(Tr||(Tr=zr(["\n display: table;\n width: 100%;\n border-collapse: collapse;\n\n &:not([hidden]) {\n display: table;\n border-collapse: collapse;\n }\n "])))));Bn((function(){return d(D,{as:"tr",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>jn(Ar||(Ar=zr(["\n display: table-row;\n\n &:not([hidden]) {\n display: table-row;\n }\n "])))));function Hr(e){const t=z(),n=a({apiVersion:"2021-10-21"}),r=function(){const e=O(te),{routerPanesState:t,groupIndex:n}=ee();return P((r=>{if(!e||!r)return;const o=[...t];o.splice(n+1,n+1,[{id:r,params:{type:"skosConcept"}}]);const i=e.resolvePathFromState({panes:o});e.navigateUrl({path:i})}),[e,t,n])}(),o=e.displayed.baseIri;return P(((i,a,s)=>{let c;c=a?{_id:`drafts.${C()}`,_type:"skosConcept",conceptId:`${C(6)}`,prefLabel:"",baseIri:o,broader:[a&&{_key:C(6),_ref:a,_type:"reference"}],related:[]}:{_id:`drafts.${C()}`,_type:"skosConcept",conceptId:`${C(6)}`,prefLabel:"",baseIri:o,broader:[],related:[]};const l=JSON.parse(JSON.stringify(e.displayed));l._id.includes("drafts.")||(l._id=`drafts.${l._id}`),n.transaction().createIfNotExists(l).create(c).patch(l._id,(e=>"topConcept"==i?e.setIfMissing({topConcepts:[]}).append("topConcepts",[{_ref:c._id.replace("drafts.",""),_type:"reference",_key:C(6),_weak:!0,_strengthenOnPublish:{_type:"skosConcept",weak:!0,template:{id:"skosConcept",params:"undefined"}}}]):e.setIfMissing({concepts:[]}).insert("after","concepts[-1]",[{_ref:c._id.replace("drafts.",""),_type:"reference",_key:C(6),_weak:!0,_strengthenOnPublish:{_type:"skosConcept",weak:void 0,template:{id:"skosConcept",params:"undefined"}}}]))).commit({autoGenerateArrayKeys:!0}).then((e=>{t.push({closable:!0,status:"success",title:"Created new concept"}),r(c._id)})).catch((e=>{t.push({closable:!0,status:"error",title:"Error creating concept",description:e.message})}))}),[e.displayed,n,o,t,r])}function Lr(e){const t=z(),n=a({apiVersion:"2021-10-21"});return P(((r,o,i)=>{const a="topConcept"==o?"topConcepts":"concepts",s=JSON.parse(JSON.stringify(e.displayed));s._id.includes("drafts.")||(s._id=`drafts.${s._id}`),n.transaction().createIfNotExists(s).patch(s._id,(e=>e.unset([`${a}[_ref=="${r.replace("drafts.","")}"]`]))).commit().then((e=>{t.push({closable:!0,status:"success",title:(i?`"${i}"`:"Concept")+" removed from scheme"})})).catch((e=>{t.push({closable:!0,status:"error",title:"Error removing concept",description:e.message})}))}),[n,e.displayed,t])}Bn((function(){return d(D,{as:"td",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>jn(Vr||(Vr=zr(["\n display: table-cell;\n\n &:not([hidden]) {\n display: table-cell;\n }\n "])))));const Dr=(e=1)=>e>6?"":`"childConcepts": *[\n (_id in $draftConceptIds ||\n (\n _id in $conceptIds &&\n !(conceptId in $draftConceptIds)\n )\n ) && ^._id in broader[]._ref ]|order(prefLabel){\n "id": _id,\n "level": ${e},\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Dr(e+1)}\n }`,jr=(e=1)=>e>6?"":`"childConcepts": *[_id in *[_id == $id][0].concepts[]._ref && ^._id in broader[]._ref ]|order(prefLabel){\n "id": _id,\n "level": ${e},\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr(e+1)}\n }`,Ur=A(null),Fr=A({editControls:!1});function Br({concept:e}){const t=O(te),{routerPanesState:n,groupIndex:r}=ee(),{id:o,prefLabel:i}=e??{},a=P((()=>{if(!t||!o)return;const e=[...n];e.splice(r+1,r+1,[{id:o,params:{type:"skosConcept"}}]);const i=t.resolvePathFromState({panes:e});t.navigateUrl({path:i})}),[o,t,n,r]);return d(nr,{href:"#",onClick:a,children:i})}const qr=({concept:e})=>{const[t,n]=E(!1),r=P((()=>n(!1)),[]),o=P((()=>n(!0)),[]);return e&&(e.definition||e.example||e.scopeNote)?l(p,{children:[d(Kn,{className:"action","aria-label":"info",onClick:o,type:"button",children:d(u,{className:"info"})}),t&&d(j,{header:e.prefLabel,id:"dialog-example",onClose:r,zOffset:1e3,width:1,children:d(U,{padding:4,paddingBottom:5,children:l(R,{space:4,children:[e.definition&&l(R,{space:2,children:[d(F,{size:1,children:"Definition"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.definition})]}),e.example&&l(R,{space:2,children:[d(F,{size:1,children:"Example"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.example})]}),e.scopeNote&&l(R,{space:2,children:[d(F,{size:1,children:"Scope Note"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.scopeNote})]})]})})})]}):null},Gr=({concept:e,selectConcept:t,inputComponent:n=!1})=>{const r=O(Ur)||{},{globalVisibility:{treeVisibility:o}}=O(Fr)||{},{editControls:i}=O(Fr)||{editControls:!1},a=Hr(r),s=Lr(r),c=P((()=>{a("concept",e?.id,e?.prefLabel)}),[e?.id,e?.prefLabel,a]),p=P((()=>{s(e.id,"concept",e?.prefLabel)}),[e.id,e?.prefLabel,s]),[h,v]=E(o),w=P((()=>{"open"==h?v("closed"):"closed"==h&&v("open")}),[h]);return l(tr,{className:h,children:[l(H,{space:2,children:[l(H,{space:1,children:[l(H,{space:1,children:[e?.childConcepts&&e.childConcepts.length>0&&d(Xn,{onClick:w,type:"button","aria-expanded":"open"==h,children:d(f,{})}),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Br,{concept:e})]}),!i&&d(qr,{concept:e})]}),i&&e?.level&&e.level<5&&l(H,{space:2,children:[d(Kn,{onClick:c,type:"button",className:"action","aria-label":"Add child a child concept",children:d(g,{className:"add"})}),d(Kn,{onClick:p,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})]}),i&&0==e.childConcepts?.length&&5==e.level&&l(H,{space:2,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"This concept is at the maximum Taxonomy Manager hierarchy depth of 5 levels."})})}),fallbackPlacements:["right","left"],placement:"top",children:d(u,{className:"info warning"})}),d(Kn,{onClick:p,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})]}),e?.childConcepts&&e?.childConcepts?.length>0&&5==e.level&&l(H,{space:1,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:l(R,{padding:1,space:2,children:[d(M,{muted:!0,size:1,children:"This concept has unlisted child concepts."}),d(M,{muted:!0,size:1,children:"The maximum hierarchy depth is 5 levels."})]})}),fallbackPlacements:["right","left"],placement:"top",children:d(b,{className:"info error"})}),r.displayed?.controls&&d(Kn,{onClick:p,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&e?.level&&e.level<5&&d(Yr,{concepts:e.childConcepts,selectConcept:t,inputComponent:n})]})};function Zr({concept:e,selectConcept:t}){const{prefLabel:n,id:r}=e??{},o=P((()=>{t({_ref:r,_type:"reference"})}),[r,t]);return d(p,{children:t?d(nr,{href:"#",onClick:o,children:n}):d(rr,{children:n})})}const Wr=({concept:e,selectConcept:t,inputComponent:n=!1})=>{const{globalVisibility:{treeVisibility:r}={treeVisibility:"open"}}=O(Fr)||{},[o,i]=E(r),a=P((()=>{"open"==o?i("closed"):"closed"==o&&i("open")}),[o]);return l(tr,{className:o,children:[l(H,{space:2,children:[l(H,{space:1,children:[l(H,{space:1,children:[e?.childConcepts&&e.childConcepts.length>0&&d(Xn,{onClick:a,type:"button","aria-expanded":"open"==o,children:d(f,{})}),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Zr,{concept:e,selectConcept:t})]}),d(qr,{concept:e})]}),e?.childConcepts&&e?.childConcepts?.length>0&&5==e.level&&d(H,{space:1,children:d(B,{content:d(U,{padding:2,sizing:"border",children:l(R,{padding:1,space:2,children:[d(M,{muted:!0,size:1,children:"This concept has unlisted child concepts."}),d(M,{muted:!0,size:1,children:"The maximum hierarchy depth is 5 levels."})]})}),fallbackPlacements:["right","left"],placement:"top",children:d(b,{className:"info error"})})})]}),e?.childConcepts&&e.childConcepts.length>0&&e?.level&&e.level<5&&d(Yr,{concepts:e.childConcepts,selectConcept:t,inputComponent:n})]})},Yr=({concepts:e,inputComponent:t=!1,selectConcept:n})=>d(er,{children:e.map((e=>d(t?Wr:Gr,{concept:e,selectConcept:n,inputComponent:t},e.id)))}),Kr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=O(Ur)||{},{editControls:i}=O(Fr)||{editControls:!1},a=Hr(o),s=Lr(o),[c,p]=E(t),h=P((()=>{"open"==c?p("closed"):"closed"==c&&p("open")}),[c]),u=P((()=>{a("concept",e?.id,e?.prefLabel)}),[e?.id,e?.prefLabel,a]),b=P((()=>{s(e?.id,"topConcept",e?.prefLabel)}),[e?.id,e?.prefLabel,s]);return l(Jn,{className:c,children:[l(H,{space:2,children:[l(H,{space:0,children:[e?.childConcepts&&e.childConcepts.length>0&&d(Xn,{onClick:h,type:"button","aria-expanded":"open"==c,children:d(f,{})}),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(n?Zr:Br,{concept:e})]}),d(M,{size:1,muted:!0,children:"top concept"}),!i&&d(qr,{concept:e}),i&&l(H,{space:2,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Add a child concept"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:u,type:"button",className:"action","aria-label":"Add child a child concept",children:d(g,{className:"add"})})}),d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Remove concept from scheme"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:b,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},Xr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const[o,i]=E(t),a=P((()=>{"open"==o?i("closed"):"closed"==o&&i("open")}),[o]);return l(Jn,{className:o,children:[l(H,{space:2,children:[l(H,{space:0,children:[e?.childConcepts&&e.childConcepts.length>0&&(n?d(m,{className:"spacer"}):d(Xn,{onClick:a,type:"button","aria-expanded":"open"==o,children:d(f,{})})),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Zr,{concept:e,selectConcept:r})]}),d(M,{size:1,muted:!0,children:"top concept"}),d(qr,{concept:e})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},Jr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=O(Ur)||{},{editControls:i}=O(Fr)||{editControls:!1},a=Hr(o),s=Lr(o),[c,p]=E(t),h=P((()=>{"open"==c?p("closed"):"closed"==c&&p("open")}),[c]),u=P((()=>{a("concept",e?.id,e?.prefLabel)}),[e?.id,e?.prefLabel,a]),b=P((()=>{s(e.id,"concept",e?.prefLabel)}),[e.id,e?.prefLabel,s]);return l(Qn,{className:c,children:[l(H,{space:2,children:[e?.childConcepts&&e.childConcepts.length>0&&(n?d(m,{className:"spacer"}):d(Xn,{onClick:h,type:"button","aria-expanded":"open"==c,children:d(f,{})})),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(n?Zr:Br,{concept:e}),o.displayed?.topConcepts?.length>0&&d(M,{size:1,muted:!0,children:"orphan"}),!i&&d(qr,{concept:e}),!n&&i&&l(H,{space:2,children:[d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Add a child concept"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:u,type:"button",className:"action","aria-label":"Add child a child concept",children:d(g,{className:"add"})})}),d(B,{content:d(U,{padding:2,sizing:"border",children:d(R,{padding:1,space:2,children:d(M,{muted:!0,size:1,children:"Remove concept from scheme"})})}),fallbackPlacements:["right","left"],placement:"top",children:d(Kn,{onClick:b,type:"button",className:"action","aria-label":"Remove concept from scheme",children:d(y,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},Qr=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=O(Ur)||{},[i,a]=E(t),s=P((()=>{"open"==i?a("closed"):"closed"==i&&a("open")}),[i]);return l(Qn,{className:i,children:[l(H,{space:2,children:[e?.childConcepts&&e.childConcepts.length>0&&(n?d(m,{className:"spacer"}):d(Xn,{onClick:s,type:"button","aria-expanded":"open"==i,children:d(f,{})})),e?.childConcepts&&0==e.childConcepts.length&&d(m,{className:"spacer"}),!e?.prefLabel&&d("span",{className:"untitled",children:"[new concept]"}),d(Zr,{concept:e,selectConcept:r}),o.displayed?.topConcepts?.length>0&&d(M,{size:1,muted:!0,children:"orphan"}),d(qr,{concept:e})]}),e?.childConcepts&&e.childConcepts.length>0&&d(Yr,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},eo=({document:e})=>{const[t,n]=E(!1),[r,o]=E(""),[i,s]=E(""),c=P((()=>n(!1)),[]),p=P((()=>n(!0)),[]),h=P((e=>{o(e.currentTarget.value)}),[]),u=P((e=>{s(e.currentTarget.value)}),[]),f=function(){const e=z(),t=a({apiVersion:"2021-10-21"});return P(((n,r,o)=>{const i=n.displayed?._id,a=n.displayed?.baseIri,s=n.displayed?.schemeId,c={_id:`drafts.${i}`,_type:"skosConceptScheme",schemeId:s,controls:!0,baseIri:a,title:r,description:o||""};t.createIfNotExists(c).then((t=>o?e.push({closable:!0,status:"success",title:"Title and Description added."}):e.push({closable:!0,status:"success",title:"Title added."}))).catch((t=>{e.push({closable:!0,status:"error",title:"There has been an error",description:t.message})}))}),[t,e])}(),m=P((()=>{f(e,r,i)}),[f,i,e,r]);return l(Zn,{children:[d(D,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:l(R,{space:6,children:[l(R,{space:4,children:[d(F,{size:4,children:"New Concept Scheme"}),d(M,{size:2,children:'To start using hierarchy view taxonomy builder, first give your concept scheme a name and optional description. You can also use the "Editor" tab to add concepts to the tree manually.'})]}),d(L,{tone:"primary",fontSize:2,icon:v,onClick:p,text:"Add Title"})]})}),t&&d(j,{header:"Title & Description",id:"title-description",onClose:c,zOffset:1e3,width:1,children:d(U,{padding:4,children:l(R,{space:4,children:[l(R,{space:2,children:[d(F,{size:1,children:"Title"}),d(M,{size:1,muted:!0,children:"Describe the concept scheme in one or two words."})]}),d(q,{fontSize:2,onChange:h,padding:3,placeholder:"",value:r}),l(R,{space:2,children:[d(F,{size:1,children:"Description (optional)"}),d(M,{size:1,muted:!0,children:"Describe the intended use of this concept scheme."})]}),d(G,{fontSize:2,onChange:u,padding:3,placeholder:"",value:i,rows:3}),d(L,{tone:"primary",fontSize:2,onClick:m,text:"Save"})]})})})]})},to=()=>d(Zn,{children:d(D,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:l(R,{space:4,children:[d(F,{size:4,children:"No Concepts"}),d(M,{size:2,children:"There are not yet any concepts assigned to this scheme. To create a multi-level hierarchy with specific entry points, create Top Concepts first, then add children to them. To create a flat list of concepts, create Entry Concepts directly."})]})})}),no=({concepts:e,inputComponent:t,selectConcept:n})=>{const{globalVisibility:{treeId:r,treeVisibility:o}={treeId:123,treeVisibility:"open"}}=O(Fr)||{};return null===e.topConcepts&&0===e.orphans.length?d(to,{}):l(Wn,{children:[e.topConcepts&&e.topConcepts.map((e=>d(t?Xr:Kr,{concept:e,treeVisibility:o,inputComponent:t,selectConcept:n},e?.id+r))),e.orphans.map((e=>d(t?Qr:Jr,{concept:e,treeVisibility:o,inputComponent:t,selectConcept:n},e.id+r)))]})},ro=({branchId:e="",selectConcept:t,inputComponent:n=!1})=>{const r=O(Ur)||{},o=r.displayed?._id,i=r.displayed?.concepts?.map((e=>e?._ref))||[],a=r.displayed?.concepts?.map((e=>`drafts.${e?._ref}`))||[],s=r.displayed?.topConcepts?.map((e=>e?._ref))||[],c=r.displayed?.topConcepts?.map((e=>`drafts.${e?._ref}`))||[],h=Hr(r),u=P((()=>{h("topConcept")}),[h]),f=P((()=>{h("concept")}),[h]),[m,y]=E({treeId:C(3),treeVisibility:"open"}),[b,v]=E(!1);$((()=>{r.displayed._id.includes("drafts.")||v(!1)}),[r.displayed._id]);const _=P((()=>{y({treeId:C(3),treeVisibility:"open"})}),[]),k=P((()=>{y({treeId:C(3),treeVisibility:"closed"})}),[]),S=P((()=>{v(!0)}),[]),{data:x,loading:I,error:N}=$r({fetch:`*[_id == $id][0] {\n _updatedAt,\n "topConcepts": *[_id in $draftTopConceptIds ||\n (\n _id in $topConceptIds &&\n !(conceptId in *[_id in $draftTopConceptIds].conceptId)\n )\n ]|order(prefLabel) {\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Dr()}\n },\n "orphans": *[_id in $draftConceptIds ||\n (\n _id in $conceptIds &&\n !(conceptId in *[_id in $draftConceptIds].conceptId)\n ) &&\n count(\n (broader[]._ref) [@ in coalesce(\n *[_id == 'drafts.' + $id][0], \n *[_id == $id][0]\n ).topConcepts[]._ref]) < 1 &&\n count(\n (broader[]._ref) [@ in coalesce(\n *[_id == 'drafts.' + $id][0], \n *[_id == $id][0]\n ).concepts[]._ref]) < 1\n ]|order(prefLabel){\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Dr()}\n }\n }`,listen:'*[_type == "skosConcept" || _id == $id ]'},{params:{id:o,branchId:e,conceptIds:i,draftConceptIds:a,topConceptIds:s,draftTopConceptIds:c}});return I?d(U,{padding:5,children:l(Z,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[d(W,{muted:!0}),d(M,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):N?(console.error(N),d("div",{children:"Error here"})):x?d(Fr.Provider,{value:{globalVisibility:m,editControls:b},children:d(U,{padding:4,paddingTop:2,children:l(p,{children:[d(R,{space:4,children:d(D,{borderBottom:!0,paddingBottom:1,display:"flex",flex:1,children:l(Z,{justify:"space-between",flex:1,children:[d(D,{children:(x.topConcepts?.filter((e=>(e?.childConcepts?.length??0)>0)).length>0||x.orphans?.filter((e=>(e?.childConcepts?.length??0)>0)).length>0)&&l(H,{space:2,children:[d(Yn,{type:"button",onClick:k,children:d(M,{weight:"semibold",muted:!0,size:1,children:"Collapse"})}),d(M,{weight:"semibold",muted:!0,size:1,children:"|"}),d(Yn,{type:"button",onClick:_,children:d(M,{weight:"semibold",muted:!0,size:1,children:"Expand"})})]})}),d(D,{children:b?l(H,{space:4,children:[d(Yn,{type:"button",className:"add",onClick:u,children:l(M,{weight:"semibold",muted:!0,size:1,children:[d(g,{})," Add Top Concept"]})}),d(Yn,{type:"button",className:"add",onClick:f,children:l(M,{weight:"semibold",muted:!0,size:1,children:[d(g,{})," Add Concept"]})})]}):d(H,{space:2,children:d(Yn,{type:"button",onClick:S,children:l(M,{weight:"semibold",muted:!0,size:1,children:[d(w,{})," Edit"]})})})})]})})}),d(no,{concepts:x,inputComponent:n,selectConcept:t})]})})}):d(eo,{document:r})},oo=({branchId:e="",selectConcept:t,inputComponent:n=!1})=>{const r=O(Ur)||{},o=r.displayed?._id,{data:i,loading:a,error:s}=$r({fetch:`\n select($branchId != null => \n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":*[_type == "skosConcept" && conceptId == $branchId]{\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr()}\n }, \n "orphans": []\n },\n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":topConcepts[]->|order(prefLabel){\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr()}\n }, \n "orphans": *[\n _id in coalesce(*[_id == 'drafts.' + $id][0], *[_id == $id][0]).concepts[]._ref &&\n count((broader[]._ref) [@ in coalesce(*[_id == 'drafts.' + $id][0], *[_id == $id][0]).topConcepts[]._ref]) < 1 &&\n count((broader[]._ref) [@ in coalesce(*[_id == 'drafts.' + $id][0], *[_id == $id][0]).concepts[]._ref]) < 1\n ]|order(prefLabel){\n "id": _id,\n "level": 0,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${jr()}\n }\n }\n )`,listen:'*[_type == "skosConcept" || _id == $id]'},{params:{id:o,branchId:e}});return a?d(U,{padding:5,children:l(Z,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[d(W,{muted:!0}),d(M,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):s?(console.warn(s),d("div",{children:"error"})):i?d(Fr.Provider,{value:{globalVisibility:{treeId:"123",treeVisibility:"open"}},children:d(U,{padding:4,children:d(no,{concepts:i,inputComponent:n,selectConcept:t})})}):d(eo,{document:r})},io=({document:e,branchId:t,selectConcept:n,inputComponent:r=!1})=>d(Ur.Provider,{value:e,children:r?d(oo,{inputComponent:r,branchId:t,selectConcept:n}):l(Y,{width:1,style:{paddingTop:"1.25rem"},children:[e?.displayed?.description&&d(U,{padding:4,children:d(R,{space:4,children:l(R,{space:2,children:[d(M,{size:1,weight:"semibold",children:"Description"}),d(M,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e?.displayed.description})]})})}),d(ro,{inputComponent:r,branchId:t})]})});function ao(e){const{schemeId:t}=e||{};return{filter:'!(_id in path("drafts.**"))\n && _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref\n || _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].topConcepts[]._ref',params:{schemeId:t}}}function so(e){const{schemeId:t,branchId:n}=e||{};return{filter:'!(_id in path("drafts.**")) && _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref \n && $branchId in broader[]->conceptId\n || $branchId in broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->broader[]->conceptId',params:{schemeId:t,branchId:n}}}function co(t){const{name:n,title:r}=t,o=e(["_id"]),i=a({apiVersion:"2021-10-21"}),[s,c]=E(!1),[p,h]=E({}),{filter:u}=t.schemaType.options,f=u(),{schemeId:m,branchId:g=null}=f.params;$((()=>{i.fetch(`{"displayed": *[schemeId == "${m}"][0]}`).then((e=>{h(e)})).catch((e=>console.warn(e)))}),[i,m]);const y=P((()=>{c(!0)}),[]),b=P((()=>{c(!1)}),[]),v=P((e=>{o.includes("drafts.")?i.patch(o).set({[n]:e}).commit().then((()=>c(!1))).catch((e=>console.error(e))):i.fetch(`*[_id == "${o}"][0]`).then((t=>{t._id=`drafts.${t._id}`,t[n]=e,i.create(t)})).then((()=>c(!1))).catch((e=>console.error(e)))}),[i,o,n]);return l(R,{space:3,children:[t.renderDefault(t),d(K,{columns:1,gap:3,children:d(L,{text:"Browse Taxonomy Tree",mode:"ghost",onClick:y})}),s&&d(j,{header:r,id:"concept-select-dialog",onClose:b,zOffset:900,width:1,children:d(U,{padding:10,children:d(io,{document:p,branchId:g,inputComponent:!0,selectConcept:v})})})]})}const lo=e=>e.list().title("Taxonomy Manager").items([e.documentTypeListItem("skosConceptScheme").title("Concept Schemes"),e.documentTypeListItem("skosConcept").title("Concepts")]),po=(e,{schemaType:t})=>{switch(t){case"skosConceptScheme":return e.document().views([e.view.component(io).title("Tree View").icon(sr),e.view.form().icon(w)]);case"skosConcept":return e.document().views([e.view.form().icon(w)]);default:e.view.form()}},ho=s((e=>{const{baseUri:t,customConceptFields:n,customSchemeFields:r}=e||{};return{name:"taxonomyManager",options:e,schema:{types:[ar(t,n),cr(t,r)]},plugins:[c({name:"taxonomy",title:"Taxonomy",structure:lo,defaultDocumentNode:po,icon:sr})]}}));export{co as HierarchyInput,io as TreeView,so as branchFilter,ao as schemeFilter,ho as taxonomyManager};//# sourceMappingURL=index.esm.esm.js.map
|