1import{j as l,o as r,d as c}from"./index-yjs0jCN1.js";import{C as a}from"./common_admin_layout-Du2CJe0Y.js";import{A as f}from"./layout-CjNw_1vT.js";import"./admin_layout_base-DUwP-dbX.js";const n={entityType:{label:"Select an entity type",options:["collection","feed","orgDetails","contentSearch"]},collectionSlug:{label:"Collection Slug (leave blank to use a Webstudio variable to fill it in)",default:"",showIf:{entityType:["collection"]}},feedFinderType:{label:"Find entity by",options:["by-identifier","by-id"],showIf:{entityType:["feed"]}},feedId:{label:"Feed ID (leave blank to use a Webstudio variable to fill it in)",default:"999999",showIf:{entityType:["feed"],feedFinderType:["by-id"]}},feedIdentifier:{label:"Feed Identifier (leave blank to use a Webstudio variable to fill it in)",default:"main_site_content",showIf:{entityType:["feed"],feedFinderType:["by-identifier"]}},specificQuery:{label:"Specific Query",options:["items","details","singleItem"],showIf:{entityType:["collection","feed"]}},collectionItemSlug:{label:"Collection Item Slug",default:"",showIf:{entityType:["collection"],specificQuery:["singleItem"]}},feedItemSlug:{label:"Feed Item Slug",default:"",showIf:{entityType:["feed"],specificQuery:["singleItem"]}},collectionFilterAttr:{label:"Filter Collection by this Attribute",default:"",showIf:{entityType:["collection"],specificQuery:["items"]}},collectionFilterMatch:{label:"Filter Match",options:["equals","not_equals","not_blank","blank"],showIf:{entityType:["collection"],specificQuery:["items"],collectionFilterAttr:["*"]}},collectionFilterValue:{label:"Filter Value",default:"",showIf:{entityType:["collection"],specificQuery:["items"],collectionFilterAttr:["*"],collectionFilterMatch:["equals","not_equals"]}},authorSlugs:{label:"Author Slugs (comma-separated and alphabetically sorted)",default:"",showIf:{entityType:["feed"],specificQuery:["items"]}},categorySlugs:{label:"Category Slugs (comma-separated and alphabetically sorted)",default:"",showIf:{entityType:["collection","feed"],specificQuery:["items"]}},mainCategorySlugs:{label:"Main Category Slugs (comma-separated and alphabetically sorted)",default:"",showIf:{entityType:["collection","feed"],specificQuery:["items"]}},limit:{label:"Limit (fetch the first N items)",default:"",showIf:{entityType:["collection","feed"],specificQuery:["items"]}},offset:{label:"Offset (skip over this many items)",default:"",showIf:{entityType:["collection","feed"],specificQuery:["items"]}},sort:{label:'Sort (please leave blank for the default of "manual")',options:["","manual","published_at"],showIf:{entityType:["collection"],specificQuery:["items"]}},order:{label:"Order",options:["","ascending","descending"],showIf:{entityType:["collection"],specificQuery:["items"],sort:["*"]}}};function d(){const e={};return Object.keys(n).forEach(t=>{e[t]=n[t].default??n[t].options[0]}),e}function p({fieldKey:e,values:t}){var i=!0;if(Object.keys(n[e].showIf||[]).forEach(o=>{n[e].showIf[o].includes("*")?t[o]||(i=!1):n[e].showIf[o].includes(t[o])||(i=!1)}),!i)return null;const s=n[e];return s.options?l.jsx(c.FormikSelectField,{name:e,label:s.label,children:s.options.map(o=>l.jsx("option",{value:o,children:o},o))}):l.jsx(c.FormikTextField,{name:e,label:s.label})}function u(e){var t=["${apiBaseURL}/orgs/${orgSlug}/${system.params.locale || defaultLocale}/"],i=[];if(e.entityType==="contentSearch"&&(t.push("content/search"),i.push("q=${searchInput}")),e.entityType==="feed")if(e.specificQuery==="singleItem")t.push(`feed-item/by-slug/${e.feedItemSlug}/`);else{const s=e.feedFinderType==="by-id"?e.feedId||"${feedId}":e.feedIdentifier||"${feedIdentifier}";t.push(`feeds/${e.feedFinderType}/${s}/`),e.specificQuery==="items"&&t.push("items/")}return e.entityType==="collection"&&(t.push(`collections/by-slug/${e.collectionSlug||"${collectionSlug}"}/`),e.specificQuery==="singleItem"&&t.push(`items/by-slug/${e.collectionItemSlug}/`),e.specificQuery==="items"&&t.push("items/")),e.entityType==="collection"&&e.specificQuery==="items"&&e.collectionFilterAttr&&(i.push(`filter-by-attr=${encodeURIComponent(e.collectionFilterAttr)}`),i.push(`filter-match=${e.collectionFilterMatch}`),(e.collectionFilterMatch==="equals"||e.collectionFilterMatch==="not_equals")&&i.push(`filter-value=${encodeURIComponent(e.collectionFilterValue)}`)),e.specificQuery==="items"&&(e.authorSlugs&&i.push(`filter-by-author-slugs=${encodeURIComponent(e.authorSlugs)}`),e.categorySlugs&&i.push(`filter-by-category-slugs=${encodeURIComponent(e.categorySlugs)}`),e.mainCategorySlugs&&i.push(`filter-by-main-category-slugs=${encodeURIComponent(e.mainCategorySlugs)}`),e.limit&&e.limit>0&&i.push(`limit=${e.limit}`),e.offset&&e.offset>0&&i.push(`offset=${e.offset}`),e.entityType==="collection"&&(e.order&&i.push(`order=${e.order}`),e.sort&&i.push(`sort=${e.sort}`))),i.length>0&&t.push(`?${i.join("&")}`),"`"+t.join("")+"`"}function y(){return l.jsx(r,{initialValues:d(),onSubmit:()=>{},children:({values:e})=>l.jsx(c.FormikForm,{children:l.jsxs(c.VStack,{children:[l.jsx(c.Heading,{css:{marginBottom:"$6"},children:"Build a URL to pull content"}),Object.keys(n).map(t=>l.jsx(p,{fieldKey:t,values:e},t)),l.jsx("label",{children:"Result URL - paste this into your website (e.g. the WebStudio resource URL expression editor)"}),l.jsx("input",{type:"text",value:u(e)})]})})})}function I(){return l.jsx(a,{title:"Content Feeds",backPath:"/admin/collections",children:l.jsx(f,{children:l.jsx(c.VStack,{children:l.jsx(c.Card,{css:{padding:"$6"},children:l.jsx(y,{})})})})})}export{I as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.