import{n as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{n}from"./iframe-DaN-XFub.js";import{D as r,E as i,O as a,k as o}from"./odata-BtfB5Aje.js";var s,c;function l(){return(l=e((()=>{s=[{code:`R01`,text:`Северный регион`,branches:[{code:`B0101`,text:`Подразделение Альфа`,teams:[{code:`T0101`,text:`Команда поддержки`,owners:[{code:`P0001`,text:`Ответственный 1`},{code:`P0002`,text:`Ответственный 2`},{code:`P0003`,text:`Ответственный 3`}]},{code:`T0102`,text:`Команда внедрения`,owners:[{code:`P0004`,text:`Ответственный 4`},{code:`P0005`,text:`Ответственный 5`}]}]},{code:`B0102`,text:`Подразделение Бета`,teams:[{code:`T0201`,text:`Команда аналитики`,owners:[{code:`P0006`,text:`Ответственный 6`},{code:`P0007`,text:`Ответственный 7`}]}]}]},{code:`R02`,text:`Южный регион`,branches:[{code:`B0201`,text:`Подразделение Гамма`,teams:[{code:`T0301`,text:`Команда сопровождения`,owners:[{code:`P0008`,text:`Ответственный 8`},{code:`P0009`,text:`Ответственный 9`}]}]}]},{code:`R03`,text:`Восточный регион`,branches:[{code:`B0301`,text:`Подразделение Дельта`,teams:[{code:`T0401`,text:`Команда развития`,owners:[{code:`P0010`,text:`Ответственный 10`},{code:`P0011`,text:`Ответственный 11`}]}]},{code:`B0302`,text:`Подразделение Омега`,teams:[{code:`T0501`,text:`Команда качества`,owners:[{code:`P0012`,text:`Ответственный 12`},{code:`P0013`,text:`Ответственный 13`}]}]}]}],c=s.flatMap(e=>e.branches.flatMap(t=>t.teams.flatMap(n=>n.owners.map(r=>({REGION:e.code,REGION_Text:e.text,BRANCH:t.code,BRANCH_Text:t.text,TEAM:n.code,TEAM_Text:n.text,OWNER:r.code,OWNER_Text:r.text})))))})))()}function u(e,t,n=200){return new Response(e,{status:n,headers:{"Content-Type":t}})}function d(e,t){return new Promise((n,r)=>{let i=()=>{window.clearTimeout(a),r(t?.reason??new DOMException(`Ожидание OData mock отменено`,`AbortError`))},a=window.setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);if(t?.aborted){i();return}t?.addEventListener(`abort`,i,{once:!0})})}function f(e,t){for(let n of t.values())if(e.includes(`/${n.service}/`))return n}function p(){let e=window.fetch,t=new Map;return{originalFetch:e,registrations:t,registrationIdsByCanvas:new WeakMap,mockedFetch:async(n,r)=>{let i=typeof n==`string`?n:n instanceof URL?n.toString():n.url,a=new URL(i,window.location.origin).pathname,o=f(a,t);return o?(o.mode===`loading`&&await d(1200,r?.signal??(typeof Request<`u`&&n instanceof Request?n.signal:void 0)),a.endsWith(`/${o.service}/$metadata`)?o.mode===`metadataError`?u(`Ошибка чтения metadata`,`text/plain`,500):u(y,`application/xml`):a.endsWith(`/${o.service}/DemoReferenceItems`)?o.mode===`collectionError`?u(JSON.stringify({error:`Ошибка загрузки справочника`}),`application/json`,500):u(JSON.stringify({d:{results:c}}),`application/json`):e(n,r)):e(n,r)}}}function m(e){let t=e.parameters.odataMockMode??`success`,n=C??p(),r=(e.canvasElement&&n.registrationIdsByCanvas.get(e.canvasElement))??Symbol(`odata-story-fetch-mock`),i=Symbol(`odata-story-fetch-mock-version`);return C=n,e.canvasElement&&n.registrationIdsByCanvas.set(e.canvasElement,r),n.registrations.delete(r),n.registrations.set(r,{mode:t,service:S[t],version:i}),window.fetch=n.mockedFetch,()=>{n.registrations.get(r)?.version===i&&(n.registrations.delete(r),e.canvasElement&&n.registrationIdsByCanvas.delete(e.canvasElement),!(n.registrations.size>0||C!==n)&&(window.fetch===n.mockedFetch&&(window.fetch=n.originalFetch),C=void 0))}}var h,g,_,v,y,b,x,S,C,w,T,E,D,O;function k(){return(k=e((()=>{h=t(),o(),r(),l(),g=n(),_=`DEMO_REFERENCE_SRV`,v=`DemoReferenceItems`,y=`<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
	<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
		<Schema Namespace="DEMO_REFERENCE_SRV" xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:sap="http://www.sap.com/Protocols/SAPData">
			<EntityType Name="DemoReferenceItemsType" sap:semantics="aggregate" sap:label="Демо-справочник" sap:content-version="1">
				<Key>
					<PropertyRef Name="ID" />
				</Key>
				<Property Name="ID" Type="Edm.String" Nullable="false" sap:sortable="false" sap:filterable="false" />
				<Property Name="REGION" Type="Edm.String" MaxLength="4" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="REGION_Text" />
				<Property Name="REGION_Text" Type="Edm.String" MaxLength="40" sap:label="Регион" sap:quickinfo="Краткое описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="BRANCH" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="BRANCH_Text" />
				<Property Name="BRANCH_Text" Type="Edm.String" MaxLength="40" sap:label="Подразделение" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="TEAM" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="TEAM_Text" />
				<Property Name="TEAM_Text" Type="Edm.String" MaxLength="40" sap:label="Команда" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="OWNER" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="OWNER_Text" />
				<Property Name="OWNER_Text" Type="Edm.String" MaxLength="40" sap:label="Ответственный" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="CNT" Type="Edm.Byte" sap:aggregation-role="measure" sap:filterable="false" />
			</EntityType>
			<EntityContainer Name="DEMO_REFERENCE_SRV_Entities" m:IsDefaultEntityContainer="true">
				<EntitySet Name="DemoReferenceItems" EntityType="DEMO_REFERENCE_SRV.DemoReferenceItemsType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1" />
			</EntityContainer>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>`,b={region:`R01`,regionText:`Северный регион`,branch:`B0101`,branchAlt:`B0102`,team:`T0101`,teamAlt:`T0201`,owner:`P0001`,ownerAlt:`P0006`},x={REGION:{placeholder:`Регион`},BRANCH:{placeholder:`Подразделение`,hideCode:!0},TEAM:{placeholder:`Команда`},OWNER:{placeholder:`Ответственный`}},S={success:_,loading:`DEMO_REFERENCE_LOADING_SRV`,metadataError:`DEMO_REFERENCE_METADATA_ERROR_SRV`,collectionError:`DEMO_REFERENCE_COLLECTION_ERROR_SRV`},w=e=>{let t=(0,h.useMemo)(()=>new a({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}}),[]),n=e;return(0,h.useEffect)(()=>()=>{t.clear()},[t]),(0,g.jsx)(i,{client:t,children:(0,g.jsx)(n,{})})},T={service:_,target:v},E={success:T,loading:{...T,service:S.loading},metadataError:{...T,service:S.metadataError},collectionError:{...T,service:S.collectionError}},D={codeKey:`REGION`,minSearchTextLength:1,minSearchCodeLength:1,searchDebounceDelay:250,maxVisibleItems:100},O={placeholder:`Регион`},w.__docgenInfo={description:`Создаёт изолированный QueryClient без IndexedDB persistence для каждой OData story.`,methods:[],displayName:`withODataStoryQueryClient`}})))()}export{m as a,x as c,k as i,w as l,T as n,E as o,O as r,b as s,D as t};