1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[362],{991:e=>{e.exports={children:"ConstructionView_children__soPe_",child:"ConstructionView_child__ch1Q6"}},2286:(e,n,t)=>{"use strict";t.d(n,{A:()=>i,D:()=>l});var r=t(7876),a=t(9794);function i(e){let{children:n}=e;return(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"max-content 50%"},children:n})}function l(e){let{id:n,name:t,value:i,onChange:l}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.b,{htmlFor:n,children:t}),(0,r.jsx)("input",{type:"text",id:n,onChange:e=>l(e.target.value),value:i})]})}},3216:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});var r=t(1040),a=t(5344);let i=e=>r.A.get(e).then(e=>e.data);function l(e){let{data:n,error:t}=(0,a.Ay)(e,i);return{getOrEmpty:()=>n||[],fold(e){let{onLoading:r,onError:a,onReady:i}=e;return void 0!==t?a(t):void 0===n?r():i(n)}}}},3600:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});var r=t(7876),a=t(4232);let i=(0,a.createContext)(1);function l(e){let{children:n,...t}=e,l=(0,a.useContext)(i);return(0,r.jsx)("div",{className:"editor editor".concat((l-1)%4+1),...t,children:(0,r.jsx)(i.Provider,{value:l+1,children:n})})}},4285:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});var r=t(4232);function a(e){let{getVisibleChild:n,children:t}=e,[a,i]=(0,r.useState)(0);return(0,r.useEffect)(()=>{n().then(i).catch(()=>{})},[n]),t[a]}},4346:(e,n,t)=>{"use strict";t.d(n,{A:()=>f});var r=t(7876),a=t(5259),i=t(9917),l=t(2315),s=t(1040),o=t(553),c=t(4587),u=t.n(c),d=t(8230),h=t.n(d),g=t(4232),p=t(7186),x=t(6411),v=t.n(x);function f(e){let{links:n,active:t}=e,c=(0,o.useSession)();(0,g.useEffect)(()=>{var e,n;let t=null==(n=c.data)||null==(e=n.user)?void 0:e.email;t&&s.A.get("/api/users",{params:{username:t}}).then(e=>{0===e.data.length&&s.A.post("/api/users",{id:(0,p.A)(),username:t})})},[c]);let d=[(0,r.jsx)(l.N_,{className:v().NavigationMenuLink,href:"https://github.com/def-gthill/lexurgy-app",target:"_blank",rel:"noopener",children:"GitHub"},"github"),(0,r.jsx)(l.N_,{className:v().NavigationMenuLink,href:"https://ko-fi.com/meamoria",target:"_blank",rel:"noopener",children:"Donate"},"donate"),(0,r.jsx)(l.N_,{className:v().NavigationMenuLink,href:"https://lexurgy.vercel.app/sc",target:"_blank",rel:"noopener",children:"Old Version"},"old")];return(0,r.jsx)(l.bL,{className:v().NavigationMenuRoot,children:(0,r.jsxs)(l.B8,{className:v().NavigationMenuList,children:[(0,r.jsxs)("div",{className:v().leftGroup,children:[(0,r.jsx)(u(),{src:"/logo.png",alt:"",width:48,height:48}),(0,r.jsx)(l.q7,{children:(0,r.jsx)(m,{href:"/",children:"Lexurgy"})})]}),(0,r.jsx)("div",{className:v().centreGroup,children:null==n?void 0:n.map(e=>{let{label:n,url:a}=e;return(0,r.jsx)(l.q7,{children:(0,r.jsx)(m,{href:a,active:t===n,children:n})},n)})}),(0,r.jsxs)("div",{className:"".concat(v().rightGroup," ").concat(v().rightGroupWide),children:[d.map(e=>(0,r.jsx)(l.q7,{children:e},e.key)),(0,r.jsx)(l.q7,{children:(0,r.jsx)(j,{session:c})})]}),(0,r.jsxs)("div",{className:"".concat(v().rightGroup," ").concat(v().rightGroupNarrow),children:[(0,r.jsxs)(l.q7,{className:v().narrowNavTriggerItem,children:[(0,r.jsx)(l.l9,{className:"".concat(v().NavigationMenuLink," ").concat(v().narrowNavTrigger),children:(0,r.jsx)(a.sKQ,{className:v().narrowNavTriggerIcon,"aria-label":"Menu"})}),(0,r.jsx)(l.UC,{className:v().narrowNavContent,children:(0,r.jsxs)("ul",{className:v().narrowNavList,children:[n&&n.length>0&&(0,r.jsxs)(r.Fragment,{children:[null==n?void 0:n.map(e=>{let{label:n,url:a}=e;return(0,r.jsx)("li",{children:(0,r.jsx)(m,{href:a,active:t===n,children:n})},n)}),(0,r.jsx)(i.b,{className:v().narrowNavSeparator})]}),d.map(e=>(0,r.jsx)("li",{children:e},e.key))]})})]}),(0,r.jsx)(l.q7,{children:(0,r.jsx)(j,{session:c})})]})]})})}function m(e){let{href:n,...t}=e;return(0,r.jsx)(h(),{href:n,passHref:!0,legacyBehavior:!0,children:(0,r.jsx)(l.N_,{className:v().NavigationMenuLink,...t})})}function j(e){var n;let{session:t}=e;return(null==(n=t.data)?void 0:n.user)?(0,r.jsx)(l.N_,{className:v().NavigationMenuLink,href:"#",onSelect:()=>{(0,o.signOut)()},children:"Sign Out"}):(0,r.jsx)(l.N_,{className:v().NavigationMenuLink,href:"/api/auth/signin?callbackUrl=%2Fsc",children:"Sign In"})}},4767:(e,n,t)=>{"use strict";t.d(n,{A:()=>h});var r=t(7876),a=t(4285),i=t(4346),l=t(3216),s=t(1040),o=t(9099),c=t(5344);let u=e=>s.A.get(e).then(e=>e.data);function d(e){var n;let{id:t,active:a,glitchCount:l}=e,s=[{label:"Main",url:"/language/".concat(t)},{label:"Lexicon",url:"/language/".concat(t,"/lexicon")},{label:"Syntax",url:"/language/".concat(t,"/syntax")},{label:"Evolution",url:"/language/".concat(t,"/sc")},{label:"Settings",url:"/language/".concat(t,"/settings")}];return l&&s.push({label:0===(n=l)?"No Glitches":1===n?"1 Glitch":"".concat(n," Glitches"),url:"/language/".concat(t,"/glitches")}),(0,r.jsx)(i.A,{links:s,active:a})}
1function h(e){let{content:n,activeLink:t}=e,{language:l,error:d}=function(){let e=(0,o.useRouter)(),n=e.query.id,{data:t,error:r}=(0,c.Ay)(e.isReady?"/api/languages/".concat(n):null,u);return{language:t,error:r}}();return void 0!==l?(0,r.jsxs)(a.A,{getVisibleChild:async()=>+!!(await s.A.get("/api/userType")).data.hasExperimentalAccess,children:[(0,r.jsx)(g,{language:l,content:n,activeLink:t,showLinks:!1}),(0,r.jsx)(g,{language:l,content:n,activeLink:t})]}):void 0!==d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.A,{}),(0,r.jsx)("main",{children:(0,r.jsx)("div",{children:"Language not found"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.A,{}),(0,r.jsx)("main",{children:(0,r.jsx)("div",{children:"Loading language..."})})]})}function g(e){let{language:n,content:t,activeLink:a,showLinks:s=!0}=e,o=(0,l.A)("/api/glitches?language=".concat(n.id)).getOrEmpty().length;return(0,r.jsxs)(r.Fragment,{children:[s?(0,r.jsx)(d,{id:n.id,active:a,glitchCount:o}):(0,r.jsx)(i.A,{}),t(n)]})}},4978:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});var r=t(1040),a=t(5344);let i=e=>r.A.get(e).then(e=>e.data);function l(e,n){n=n||e;let{data:t,error:l}=(0,a.Ay)(n,i),{mutate:s}=(0,a.iX)();return{getOrEmpty:()=>t||[],fold(e){let{onLoading:n,onError:r,onReady:a}=e;return void 0!==l?r(l):void 0===t?n():a(t)},async save(t){let a=(await r.A.post(e,t)).data;return s(n),a},async delete(t){let a="".concat(e,"/").concat(t);await r.A.delete(a),s(n)}}}},6411:e=>{e.exports={NavigationMenuRoot:"Header_NavigationMenuRoot__RK7yu",NavigationMenuList:"Header_NavigationMenuList__uW5nl",leftGroup:"Header_leftGroup__Ev_37",centreGroup:"Header_centreGroup__iizFk",rightGroup:"Header_rightGroup__g_QQr",rightGroupNarrow:"Header_rightGroupNarrow__YxiQv",NavigationMenuLink:"Header_NavigationMenuLink__18B14",narrowNavTriggerItem:"Header_narrowNavTriggerItem__QtqD4",narrowNavTriggerIcon:"Header_narrowNavTriggerIcon__YAEU9",narrowNavContent:"Header_narrowNavContent__WQ35k",narrowNavList:"Header_narrowNavList__n3zTJ",narrowNavSeparator:"Header_narrowNavSeparator__cD578",rightGroupWide:"Header_rightGroupWide__NY7es"}},6559:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>v});var r=t(7876),a=t(7598),i=t(4767),l=t(6689),s=t(2286);function o(e){let{construction:n,onChange:t}=e;return(0,r.jsx)("div",{children:(0,r.jsxs)(s.A,{children:[(0,r.jsx)(s.D,{id:"name",name:"Construction Name",value:n.name,onChange:e=>t({...n,name:e})}),(0,r.jsx)(r.Fragment,{children:n.children.map((e,a)=>(0,r.jsx)(s.D,{id:"slot".concat(a+1),name:"Slot ".concat(a+1),value:e,onChange:e=>t({...n,children:(0,l.hZ)(n.children,a,e)})},a+1))}),(0,r.jsx)(r.Fragment,{children:n.children.at(-1)&&(0,r.jsx)("div",{className:"buttons",children:(0,r.jsx)("button",{onClick:()=>t({...n,children:[...n.children,""]}),children:"Add Slot"})})})]})})}var c=t(991),u=t.n(c);function d(e){let{construction:n}=e;return(0,r.jsxs)("div",{className:"card",children:[n.name&&(0,r.jsx)("div",{children:n.name}),(0,r.jsx)("div",{className:u().children,children:n.children.map(e=>(0,r.jsx)("div",{className:u().child,children:e},e))})]})}var h=t(4978),g=t(7328),p=t.n(g),x=t(9099);let v=function(){let e=(0,x.useRouter)().query.id,n=(0,h.A)("/api/constructions","/api/constructions?language=".concat(e)),t=n.getOrEmpty();return(0,r.jsx)(i.A,{activeLink:"Syntax",content:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(p(),{children:[(0,r.jsxs)("title",{children:["Lexurgy - ",e.name," Syntax"]}),(0,r.jsx)("meta",{name:"description",content:'"Syntax for '.concat(e.name,', a constructed language"')})]}),(0,r.jsxs)("main",{children:[(0,r.jsxs)("h1",{children:[e.name," Syntax"]}),(0,r.jsx)(a.A,{showButtonLabel:"Add Construction",component:(e,n)=>(0,r.jsx)(o,{construction:e,onChange:n}),initialValue:{languageId:e.id,name:"",children:[""]},onSave:e=>{n.save(e)}}),t.map(e=>(0,r.jsx)(d,{construction:e},e.id))]})]})})}},6689:(e,n,t)=>{"use strict";function r(e,n,t){let r=[...e];return r[n]=t,r}function a(e,n){0!==e.length&&e.push(n(e.pop()))}function i(e,n){return[...new Map([...e,n])]}t.d(n,{AP:()=>i,hZ:()=>r,vh:()=>a})},7598:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});var r=t(7876),a=t(3600),i=t(4232);function l(e){let{showButtonLabel:n,component:t,initialValue:l,onSave:s,startsShowing:o,hideLabelWhenOpen:c}=e,[u,d]=(0,i.useState)(o),[h,g]=(0,i.useState)(l);return u?(0,r.jsxs)(a.A,{children:[!c&&(0,r.jsx)("h4",{style:{marginTop:0},children:n}
1),t(h,g),(0,r.jsxs)("div",{className:"buttons",children:[(0,r.jsx)("button",{onClick:()=>{s(h),d(!1),g(l)},children:"Save"}),(0,r.jsx)("button",{onClick:()=>{d(!1)},children:"Cancel"})]})]}):(0,r.jsx)("div",{style:{margin:"4px 0"},children:(0,r.jsx)("button",{onClick:()=>d(!0),children:n})})}},8124:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/language/[id]/syntax",function(){return t(6559)}])},9099:(e,n,t)=>{e.exports=t(6296)},9794:(e,n,t)=>{"use strict";t.d(n,{b:()=>g});var r=t(4232),a=t.t(r,2);function i(e,n){if("function"==typeof e)return e(n);null!=e&&(e.current=n)}t(8477);var l=Symbol.for("radix.slottable"),s=Symbol.for("react.lazy");function o(e){var n;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===s&&"_payload"in e&&"object"==typeof(n=e._payload)&&null!==n&&"then"in n}var c=a[" use ".trim().toString()],u=t(7876),d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{let t=function(e){let n=r.forwardRef((n,t)=>{var a;let s,u,{children:d,...h}=n,g=null,p=!1,x=[];o(d)&&"function"==typeof c&&(d=c(d._payload)),r.Children.forEach(d,e=>{var n;if(n=e,r.isValidElement(n)&&"function"==typeof n.type&&"__radixId"in n.type&&n.type.__radixId===l){p=!0;let n="child"in e.props?e.props.child:e.props.children;o(n)&&"function"==typeof c&&(n=c(n._payload)),g=((e,n)=>{if("child"in e.props){let n=e.props.child;return r.isValidElement(n)?r.cloneElement(n,void 0,e.props.children(n.props.children)):null}return r.isValidElement(n)?n:null})(e,n),x.push(g?.props?.children)}else x.push(e)}),g?g=r.cloneElement(g,void 0,x):!p&&1===r.Children.count(d)&&r.isValidElement(d)&&(g=d);let v=g?(a=g,(u=(s=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in s&&s.isReactWarning)?a.ref:(u=(s=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in s&&s.isReactWarning)?a.props.ref:a.props.ref||a.ref):void 0,f=function(...e){return r.useCallback(function(...e){return n=>{let t=!1,r=e.map(e=>{let r=i(e,n);return t||"function"!=typeof r||(t=!0),r});if(t)return()=>{for(let n=0;n<r.length;n++){let t=r[n];"function"==typeof t?t():i(e[n],null)}}}}(...e),e)}(t,v);if(!g){if(d||0===d){let n,t;throw Error(p?(n=e,`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`):(t=e,`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`))}return d}let m=function(e,n){let t={...n};for(let r in n){let a=e[r],i=n[r];/^on[A-Z]/.test(r)?a&&i?t[r]=(...e)=>{let n=i(...e);return a(...e),n}:a&&(t[r]=a):"style"===r?t[r]={...a,...i}:"className"===r&&(t[r]=[a,i].filter(Boolean).join(" "))}return{...e,...t}}(h,g.props??{});return g.type!==r.Fragment&&(m.ref=t?f:v),r.cloneElement(g,m)});return n.displayName=`${e}.Slot`,n}(`Primitive.${n}`),a=r.forwardRef((e,r)=>{let{asChild:a,...i}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,u.jsx)(a?t:n,{...i,ref:r})});return a.displayName=`Primitive.${n}`,{...e,[n]:a}},{}),h=r.forwardRef((e,n)=>(0,u.jsx)(d.label,{...e,ref:n,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));h.displayName="Label";var g=h}},e=>{e.O(0,[587,240,344,636,593,792],()=>e(e.s=8124)),_N_E=e.O()}]);
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.